QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
33 QMutexLocker locker( &layer->mFeatureSourceConstructorMutex );
56 if ( L->editBuffer()->addedFeatures().contains( request.filterFid() ) )
57 mAddedFeatures.insert( request.filterFid(), L->editBuffer()->addedFeatures()[ request.filterFid()] );
59 if ( L->editBuffer()->changedGeometries().contains( request.filterFid() ) )
60 mChangedGeometries.insert( request.filterFid(), L->editBuffer()->changedGeometries()[ request.filterFid()] );
62 if ( L->editBuffer()->deletedFeatureIds().contains( request.filterFid() ) )
65 if ( L->editBuffer()->changedAttributeValues().contains( request.filterFid() ) )
66 mChangedAttributeValues.insert( request.filterFid(), L->editBuffer()->changedAttributeValues()[ request.filterFid()] );
68 if ( L->editBuffer()->changedAttributeValues().contains( request.filterFid() ) )
69 mChangedFeaturesRequest.setFilterFids(
QgsFeatureIds() << request.filterFid() );
120 , mFetchedFid( false )
149 for (
int attrIndex : usedAttributeIndices )
152 mDelegatedOrderByToProvider =
false;
192 if ( !mDelegatedOrderByToProvider )
200 QSet<int> providerSubset;
203 for (
int attrIndex : subset )
205 if ( attrIndex < 0 || attrIndex >= nPendingFields )
219 for (
int attrIndex : usedAttributeIndices )
221 providerSubset << attrIndex;
232 for (
const QString &
field : constReferencedColumns )
260 changedIds << attIt.key();
322 class QgsThreadStackOverflowGuard
326 QgsThreadStackOverflowGuard( QThreadStorage<QStack<QString>> &storage,
const QString &stackFrameInformation,
int maxDepth )
327 : mStorage( storage )
328 , mMaxDepth( maxDepth )
330 if ( !storage.hasLocalData() )
332 storage.setLocalData( QStack<QString>() );
335 storage.localData().push( stackFrameInformation );
338 ~QgsThreadStackOverflowGuard()
340 mStorage.localData().pop();
343 bool hasStackOverflow()
const
345 if ( mStorage.localData().size() > mMaxDepth )
351 QString topFrames()
const
353 QStringList dumpStack;
354 const QStack<QString> &stack = mStorage.localData();
356 int dumpSize = std::min( stack.size(), 10 );
357 for (
int i = 0; i < dumpSize; ++i )
359 dumpStack += stack.at( i );
362 return dumpStack.join(
'\n' );
367 return mStorage.localData().size();
371 QThreadStorage<QStack<QString>> &mStorage;
384 static QThreadStorage<QStack<QString>> sStack;
386 QgsThreadStackOverflowGuard guard( sStack,
mSource->
id(), 4 );
388 if ( guard.hasStackOverflow() )
399 if ( res && postProcessFeature( f ) )
473 if ( !postProcessFeature( f ) )
520 mInterruptionChecker = interruptionChecker;
546 if ( !postProcessFeature( f ) )
600 if ( postProcessFeature( f ) )
691 int sourceLayerIndex;
693 Q_ASSERT( joinInfo );
719 mFetchJoinInfo[ joinInfo ].attributes.push_back( sourceLayerIndex );
725 static QThreadStorage<QStack<QString>> sStack;
727 QgsThreadStackOverflowGuard guard( sStack,
mSource->
id(), 4 );
729 if ( guard.hasStackOverflow() )
738 std::unique_ptr<QgsExpression> exp = qgis::make_unique<QgsExpression>( exps[oi].cachedExpression );
743 exp->setGeomCalculator( &da );
747 if ( !mExpressionContext )
748 createExpressionContext();
749 exp->prepare( mExpressionContext.get() );
750 const QSet<int> referencedColumns = exp->referencedAttributeIndexes(
mSource->
fields() );
754 for (
int dependentFieldIdx : referencedColumns )
758 requestedAttributes += dependentFieldIdx;
761 if ( !mPreparedFields.contains( dependentFieldIdx ) && !mFieldsToPrepare.contains( dependentFieldIdx ) )
762 mFieldsToPrepare << dependentFieldIdx;
770 if ( exp->needsGeometry() )
780 mPreparedFields.clear();
781 mFieldsToPrepare.clear();
783 mOrderedJoinInfoList.clear();
785 mExpressionContext.reset();
789 while ( !mFieldsToPrepare.isEmpty() )
791 int fieldIdx = mFieldsToPrepare.takeFirst();
792 if ( mPreparedFields.contains( fieldIdx ) )
795 mPreparedFields << fieldIdx;
802 createOrderedJoinList();
806 void QgsVectorLayerFeatureIterator::createOrderedJoinList()
809 if ( mOrderedJoinInfoList.size() < 2 )
814 QSet<int> resolvedFields;
817 QList< int >::const_iterator prepFieldIt = mPreparedFields.constBegin();
818 for ( ; prepFieldIt != mPreparedFields.constEnd(); ++prepFieldIt )
822 resolvedFields.insert( *prepFieldIt );
829 int maxIterations = ( mOrderedJoinInfoList.size() + 1 ) * mOrderedJoinInfoList.size() / 2.0;
830 int currentIteration = 0;
832 for (
int i = 0; i < mOrderedJoinInfoList.size() - 1; ++i )
834 if ( !resolvedFields.contains( mOrderedJoinInfoList.at( i ).targetField ) )
836 mOrderedJoinInfoList.append( mOrderedJoinInfoList.at( i ) );
837 mOrderedJoinInfoList.removeAt( i );
842 int offset = mOrderedJoinInfoList.at( i ).indexOffset;
843 int joinField = mOrderedJoinInfoList.at( i ).joinField;
846 for (
int n = 0; n < attributes.size(); n++ )
848 if ( n != joinField )
850 resolvedFields.insert( joinField < n ? n + offset - 1 : n + offset );
856 if ( currentIteration >= maxIterations )
863 bool QgsVectorLayerFeatureIterator::postProcessFeature(
QgsFeature &feature )
865 bool result = checkGeometryValidity( feature );
871 bool QgsVectorLayerFeatureIterator::checkGeometryValidity(
const QgsFeature &feature )
936 QList< FetchJoinInfo >::const_iterator joinIt = mOrderedJoinInfoList.constBegin();
937 for ( ; joinIt != mOrderedJoinInfoList.constEnd(); ++joinIt )
939 QVariant targetFieldValue = f.
attribute( joinIt->targetField );
940 if ( !targetFieldValue.isValid() )
943 const QHash< QString, QgsAttributes> &memoryCache = joinIt->joinInfo->cachedAttributes;
944 if ( memoryCache.isEmpty() )
945 joinIt->addJoinedAttributesDirect( f, targetFieldValue );
947 joinIt->addJoinedAttributesCached( f, targetFieldValue );
961 QList< int > fetchedVirtualAttributes;
963 QMap<const QgsVectorLayerJoinInfo *, FetchJoinInfo>::const_iterator joinIt =
mFetchJoinInfo.constBegin();
970 fetchedVirtualAttributes << joinIt->targetField;
983 if ( fetchedVirtualAttributes.contains( it.key() ) )
996 if ( !mExpressionContext )
997 createExpressionContext();
999 mExpressionContext->setFeature( f );
1000 QVariant val = exp->
evaluate( mExpressionContext.get() );
1012 Q_UNUSED( simplifyMethod )
1018 Q_UNUSED( methodType )
1026 QHash<QString, QgsAttributes>::const_iterator it = memoryCache.find( joinValue.toString() );
1027 if ( it == memoryCache.constEnd() )
1033 for (
int i = 0; i < featureAttributes.count(); ++i )
1044 if ( joinLayer && ! joinLayer->hasFeatures() )
1050 QString subsetString;
1052 QString joinFieldName = joinInfo->joinFieldName();
1054 subsetString.append( QStringLiteral(
"\"%1\"" ).arg( joinFieldName ) );
1056 if ( joinValue.isNull() )
1058 subsetString += QLatin1String(
" IS NULL" );
1062 QString v = joinValue.toString();
1063 switch ( joinValue.type() )
1066 case QVariant::LongLong:
1067 case QVariant::Double:
1071 case QVariant::String:
1072 v.replace(
'\'', QLatin1String(
"''" ) );
1073 v.prepend(
'\'' ).append(
'\'' );
1076 subsetString +=
'=' + v;
1081 QVector<int> subsetIndices;
1082 if ( joinInfo->hasSubset() )
1100 int index = indexOffset;
1102 if ( joinInfo->hasSubset() )
1104 for (
int i = 0; i < subsetIndices.count(); ++i )
1105 f.
setAttribute( index++, attr.at( subsetIndices.at( i ) ) );
1110 for (
int i = 0; i < attr.count(); ++i )
1112 if ( i == joinField )
1146 if ( iter->id() == featureId )
1188 for ( QgsAttributeMap::const_iterator it = map.begin(); it != map.end(); ++it )
1189 attrs[it.key()] = it.value();
1200 void QgsVectorLayerFeatureIterator::createExpressionContext()
1202 mExpressionContext = qgis::make_unique< QgsExpressionContext >();
1208 bool QgsVectorLayerFeatureIterator::prepareOrderBy(
const QList<QgsFeatureRequest::OrderByClause> &orderBys )
1210 Q_UNUSED( orderBys )
1211 return mDelegatedOrderByToProvider;
1221 , mSelectedFeatureIds( layer->selectedFeatureIds() )
1222 , mWkbType( layer->wkbType() )
1223 , mName( layer->name() )
1248 return QgsFeatureIterator(
new QgsVectorLayerSelectedFeatureIterator( mSelectedFeatureIds, req, mSource ) );
1253 return mSource.
crs();
1268 return mSelectedFeatureIds.count();
1279 return mLayer->createExpressionContextScope();
1287 return mLayer->hasSpatialIndex();
1299 , mSelectedFeatureIds( selectedFeatureIds )
1312 bool QgsVectorLayerSelectedFeatureIterator::rewind()
1314 return mIterator.
rewind();
1317 bool QgsVectorLayerSelectedFeatureIterator::close()
1319 return mIterator.close();
1322 bool QgsVectorLayerSelectedFeatureIterator::fetchFeature(
QgsFeature &f )
1324 while ( mIterator.nextFeature( f ) )
1326 if ( mSelectedFeatureIds.contains( f.
id() ) )
@ OriginProvider
Field comes from the underlying data provider of the vector layer (originIndex = index in provider's ...
@ NoGeometry
Geometry is not required. It may still be returned if e.g. required for a filter condition.
bool fetchNextAddedFeature(QgsFeature &f)
std::function< void(const QgsFeature &) > invalidGeometryCallback() const
Returns the callback function to use when encountering an invalid geometry and invalidGeometryCheck()...
QgsCoordinateReferenceSystem crs
QgsExpressionContextScope mLayerScope
Q_INVOKABLE QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) override
Gets an iterator for features matching the specified request.
QgsFeatureIterator mChangedFeaturesIterator
void setInterruptionChecker(QgsFeedback *interruptionChecker) override
Attach an object that can be queried regularly by the iterator to check if it must stopped.
static QVector< int > joinSubsetIndices(QgsVectorLayer *joinLayer, const QStringList &joinFieldsSubset)
Returns a vector of indices for use in join based on field names from the layer.
@ OriginEdit
Field has been temporarily added in editing mode (originIndex = index in the list of added attributes...
@ FilterFid
Filter using feature ID.
void prepareJoin(int fieldIdx)
This class contains information about how to simplify geometries fetched from a QgsFeatureIterator.
const QgsFeatureIds & filterFids() const
Gets feature IDs that should be fetched.
@ GeometryAbortOnInvalid
Close iterator on encountering any features with invalid geometry. This requires a slow geometry vali...
void addJoinedAttributesDirect(QgsFeature &f, const QVariant &joinValue) const
QgsCoordinateTransformContext transformContext() const
Returns the transform context, for use when a destinationCrs() has been set and reprojection is requi...
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
bool acceptFeature(const QgsFeature &feature)
Check if a feature is accepted by this requests filter.
QgsCoordinateTransform mTransform
QSet< QString > referencedColumns() const
Gets list of columns referenced by the expression.
void setId(QgsFeatureId id)
Sets the feature ID for this feature.
QgsVectorLayerFeatureIterator(QgsVectorLayerFeatureSource *source, bool ownSource, const QgsFeatureRequest &request)
QgsCoordinateReferenceSystem sourceCrs() const override
Returns the coordinate reference system for features in the source.
void addVirtualAttributes(QgsFeature &f)
Adds attributes that don't source from the provider but are added inside QGIS Includes.
QgsFeatureId filterFid() const
Gets the feature ID that should be fetched.
QgsFeatureMap mAddedFeatures
const Flags & flags() const
const QgsRectangle & filterRect() const
Returns the rectangle from which features will be taken.
void iteratorClosed()
to be called by from subclass in close()
QMap< int, QgsExpression * > mExpressionFieldInfo
FilterType filterType() const
Returns the filter type which is currently set on this request.
bool mClosed
Sets to true, as soon as the iterator is closed.
int count() const
Returns number of items.
Container of fields for a vector layer.
QSet< int > referencedAttributeIndexes(const QgsFields &fields) const
Returns a list of field name indexes obtained from the provided fields.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
QgsAttributeList mDeletedAttributeIds
QgsCoordinateTransformContext transformContext
void setValid(bool validity)
Sets the validity of the feature.
QgsFields fields() const
Returns the fields that will be available for features that are retrieved from this source.
static QgsProject * instance()
Returns the QgsProject singleton instance.
const QgsVectorLayerJoinInfo * joinForFieldIndex(int index, const QgsFields &fields, int &sourceFieldIndex) const
Finds the vector join for a layer field index.
QStringList * joinFieldNamesSubset() const
Returns the subset of fields to be used from joined layer.
QgsVectorLayerFeatureSource * mSource
QgsChangedAttributesMap mChangedAttributeValues
bool fetchNextChangedAttributeFeature(QgsFeature &f)
void setFields(const QgsFields &fields)
Convenience function for setting a fields for the context.
Type
The WKB type describes the number of dimensions a geometry has.
QgsFeatureIterator mProviderIterator
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system for feature's geometries, or an invalid QgsCoordi...
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
QgsFeatureRequest mRequest
A copy of the feature request.
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
void addExpressionAttribute(QgsFeature &f, int attrIndex)
Adds an expression based attribute to a feature.
QString sourceName() const override
Returns a friendly display name for the source.
bool isClosed() const
find out whether the iterator is still valid or closed already
QgsVectorLayerJoinBuffer * mJoinBuffer
@ GeometrySkipInvalid
Skip any features with invalid geometry. This requires a slow geometry validity check for every featu...
void addJoinedAttributes(QgsFeature &f)
QgsGeometryMap::ConstIterator mFetchChangedGeomIt
QList< int > QgsAttributeList
@ SubsetOfAttributes
Fetch only a subset of attributes (setSubsetOfAttributes sets this flag)
QgsFeatureRequest & disableFilter()
Disables filter conditions.
Helper template that cares of two things: 1.
QgsFeatureRequest & setFilterFid(QgsFeatureId fid)
Sets feature ID that should be fetched.
QgsExpressionContext * expressionContext()
Returns the expression context used to evaluate filter expressions.
QgsGeometryMap mChangedGeometries
void addJoinedAttributesCached(QgsFeature &f, const QVariant &joinValue) const
int joinedFieldsOffset(const QgsVectorLayerJoinInfo *info, const QgsFields &fields)
Find out what is the first index of the join within fields.
QgsVectorLayerSelectedFeatureSource(QgsVectorLayer *layer)
Constructor for QgsVectorLayerSelectedFeatureSource, for selected features from the specified layer.
QgsFeatureRequest & setFilterExpression(const QString &expression)
Set the filter expression.
QgsFeatureRequest & setFilterRect(const QgsRectangle &rectangle)
Sets the rectangle from which features will be taken.
QString targetFieldName() const
Returns name of the field of our layer that will be used for join.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
QgsWkbTypes::Type wkbType() const override
Returns the geometry type for features returned by this source.
bool fetchFeature(QgsFeature &feature) override
fetch next feature, return true on success
bool setEllipsoid(const QString &ellipsoid)
Sets the ellipsoid by its acronym.
QgsRectangle filterRectToSourceCrs(const QgsCoordinateTransform &transform) const SIP_THROW(QgsCsException)
Returns a rectangle representing the original request's QgsFeatureRequest::filterRect().
This class wraps a request for features to a vector layer (or directly its vector data provider).
QgsFeatureRequest mChangedFeaturesRequest
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
Custom exception class for Coordinate Reference System related exceptions.
int joinField
Index of field (of the joined layer) must have equal value.
void prepareField(int fieldIdx)
bool prepareSimplification(const QgsSimplifyMethod &simplifyMethod) override
Setup the simplification of geometries to fetch using the specified simplify method.
QgsVectorLayer * joinLayer
Resolved pointer to the joined layer.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
QgsExpressionContextScope * createExpressionContextScope() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
QgsAttributeList deletedAttributeIds() const
Returns a list of deleted attributes fields which are not committed.
QHash< QString, QgsAttributes > cachedAttributes
Cache for joined attributes to provide fast lookup (size is 0 if no memory caching)
void setFields(const QgsFields &fields, bool initAttributes=false)
Assign a field map with the feature to allow attribute access by attribute name.
bool exists(int i) const
Returns if a field index is valid.
QgsFields fields() const override
Returns the fields associated with features in the source.
virtual QgsAbstractFeatureSource * featureSource() const =0
Returns feature source object that can be used for querying provider's data.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
@ OriginUnknown
It has not been specified where the field comes from.
QString id() const
Returns the layer id of the source layer.
QList< QgsField > mAddedAttributes
QgsChangedAttributesMap changedAttributeValues() const
Returns a map of features with changed attributes values which are not committed.
SpatialIndexPresence
Enumeration of spatial index presence states.
QgsExpression * filterExpression() const
Returns the filter expression if set.
QgsVectorLayerJoinBuffer * clone() const
Create a copy of the join buffer.
void updateFeatureGeometry(QgsFeature &f)
Update feature with uncommitted geometry updates.
FieldOrigin fieldOrigin(int fieldIdx) const
Gets field's origin (value from an enumeration)
void updateChangedAttributes(QgsFeature &f)
Update feature with uncommitted attribute updates.
QMap< int, QVariant > QgsAttributeMap
~QgsVectorLayerFeatureIterator() override
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
void useAddedFeature(const QgsFeature &src, QgsFeature &f)
QString joinFieldName() const
Returns name of the field of joined layer that will be used for join.
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
QgsFeatureRequest & setFilterFids(const QgsFeatureIds &fids)
Sets feature IDs that should be fetched.
void createJoinCaches()
Calls cacheJoinLayer() for all vector joins.
bool nextFeatureFid(QgsFeature &f)
QList< QgsExpressionFieldBuffer::ExpressionField > expressions() const
void prepareExpression(int fieldIdx)
Defines left outer join from our vector layer to some other vector layer.
Buffers information about expression fields for a vector layer.
void setSourceCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets source spatial reference system crs.
@ FilterExpression
Filter using expression.
QMap< QgsFeatureId, QgsFeature > QgsFeatureMap
int indexOffset
At what position the joined fields start.
void geometryToDestinationCrs(QgsFeature &feature, const QgsCoordinateTransform &transform) const
Transforms feature's geometry according to the specified coordinate transform.
bool prepare(const QgsExpressionContext *context)
Gets the expression ready for evaluation - find out column indexes.
QSet< QgsFeatureId > QgsFeatureIds
This class represents a coordinate reference system (CRS).
QgsCoordinateReferenceSystem mCrs
QVariant evaluate()
Evaluate the feature and return the result.
Single scope for storing variables and functions for use within a QgsExpressionContext.
int targetField
Index of field (of this layer) that drives the join.
QSet< int > CORE_EXPORT usedAttributeIndices(const QgsFields &fields) const
Returns a set of used, validated attribute indices.
QgsFeatureRequest mProviderRequest
Join information prepared for fast attribute id mapping in QgsVectorLayerJoinBuffer::updateFeatureAtt...
QgsFeatureIds deletedFeatureIds() const
Returns a list of deleted feature IDs which are not committed.
friend class QgsVectorLayerFeatureIterator
QgsAttributeList allAttributesList() const
Utility function to get list of attribute indexes.
bool setAttribute(int field, const QVariant &attr)
Set an attribute's value by field index.
bool rewind() override
reset the iterator to the starting position
@ OriginExpression
Field is calculated from an expression.
QgsExpressionFieldBuffer * mExpressionFieldBuffer
Represents a list of OrderByClauses, with the most important first and the least important last.
bool nextFeature(QgsFeature &f)
long featureCount() const override
Returns the number of features contained in the source, or -1 if the feature count is unknown.
A geometry is the spatial representation of a feature.
bool mHasVirtualAttributes
@ SpatialIndexUnknown
Spatial index presence cannot be determined, index may or may not exist.
InvalidGeometryCheck invalidGeometryCheck() const
Returns the invalid geometry checking behavior.
OrderBy orderBy() const
Returns a list of order by clauses specified for this feature request.
Represents a vector layer which manages a vector based data sets.
bool hasGeometry() const
Returns true if the feature has an associated geometry.
QgsFeatureRequest & setLimit(long limit)
Set the maximum number of features to request.
QSet< QgsFeatureId > mFetchConsidered
QgsAttributeList subsetOfAttributes() const
Returns the subset of attributes which at least need to be fetched.
Partial snapshot of vector layer's state (only the members necessary for access to features)
QgsVectorLayer * joinLayer() const
Returns joined layer (may be nullptr if the reference was set by layer ID and not resolved yet)
QgsGeometryMap changedGeometries() const
Returns a map of features with changed geometries which are not committed.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
QgsVectorDataProvider * dataProvider() FINAL
Returns the layer's data provider, it may be nullptr.
int fieldOriginIndex(int fieldIdx) const
Gets field's origin index (its meaning is specific to each type of origin)
QgsVectorLayerFeatureSource(const QgsVectorLayer *layer)
Constructor for QgsVectorLayerFeatureSource.
QgsFeatureRequest & setOrderBy(const OrderBy &orderBy)
Set a list of order by clauses.
@ GeometryNoCheck
No invalid geometry checking.
bool containsJoins() const
Quick way to test if there is any join at all.
void useChangedAttributeFeature(QgsFeatureId fid, const QgsGeometry &geom, QgsFeature &f)
bool needsGeometry() const
Returns true if the expression uses feature geometry for some computation.
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
~QgsVectorLayerFeatureSource() override
@ FilterNone
No filter is applied.
bool close() override
end of iterating: free the resources / lock
virtual QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())=0
Gets an iterator for features matching the specified request.
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
void setInterruptionChecker(QgsFeedback *interruptionChecker)
Attach an object that can be queried regularly by the iterator to check if it must stopped.
bool isValid() const override
Returns if this iterator is valid.
QgsAbstractFeatureSource * mProviderFeatureSource
QgsCoordinateReferenceSystem crs() const
Returns the coordinate reference system for features retrieved from this source.
QgsFeatureRequest & setDestinationCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets the destination crs for feature's geometries.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const override
Returns an iterator for the features in the source.
bool isGeosValid(QgsGeometry::ValidityFlags flags=QgsGeometry::ValidityFlags()) const
Checks validity of the geometry using GEOS.
SpatialIndexPresence hasSpatialIndex() const override
Returns an enum value representing the presence of a valid spatial index on the source,...
const QgsVectorLayerJoinInfo * joinInfo
Canonical source of information about the join.
void setAttributes(const QgsAttributes &attrs)
Sets the feature's attributes.
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
QgsField at(int i) const
Gets field at particular index (must be in range 0..N-1)
QList< QgsField > addedAttributes() const
Returns a list of added attributes fields which are not committed.
Class for parsing and evaluation of expressions (formerly called "search strings").
Wrapper for iterator of features from vector data provider or vector layer.
QgsFeatureRequest & setFlags(QgsFeatureRequest::Flags flags)
Sets flags that affect how features will be fetched.
const QgsAttributeList & attributeIndexes
bool fetchNextChangedGeomFeature(QgsFeature &f)
Internal feature iterator to be implemented within data providers.
QgsFeatureIds mDeletedFeatureIds
QMap< const QgsVectorLayerJoinInfo *, QgsVectorLayerFeatureIterator::FetchJoinInfo > mFetchJoinInfo
Information about joins used in the current select() statement.
QgsFeatureMap addedFeatures() const
Returns a map of new features which are not committed.
bool isNull() const
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
bool convertCompatible(QVariant &v, QString *errorMessage=nullptr) const
Converts the provided variant to a compatible format.
bool isValid() const
Will return if this iterator is valid.
int indexFromName(const QString &fieldName) const
Gets the field index from the field name.
QgsFeatureMap::ConstIterator mFetchAddedFeaturesIt
@ OriginJoin
Field comes from a joined layer (originIndex / 1000 = index of the join, originIndex % 1000 = index w...
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
long limit() const
Returns the maximum number of features to request, or -1 if no limit set.