Skip to content

Commit e351d24

Browse files
committed
More types support for QgsVectorFileWriter
1 parent e29c7e5 commit e351d24

File tree

7 files changed

+251
-103
lines changed

7 files changed

+251
-103
lines changed

python/core/geometry/qgswkbtypes.sip

+7
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,11 @@ class QgsWKBTypes
183183
* @see addM()
184184
*/
185185
static Type dropM( Type type );
186+
187+
/**
188+
* Will convert the 25D version of the flat type if supported or Unknown if not supported.
189+
* @param type The type to convert
190+
* @return the 25D version of the type or Unknown
191+
*/
192+
static Type to25D( Type type );
186193
};

python/core/qgsvectorfilewriter.sip

+15-2
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,21 @@ class QgsVectorFileWriter
194194
const QString& driverName = "ESRI Shapefile",
195195
const QStringList &datasourceOptions = QStringList(),
196196
const QStringList &layerOptions = QStringList(),
197-
QString *newFilename = 0,
198-
QgsVectorFileWriter::SymbologyExport symbologyExport = QgsVectorFileWriter::NoSymbology
197+
QString *newFilename = nullptr,
198+
SymbologyExport symbologyExport = NoSymbology
199+
);
200+
201+
/** Create a new vector file writer */
202+
QgsVectorFileWriter( const QString& vectorFileName,
203+
const QString& fileEncoding,
204+
const QgsFields& fields,
205+
QgsWKBTypes::Type geometryType,
206+
const QgsCoordinateReferenceSystem* srs,
207+
const QString& driverName = "ESRI Shapefile",
208+
const QStringList &datasourceOptions = QStringList(),
209+
const QStringList &layerOptions = QStringList(),
210+
QString *newFilename = nullptr,
211+
SymbologyExport symbologyExport = NoSymbology
199212
);
200213

201214
/** Returns map with format filter string as key and OGR format key as value*/

src/core/geometry/qgswkbtypes.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,18 @@ QgsWKBTypes::Type QgsWKBTypes::dropM( QgsWKBTypes::Type type )
236236
return returnType;
237237
}
238238

239+
QgsWKBTypes::Type QgsWKBTypes::to25D( QgsWKBTypes::Type type )
240+
{
241+
QgsWKBTypes::Type flat = flatType( type );
242+
243+
if ( flat >= Point && flat <= MultiPolygon )
244+
return static_cast< QgsWKBTypes::Type >( flat + 0x80000000 );
245+
else if ( type == QgsWKBTypes::NoGeometry )
246+
return QgsWKBTypes::NoGeometry;
247+
else
248+
return Unknown;
249+
}
250+
239251
/***************************************************************************
240252
* This class is considered CRITICAL and any change MUST be accompanied with
241253
* full unit tests.

src/core/geometry/qgswkbtypes.h

+6
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ class CORE_EXPORT QgsWKBTypes
217217
*/
218218
static Type dropM( Type type );
219219

220+
/**
221+
* Will convert the 25D version of the flat type if supported or Unknown if not supported.
222+
* @param type The type to convert
223+
* @return the 25D version of the type or Unknown
224+
*/
225+
static Type to25D( Type type );
220226
private:
221227

222228
struct wkbEntry

0 commit comments

Comments
 (0)