22 , mVectorLayerCache( vlCache )
38 if ( !mFilterRect.
isNull() )
55 mFeatureIds = mVectorLayerCache->mCache.keys().toSet();
59 mFeatureIdIterator = mFeatureIds.constBegin();
61 if ( mFeatureIdIterator == mFeatureIds.constEnd() )
72 while ( mFeatureIdIterator != mFeatureIds.constEnd() )
74 if ( !mVectorLayerCache->mCache.contains( *mFeatureIdIterator ) )
80 f =
QgsFeature( *mVectorLayerCache->mCache[*mFeatureIdIterator]->feature() );
95 mFeatureIdIterator = mFeatureIds.constBegin();
108 , mVectorLayerCache( vlCache )
124 if ( !mFilterRect.
isNull() )
143 mVectorLayerCache->cacheFeature( f );
144 mFids.insert( f.
id() );
166 return mFeatIt.
close();
bool acceptFeature(const QgsFeature &feature)
Check if a feature is accepted by this requests filter.
void geometryToDestinationCrs(QgsFeature &feature, const QgsCoordinateTransform &transform) const
Transforms feature's geometry according to the specified coordinate transform.
Filter using feature IDs.
QSet< QgsFeatureId > QgsFeatureIds
bool fetchFeature(QgsFeature &f) override
Implementation for fetching a feature.
QgsFeatureId filterFid() const
Get the feature ID that should be fetched.
QgsRectangle filterRectToSourceCrs(const QgsCoordinateTransform &transform) const
Returns a rectangle representing the original request's QgsFeatureRequest::filterRect().
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system for feature's geometries, or an invalid QgsCoordi...
FilterType filterType() const
Return the filter type which is currently set on this request.
const QgsFeatureIds & filterFids() const
Get feature IDs that should be fetched.
void requestCompleted(const QgsFeatureRequest &featureRequest, const QgsFeatureIds &fids)
Gets called, whenever the full list of feature ids for a certain request is known.
QgsVectorLayer * layer()
Returns the layer to which this cache belongs.
bool mClosed
Set to true, as soon as the iterator is closed.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QgsCoordinateReferenceSystem sourceCrs() const
Returns the coordinate reference system for features in the cache.
Internal feature iterator to be implemented within data providers.
bool close() override
Close this iterator.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QgsFeatureRequest & setFilterRect(const QgsRectangle &rectangle)
Sets the rectangle from which features will be taken.
bool close() override
Close this iterator.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const override
Query the layer for features specified in request.
bool rewind() override
Rewind to the beginning of the iterator.
This class caches features of a given QgsVectorLayer.
void setValid(bool validity)
Sets the validity of the feature.
QgsFeatureRequest mRequest
A copy of the feature request.
bool rewind() override
Rewind to the beginning of the iterator.
bool isNull() const
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
QgsCachedFeatureIterator(QgsVectorLayerCache *vlCache, const QgsFeatureRequest &featureRequest)
This constructor creates a feature iterator, that delivers all cached features.
Custom exception class for Coordinate Reference System related exceptions.
bool nextFeature(QgsFeature &f)
QgsCoordinateTransformContext transformContext() const
Returns the transform context, for use when a destinationCrs() has been set and reprojection is requi...
bool fetchFeature(QgsFeature &f) override
Implementation for fetching a feature.
QgsCachedFeatureWriterIterator(QgsVectorLayerCache *vlCache, const QgsFeatureRequest &featureRequest)
This constructor creates a feature iterator, which queries the backend and caches retrieved features...
bool isValid() const
Returns whether this CRS is correctly initialized and usable.