@@ -56,6 +56,14 @@ class CORE_EXPORT QgsVectorFileWriter
56
56
ErrInvalidLayer, // added in 2.0
57
57
};
58
58
59
+ // added in 2.0
60
+ enum SymbologyExport
61
+ {
62
+ NoSymbology = 0 , // export only data
63
+ FeatureSymbology, // Keeps the number of features and export symbology per feature
64
+ SymbolLayerSymbology // Exports one feature per symbol layer (considering symbol levels)
65
+ };
66
+
59
67
/* * Write contents of vector layer to a shapefile
60
68
@deprecated Use writeAsVectorFormat instead*/
61
69
Q_DECL_DEPRECATED static WriterError writeAsShapefile ( QgsVectorLayer* layer,
@@ -93,7 +101,8 @@ class CORE_EXPORT QgsVectorFileWriter
93
101
const QStringList &datasourceOptions = QStringList(), // added in 1.6
94
102
const QStringList &layerOptions = QStringList(), // added in 1.6
95
103
bool skipAttributeCreation = false, // added in 1.6
96
- QString *newFilename = 0 // added in 1.9
104
+ QString *newFilename = 0, // added in 1.9
105
+ SymbologyExport symbologyExport = NoSymbology // added in 2.0
97
106
);
98
107
99
108
/* * create shapefile and initialize it */
@@ -105,7 +114,8 @@ class CORE_EXPORT QgsVectorFileWriter
105
114
const QString& driverName = " ESRI Shapefile" ,
106
115
const QStringList &datasourceOptions = QStringList(), // added in 1.6
107
116
const QStringList &layerOptions = QStringList(), // added in 1.6
108
- QString *newFilename = 0 // added in 1.9
117
+ QString *newFilename = 0 , // added in 1.9
118
+ SymbologyExport symbologyExport = NoSymbology// added in 2.0
109
119
);
110
120
111
121
/* *Returns map with format filter string as key and OGR format key as value*/
@@ -146,6 +156,9 @@ class CORE_EXPORT QgsVectorFileWriter
146
156
*/
147
157
static bool deleteShapeFile ( QString theFileName );
148
158
159
+ SymbologyExport symbologyExport () const { return mSymbologyExport ; }
160
+ void setSymbologyExport ( SymbologyExport symExport ) { mSymbologyExport = symExport; }
161
+
149
162
protected:
150
163
// ! @note not available in python bindings
151
164
OGRGeometryH createEmptyGeometry ( QGis::WkbType wkbType );
@@ -168,8 +181,7 @@ class CORE_EXPORT QgsVectorFileWriter
168
181
/* * map attribute indizes to OGR field indexes */
169
182
QMap<int , int > mAttrIdxToOgrIdx ;
170
183
171
- /* * flag if OGR feature type style should be exported*/
172
- bool mExportFeatureStyle ;
184
+ SymbologyExport mSymbologyExport ;
173
185
174
186
private:
175
187
static bool driverMetadata ( QString driverName, QString &longName, QString &trLongName, QString &glob, QString &ext );
0 commit comments