25 #include "qgis_core.h"
79 GeometryCollection = 7,
91 MultiLineStringZ = 1005,
93 GeometryCollectionZ = 1007,
94 CircularStringZ = 1008,
95 CompoundCurveZ = 1009,
104 MultiLineStringM = 2005,
105 MultiPolygonM = 2006,
106 GeometryCollectionM = 2007,
107 CircularStringM = 2008,
108 CompoundCurveM = 2009,
109 CurvePolygonM = 2010,
111 MultiSurfaceM = 2012,
116 MultiLineStringZM = 3005,
117 MultiPolygonZM = 3006,
118 GeometryCollectionZM = 3007,
119 CircularStringZM = 3008,
120 CompoundCurveZM = 3009,
121 CurvePolygonZM = 3010,
123 MultiSurfaceZM = 3012,
125 Point25D = 0x80000001,
148 Q_ENUM( GeometryType )
162 case GeometryCollection:
163 case GeometryCollectionZ:
164 case GeometryCollectionM:
165 case GeometryCollectionZM:
185 case MultiLineString:
189 case MultiLineStringZ:
193 case MultiLineStringM:
197 case MultiLineStringZM:
233 return CircularString;
235 case CircularStringZ:
236 return CircularStringZ;
238 case CircularStringM:
239 return CircularStringM;
241 case CircularStringZM:
242 return CircularStringZM;
246 return CompoundCurve;
250 return CompoundCurveZ;
254 return CompoundCurveM;
256 case CompoundCurveZM:
258 return CompoundCurveZM;
266 return CurvePolygonZ;
270 return CurvePolygonM;
274 return CurvePolygonZM;
284 case MultiLineString25D:
285 return LineString25D;
288 case MultiPolygon25D:
314 return MultiPolygonZ;
317 return MultiPolygonM;
320 return MultiPolygonZM;
322 case GeometryCollection:
323 return GeometryCollection;
325 case GeometryCollectionZ:
326 return GeometryCollectionZ;
328 case GeometryCollectionM:
329 return GeometryCollectionM;
331 case GeometryCollectionZM:
332 return GeometryCollectionZM;
351 case MultiLineString:
352 return MultiLineString;
355 case MultiLineStringZ:
356 return MultiLineStringZ;
359 case MultiLineStringM:
360 return MultiLineStringM;
363 case MultiLineStringZM:
364 return MultiLineStringZM;
372 return MultiPolygonZ;
376 return MultiPolygonM;
380 return MultiPolygonZM;
388 case CircularStringZ:
393 case CircularStringM:
397 case CompoundCurveZM:
398 case CircularStringZM:
408 return MultiSurfaceZ;
412 return MultiSurfaceM;
416 return MultiSurfaceZM;
423 return MultiPoint25D;
426 case MultiLineString25D:
427 return MultiLineString25D;
430 case MultiPolygon25D:
431 return MultiPolygon25D;
462 case GeometryCollection:
463 return GeometryCollection;
465 case GeometryCollectionZ:
466 return GeometryCollectionZ;
468 case GeometryCollectionM:
469 return GeometryCollectionM;
471 case GeometryCollectionZM:
472 return GeometryCollectionZM;
501 return CompoundCurve;
503 case MultiLineString:
509 case CircularStringZ:
511 return CompoundCurveZ;
513 case MultiLineStringZ:
515 case MultiLineString25D:
520 case CircularStringM:
521 return CompoundCurveM;
523 case MultiLineStringM:
528 case CompoundCurveZM:
529 case CircularStringZM:
530 return CompoundCurveZM;
532 case MultiLineStringZM:
547 return CurvePolygonZ;
551 case MultiPolygon25D:
552 return MultiSurfaceZ;
556 return CurvePolygonM;
560 return MultiSurfaceM;
564 return CurvePolygonZM;
568 return MultiSurfaceZM;
575 return MultiPoint25D;
601 case CircularStringM:
605 case CircularStringZ:
609 case CircularStringZM:
610 case CompoundCurveZM:
614 return MultiLineString;
617 return MultiLineStringM;
620 return MultiLineStringZ;
623 return MultiLineStringZM;
641 return MultiPolygonM;
644 return MultiPolygonZ;
647 return MultiPolygonZM;
649 case GeometryCollection:
650 case GeometryCollectionM:
651 case GeometryCollectionZ:
652 case GeometryCollectionZM:
658 case MultiLineString:
659 case MultiLineString25D:
660 case MultiLineStringM:
661 case MultiLineStringZ:
662 case MultiLineStringZM:
669 case MultiPolygon25D:
743 case MultiLineString:
744 case MultiLineStringZ:
745 case MultiLineStringM:
746 case MultiLineStringZM:
747 case MultiLineString25D:
748 return MultiLineString;
754 case MultiPolygon25D:
757 case GeometryCollection:
758 case GeometryCollectionZ:
759 case GeometryCollectionM:
760 case GeometryCollectionZM:
761 return GeometryCollection;
764 case CircularStringZ:
765 case CircularStringM:
766 case CircularStringZM:
767 return CircularString;
772 case CompoundCurveZM:
773 return CompoundCurve;
803 type = flatType( type );
824 return ( type != Unknown && !isMultiType( type ) );
849 case CircularStringZ:
856 case CircularStringM:
863 case CircularStringZM:
864 case CompoundCurveZM:
883 switch ( flatType( type ) )
911 case PolygonGeometry:
927 if ( type == Unknown || type == NoGeometry )
930 return 2 + hasZ( type ) + hasM( type );
943 case GeometryCollection:
944 case GeometryCollectionZ:
945 case GeometryCollectionM:
946 case GeometryCollectionZM:
947 return UnknownGeometry;
959 return PointGeometry;
962 case MultiLineString:
964 case MultiLineStringZ:
966 case MultiLineStringM:
968 case MultiLineStringZM:
970 case MultiLineString25D:
974 case CircularStringZ:
977 case CircularStringM:
980 case CircularStringZM:
981 case CompoundCurveZM:
998 case MultiPolygon25D:
1005 case CurvePolygonZM:
1006 case MultiSurfaceZM:
1007 return PolygonGeometry;
1010 return NullGeometry;
1013 return UnknownGeometry;
1019 static QString displayString( Type type )
SIP_HOLDGIL;
1026 static QString translatedDisplayString( Type type )
SIP_HOLDGIL;
1042 static QString geometryDisplayString( GeometryType type )
SIP_HOLDGIL;
1059 case MultiLineStringZ:
1061 case GeometryCollectionZ:
1062 case CircularStringZ:
1063 case CompoundCurveZ:
1072 case MultiLineStringZM:
1073 case MultiPolygonZM:
1074 case GeometryCollectionZM:
1075 case CircularStringZM:
1076 case CompoundCurveZM:
1077 case CurvePolygonZM:
1079 case MultiSurfaceZM:
1084 case MultiLineString25D:
1085 case MultiPolygon25D:
1109 case MultiLineStringM:
1111 case GeometryCollectionM:
1112 case CircularStringM:
1113 case CompoundCurveM:
1122 case MultiLineStringZM:
1123 case MultiPolygonZM:
1124 case GeometryCollectionZM:
1125 case CircularStringZM:
1126 case CompoundCurveZM:
1127 case CurvePolygonZM:
1129 case MultiSurfaceZM:
1150 else if ( type == Unknown )
1152 else if ( type == NoGeometry )
1156 Type flat = flatType( type );
1175 else if ( type == Unknown )
1177 else if ( type == NoGeometry )
1179 else if ( type == Point25D )
1181 else if ( type == LineString25D )
1182 return LineStringZM;
1183 else if ( type == Polygon25D )
1185 else if ( type == MultiPoint25D )
1186 return MultiPointZM;
1187 else if ( type == MultiLineString25D )
1188 return MultiLineStringZM;
1189 else if ( type == MultiPolygon25D )
1190 return MultiPolygonZM;
1193 Type flat = flatType( type );
1209 if ( !hasZ( type ) )
1214 returnType = addM( returnType );
1227 if ( !hasM( type ) )
1232 returnType = addZ( returnType );
1245 if ( flat >= Point && flat <= MultiPolygon )
1246 return static_cast< QgsWkbTypes::Type >(
static_cast<unsigned>( flat ) + 0x80000000U );
Handles storage of information regarding WKB types and their properties.
static bool isSingleType(Type type) SIP_HOLDGIL
Returns true if the WKB type is a single type.
static GeometryType geometryType(Type type) SIP_HOLDGIL
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
static Type parseType(const QString &wktStr)
Attempts to extract the WKB type from a WKT string.
static bool isMultiType(Type type) SIP_HOLDGIL
Returns true if the WKB type is a multi type.
static Type curveType(Type type) SIP_HOLDGIL
Returns the curve type for a WKB type.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
static bool hasM(Type type) SIP_HOLDGIL
Tests whether a WKB type contains m values.
static Type linearType(Type type) SIP_HOLDGIL
Returns the linear type for a WKB type.
Type
The WKB type describes the number of dimensions a geometry has.
static Type zmType(Type type, bool hasZ, bool hasM) SIP_HOLDGIL
Returns the modified input geometry type according to hasZ / hasM.
static int wkbDimensions(Type type) SIP_HOLDGIL
Returns the inherent dimension of the geometry type as an integer.
static int coordDimensions(Type type) SIP_HOLDGIL
Returns the coordinate dimension of the geometry type as an integer.
static Type dropZ(Type type) SIP_HOLDGIL
Drops the z dimension (if present) for a WKB type and returns the new type.
static Type to25D(Type type) SIP_HOLDGIL
Will convert the 25D version of the flat type if supported or Unknown if not supported.
static bool isCurvedType(Type type) SIP_HOLDGIL
Returns true if the WKB type is a curved type or can contain curved geometries.
static Type flatType(Type type) SIP_HOLDGIL
Returns the flat type for a WKB type.
static Type multiType(Type type) SIP_HOLDGIL
Returns the multi type for a WKB type.
static Type addZ(Type type) SIP_HOLDGIL
Adds the z dimension to a WKB type and returns the new type.
static bool hasZ(Type type) SIP_HOLDGIL
Tests whether a WKB type contains the z-dimension.
static Type addM(Type type) SIP_HOLDGIL
Adds the m dimension to a WKB type and returns the new type.
static Type dropM(Type type) SIP_HOLDGIL
Drops the m dimension (if present) for a WKB type and returns the new type.