Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
add QgsVectorLayer::getGeometry(fid) (#8174)
* add QgsVectorLayer::getGeometry(fid)
* update docs to say geom is invalid
- Loading branch information
|
@@ -1054,6 +1054,12 @@ Query the layer for features matching a given expression. |
|
|
%Docstring |
|
|
Query the layer for the feature with the given id. |
|
|
If there is no such feature, the returned feature will be invalid. |
|
|
%End |
|
|
|
|
|
QgsGeometry getGeometry( QgsFeatureId fid ) const; |
|
|
%Docstring |
|
|
Query the layer for the geometry at the given id. |
|
|
If there is no such feature, the returned geometry will be invalid. |
|
|
%End |
|
|
|
|
|
QgsFeatureIterator getFeatures( const QgsFeatureIds &fids ); |
|
|
|
@@ -941,6 +941,16 @@ QgsFeatureIterator QgsVectorLayer::getFeatures( const QgsFeatureRequest &request |
|
|
return QgsFeatureIterator( new QgsVectorLayerFeatureIterator( new QgsVectorLayerFeatureSource( this ), true, request ) ); |
|
|
} |
|
|
|
|
|
QgsGeometry QgsVectorLayer::getGeometry( QgsFeatureId fid ) const |
|
|
{ |
|
|
QgsFeature feature; |
|
|
getFeatures( QgsFeatureRequest( fid ).setFlags( QgsFeatureRequest::SubsetOfAttributes ) ).nextFeature( feature ); |
|
|
if ( feature.isValid() ) |
|
|
return feature.geometry(); |
|
|
else |
|
|
return QgsGeometry(); |
|
|
} |
|
|
|
|
|
bool QgsVectorLayer::addFeature( QgsFeature &feature, Flags ) |
|
|
{ |
|
|
if ( !mValid || !mEditBuffer || !mDataProvider ) |
|
|
|
@@ -1038,6 +1038,12 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte |
|
|
return feature; |
|
|
} |
|
|
|
|
|
/** |
|
|
* Query the layer for the geometry at the given id. |
|
|
* If there is no such feature, the returned geometry will be invalid. |
|
|
*/ |
|
|
QgsGeometry getGeometry( QgsFeatureId fid ) const; |
|
|
|
|
|
/** |
|
|
* Query the layer for the features with the given ids. |
|
|
*/ |
|
|