QGIS API Documentation
2.2.0-Valmiera
|
#include <qgsvectorlayerfeatureiterator.h>
Classes | |
struct | FetchJoinInfo |
Join information prepared for fast attribute id mapping in QgsVectorLayerJoinBuffer::updateFeatureAttributes(). More... |
Public Member Functions | |
QgsVectorLayerFeatureIterator (QgsVectorLayer *layer, const QgsFeatureRequest &request) | |
~QgsVectorLayerFeatureIterator () | |
virtual bool | rewind () |
reset the iterator to the starting position | |
virtual bool | close () |
end of iterating: free the resources / lock | |
Public Member Functions inherited from QgsAbstractFeatureIterator | |
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 |
Protected Member Functions | |
virtual bool | fetchFeature (QgsFeature &feature) |
fetch next feature, return true on success | |
virtual bool | nextFeatureFilterExpression (QgsFeature &f) |
Overrides default method as we only need to filter features in the edit buffer while for others filtering is left to the provider implementation. | |
virtual bool | prepareSimplification (const QgsSimplifyMethod &simplifyMethod) |
Setup the simplification of geometries to fetch using the specified simplify method. | |
void | rewindEditBuffer () |
void | prepareJoins () |
bool | fetchNextAddedFeature (QgsFeature &f) |
bool | fetchNextChangedGeomFeature (QgsFeature &f) |
bool | fetchNextChangedAttributeFeature (QgsFeature &f) |
void | useAddedFeature (const QgsFeature &src, QgsFeature &f) |
void | useChangedAttributeFeature (QgsFeatureId fid, const QgsGeometry &geom, QgsFeature &f) |
bool | nextFeatureFid (QgsFeature &f) |
void | addJoinedAttributes (QgsFeature &f) |
void | updateChangedAttributes (QgsFeature &f) |
Update feature with uncommited attribute updates. | |
void | updateFeatureGeometry (QgsFeature &f) |
Update feature with uncommited geometry updates. | |
Protected Member Functions inherited from QgsAbstractFeatureIterator | |
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 |
Protected Attributes | |
QgsVectorLayer * | L |
QgsFeatureRequest | mProviderRequest |
QgsFeatureIterator | mProviderIterator |
QgsFeatureRequest | mChangedFeaturesRequest |
QgsFeatureIterator | mChangedFeaturesIterator |
QSet< QgsFeatureId > | mFetchConsidered |
QgsGeometryMap::ConstIterator | mFetchChangedGeomIt |
QgsFeatureMap::ConstIterator | mFetchAddedFeaturesIt |
bool | mFetchedFid |
QgsFeatureMap | mAddedFeatures |
QgsGeometryMap | mChangedGeometries |
QgsFeatureIds | mDeletedFeatureIds |
QList< QgsField > | mAddedAttributes |
QgsChangedAttributesMap | mChangedAttributeValues |
QgsAttributeList | mDeletedAttributeIds |
QMap< QgsVectorLayer *, FetchJoinInfo > | mFetchJoinInfo |
Informations about joins used in the current select() statement. | |
Protected Attributes inherited from QgsAbstractFeatureIterator | |
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 |
Private Attributes | |
QgsAbstractGeometrySimplifier * | mEditGeometrySimplifier |
optional object to locally simplify edited (changed or added) geometries fetched by this feature iterator |
Definition at line 28 of file qgsvectorlayerfeatureiterator.h.
QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator | ( | QgsVectorLayer * | layer, |
const QgsFeatureRequest & | request | ||
) |
Definition at line 25 of file qgsvectorlayerfeatureiterator.cpp.
References QgsVectorLayerEditBuffer::addedAttributes(), QgsVectorLayerEditBuffer::addedFeatures(), QgsVectorLayerEditBuffer::changedAttributeValues(), QgsVectorLayerEditBuffer::changedGeometries(), QgsVectorLayerJoinBuffer::containsJoins(), QgsFields::count(), QgsVectorLayer::dataProvider(), QgsVectorLayerEditBuffer::deletedAttributeIds(), QgsVectorLayerEditBuffer::deletedFeatureIds(), QgsVectorLayer::editBuffer(), QgsFields::fieldOrigin(), QgsFields::fieldOriginIndex(), QgsFeatureRequest::FilterExpression, QgsFeatureRequest::filterExpression(), QgsFeatureRequest::FilterFid, QgsFeatureRequest::filterFid(), QgsFeatureRequest::filterType(), QgsFeatureRequest::flags(), QgsVectorDataProvider::getFeatures(), L, mAddedAttributes, mAddedFeatures, mChangedAttributeValues, mChangedFeaturesIterator, mChangedFeaturesRequest, mChangedGeometries, mDeletedAttributeIds, mDeletedFeatureIds, mFetchedFid, QgsVectorLayer::mJoinBuffer, mProviderIterator, mProviderRequest, QgsAbstractFeatureIterator::mRequest, QgsFields::OriginProvider, QgsVectorLayer::pendingFields(), QgsExpression::prepare(), prepareJoins(), rewindEditBuffer(), QgsFeatureRequest::setFilterFids(), QgsFeatureRequest::setSubsetOfAttributes(), QgsFeatureRequest::SubsetOfAttributes, and QgsFeatureRequest::subsetOfAttributes().
QgsVectorLayerFeatureIterator::~QgsVectorLayerFeatureIterator | ( | ) |
Definition at line 114 of file qgsvectorlayerfeatureiterator.cpp.
References close(), and mEditGeometrySimplifier.
|
protected |
Definition at line 451 of file qgsvectorlayerfeatureiterator.cpp.
References QgsVectorLayerFeatureIterator::FetchJoinInfo::addJoinedAttributesCached(), QgsVectorLayerFeatureIterator::FetchJoinInfo::addJoinedAttributesDirect(), QgsFeature::attribute(), QgsFeature::attributes(), QgsVectorJoinInfo::cachedAttributes, QgsFields::count(), QgsVectorLayerFeatureIterator::FetchJoinInfo::joinInfo, L, mFetchJoinInfo, QgsVectorLayer::pendingFields(), and QgsVectorLayerFeatureIterator::FetchJoinInfo::targetField.
Referenced by fetchFeature(), nextFeatureFid(), useAddedFeature(), and useChangedAttributeFeature().
|
virtual |
end of iterating: free the resources / lock
Implements QgsAbstractFeatureIterator.
Definition at line 215 of file qgsvectorlayerfeatureiterator.cpp.
References QgsFeatureIterator::close(), QgsAbstractFeatureIterator::mClosed, and mProviderIterator.
Referenced by fetchFeature(), and ~QgsVectorLayerFeatureIterator().
|
protectedvirtual |
fetch next feature, return true on success
Implements QgsAbstractFeatureIterator.
Definition at line 124 of file qgsvectorlayerfeatureiterator.cpp.
References addJoinedAttributes(), close(), QgsFeatureIterator::close(), QgsVectorLayer::dataProvider(), fetchNextAddedFeature(), fetchNextChangedAttributeFeature(), fetchNextChangedGeomFeature(), QgsFeatureRequest::FilterExpression, QgsFeatureRequest::FilterFid, QgsFeatureRequest::FilterRect, QgsFeatureRequest::filterType(), QgsFeatureRequest::flags(), QgsVectorDataProvider::getFeatures(), QgsFeature::id(), QgsFeatureIterator::isClosed(), L, mChangedFeaturesIterator, QgsAbstractFeatureIterator::mClosed, mFetchConsidered, mFetchedFid, mFetchJoinInfo, mProviderIterator, mProviderRequest, QgsAbstractFeatureIterator::mRequest, QgsVectorLayer::mUpdatedFields, QgsFeatureIterator::nextFeature(), nextFeatureFid(), QgsFeatureRequest::NoGeometry, QgsFeature::setFields(), QgsFeature::setValid(), updateChangedAttributes(), and updateFeatureGeometry().
|
protected |
Definition at line 229 of file qgsvectorlayerfeatureiterator.cpp.
References QgsFeatureRequest::acceptFeature(), mAddedFeatures, mFetchAddedFeaturesIt, mFetchConsidered, QgsAbstractFeatureIterator::mRequest, and useAddedFeature().
Referenced by fetchFeature().
|
protected |
Definition at line 309 of file qgsvectorlayerfeatureiterator.cpp.
References QgsExpression::evaluate(), QgsFeatureRequest::FilterExpression, QgsFeatureRequest::filterExpression(), QgsFeatureRequest::filterType(), QgsFeature::id(), mChangedFeaturesIterator, mFetchConsidered, QgsAbstractFeatureIterator::mRequest, QgsFeatureIterator::nextFeature(), and updateChangedAttributes().
Referenced by fetchFeature().
|
protected |
Definition at line 282 of file qgsvectorlayerfeatureiterator.cpp.
References QgsFeatureRequest::filterRect(), mChangedGeometries, mFetchChangedGeomIt, mFetchConsidered, QgsAbstractFeatureIterator::mRequest, and useChangedAttributeFeature().
Referenced by fetchFeature().
|
protected |
Definition at line 605 of file qgsvectorlayerfeatureiterator.cpp.
References addJoinedAttributes(), QgsVectorLayer::dataProvider(), QgsFeatureRequest::filterFid(), QgsFeatureRequest::flags(), QgsVectorDataProvider::getFeatures(), L, mAddedFeatures, mChangedGeometries, mDeletedFeatureIds, mFetchJoinInfo, mProviderRequest, QgsAbstractFeatureIterator::mRequest, QgsFeatureIterator::nextFeature(), QgsFeatureRequest::NoGeometry, updateChangedAttributes(), useAddedFeature(), and useChangedAttributeFeature().
Referenced by fetchFeature().
|
inlineprotectedvirtual |
Overrides default method as we only need to filter features in the edit buffer while for others filtering is left to the provider implementation.
Reimplemented from QgsAbstractFeatureIterator.
Definition at line 47 of file qgsvectorlayerfeatureiterator.h.
References QgsAbstractFeatureIterator::fetchFeature().
|
protected |
Definition at line 389 of file qgsvectorlayerfeatureiterator.cpp.
References QgsFields::exists(), QgsFields::fieldOrigin(), QgsFeatureRequest::flags(), QgsFields::indexFromName(), QgsVectorLayerFeatureIterator::FetchJoinInfo::indexOffset, QgsMapLayerRegistry::instance(), QgsVectorLayerFeatureIterator::FetchJoinInfo::joinField, QgsVectorJoinInfo::joinFieldIndex, QgsVectorJoinInfo::joinFieldName, QgsVectorLayerJoinBuffer::joinForFieldIndex(), QgsVectorLayerFeatureIterator::FetchJoinInfo::joinInfo, QgsVectorLayerFeatureIterator::FetchJoinInfo::joinLayer, QgsVectorJoinInfo::joinLayerId, L, QgsMapLayerRegistry::mapLayer(), mFetchJoinInfo, QgsVectorLayer::mJoinBuffer, QgsAbstractFeatureIterator::mRequest, QgsFields::OriginJoin, QgsVectorLayer::pendingAllAttributesList(), QgsVectorLayer::pendingFields(), QgsFeatureRequest::setSubsetOfAttributes(), QgsFeatureRequest::SubsetOfAttributes, QgsFeatureRequest::subsetOfAttributes(), QgsVectorLayerFeatureIterator::FetchJoinInfo::targetField, QgsVectorJoinInfo::targetFieldIndex, and QgsVectorJoinInfo::targetFieldName.
Referenced by QgsVectorLayerFeatureIterator().
|
protectedvirtual |
Setup the simplification of geometries to fetch using the specified simplify method.
Reimplemented from QgsAbstractFeatureIterator.
Definition at line 474 of file qgsvectorlayerfeatureiterator.cpp.
References QgsSimplifyMethod::createGeometrySimplifier(), QgsFeatureRequest::flags(), QgsVectorLayer::geometryType(), QgsVectorLayer::hasGeometryType(), L, mEditGeometrySimplifier, QgsSimplifyMethod::methodType(), QgsAbstractFeatureIterator::mRequest, QgsFeatureRequest::NoGeometry, QgsSimplifyMethod::NoSimplification, and QGis::Point.
|
privatevirtual |
returns whether the iterator supports simplify geometries on provider side
Definition at line 488 of file qgsvectorlayerfeatureiterator.cpp.
References QgsVectorDataProvider::capabilities(), QgsVectorLayer::dataProvider(), L, QgsSimplifyMethod::NoSimplification, QgsSimplifyMethod::OptimizeForRendering, QgsSimplifyMethod::PreserveTopology, QgsVectorDataProvider::SimplifyGeometries, and QgsVectorDataProvider::SimplifyGeometriesWithTopologicalValidation.
|
virtual |
reset the iterator to the starting position
Implements QgsAbstractFeatureIterator.
Definition at line 197 of file qgsvectorlayerfeatureiterator.cpp.
References QgsFeatureRequest::FilterFid, QgsFeatureRequest::filterType(), QgsAbstractFeatureIterator::mClosed, mFetchedFid, mProviderIterator, QgsAbstractFeatureIterator::mRequest, QgsFeatureIterator::rewind(), and rewindEditBuffer().
|
protected |
Definition at line 379 of file qgsvectorlayerfeatureiterator.cpp.
References mAddedFeatures, mChangedGeometries, mDeletedFeatureIds, mFetchAddedFeaturesIt, mFetchChangedGeomIt, and mFetchConsidered.
Referenced by QgsVectorLayerFeatureIterator(), and rewind().
|
protected |
Update feature with uncommited attribute updates.
Definition at line 645 of file qgsvectorlayerfeatureiterator.cpp.
References QgsFeature::attributes(), QgsFeature::id(), mAddedAttributes, mChangedAttributeValues, and mDeletedAttributeIds.
Referenced by fetchFeature(), fetchNextChangedAttributeFeature(), nextFeatureFid(), and useChangedAttributeFeature().
|
protected |
Update feature with uncommited geometry updates.
Definition at line 667 of file qgsvectorlayerfeatureiterator.cpp.
References QgsFeature::id(), mChangedGeometries, and QgsFeature::setGeometry().
Referenced by fetchFeature().
|
protected |
Definition at line 253 of file qgsvectorlayerfeatureiterator.cpp.
References addJoinedAttributes(), QgsFeature::attributes(), QgsFeatureRequest::flags(), QgsFeature::geometry(), QgsFeature::id(), L, QGis::Line, mEditGeometrySimplifier, mFetchJoinInfo, QgsAbstractFeatureIterator::mRequest, QgsVectorLayer::mUpdatedFields, QgsFeatureRequest::NoGeometry, QGis::Polygon, QgsFeature::setAttributes(), QgsFeature::setFeatureId(), QgsFeature::setFields(), QgsFeature::setGeometry(), QgsFeature::setValid(), QgsAbstractGeometrySimplifier::simplifyGeometry(), and QgsGeometry::type().
Referenced by fetchNextAddedFeature(), and nextFeatureFid().
|
protected |
Definition at line 334 of file qgsvectorlayerfeatureiterator.cpp.
References addJoinedAttributes(), QgsFeature::attributes(), QgsVectorLayer::dataProvider(), QgsFeatureRequest::flags(), QgsFeature::geometry(), QgsVectorDataProvider::getFeatures(), L, QGis::Line, mEditGeometrySimplifier, mFetchJoinInfo, mProviderRequest, QgsAbstractFeatureIterator::mRequest, QgsVectorLayer::mUpdatedFields, QgsFeatureIterator::nextFeature(), QgsFeatureRequest::NoGeometry, QGis::Polygon, QgsFeature::setAttributes(), QgsFeature::setFeatureId(), QgsFeature::setFields(), QgsFeatureRequest::setFilterFid(), QgsFeatureRequest::setFlags(), QgsFeature::setGeometry(), QgsFeatureRequest::setSubsetOfAttributes(), QgsFeature::setValid(), QgsAbstractGeometrySimplifier::simplifyGeometry(), QgsFeatureRequest::SubsetOfAttributes, QgsFeatureRequest::subsetOfAttributes(), QgsGeometry::type(), and updateChangedAttributes().
Referenced by fetchNextChangedGeomFeature(), and nextFeatureFid().
|
protected |
Definition at line 52 of file qgsvectorlayerfeatureiterator.h.
Referenced by addJoinedAttributes(), fetchFeature(), nextFeatureFid(), prepareJoins(), prepareSimplification(), providerCanSimplify(), QgsVectorLayerFeatureIterator(), useAddedFeature(), and useChangedAttributeFeature().
|
protected |
Definition at line 113 of file qgsvectorlayerfeatureiterator.h.
Referenced by QgsVectorLayerFeatureIterator(), and updateChangedAttributes().
|
protected |
Definition at line 110 of file qgsvectorlayerfeatureiterator.h.
Referenced by fetchNextAddedFeature(), nextFeatureFid(), QgsVectorLayerFeatureIterator(), and rewindEditBuffer().
|
protected |
Definition at line 114 of file qgsvectorlayerfeatureiterator.h.
Referenced by QgsVectorLayerFeatureIterator(), and updateChangedAttributes().
|
protected |
Definition at line 57 of file qgsvectorlayerfeatureiterator.h.
Referenced by fetchFeature(), fetchNextChangedAttributeFeature(), and QgsVectorLayerFeatureIterator().
|
protected |
Definition at line 56 of file qgsvectorlayerfeatureiterator.h.
Referenced by QgsVectorLayerFeatureIterator().
|
protected |
Definition at line 111 of file qgsvectorlayerfeatureiterator.h.
Referenced by fetchNextChangedGeomFeature(), nextFeatureFid(), QgsVectorLayerFeatureIterator(), rewindEditBuffer(), and updateFeatureGeometry().
|
protected |
Definition at line 115 of file qgsvectorlayerfeatureiterator.h.
Referenced by QgsVectorLayerFeatureIterator(), and updateChangedAttributes().
|
protected |
Definition at line 112 of file qgsvectorlayerfeatureiterator.h.
Referenced by nextFeatureFid(), QgsVectorLayerFeatureIterator(), and rewindEditBuffer().
|
private |
optional object to locally simplify edited (changed or added) geometries fetched by this feature iterator
Definition at line 123 of file qgsvectorlayerfeatureiterator.h.
Referenced by prepareSimplification(), useAddedFeature(), useChangedAttributeFeature(), and ~QgsVectorLayerFeatureIterator().
|
protected |
Definition at line 71 of file qgsvectorlayerfeatureiterator.h.
Referenced by fetchNextAddedFeature(), and rewindEditBuffer().
|
protected |
Definition at line 70 of file qgsvectorlayerfeatureiterator.h.
Referenced by fetchNextChangedGeomFeature(), and rewindEditBuffer().
|
protected |
Definition at line 69 of file qgsvectorlayerfeatureiterator.h.
Referenced by fetchFeature(), fetchNextAddedFeature(), fetchNextChangedAttributeFeature(), fetchNextChangedGeomFeature(), and rewindEditBuffer().
|
protected |
Definition at line 73 of file qgsvectorlayerfeatureiterator.h.
Referenced by fetchFeature(), QgsVectorLayerFeatureIterator(), and rewind().
|
protected |
Informations about joins used in the current select() statement.
Allows faster mapping of attribute ids compared to mVectorJoins
Definition at line 119 of file qgsvectorlayerfeatureiterator.h.
Referenced by addJoinedAttributes(), fetchFeature(), nextFeatureFid(), prepareJoins(), useAddedFeature(), and useChangedAttributeFeature().
|
protected |
Definition at line 55 of file qgsvectorlayerfeatureiterator.h.
Referenced by close(), fetchFeature(), QgsVectorLayerFeatureIterator(), and rewind().
|
protected |
Definition at line 54 of file qgsvectorlayerfeatureiterator.h.
Referenced by fetchFeature(), nextFeatureFid(), QgsVectorLayerFeatureIterator(), and useChangedAttributeFeature().