QGIS API Documentation  3.2.0-Bonn (bc43194)
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.h"
23 #include "qgsfeaturerequest.h"
24 
25 class QgsFeatureIterator;
27 class QgsFields;
28 class QgsFeedback;
29 
37 class CORE_EXPORT QgsFeatureSource
38 {
39  public:
40 
41  virtual ~QgsFeatureSource() = default;
42 
48  virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const = 0;
49 
53  virtual QString sourceName() const = 0;
54 
58  virtual QgsCoordinateReferenceSystem sourceCrs() const = 0;
59 
63  virtual QgsFields fields() const = 0;
64 
68  virtual QgsWkbTypes::Type wkbType() const = 0;
69 
70 #ifdef SIP_RUN
71 
76  int __len__() const;
77  % MethodCode
78  sipRes = sipCpp->featureCount();
79  % End
80 #endif
81 
86  virtual long featureCount() const = 0;
87 
96  virtual QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const;
97 
105  virtual QVariant minimumValue( int fieldIndex ) const;
106 
114  virtual QVariant maximumValue( int fieldIndex ) const;
115 
121  virtual QgsRectangle sourceExtent() const;
122 
126  virtual QgsFeatureIds allFeatureIds() const;
127 
151  QgsVectorLayer *materialize( const QgsFeatureRequest &request,
152  QgsFeedback *feedback = nullptr ) SIP_FACTORY;
153 
154 };
155 
157 
158 #endif // QGSFEATURESOURCE_H
Wrapper for iterator of features from vector data provider or vector layer.
A rectangle specified with double values.
Definition: qgsrectangle.h:40
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:544
Container of fields for a vector layer.
Definition: qgsfields.h:42
Q_DECLARE_METATYPE(QModelIndex)
Base class for feedback objects to be used for cancelation of something running in a worker thread...
Definition: qgsfeedback.h:44
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:67
This class wraps a request for features to a vector layer (or directly its vector data provider)...
#define SIP_FACTORY
Definition: qgis_sip.h:69
An interface for objects which provide features via a getFeatures method.
This class represents a coordinate reference system (CRS).
Represents a vector layer which manages a vector based data sets.