QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
qgswkbtypes.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgswkbtypes.cpp
3 ---------------
4 begin : January 2015
5 copyright : (C) 2015 by Marco Hugentobler
6 email : marco at sourcepole dot ch
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "qgswkbtypes.h"
19
20/***************************************************************************
21 * This class is considered CRITICAL and any change MUST be accompanied with
22 * full unit tests.
23 * See details in QEP #17
24 ****************************************************************************/
25
26
28{
29 WkbEntry( const QString &name, bool isMultiType, Qgis::WkbType multiType, Qgis::WkbType singleType, Qgis::WkbType flatType, Qgis::GeometryType geometryType,
30 bool hasZ, bool hasM )
31 : mName( name )
32 , mIsMultiType( isMultiType )
33 , mMultiType( multiType )
34 , mSingleType( singleType )
35 , mFlatType( flatType )
36 , mGeometryType( geometryType )
37 , mHasZ( hasZ )
38 , mHasM( hasM )
39 {}
40 QString mName;
46 bool mHasZ;
47 bool mHasM;
48};
49
50typedef QMap<Qgis::WkbType, WkbEntry> WkbEntries;
51
53{
54 //register the known wkb types
55 { Qgis::WkbType::Unknown, WkbEntry( QLatin1String( "Unknown" ), false, Qgis::WkbType::Unknown, Qgis::WkbType::Unknown, Qgis::WkbType::Unknown, Qgis::GeometryType::Unknown, false, false ) },
56 { Qgis::WkbType::NoGeometry, WkbEntry( QLatin1String( "NoGeometry" ), false, Qgis::WkbType::NoGeometry, Qgis::WkbType::NoGeometry, Qgis::WkbType::NoGeometry, Qgis::GeometryType::Null, false, false ) },
57 //point
58 {Qgis::WkbType::Point, WkbEntry( QLatin1String( "Point" ), false, Qgis::WkbType::MultiPoint, Qgis::WkbType::Point, Qgis::WkbType::Point, Qgis::GeometryType::Point, false, false ) },
59 {Qgis::WkbType::PointZ, WkbEntry( QLatin1String( "PointZ" ), false, Qgis::WkbType::MultiPointZ, Qgis::WkbType::PointZ, Qgis::WkbType::Point, Qgis::GeometryType::Point, true, false ) },
60 {Qgis::WkbType::PointM, WkbEntry( QLatin1String( "PointM" ), false, Qgis::WkbType::MultiPointM, Qgis::WkbType::PointM, Qgis::WkbType::Point, Qgis::GeometryType::Point, false, true ) },
61 {Qgis::WkbType::PointZM, WkbEntry( QLatin1String( "PointZM" ), false, Qgis::WkbType::MultiPointZM, Qgis::WkbType::PointZM, Qgis::WkbType::Point, Qgis::GeometryType::Point, true, true ) },
62 {Qgis::WkbType::Point25D, WkbEntry( QLatin1String( "Point25D" ), false, Qgis::WkbType::MultiPoint25D, Qgis::WkbType::Point25D, Qgis::WkbType::Point, Qgis::GeometryType::Point, true, false ) },
63 //linestring
64 { Qgis::WkbType::LineString, WkbEntry( QLatin1String( "LineString" ), false, Qgis::WkbType::MultiLineString, Qgis::WkbType::LineString, Qgis::WkbType::LineString, Qgis::GeometryType::Line, false, false ) },
65 { Qgis::WkbType::LineStringZ, WkbEntry( QLatin1String( "LineStringZ" ), false, Qgis::WkbType::MultiLineStringZ, Qgis::WkbType::LineStringZ, Qgis::WkbType::LineString, Qgis::GeometryType::Line, true, false ) },
66 { Qgis::WkbType::LineStringM, WkbEntry( QLatin1String( "LineStringM" ), false, Qgis::WkbType::MultiLineStringM, Qgis::WkbType::LineStringM, Qgis::WkbType::LineString, Qgis::GeometryType::Line, false, true ) },
67 { Qgis::WkbType::LineStringZM, WkbEntry( QLatin1String( "LineStringZM" ), false, Qgis::WkbType::MultiLineStringZM, Qgis::WkbType::LineStringZM, Qgis::WkbType::LineString, Qgis::GeometryType::Line, true, true ) },
68 { Qgis::WkbType::LineString25D, WkbEntry( QLatin1String( "LineString25D" ), false, Qgis::WkbType::MultiLineString25D, Qgis::WkbType::LineString25D, Qgis::WkbType::LineString, Qgis::GeometryType::Line, true, false ) },
69 //circularstring
70 { Qgis::WkbType::CircularString, WkbEntry( QLatin1String( "CircularString" ), false, Qgis::WkbType::MultiCurve, Qgis::WkbType::CircularString, Qgis::WkbType::CircularString, Qgis::GeometryType::Line, false, false ) },
71 { Qgis::WkbType::CircularStringZ, WkbEntry( QLatin1String( "CircularStringZ" ), false, Qgis::WkbType::MultiCurveZ, Qgis::WkbType::CircularStringZ, Qgis::WkbType::CircularString, Qgis::GeometryType::Line, true, false ) },
72 { Qgis::WkbType::CircularStringM, WkbEntry( QLatin1String( "CircularStringM" ), false, Qgis::WkbType::MultiCurveM, Qgis::WkbType::CircularStringM, Qgis::WkbType::CircularString, Qgis::GeometryType::Line, false, true ) },
73 { Qgis::WkbType::CircularStringZM, WkbEntry( QLatin1String( "CircularStringZM" ), false, Qgis::WkbType::MultiCurveZM, Qgis::WkbType::CircularStringZM, Qgis::WkbType::CircularString, Qgis::GeometryType::Line, true, true ) },
74 //compoundcurve
75 { Qgis::WkbType::CompoundCurve, WkbEntry( QLatin1String( "CompoundCurve" ), false, Qgis::WkbType::MultiCurve, Qgis::WkbType::CompoundCurve, Qgis::WkbType::CompoundCurve, Qgis::GeometryType::Line, false, false ) },
76 { Qgis::WkbType::CompoundCurveZ, WkbEntry( QLatin1String( "CompoundCurveZ" ), false, Qgis::WkbType::MultiCurveZ, Qgis::WkbType::CompoundCurveZ, Qgis::WkbType::CompoundCurve, Qgis::GeometryType::Line, true, false ) },
77 { Qgis::WkbType::CompoundCurveM, WkbEntry( QLatin1String( "CompoundCurveM" ), false, Qgis::WkbType::MultiCurveM, Qgis::WkbType::CompoundCurveM, Qgis::WkbType::CompoundCurve, Qgis::GeometryType::Line, false, true ) },
78 { Qgis::WkbType::CompoundCurveZM, WkbEntry( QLatin1String( "CompoundCurveZM" ), false, Qgis::WkbType::MultiCurveZM, Qgis::WkbType::CompoundCurveZM, Qgis::WkbType::CompoundCurve, Qgis::GeometryType::Line, true, true ) },
79 //polygonQgis::WkbTypes
80 { Qgis::WkbType::Polygon, WkbEntry( QLatin1String( "Polygon" ), false, Qgis::WkbType::MultiPolygon, Qgis::WkbType::Polygon, Qgis::WkbType::Polygon, Qgis::GeometryType::Polygon, false, false ) },
81 { Qgis::WkbType::PolygonZ, WkbEntry( QLatin1String( "PolygonZ" ), false, Qgis::WkbType::MultiPolygonZ, Qgis::WkbType::PolygonZ, Qgis::WkbType::Polygon, Qgis::GeometryType::Polygon, true, false ) },
82 { Qgis::WkbType::PolygonM, WkbEntry( QLatin1String( "PolygonM" ), false, Qgis::WkbType::MultiPolygonM, Qgis::WkbType::PolygonM, Qgis::WkbType::Polygon, Qgis::GeometryType::Polygon, false, true ) },
83 { Qgis::WkbType::PolygonZM, WkbEntry( QLatin1String( "PolygonZM" ), false, Qgis::WkbType::MultiPolygonZM, Qgis::WkbType::PolygonZM, Qgis::WkbType::Polygon, Qgis::GeometryType::Polygon, true, true ) },
84 { Qgis::WkbType::Polygon25D, WkbEntry( QLatin1String( "Polygon25D" ), false, Qgis::WkbType::MultiPolygon25D, Qgis::WkbType::Polygon25D, Qgis::WkbType::Polygon, Qgis::GeometryType::Polygon, true, false ) },
85 //triangle
86 { Qgis::WkbType::Triangle, WkbEntry( QLatin1String( "Triangle" ), false, Qgis::WkbType::Unknown, Qgis::WkbType::Triangle, Qgis::WkbType::Triangle, Qgis::GeometryType::Polygon, false, false ) },
87 { Qgis::WkbType::TriangleZ, WkbEntry( QLatin1String( "TriangleZ" ), false, Qgis::WkbType::Unknown, Qgis::WkbType::TriangleZ, Qgis::WkbType::Triangle, Qgis::GeometryType::Polygon, true, false ) },
88 { Qgis::WkbType::TriangleM, WkbEntry( QLatin1String( "TriangleM" ), false, Qgis::WkbType::Unknown, Qgis::WkbType::TriangleM, Qgis::WkbType::Triangle, Qgis::GeometryType::Polygon, false, true ) },
89 { Qgis::WkbType::TriangleZM, WkbEntry( QLatin1String( "TriangleZM" ), false, Qgis::WkbType::Unknown, Qgis::WkbType::TriangleZM, Qgis::WkbType::Triangle, Qgis::GeometryType::Polygon, true, true ) },
90 //curvepolygon
91 { Qgis::WkbType::CurvePolygon, WkbEntry( QLatin1String( "CurvePolygon" ), false, Qgis::WkbType::MultiSurface, Qgis::WkbType::CurvePolygon, Qgis::WkbType::CurvePolygon, Qgis::GeometryType::Polygon, false, false ) },
92 { Qgis::WkbType::CurvePolygonZ, WkbEntry( QLatin1String( "CurvePolygonZ" ), false, Qgis::WkbType::MultiSurfaceZ, Qgis::WkbType::CurvePolygonZ, Qgis::WkbType::CurvePolygon, Qgis::GeometryType::Polygon, true, false ) },
93 { Qgis::WkbType::CurvePolygonM, WkbEntry( QLatin1String( "CurvePolygonM" ), false, Qgis::WkbType::MultiSurfaceM, Qgis::WkbType::CurvePolygonM, Qgis::WkbType::CurvePolygon, Qgis::GeometryType::Polygon, false, true ) },
94 { Qgis::WkbType::CurvePolygonZM, WkbEntry( QLatin1String( "CurvePolygonZM" ), false, Qgis::WkbType::MultiSurfaceZM, Qgis::WkbType::CurvePolygonZM, Qgis::WkbType::CurvePolygon, Qgis::GeometryType::Polygon, true, true ) },
95 //multipoint
96 { Qgis::WkbType::MultiPoint, WkbEntry( QLatin1String( "MultiPoint" ), true, Qgis::WkbType::MultiPoint, Qgis::WkbType::Point, Qgis::WkbType::MultiPoint, Qgis::GeometryType::Point, false, false ) },
97 { Qgis::WkbType::MultiPointZ, WkbEntry( QLatin1String( "MultiPointZ" ), true, Qgis::WkbType::MultiPointZ, Qgis::WkbType::PointZ, Qgis::WkbType::MultiPoint, Qgis::GeometryType::Point, true, false ) },
98 { Qgis::WkbType::MultiPointM, WkbEntry( QLatin1String( "MultiPointM" ), true, Qgis::WkbType::MultiPointM, Qgis::WkbType::PointM, Qgis::WkbType::MultiPoint, Qgis::GeometryType::Point, false, true ) },
99 { Qgis::WkbType::MultiPointZM, WkbEntry( QLatin1String( "MultiPointZM" ), true, Qgis::WkbType::MultiPointZM, Qgis::WkbType::PointZM, Qgis::WkbType::MultiPoint, Qgis::GeometryType::Point, true, true ) },
100 { Qgis::WkbType::MultiPoint25D, WkbEntry( QLatin1String( "MultiPoint25D" ), true, Qgis::WkbType::MultiPoint25D, Qgis::WkbType::Point25D, Qgis::WkbType::MultiPoint, Qgis::GeometryType::Point, true, false ) },
101 //multiline
102 {Qgis::WkbType::MultiLineString, WkbEntry( QLatin1String( "MultiLineString" ), true, Qgis::WkbType::MultiLineString, Qgis::WkbType::LineString, Qgis::WkbType::MultiLineString, Qgis::GeometryType::Line, false, false ) },
103 {Qgis::WkbType::MultiLineStringZ, WkbEntry( QLatin1String( "MultiLineStringZ" ), true, Qgis::WkbType::MultiLineStringZ, Qgis::WkbType::LineStringZ, Qgis::WkbType::MultiLineString, Qgis::GeometryType::Line, true, false ) },
104 {Qgis::WkbType::MultiLineStringM, WkbEntry( QLatin1String( "MultiLineStringM" ), true, Qgis::WkbType::MultiLineStringM, Qgis::WkbType::LineStringM, Qgis::WkbType::MultiLineString, Qgis::GeometryType::Line, false, true ) },
105 {Qgis::WkbType::MultiLineStringZM, WkbEntry( QLatin1String( "MultiLineStringZM" ), true, Qgis::WkbType::MultiLineStringZM, Qgis::WkbType::LineStringZM, Qgis::WkbType::MultiLineString, Qgis::GeometryType::Line, true, true ) },
106 {Qgis::WkbType::MultiLineString25D, WkbEntry( QLatin1String( "MultiLineString25D" ), true, Qgis::WkbType::MultiLineString25D, Qgis::WkbType::LineString25D, Qgis::WkbType::MultiLineString, Qgis::GeometryType::Line, true, false ) },
107 //multicurve
108 {Qgis::WkbType::MultiCurve, WkbEntry( QLatin1String( "MultiCurve" ), true, Qgis::WkbType::MultiCurve, Qgis::WkbType::CompoundCurve, Qgis::WkbType::MultiCurve, Qgis::GeometryType::Line, false, false ) },
109 {Qgis::WkbType::MultiCurveZ, WkbEntry( QLatin1String( "MultiCurveZ" ), true, Qgis::WkbType::MultiCurveZ, Qgis::WkbType::CompoundCurveZ, Qgis::WkbType::MultiCurve, Qgis::GeometryType::Line, true, false ) },
110 {Qgis::WkbType::MultiCurveM, WkbEntry( QLatin1String( "MultiCurveM" ), true, Qgis::WkbType::MultiCurveM, Qgis::WkbType::CompoundCurveM, Qgis::WkbType::MultiCurve, Qgis::GeometryType::Line, false, true ) },
111 {Qgis::WkbType::MultiCurveZM, WkbEntry( QLatin1String( "MultiCurveZM" ), true, Qgis::WkbType::MultiCurveZM, Qgis::WkbType::CompoundCurveZM, Qgis::WkbType::MultiCurve, Qgis::GeometryType::Line, true, true ) },
112 //multipolygon
113 { Qgis::WkbType::MultiPolygon, WkbEntry( QLatin1String( "MultiPolygon" ), true, Qgis::WkbType::MultiPolygon, Qgis::WkbType::Polygon, Qgis::WkbType::MultiPolygon, Qgis::GeometryType::Polygon, false, false ) },
114 { Qgis::WkbType::MultiPolygonZ, WkbEntry( QLatin1String( "MultiPolygonZ" ), true, Qgis::WkbType::MultiPolygonZ, Qgis::WkbType::PolygonZ, Qgis::WkbType::MultiPolygon, Qgis::GeometryType::Polygon, true, false ) },
115 { Qgis::WkbType::MultiPolygonM, WkbEntry( QLatin1String( "MultiPolygonM" ), true, Qgis::WkbType::MultiPolygonM, Qgis::WkbType::PolygonM, Qgis::WkbType::MultiPolygon, Qgis::GeometryType::Polygon, false, true ) },
116 { Qgis::WkbType::MultiPolygonZM, WkbEntry( QLatin1String( "MultiPolygonZM" ), true, Qgis::WkbType::MultiPolygonZM, Qgis::WkbType::PolygonZM, Qgis::WkbType::MultiPolygon, Qgis::GeometryType::Polygon, true, true ) },
117 { Qgis::WkbType::MultiPolygon25D, WkbEntry( QLatin1String( "MultiPolygon25D" ), true, Qgis::WkbType::MultiPolygon25D, Qgis::WkbType::Polygon25D, Qgis::WkbType::MultiPolygon, Qgis::GeometryType::Polygon, true, false ) },
118 //multisurface
119 { Qgis::WkbType::MultiSurface, WkbEntry( QLatin1String( "MultiSurface" ), true, Qgis::WkbType::MultiSurface, Qgis::WkbType::CurvePolygon, Qgis::WkbType::MultiSurface, Qgis::GeometryType::Polygon, false, false ) },
120 { Qgis::WkbType::MultiSurfaceZ, WkbEntry( QLatin1String( "MultiSurfaceZ" ), true, Qgis::WkbType::MultiSurfaceZ, Qgis::WkbType::CurvePolygonZ, Qgis::WkbType::MultiSurface, Qgis::GeometryType::Polygon, true, false ) },
121 { Qgis::WkbType::MultiSurfaceM, WkbEntry( QLatin1String( "MultiSurfaceM" ), true, Qgis::WkbType::MultiSurfaceM, Qgis::WkbType::CurvePolygonM, Qgis::WkbType::MultiSurface, Qgis::GeometryType::Polygon, false, true ) },
122 { Qgis::WkbType::MultiSurfaceZM, WkbEntry( QLatin1String( "MultiSurfaceZM" ), true, Qgis::WkbType::MultiSurfaceZM, Qgis::WkbType::CurvePolygonZM, Qgis::WkbType::MultiSurface, Qgis::GeometryType::Polygon, true, true ) },
123 //geometrycollection
124 { Qgis::WkbType::GeometryCollection, WkbEntry( QLatin1String( "GeometryCollection" ), true, Qgis::WkbType::GeometryCollection, Qgis::WkbType::Unknown, Qgis::WkbType::GeometryCollection, Qgis::GeometryType::Unknown, false, false ) },
125 { Qgis::WkbType::GeometryCollectionZ, WkbEntry( QLatin1String( "GeometryCollectionZ" ), true, Qgis::WkbType::GeometryCollectionZ, Qgis::WkbType::Unknown, Qgis::WkbType::GeometryCollection, Qgis::GeometryType::Unknown, true, false ) },
126 { Qgis::WkbType::GeometryCollectionM, WkbEntry( QLatin1String( "GeometryCollectionM" ), true, Qgis::WkbType::GeometryCollectionM, Qgis::WkbType::Unknown, Qgis::WkbType::GeometryCollection, Qgis::GeometryType::Unknown, false, true ) },
127 { Qgis::WkbType::GeometryCollectionZM, WkbEntry( QLatin1String( "GeometryCollectionZM" ), true, Qgis::WkbType::GeometryCollectionZM, Qgis::WkbType::Unknown, Qgis::WkbType::GeometryCollection, Qgis::GeometryType::Unknown, true, true ) },
128} ) )
129
130Qgis::WkbType QgsWkbTypes::parseType( const QString &wktStr )
131{
132 const QString typestr = wktStr.left( wktStr.indexOf( '(' ) ).simplified().remove( ' ' );
133
134 QMap<Qgis::WkbType, WkbEntry>::const_iterator it = sWkbEntries()->constBegin();
135 for ( ; it != sWkbEntries()->constEnd(); ++it )
136 {
137 if ( it.value().mName.compare( typestr, Qt::CaseInsensitive ) == 0 )
138 {
139 return it.key();
140 }
141 }
143}
144
146{
147 const QMap< Qgis::WkbType, WkbEntry >::const_iterator it = sWkbEntries()->constFind( type );
148 if ( it == sWkbEntries()->constEnd() )
149 {
150 return QString();
151 }
152 return it->mName;
153}
154
156{
157 switch ( type )
158 {
159 case Qgis::WkbType::Unknown: return QObject::tr( "Unknown" );
160 case Qgis::WkbType::Point: return QObject::tr( "Point" );
161 case Qgis::WkbType::LineString: return QObject::tr( "LineString" );
162 case Qgis::WkbType::Polygon: return QObject::tr( "Polygon" );
163 case Qgis::WkbType::Triangle: return QObject::tr( "Triangle" );
164 case Qgis::WkbType::MultiPoint: return QObject::tr( "MultiPoint" );
165 case Qgis::WkbType::MultiLineString: return QObject::tr( "MultiLine" );
166 case Qgis::WkbType::MultiPolygon: return QObject::tr( "MultiPolygon" );
167 case Qgis::WkbType::GeometryCollection: return QObject::tr( "GeometryCollection" );
168 case Qgis::WkbType::CircularString: return QObject::tr( "CircularString" );
169 case Qgis::WkbType::CompoundCurve: return QObject::tr( "CompoundCurve" );
170 case Qgis::WkbType::CurvePolygon: return QObject::tr( "CurvePolygon" );
171 case Qgis::WkbType::MultiCurve: return QObject::tr( "MultiCurve" );
172 case Qgis::WkbType::MultiSurface: return QObject::tr( "MultiSurface" );
173 case Qgis::WkbType::NoGeometry: return QObject::tr( "No Geometry" );
174 case Qgis::WkbType::PointZ: return QObject::tr( "PointZ" );
175 case Qgis::WkbType::LineStringZ: return QObject::tr( "LineStringZ" );
176 case Qgis::WkbType::PolygonZ: return QObject::tr( "PolygonZ" );
177 case Qgis::WkbType::TriangleZ: return QObject::tr( "TriangleZ" );
178 case Qgis::WkbType::MultiPointZ: return QObject::tr( "MultiPointZ" );
179 case Qgis::WkbType::MultiLineStringZ: return QObject::tr( "MultiLineZ" );
180 case Qgis::WkbType::MultiPolygonZ: return QObject::tr( "MultiPolygonZ" );
181 case Qgis::WkbType::GeometryCollectionZ: return QObject::tr( "GeometryCollectionZ" );
182 case Qgis::WkbType::CircularStringZ: return QObject::tr( "CircularStringZ" );
183 case Qgis::WkbType::CompoundCurveZ: return QObject::tr( "CompoundCurveZ" );
184 case Qgis::WkbType::CurvePolygonZ: return QObject::tr( "CurvePolygonZ" );
185 case Qgis::WkbType::MultiCurveZ: return QObject::tr( "MultiCurveZ" );
186 case Qgis::WkbType::MultiSurfaceZ: return QObject::tr( "MultiSurfaceZ" );
187 case Qgis::WkbType::PointM: return QObject::tr( "PointM" );
188 case Qgis::WkbType::LineStringM: return QObject::tr( "LineStringM" );
189 case Qgis::WkbType::PolygonM: return QObject::tr( "PolygonM" );
190 case Qgis::WkbType::TriangleM: return QObject::tr( "TriangleM" );
191 case Qgis::WkbType::MultiPointM: return QObject::tr( "MultiPointM" );
192 case Qgis::WkbType::MultiLineStringM: return QObject::tr( "MultiLineStringM" );
193 case Qgis::WkbType::MultiPolygonM: return QObject::tr( "MultiPolygonM" );
194 case Qgis::WkbType::GeometryCollectionM: return QObject::tr( "GeometryCollectionM" );
195 case Qgis::WkbType::CircularStringM: return QObject::tr( "CircularStringM" );
196 case Qgis::WkbType::CompoundCurveM: return QObject::tr( "CompoundCurveM" );
197 case Qgis::WkbType::CurvePolygonM: return QObject::tr( "CurvePolygonM" );
198 case Qgis::WkbType::MultiCurveM: return QObject::tr( "MultiCurveM" );
199 case Qgis::WkbType::MultiSurfaceM: return QObject::tr( "MultiSurfaceM" );
200 case Qgis::WkbType::PointZM: return QObject::tr( "PointZM" );
201 case Qgis::WkbType::LineStringZM: return QObject::tr( "LineStringZM" );
202 case Qgis::WkbType::PolygonZM: return QObject::tr( "PolygonZM" );
203 case Qgis::WkbType::MultiPointZM: return QObject::tr( "MultiPointZM" );
204 case Qgis::WkbType::MultiLineStringZM: return QObject::tr( "MultiLineZM" );
205 case Qgis::WkbType::MultiPolygonZM: return QObject::tr( "MultiPolygonZM" );
206 case Qgis::WkbType::GeometryCollectionZM: return QObject::tr( "GeometryCollectionZM" );
207 case Qgis::WkbType::CircularStringZM: return QObject::tr( "CircularStringZM" );
208 case Qgis::WkbType::CompoundCurveZM: return QObject::tr( "CompoundCurveZM" );
209 case Qgis::WkbType::CurvePolygonZM: return QObject::tr( "CurvePolygonZM" );
210 case Qgis::WkbType::MultiCurveZM: return QObject::tr( "MultiCurveZM" );
211 case Qgis::WkbType::MultiSurfaceZM: return QObject::tr( "MultiSurfaceZM" );
212 case Qgis::WkbType::TriangleZM: return QObject::tr( "TriangleZM" );
213 case Qgis::WkbType::Point25D: return QObject::tr( "Point25D" );
214 case Qgis::WkbType::LineString25D: return QObject::tr( "LineString25D" );
215 case Qgis::WkbType::Polygon25D: return QObject::tr( "Polygon25D" );
216 case Qgis::WkbType::MultiPoint25D: return QObject::tr( "MultiPoint25D" );
217 case Qgis::WkbType::MultiLineString25D: return QObject::tr( "MultiLineString25D" );
218 case Qgis::WkbType::MultiPolygon25D: return QObject::tr( "MultiPolygon25D" );
219 }
220 return QString();
221}
222
224{
225
226 switch ( type )
227 {
228 case Qgis::GeometryType::Point:
229 return QStringLiteral( "Point" );
230 case Qgis::GeometryType::Line:
231 return QStringLiteral( "Line" );
232 case Qgis::GeometryType::Polygon:
233 return QStringLiteral( "Polygon" );
234 case Qgis::GeometryType::Unknown:
235 return QStringLiteral( "Unknown geometry" );
236 case Qgis::GeometryType::Null:
237 return QStringLiteral( "No geometry" );
238 default:
239 return QStringLiteral( "Invalid type" );
240 }
241
242
243}
244
245/***************************************************************************
246 * This class is considered CRITICAL and any change MUST be accompanied with
247 * full unit tests.
248 * See details in QEP #17
249 ****************************************************************************/
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:54
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Definition: qgis.h:227
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition: qgis.h:154
@ LineString25D
LineString25D.
@ MultiSurfaceM
MultiSurfaceM.
@ MultiLineStringZM
MultiLineStringZM.
@ MultiPointZM
MultiPointZM.
@ MultiPointZ
MultiPointZ.
@ CompoundCurve
CompoundCurve.
@ MultiPolygonZM
MultiPolygonZM.
@ LineStringM
LineStringM.
@ LineString
LineString.
@ MultiLineStringM
MultiLineStringM.
@ MultiPolygon25D
MultiPolygon25D.
@ MultiPointM
MultiPointM.
@ MultiPoint
MultiPoint.
@ LineStringZM
LineStringZM.
@ GeometryCollectionZM
GeometryCollectionZM.
@ TriangleZ
TriangleZ.
@ Polygon
Polygon.
@ CompoundCurveZM
CompoundCurveZM.
@ CompoundCurveM
CompoundCurveM.
@ MultiLineString25D
MultiLineString25D.
@ MultiPolygon
MultiPolygon.
@ GeometryCollectionZ
GeometryCollectionZ.
@ GeometryCollectionM
GeometryCollectionM.
@ CircularStringZM
CircularStringZM.
@ Triangle
Triangle.
@ PolygonM
PolygonM.
@ NoGeometry
No geometry.
@ MultiSurfaceZ
MultiSurfaceZ.
@ CurvePolygonZM
CurvePolygonZM.
@ MultiLineString
MultiLineString.
@ MultiPolygonM
MultiPolygonM.
@ MultiCurveZM
MultiCurveZM.
@ MultiSurfaceZM
MultiSurfaceZM.
@ PolygonZM
PolygonZM.
@ MultiPoint25D
MultiPoint25D.
@ Unknown
Unknown.
@ PointM
PointM.
@ CurvePolygonM
CurvePolygonM.
@ CircularString
CircularString.
@ PointZ
PointZ.
@ TriangleZM
TriangleZM.
@ MultiLineStringZ
MultiLineStringZ.
@ GeometryCollection
GeometryCollection.
@ MultiPolygonZ
MultiPolygonZ.
@ CurvePolygonZ
CurvePolygonZ.
@ MultiCurve
MultiCurve.
@ CompoundCurveZ
CompoundCurveZ.
@ MultiCurveZ
MultiCurveZ.
@ MultiCurveM
MultiCurveM.
@ CircularStringM
CircularStringM.
@ CurvePolygon
CurvePolygon.
@ Point25D
Point25D.
@ PointZM
PointZM.
@ TriangleM
TriangleM.
@ CircularStringZ
CircularStringZ.
@ LineStringZ
LineStringZ.
@ MultiSurface
MultiSurface.
@ PolygonZ
PolygonZ.
@ Polygon25D
Polygon25D.
Handles storage of information regarding WKB types and their properties.
Definition: qgswkbtypes.h:43
static QString geometryDisplayString(Qgis::GeometryType type) SIP_HOLDGIL
Returns a display string for a geometry type.
static QString translatedDisplayString(Qgis::WkbType type) SIP_HOLDGIL
Returns a translated display string type for a WKB type, e.g., the geometry name used in WKT geometry...
static QString displayString(Qgis::WkbType type) SIP_HOLDGIL
Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geom...
Q_GLOBAL_STATIC_WITH_ARGS(WkbEntries, sWkbEntries,({ { Qgis::WkbType::Unknown, WkbEntry(QLatin1String("Unknown"), false, Qgis::WkbType::Unknown, Qgis::WkbType::Unknown, Qgis::WkbType::Unknown, Qgis::GeometryType::Unknown, false, false) }, { Qgis::WkbType::NoGeometry, WkbEntry(QLatin1String("NoGeometry"), false, Qgis::WkbType::NoGeometry, Qgis::WkbType::NoGeometry, Qgis::WkbType::NoGeometry, Qgis::GeometryType::Null, false, false) }, {Qgis::WkbType::Point, WkbEntry(QLatin1String("Point"), false, Qgis::WkbType::MultiPoint, Qgis::WkbType::Point, Qgis::WkbType::Point, Qgis::GeometryType::Point, false, false) }, {Qgis::WkbType::PointZ, WkbEntry(QLatin1String("PointZ"), false, Qgis::WkbType::MultiPointZ, Qgis::WkbType::PointZ, Qgis::WkbType::Point, Qgis::GeometryType::Point, true, false) }, {Qgis::WkbType::PointM, WkbEntry(QLatin1String("PointM"), false, Qgis::WkbType::MultiPointM, Qgis::WkbType::PointM, Qgis::WkbType::Point, Qgis::GeometryType::Point, false, true) }, {Qgis::WkbType::PointZM, WkbEntry(QLatin1String("PointZM"), false, Qgis::WkbType::MultiPointZM, Qgis::WkbType::PointZM, Qgis::WkbType::Point, Qgis::GeometryType::Point, true, true) }, {Qgis::WkbType::Point25D, WkbEntry(QLatin1String("Point25D"), false, Qgis::WkbType::MultiPoint25D, Qgis::WkbType::Point25D, Qgis::WkbType::Point, Qgis::GeometryType::Point, true, false) }, { Qgis::WkbType::LineString, WkbEntry(QLatin1String("LineString"), false, Qgis::WkbType::MultiLineString, Qgis::WkbType::LineString, Qgis::WkbType::LineString, Qgis::GeometryType::Line, false, false) }, { Qgis::WkbType::LineStringZ, WkbEntry(QLatin1String("LineStringZ"), false, Qgis::WkbType::MultiLineStringZ, Qgis::WkbType::LineStringZ, Qgis::WkbType::LineString, Qgis::GeometryType::Line, true, false) }, { Qgis::WkbType::LineStringM, WkbEntry(QLatin1String("LineStringM"), false, Qgis::WkbType::MultiLineStringM, Qgis::WkbType::LineStringM, Qgis::WkbType::LineString, Qgis::GeometryType::Line, false, true) }, { Qgis::WkbType::LineStringZM, WkbEntry(QLatin1String("LineStringZM"), false, Qgis::WkbType::MultiLineStringZM, Qgis::WkbType::LineStringZM, Qgis::WkbType::LineString, Qgis::GeometryType::Line, true, true) }, { Qgis::WkbType::LineString25D, WkbEntry(QLatin1String("LineString25D"), false, Qgis::WkbType::MultiLineString25D, Qgis::WkbType::LineString25D, Qgis::WkbType::LineString, Qgis::GeometryType::Line, true, false) }, { Qgis::WkbType::CircularString, WkbEntry(QLatin1String("CircularString"), false, Qgis::WkbType::MultiCurve, Qgis::WkbType::CircularString, Qgis::WkbType::CircularString, Qgis::GeometryType::Line, false, false) }, { Qgis::WkbType::CircularStringZ, WkbEntry(QLatin1String("CircularStringZ"), false, Qgis::WkbType::MultiCurveZ, Qgis::WkbType::CircularStringZ, Qgis::WkbType::CircularString, Qgis::GeometryType::Line, true, false) }, { Qgis::WkbType::CircularStringM, WkbEntry(QLatin1String("CircularStringM"), false, Qgis::WkbType::MultiCurveM, Qgis::WkbType::CircularStringM, Qgis::WkbType::CircularString, Qgis::GeometryType::Line, false, true) }, { Qgis::WkbType::CircularStringZM, WkbEntry(QLatin1String("CircularStringZM"), false, Qgis::WkbType::MultiCurveZM, Qgis::WkbType::CircularStringZM, Qgis::WkbType::CircularString, Qgis::GeometryType::Line, true, true) }, { Qgis::WkbType::CompoundCurve, WkbEntry(QLatin1String("CompoundCurve"), false, Qgis::WkbType::MultiCurve, Qgis::WkbType::CompoundCurve, Qgis::WkbType::CompoundCurve, Qgis::GeometryType::Line, false, false) }, { Qgis::WkbType::CompoundCurveZ, WkbEntry(QLatin1String("CompoundCurveZ"), false, Qgis::WkbType::MultiCurveZ, Qgis::WkbType::CompoundCurveZ, Qgis::WkbType::CompoundCurve, Qgis::GeometryType::Line, true, false) }, { Qgis::WkbType::CompoundCurveM, WkbEntry(QLatin1String("CompoundCurveM"), false, Qgis::WkbType::MultiCurveM, Qgis::WkbType::CompoundCurveM, Qgis::WkbType::CompoundCurve, Qgis::GeometryType::Line, false, true) }, { Qgis::WkbType::CompoundCurveZM, WkbEntry(QLatin1String("CompoundCurveZM"), false, Qgis::WkbType::MultiCurveZM, Qgis::WkbType::CompoundCurveZM, Qgis::WkbType::CompoundCurve, Qgis::GeometryType::Line, true, true) }, { Qgis::WkbType::Polygon, WkbEntry(QLatin1String("Polygon"), false, Qgis::WkbType::MultiPolygon, Qgis::WkbType::Polygon, Qgis::WkbType::Polygon, Qgis::GeometryType::Polygon, false, false) }, { Qgis::WkbType::PolygonZ, WkbEntry(QLatin1String("PolygonZ"), false, Qgis::WkbType::MultiPolygonZ, Qgis::WkbType::PolygonZ, Qgis::WkbType::Polygon, Qgis::GeometryType::Polygon, true, false) }, { Qgis::WkbType::PolygonM, WkbEntry(QLatin1String("PolygonM"), false, Qgis::WkbType::MultiPolygonM, Qgis::WkbType::PolygonM, Qgis::WkbType::Polygon, Qgis::GeometryType::Polygon, false, true) }, { Qgis::WkbType::PolygonZM, WkbEntry(QLatin1String("PolygonZM"), false, Qgis::WkbType::MultiPolygonZM, Qgis::WkbType::PolygonZM, Qgis::WkbType::Polygon, Qgis::GeometryType::Polygon, true, true) }, { Qgis::WkbType::Polygon25D, WkbEntry(QLatin1String("Polygon25D"), false, Qgis::WkbType::MultiPolygon25D, Qgis::WkbType::Polygon25D, Qgis::WkbType::Polygon, Qgis::GeometryType::Polygon, true, false) }, { Qgis::WkbType::Triangle, WkbEntry(QLatin1String("Triangle"), false, Qgis::WkbType::Unknown, Qgis::WkbType::Triangle, Qgis::WkbType::Triangle, Qgis::GeometryType::Polygon, false, false) }, { Qgis::WkbType::TriangleZ, WkbEntry(QLatin1String("TriangleZ"), false, Qgis::WkbType::Unknown, Qgis::WkbType::TriangleZ, Qgis::WkbType::Triangle, Qgis::GeometryType::Polygon, true, false) }, { Qgis::WkbType::TriangleM, WkbEntry(QLatin1String("TriangleM"), false, Qgis::WkbType::Unknown, Qgis::WkbType::TriangleM, Qgis::WkbType::Triangle, Qgis::GeometryType::Polygon, false, true) }, { Qgis::WkbType::TriangleZM, WkbEntry(QLatin1String("TriangleZM"), false, Qgis::WkbType::Unknown, Qgis::WkbType::TriangleZM, Qgis::WkbType::Triangle, Qgis::GeometryType::Polygon, true, true) }, { Qgis::WkbType::CurvePolygon, WkbEntry(QLatin1String("CurvePolygon"), false, Qgis::WkbType::MultiSurface, Qgis::WkbType::CurvePolygon, Qgis::WkbType::CurvePolygon, Qgis::GeometryType::Polygon, false, false) }, { Qgis::WkbType::CurvePolygonZ, WkbEntry(QLatin1String("CurvePolygonZ"), false, Qgis::WkbType::MultiSurfaceZ, Qgis::WkbType::CurvePolygonZ, Qgis::WkbType::CurvePolygon, Qgis::GeometryType::Polygon, true, false) }, { Qgis::WkbType::CurvePolygonM, WkbEntry(QLatin1String("CurvePolygonM"), false, Qgis::WkbType::MultiSurfaceM, Qgis::WkbType::CurvePolygonM, Qgis::WkbType::CurvePolygon, Qgis::GeometryType::Polygon, false, true) }, { Qgis::WkbType::CurvePolygonZM, WkbEntry(QLatin1String("CurvePolygonZM"), false, Qgis::WkbType::MultiSurfaceZM, Qgis::WkbType::CurvePolygonZM, Qgis::WkbType::CurvePolygon, Qgis::GeometryType::Polygon, true, true) }, { Qgis::WkbType::MultiPoint, WkbEntry(QLatin1String("MultiPoint"), true, Qgis::WkbType::MultiPoint, Qgis::WkbType::Point, Qgis::WkbType::MultiPoint, Qgis::GeometryType::Point, false, false) }, { Qgis::WkbType::MultiPointZ, WkbEntry(QLatin1String("MultiPointZ"), true, Qgis::WkbType::MultiPointZ, Qgis::WkbType::PointZ, Qgis::WkbType::MultiPoint, Qgis::GeometryType::Point, true, false) }, { Qgis::WkbType::MultiPointM, WkbEntry(QLatin1String("MultiPointM"), true, Qgis::WkbType::MultiPointM, Qgis::WkbType::PointM, Qgis::WkbType::MultiPoint, Qgis::GeometryType::Point, false, true) }, { Qgis::WkbType::MultiPointZM, WkbEntry(QLatin1String("MultiPointZM"), true, Qgis::WkbType::MultiPointZM, Qgis::WkbType::PointZM, Qgis::WkbType::MultiPoint, Qgis::GeometryType::Point, true, true) }, { Qgis::WkbType::MultiPoint25D, WkbEntry(QLatin1String("MultiPoint25D"), true, Qgis::WkbType::MultiPoint25D, Qgis::WkbType::Point25D, Qgis::WkbType::MultiPoint, Qgis::GeometryType::Point, true, false) }, {Qgis::WkbType::MultiLineString, WkbEntry(QLatin1String("MultiLineString"), true, Qgis::WkbType::MultiLineString, Qgis::WkbType::LineString, Qgis::WkbType::MultiLineString, Qgis::GeometryType::Line, false, false) }, {Qgis::WkbType::MultiLineStringZ, WkbEntry(QLatin1String("MultiLineStringZ"), true, Qgis::WkbType::MultiLineStringZ, Qgis::WkbType::LineStringZ, Qgis::WkbType::MultiLineString, Qgis::GeometryType::Line, true, false) }, {Qgis::WkbType::MultiLineStringM, WkbEntry(QLatin1String("MultiLineStringM"), true, Qgis::WkbType::MultiLineStringM, Qgis::WkbType::LineStringM, Qgis::WkbType::MultiLineString, Qgis::GeometryType::Line, false, true) }, {Qgis::WkbType::MultiLineStringZM, WkbEntry(QLatin1String("MultiLineStringZM"), true, Qgis::WkbType::MultiLineStringZM, Qgis::WkbType::LineStringZM, Qgis::WkbType::MultiLineString, Qgis::GeometryType::Line, true, true) }, {Qgis::WkbType::MultiLineString25D, WkbEntry(QLatin1String("MultiLineString25D"), true, Qgis::WkbType::MultiLineString25D, Qgis::WkbType::LineString25D, Qgis::WkbType::MultiLineString, Qgis::GeometryType::Line, true, false) }, {Qgis::WkbType::MultiCurve, WkbEntry(QLatin1String("MultiCurve"), true, Qgis::WkbType::MultiCurve, Qgis::WkbType::CompoundCurve, Qgis::WkbType::MultiCurve, Qgis::GeometryType::Line, false, false) }, {Qgis::WkbType::MultiCurveZ, WkbEntry(QLatin1String("MultiCurveZ"), true, Qgis::WkbType::MultiCurveZ, Qgis::WkbType::CompoundCurveZ, Qgis::WkbType::MultiCurve, Qgis::GeometryType::Line, true, false) }, {Qgis::WkbType::MultiCurveM, WkbEntry(QLatin1String("MultiCurveM"), true, Qgis::WkbType::MultiCurveM, Qgis::WkbType::CompoundCurveM, Qgis::WkbType::MultiCurve, Qgis::GeometryType::Line, false, true) }, {Qgis::WkbType::MultiCurveZM, WkbEntry(QLatin1String("MultiCurveZM"), true, Qgis::WkbType::MultiCurveZM, Qgis::WkbType::CompoundCurveZM, Qgis::WkbType::MultiCurve, Qgis::GeometryType::Line, true, true) }, { Qgis::WkbType::MultiPolygon, WkbEntry(QLatin1String("MultiPolygon"), true, Qgis::WkbType::MultiPolygon, Qgis::WkbType::Polygon, Qgis::WkbType::MultiPolygon, Qgis::GeometryType::Polygon, false, false) }, { Qgis::WkbType::MultiPolygonZ, WkbEntry(QLatin1String("MultiPolygonZ"), true, Qgis::WkbType::MultiPolygonZ, Qgis::WkbType::PolygonZ, Qgis::WkbType::MultiPolygon, Qgis::GeometryType::Polygon, true, false) }, { Qgis::WkbType::MultiPolygonM, WkbEntry(QLatin1String("MultiPolygonM"), true, Qgis::WkbType::MultiPolygonM, Qgis::WkbType::PolygonM, Qgis::WkbType::MultiPolygon, Qgis::GeometryType::Polygon, false, true) }, { Qgis::WkbType::MultiPolygonZM, WkbEntry(QLatin1String("MultiPolygonZM"), true, Qgis::WkbType::MultiPolygonZM, Qgis::WkbType::PolygonZM, Qgis::WkbType::MultiPolygon, Qgis::GeometryType::Polygon, true, true) }, { Qgis::WkbType::MultiPolygon25D, WkbEntry(QLatin1String("MultiPolygon25D"), true, Qgis::WkbType::MultiPolygon25D, Qgis::WkbType::Polygon25D, Qgis::WkbType::MultiPolygon, Qgis::GeometryType::Polygon, true, false) }, { Qgis::WkbType::MultiSurface, WkbEntry(QLatin1String("MultiSurface"), true, Qgis::WkbType::MultiSurface, Qgis::WkbType::CurvePolygon, Qgis::WkbType::MultiSurface, Qgis::GeometryType::Polygon, false, false) }, { Qgis::WkbType::MultiSurfaceZ, WkbEntry(QLatin1String("MultiSurfaceZ"), true, Qgis::WkbType::MultiSurfaceZ, Qgis::WkbType::CurvePolygonZ, Qgis::WkbType::MultiSurface, Qgis::GeometryType::Polygon, true, false) }, { Qgis::WkbType::MultiSurfaceM, WkbEntry(QLatin1String("MultiSurfaceM"), true, Qgis::WkbType::MultiSurfaceM, Qgis::WkbType::CurvePolygonM, Qgis::WkbType::MultiSurface, Qgis::GeometryType::Polygon, false, true) }, { Qgis::WkbType::MultiSurfaceZM, WkbEntry(QLatin1String("MultiSurfaceZM"), true, Qgis::WkbType::MultiSurfaceZM, Qgis::WkbType::CurvePolygonZM, Qgis::WkbType::MultiSurface, Qgis::GeometryType::Polygon, true, true) }, { Qgis::WkbType::GeometryCollection, WkbEntry(QLatin1String("GeometryCollection"), true, Qgis::WkbType::GeometryCollection, Qgis::WkbType::Unknown, Qgis::WkbType::GeometryCollection, Qgis::GeometryType::Unknown, false, false) }, { Qgis::WkbType::GeometryCollectionZ, WkbEntry(QLatin1String("GeometryCollectionZ"), true, Qgis::WkbType::GeometryCollectionZ, Qgis::WkbType::Unknown, Qgis::WkbType::GeometryCollection, Qgis::GeometryType::Unknown, true, false) }, { Qgis::WkbType::GeometryCollectionM, WkbEntry(QLatin1String("GeometryCollectionM"), true, Qgis::WkbType::GeometryCollectionM, Qgis::WkbType::Unknown, Qgis::WkbType::GeometryCollection, Qgis::GeometryType::Unknown, false, true) }, { Qgis::WkbType::GeometryCollectionZM, WkbEntry(QLatin1String("GeometryCollectionZM"), true, Qgis::WkbType::GeometryCollectionZM, Qgis::WkbType::Unknown, Qgis::WkbType::GeometryCollection, Qgis::GeometryType::Unknown, true, true) }, })) Qgis
Definition: qgswkbtypes.cpp:52
QMap< Qgis::WkbType, WkbEntry > WkbEntries
Definition: qgswkbtypes.cpp:50
Qgis::WkbType mMultiType
Definition: qgswkbtypes.cpp:42
QString mName
Definition: qgswkbtypes.cpp:40
Qgis::GeometryType mGeometryType
Definition: qgswkbtypes.cpp:45
bool mIsMultiType
Definition: qgswkbtypes.cpp:41
Qgis::WkbType mFlatType
Definition: qgswkbtypes.cpp:44
WkbEntry(const QString &name, bool isMultiType, Qgis::WkbType multiType, Qgis::WkbType singleType, Qgis::WkbType flatType, Qgis::GeometryType geometryType, bool hasZ, bool hasM)
Definition: qgswkbtypes.cpp:29
Qgis::WkbType mSingleType
Definition: qgswkbtypes.cpp:43
bool mHasZ
Definition: qgswkbtypes.cpp:46
bool mHasM
Definition: qgswkbtypes.cpp:47