25 #include "qgis_core.h" 78 GeometryCollection = 7,
90 MultiLineStringZ = 1005,
92 GeometryCollectionZ = 1007,
93 CircularStringZ = 1008,
94 CompoundCurveZ = 1009,
103 MultiLineStringM = 2005,
104 MultiPolygonM = 2006,
105 GeometryCollectionM = 2007,
106 CircularStringM = 2008,
107 CompoundCurveM = 2009,
108 CurvePolygonM = 2010,
110 MultiSurfaceM = 2012,
115 MultiLineStringZM = 3005,
116 MultiPolygonZM = 3006,
117 GeometryCollectionZM = 3007,
118 CircularStringZM = 3008,
119 CompoundCurveZM = 3009,
120 CurvePolygonZM = 3010,
122 MultiSurfaceZM = 3012,
124 Point25D = 0x80000001,
161 case GeometryCollection:
162 case GeometryCollectionZ:
163 case GeometryCollectionM:
164 case GeometryCollectionZM:
184 case MultiLineString:
188 case MultiLineStringZ:
192 case MultiLineStringM:
196 case MultiLineStringZM:
232 return CircularString;
234 case CircularStringZ:
235 return CircularStringZ;
237 case CircularStringM:
238 return CircularStringM;
240 case CircularStringZM:
241 return CircularStringZM;
245 return CompoundCurve;
249 return CompoundCurveZ;
253 return CompoundCurveM;
255 case CompoundCurveZM:
257 return CompoundCurveZM;
265 return CurvePolygonZ;
269 return CurvePolygonM;
273 return CurvePolygonZM;
283 case MultiLineString25D:
284 return LineString25D;
287 case MultiPolygon25D:
312 case GeometryCollection:
313 return GeometryCollection;
315 case GeometryCollectionZ:
316 return GeometryCollectionZ;
318 case GeometryCollectionM:
319 return GeometryCollectionM;
321 case GeometryCollectionZM:
322 return GeometryCollectionZM;
341 case MultiLineString:
342 return MultiLineString;
345 case MultiLineStringZ:
346 return MultiLineStringZ;
349 case MultiLineStringM:
350 return MultiLineStringM;
353 case MultiLineStringZM:
354 return MultiLineStringZM;
362 return MultiPolygonZ;
366 return MultiPolygonM;
370 return MultiPolygonZM;
378 case CircularStringZ:
383 case CircularStringM:
387 case CompoundCurveZM:
388 case CircularStringZM:
398 return MultiSurfaceZ;
402 return MultiSurfaceM;
406 return MultiSurfaceZM;
413 return MultiPoint25D;
416 case MultiLineString25D:
417 return MultiLineString25D;
420 case MultiPolygon25D:
421 return MultiPolygon25D;
451 case GeometryCollection:
452 return GeometryCollection;
454 case GeometryCollectionZ:
455 return GeometryCollectionZ;
457 case GeometryCollectionM:
458 return GeometryCollectionM;
460 case GeometryCollectionZM:
461 return GeometryCollectionZM;
490 return CompoundCurve;
492 case MultiLineString:
498 case CircularStringZ:
500 return CompoundCurveZ;
502 case MultiLineStringZ:
504 case MultiLineString25D:
509 case CircularStringM:
510 return CompoundCurveM;
512 case MultiLineStringM:
517 case CompoundCurveZM:
518 case CircularStringZM:
519 return CompoundCurveZM;
521 case MultiLineStringZM:
536 return CurvePolygonZ;
540 case MultiPolygon25D:
541 return MultiSurfaceZ;
545 return CurvePolygonM;
549 return MultiSurfaceM;
553 return CurvePolygonZM;
557 return MultiSurfaceZM;
564 return MultiPoint25D;
617 case MultiLineString:
618 case MultiLineStringZ:
619 case MultiLineStringM:
620 case MultiLineStringZM:
621 case MultiLineString25D:
622 return MultiLineString;
628 case MultiPolygon25D:
631 case GeometryCollection:
632 case GeometryCollectionZ:
633 case GeometryCollectionM:
634 case GeometryCollectionZM:
635 return GeometryCollection;
638 case CircularStringZ:
639 case CircularStringM:
640 case CircularStringZM:
641 return CircularString;
646 case CompoundCurveZM:
647 return CompoundCurve;
677 type = flatType( type );
689 static Type parseType(
const QString &wktStr );
698 return ( type != Unknown && !isMultiType( type ) );
723 case CircularStringZ:
730 case CircularStringM:
737 case CircularStringZM:
738 case CompoundCurveZM:
757 switch ( flatType( type ) )
785 case PolygonGeometry:
801 if ( type == Unknown || type == NoGeometry )
804 return 2 + hasZ( type ) + hasM( type );
817 case GeometryCollection:
818 case GeometryCollectionZ:
819 case GeometryCollectionM:
820 case GeometryCollectionZM:
821 return UnknownGeometry;
833 return PointGeometry;
836 case MultiLineString:
838 case MultiLineStringZ:
840 case MultiLineStringM:
842 case MultiLineStringZM:
844 case MultiLineString25D:
848 case CircularStringZ:
851 case CircularStringM:
854 case CircularStringZM:
855 case CompoundCurveZM:
872 case MultiPolygon25D:
881 return PolygonGeometry;
887 return UnknownGeometry;
893 static QString displayString(
Type type );
909 static QString geometryDisplayString(
GeometryType type );
926 case MultiLineStringZ:
928 case GeometryCollectionZ:
929 case CircularStringZ:
939 case MultiLineStringZM:
941 case GeometryCollectionZM:
942 case CircularStringZM:
943 case CompoundCurveZM:
951 case MultiLineString25D:
952 case MultiPolygon25D:
976 case MultiLineStringM:
978 case GeometryCollectionM:
979 case CircularStringM:
989 case MultiLineStringZM:
991 case GeometryCollectionZM:
992 case CircularStringZM:
993 case CompoundCurveZM:
1017 else if ( type == Unknown )
1019 else if ( type == NoGeometry )
1023 Type flat = flatType( type );
1042 else if ( type == Unknown )
1044 else if ( type == NoGeometry )
1046 else if ( type == Point25D ||
1047 type == LineString25D ||
1048 type == Polygon25D ||
1049 type == MultiPoint25D ||
1050 type == MultiLineString25D ||
1051 type == MultiPolygon25D )
1055 Type flat = flatType( type );
1071 if ( !hasZ( type ) )
1076 returnType = addM( returnType );
1089 if ( !hasM( type ) )
1094 returnType = addZ( returnType );
1107 if ( flat >= Point && flat <= MultiPolygon )
1119 wkbEntry(
const QString &name,
bool isMultiType,
Type multiType,
Type singleType,
Type flatType,
GeometryType geometryType,
1120 bool hasZ,
bool hasM )
1122 , mIsMultiType( isMultiType )
1123 , mMultiType( multiType )
1124 , mSingleType( singleType )
1125 , mFlatType( flatType )
1126 , mGeometryType( geometryType )
1140 static const QMap<Type, wkbEntry> ENTRIES;
1143 #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 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 Type curveType(Type type)
Returns the curve type for a WKB 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.