QGIS API Documentation  3.24.2-Tisler (13c1a02865)
Public Types | Static Public Member Functions | List of all members
QgsWkbTypes Class Reference

Handles storage of information regarding WKB types and their properties. More...

#include <qgswkbtypes.h>

Public Types

enum  GeometryType {
  PointGeometry , LineGeometry , PolygonGeometry , UnknownGeometry ,
  NullGeometry
}
 The geometry types are used to group QgsWkbTypes::Type in a coarse way. More...
 
enum  Type {
  Unknown = 0 , Point = 1 , LineString = 2 , Polygon = 3 ,
  Triangle = 17 , MultiPoint = 4 , MultiLineString = 5 , MultiPolygon = 6 ,
  GeometryCollection = 7 , CircularString = 8 , CompoundCurve = 9 , CurvePolygon = 10 ,
  MultiCurve = 11 , MultiSurface = 12 , NoGeometry = 100 , PointZ = 1001 ,
  LineStringZ = 1002 , PolygonZ = 1003 , TriangleZ = 1017 , MultiPointZ = 1004 ,
  MultiLineStringZ = 1005 , MultiPolygonZ = 1006 , GeometryCollectionZ = 1007 , CircularStringZ = 1008 ,
  CompoundCurveZ = 1009 , CurvePolygonZ = 1010 , MultiCurveZ = 1011 , MultiSurfaceZ = 1012 ,
  PointM = 2001 , LineStringM = 2002 , PolygonM = 2003 , TriangleM = 2017 ,
  MultiPointM = 2004 , MultiLineStringM = 2005 , MultiPolygonM = 2006 , GeometryCollectionM = 2007 ,
  CircularStringM = 2008 , CompoundCurveM = 2009 , CurvePolygonM = 2010 , MultiCurveM = 2011 ,
  MultiSurfaceM = 2012 , PointZM = 3001 , LineStringZM = 3002 , PolygonZM = 3003 ,
  MultiPointZM = 3004 , MultiLineStringZM = 3005 , MultiPolygonZM = 3006 , GeometryCollectionZM = 3007 ,
  CircularStringZM = 3008 , CompoundCurveZM = 3009 , CurvePolygonZM = 3010 , MultiCurveZM = 3011 ,
  MultiSurfaceZM = 3012 , TriangleZM = 3017 , Point25D = 0x80000001 , LineString25D ,
  Polygon25D , MultiPoint25D , MultiLineString25D , MultiPolygon25D
}
 The WKB type describes the number of dimensions a geometry has. More...
 

Static Public Member Functions

static Type addM (Type type) SIP_HOLDGIL
 Adds the m dimension to a WKB type and returns the new type. More...
 
static Type addZ (Type type) SIP_HOLDGIL
 Adds the z dimension to a WKB type and returns the new type. More...
 
static int coordDimensions (Type type) SIP_HOLDGIL
 Returns the coordinate dimension of the geometry type as an integer. More...
 
static Type curveType (Type type) SIP_HOLDGIL
 Returns the curve type for a WKB type. More...
 
static QString displayString (Type type) SIP_HOLDGIL
 Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geometry representations. More...
 
static Type dropM (Type type) SIP_HOLDGIL
 Drops the m dimension (if present) for a WKB type and returns the new type. More...
 
static Type dropZ (Type type) SIP_HOLDGIL
 Drops the z dimension (if present) for a WKB type and returns the new type. More...
 
static Type flatType (Type type) SIP_HOLDGIL
 Returns the flat type for a WKB type. More...
 
static QString geometryDisplayString (GeometryType type) SIP_HOLDGIL
 Returns a display string for a geometry type. More...
 
static GeometryType geometryType (Type type) SIP_HOLDGIL
 Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a PolygonGeometry geometry type. More...
 
static bool hasM (Type type) SIP_HOLDGIL
 Tests whether a WKB type contains m values. More...
 
static bool hasZ (Type type) SIP_HOLDGIL
 Tests whether a WKB type contains the z-dimension. More...
 
static bool isCurvedType (Type type) SIP_HOLDGIL
 Returns true if the WKB type is a curved type or can contain curved geometries. More...
 
static bool isMultiType (Type type) SIP_HOLDGIL
 Returns true if the WKB type is a multi type. More...
 
static bool isSingleType (Type type) SIP_HOLDGIL
 Returns true if the WKB type is a single type. More...
 
static Type linearType (Type type) SIP_HOLDGIL
 Returns the linear type for a WKB type. More...
 
static Type multiType (Type type) SIP_HOLDGIL
 Returns the multi type for a WKB type. More...
 
static Type parseType (const QString &wktStr)
 Attempts to extract the WKB type from a WKT string. More...
 
static Type promoteNonPointTypesToMulti (Type type) SIP_HOLDGIL
 Promotes a WKB geometry type to its multi-type equivalent, with the exception of point geometry types. More...
 
static Type singleType (Type type) SIP_HOLDGIL
 Returns the single type for a WKB type. More...
 
static Type to25D (Type type) SIP_HOLDGIL
 Will convert the 25D version of the flat type if supported or Unknown if not supported. More...
 
static QString translatedDisplayString (Type type) SIP_HOLDGIL
 Returns a translated display string type for a WKB type, e.g., the geometry name used in WKT geometry representations. More...
 
static int wkbDimensions (Type type) SIP_HOLDGIL
 Returns the inherent dimension of the geometry type as an integer. More...
 
static Type zmType (Type type, bool hasZ, bool hasM) SIP_HOLDGIL
 Returns the modified input geometry type according to hasZ / hasM. More...
 

Detailed Description

Handles storage of information regarding WKB types and their properties.

Since
QGIS 2.10

Definition at line 41 of file qgswkbtypes.h.

Member Enumeration Documentation

◆ GeometryType

The geometry types are used to group QgsWkbTypes::Type in a coarse way.

See also
geometryType( QgsWkbTypes::Type )
Enumerator
PointGeometry 
LineGeometry 
PolygonGeometry 
UnknownGeometry 
NullGeometry 

Definition at line 140 of file qgswkbtypes.h.

◆ Type

The WKB type describes the number of dimensions a geometry has.

  • Point
  • LineString
  • Polygon

as well as the number of dimensions for each individual vertex

  • X (always)
  • Y (always)
  • Z (optional)
  • M (measurement value, optional)

it also has values for multi types, collections, unknown geometry, null geometry, no geometry and curve support.

These classes of geometry are often used for data sources to communicate what kind of geometry should be expected for a given geometry field. It is also used for tools or algorithms to decide if they should be available for a given geometry type or act in a different mode.

Enumerator
Unknown 
Point 
LineString 
Polygon 
Triangle 
MultiPoint 
MultiLineString 
MultiPolygon 
GeometryCollection 
CircularString 
CompoundCurve 
CurvePolygon 
MultiCurve 
MultiSurface 
NoGeometry 
PointZ 
LineStringZ 
PolygonZ 
TriangleZ 
MultiPointZ 
MultiLineStringZ 
MultiPolygonZ 
GeometryCollectionZ 
CircularStringZ 
CompoundCurveZ 
CurvePolygonZ 
MultiCurveZ 
MultiSurfaceZ 
PointM 
LineStringM 
PolygonM 
TriangleM 
MultiPointM 
MultiLineStringM 
MultiPolygonM 
GeometryCollectionM 
CircularStringM 
CompoundCurveM 
CurvePolygonM 
MultiCurveM 
MultiSurfaceM 
PointZM 
LineStringZM 
PolygonZM 
MultiPointZM 
MultiLineStringZM 
MultiPolygonZM 
GeometryCollectionZM 
CircularStringZM 
CompoundCurveZM 
CurvePolygonZM 
MultiCurveZM 
MultiSurfaceZM 
TriangleZM 
Point25D 
LineString25D 
Polygon25D 
MultiPoint25D 
MultiLineString25D 
MultiPolygon25D 

Definition at line 69 of file qgswkbtypes.h.

Member Function Documentation

◆ addM()

static Type QgsWkbTypes::addM ( Type  type)
inlinestatic

Adds the m dimension to a WKB type and returns the new type.

Parameters
typeoriginal type
See also
addZ()
dropM()
hasM()
Since
QGIS 2.12

Definition at line 1201 of file qgswkbtypes.h.

◆ addZ()

static Type QgsWkbTypes::addZ ( Type  type)
inlinestatic

Adds the z dimension to a WKB type and returns the new type.

Parameters
typeoriginal type
See also
addM()
dropZ()
hasZ()
Since
QGIS 2.12

Definition at line 1176 of file qgswkbtypes.h.

◆ coordDimensions()

static int QgsWkbTypes::coordDimensions ( Type  type)
inlinestatic

Returns the coordinate dimension of the geometry type as an integer.

Returned value will be between 2-4, depending on whether the geometry type contains the Z or M dimensions. Invalid geometry types will return a dimension of 0.

See also
wkbDimensions()
Since
QGIS 2.14

Definition at line 955 of file qgswkbtypes.h.

◆ curveType()

static Type QgsWkbTypes::curveType ( Type  type)
inlinestatic

Returns the curve type for a WKB type.

For example, for Polygon WKB types the curve type would be CurvePolygon.

Note
Returns CompoundCurve for CircularString (and its Z/M variants)
See also
linearType()
isMultiType()
isCurvedType()
singleType()
flatType()
multiType()
Since
QGIS 3.10

Definition at line 481 of file qgswkbtypes.h.

◆ displayString()

QString QgsWkbTypes::displayString ( Type  type)
static

Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geometry representations.

Definition at line 145 of file qgswkbtypes.cpp.

◆ dropM()

static Type QgsWkbTypes::dropM ( Type  type)
inlinestatic

Drops the m dimension (if present) for a WKB type and returns the new type.

Parameters
typeoriginal type
See also
dropZ()
addM()
Since
QGIS 2.14

Definition at line 1255 of file qgswkbtypes.h.

◆ dropZ()

static Type QgsWkbTypes::dropZ ( Type  type)
inlinestatic

Drops the z dimension (if present) for a WKB type and returns the new type.

Parameters
typeoriginal type
See also
dropM()
addZ()
Since
QGIS 2.14

Definition at line 1237 of file qgswkbtypes.h.

◆ flatType()

static Type QgsWkbTypes::flatType ( Type  type)
inlinestatic

Returns the flat type for a WKB type.

This is the WKB type minus any Z or M dimensions. For example, for PolygonZM WKB types the single type would be Polygon.

See also
singleType()
multiType()
curveType()

Definition at line 732 of file qgswkbtypes.h.

◆ geometryDisplayString()

QString QgsWkbTypes::geometryDisplayString ( QgsWkbTypes::GeometryType  type)
static

Returns a display string for a geometry type.

This will return one of the following strings:

  • Point
  • Line
  • Polygon
  • Unknown Geometry
  • No Geometry
  • Invalid Geometry
Since
QGIS 3.0

Definition at line 223 of file qgswkbtypes.cpp.

◆ geometryType()

static GeometryType QgsWkbTypes::geometryType ( Type  type)
inlinestatic

Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a PolygonGeometry geometry type.

GeometryCollections are reported as QgsWkbTypes::UnknownGeometry.

Definition at line 968 of file qgswkbtypes.h.

◆ hasM()

static bool QgsWkbTypes::hasM ( Type  type)
inlinestatic

Tests whether a WKB type contains m values.

Returns
true if type has m values
See also
addM()
hasZ()

Definition at line 1130 of file qgswkbtypes.h.

◆ hasZ()

static bool QgsWkbTypes::hasZ ( Type  type)
inlinestatic

Tests whether a WKB type contains the z-dimension.

Returns
true if type has z values
See also
addZ()
hasM()

Definition at line 1080 of file qgswkbtypes.h.

◆ isCurvedType()

static bool QgsWkbTypes::isCurvedType ( Type  type)
inlinestatic

Returns true if the WKB type is a curved type or can contain curved geometries.

Since
QGIS 2.14

Definition at line 911 of file qgswkbtypes.h.

◆ isMultiType()

static bool QgsWkbTypes::isMultiType ( Type  type)
inlinestatic

Returns true if the WKB type is a multi type.

See also
isSingleType()
multiType()

Definition at line 862 of file qgswkbtypes.h.

◆ isSingleType()

static bool QgsWkbTypes::isSingleType ( Type  type)
inlinestatic

Returns true if the WKB type is a single type.

See also
isMultiType()
singleType()

Definition at line 852 of file qgswkbtypes.h.

◆ linearType()

static Type QgsWkbTypes::linearType ( Type  type)
inlinestatic

Returns the linear type for a WKB type.

For example, for a CompoundCurve, the linear type would be LineString.

See also
curveType()
isMultiType()
isCurvedType()
singleType()
flatType()
multiType()
Since
QGIS 3.14

Definition at line 622 of file qgswkbtypes.h.

◆ multiType()

static Type QgsWkbTypes::multiType ( Type  type)
inlinestatic

Returns the multi type for a WKB type.

For example, for Polygon WKB types the multi type would be MultiPolygon.

See also
promoteNonPointTypesToMulti()
isMultiType()
singleType()
curveType()
flatType()

Definition at line 304 of file qgswkbtypes.h.

◆ parseType()

static Type QgsWkbTypes::parseType ( const QString &  wktStr)
static

Attempts to extract the WKB type from a WKT string.

Parameters
wktStra valid WKT string

◆ promoteNonPointTypesToMulti()

static Type QgsWkbTypes::promoteNonPointTypesToMulti ( Type  type)
inlinestatic

Promotes a WKB geometry type to its multi-type equivalent, with the exception of point geometry types.

Specifically, this method should be used to determine the most-permissive possible resultant WKB type which can result from subtracting parts of a geometry. A single-point geometry type can never become a multi-point geometry type as a result of a subtraction, but a single-line or single-polygon geometry CAN become a multipart geometry as a result of subtracting portions of the geometry.

See also
multiType()
singleType()
Since
QGIS 3.24

Definition at line 451 of file qgswkbtypes.h.

◆ singleType()

static Type QgsWkbTypes::singleType ( Type  type)
inlinestatic

Returns the single type for a WKB type.

For example, for MultiPolygon WKB types the single type would be Polygon.

See also
isSingleType()
multiType()
curveType()
flatType()

Definition at line 157 of file qgswkbtypes.h.

◆ to25D()

static Type QgsWkbTypes::to25D ( Type  type)
inlinestatic

Will convert the 25D version of the flat type if supported or Unknown if not supported.

Parameters
typeThe type to convert
Returns
the 25D version of the type or Unknown

Definition at line 1271 of file qgswkbtypes.h.

◆ translatedDisplayString()

QString QgsWkbTypes::translatedDisplayString ( Type  type)
static

Returns a translated display string type for a WKB type, e.g., the geometry name used in WKT geometry representations.

Since
QGIS 3.18

Definition at line 155 of file qgswkbtypes.cpp.

◆ wkbDimensions()

static int QgsWkbTypes::wkbDimensions ( Type  type)
inlinestatic

Returns the inherent dimension of the geometry type as an integer.

Returned value will always be less than or equal to the coordinate dimension.

Returns
0 for point geometries, 1 for line geometries, 2 for polygon geometries Invalid geometry types will return a dimension of 0.
See also
coordDimensions()

Definition at line 934 of file qgswkbtypes.h.

◆ zmType()

static Type QgsWkbTypes::zmType ( Type  type,
bool  hasZ,
bool  hasM 
)
inlinestatic

Returns the modified input geometry type according to hasZ / hasM.

Definition at line 831 of file qgswkbtypes.h.


The documentation for this class was generated from the following files: