@@ -56,6 +56,14 @@ class CORE_EXPORT QgsVectorFileWriter
5656 ErrInvalidLayer, // added in 2.0
5757 };
5858
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+
5967 /* * Write contents of vector layer to a shapefile
6068 @deprecated Use writeAsVectorFormat instead*/
6169 Q_DECL_DEPRECATED static WriterError writeAsShapefile ( QgsVectorLayer* layer,
@@ -93,7 +101,8 @@ class CORE_EXPORT QgsVectorFileWriter
93101 const QStringList &datasourceOptions = QStringList(), // added in 1.6
94102 const QStringList &layerOptions = QStringList(), // added in 1.6
95103 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
97106 );
98107
99108 /* * create shapefile and initialize it */
@@ -105,7 +114,8 @@ class CORE_EXPORT QgsVectorFileWriter
105114 const QString& driverName = " ESRI Shapefile" ,
106115 const QStringList &datasourceOptions = QStringList(), // added in 1.6
107116 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
109119 );
110120
111121 /* *Returns map with format filter string as key and OGR format key as value*/
@@ -146,6 +156,9 @@ class CORE_EXPORT QgsVectorFileWriter
146156 */
147157 static bool deleteShapeFile ( QString theFileName );
148158
159+ SymbologyExport symbologyExport () const { return mSymbologyExport ; }
160+ void setSymbologyExport ( SymbologyExport symExport ) { mSymbologyExport = symExport; }
161+
149162 protected:
150163 // ! @note not available in python bindings
151164 OGRGeometryH createEmptyGeometry ( QGis::WkbType wkbType );
@@ -168,8 +181,7 @@ class CORE_EXPORT QgsVectorFileWriter
168181 /* * map attribute indizes to OGR field indexes */
169182 QMap<int , int > mAttrIdxToOgrIdx ;
170183
171- /* * flag if OGR feature type style should be exported*/
172- bool mExportFeatureStyle ;
184+ SymbologyExport mSymbologyExport ;
173185
174186 private:
175187 static bool driverMetadata ( QString driverName, QString &longName, QString &trLongName, QString &glob, QString &ext );
0 commit comments