QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
23 , mSelectedOnly( selectedOnly )
41 featureIds.insert( feature.
id() );
45 featureIds.remove( feature.
id() );
55 features.append( feature );
59 auto addFeatureSynchronized = [
this, &features, &res ]()
71 feature.
setId( features.front().id() );
80 selectedFeatureIds.insert( feature.
id() );
97 auto addFeatureSynchronized = [
this, &features, &res ]()
117 for (
const QgsFeature &feature : qgis::as_const( features ) )
118 selectedFeatureIds.insert( feature.id() );
124 for (
const QgsFeature &feature : qgis::as_const( features ) )
136 geometryMap.insert( feature.
id(), feature.
geometry() );
139 for (
int i = 0, n = feature.
attributes().size(); i < n; ++i )
141 attribMap.insert( i, feature.
attributes().at( i ) );
143 changedAttributesMap.insert( feature.
id(), attribMap );
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const FINAL
Queries the layer for features specified in request.
bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
Adds a single feature to the sink.
virtual bool deleteFeatures(const QgsFeatureIds &id)
Deletes one or more features from the provider.
QgsVectorDataProvider * dataProvider() FINAL
Returns the layer's data provider, it may be nullptr.
void setId(QgsFeatureId id)
Sets the feature ID for this feature.
void setFeatureIds(const QgsFeatureIds &ids)
Sets all the feature ids governed by this feature pool.
virtual bool changeAttributeValues(const QgsChangedAttributesMap &attr_map)
Changes attribute values of existing features.
Q_INVOKABLE void selectByIds(const QgsFeatureIds &ids, QgsVectorLayer::SelectBehavior behavior=QgsVectorLayer::SetSelection)
Selects matching features using a list of feature IDs.
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
bool getFeature(QgsFeatureId id, QgsFeature &feature)
Retrieves the feature with the specified id into feature.
void updateFeature(QgsFeature &feature) override
Updates a feature in this pool.
bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
Adds a list of features to the sink.
virtual bool changeGeometryValues(const QgsGeometryMap &geometry_map)
Changes geometries of existing features.
const Q_INVOKABLE QgsFeatureIds & selectedFeatureIds() const
Returns a list of the selected features IDs in this layer.
QList< QgsFeature > QgsFeatureList
QMap< int, QVariant > QgsAttributeMap
QgsFeatureRequest & setFilterFids(const QgsFeatureIds &fids)
Sets feature IDs that should be fetched.
QSet< QgsFeatureId > QgsFeatureIds
void removeFeature(const QgsFeatureId featureId)
Removes a feature from the cache and the spatial index.
void deleteFeature(QgsFeatureId fid) override
Removes a feature from this pool.
QgsVectorLayer * layer() const
Gets a pointer to the underlying layer.
bool addFeatures(QgsFeatureList &flist, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
Adds a list of features to the sink.
bool nextFeature(QgsFeature &f)
static bool runOnMainThread(const Func &func, QgsFeedback *feedback=nullptr)
Guarantees that func is executed on the main thread.
bool hasGeometry() const
Returns true if the feature has an associated geometry.
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
QgsVectorDataProviderFeaturePool(QgsVectorLayer *layer, bool selectedOnly=false)
Creates a new feature pool for the data provider of layer.
void refreshCache(const QgsFeature &feature)
Changes a feature in the cache and the spatial index.
void insertFeature(const QgsFeature &feature, bool skipLock=false)
Inserts a feature into the cache and the spatial index.