QGIS API Documentation  3.37.0-Master (a5b4d9743e8)
Public Member Functions | List of all members
QgsProcessingFeatureSource Class Reference

QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource, modifying results according to the settings in a QgsProcessingContext. More...

#include <qgsprocessingutils.h>

Inheritance diagram for QgsProcessingFeatureSource:
Inheritance graph
[legend]

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. More...
 
 ~QgsProcessingFeatureSource () override
 
QgsFeatureIds allFeatureIds () const override
 Returns a list of all feature IDs for features present in the source. More...
 
QgsExpressionContextScopecreateExpressionContextScope () const
 Returns an expression context scope suitable for this source. More...
 
long long featureCount () const override
 Returns the number of features contained in the source, or -1 if the feature count is unknown. More...
 
QgsFields fields () const override
 Returns the fields associated with features in the source. More...
 
QgsFeatureIterator getFeatures (const QgsFeatureRequest &request, Qgis::ProcessingFeatureSourceFlags flags) const
 Returns an iterator for the features in the source, respecting the supplied feature flags. More...
 
QgsFeatureIterator getFeatures (const QgsFeatureRequest &request=QgsFeatureRequest()) const override
 Returns an iterator for the features in the source. More...
 
Qgis::FeatureAvailability hasFeatures () const override
 Determines if there are any features available in the source. More...
 
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. More...
 
Qgis::InvalidGeometryCheck invalidGeometryCheck () const
 Returns the geometry check method for the source. More...
 
QVariant maximumValue (int fieldIndex) const override
 Returns the maximum value for an attribute column or an invalid variant in case of error. More...
 
QVariant minimumValue (int fieldIndex) const override
 Returns the minimum value for an attribute column or an invalid variant in case of error. More...
 
void setInvalidGeometryCheck (Qgis::InvalidGeometryCheck method)
 Overrides the default geometry check method for the source. More...
 
QgsCoordinateReferenceSystem sourceCrs () const override
 Returns the coordinate reference system for features in the source. More...
 
QgsRectangle sourceExtent () const override
 Returns the extent of all geometries from the source. More...
 
QString sourceName () const override
 Returns a friendly display name for the source. More...
 
QSet< QVariant > uniqueValues (int fieldIndex, int limit=-1) const override
 Returns the set of unique values contained within the specified fieldIndex from this source. More...
 
Qgis::WkbType wkbType () const override
 Returns the geometry type for features returned by this source. More...
 
- Public Member Functions inherited from QgsFeatureSource
virtual ~QgsFeatureSource ()=default
 
QgsVectorLayermaterialize (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. More...
 
virtual QgsBox3D sourceExtent3D () const
 Returns the 3D extent of all geometries from the source. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ QgsProcessingFeatureSource()

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 1680 of file qgsprocessingutils.cpp.

◆ ~QgsProcessingFeatureSource()

QgsProcessingFeatureSource::~QgsProcessingFeatureSource ( )
override

Definition at line 1700 of file qgsprocessingutils.cpp.

Member Function Documentation

◆ allFeatureIds()

QgsFeatureIds QgsProcessingFeatureSource::allFeatureIds ( ) const
overridevirtual

Returns a list of all feature IDs for features present in the source.

Reimplemented from QgsFeatureSource.

Definition at line 1879 of file qgsprocessingutils.cpp.

◆ createExpressionContextScope()

QgsExpressionContextScope * QgsProcessingFeatureSource::createExpressionContextScope ( ) const

Returns an expression context scope suitable for this source.

Definition at line 1905 of file qgsprocessingutils.cpp.

◆ featureCount()

long long QgsProcessingFeatureSource::featureCount ( ) const
overridevirtual

Returns the number of features contained in the source, or -1 if the feature count is unknown.

Implements QgsFeatureSource.

Definition at line 1775 of file qgsprocessingutils.cpp.

◆ fields()

QgsFields QgsProcessingFeatureSource::fields ( ) const
overridevirtual

Returns the fields associated with features in the source.

Implements QgsFeatureSource.

Definition at line 1765 of file qgsprocessingutils.cpp.

◆ getFeatures() [1/2]

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 1706 of file qgsprocessingutils.cpp.

◆ getFeatures() [2/2]

QgsFeatureIterator QgsProcessingFeatureSource::getFeatures ( const QgsFeatureRequest request = QgsFeatureRequest()) const
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 1742 of file qgsprocessingutils.cpp.

◆ hasFeatures()

Qgis::FeatureAvailability QgsProcessingFeatureSource::hasFeatures ( ) const
overridevirtual

Determines if there are any features available in the source.

Since
QGIS 3.2

Reimplemented from QgsFeatureSource.

Definition at line 1730 of file qgsprocessingutils.cpp.

◆ hasSpatialIndex()

Qgis::SpatialIndexPresence QgsProcessingFeatureSource::hasSpatialIndex ( ) const
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.

Since
QGIS 3.10.1

Reimplemented from QgsFeatureSource.

Definition at line 1900 of file qgsprocessingutils.cpp.

◆ invalidGeometryCheck()

Qgis::InvalidGeometryCheck QgsProcessingFeatureSource::invalidGeometryCheck ( ) const

Returns the geometry check method for the source.

See also
setInvalidGeometryCheck()
Since
QGIS 3.36

Definition at line 1936 of file qgsprocessingutils.cpp.

◆ maximumValue()

QVariant QgsProcessingFeatureSource::maximumValue ( int  fieldIndex) const
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.

See also
minimumValue()
uniqueValues()

Reimplemented from QgsFeatureSource.

Definition at line 1846 of file qgsprocessingutils.cpp.

◆ minimumValue()

QVariant QgsProcessingFeatureSource::minimumValue ( int  fieldIndex) const
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.

See also
maximumValue()
uniqueValues()

Reimplemented from QgsFeatureSource.

Definition at line 1818 of file qgsprocessingutils.cpp.

◆ setInvalidGeometryCheck()

void QgsProcessingFeatureSource::setInvalidGeometryCheck ( Qgis::InvalidGeometryCheck  method)

Overrides the default geometry check method for the source.

See also
invalidGeometryCheck()
Since
QGIS 3.14

Definition at line 1916 of file qgsprocessingutils.cpp.

◆ sourceCrs()

QgsCoordinateReferenceSystem QgsProcessingFeatureSource::sourceCrs ( ) const
overridevirtual

Returns the coordinate reference system for features in the source.

Implements QgsFeatureSource.

Definition at line 1760 of file qgsprocessingutils.cpp.

◆ sourceExtent()

QgsRectangle QgsProcessingFeatureSource::sourceExtent ( ) const
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 1874 of file qgsprocessingutils.cpp.

◆ sourceName()

QString QgsProcessingFeatureSource::sourceName ( ) const
overridevirtual

Returns a friendly display name for the source.

The returned value can be an empty string.

Implements QgsFeatureSource.

Definition at line 1786 of file qgsprocessingutils.cpp.

◆ uniqueValues()

QSet< QVariant > QgsProcessingFeatureSource::uniqueValues ( int  fieldIndex,
int  limit = -1 
) const
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.

See also
minimumValue()
maximumValue()

Reimplemented from QgsFeatureSource.

Definition at line 1791 of file qgsprocessingutils.cpp.

◆ wkbType()

Qgis::WkbType QgsProcessingFeatureSource::wkbType ( ) const
overridevirtual

Returns the geometry type for features returned by this source.

Implements QgsFeatureSource.

Definition at line 1770 of file qgsprocessingutils.cpp.


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