QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgscachedfeatureiterator.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscachedfeatureiterator.h
3 --------------------------------------
4 Date : 12.2.2013
5 Copyright : (C) 2013 Matthias Kuhn
6 Email : matthias at opengis dot ch
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSCACHEDFEATUREITERATOR_H
17#define QGSCACHEDFEATUREITERATOR_H
18
19#include "qgis_core.h"
21#include "qgsfeature.h"
22#include "qgsfeatureiterator.h"
23#include "qgsvectorlayercache.h"
24
25#include <QPointer>
26
28
35{
36 public:
43 QgsCachedFeatureIterator( QgsVectorLayerCache *vlCache, const QgsFeatureRequest &featureRequest );
44
46
52 bool rewind() override;
53
59 bool close() override;
60
61 // QgsAbstractFeatureIterator interface
62 protected:
69 bool fetchFeature( QgsFeature &f ) override;
70
77 bool nextFeatureFilterFids( QgsFeature &f ) override { return fetchFeature( f ); }
78
79 private:
80#ifdef SIP_RUN
82#endif
83
84 QList< QgsFeatureId > mFeatureIds;
85 QPointer< QgsVectorLayerCache > mVectorLayerCache = nullptr;
86 QList< QgsFeatureId >::ConstIterator mFeatureIdIterator;
87 QgsCoordinateTransform mTransform;
88 QgsRectangle mFilterRect;
89
90 QgsGeometry mDistanceWithinGeom;
91 std::unique_ptr< QgsGeometryEngine > mDistanceWithinEngine;
92 double mDistanceWithin = 0;
93};
94
102{
103 public:
111
117 bool rewind() override;
118
124 bool close() override;
125
126 protected:
133 bool fetchFeature( QgsFeature &f ) override;
134
135 private:
136 QgsFeatureIterator mFeatIt;
137 QPointer< QgsVectorLayerCache > mVectorLayerCache;
138 QgsFeatureIds mFids;
139 QgsCoordinateTransform mTransform;
140 QgsRectangle mFilterRect;
141};
142#endif // QGSCACHEDFEATUREITERATOR_H
virtual bool rewind()=0
Resets the iterator to the starting position.
virtual bool fetchFeature(QgsFeature &f)=0
If you write a feature iterator for your provider, this is the method you need to implement!
virtual bool close()=0
Call to end the iteration.
QgsAbstractFeatureIterator(const QgsFeatureRequest &request)
base class constructor - stores the iteration parameters
Delivers features from the cache.
QgsCachedFeatureIterator(QgsVectorLayerCache *vlCache, const QgsFeatureRequest &featureRequest)
This constructor creates a feature iterator, that delivers all cached features.
~QgsCachedFeatureIterator() override
bool nextFeatureFilterFids(QgsFeature &f) override
We have a local special iterator for FilterFids, no need to run the generic.
QgsCachedFeatureWriterIterator(QgsVectorLayerCache *vlCache, const QgsFeatureRequest &featureRequest)
This constructor creates a feature iterator, which queries the backend and caches retrieved features.
Handles coordinate transforms between two coordinate systems.
Wraps a request for features to a vector layer (or directly its vector data provider).
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:60
A geometry is the spatial representation of a feature.
A rectangle specified with double values.
Caches features for a given QgsVectorLayer.
QSet< QgsFeatureId > QgsFeatureIds