QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
An interface for objects which provide features via a getFeatures method. More...
#include <qgsfeaturesource.h>
Public Member Functions | |
virtual | ~QgsFeatureSource ()=default |
virtual QgsFeatureIds | allFeatureIds () const |
Returns a list of all feature IDs for features present in the source. | |
virtual long long | featureCount () const =0 |
Returns the number of features contained in the source, or -1 if the feature count is unknown. | |
virtual QgsFields | fields () const =0 |
Returns the fields associated with features in the source. | |
virtual QgsFeatureIterator | getFeatures (const QgsFeatureRequest &request=QgsFeatureRequest()) const =0 |
Returns an iterator for the features in the source. | |
virtual Qgis::FeatureAvailability | hasFeatures () const |
Determines if there are any features available in the source. | |
virtual Qgis::SpatialIndexPresence | hasSpatialIndex () const |
Returns an enum value representing the presence of a valid spatial index on the source, if it can be determined. | |
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 QVariant | maximumValue (int fieldIndex) const |
Returns the maximum value for an attribute column or an invalid variant in case of error. | |
virtual QVariant | minimumValue (int fieldIndex) const |
Returns the minimum value for an attribute column or an invalid variant in case of error. | |
virtual QgsCoordinateReferenceSystem | sourceCrs () const =0 |
Returns the coordinate reference system for features in the source. | |
virtual QgsRectangle | sourceExtent () const |
Returns the extent of all geometries from the source. | |
virtual QgsBox3D | sourceExtent3D () const |
Returns the 3D extent of all geometries from the source. | |
virtual QString | sourceName () const =0 |
Returns a friendly display name for the source. | |
virtual QSet< QVariant > | uniqueValues (int fieldIndex, int limit=-1) const |
Returns the set of unique values contained within the specified fieldIndex from this source. | |
virtual Qgis::WkbType | wkbType () const =0 |
Returns the geometry type for features returned by this source. | |
An interface for objects which provide features via a getFeatures method.
Definition at line 36 of file qgsfeaturesource.h.
|
virtualdefault |
|
virtual |
Returns a list of all feature IDs for features present in the source.
Reimplemented in QgsProcessingFeatureSource.
Definition at line 120 of file qgsfeaturesource.cpp.
|
pure virtual |
Returns the number of features contained in the source, or -1 if the feature count is unknown.
Implemented in QgsVectorLayer, QgsProcessingFeatureSource, QgsVectorLayerSelectedFeatureSource, and QgsVectorDataProvider.
|
pure virtual |
Returns the fields associated with features in the source.
Implemented in QgsVectorLayer, QgsProcessingFeatureSource, QgsVectorLayerSelectedFeatureSource, and QgsVectorDataProvider.
|
pure virtual |
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.
Implemented in QgsVectorLayer, QgsProcessingFeatureSource, QgsVectorLayerSelectedFeatureSource, and QgsVectorDataProvider.
|
virtual |
Determines if there are any features available in the source.
Reimplemented in QgsVectorLayer, QgsProcessingFeatureSource, and QgsVectorDataProvider.
Definition at line 26 of file qgsfeaturesource.cpp.
|
virtual |
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 in QgsProcessingFeatureSource, and QgsVectorLayerSelectedFeatureSource.
Definition at line 196 of file qgsfeaturesource.cpp.
QgsVectorLayer * QgsFeatureSource::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.
All settings from feature request will be honored.
If a subset of attributes has been set for the request, then only those selected fields will be present in the output layer.
The CRS for the output layer will match the input layer, unless QgsFeatureRequest::setDestinationCrs() has been called with a valid QgsCoordinateReferenceSystem. In this case the output layer will match the QgsFeatureRequest::destinationCrs() CRS.
The returned layer WKB type will match wkbType(), unless the QgsFeatureRequest::NoGeometry flag is set on the request. In that case the returned layer will not be a spatial layer.
An optional feedback argument can be used to cancel the materialization before it has fully completed.
The returned value is a new instance and the caller takes responsibility for its ownership.
Definition at line 137 of file qgsfeaturesource.cpp.
|
virtual |
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 in QgsProcessingFeatureSource, QgsVectorLayer, and QgsVectorDataProvider.
Definition at line 75 of file qgsfeaturesource.cpp.
|
virtual |
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 in QgsProcessingFeatureSource, QgsVectorLayer, and QgsVectorDataProvider.
Definition at line 52 of file qgsfeaturesource.cpp.
|
pure virtual |
Returns the coordinate reference system for features in the source.
Implemented in QgsVectorLayer, QgsProcessingFeatureSource, QgsVectorDataProvider, and QgsVectorLayerSelectedFeatureSource.
|
virtual |
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 in QgsVectorLayer, QgsProcessingFeatureSource, and QgsVectorDataProvider.
Definition at line 98 of file qgsfeaturesource.cpp.
|
virtual |
Returns the 3D 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 in QgsVectorLayer, and QgsVectorDataProvider.
Definition at line 103 of file qgsfeaturesource.cpp.
|
pure virtual |
Returns a friendly display name for the source.
The returned value can be an empty string.
Implemented in QgsVectorLayer, QgsProcessingFeatureSource, QgsVectorDataProvider, and QgsVectorLayerSelectedFeatureSource.
|
virtual |
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 in QgsVectorLayer, and QgsProcessingFeatureSource.
Definition at line 31 of file qgsfeaturesource.cpp.
|
pure virtual |
Returns the geometry type for features returned by this source.
Implemented in QgsVectorLayer, QgsProcessingFeatureSource, QgsVectorLayerSelectedFeatureSource, and QgsVectorDataProvider.