Internal feature iterator to be implemented within data providers.
More...
#include <qgsfeatureiterator.h>
Internal feature iterator to be implemented within data providers.
Definition at line 28 of file qgsfeatureiterator.h.
◆ CompileStatus
Status of expression compilation for filter expression requests.
Enumerator |
---|
NoCompilation | Expression could not be compiled or not attempt was made to compile expression.
|
PartiallyCompiled | Expression was partially compiled, but extra checks need to be applied to features.
|
Compiled | Expression was fully compiled and delegated to data provider source.
|
Definition at line 33 of file qgsfeatureiterator.h.
◆ RequestToSourceCrsResult
Possible results from the updateRequestToSourceCrs() method.
- Since
- QGIS 3.22
Enumerator |
---|
Success | Request was successfully updated to the source CRS, or no changes were required.
|
DistanceWithinMustBeCheckedManually | The distance within request cannot be losslessly updated to the source CRS, and callers will need to take appropriate steps to handle the distance within requirement manually during feature iteration.
|
Definition at line 99 of file qgsfeatureiterator.h.
◆ QgsAbstractFeatureIterator()
QgsAbstractFeatureIterator::QgsAbstractFeatureIterator |
( |
const QgsFeatureRequest & |
request | ) |
|
◆ ~QgsAbstractFeatureIterator()
virtual QgsAbstractFeatureIterator::~QgsAbstractFeatureIterator |
( |
| ) |
|
|
virtualdefault |
destructor makes sure that the iterator is closed properly
◆ close()
virtual bool QgsAbstractFeatureIterator::close |
( |
| ) |
|
|
pure virtual |
◆ compileFailed()
bool QgsAbstractFeatureIterator::compileFailed |
( |
| ) |
const |
Indicator if there was an error when sending the compiled query to the server.
This indicates that there is something wrong with the expression compiler.
- Since
- QGIS 3.2
Definition at line 191 of file qgsfeatureiterator.cpp.
◆ compileStatus()
CompileStatus QgsAbstractFeatureIterator::compileStatus |
( |
| ) |
const |
|
inline |
Returns the status of expression compilation for filter expression requests.
- Since
- QGIS 2.16
Definition at line 69 of file qgsfeatureiterator.h.
◆ deref()
void QgsAbstractFeatureIterator::deref |
( |
| ) |
|
|
protected |
◆ fetchFeature()
virtual bool QgsAbstractFeatureIterator::fetchFeature |
( |
QgsFeature & |
f | ) |
|
|
protectedpure virtual |
◆ filterRectToSourceCrs()
Returns a rectangle representing the original request's QgsFeatureRequest::filterRect().
If transform is a valid coordinate transform, the return rectangle will represent the requested filterRect() transformed to the source's coordinate reference system. Iterators should call this method and use the returned rectangle for filtering features to ensure that any QgsFeatureRequest::destinationCrs() set on the request is respected. Will throw a QgsCsException if the rect cannot be transformed from the destination CRS.
- Since
- QGIS 3.0
Definition at line 157 of file qgsfeatureiterator.cpp.
◆ geometryToDestinationCrs()
Transforms feature's geometry according to the specified coordinate transform.
If feature has no geometry or transform is invalid then calling this method has no effect and will be shortcut. Iterators should call this method before returning features to ensure that any QgsFeatureRequest::destinationCrs() set on the request is respected.
- Since
- QGIS 3.0
Definition at line 101 of file qgsfeatureiterator.cpp.
◆ isValid()
virtual bool QgsAbstractFeatureIterator::isValid |
( |
| ) |
const |
|
inlinevirtual |
Returns if this iterator is valid.
An invalid feature iterator is not able to provide a reliable source for data. If an iterator is invalid, either give up or try to send the request again (preferably after a timeout to give the system some time to stay responsive).
If you want to check if the iterator successfully completed, better use QgsFeatureIterator::isClosed().
- Since
- QGIS 3.0
Reimplemented in QgsVectorLayerFeatureIterator.
Definition at line 81 of file qgsfeatureiterator.h.
◆ nextFeature()
bool QgsAbstractFeatureIterator::nextFeature |
( |
QgsFeature & |
f | ) |
|
|
virtual |
◆ nextFeatureFilterExpression()
bool QgsAbstractFeatureIterator::nextFeatureFilterExpression |
( |
QgsFeature & |
f | ) |
|
|
protectedvirtual |
By default, the iterator will fetch all features and check if the feature matches the expression.
If you have a more sophisticated metodology (SQL request for the features...) and you check for the expression in your fetchFeature method, you can just redirect this call to fetchFeature so the default check will be omitted.
- Parameters
-
- Returns
true
if a feature was written to f
Reimplemented in QgsVectorLayerFeatureIterator.
Definition at line 80 of file qgsfeatureiterator.cpp.
◆ nextFeatureFilterFids()
bool QgsAbstractFeatureIterator::nextFeatureFilterFids |
( |
QgsFeature & |
f | ) |
|
|
protectedvirtual |
By default, the iterator will fetch all features and check if the id is in the request.
If you have a more sophisticated metodology (SQL request for the features...) and you are sure, that any feature you return from fetchFeature will match if the request was FilterFids you can just redirect this call to fetchFeature so the default check will be omitted.
- Parameters
-
- Returns
true
if a feature was written to f
Reimplemented in QgsCachedFeatureIterator.
Definition at line 91 of file qgsfeatureiterator.cpp.
◆ prepareSimplification()
bool QgsAbstractFeatureIterator::prepareSimplification |
( |
const QgsSimplifyMethod & |
simplifyMethod | ) |
|
|
protectedvirtual |
◆ ref()
void QgsAbstractFeatureIterator::ref |
( |
| ) |
|
|
protected |
◆ rewind()
virtual bool QgsAbstractFeatureIterator::rewind |
( |
| ) |
|
|
pure virtual |
◆ setInterruptionChecker()
void QgsAbstractFeatureIterator::setInterruptionChecker |
( |
QgsFeedback * |
interruptionChecker | ) |
|
|
virtual |
Attach an object that can be queried regularly by the iterator to check if it must stopped.
This is mostly useful for iterators where a single nextFeature()/fetchFeature() iteration might be very long. A typical use case is the WFS provider. When nextFeature()/fetchFeature() is reasonably fast, it is not necessary to implement this method. The default implementation does nothing.
- Note
- not available in Python bindings
- Since
- QGIS 2.16
Reimplemented in QgsVectorLayerFeatureIterator.
Definition at line 261 of file qgsfeatureiterator.cpp.
◆ updateRequestToSourceCrs()
◆ QgsFeatureIterator
◆ mClosed
bool QgsAbstractFeatureIterator::mClosed = false |
|
protected |
◆ mCompileFailed
bool QgsAbstractFeatureIterator::mCompileFailed = false |
|
protected |
◆ mCompileStatus
◆ mFetchedCount
long long QgsAbstractFeatureIterator::mFetchedCount = 0 |
|
protected |
◆ mRequest
◆ mValid
bool QgsAbstractFeatureIterator::mValid = true |
|
protected |
An invalid state of a feature iterator indicates that there was a problem with even getting it up and running.
This should be set to false
by subclasses if they have problems connecting to the provider. Do NOT set this to false
when the feature iterator closes or has no features but we are sure, that it's just an empty dataset.
Definition at line 223 of file qgsfeatureiterator.h.
◆ mZombie
bool QgsAbstractFeatureIterator::mZombie = false |
|
protected |
A feature iterator may be closed already but still be serving features from the cache.
This is done when we serve features which have been pre-fetched and the order by has been locally sorted. In such a scenario, all resources have been released (mClosed is true
) but the deads are still alive.
Definition at line 190 of file qgsfeatureiterator.h.
◆ refs
int QgsAbstractFeatureIterator::refs = 0 |
|
protected |
The documentation for this class was generated from the following files: