21 , mFeatureIds( featureIds )
22 , mVectorLayerCache( vlCache )
24 mFeatureIdIterator = featureIds.constBegin();
26 if ( mFeatureIdIterator == featureIds.constEnd() )
32 , mVectorLayerCache( vlCache )
45 mFeatureIds = mVectorLayerCache->mCache.keys().toSet();
49 mFeatureIdIterator = mFeatureIds.constBegin();
51 if ( mFeatureIdIterator == mFeatureIds.constEnd() )
60 while ( mFeatureIdIterator != mFeatureIds.constEnd() )
62 f =
QgsFeature( *mVectorLayerCache->mCache[*mFeatureIdIterator]->feature() );
73 mFeatureIdIterator = mFeatureIds.constBegin();
86 , mVectorLayerCache( vlCache )
96 mVectorLayerCache->cacheFeature( f );
97 mFids.insert( f.
id() );
118 return mFeatIt.
close();
QgsFeatureId id() const
Get the feature id for this feature.
bool acceptFeature(const QgsFeature &feature)
Check if a feature is accepted by this requests filter.
Filter using feature IDs.
QSet< QgsFeatureId > QgsFeatureIds
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())
Query the provider for features specified in request.
const QgsFeatureIds & filterFids() const
virtual bool fetchFeature(QgsFeature &f) override
Implementation for fetching a feature.
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...
QgsCachedFeatureIterator(QgsVectorLayerCache *vlCache, QgsFeatureRequest featureRequest, QgsFeatureIds featureIds)
This constructor creates a feature iterator, that delivers only cached information, based on the QgsFeatureIds.
Internal feature iterator to be implemented within data providers.
virtual bool close() override
Close this iterator.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
FilterType filterType() const
virtual bool close() override
Close this iterator.
virtual bool rewind() override
Rewind to the beginning of the iterator.
This class caches features of a given QgsVectorLayer.
const QgsFeatureId & filterFid() const
QgsFeatureRequest mRequest
A copy of the feature request.
virtual bool rewind() override
Rewind to the beginning of the iterator.
void requestCompleted(QgsFeatureRequest featureRequest, QgsFeatureIds fids)
Gets called, whenever the full list of feature ids for a certain request is known.
bool nextFeature(QgsFeature &f)
QgsCachedFeatureWriterIterator(QgsVectorLayerCache *vlCache, QgsFeatureRequest featureRequest)
This constructor creates a feature iterator, which queries the backend and caches retrieved features...
virtual bool fetchFeature(QgsFeature &f) override
Implementation for fetching a feature.