QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
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.
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.
This class wraps a request for features to a vector layer (or directly its vector data provider).
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.
Q_INVOKABLE const 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.
Represents a vector layer which manages a vector based data sets.
bool hasGeometry() const
Returns true if the feature has an associated geometry.
QgsVectorDataProvider * dataProvider() FINAL
Returns the layer's data provider, it may be nullptr.
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QgsVectorDataProviderFeaturePool(QgsVectorLayer *layer, bool selectedOnly=false)
Creates a new feature pool for the data provider of layer.
Wrapper for iterator of features from vector data provider or vector layer.
A feature pool is based on a vector layer and caches features.
void refreshCache(const QgsFeature &feature)
Changes a feature in the cache and the spatial index.
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
void insertFeature(const QgsFeature &feature, bool skipLock=false)
Inserts a feature into the cache and the spatial index.