15 #ifndef QGSFEATUREITERATOR_H 16 #define QGSFEATUREITERATOR_H 18 #include "qgis_core.h" 50 virtual bool rewind() = 0;
52 virtual bool close() = 0;
107 virtual bool nextFeatureFilterExpression(
QgsFeature &f );
120 virtual bool nextFeatureFilterFids(
QgsFeature &f );
148 bool mClosed =
false;
157 bool mZombie =
false;
171 long mFetchedCount = 0;
190 bool mUseCachedFeatures =
false;
191 QList<QgsIndexedFeature> mCachedFeatures;
192 QList<QgsIndexedFeature>::ConstIterator mFeatureIterator;
205 virtual bool prepareOrderBy(
const QList<QgsFeatureRequest::OrderByClause> &orderBys );
213 void setupOrderBy(
const QList<QgsFeatureRequest::OrderByClause> &orderBys );
229 , mOwnSource( ownSource )
231 mSource->iteratorOpened(
this );
244 T *mSource =
nullptr;
263 SIP_PYOBJECT __next__();
265 std::unique_ptr< QgsFeature >
f = qgis::make_unique< QgsFeature >();
267 Py_BEGIN_ALLOW_THREADS
268 result = ( sipCpp->nextFeature( *f ) );
271 sipRes = sipConvertFromType( f.release(), sipType_QgsFeature, Py_None );
274 PyErr_SetString( PyExc_StopIteration,
"" );
305 virtual bool isValid()
const;
308 bool isClosed()
const;
390 return !( fi1 == fi2 );
401 #endif // QGSFEATUREITERATOR_H
Wrapper for iterator of features from vector data provider or vector layer.
virtual bool close()=0
end of iterating: free the resources / lock
A rectangle specified with double values.
Expression could not be compiled or not attempt was made to compile expression.
long mFetchedCount
Number of features already fetched by iterator.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
virtual bool rewind()=0
reset the iterator to the starting position
Expression was fully compiled and delegated to data provider source.
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...
QgsAbstractFeatureIterator::CompileStatus compileStatus() const
Returns the status of expression compilation for filter expression requests.
friend bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Base class for feedback objects to be used for cancelation of something running in a worker thread...
void iteratorClosed()
to be called by from subclass in close()
virtual bool nextFeature(QgsFeature &f)
fetch next feature, return true on success
CompileStatus compileStatus() const
Returns the status of expression compilation for filter expression requests.
Internal feature iterator to be implemented within data providers.
CompileStatus
Status of expression compilation for filter expression requests.
void setInterruptionChecker(QgsFeedback *interruptionChecker)
Attach an object that can be queried regularly by the iterator to check if it must stopped...
bool mZombie
A feature iterator may be closed already but still be serving features from the cache.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QgsFeatureIterator()=default
construct invalid iterator
void deref()
Remove reference, delete if refs == 0.
friend bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
~QgsAbstractFeatureIteratorFromSource() override
virtual bool isValid() const
Returns if this iterator is valid.
QgsFeatureRequest mRequest
A copy of the feature request.
Expression was partially compiled, but extra checks need to be applied to features.
QgsAbstractFeatureIterator * mIter
virtual void setInterruptionChecker(QgsFeedback *interruptionChecker)
Attach an object that can be queried regularly by the iterator to check if it must stopped...
~QgsFeatureIterator()
destructor deletes the iterator if it has no more references
This class contains information about how to simplify geometries fetched from a QgsFeatureIterator.
bool nextFeature(QgsFeature &f)
bool isClosed() const
find out whether the iterator is still valid or closed already
QgsAbstractFeatureIteratorFromSource(T *source, bool ownSource, const QgsFeatureRequest &request)
Helper template that cares of two things: 1.