QGIS API Documentation  3.6.0-Noosa (5873452)
Classes | 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)
 Adds the m dimension to a WKB type and returns the new type. More...
 
static Type addZ (Type type)
 Adds the z dimension to a WKB type and returns the new type. More...
 
static int coordDimensions (Type type)
 Returns the coordinate dimension of the geometry type as an integer. More...
 
static QString displayString (Type type)
 Returns a display string type for a WKB type, e.g., the geometry name used in WKT geometry representations. More...
 
static Type dropM (Type type)
 Drops the m dimension (if present) for a WKB type and returns the new type. More...
 
static Type dropZ (Type type)
 Drops the z dimension (if present) for a WKB type and returns the new type. More...
 
static Type flatType (Type type)
 Returns the flat type for a WKB type. More...
 
static QString geometryDisplayString (GeometryType type)
 Returns a display string for a geometry type. More...
 
static GeometryType geometryType (Type type)
 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)
 Tests whether a WKB type contains m values. More...
 
static bool hasZ (Type type)
 Tests whether a WKB type contains the z-dimension. More...
 
static bool isCurvedType (Type type)
 Returns true if the WKB type is a curved type or can contain curved geometries. More...
 
static bool isMultiType (Type type)
 Returns true if the WKB type is a multi type. More...
 
static bool isSingleType (Type type)
 Returns true if the WKB type is a single type. More...
 
static Type multiType (Type type)
 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 singleType (Type type)
 Returns the single type for a WKB type. More...
 
static Type to25D (Type type)
 Will convert the 25D version of the flat type if supported or Unknown if not supported. More...
 
static int wkbDimensions (Type type)
 Returns the inherent dimension of the geometry type as an integer. More...
 
static Type zmType (Type type, bool hasZ, bool hasM)
 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 40 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 138 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 68 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 891 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 866 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 652 of file qgswkbtypes.h.

◆ displayString()

QString QgsWkbTypes::displayString ( Type  type)
static

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

Definition at line 119 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 940 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 922 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()

Definition at line 429 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 129 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 665 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 820 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 770 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 608 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 559 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 549 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
isMultiType()
singleType()
flatType()

Definition at line 298 of file qgswkbtypes.h.

◆ parseType()

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

Attempts to extract the WKB type from a WKT string.

Parameters
wktStra valid WKT string

Definition at line 104 of file qgswkbtypes.cpp.

◆ 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()
flatType()

Definition at line 154 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 956 of file qgswkbtypes.h.

◆ 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 631 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 528 of file qgswkbtypes.h.


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