Skip to content
Permalink
Browse files
QgsVectorLayer::featureAtId() - use the same semantics as QgsVectorDa…
…taProvider::featureAtId()

i.e. return true on success


git-svn-id: http://svn.osgeo.org/qgis/trunk@9620 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Nov 11, 2008
1 parent bb63eac commit 92219741598915ac249f4fc5171ae77f4cf8ec4b
Showing with 12 additions and 12 deletions.
  1. +2 −2 python/core/qgsvectorlayer.sip
  2. +1 −1 src/app/qgsmaptoolidentify.cpp
  3. +7 −7 src/core/qgsvectorlayer.cpp
  4. +2 −2 src/core/qgsvectorlayer.h
@@ -166,8 +166,8 @@ public:


/**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.
@@ -451,7 +451,7 @@ void QgsMapToolIdentify::highlightFeature( int featureId )
mRubberBand = 0;

QgsFeature feat;
if ( layer->featureAtId( featureId, feat, true, false ) != 0 )
if ( ! layer->featureAtId( featureId, feat, true, false ) )
{
return;
}
@@ -1301,13 +1301,13 @@ bool QgsVectorLayer::nextFeature( QgsFeature &f )
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 @@ int QgsVectorLayer::featureAtId( int featureId, QgsFeature& f, bool fetchGeometr
if ( fetchAttributes )
f.setAttributeMap( iter->attributeMap() );

return 0;
return true;
}
}

@@ -1369,17 +1369,17 @@ int QgsVectorLayer::featureAtId( int featureId, QgsFeature& f, bool fetchGeometr
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 )
@@ -225,8 +225,8 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
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.

0 comments on commit 9221974

Please sign in to comment.