23 , mVectorLayerCache( vlCache )
39 if ( !mFilterRect.
isNull() )
56 mFeatureIds = mVectorLayerCache->mCache.keys().toSet();
60 mFeatureIdIterator = mFeatureIds.constBegin();
62 if ( mFeatureIdIterator == mFeatureIds.constEnd() )
73 while ( mFeatureIdIterator != mFeatureIds.constEnd() )
75 if ( !mVectorLayerCache->mCache.contains( *mFeatureIdIterator ) )
81 f =
QgsFeature( *mVectorLayerCache->mCache[*mFeatureIdIterator]->feature() );
96 mFeatureIdIterator = mFeatureIds.constBegin();
109 , mVectorLayerCache( vlCache )
125 if ( !mFilterRect.
isNull() )
144 mVectorLayerCache->cacheFeature( f );
145 mFids.insert( f.
id() );
167 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
QgsRectangle filterRectToSourceCrs(const QgsCoordinateTransform &transform) const SIP_THROW(QgsCsException)
Returns a rectangle representing the original request's QgsFeatureRequest::filterRect().
bool fetchFeature(QgsFeature &f) override
Implementation for fetching a feature.
QgsFeatureId filterFid() const
Gets the feature ID that should be fetched.
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system for feature's geometries, or an invalid QgsCoordi...
FilterType filterType() const
Returns the filter type which is currently set on this request.
const QgsFeatureIds & filterFids() const
Gets 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
Sets 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.
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()).
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const FINAL
Queries the layer for features specified in request.
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.