QGIS API Documentation  3.21.0-Master (402cf1129e)
qgsabstractgeometry.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsabstractgeometry.h
3  -------------------------------------------------------------------
4 Date : 04 Sept 2014
5 Copyright : (C) 2014 by Marco Hugentobler
6 email : marco.hugentobler at sourcepole dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSABSTRACTGEOMETRYV2
17 #define QGSABSTRACTGEOMETRYV2
18 
19 #include <array>
20 #include <functional>
21 #include <type_traits>
22 #include <QString>
23 
24 #include "qgis_core.h"
25 #include "qgscoordinatetransform.h"
26 #include "qgswkbtypes.h"
27 #include "qgswkbptr.h"
28 
29 #ifndef SIP_RUN
30 #include "json_fwd.hpp"
31 using namespace nlohmann;
32 #endif
33 
34 class QgsMapToPixel;
35 class QgsCurve;
36 class QgsMultiCurve;
37 class QgsMultiPoint;
38 
39 struct QgsVertexId;
40 class QgsVertexIterator;
41 class QPainter;
42 class QDomDocument;
43 class QDomElement;
46 class QgsConstWkbPtr;
47 class QPainterPath;
49 class QgsFeedback;
50 
51 typedef QVector< QgsPoint > QgsPointSequence;
52 #ifndef SIP_RUN
53 typedef QVector< QgsPointSequence > QgsRingSequence;
54 typedef QVector< QgsRingSequence > QgsCoordinateSequence;
55 #else
56 typedef QVector< QVector< QgsPoint > > QgsRingSequence;
57 typedef QVector< QVector< QVector< QgsPoint > > > QgsCoordinateSequence;
58 #endif
59 
60 
76 class CORE_EXPORT QgsAbstractGeometry
77 {
78 
79 #ifdef SIP_RUN
81  if ( qgsgeometry_cast<QgsPoint *>( sipCpp ) != nullptr )
82  sipType = sipType_QgsPoint;
83  else if ( qgsgeometry_cast<QgsLineString *>( sipCpp ) != nullptr )
84  sipType = sipType_QgsLineString;
85  else if ( qgsgeometry_cast<QgsCircularString *>( sipCpp ) != nullptr )
86  sipType = sipType_QgsCircularString;
87  else if ( qgsgeometry_cast<QgsCompoundCurve *>( sipCpp ) != nullptr )
88  sipType = sipType_QgsCompoundCurve;
89  else if ( qgsgeometry_cast<QgsTriangle *>( sipCpp ) != nullptr )
90  sipType = sipType_QgsTriangle;
91  else if ( qgsgeometry_cast<QgsPolygon *>( sipCpp ) != nullptr )
92  sipType = sipType_QgsPolygon;
93  else if ( qgsgeometry_cast<QgsCurvePolygon *>( sipCpp ) != nullptr )
94  sipType = sipType_QgsCurvePolygon;
95  else if ( qgsgeometry_cast<QgsMultiPoint *>( sipCpp ) != nullptr )
96  sipType = sipType_QgsMultiPoint;
97  else if ( qgsgeometry_cast<QgsMultiLineString *>( sipCpp ) != nullptr )
98  sipType = sipType_QgsMultiLineString;
99  else if ( qgsgeometry_cast<QgsMultiPolygon *>( sipCpp ) != nullptr )
100  sipType = sipType_QgsMultiPolygon;
101  else if ( qgsgeometry_cast<QgsMultiSurface *>( sipCpp ) != nullptr )
102  sipType = sipType_QgsMultiSurface;
103  else if ( qgsgeometry_cast<QgsMultiCurve *>( sipCpp ) != nullptr )
104  sipType = sipType_QgsMultiCurve;
105  else if ( qgsgeometry_cast<QgsGeometryCollection *>( sipCpp ) != nullptr )
106  sipType = sipType_QgsGeometryCollection;
107  else
108  sipType = 0;
109  SIP_END
110 #endif
111 
112  Q_GADGET
113 
114  public:
115 
118  {
119 
124  MaximumAngle = 0,
125 
130  MaximumDifference
131  };
132  Q_ENUM( SegmentationToleranceType )
133 
134 
136  {
137 
141  XY = 0,
142 
146  YX
147  };
149 
150 
153  QgsAbstractGeometry() = default;
154  virtual ~QgsAbstractGeometry() = default;
156  QgsAbstractGeometry &operator=( const QgsAbstractGeometry &geom );
157 
158  virtual bool operator==( const QgsAbstractGeometry &other ) const = 0;
159  virtual bool operator!=( const QgsAbstractGeometry &other ) const = 0;
160 
164  virtual QgsAbstractGeometry *clone() const = 0 SIP_FACTORY;
165 
171  virtual int compareTo( const QgsAbstractGeometry *other ) const;
172 
176  virtual void clear() = 0;
177 
181  virtual QgsRectangle boundingBox() const = 0;
182 
183  //mm-sql interface
184 
189  virtual int dimension() const = 0;
190 
196  virtual QString geometryType() const = 0;
197 
203  inline QgsWkbTypes::Type wkbType() const SIP_HOLDGIL { return mWkbType; }
204 
210  QString wktTypeStr() const;
211 
216  bool is3D() const SIP_HOLDGIL
217  {
218  return QgsWkbTypes::hasZ( mWkbType );
219  }
220 
225  bool isMeasure() const SIP_HOLDGIL
226  {
227  return QgsWkbTypes::hasM( mWkbType );
228  }
229 
237 
247  virtual void normalize() = 0;
248 
249  //import
250 
256  virtual bool fromWkb( QgsConstWkbPtr &wkb ) = 0;
257 
262  virtual bool fromWkt( const QString &wkt ) = 0;
263 
264  //export
265 
270  enum WkbFlag
271  {
272  FlagExportTrianglesAsPolygons = 1 << 0,
273  };
274  Q_DECLARE_FLAGS( WkbFlags, WkbFlag )
275 
276 
283  virtual int wkbSize( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const = 0;
284 
296  virtual QByteArray asWkb( WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const = 0;
297 
306  virtual QString asWkt( int precision = 17 ) const = 0;
307 
319  virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml", AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const = 0;
320 
332  virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml", AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const = 0;
333 
343  QString asJson( int precision = 17 );
344 
355  virtual json asJsonObject( int precision = 17 ) SIP_SKIP const;
356 
361  virtual QString asKml( int precision = 17 ) const = 0;
362 
363 
364  //render pipeline
365 
376  virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) SIP_THROW( QgsCsException ) = 0;
377 
384  virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0,
385  double mTranslate = 0.0, double mScale = 1.0 ) = 0;
386 
391  virtual void draw( QPainter &p ) const = 0;
392 
401  virtual QPainterPath asQPainterPath() const = 0;
402 
413  virtual int vertexNumberFromVertexId( QgsVertexId id ) const = 0;
414 
422  virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex SIP_OUT ) const = 0;
423 
428  virtual void adjacentVertices( QgsVertexId vertex, QgsVertexId &previousVertex SIP_OUT, QgsVertexId &nextVertex SIP_OUT ) const = 0;
429 
434  virtual QgsCoordinateSequence coordinateSequence() const = 0;
435 
439  virtual int nCoordinates() const;
440 
444  virtual QgsPoint vertexAt( QgsVertexId id ) const = 0;
445 
458  virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT,
459  QgsVertexId &vertexAfter SIP_OUT,
460  int *leftOf SIP_OUT = nullptr, double epsilon = 4 * std::numeric_limits<double>::epsilon() ) const = 0;
461 
462  //low-level editing
463 
472  virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) = 0;
473 
482  virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) = 0;
483 
491  virtual bool deleteVertex( QgsVertexId position ) = 0;
492 
505  virtual double length() const;
506 
519  virtual double perimeter() const;
520 
533  virtual double area() const;
534 
543  virtual double segmentLength( QgsVertexId startVertex ) const = 0;
544 
546  virtual QgsPoint centroid() const;
547 
551  virtual bool isEmpty() const;
552 
556  virtual bool hasCurvedSegments() const;
557 
566  virtual bool boundingBoxIntersects( const QgsRectangle &rectangle ) const SIP_HOLDGIL;
567 
574  virtual QgsAbstractGeometry *segmentize( double tolerance = M_PI / 180., SegmentationToleranceType toleranceType = MaximumAngle ) const SIP_FACTORY;
575 
582  virtual QgsAbstractGeometry *toCurveType() const = 0 SIP_FACTORY;
583 
606  virtual QgsAbstractGeometry *snappedToGrid( double hSpacing, double vSpacing, double dSpacing = 0, double mSpacing = 0 ) const = 0 SIP_FACTORY;
607 
628  virtual bool removeDuplicateNodes( double epsilon = 4 * std::numeric_limits<double>::epsilon(), bool useZValues = false ) = 0;
629 
637  virtual double vertexAngle( QgsVertexId vertex ) const = 0;
638 
642  virtual int vertexCount( int part = 0, int ring = 0 ) const = 0;
643 
647  virtual int ringCount( int part = 0 ) const = 0;
648 
654  virtual int partCount() const = 0;
655 
664  virtual bool addZValue( double zValue = 0 ) = 0;
665 
674  virtual bool addMValue( double mValue = 0 ) = 0;
675 
683  virtual bool dropZValue() = 0;
684 
692  virtual bool dropMValue() = 0;
693 
700  virtual void swapXy() = 0;
701 
707  virtual bool convertTo( QgsWkbTypes::Type type );
708 
727  virtual const QgsAbstractGeometry *simplifiedTypeRef() const SIP_HOLDGIL;
728 
740  virtual bool isValid( QString &error SIP_OUT, int flags = 0 ) const = 0;
741 
755  virtual bool transform( QgsAbstractGeometryTransformer *transformer, QgsFeedback *feedback = nullptr ) = 0;
756 
757 #ifndef SIP_RUN
758 
768  virtual void filterVertices( const std::function< bool( const QgsPoint & ) > &filter );
769 
784  virtual void transformVertices( const std::function< QgsPoint( const QgsPoint & ) > &transform );
785 
791  class CORE_EXPORT part_iterator
792  {
793  private:
794 
795  int mIndex = 0;
796  QgsAbstractGeometry *mGeometry = nullptr;
797 
798  public:
800  part_iterator() = default;
801 
803  part_iterator( QgsAbstractGeometry *g, int index );
804 
809  part_iterator &operator++();
810 
812  part_iterator operator++( int );
813 
816 
818  int partNumber() const;
819 
820  bool operator==( part_iterator other ) const;
821  bool operator!=( part_iterator other ) const { return !( *this == other ); }
822  };
823 
833  {
834  return part_iterator( this, 0 );
835  }
836 
845  part_iterator parts_end();
846 
854  QgsGeometryConstPartIterator parts() const;
855 
861  class CORE_EXPORT const_part_iterator
862  {
863  private:
864 
865  int mIndex = 0;
866  const QgsAbstractGeometry *mGeometry = nullptr;
867 
868  public:
870  const_part_iterator() = default;
871 
873  const_part_iterator( const QgsAbstractGeometry *g, int index );
874 
879  const_part_iterator &operator++();
880 
882  const_part_iterator operator++( int );
883 
885  const QgsAbstractGeometry *operator*() const;
886 
888  int partNumber() const;
889 
890  bool operator==( const_part_iterator other ) const;
891  bool operator!=( const_part_iterator other ) const { return !( *this == other ); }
892  };
893 
902  {
903  return const_part_iterator( this, 0 );
904  }
905 
913  const_part_iterator const_parts_end() const;
914 
915 
921  class CORE_EXPORT vertex_iterator
922  {
923  private:
924 
930  struct Level
931  {
932  const QgsAbstractGeometry *g = nullptr;
933  int index = 0;
934 
935  bool operator==( const Level &other ) const;
936  };
937 
938  std::array<Level, 3> levels;
939  int depth = -1;
940 
941  void digDown();
942 
943  public:
945  vertex_iterator() = default;
946 
948  vertex_iterator( const QgsAbstractGeometry *g, int index );
949 
954  vertex_iterator &operator++();
955 
957  vertex_iterator operator++( int );
958 
960  QgsPoint operator*() const;
961 
963  QgsVertexId vertexId() const;
964 
965  bool operator==( const vertex_iterator &other ) const;
966  bool operator!=( const vertex_iterator &other ) const { return !( *this == other ); }
967  };
968 
978  {
979  return vertex_iterator( this, 0 );
980  }
981 
991  {
992  return vertex_iterator( this, childCount() );
993  }
994 #endif
995 
1029  QgsGeometryPartIterator parts();
1030 
1031 
1055  QgsVertexIterator vertices() const;
1056 
1064 
1065  protected:
1066 
1073  int sortIndex() const;
1074 
1085  virtual int compareToSameClass( const QgsAbstractGeometry *other ) const = 0;
1086 
1092  virtual bool hasChildGeometries() const;
1093 
1099  virtual int childCount() const { return 0; }
1100 
1106  virtual QgsAbstractGeometry *childGeometry( int index ) const { Q_UNUSED( index ) return nullptr; }
1107 
1113  virtual QgsPoint childPoint( int index ) const;
1114 
1115  protected:
1117 
1121  void setZMTypeFromSubGeometry( const QgsAbstractGeometry *subggeom, QgsWkbTypes::Type baseGeomType );
1122 
1127  virtual QgsRectangle calculateBoundingBox() const;
1128 
1132  virtual void clearCache() const;
1133 
1134  friend class TestQgsGeometry;
1135 };
1136 
1137 
1144 struct CORE_EXPORT QgsVertexId
1145 {
1146 
1151  {
1152  SegmentVertex = 1,
1154  };
1155 
1159  explicit QgsVertexId( int _part = -1, int _ring = -1, int _vertex = -1, VertexType _type = SegmentVertex ) SIP_HOLDGIL
1160 : part( _part )
1161  , ring( _ring )
1162  , vertex( _vertex )
1163  , type( _type )
1164  {}
1165 
1169  bool isValid() const SIP_HOLDGIL { return part >= 0 && ring >= 0 && vertex >= 0; }
1170 
1171  bool operator==( QgsVertexId other ) const SIP_HOLDGIL
1172  {
1173  return part == other.part && ring == other.ring && vertex == other.vertex;
1174  }
1175  bool operator!=( QgsVertexId other ) const SIP_HOLDGIL
1176  {
1177  return part != other.part || ring != other.ring || vertex != other.vertex;
1178  }
1179 
1184  {
1185  return part >= 0 && o.part == part;
1186  }
1187 
1193  {
1194  return partEqual( o ) && ( ring >= 0 && o.ring == ring );
1195  }
1196 
1202  {
1203  return ringEqual( o ) && ( vertex >= 0 && o.ring == ring );
1204  }
1205 
1209  bool isValid( const QgsAbstractGeometry *geom ) const SIP_HOLDGIL
1210  {
1211  return ( part >= 0 && part < geom->partCount() ) &&
1212  ( ring < geom->ringCount( part ) ) &&
1213  ( vertex < 0 || vertex < geom->vertexCount( part, ring ) );
1214  }
1215 
1217  int part = -1;
1218 
1220  int ring = -1;
1221 
1223  int vertex = -1;
1224 
1226  VertexType type = SegmentVertex;
1227 
1228 #ifdef SIP_RUN
1229  SIP_PYOBJECT __repr__();
1230  % MethodCode
1231  QString str = QStringLiteral( "<QgsVertexId: %1,%2,%3%4>" ).arg( sipCpp->part ).arg( sipCpp->ring ).arg( sipCpp->vertex ).arg( sipCpp->type == QgsVertexId::CurveVertex ? QStringLiteral( " CurveVertex" ) : QString() );
1232  sipRes = PyUnicode_FromString( str.toUtf8().data() );
1233  % End
1234 #endif
1235 
1236 };
1237 
1238 #ifndef SIP_RUN
1239 
1240 template <class T>
1241 inline T qgsgeometry_cast( const QgsAbstractGeometry *geom )
1242 {
1243  return const_cast<T>( std::remove_pointer<T>::type::cast( geom ) );
1244 }
1245 
1246 #endif
1247 
1248 // clazy:excludeall=qstring-allocations
1249 
1255 class CORE_EXPORT QgsVertexIterator
1256 {
1257  public:
1259  QgsVertexIterator() = default;
1260 
1263  : g( geometry )
1264  , i( g->vertices_begin() )
1265  , n( g->vertices_end() )
1266  {
1267  }
1268 
1270  bool hasNext() const
1271  {
1272  return g && g->vertices_end() != i;
1273  }
1274 
1276  QgsPoint next();
1277 
1278 #ifdef SIP_RUN
1279  QgsVertexIterator *__iter__();
1280  % MethodCode
1281  sipRes = sipCpp;
1282  % End
1283 
1284  SIP_PYOBJECT __next__() SIP_TYPEHINT( QgsPoint );
1285  % MethodCode
1286  if ( sipCpp->hasNext() )
1287  sipRes = sipConvertFromType( new QgsPoint( sipCpp->next() ), sipType_QgsPoint, Py_None );
1288  else
1289  PyErr_SetString( PyExc_StopIteration, "" );
1290  % End
1291 #endif
1292 
1293  private:
1294  const QgsAbstractGeometry *g = nullptr;
1296 
1297 };
1298 
1304 class CORE_EXPORT QgsGeometryPartIterator
1305 {
1306  public:
1309 
1312  : g( geometry )
1313  , i( g->parts_begin() )
1314  , n( g->parts_end() )
1315  {
1316  }
1317 
1319  bool hasNext() const SIP_HOLDGIL
1320  {
1321  return g && g->parts_end() != i;
1322  }
1323 
1325  QgsAbstractGeometry *next();
1326 
1327 #ifdef SIP_RUN
1328  QgsGeometryPartIterator *__iter__();
1329  % MethodCode
1330  sipRes = sipCpp;
1331  % End
1332 
1333  SIP_PYOBJECT __next__() SIP_TYPEHINT( QgsAbstractGeometry );
1334  % MethodCode
1335  if ( sipCpp->hasNext() )
1336  sipRes = sipConvertFromType( sipCpp->next(), sipType_QgsAbstractGeometry, NULL );
1337  else
1338  PyErr_SetString( PyExc_StopIteration, "" );
1339  % End
1340 #endif
1341 
1342  private:
1343  QgsAbstractGeometry *g = nullptr;
1345 
1346 };
1347 
1348 
1355 {
1356  public:
1359 
1362  : g( geometry )
1363  , i( g->const_parts_begin() )
1364  , n( g->const_parts_end() )
1365  {
1366  }
1367 
1369  bool hasNext() const SIP_HOLDGIL
1370  {
1371  return g && g->const_parts_end() != i;
1372  }
1373 
1375  const QgsAbstractGeometry *next();
1376 
1377 #ifdef SIP_RUN
1378  QgsGeometryConstPartIterator *__iter__();
1379  % MethodCode
1380  sipRes = sipCpp;
1381  % End
1382 
1383  SIP_PYOBJECT __next__() SIP_TYPEHINT( QgsAbstractGeometry );
1384  % MethodCode
1385  if ( sipCpp->hasNext() )
1386  sipRes = sipConvertFromType( const_cast< QgsAbstractGeometry * >( sipCpp->next() ), sipType_QgsAbstractGeometry, NULL );
1387  else
1388  PyErr_SetString( PyExc_StopIteration, "" );
1389  % End
1390 #endif
1391 
1392  private:
1393  const QgsAbstractGeometry *g = nullptr;
1395 
1396 };
1397 
1398 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsAbstractGeometry::WkbFlags )
1399 
1400 #endif //QGSABSTRACTGEOMETRYV2
An abstract base class for classes which transform geometries by transforming input points to output ...
The part_iterator class provides STL-style iterator for const references to geometry parts.
bool operator!=(const_part_iterator other) const
const_part_iterator()=default
Create invalid iterator.
The part_iterator class provides STL-style iterator for geometry parts.
part_iterator()=default
Create invalid iterator.
bool operator!=(part_iterator other) const
The vertex_iterator class provides STL-style iterator for vertices.
vertex_iterator()=default
Create invalid iterator.
bool operator!=(const vertex_iterator &other) const
Abstract base class for all geometries.
virtual bool fromWkb(QgsConstWkbPtr &wkb)=0
Sets the geometry from a WKB string.
virtual QgsAbstractGeometry * boundary() const =0
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the...
SegmentationToleranceType
Segmentation tolerance as maximum angle or maximum difference between approximation and circle.
vertex_iterator vertices_end() const
Returns STL-style iterator pointing to the imaginary vertex after the last vertex of the geometry.
bool is3D() const SIP_HOLDGIL
Returns true if the geometry is 3D and contains a z-value.
virtual int childCount() const
Returns number of child geometries (for geometries with child geometries) or child points (for geomet...
AxisOrder
Axis order for GML generation.
virtual QgsAbstractGeometry * createEmptyWithSameType() const =0
Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
virtual bool fromWkt(const QString &wkt)=0
Sets the geometry from a WKT string.
virtual void normalize()=0
Reorganizes the geometry into a normalized form (or "canonical" form).
vertex_iterator vertices_begin() const
Returns STL-style iterator pointing to the first vertex of the geometry.
virtual QgsAbstractGeometry * childGeometry(int index) const
Returns pointer to child geometry (for geometries with child geometries - i.e.
WkbFlag
WKB export flags.
const_part_iterator const_parts_begin() const
Returns STL-style iterator pointing to the const first part of the geometry.
virtual int compareToSameClass(const QgsAbstractGeometry *other) const =0
Compares to an other geometry of the same class, and returns a integer for sorting of the two geometr...
part_iterator parts_begin()
Returns STL-style iterator pointing to the first part of the geometry.
bool isMeasure() const SIP_HOLDGIL
Returns true if the geometry contains m values.
A const WKB pointer.
Definition: qgswkbptr.h:138
Class for doing transforms between two map coordinate systems.
Custom exception class for Coordinate Reference System related exceptions.
Definition: qgsexception.h:66
Abstract base class for curved geometry type.
Definition: qgscurve.h:36
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:45
Java-style iterator for const traversal of parts of a geometry.
QgsGeometryConstPartIterator(const QgsAbstractGeometry *geometry)
Constructs iterator for the given geometry.
QgsGeometryConstPartIterator()=default
Constructor for QgsGeometryConstPartIterator.
bool hasNext() const SIP_HOLDGIL
Find out whether there are more parts.
Java-style iterator for traversal of parts of a geometry.
QgsGeometryPartIterator()=default
Constructor for QgsGeometryPartIterator.
bool hasNext() const SIP_HOLDGIL
Find out whether there are more parts.
QgsGeometryPartIterator(QgsAbstractGeometry *geometry)
Constructs iterator for the given geometry.
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:39
Multi curve geometry collection.
Definition: qgsmulticurve.h:30
Multi point geometry collection.
Definition: qgsmultipoint.h:30
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:49
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Java-style iterator for traversal of vertices of a geometry.
bool hasNext() const
Find out whether there are more vertices.
QgsVertexIterator()=default
Constructor for QgsVertexIterator.
QgsVertexIterator(const QgsAbstractGeometry *geometry)
Constructs iterator for the given geometry.
Handles storage of information regarding WKB types and their properties.
Definition: qgswkbtypes.h:42
static bool hasM(Type type) SIP_HOLDGIL
Tests whether a WKB type contains m values.
Definition: qgswkbtypes.h:1100
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:70
static bool hasZ(Type type) SIP_HOLDGIL
Tests whether a WKB type contains the z-dimension.
Definition: qgswkbtypes.h:1050
double ANALYSIS_EXPORT leftOf(const QgsPoint &thepoint, const QgsPoint *p1, const QgsPoint *p2)
Returns whether 'thepoint' is left or right of the line from 'p1' to 'p2'. Negative values mean left ...
Definition: MathUtils.cpp:292
CORE_EXPORT QgsMeshVertex centroid(const QgsMeshFace &face, const QVector< QgsMeshVertex > &vertices)
Returns the centroid of the face.
#define str(x)
Definition: qgis.cpp:37
#define SIP_THROW(name)
Definition: qgis_sip.h:189
#define SIP_TYPEHINT(type)
Definition: qgis_sip.h:218
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:177
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_OUT
Definition: qgis_sip.h:58
#define SIP_HOLDGIL
Definition: qgis_sip.h:157
#define SIP_FACTORY
Definition: qgis_sip.h:76
#define SIP_END
Definition: qgis_sip.h:194
T qgsgeometry_cast(const QgsAbstractGeometry *geom)
QVector< QgsRingSequence > QgsCoordinateSequence
QVector< QgsPointSequence > QgsRingSequence
QVector< QgsPoint > QgsPointSequence
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
QgsMargins operator*(const QgsMargins &margins, double factor)
Returns a QgsMargins object that is formed by multiplying each component of the given margins by fact...
Definition: qgsmargins.h:242
double closestSegment(const QgsPolylineXY &pl, const QgsPointXY &pt, int &vertexAfter, double epsilon)
Definition: qgstracer.cpp:68
int precision
Utility class for identifying a unique vertex within a geometry.
bool operator!=(QgsVertexId other) const SIP_HOLDGIL
bool ringEqual(QgsVertexId o) const SIP_HOLDGIL
Returns true if this vertex ID belongs to the same ring as another vertex ID (i.e.
bool partEqual(QgsVertexId o) const SIP_HOLDGIL
Returns true if this vertex ID belongs to the same part as another vertex ID.
bool isValid() const SIP_HOLDGIL
Returns true if the vertex id is valid.
bool vertexEqual(QgsVertexId o) const SIP_HOLDGIL
Returns true if this vertex ID corresponds to the same vertex as another vertex ID (i....
bool isValid(const QgsAbstractGeometry *geom) const SIP_HOLDGIL
Returns true if this vertex ID is valid for the specified geom.
QgsVertexId(int _part=-1, int _ring=-1, int _vertex=-1, VertexType _type=SegmentVertex) SIP_HOLDGIL
Constructor for QgsVertexId.
bool operator==(QgsVertexId other) const SIP_HOLDGIL
VertexType
Type of vertex.
@ CurveVertex
An intermediate point on a segment defining the curvature of the segment.