QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
QgsAbstractFeatureIterator Class Reference

Internal feature iterator to be implemented within data providers. More...

#include <qgsfeatureiterator.h>

Inheritance diagram for QgsAbstractFeatureIterator:
Inheritance graph
[legend]

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)

Friends

class QgsFeatureIterator

Detailed Description

Internal feature iterator to be implemented within data providers.

Constructor & Destructor Documentation

QgsAbstractFeatureIterator::QgsAbstractFeatureIterator ( const QgsFeatureRequest request)

base class constructor - stores the iteration parameters

QgsAbstractFeatureIterator::~QgsAbstractFeatureIterator ( )
virtual

destructor makes sure that the iterator is closed properly

Member Function Documentation

virtual bool QgsAbstractFeatureIterator::close ( )
pure virtual

end of iterating: free the resources / lock

Implemented in QgsCachedFeatureWriterIterator, QgsVectorLayerFeatureIterator, and QgsCachedFeatureIterator.

void QgsAbstractFeatureIterator::deref ( )
protected

remove reference, delete if refs == 0

virtual bool QgsAbstractFeatureIterator::fetchFeature ( QgsFeature f)
protectedpure virtual

If you write a feature iterator for your provider, this is the method you need to implement!!

Parameters
fThe feature to write to
Returns
true if a feature was written to f

Implemented in QgsCachedFeatureWriterIterator, QgsVectorLayerFeatureIterator, and QgsCachedFeatureIterator.

bool QgsAbstractFeatureIterator::nextFeature ( QgsFeature f)
virtual

fetch next feature, return true on success

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
fThe feature to write to
Returns
true if a feature was written to f

Reimplemented in QgsVectorLayerFeatureIterator.

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
fThe feature to write to
Returns
true if a feature was written to f

Reimplemented in QgsCachedFeatureIterator.

bool QgsAbstractFeatureIterator::prepareSimplification ( const QgsSimplifyMethod simplifyMethod)
protectedvirtual

Setup the simplification of geometries to fetch using the specified simplify method.

Reimplemented in QgsVectorLayerFeatureIterator.

void QgsAbstractFeatureIterator::ref ( )
protected

add reference

virtual bool QgsAbstractFeatureIterator::rewind ( )
pure virtual

reset the iterator to the starting position

Implemented in QgsCachedFeatureWriterIterator, QgsVectorLayerFeatureIterator, and QgsCachedFeatureIterator.

Friends And Related Function Documentation

friend class QgsFeatureIterator
friend

Member Data Documentation

bool QgsAbstractFeatureIterator::mClosed
protected

Set to true, as soon as the iterator is closed.

QgsFeatureRequest QgsAbstractFeatureIterator::mRequest
protected

A copy of the feature request.

int QgsAbstractFeatureIterator::refs
protected

reference counting (to allow seamless copying of QgsFeatureIterator instances)


The documentation for this class was generated from the following files: