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,
159 case GeometryCollection:
160 case GeometryCollectionZ:
161 case GeometryCollectionM:
162 case GeometryCollectionZM:
182 case MultiLineString:
186 case MultiLineStringZ:
190 case MultiLineStringM:
194 case MultiLineStringZM:
230 return CircularString;
232 case CircularStringZ:
233 return CircularStringZ;
235 case CircularStringM:
236 return CircularStringM;
238 case CircularStringZM:
239 return CircularStringZM;
243 return CompoundCurve;
247 return CompoundCurveZ;
251 return CompoundCurveM;
253 case CompoundCurveZM:
255 return CompoundCurveZM;
263 return CurvePolygonZ;
267 return CurvePolygonM;
271 return CurvePolygonZM;
281 case MultiLineString25D:
282 return LineString25D;
285 case MultiPolygon25D:
309 case GeometryCollection:
310 return GeometryCollection;
312 case GeometryCollectionZ:
313 return GeometryCollectionZ;
315 case GeometryCollectionM:
316 return GeometryCollectionM;
318 case GeometryCollectionZM:
319 return GeometryCollectionZM;
338 case MultiLineString:
339 return MultiLineString;
342 case MultiLineStringZ:
343 return MultiLineStringZ;
346 case MultiLineStringM:
347 return MultiLineStringM;
350 case MultiLineStringZM:
351 return MultiLineStringZM;
359 return MultiPolygonZ;
363 return MultiPolygonM;
367 return MultiPolygonZM;
375 case CircularStringZ:
380 case CircularStringM:
384 case CompoundCurveZM:
385 case CircularStringZM:
395 return MultiSurfaceZ;
399 return MultiSurfaceM;
403 return MultiSurfaceZM;
410 return MultiPoint25D;
413 case MultiLineString25D:
414 return MultiLineString25D;
417 case MultiPolygon25D:
418 return MultiPolygon25D;
441 case GeometryCollection:
442 return GeometryCollection;
444 case GeometryCollectionZ:
445 return GeometryCollectionZ;
447 case GeometryCollectionM:
448 return GeometryCollectionM;
450 case GeometryCollectionZM:
451 return GeometryCollectionZM;
480 return CompoundCurve;
482 case MultiLineString:
488 case CircularStringZ:
490 return CompoundCurveZ;
492 case MultiLineStringZ:
494 case MultiLineString25D:
499 case CircularStringM:
500 return CompoundCurveM;
502 case MultiLineStringM:
507 case CompoundCurveZM:
508 case CircularStringZM:
509 return CompoundCurveZM;
511 case MultiLineStringZM:
526 return CurvePolygonZ;
530 case MultiPolygon25D:
531 return MultiSurfaceZ;
535 return CurvePolygonM;
539 return MultiSurfaceM;
543 return CurvePolygonZM;
547 return MultiSurfaceZM;
554 return MultiPoint25D;
606 case MultiLineString:
607 case MultiLineStringZ:
608 case MultiLineStringM:
609 case MultiLineStringZM:
610 case MultiLineString25D:
611 return MultiLineString;
617 case MultiPolygon25D:
620 case GeometryCollection:
621 case GeometryCollectionZ:
622 case GeometryCollectionM:
623 case GeometryCollectionZM:
624 return GeometryCollection;
627 case CircularStringZ:
628 case CircularStringM:
629 case CircularStringZM:
630 return CircularString;
635 case CompoundCurveZM:
636 return CompoundCurve;
666 type = flatType( type );
678 static Type parseType(
const QString &wktStr );
687 return ( type != Unknown && !isMultiType( type ) );
712 case CircularStringZ:
719 case CircularStringM:
726 case CircularStringZM:
727 case CompoundCurveZM:
746 switch ( flatType( type ) )
774 case PolygonGeometry:
790 if ( type == Unknown || type == NoGeometry )
793 return 2 + hasZ( type ) + hasM( type );
806 case GeometryCollection:
807 case GeometryCollectionZ:
808 case GeometryCollectionM:
809 case GeometryCollectionZM:
810 return UnknownGeometry;
822 return PointGeometry;
825 case MultiLineString:
827 case MultiLineStringZ:
829 case MultiLineStringM:
831 case MultiLineStringZM:
833 case MultiLineString25D:
837 case CircularStringZ:
840 case CircularStringM:
843 case CircularStringZM:
844 case CompoundCurveZM:
861 case MultiPolygon25D:
870 return PolygonGeometry;
876 return UnknownGeometry;
882 static QString displayString(
Type type );
898 static QString geometryDisplayString(
GeometryType type );
915 case MultiLineStringZ:
917 case GeometryCollectionZ:
918 case CircularStringZ:
928 case MultiLineStringZM:
930 case GeometryCollectionZM:
931 case CircularStringZM:
932 case CompoundCurveZM:
940 case MultiLineString25D:
941 case MultiPolygon25D:
965 case MultiLineStringM:
967 case GeometryCollectionM:
968 case CircularStringM:
978 case MultiLineStringZM:
980 case GeometryCollectionZM:
981 case CircularStringZM:
982 case CompoundCurveZM:
1006 else if ( type == Unknown )
1008 else if ( type == NoGeometry )
1012 Type flat = flatType( type );
1031 else if ( type == Unknown )
1033 else if ( type == NoGeometry )
1035 else if ( type == Point25D ||
1036 type == LineString25D ||
1037 type == Polygon25D ||
1038 type == MultiPoint25D ||
1039 type == MultiLineString25D ||
1040 type == MultiPolygon25D )
1044 Type flat = flatType( type );
1060 if ( !hasZ( type ) )
1065 returnType = addM( returnType );
1078 if ( !hasM( type ) )
1083 returnType = addZ( returnType );
1096 if ( flat >= Point && flat <= MultiPolygon )
1108 wkbEntry(
const QString &name,
bool isMultiType,
Type multiType,
Type singleType,
Type flatType,
GeometryType geometryType,
1109 bool hasZ,
bool hasM )
1111 , mIsMultiType( isMultiType )
1112 , mMultiType( multiType )
1113 , mSingleType( singleType )
1114 , mFlatType( flatType )
1115 , mGeometryType( geometryType )
1129 static const QMap<Type, wkbEntry> ENTRIES;
1132 #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.