QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
|
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource, modifying results according to the settings in a QgsProcessingContext. More...
#include <qgsprocessingutils.h>
Public Member Functions | |
QgsProcessingFeatureSource (QgsFeatureSource *originalSource, const QgsProcessingContext &context, bool ownsOriginalSource=false, long long featureLimit=-1, const QString &filterExpression=QString()) | |
Constructor for QgsProcessingFeatureSource, accepting an original feature source originalSource and processing context. | |
~QgsProcessingFeatureSource () override | |
QgsFeatureIds | allFeatureIds () const override |
Returns a list of all feature IDs for features present in the source. | |
QgsExpressionContextScope * | createExpressionContextScope () const |
Returns an expression context scope suitable for this source. | |
long long | featureCount () const override |
Returns the number of features contained in the source, or -1 if the feature count is unknown. | |
QgsFields | fields () const override |
Returns the fields associated with features in the source. | |
QgsFeatureIterator | getFeatures (const QgsFeatureRequest &request, Qgis::ProcessingFeatureSourceFlags flags) const |
Returns an iterator for the features in the source, respecting the supplied feature flags. | |
QgsFeatureIterator | getFeatures (const QgsFeatureRequest &request=QgsFeatureRequest()) const override |
Returns an iterator for the features in the source. | |
Qgis::FeatureAvailability | hasFeatures () const override |
Determines if there are any features available in the source. | |
Qgis::SpatialIndexPresence | hasSpatialIndex () const override |
Returns an enum value representing the presence of a valid spatial index on the source, if it can be determined. | |
Qgis::InvalidGeometryCheck | invalidGeometryCheck () const |
Returns the geometry check method for the source. | |
QVariant | maximumValue (int fieldIndex) const override |
Returns the maximum value for an attribute column or an invalid variant in case of error. | |
QVariant | minimumValue (int fieldIndex) const override |
Returns the minimum value for an attribute column or an invalid variant in case of error. | |
void | setInvalidGeometryCheck (Qgis::InvalidGeometryCheck method) |
Overrides the default geometry check method for the source. | |
QgsCoordinateReferenceSystem | sourceCrs () const override |
Returns the coordinate reference system for features in the source. | |
QgsRectangle | sourceExtent () const override |
Returns the extent of all geometries from the source. | |
QString | sourceName () const override |
Returns a friendly display name for the source. | |
QSet< QVariant > | uniqueValues (int fieldIndex, int limit=-1) const override |
Returns the set of unique values contained within the specified fieldIndex from this source. | |
Qgis::WkbType | wkbType () const override |
Returns the geometry type for features returned by this source. | |
Public Member Functions inherited from QgsFeatureSource | |
virtual | ~QgsFeatureSource ()=default |
QgsVectorLayer * | materialize (const QgsFeatureRequest &request, QgsFeedback *feedback=nullptr) |
Materializes a request (query) made against this feature source, by running it over the source and returning a new memory based vector layer containing the result. | |
virtual QgsBox3D | sourceExtent3D () const |
Returns the 3D extent of all geometries from the source. | |
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource, modifying results according to the settings in a QgsProcessingContext.
Definition at line 685 of file qgsprocessingutils.h.
QgsProcessingFeatureSource::QgsProcessingFeatureSource | ( | QgsFeatureSource * | originalSource, |
const QgsProcessingContext & | context, | ||
bool | ownsOriginalSource = false , |
||
long long | featureLimit = -1 , |
||
const QString & | filterExpression = QString() |
||
) |
Constructor for QgsProcessingFeatureSource, accepting an original feature source originalSource and processing context.
Ownership of originalSource is dictated by ownsOriginalSource. If ownsOriginalSource is false
, ownership is not transferred, and callers must ensure that originalSource exists for the lifetime of this object. If ownsOriginalSource is true
, then this object will take ownership of originalSource.
If featureLimit is set to a value > 0, then a limit is placed on the maximum number of features which will be read from the source.
Since QGIS 3.32, the optional filterExpression can be used to specify an expression based filter for the source.
Definition at line 1732 of file qgsprocessingutils.cpp.
|
override |
Definition at line 1752 of file qgsprocessingutils.cpp.
|
overridevirtual |
Returns a list of all feature IDs for features present in the source.
Reimplemented from QgsFeatureSource.
Definition at line 1931 of file qgsprocessingutils.cpp.
QgsExpressionContextScope * QgsProcessingFeatureSource::createExpressionContextScope | ( | ) | const |
Returns an expression context scope suitable for this source.
Definition at line 1957 of file qgsprocessingutils.cpp.
|
overridevirtual |
Returns the number of features contained in the source, or -1 if the feature count is unknown.
Implements QgsFeatureSource.
Definition at line 1827 of file qgsprocessingutils.cpp.
|
overridevirtual |
Returns the fields associated with features in the source.
Implements QgsFeatureSource.
Definition at line 1817 of file qgsprocessingutils.cpp.
QgsFeatureIterator QgsProcessingFeatureSource::getFeatures | ( | const QgsFeatureRequest & | request, |
Qgis::ProcessingFeatureSourceFlags | flags | ||
) | const |
Returns an iterator for the features in the source, respecting the supplied feature flags.
An optional request can be used to optimise the returned iterator, eg by restricting the returned attributes or geometry.
Definition at line 1758 of file qgsprocessingutils.cpp.
|
overridevirtual |
Returns an iterator for the features in the source.
An optional request can be used to optimise the returned iterator, eg by restricting the returned attributes or geometry.
Implements QgsFeatureSource.
Definition at line 1794 of file qgsprocessingutils.cpp.
|
overridevirtual |
Determines if there are any features available in the source.
Reimplemented from QgsFeatureSource.
Definition at line 1782 of file qgsprocessingutils.cpp.
|
overridevirtual |
Returns an enum value representing the presence of a valid spatial index on the source, if it can be determined.
If QgsFeatureSource::SpatialIndexUnknown is returned then the presence of an index cannot be determined.
Reimplemented from QgsFeatureSource.
Definition at line 1952 of file qgsprocessingutils.cpp.
Qgis::InvalidGeometryCheck QgsProcessingFeatureSource::invalidGeometryCheck | ( | ) | const |
Returns the geometry check method for the source.
Definition at line 1988 of file qgsprocessingutils.cpp.
|
overridevirtual |
Returns the maximum value for an attribute column or an invalid variant in case of error.
The base class implementation uses a non-optimised approach of looping through all features in the source.
Reimplemented from QgsFeatureSource.
Definition at line 1898 of file qgsprocessingutils.cpp.
|
overridevirtual |
Returns the minimum value for an attribute column or an invalid variant in case of error.
The base class implementation uses a non-optimised approach of looping through all features in the source.
Reimplemented from QgsFeatureSource.
Definition at line 1870 of file qgsprocessingutils.cpp.
void QgsProcessingFeatureSource::setInvalidGeometryCheck | ( | Qgis::InvalidGeometryCheck | method | ) |
Overrides the default geometry check method for the source.
Definition at line 1968 of file qgsprocessingutils.cpp.
|
overridevirtual |
Returns the coordinate reference system for features in the source.
Implements QgsFeatureSource.
Definition at line 1812 of file qgsprocessingutils.cpp.
|
overridevirtual |
Returns the extent of all geometries from the source.
The base class implementation uses a non-optimised approach of looping through all features in the source.
Reimplemented from QgsFeatureSource.
Definition at line 1926 of file qgsprocessingutils.cpp.
|
overridevirtual |
Returns a friendly display name for the source.
The returned value can be an empty string.
Implements QgsFeatureSource.
Definition at line 1838 of file qgsprocessingutils.cpp.
|
overridevirtual |
Returns the set of unique values contained within the specified fieldIndex from this source.
If specified, the limit option can be used to limit the number of returned values. The base class implementation uses a non-optimised approach of looping through all features in the source.
Reimplemented from QgsFeatureSource.
Definition at line 1843 of file qgsprocessingutils.cpp.
|
overridevirtual |
Returns the geometry type for features returned by this source.
Implements QgsFeatureSource.
Definition at line 1822 of file qgsprocessingutils.cpp.