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,
160 case GeometryCollection:
161 case GeometryCollectionZ:
162 case GeometryCollectionM:
163 case GeometryCollectionZM:
183 case MultiLineString:
187 case MultiLineStringZ:
191 case MultiLineStringM:
195 case MultiLineStringZM:
231 return CircularString;
233 case CircularStringZ:
234 return CircularStringZ;
236 case CircularStringM:
237 return CircularStringM;
239 case CircularStringZM:
240 return CircularStringZM;
244 return CompoundCurve;
248 return CompoundCurveZ;
252 return CompoundCurveM;
254 case CompoundCurveZM:
256 return CompoundCurveZM;
264 return CurvePolygonZ;
268 return CurvePolygonM;
272 return CurvePolygonZM;
282 case MultiLineString25D:
283 return LineString25D;
286 case MultiPolygon25D:
310 case GeometryCollection:
311 return GeometryCollection;
313 case GeometryCollectionZ:
314 return GeometryCollectionZ;
316 case GeometryCollectionM:
317 return GeometryCollectionM;
319 case GeometryCollectionZM:
320 return GeometryCollectionZM;
339 case MultiLineString:
340 return MultiLineString;
343 case MultiLineStringZ:
344 return MultiLineStringZ;
347 case MultiLineStringM:
348 return MultiLineStringM;
351 case MultiLineStringZM:
352 return MultiLineStringZM;
360 return MultiPolygonZ;
364 return MultiPolygonM;
368 return MultiPolygonZM;
376 case CircularStringZ:
381 case CircularStringM:
385 case CompoundCurveZM:
386 case CircularStringZM:
396 return MultiSurfaceZ;
400 return MultiSurfaceM;
404 return MultiSurfaceZM;
411 return MultiPoint25D;
414 case MultiLineString25D:
415 return MultiLineString25D;
418 case MultiPolygon25D:
419 return MultiPolygon25D;
471 case MultiLineString:
472 case MultiLineStringZ:
473 case MultiLineStringM:
474 case MultiLineStringZM:
475 case MultiLineString25D:
476 return MultiLineString;
482 case MultiPolygon25D:
485 case GeometryCollection:
486 case GeometryCollectionZ:
487 case GeometryCollectionM:
488 case GeometryCollectionZM:
489 return GeometryCollection;
492 case CircularStringZ:
493 case CircularStringM:
494 case CircularStringZM:
495 return CircularString;
500 case CompoundCurveZM:
501 return CompoundCurve;
531 type = flatType( type );
543 static Type parseType(
const QString &wktStr );
552 return ( type != Unknown && !isMultiType( type ) );
577 case CircularStringZ:
584 case CircularStringM:
591 case CircularStringZM:
592 case CompoundCurveZM:
611 switch ( flatType( type ) )
639 case PolygonGeometry:
655 if ( type == Unknown || type == NoGeometry )
658 return 2 + hasZ( type ) + hasM( type );
671 case GeometryCollection:
672 case GeometryCollectionZ:
673 case GeometryCollectionM:
674 case GeometryCollectionZM:
675 return UnknownGeometry;
687 return PointGeometry;
690 case MultiLineString:
692 case MultiLineStringZ:
694 case MultiLineStringM:
696 case MultiLineStringZM:
698 case MultiLineString25D:
702 case CircularStringZ:
705 case CircularStringM:
708 case CircularStringZM:
709 case CompoundCurveZM:
726 case MultiPolygon25D:
735 return PolygonGeometry;
741 return UnknownGeometry;
747 static QString displayString(
Type type );
763 static QString geometryDisplayString(
GeometryType type );
780 case MultiLineStringZ:
782 case GeometryCollectionZ:
783 case CircularStringZ:
793 case MultiLineStringZM:
795 case GeometryCollectionZM:
796 case CircularStringZM:
797 case CompoundCurveZM:
805 case MultiLineString25D:
806 case MultiPolygon25D:
830 case MultiLineStringM:
832 case GeometryCollectionM:
833 case CircularStringM:
843 case MultiLineStringZM:
845 case GeometryCollectionZM:
846 case CircularStringZM:
847 case CompoundCurveZM:
871 else if ( type == Unknown )
873 else if ( type == NoGeometry )
877 Type flat = flatType( type );
896 else if ( type == Unknown )
898 else if ( type == NoGeometry )
900 else if ( type == Point25D ||
901 type == LineString25D ||
902 type == Polygon25D ||
903 type == MultiPoint25D ||
904 type == MultiLineString25D ||
905 type == MultiPolygon25D )
909 Type flat = flatType( type );
930 returnType = addM( returnType );
948 returnType = addZ( returnType );
961 if ( flat >= Point && flat <= MultiPolygon )
973 wkbEntry(
const QString &name,
bool isMultiType,
Type multiType,
Type singleType,
Type flatType,
GeometryType geometryType,
974 bool hasZ,
bool hasM )
976 , mIsMultiType( isMultiType )
977 , mMultiType( multiType )
978 , mSingleType( singleType )
979 , mFlatType( flatType )
980 , mGeometryType( geometryType )
994 static const QMap<Type, wkbEntry> ENTRIES;
997 #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 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.