QGIS API Documentation  2.12.0-Lyon
qgswkbtypes.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgswkbtypes.h
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 #ifndef QGSWKBTYPES_H
19 #define QGSWKBTYPES_H
20 
21 #include <QMap>
22 #include <QString>
23 
25 class CORE_EXPORT QgsWKBTypes
26 {
27  public:
28 
29  enum Type
30  {
31  Unknown = 0,
32  Point = 1,
33  LineString = 2,
34  Polygon = 3,
35  MultiPoint = 4,
36  MultiLineString = 5,
37  MultiPolygon = 6,
38  GeometryCollection = 7,
39  CircularString = 8,
40  CompoundCurve = 9,
41  CurvePolygon = 10, //13, //should be 10. Seems to be correct in newer postgis versions
42  MultiCurve = 11,
43  MultiSurface = 12,
44  NoGeometry = 100, //attributes only
45  PointZ = 1001,
46  LineStringZ = 1002,
47  PolygonZ = 1003,
48  MultiPointZ = 1004,
49  MultiLineStringZ = 1005,
50  MultiPolygonZ = 1006,
51  GeometryCollectionZ = 1007,
52  CircularStringZ = 1008,
53  CompoundCurveZ = 1009,
54  CurvePolygonZ = 1010,
55  MultiCurveZ = 1011,
56  MultiSurfaceZ = 1012,
57  PointM = 2001,
58  LineStringM = 2002,
59  PolygonM = 2003,
60  MultiPointM = 2004,
61  MultiLineStringM = 2005,
62  MultiPolygonM = 2006,
63  GeometryCollectionM = 2007,
64  CircularStringM = 2008,
65  CompoundCurveM = 2009,
66  CurvePolygonM = 2010,
67  MultiCurveM = 2011,
68  MultiSurfaceM = 2012,
69  PointZM = 3001,
70  LineStringZM = 3002,
71  PolygonZM = 3003,
72  MultiPointZM = 3004,
73  MultiLineStringZM = 3005,
74  MultiPolygonZM = 3006,
75  GeometryCollectionZM = 3007,
76  CircularStringZM = 3008,
77  CompoundCurveZM = 3009,
78  CurvePolygonZM = 3010,
79  MultiCurveZM = 3011,
80  MultiSurfaceZM = 3012,
81  Point25D = 0x80000001,
86  MultiPolygon25D
87  };
88 
90  {
95  NullGeometry
96  };
97 
98  struct wkbEntry
99  {
100  wkbEntry( const QString& name, bool isMultiType, Type multiType, Type singleType, Type flatType, GeometryType geometryType,
101  bool hasZ, bool hasM ):
102  mName( name ), mIsMultiType( isMultiType ), mMultiType( multiType ), mSingleType( singleType ), mFlatType( flatType ), mGeometryType( geometryType ),
103  mHasZ( hasZ ), mHasM( hasM ) {}
110  bool mHasZ;
111  bool mHasM;
112  };
113 
114  static Type singleType( Type type );
115  static Type multiType( Type type );
116  static Type flatType( Type type );
117  static Type parseType( const QString& wktStr );
118  static bool isSingleType( Type type );
119  static bool isMultiType( Type type );
120  static int wkbDimensions( Type type );
121  static GeometryType geometryType( Type type );
122  static QString displayString( Type type );
123 
129  static bool hasZ( Type type );
130 
136  static bool hasM( Type type );
137 
144  static Type addZ( Type type );
145 
152  static Type addM( Type type );
153 
154  private:
155  static QMap<Type, wkbEntry> registerTypes();
156  static QMap<Type, wkbEntry>* entries();
157 };
158 
159 #endif // QGSWKBTYPES_H
Class to store information about wkb types.
Definition: qgswkbtypes.h:25
wkbEntry(const QString &name, bool isMultiType, Type multiType, Type singleType, Type flatType, GeometryType geometryType, bool hasZ, bool hasM)
Definition: qgswkbtypes.h:100
GeometryType mGeometryType
Definition: qgswkbtypes.h:109