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:
 
  316           return MultiPolygonZ;
 
  319           return MultiPolygonM;
 
  322           return MultiPolygonZM;
 
  324         case GeometryCollection:
 
  325           return GeometryCollection;
 
  327         case GeometryCollectionZ:
 
  328           return GeometryCollectionZ;
 
  330         case GeometryCollectionM:
 
  331           return GeometryCollectionM;
 
  333         case GeometryCollectionZM:
 
  334           return GeometryCollectionZM;
 
  353         case MultiLineString:
 
  354           return MultiLineString;
 
  357         case MultiLineStringZ:
 
  358           return MultiLineStringZ;
 
  361         case MultiLineStringM:
 
  362           return MultiLineStringM;
 
  365         case MultiLineStringZM:
 
  366           return MultiLineStringZM;
 
  374           return MultiPolygonZ;
 
  378           return MultiPolygonM;
 
  382           return MultiPolygonZM;
 
  390         case CircularStringZ:
 
  395         case CircularStringM:
 
  399         case CompoundCurveZM:
 
  400         case CircularStringZM:
 
  410           return MultiSurfaceZ;
 
  414           return MultiSurfaceM;
 
  418           return MultiSurfaceZM;
 
  425           return MultiPoint25D;
 
  428         case MultiLineString25D:
 
  429           return MultiLineString25D;
 
  432         case MultiPolygon25D:
 
  433           return MultiPolygon25D;
 
  453       switch ( geometryType( type ) )
 
  462           return multiType( type );
 
  492         case GeometryCollection:
 
  493           return GeometryCollection;
 
  495         case GeometryCollectionZ:
 
  496           return GeometryCollectionZ;
 
  498         case GeometryCollectionM:
 
  499           return GeometryCollectionM;
 
  501         case GeometryCollectionZM:
 
  502           return GeometryCollectionZM;
 
  531           return CompoundCurve;
 
  533         case MultiLineString:
 
  539         case CircularStringZ:
 
  541           return CompoundCurveZ;
 
  543         case MultiLineStringZ:
 
  545         case MultiLineString25D:
 
  550         case CircularStringM:
 
  551           return CompoundCurveM;
 
  553         case MultiLineStringM:
 
  558         case CompoundCurveZM:
 
  559         case CircularStringZM:
 
  560           return CompoundCurveZM;
 
  562         case MultiLineStringZM:
 
  577           return CurvePolygonZ;
 
  581         case MultiPolygon25D:
 
  582           return MultiSurfaceZ;
 
  586           return CurvePolygonM;
 
  590           return MultiSurfaceM;
 
  594           return CurvePolygonZM;
 
  598           return MultiSurfaceZM;
 
  605           return MultiPoint25D;
 
  631         case CircularStringM:
 
  635         case CircularStringZ:
 
  639         case CircularStringZM:
 
  640         case CompoundCurveZM:
 
  644           return MultiLineString;
 
  647           return MultiLineStringM;
 
  650           return MultiLineStringZ;
 
  653           return MultiLineStringZM;
 
  671           return MultiPolygonM;
 
  674           return MultiPolygonZ;
 
  677           return MultiPolygonZM;
 
  679         case GeometryCollection:
 
  680         case GeometryCollectionM:
 
  681         case GeometryCollectionZ:
 
  682         case GeometryCollectionZM:
 
  688         case MultiLineString:
 
  689         case MultiLineString25D:
 
  690         case MultiLineStringM:
 
  691         case MultiLineStringZ:
 
  692         case MultiLineStringZM:
 
  699         case MultiPolygon25D:
 
  773         case MultiLineString:
 
  774         case MultiLineStringZ:
 
  775         case MultiLineStringM:
 
  776         case MultiLineStringZM:
 
  777         case MultiLineString25D:
 
  778           return MultiLineString;
 
  784         case MultiPolygon25D:
 
  787         case GeometryCollection:
 
  788         case GeometryCollectionZ:
 
  789         case GeometryCollectionM:
 
  790         case GeometryCollectionZM:
 
  791           return GeometryCollection;
 
  794         case CircularStringZ:
 
  795         case CircularStringM:
 
  796         case CircularStringZM:
 
  797           return CircularString;
 
  802         case CompoundCurveZM:
 
  803           return CompoundCurve;
 
  833       type = flatType( type );
 
  854       return ( type != Unknown && !isMultiType( type ) );
 
  879         case CircularStringZ:
 
  886         case CircularStringM:
 
  893         case CircularStringZM:
 
  894         case CompoundCurveZM:
 
  913       switch ( flatType( type ) )
 
  941         case PolygonGeometry:
 
  957       if ( type == Unknown || type == NoGeometry )
 
  960       return 2 + hasZ( type ) + hasM( type );
 
  973         case GeometryCollection:
 
  974         case GeometryCollectionZ:
 
  975         case GeometryCollectionM:
 
  976         case GeometryCollectionZM:
 
  977           return UnknownGeometry;
 
  989           return PointGeometry;
 
  992         case MultiLineString:
 
  994         case MultiLineStringZ:
 
  996         case MultiLineStringM:
 
  998         case MultiLineStringZM:
 
 1000         case MultiLineString25D:
 
 1001         case CircularString:
 
 1004         case CircularStringZ:
 
 1005         case CompoundCurveZ:
 
 1007         case CircularStringM:
 
 1008         case CompoundCurveM:
 
 1010         case CircularStringZM:
 
 1011         case CompoundCurveZM:
 
 1013           return LineGeometry;
 
 1025         case MultiPolygonZM:
 
 1028         case MultiPolygon25D:
 
 1035         case CurvePolygonZM:
 
 1036         case MultiSurfaceZM:
 
 1037           return PolygonGeometry;
 
 1040           return NullGeometry;
 
 1043       return UnknownGeometry;
 
 1049     static QString displayString( Type type ) 
SIP_HOLDGIL;
 
 1056     static QString translatedDisplayString( Type type ) 
SIP_HOLDGIL;
 
 1072     static QString geometryDisplayString( GeometryType type ) 
SIP_HOLDGIL;
 
 1089         case MultiLineStringZ:
 
 1091         case GeometryCollectionZ:
 
 1092         case CircularStringZ:
 
 1093         case CompoundCurveZ:
 
 1102         case MultiLineStringZM:
 
 1103         case MultiPolygonZM:
 
 1104         case GeometryCollectionZM:
 
 1105         case CircularStringZM:
 
 1106         case CompoundCurveZM:
 
 1107         case CurvePolygonZM:
 
 1109         case MultiSurfaceZM:
 
 1114         case MultiLineString25D:
 
 1115         case MultiPolygon25D:
 
 1139         case MultiLineStringM:
 
 1141         case GeometryCollectionM:
 
 1142         case CircularStringM:
 
 1143         case CompoundCurveM:
 
 1152         case MultiLineStringZM:
 
 1153         case MultiPolygonZM:
 
 1154         case GeometryCollectionZM:
 
 1155         case CircularStringZM:
 
 1156         case CompoundCurveZM:
 
 1157         case CurvePolygonZM:
 
 1159         case MultiSurfaceZM:
 
 1180       else if ( type == Unknown )
 
 1182       else if ( type == NoGeometry )
 
 1186       const Type flat = flatType( type );
 
 1205       else if ( type == Unknown )
 
 1207       else if ( type == NoGeometry )
 
 1209       else if ( type == Point25D )
 
 1211       else if ( type == LineString25D )
 
 1212         return LineStringZM;
 
 1213       else if ( type == Polygon25D )
 
 1215       else if ( type == MultiPoint25D )
 
 1216         return MultiPointZM;
 
 1217       else if ( type == MultiLineString25D )
 
 1218         return MultiLineStringZM;
 
 1219       else if ( type == MultiPolygon25D )
 
 1220         return MultiPolygonZM;
 
 1223       const Type flat = flatType( type );
 
 1239       if ( !hasZ( type ) )
 
 1244         returnType = addM( returnType );
 
 1257       if ( !hasM( type ) )
 
 1262         returnType = addZ( returnType );
 
 1275       if ( flat >= Point && flat <= MultiPolygon )
 
 1276         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 Type promoteNonPointTypesToMulti(Type type) SIP_HOLDGIL
Promotes a WKB geometry type to its multi-type equivalent, with the exception of point geometry types...
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.