QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
qgsfeaturesource.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsfeaturesource.h
3 ----------------
4 begin : May 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSFEATURESOURCE_H
19#define QGSFEATURESOURCE_H
20
21#include "qgis_core.h"
22#include "qgis_sip.h"
23#include "qgsfeaturerequest.h"
24
27class QgsFields;
28class QgsFeedback;
29
36class CORE_EXPORT QgsFeatureSource
37{
38 public:
39
40 virtual ~QgsFeatureSource() = default;
41
47 virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const = 0;
48
52 virtual QString sourceName() const = 0;
53
58
62 virtual QgsFields fields() const = 0;
63
67 virtual Qgis::WkbType wkbType() const = 0;
68
69#ifdef SIP_RUN
70
75 int __len__() const;
76 % MethodCode
77 sipRes = sipCpp->featureCount();
78 % End
79
81 int __bool__() const;
82 % MethodCode
83 sipRes = true;
84 % End
85#endif
86
91 virtual long long featureCount() const = 0;
92
99
108 virtual QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const;
109
117 virtual QVariant minimumValue( int fieldIndex ) const;
118
126 virtual QVariant maximumValue( int fieldIndex ) const;
127
133 virtual QgsRectangle sourceExtent() const;
134
141 virtual QgsBox3D sourceExtent3D() const;
142
146 virtual QgsFeatureIds allFeatureIds() const;
147
171 QgsFeedback *feedback = nullptr ) SIP_FACTORY;
172
182 virtual Qgis::SpatialIndexPresence hasSpatialIndex() const;
183};
184
186
187#endif // QGSFEATURESOURCE_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:56
FeatureAvailability
Possible return value for QgsFeatureSource::hasFeatures() to determine if a source is empty.
Definition qgis.h:577
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:277
A 3-dimensional box composed of x, y, z coordinates.
Definition qgsbox3d.h:42
Represents a coordinate reference system (CRS).
Wrapper for iterator of features from vector data provider or vector layer.
Wraps a request for features to a vector layer (or directly its vector data provider).
An interface for objects which provide features via a getFeatures method.
virtual QgsFields fields() const =0
Returns the fields associated with features in 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 QgsCoordinateReferenceSystem sourceCrs() const =0
Returns the coordinate reference system for features in the source.
virtual Qgis::WkbType wkbType() const =0
Returns the geometry type for features returned by this 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,...
virtual QVariant minimumValue(int fieldIndex) const
Returns the minimum value for an attribute column or an invalid variant in case of error.
virtual QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const =0
Returns an iterator for the features in the source.
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 re...
virtual QString sourceName() const =0
Returns a friendly display name for the source.
virtual QVariant maximumValue(int fieldIndex) const
Returns the maximum value for an attribute column or an invalid variant in case of error.
virtual long long featureCount() const =0
Returns the number of features contained in the source, or -1 if the feature count is unknown.
virtual QgsFeatureIds allFeatureIds() const
Returns a list of all feature IDs for features present 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.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
Container of fields for a vector layer.
Definition qgsfields.h:46
A rectangle specified with double values.
Represents a vector layer which manages a vector based dataset.
#define SIP_FACTORY
Definition qgis_sip.h:84
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
QSet< QgsFeatureId > QgsFeatureIds