File tree 3 files changed +17
-5
lines changed
3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 4
4
1. static call to QgsVectorFileWriter::writeAsShapefile(...) which saves the whole vector layer
5
5
2. create an instance of the class and issue calls to addFeature(...)
6
6
*/
7
- class QgsVectorLayerImport
7
+ class QgsVectorLayerImport : QgsFeatureSink
8
8
{
9
9
%TypeHeaderCode
10
10
#include <qgsvectorlayerimport.h>
@@ -85,7 +85,7 @@ class QProgressDialog;
85
85
86
86
int errorCount() const;
87
87
88
- /** Add feature to the new created layer */
88
+ bool addFeatures( QgsFeatureList &features );
89
89
bool addFeature( QgsFeature &feature );
90
90
91
91
/** Close the new created layer */
Original file line number Diff line number Diff line change @@ -145,6 +145,17 @@ QString QgsVectorLayerImport::errorMessage()
145
145
return mErrorMessage ;
146
146
}
147
147
148
+ bool QgsVectorLayerImport::addFeatures ( QgsFeatureList &features )
149
+ {
150
+ QgsFeatureList::iterator fIt = features.begin ();
151
+ bool result = true ;
152
+ for ( ; fIt != features.end (); ++fIt )
153
+ {
154
+ result = result && addFeature ( *fIt );
155
+ }
156
+ return result;
157
+ }
158
+
148
159
bool QgsVectorLayerImport::addFeature ( QgsFeature &feat )
149
160
{
150
161
QgsAttributes attrs = feat.attributes ();
Original file line number Diff line number Diff line change 22
22
#include " qgis_core.h"
23
23
#include " qgis.h"
24
24
#include " qgsfeature.h"
25
+ #include " qgsfeaturesink.h"
25
26
26
27
class QProgressDialog ;
27
28
class QgsVectorDataProvider ;
@@ -34,7 +35,7 @@ class QgsFields;
34
35
1. static call to QgsVectorFileWriter::writeAsShapefile(...) which saves the whole vector layer
35
36
2. create an instance of the class and issue calls to addFeature(...)
36
37
*/
37
- class CORE_EXPORT QgsVectorLayerImport
38
+ class CORE_EXPORT QgsVectorLayerImport : public QgsFeatureSink
38
39
{
39
40
public:
40
41
@@ -114,8 +115,8 @@ class CORE_EXPORT QgsVectorLayerImport
114
115
115
116
int errorCount () const { return mErrorCount ; }
116
117
117
- // ! Add feature to the new created layer
118
- bool addFeature ( QgsFeature &feature );
118
+ bool addFeatures ( QgsFeatureList &features ) override ;
119
+ bool addFeature ( QgsFeature &feature ) override ;
119
120
120
121
// ! Close the new created layer
121
122
~QgsVectorLayerImport ();
You can’t perform that action at this time.
0 commit comments