QGIS API Documentation 3.41.0-Master (af5edcb665c)
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
98 virtual Qgis::FeatureAvailability hasFeatures() const;
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
170 QgsVectorLayer *materialize( const QgsFeatureRequest &request,
171 QgsFeedback *feedback = nullptr ) SIP_FACTORY;
172
182 virtual Qgis::SpatialIndexPresence hasSpatialIndex() const;
183};
184
186
187#endif // QGSFEATURESOURCE_H
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
FeatureAvailability
Possible return value for QgsFeatureSource::hasFeatures() to determine if a source is empty.
Definition qgis.h:541
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:256
A 3-dimensional box composed of x, y, z coordinates.
Definition qgsbox3d.h:43
This class represents a coordinate reference system (CRS).
Wrapper for iterator of features from vector data provider or vector layer.
This class 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 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 QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const =0
Returns an iterator for the features in the source.
virtual ~QgsFeatureSource()=default
virtual QString sourceName() const =0
Returns a friendly display name for 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.
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 data sets.
#define SIP_FACTORY
Definition qgis_sip.h:76
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
QSet< QgsFeatureId > QgsFeatureIds