[QGIS Commit] r9620 - in trunk/qgis: python/core src/app src/core
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Tue Nov 11 08:13:13 EST 2008
Author: wonder
Date: 2008-11-11 08:13:13 -0500 (Tue, 11 Nov 2008)
New Revision: 9620
Modified:
trunk/qgis/python/core/qgsvectorlayer.sip
trunk/qgis/src/app/qgsmaptoolidentify.cpp
trunk/qgis/src/core/qgsvectorlayer.cpp
trunk/qgis/src/core/qgsvectorlayer.h
Log:
QgsVectorLayer::featureAtId() - use the same semantics as QgsVectorDataProvider::featureAtId()
i.e. return true on success
Modified: trunk/qgis/python/core/qgsvectorlayer.sip
===================================================================
--- trunk/qgis/python/core/qgsvectorlayer.sip 2008-11-10 19:40:00 UTC (rev 9619)
+++ trunk/qgis/python/core/qgsvectorlayer.sip 2008-11-11 13:13:13 UTC (rev 9620)
@@ -166,8 +166,8 @@
/**Gets the feature at the given feature id. Considers the changed, added, deleted and permanent features
- @return 0 in case of success*/
- int featureAtId(int featureId, QgsFeature& f, bool fetchGeometries = true, bool fetchAttributes = true);
+ @return true in case of success*/
+ bool featureAtId(int featureId, QgsFeature& f, bool fetchGeometries = true, bool fetchAttributes = true);
/** Adds a feature
@param alsoUpdateExtent If True, will also go to the effort of e.g. updating the extents.
Modified: trunk/qgis/src/app/qgsmaptoolidentify.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptoolidentify.cpp 2008-11-10 19:40:00 UTC (rev 9619)
+++ trunk/qgis/src/app/qgsmaptoolidentify.cpp 2008-11-11 13:13:13 UTC (rev 9620)
@@ -451,7 +451,7 @@
mRubberBand = 0;
QgsFeature feat;
- if ( layer->featureAtId( featureId, feat, true, false ) != 0 )
+ if ( ! layer->featureAtId( featureId, feat, true, false ) )
{
return;
}
Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp 2008-11-10 19:40:00 UTC (rev 9619)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp 2008-11-11 13:13:13 UTC (rev 9620)
@@ -1301,13 +1301,13 @@
return false;
}
-int QgsVectorLayer::featureAtId( int featureId, QgsFeature& f, bool fetchGeometries, bool fetchAttributes )
+bool QgsVectorLayer::featureAtId( int featureId, QgsFeature& f, bool fetchGeometries, bool fetchAttributes )
{
if ( !mDataProvider )
- return 1;
+ return false;
if ( mDeletedFeatureIds.contains( featureId ) )
- return 2;
+ return false;
if ( fetchGeometries && mChangedGeometries.contains( featureId ) )
{
@@ -1359,7 +1359,7 @@
if ( fetchAttributes )
f.setAttributeMap( iter->attributeMap() );
- return 0;
+ return true;
}
}
@@ -1369,17 +1369,17 @@
if ( mDataProvider->featureAtId( featureId, f, fetchGeometries, mDataProvider->attributeIndexes() ) )
{
updateFeatureAttributes( f );
- return 0;
+ return true;
}
}
else
{
if ( mDataProvider->featureAtId( featureId, f, fetchGeometries, QgsAttributeList() ) )
{
- return 0;
+ return true;
}
}
- return 3;
+ return false;
}
bool QgsVectorLayer::addFeature( QgsFeature& f, bool alsoUpdateExtent )
Modified: trunk/qgis/src/core/qgsvectorlayer.h
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.h 2008-11-10 19:40:00 UTC (rev 9619)
+++ trunk/qgis/src/core/qgsvectorlayer.h 2008-11-11 13:13:13 UTC (rev 9620)
@@ -225,8 +225,8 @@
bool nextFeature( QgsFeature& feature );
/**Gets the feature at the given feature id. Considers the changed, added, deleted and permanent features
- @return 0 in case of success*/
- int featureAtId( int featureId, QgsFeature &f, bool fetchGeometries = true, bool fetchAttributes = true );
+ @return true in case of success*/
+ bool featureAtId( int featureId, QgsFeature &f, bool fetchGeometries = true, bool fetchAttributes = true );
/** Adds a feature
@param lastFeatureInBatch If True, will also go to the effort of e.g. updating the extents.
More information about the QGIS-commit
mailing list