QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsVectorLayerFeaturePool Class Reference

A feature pool based on a vector layer. More...

#include <qgsvectorlayerfeaturepool.h>

Inheritance diagram for QgsVectorLayerFeaturePool:
Inheritance graph
[legend]

Public Member Functions

 QgsVectorLayerFeaturePool (QgsVectorLayer *layer)
 Creates a new feature pool for layer.
 
bool addFeature (QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
 Adds a single feature to the sink.
 
bool addFeatures (QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
 Adds a list of features to the sink.
 
void deleteFeature (QgsFeatureId fid) override
 Removes a feature from this pool.
 
void updateFeature (QgsFeature &feature) override
 Updates a feature in this pool.
 
- Public Member Functions inherited from QgsFeaturePool
 QgsFeaturePool (QgsVectorLayer *layer)
 Creates a new feature pool for layer.
 
virtual ~QgsFeaturePool ()=default
 
QgsFeatureIds allFeatureIds () const
 Returns the complete set of feature ids in this pool.
 
QgsCoordinateReferenceSystem crs () const
 The coordinate reference system of this layer.
 
Qgis::GeometryType geometryType () const
 The geometry type of this layer.
 
bool getFeature (QgsFeatureId id, QgsFeature &feature)
 Retrieves the feature with the specified id into feature.
 
QgsFeatureIds getFeatures (const QgsFeatureRequest &request, QgsFeedback *feedback=nullptr)
 Gets features for the provided request.
 
QgsFeatureIds getIntersects (const QgsRectangle &rect) const
 Gets all feature ids in the bounding box rect.
 
QgsVectorLayerlayer () const
 Gets a pointer to the underlying layer.
 
QString layerId () const
 The layer id of the layer.
 
QString layerName () const
 Returns the name of the layer.
 
QPointer< QgsVectorLayerlayerPtr () const
 Gets a QPointer to the underlying layer.
 
- Public Member Functions inherited from QgsFeatureSink
virtual ~QgsFeatureSink ()=default
 
virtual bool addFeatures (QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())
 Adds all features from the specified iterator to the sink.
 
virtual void finalize ()
 Finalizes the sink, flushing any buffered features to the destination.
 
virtual bool flushBuffer ()
 Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink's destination.
 
virtual QString lastError () const
 Returns the most recent error encountered by the sink, e.g.
 

Additional Inherited Members

- Public Types inherited from QgsFeatureSink
enum  Flag { FastInsert = 1 << 1 , RollBackOnErrors = 1 << 2 }
 Flags controlling how features are added to a sink. More...
 
typedef QFlags< FlagFlags
 
enum  SinkFlag { RegeneratePrimaryKey = 1 << 1 }
 Flags that can be set on a QgsFeatureSink. More...
 
typedef QFlags< SinkFlagSinkFlags
 
- Protected Member Functions inherited from QgsFeaturePool
void insertFeature (const QgsFeature &feature, bool skipLock=false)
 Inserts a feature into the cache and the spatial index.
 
bool isFeatureCached (QgsFeatureId fid)
 Checks if the feature fid is cached.
 
void refreshCache (QgsFeature feature, const QgsFeature &origFeature)
 Changes a feature in the cache and the spatial index.
 
void removeFeature (const QgsFeatureId featureId)
 Removes a feature from the cache and the spatial index.
 
void setFeatureIds (const QgsFeatureIds &ids)
 Sets all the feature ids governed by this feature pool.
 

Detailed Description

A feature pool based on a vector layer.

Since
QGIS 3.4

Definition at line 30 of file qgsvectorlayerfeaturepool.h.

Constructor & Destructor Documentation

◆ QgsVectorLayerFeaturePool()

QgsVectorLayerFeaturePool::QgsVectorLayerFeaturePool ( QgsVectorLayer layer)

Creates a new feature pool for layer.

Definition at line 23 of file qgsvectorlayerfeaturepool.cpp.

Member Function Documentation

◆ addFeature()

bool QgsVectorLayerFeaturePool::addFeature ( QgsFeature feature,
QgsFeatureSink::Flags  flags = QgsFeatureSink::Flags() 
)
overridevirtual

Adds a single feature to the sink.

Feature addition behavior is controlled by the specified flags.

See also
addFeatures()
Returns
true in case of success and false in case of failure

Reimplemented from QgsFeatureSink.

Definition at line 31 of file qgsvectorlayerfeaturepool.cpp.

◆ addFeatures()

bool QgsVectorLayerFeaturePool::addFeatures ( QgsFeatureList features,
QgsFeatureSink::Flags  flags = QgsFeatureSink::Flags() 
)
overridevirtual

Adds a list of features to the sink.

Feature addition behavior is controlled by the specified flags.

See also
addFeature()
Returns
true in case of success and false in case of failure

Implements QgsFeatureSink.

Definition at line 68 of file qgsvectorlayerfeaturepool.cpp.

◆ deleteFeature()

void QgsVectorLayerFeaturePool::deleteFeature ( QgsFeatureId  fid)
overridevirtual

Removes a feature from this pool.

Implementations will remove the feature from the layer or from the data provider.

Warning
This method can safely be called from a different thread vs the object's creation thread or the original layer's thread. The update will be delegated to run in the main thread, and care must be taken to avoid deadlocks if the main thread is busy.

Implements QgsFeaturePool.

Definition at line 124 of file qgsvectorlayerfeaturepool.cpp.

◆ updateFeature()

void QgsVectorLayerFeaturePool::updateFeature ( QgsFeature feature)
overridevirtual

Updates a feature in this pool.

Implementations will update the feature on the layer or on the data provider.

Warning
This method can safely be called from a different thread vs the object's creation thread or the original layer's thread. The update will be delegated to run in the main thread, and care must be taken to avoid deadlocks if the main thread is busy.

Implements QgsFeaturePool.

Definition at line 108 of file qgsvectorlayerfeaturepool.cpp.


The documentation for this class was generated from the following files: