QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsfeaturestore.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfeaturestore.h
3  --------------------------------------
4  Date : February 2013
5  Copyright : (C) 2013 by Radim Blazek
6  Email : [email protected]
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSFEATURESTORE_H
16 #define QGSFEATURESTORE_H
17 
18 #include "qgis_core.h"
19 #include "qgis_sip.h"
20 #include "qgsfeature.h"
21 #include "qgsfields.h"
22 #include "qgsfeaturesink.h"
24 #include <QList>
25 #include <QMetaType>
26 #include <QVariant>
27 
32 class CORE_EXPORT QgsFeatureStore : public QgsFeatureSink
33 {
34  public:
36  QgsFeatureStore() = default;
37 
40 
45  QgsFields fields() const { return mFields; }
46 
51  void setFields( const QgsFields &fields );
52 
57  QgsCoordinateReferenceSystem crs() const { return mCrs; }
58 
63  void setCrs( const QgsCoordinateReferenceSystem &crs ) { mCrs = crs; }
64 
65  bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) override;
66  bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) override;
67 
71  int count() const { return mFeatures.size(); }
72 
73 #ifdef SIP_RUN
74 
78  int __len__() const;
79  % MethodCode
80  sipRes = sipCpp->count();
81  % End
82 
84  int __bool__() const;
85  % MethodCode
86  sipRes = true;
87  % End
88 #endif
89 
93  QgsFeatureList features() const { return mFeatures; }
94 
99  void setParams( const QMap<QString, QVariant> &parameters ) { mParams = parameters; }
100 
105  QMap<QString, QVariant> params() const { return mParams; }
106 
107  private:
108  QgsFields mFields;
109 
111 
112  QgsFeatureList mFeatures;
113 
114  // Optional parameters
115  QMap<QString, QVariant> mParams;
116 };
117 
118 typedef QList<QgsFeatureStore> QgsFeatureStoreList;
119 
121 
123 
124 #endif
qgsfields.h
crs
const QgsCoordinateReferenceSystem & crs
Definition: qgswfsgetfeature.cpp:105
QgsFeatureSink::addFeature
virtual bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())
Adds a single feature to the sink.
Definition: qgsfeaturesink.cpp:20
QgsFields
Definition: qgsfields.h:44
QgsFeatureStore
Definition: qgsfeaturestore.h:32
qgsfeaturesink.h
qgsfeature.h
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QgsMeshTimeSettings)
QgsFeatureStoreList
QList< QgsFeatureStore > QgsFeatureStoreList
Definition: qgsfeaturestore.h:118
qgis_sip.h
QgsFeatureList
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:572
QgsCoordinateReferenceSystem
Definition: qgscoordinatereferencesystem.h:206
QgsFeatureSink::addFeatures
virtual bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())=0
Adds a list of features to the sink.
QgsFeature
Definition: qgsfeature.h:55
qgscoordinatereferencesystem.h
QgsFeatureSink
Definition: qgsfeaturesink.h:33