24 #include "qgis_core.h" 77 GeometryCollection = 7,
89 MultiLineStringZ = 1005,
91 GeometryCollectionZ = 1007,
92 CircularStringZ = 1008,
93 CompoundCurveZ = 1009,
102 MultiLineStringM = 2005,
103 MultiPolygonM = 2006,
104 GeometryCollectionM = 2007,
105 CircularStringM = 2008,
106 CompoundCurveM = 2009,
107 CurvePolygonM = 2010,
109 MultiSurfaceM = 2012,
114 MultiLineStringZM = 3005,
115 MultiPolygonZM = 3006,
116 GeometryCollectionZM = 3007,
117 CircularStringZM = 3008,
118 CompoundCurveZM = 3009,
119 CurvePolygonZM = 3010,
121 MultiSurfaceZM = 3012,
123 Point25D = 0x80000001,
157 case GeometryCollection:
158 case GeometryCollectionZ:
159 case GeometryCollectionM:
160 case GeometryCollectionZM:
180 case MultiLineString:
184 case MultiLineStringZ:
188 case MultiLineStringM:
192 case MultiLineStringZM:
228 return CircularString;
230 case CircularStringZ:
231 return CircularStringZ;
233 case CircularStringM:
234 return CircularStringM;
236 case CircularStringZM:
237 return CircularStringZM;
241 return CompoundCurve;
245 return CompoundCurveZ;
249 return CompoundCurveM;
251 case CompoundCurveZM:
253 return CompoundCurveZM;
261 return CurvePolygonZ;
265 return CurvePolygonM;
269 return CurvePolygonZM;
279 case MultiLineString25D:
280 return LineString25D;
283 case MultiPolygon25D:
307 case GeometryCollection:
308 return GeometryCollection;
310 case GeometryCollectionZ:
311 return GeometryCollectionZ;
313 case GeometryCollectionM:
314 return GeometryCollectionM;
316 case GeometryCollectionZM:
317 return GeometryCollectionZM;
336 case MultiLineString:
337 return MultiLineString;
340 case MultiLineStringZ:
341 return MultiLineStringZ;
344 case MultiLineStringM:
345 return MultiLineStringM;
348 case MultiLineStringZM:
349 return MultiLineStringZM;
357 return MultiPolygonZ;
361 return MultiPolygonM;
365 return MultiPolygonZM;
373 case CircularStringZ:
378 case CircularStringM:
382 case CompoundCurveZM:
383 case CircularStringZM:
393 return MultiSurfaceZ;
397 return MultiSurfaceM;
401 return MultiSurfaceZM;
408 return MultiPoint25D;
411 case MultiLineString25D:
412 return MultiLineString25D;
415 case MultiPolygon25D:
416 return MultiPolygon25D;
468 case MultiLineString:
469 case MultiLineStringZ:
470 case MultiLineStringM:
471 case MultiLineStringZM:
472 case MultiLineString25D:
473 return MultiLineString;
479 case MultiPolygon25D:
482 case GeometryCollection:
483 case GeometryCollectionZ:
484 case GeometryCollectionM:
485 case GeometryCollectionZM:
486 return GeometryCollection;
489 case CircularStringZ:
490 case CircularStringM:
491 case CircularStringZM:
492 return CircularString;
497 case CompoundCurveZM:
498 return CompoundCurve;
528 type = flatType( type );
540 static Type parseType(
const QString &wktStr );
549 return ( type != Unknown && !isMultiType( type ) );
574 case CircularStringZ:
581 case CircularStringM:
588 case CircularStringZM:
589 case CompoundCurveZM:
608 switch ( flatType( type ) )
636 case PolygonGeometry:
652 if ( type == Unknown || type == NoGeometry )
655 return 2 + hasZ( type ) + hasM( type );
668 case GeometryCollection:
669 case GeometryCollectionZ:
670 case GeometryCollectionM:
671 case GeometryCollectionZM:
672 return UnknownGeometry;
684 return PointGeometry;
687 case MultiLineString:
689 case MultiLineStringZ:
691 case MultiLineStringM:
693 case MultiLineStringZM:
695 case MultiLineString25D:
699 case CircularStringZ:
702 case CircularStringM:
705 case CircularStringZM:
706 case CompoundCurveZM:
723 case MultiPolygon25D:
732 return PolygonGeometry;
738 return UnknownGeometry;
744 static QString displayString(
Type type );
760 static QString geometryDisplayString(
GeometryType type );
777 case MultiLineStringZ:
779 case GeometryCollectionZ:
780 case CircularStringZ:
790 case MultiLineStringZM:
792 case GeometryCollectionZM:
793 case CircularStringZM:
794 case CompoundCurveZM:
802 case MultiLineString25D:
803 case MultiPolygon25D:
827 case MultiLineStringM:
829 case GeometryCollectionM:
830 case CircularStringM:
840 case MultiLineStringZM:
842 case GeometryCollectionZM:
843 case CircularStringZM:
844 case CompoundCurveZM:
868 else if ( type == Unknown )
870 else if ( type == NoGeometry )
874 Type flat = flatType( type );
893 else if ( type == Unknown )
895 else if ( type == NoGeometry )
897 else if ( type == Point25D ||
898 type == LineString25D ||
899 type == Polygon25D ||
900 type == MultiPoint25D ||
901 type == MultiLineString25D ||
902 type == MultiPolygon25D )
906 Type flat = flatType( type );
927 returnType = addM( returnType );
945 returnType = addZ( returnType );
958 if ( flat >= Point && flat <= MultiPolygon )
970 wkbEntry(
const QString &name,
bool isMultiType,
Type multiType,
Type singleType,
Type flatType,
GeometryType geometryType,
971 bool hasZ,
bool hasM )
973 , mIsMultiType( isMultiType )
974 , mMultiType( multiType )
975 , mSingleType( singleType )
976 , mFlatType( flatType )
977 , mGeometryType( geometryType )
991 static const QMap<Type, wkbEntry> ENTRIES;
994 #endif // QGSWKBTYPES_H static Type to25D(Type type)
Will convert the 25D version of the flat type if supported or Unknown if not supported.
static Type singleType(Type type)
Returns the single type for a WKB type.
static Type multiType(Type type)
Returns the multi type for a WKB type.
static int wkbDimensions(Type type)
Returns the inherent dimension of the geometry type as an integer.
static bool isMultiType(Type type)
Returns true if the WKB type is a multi type.
Handles storage of information regarding WKB types and their properties.
static bool hasZ(Type type)
Tests whether a WKB type contains the z-dimension.
static Type dropM(Type type)
Drops the m dimension (if present) for a WKB type and returns the new type.
Type
The WKB type describes the number of dimensions a geometry has.
static Type addM(Type type)
Adds the m dimension to a WKB type and returns the new type.
static GeometryType geometryType(Type type)
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
static Type addZ(Type type)
Adds the z dimension to a WKB type and returns the new type.
static bool isSingleType(Type type)
Returns true if the WKB type is a single type.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
static Type dropZ(Type type)
Drops the z dimension (if present) for a WKB type and returns the new type.
static bool isCurvedType(Type type)
Returns true if the WKB type is a curved type or can contain curved geometries.
static Type zmType(Type type, bool hasZ, bool hasM)
Returns the modified input geometry type according to hasZ / hasM.
static bool hasM(Type type)
Tests whether a WKB type contains m values.
static Type flatType(Type type)
Returns the flat type for a WKB type.
static int coordDimensions(Type type)
Returns the coordinate dimension of the geometry type as an integer.