17#ifndef QGS_FEATUREPOOL_H
18#define QGS_FEATUREPOOL_H
20#include "qgis_analysis.h"
214 static const int CACHE_SIZE = 1000;
215 QCache<QgsFeatureId, QgsFeature> mFeatureCache;
216 QPointer<QgsVectorLayer> mLayer;
217 mutable QReadWriteLock mCacheLock;
221 std::unique_ptr<QgsVectorLayerFeatureSource> mFeatureSource;
236 QHash<QgsFeatureId, QgsFeature> mUpdatedFeatures;
Provides global constants and enumerations for use throughout the application.
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Represents a coordinate reference system (CRS).
virtual void updateFeature(QgsFeature &feature)=0
Updates a feature in this pool.
Qgis::GeometryType geometryType() const
The geometry type of this layer.
QgsFeaturePool(QgsVectorLayer *layer)
Creates a new feature pool for layer.
void refreshCache(QgsFeature feature, const QgsFeature &origFeature)
Changes a feature in the cache and the spatial index.
QgsFeatureIds allFeatureIds() const
Returns the complete set of feature ids in this pool.
friend class TestQgsVectorLayerFeaturePool
QString layerId() const
The layer id of the layer.
void insertFeature(const QgsFeature &feature, bool skipLock=false)
Inserts a feature into the cache and the spatial index.
QPointer< QgsVectorLayer > layerPtr() const
Gets a QPointer to the underlying layer.
bool isFeatureCached(QgsFeatureId fid)
Checks if the feature fid is cached.
~QgsFeaturePool() override=default
QgsCoordinateReferenceSystem crs() const
The coordinate reference system of this layer.
QgsFeatureIds getFeatures(const QgsFeatureRequest &request, QgsFeedback *feedback=nullptr)
Gets features for the provided request.
virtual void deleteFeature(QgsFeatureId fid)=0
Removes a feature from this pool.
QgsFeatureIds getIntersects(const QgsRectangle &rect) const
Gets all feature ids in the bounding box rect.
QString layerName() const
Returns the name of the layer.
void setFeatureIds(const QgsFeatureIds &ids)
Sets all the feature ids governed by this feature pool.
void removeFeature(const QgsFeatureId featureId)
Removes a feature from the cache and the spatial index.
QgsVectorLayer * layer() const
Gets a pointer to the underlying layer.
bool getFeature(QgsFeatureId id, QgsFeature &feature)
Retrieves the feature with the specified id into feature.
Wraps a request for features to a vector layer (or directly its vector data provider).
An interface for objects which accept features via addFeature(s) methods.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Base class for feedback objects to be used for cancellation of something running in a worker thread.
A rectangle specified with double values.
A spatial index for QgsFeature objects.
Represents a vector layer which manages a vector based dataset.
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features