[QGIS Commit] r9506 - in trunk/qgis: python/core src/app src/core
src/core/spatialindex src/plugins/grass
src/providers/postgres src/providers/wfs
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon Oct 20 17:44:16 EDT 2008
Author: timlinux
Date: 2008-10-20 17:44:15 -0400 (Mon, 20 Oct 2008)
New Revision: 9506
Modified:
trunk/qgis/python/core/qgsfeature.sip
trunk/qgis/src/app/qgsattributetable.cpp
trunk/qgis/src/app/qgsattributetabledisplay.cpp
trunk/qgis/src/app/qgsmaptoolidentify.cpp
trunk/qgis/src/app/qgsmaptoolmovefeature.cpp
trunk/qgis/src/core/qgsfeature.cpp
trunk/qgis/src/core/qgsfeature.h
trunk/qgis/src/core/qgsvectordataprovider.cpp
trunk/qgis/src/core/qgsvectorfilewriter.cpp
trunk/qgis/src/core/qgsvectorlayer.cpp
trunk/qgis/src/core/spatialindex/qgsspatialindex.cpp
trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp
trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
trunk/qgis/src/providers/wfs/qgswfsprovider.cpp
Log:
Api cleanups for qgsfeature
Modified: trunk/qgis/python/core/qgsfeature.sip
===================================================================
--- trunk/qgis/python/core/qgsfeature.sip 2008-10-20 21:35:05 UTC (rev 9505)
+++ trunk/qgis/python/core/qgsfeature.sip 2008-10-20 21:44:15 UTC (rev 9506)
@@ -24,7 +24,7 @@
* Get the feature id for this feature
* @return Feature id
*/
- int featureId() const;
+ int id() const;
/**
* Set the feature id for this feature
@@ -87,7 +87,7 @@
* Reset the dirtiness of the feature. (i.e. make clean)
* You would normally do this after it's saved to permanent storage (e.g. disk, an ACID-compliant database)
*/
- void resetDirty();
+ void clean();
/**
* Get the geometry object associated with this feature
Modified: trunk/qgis/src/app/qgsattributetable.cpp
===================================================================
--- trunk/qgis/src/app/qgsattributetable.cpp 2008-10-20 21:35:05 UTC (rev 9505)
+++ trunk/qgis/src/app/qgsattributetable.cpp 2008-10-20 21:44:15 UTC (rev 9506)
@@ -501,7 +501,7 @@
}
//id-field
- int id = fet.featureId();
+ int id = fet.id();
QTableWidgetItem *twi = new QTableWidgetItem( QString::number( id ) );
twi->setTextAlignment( Qt::AlignRight | Qt::AlignVCenter );
setItem( row, 0, twi );
Modified: trunk/qgis/src/app/qgsattributetabledisplay.cpp
===================================================================
--- trunk/qgis/src/app/qgsattributetabledisplay.cpp 2008-10-20 21:35:05 UTC (rev 9505)
+++ trunk/qgis/src/app/qgsattributetabledisplay.cpp 2008-10-20 21:44:15 UTC (rev 9506)
@@ -379,7 +379,7 @@
{
if ( searchTree->checkAgainst( mLayer->pendingFields(), f.attributeMap() ) )
{
- mSearchIds << f.featureId();
+ mSearchIds << f.id();
}
// check if there were errors during evaluating
Modified: trunk/qgis/src/app/qgsmaptoolidentify.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptoolidentify.cpp 2008-10-20 21:35:05 UTC (rev 9505)
+++ trunk/qgis/src/app/qgsmaptoolidentify.cpp 2008-10-20 21:44:15 UTC (rev 9506)
@@ -317,12 +317,12 @@
featureCount++;
QTreeWidgetItem* featureNode = mResults->addNode( "foo" );
- featureNode->setData( 0, Qt::UserRole, QVariant( f_it->featureId() ) ); // save feature id
- lastFeatureId = f_it->featureId();
+ featureNode->setData( 0, Qt::UserRole, QVariant( f_it->id() ) ); // save feature id
+ lastFeatureId = f_it->id();
featureNode->setText( 0, fieldIndex );
if ( layer->isEditable() )
- mResults->addEdit( featureNode, f_it->featureId() );
+ mResults->addEdit( featureNode, f_it->id() );
const QgsAttributeMap& attr = f_it->attributeMap();
@@ -476,7 +476,7 @@
{
for ( QgsFeatureList::iterator it = mFeatureList.begin(); it != mFeatureList.end(); it++ )
{
- if ( it->featureId() == featureId )
+ if ( it->id() == featureId )
{
editFeature( *it );
break;
@@ -503,7 +503,7 @@
for ( QgsAttributeMap::const_iterator it = dst.begin(); it != dst.end(); it++ )
{
if ( !src.contains( it.key() ) || it.value() != src[it.key()] )
- layer->changeAttributeValue( f.featureId(), it.key(), it.value() );
+ layer->changeAttributeValue( f.id(), it.key(), it.value() );
}
}
delete ad;
Modified: trunk/qgis/src/app/qgsmaptoolmovefeature.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptoolmovefeature.cpp 2008-10-20 21:35:05 UTC (rev 9505)
+++ trunk/qgis/src/app/qgsmaptoolmovefeature.cpp 2008-10-20 21:44:15 UTC (rev 9506)
@@ -107,7 +107,7 @@
}
mStartPointMapCoords = toMapCoordinates( e->pos() );
- mMovedFeature = cf.featureId(); //todo: take the closest feature, not the first one...
+ mMovedFeature = cf.id(); //todo: take the closest feature, not the first one...
mRubberBand = createRubberBand();
mRubberBand->setToGeometry( cf.geometry(), *vlayer );
mRubberBand->setColor( Qt::red );
Modified: trunk/qgis/src/core/qgsfeature.cpp
===================================================================
--- trunk/qgis/src/core/qgsfeature.cpp 2008-10-20 21:35:05 UTC (rev 9505)
+++ trunk/qgis/src/core/qgsfeature.cpp 2008-10-20 21:44:15 UTC (rev 9506)
@@ -84,7 +84,7 @@
* Get the feature id for this feature
* @return Feature id
*/
-int QgsFeature::featureId() const
+int QgsFeature::id() const
{
return mFid;
}
@@ -204,7 +204,7 @@
return mDirty;
}
-void QgsFeature::resetDirty()
+void QgsFeature::clean()
{
mDirty = false;
}
Modified: trunk/qgis/src/core/qgsfeature.h
===================================================================
--- trunk/qgis/src/core/qgsfeature.h 2008-10-20 21:35:05 UTC (rev 9505)
+++ trunk/qgis/src/core/qgsfeature.h 2008-10-20 21:44:15 UTC (rev 9506)
@@ -66,7 +66,7 @@
* Get the feature id for this feature
* @return Feature id
*/
- int featureId() const;
+ int id() const;
/**
* Set the feature id for this feature
@@ -128,7 +128,7 @@
* Reset the dirtiness of the feature. (i.e. make clean)
* You would normally do this after it's saved to permanent storage (e.g. disk, an ACID-compliant database)
*/
- void resetDirty();
+ void clean();
/**
* Get the geometry object associated with this feature
Modified: trunk/qgis/src/core/qgsvectordataprovider.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectordataprovider.cpp 2008-10-20 21:35:05 UTC (rev 9505)
+++ trunk/qgis/src/core/qgsvectordataprovider.cpp 2008-10-20 21:44:15 UTC (rev 9506)
@@ -56,7 +56,7 @@
while ( nextFeature( feature ) )
{
- if ( feature.featureId() == featureId )
+ if ( feature.id() == featureId )
return TRUE;
}
Modified: trunk/qgis/src/core/qgsvectorfilewriter.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorfilewriter.cpp 2008-10-20 21:35:05 UTC (rev 9505)
+++ trunk/qgis/src/core/qgsvectorfilewriter.cpp 2008-10-20 21:44:15 UTC (rev 9506)
@@ -348,7 +348,7 @@
// write all features
while ( provider->nextFeature( fet ) )
{
- if ( onlySelected && !ids.contains( fet.featureId() ) )
+ if ( onlySelected && !ids.contains( fet.id() ) )
continue;
if ( shallTransform )
Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp 2008-10-20 21:35:05 UTC (rev 9505)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp 2008-10-20 21:44:15 UTC (rev 9506)
@@ -318,7 +318,7 @@
{
if ( mRenderer->willRenderFeature( &fet ) )
{
- bool sel = mSelectedFeatureIds.contains( fet.featureId() );
+ bool sel = mSelectedFeatureIds.contains( fet.id() );
mLabel->renderLabel( p, viewExtent, ct, theMapToPixelTransform, fet, sel, 0, scale );
}
featureCount++;
@@ -742,13 +742,13 @@
if ( mEditable )
{
// Cache this for the use of (e.g.) modifying the feature's uncommitted geometry.
- mCachedGeometries[fet.featureId()] = *fet.geometry();
+ mCachedGeometries[fet.id()] = *fet.geometry();
}
// check if feature is selected
// only show selections of the current layer
// TODO: create a mechanism to let layer know whether it's current layer or not [MD]
- bool sel = mSelectedFeatureIds.contains( fet.featureId() );
+ bool sel = mSelectedFeatureIds.contains( fet.id() );
//QgsDebugMsg(QString("markerScale before renderFeature(): %1").arg(markerScaleFactor));
// markerScalerFactore reflects the wanted scaling of the marker
@@ -843,7 +843,7 @@
QgsFeature f;
while ( nextFeature( f ) )
{
- select( f.featureId(), false ); // don't emit signal (not to redraw it everytime)
+ select( f.id(), false ); // don't emit signal (not to redraw it everytime)
}
emit selectionChanged(); // now emit signal to redraw layer
@@ -861,7 +861,7 @@
QgsFeature fet;
while ( nextFeature( fet ) )
{
- select( fet.featureId(), false ); // don't emit signal
+ select( fet.id(), false ); // don't emit signal
}
for ( QgsFeatureIds::iterator iter = tmp.begin(); iter != tmp.end(); ++iter )
@@ -994,7 +994,7 @@
QgsFeature fet;
while ( nextFeature( fet ) )
{
- if ( mSelectedFeatureIds.contains( fet.featureId() ) )
+ if ( mSelectedFeatureIds.contains( fet.id() ) )
{
if ( fet.geometry() )
{
@@ -1128,9 +1128,9 @@
void QgsVectorLayer::updateFeatureAttributes( QgsFeature &f )
{
- if ( mChangedAttributeValues.contains( f.featureId() ) )
+ if ( mChangedAttributeValues.contains( f.id() ) )
{
- const QgsAttributeMap &map = mChangedAttributeValues[f.featureId()];
+ const QgsAttributeMap &map = mChangedAttributeValues[f.id()];
for ( QgsAttributeMap::const_iterator it = map.begin(); it != map.end(); it++ )
f.changeAttribute( it.key(), it.value() );
}
@@ -1141,8 +1141,8 @@
void QgsVectorLayer::updateFeatureGeometry( QgsFeature &f )
{
- if ( mChangedGeometries.contains( f.featureId() ) )
- f.setGeometry( mChangedGeometries[f.featureId()] );
+ if ( mChangedGeometries.contains( f.id() ) )
+ f.setGeometry( mChangedGeometries[f.id()] );
}
@@ -1234,7 +1234,7 @@
for ( QgsFeatureList::iterator it = mAddedFeatures.begin(); it != mAddedFeatures.end(); it++ )
{
- if ( fid != it->featureId() )
+ if ( fid != it->id() )
{
found = true;
f.setAttributeMap( it->attributeMap() );
@@ -1243,7 +1243,7 @@
}
if ( !found )
- QgsLogger::warning( QString( "No attributes for the added feature %1 found" ).arg( f.featureId() ) );
+ QgsLogger::warning( QString( "No attributes for the added feature %1 found" ).arg( f.id() ) );
}
else
{
@@ -1265,7 +1265,7 @@
for ( ; mFetchAddedFeaturesIt != mAddedFeatures.end(); mFetchAddedFeaturesIt++ )
{
- int fid = mFetchAddedFeaturesIt->featureId();
+ int fid = mFetchAddedFeaturesIt->id();
if ( mFetchConsidered.contains( fid ) )
// must have changed geometry outside rectangle
@@ -1297,7 +1297,7 @@
while ( dataProvider()->nextFeature( f ) )
{
- if ( mFetchConsidered.contains( f.featureId() ) )
+ if ( mFetchConsidered.contains( f.id() ) )
continue;
if ( mEditable )
@@ -1333,7 +1333,7 @@
for ( QgsFeatureList::iterator it = mAddedFeatures.begin(); it != mAddedFeatures.end(); it++ )
{
- if ( featureId != it->featureId() )
+ if ( featureId != it->id() )
{
found = true;
f.setAttributeMap( it->attributeMap() );
@@ -1342,7 +1342,7 @@
}
if ( !found )
- QgsLogger::warning( QString( "No attributes for the added feature %1 found" ).arg( f.featureId() ) );
+ QgsLogger::warning( QString( "No attributes for the added feature %1 found" ).arg( f.id() ) );
}
else
{
@@ -1359,9 +1359,9 @@
//added features
for ( QgsFeatureList::iterator iter = mAddedFeatures.begin(); iter != mAddedFeatures.end(); ++iter )
{
- if ( iter->featureId() == featureId )
+ if ( iter->id() == featureId )
{
- f.setFeatureId( iter->featureId() );
+ f.setFeatureId( iter->id() );
if ( fetchGeometries )
f.setGeometry( *iter->geometry() );
@@ -1574,7 +1574,7 @@
addRingReturnCode = f.geometry()->addRing( ring );
if ( addRingReturnCode == 0 )
{
- mChangedGeometries.insert( f.featureId(), *f.geometry() );
+ mChangedGeometries.insert( f.id(), *f.geometry() );
setModified( true, true );
break;
}
@@ -1610,7 +1610,7 @@
//look if id of selected feature belongs to an added feature
for ( QgsFeatureList::iterator addedIt = mAddedFeatures.begin(); addedIt != mAddedFeatures.end(); ++addedIt )
{
- if ( addedIt->featureId() == selectedFeatureId )
+ if ( addedIt->id() == selectedFeatureId )
{
return addedIt->geometry()->addIsland( ring );
}
@@ -1644,7 +1644,7 @@
//look if id of selected feature belongs to an added feature
for ( QgsFeatureList::iterator addedIt = mAddedFeatures.begin(); addedIt != mAddedFeatures.end(); ++addedIt )
{
- if ( addedIt->featureId() == featureId )
+ if ( addedIt->id() == featureId )
{
return addedIt->geometry()->translate( dx, dy );
}
@@ -1729,7 +1729,7 @@
if ( splitFunctionReturn == 0 )
{
//change this geometry
- mChangedGeometries.insert( select_it->featureId(), *( select_it->geometry() ) );
+ mChangedGeometries.insert( select_it->id(), *( select_it->geometry() ) );
//insert new features
for ( int i = 0; i < newGeometries.size(); ++i )
@@ -2504,7 +2504,7 @@
{
// updated added feature
int i;
- for ( i = 0; i < mAddedFeatures.size() && mAddedFeatures[i].featureId() != fid; i++ )
+ for ( i = 0; i < mAddedFeatures.size() && mAddedFeatures[i].id() != fid; i++ )
;
if ( i == mAddedFeatures.size() )
@@ -2783,21 +2783,21 @@
{
for ( QgsFeatureList::iterator iter = mAddedFeatures.begin(); iter != mAddedFeatures.end(); ++iter )
{
- if ( mDeletedFeatureIds.contains( iter->featureId() ) )
+ if ( mDeletedFeatureIds.contains( iter->id() ) )
{
- mDeletedFeatureIds.remove( iter->featureId() );
+ mDeletedFeatureIds.remove( iter->id() );
- if ( mChangedGeometries.contains( iter->featureId() ) )
- mChangedGeometries.remove( iter->featureId() );
+ if ( mChangedGeometries.contains( iter->id() ) )
+ mChangedGeometries.remove( iter->id() );
mAddedFeatures.erase( iter );
continue;
}
- if ( mChangedGeometries.contains( iter->featureId() ) )
+ if ( mChangedGeometries.contains( iter->id() ) )
{
- iter->setGeometry( mChangedGeometries.take( iter->featureId() ) );
+ iter->setGeometry( mChangedGeometries.take( iter->id() ) );
}
}
@@ -2973,7 +2973,7 @@
// Check this selected item against the uncommitted added features
for ( QgsFeatureList::iterator iter = mAddedFeatures.begin(); iter != mAddedFeatures.end(); ++iter )
{
- if ( *it == iter->featureId() )
+ if ( *it == iter->id() )
{
feat = QgsFeature( *iter );
selectionIsAddedFeature = TRUE;
@@ -3024,7 +3024,7 @@
if ( makeSelected )
{
- mSelectedFeatureIds.insert( iter->featureId() );
+ mSelectedFeatureIds.insert( iter->id() );
}
}
@@ -3146,7 +3146,7 @@
QgsFeature f;
while ( nextFeature( f ) )
{
- snapToGeometry( startPoint, f.featureId(), f.geometry(), sqrSnappingTolerance, snappingResults, snap_to );
+ snapToGeometry( startPoint, f.id(), f.geometry(), sqrSnappingTolerance, snappingResults, snap_to );
++n;
}
Modified: trunk/qgis/src/core/spatialindex/qgsspatialindex.cpp
===================================================================
--- trunk/qgis/src/core/spatialindex/qgsspatialindex.cpp 2008-10-20 21:35:05 UTC (rev 9505)
+++ trunk/qgis/src/core/spatialindex/qgsspatialindex.cpp 2008-10-20 21:44:15 UTC (rev 9506)
@@ -94,7 +94,7 @@
if ( !g )
return false;
- id = f.featureId();
+ id = f.id();
r = rectToRegion( g->boundingBox() );
return true;
}
Modified: trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp 2008-10-20 21:35:05 UTC (rev 9505)
+++ trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp 2008-10-20 21:44:15 UTC (rev 9506)
@@ -2967,7 +2967,7 @@
int i = 0;
while ( provider->nextFeature( feature ) )
{
- if ( !selected.contains( feature.featureId() ) )
+ if ( !selected.contains( feature.id() ) )
continue;
QgsAttributeMap attr = feature.attributeMap();
Modified: trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp 2008-10-20 21:35:05 UTC (rev 9505)
+++ trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp 2008-10-20 21:44:15 UTC (rev 9506)
@@ -616,7 +616,7 @@
{
feature.setGeometryAndOwnership( 0, 0 );
}
- feature.setFeatureId( mFeatureQueue.front().featureId() );
+ feature.setFeatureId( mFeatureQueue.front().id() );
feature.setAttributeMap( mFeatureQueue.front().attributeMap() );
mFeatureQueue.pop();
Modified: trunk/qgis/src/providers/wfs/qgswfsprovider.cpp
===================================================================
--- trunk/qgis/src/providers/wfs/qgswfsprovider.cpp 2008-10-20 21:35:05 UTC (rev 9505)
+++ trunk/qgis/src/providers/wfs/qgswfsprovider.cpp 2008-10-20 21:44:15 UTC (rev 9506)
@@ -72,7 +72,7 @@
return 0;
}
- feature.setFeatureId( mFeatures[*mFeatureIterator]->featureId() );
+ feature.setFeatureId( mFeatures[*mFeatureIterator]->id() );
if ( mFetchGeom )
{
QgsGeometry* geometry = mFeatures[*mFeatureIterator]->geometry();
@@ -305,7 +305,7 @@
for ( QList<QgsFeature*>::iterator it = mFeatures.begin(); it != mFeatures.end(); ++it )
{
- QgsDebugMsg( "feature " + QString::number(( *it )->featureId() ) );
+ QgsDebugMsg( "feature " + QString::number(( *it )->id() ) );
mSpatialIndex->insertFeature( **it );
}
More information about the QGIS-commit
mailing list