QGIS API Documentation
2.2.0-Valmiera
|
Internal feature iterator to be implemented within data providers. More...
#include <qgsfeatureiterator.h>
Public Member Functions | |
QgsAbstractFeatureIterator (const QgsFeatureRequest &request) | |
base class constructor - stores the iteration parameters | |
virtual | ~QgsAbstractFeatureIterator () |
destructor makes sure that the iterator is closed properly | |
virtual bool | nextFeature (QgsFeature &f) |
fetch next feature, return true on success | |
virtual bool | rewind ()=0 |
reset the iterator to the starting position | |
virtual bool | close ()=0 |
end of iterating: free the resources / lock |
Protected Member Functions | |
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 | nextFeatureFilterExpression (QgsFeature &f) |
By default, the iterator will fetch all features and check if the feature matches the expression. | |
virtual bool | nextFeatureFilterFids (QgsFeature &f) |
By default, the iterator will fetch all features and check if the id is in the request. | |
void | ref () |
add reference | |
void | deref () |
remove reference, delete if refs == 0 | |
virtual bool | prepareSimplification (const QgsSimplifyMethod &simplifyMethod) |
Setup the simplification of geometries to fetch using the specified simplify method. |
Protected Attributes | |
QgsFeatureRequest | mRequest |
A copy of the feature request. | |
bool | mClosed |
Set to true, as soon as the iterator is closed. | |
int | refs |
reference counting (to allow seamless copying of QgsFeatureIterator instances) |
Private Member Functions | |
virtual bool | providerCanSimplify (QgsSimplifyMethod::MethodType methodType) const |
returns whether the iterator supports simplify geometries on provider side | |
virtual bool | simplify (QgsFeature &feature) |
simplify the specified geometry if it was configured |
Private Attributes | |
QgsAbstractGeometrySimplifier * | mGeometrySimplifier |
optional object to locally simplify geometries fetched by this feature iterator | |
bool | mLocalSimplification |
this iterator runs local simplification |
Friends | |
class | QgsFeatureIterator |
Internal feature iterator to be implemented within data providers.
Definition at line 26 of file qgsfeatureiterator.h.
QgsAbstractFeatureIterator::QgsAbstractFeatureIterator | ( | const QgsFeatureRequest & | request | ) |
base class constructor - stores the iteration parameters
Definition at line 21 of file qgsfeatureiterator.cpp.
|
virtual |
destructor makes sure that the iterator is closed properly
Definition at line 30 of file qgsfeatureiterator.cpp.
References mGeometrySimplifier.
|
pure virtual |
end of iterating: free the resources / lock
Implemented in QgsCachedFeatureWriterIterator, QgsCachedFeatureIterator, and QgsVectorLayerFeatureIterator.
Referenced by QgsFeatureIterator::close().
|
protected |
remove reference, delete if refs == 0
Definition at line 98 of file qgsfeatureiterator.cpp.
References refs.
Referenced by QgsFeatureIterator::operator=(), and QgsFeatureIterator::~QgsFeatureIterator().
|
protectedpure virtual |
If you write a feature iterator for your provider, this is the method you need to implement!!
f | The feature to write to |
Implemented in QgsCachedFeatureWriterIterator, QgsCachedFeatureIterator, and QgsVectorLayerFeatureIterator.
Referenced by nextFeature(), QgsVectorLayerFeatureIterator::nextFeatureFilterExpression(), nextFeatureFilterExpression(), nextFeatureFilterFids(), and QgsCachedFeatureIterator::nextFeatureFilterFids().
|
virtual |
fetch next feature, return true on success
Definition at line 36 of file qgsfeatureiterator.cpp.
References fetchFeature(), QgsFeatureRequest::FilterExpression, QgsFeatureRequest::FilterFids, QgsFeatureRequest::filterType(), QgsFeature::geometry(), mLocalSimplification, mRequest, nextFeatureFilterExpression(), nextFeatureFilterFids(), and simplify().
Referenced by QgsFeatureIterator::nextFeature().
|
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.
f | The feature to write to |
Reimplemented in QgsVectorLayerFeatureIterator.
Definition at line 64 of file qgsfeatureiterator.cpp.
References QgsExpression::evaluate(), fetchFeature(), QgsFeatureRequest::filterExpression(), and mRequest.
Referenced by nextFeature().
|
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.
f | The feature to write to |
Reimplemented in QgsCachedFeatureIterator.
Definition at line 74 of file qgsfeatureiterator.cpp.
References fetchFeature(), QgsFeatureRequest::filterFids(), QgsFeature::id(), and mRequest.
Referenced by nextFeature().
|
protectedvirtual |
Setup the simplification of geometries to fetch using the specified simplify method.
Reimplemented in QgsVectorLayerFeatureIterator.
Definition at line 105 of file qgsfeatureiterator.cpp.
References QgsSimplifyMethod::createGeometrySimplifier(), QgsFeatureRequest::flags(), QgsSimplifyMethod::forceLocalOptimization(), QgsSimplifyMethod::methodType(), mGeometrySimplifier, mLocalSimplification, mRequest, QgsFeatureRequest::NoGeometry, QgsSimplifyMethod::NoSimplification, and providerCanSimplify().
Referenced by ref().
|
privatevirtual |
returns whether the iterator supports simplify geometries on provider side
Definition at line 122 of file qgsfeatureiterator.cpp.
Referenced by prepareSimplification().
|
protected |
add reference
Definition at line 84 of file qgsfeatureiterator.cpp.
References mRequest, prepareSimplification(), refs, and QgsFeatureRequest::simplifyMethod().
Referenced by QgsFeatureIterator::operator=(), and QgsFeatureIterator::QgsFeatureIterator().
|
pure virtual |
reset the iterator to the starting position
Implemented in QgsCachedFeatureWriterIterator, QgsCachedFeatureIterator, and QgsVectorLayerFeatureIterator.
Referenced by QgsFeatureIterator::rewind().
|
privatevirtual |
simplify the specified geometry if it was configured
Definition at line 128 of file qgsfeatureiterator.cpp.
References QgsFeature::geometry(), QGis::Line, mGeometrySimplifier, QGis::Polygon, QgsAbstractGeometrySimplifier::simplifyGeometry(), and QgsGeometry::type().
Referenced by nextFeature().
|
friend |
Definition at line 88 of file qgsfeatureiterator.h.
Referenced by QgsVectorLayerCache::getFeatures().
|
protected |
Set to true, as soon as the iterator is closed.
Definition at line 82 of file qgsfeatureiterator.h.
Referenced by QgsVectorLayerFeatureIterator::close(), QgsCachedFeatureIterator::close(), QgsCachedFeatureWriterIterator::close(), QgsVectorLayerFeatureIterator::fetchFeature(), QgsCachedFeatureIterator::fetchFeature(), QgsFeatureIterator::isClosed(), and QgsVectorLayerFeatureIterator::rewind().
|
private |
optional object to locally simplify geometries fetched by this feature iterator
Definition at line 95 of file qgsfeatureiterator.h.
Referenced by prepareSimplification(), simplify(), and ~QgsAbstractFeatureIterator().
|
private |
this iterator runs local simplification
Definition at line 97 of file qgsfeatureiterator.h.
Referenced by nextFeature(), and prepareSimplification().
|
protected |
A copy of the feature request.
Definition at line 79 of file qgsfeatureiterator.h.
Referenced by QgsVectorLayerFeatureIterator::fetchFeature(), QgsCachedFeatureIterator::fetchFeature(), QgsCachedFeatureWriterIterator::fetchFeature(), QgsVectorLayerFeatureIterator::fetchNextAddedFeature(), QgsVectorLayerFeatureIterator::fetchNextChangedAttributeFeature(), QgsVectorLayerFeatureIterator::fetchNextChangedGeomFeature(), nextFeature(), QgsVectorLayerFeatureIterator::nextFeatureFid(), nextFeatureFilterExpression(), nextFeatureFilterFids(), QgsVectorLayerFeatureIterator::prepareJoins(), QgsVectorLayerFeatureIterator::prepareSimplification(), prepareSimplification(), QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator(), ref(), QgsVectorLayerFeatureIterator::rewind(), QgsVectorLayerFeatureIterator::useAddedFeature(), and QgsVectorLayerFeatureIterator::useChangedAttributeFeature().
|
protected |
reference counting (to allow seamless copying of QgsFeatureIterator instances)
Definition at line 85 of file qgsfeatureiterator.h.