Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
QgsVectorLayer::featureAtId() - use the same semantics as QgsVectorDa…
- Loading branch information
|
@@ -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. |
|
|