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;
470 case MultiLineString:
471 case MultiLineStringZ:
472 case MultiLineStringM:
473 case MultiLineStringZM:
474 case MultiLineString25D:
475 return MultiLineString;
481 case MultiPolygon25D:
484 case GeometryCollection:
485 case GeometryCollectionZ:
486 case GeometryCollectionM:
487 case GeometryCollectionZM:
488 return GeometryCollection;
491 case CircularStringZ:
492 case CircularStringM:
493 case CircularStringZM:
494 return CircularString;
499 case CompoundCurveZM:
500 return CompoundCurve;
530 type = flatType( type );
542 static Type parseType(
const QString &wktStr );
551 return ( type != Unknown && !isMultiType( type ) );
576 case CircularStringZ:
583 case CircularStringM:
590 case CircularStringZM:
591 case CompoundCurveZM:
610 switch ( flatType( type ) )
638 case PolygonGeometry:
654 if ( type == Unknown || type == NoGeometry )
657 return 2 + hasZ( type ) + hasM( type );
670 case GeometryCollection:
671 case GeometryCollectionZ:
672 case GeometryCollectionM:
673 case GeometryCollectionZM:
674 return UnknownGeometry;
686 return PointGeometry;
689 case MultiLineString:
691 case MultiLineStringZ:
693 case MultiLineStringM:
695 case MultiLineStringZM:
697 case MultiLineString25D:
701 case CircularStringZ:
704 case CircularStringM:
707 case CircularStringZM:
708 case CompoundCurveZM:
725 case MultiPolygon25D:
734 return PolygonGeometry;
740 return UnknownGeometry;
746 static QString displayString(
Type type );
762 static QString geometryDisplayString(
GeometryType type );
779 case MultiLineStringZ:
781 case GeometryCollectionZ:
782 case CircularStringZ:
792 case MultiLineStringZM:
794 case GeometryCollectionZM:
795 case CircularStringZM:
796 case CompoundCurveZM:
804 case MultiLineString25D:
805 case MultiPolygon25D:
829 case MultiLineStringM:
831 case GeometryCollectionM:
832 case CircularStringM:
842 case MultiLineStringZM:
844 case GeometryCollectionZM:
845 case CircularStringZM:
846 case CompoundCurveZM:
870 else if ( type == Unknown )
872 else if ( type == NoGeometry )
876 Type flat = flatType( type );
895 else if ( type == Unknown )
897 else if ( type == NoGeometry )
899 else if ( type == Point25D ||
900 type == LineString25D ||
901 type == Polygon25D ||
902 type == MultiPoint25D ||
903 type == MultiLineString25D ||
904 type == MultiPolygon25D )
908 Type flat = flatType( type );
929 returnType = addM( returnType );
947 returnType = addZ( returnType );
960 if ( flat >= Point && flat <= MultiPolygon )
972 wkbEntry(
const QString &name,
bool isMultiType,
Type multiType,
Type singleType,
Type flatType,
GeometryType geometryType,
973 bool hasZ,
bool hasM )
975 , mIsMultiType( isMultiType )
976 , mMultiType( multiType )
977 , mSingleType( singleType )
978 , mFlatType( flatType )
979 , mGeometryType( geometryType )
993 static const QMap<Type, wkbEntry> ENTRIES;
996 #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.