QGIS API Documentation  2.99.0-Master (19b062c)
qgsgeometry.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgeometry.h - Geometry (stored as Open Geospatial Consortium WKB)
3  -------------------------------------------------------------------
4 Date : 02 May 2005
5 Copyright : (C) 2005 by Brendan Morley
6 email : morb at ozemail dot com dot au
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 QGSGEOMETRY_H
17 #define QGSGEOMETRY_H
18 
19 #include <QDomDocument>
20 #include <QSet>
21 #include <QString>
22 #include <QVector>
23 
24 #include <geos_c.h>
25 #include <climits>
26 #include <limits>
27 #include <memory>
28 
29 #include "qgis_core.h"
30 #include "qgis.h"
31 
32 
33 #if defined(GEOS_VERSION_MAJOR) && (GEOS_VERSION_MAJOR<3)
34 #define GEOSGeometry struct GEOSGeom_t
35 #define GEOSCoordSequence struct GEOSCoordSeq_t
36 #endif
37 
38 #include "qgsabstractgeometry.h"
39 #include "qgsfeature.h"
40 #include "qgspointxy.h"
41 #include "qgspoint.h"
42 
43 
44 class QgsGeometryEngine;
45 class QgsVectorLayer;
46 class QgsMapToPixel;
47 class QPainter;
48 class QgsPolygon;
50 
60 typedef QVector<QgsPointXY> QgsPolylineXY;
61 
69 typedef QVector<QgsPoint> QgsPolyline;
70 
72 #ifndef SIP_RUN
73 typedef QVector<QgsPolylineXY> QgsPolygonXY;
74 #else
75 typedef QVector<QVector<QgsPointXY>> QgsPolygonXY;
76 #endif
77 
79 typedef QVector<QgsPointXY> QgsMultiPointXY;
80 
82 #ifndef SIP_RUN
83 typedef QVector<QgsPolylineXY> QgsMultiPolylineXY;
84 #else
85 typedef QVector<QVector<QgsPointXY>> QgsMultiPolylineXY;
86 #endif
87 
89 #ifndef SIP_RUN
90 typedef QVector<QgsPolygonXY> QgsMultiPolygonXY;
91 #else
92 typedef QVector<QVector<QVector<QgsPointXY>>> QgsMultiPolygonXY;
93 #endif
94 
95 class QgsRectangle;
96 
97 class QgsConstWkbPtr;
98 
99 struct QgsGeometryPrivate;
100 
111 class CORE_EXPORT QgsGeometry
112 {
113  public:
114 
120  {
121  Success = 0,
122  NothingHappened = 1000,
129  /* Add part issues */
132  /* Add ring issues*/
137  /* Split features */
139  };
140 
142  QgsGeometry();
143 
145  QgsGeometry( const QgsGeometry & );
146 
151  QgsGeometry &operator=( QgsGeometry const &rhs ) SIP_SKIP;
152 
158  explicit QgsGeometry( QgsAbstractGeometry *geom SIP_TRANSFER );
159 
165  explicit QgsGeometry( std::unique_ptr< QgsAbstractGeometry > geom ) SIP_SKIP;
166 
167  ~QgsGeometry();
168 
180  const QgsAbstractGeometry *constGet() const;
181 
194  QgsAbstractGeometry *get();
195 
205  void set( QgsAbstractGeometry *geometry SIP_TRANSFER );
206 
214  bool isNull() const;
215 
217  static QgsGeometry fromWkt( const QString &wkt );
219  static QgsGeometry fromPointXY( const QgsPointXY &point );
221  static QgsGeometry fromMultiPointXY( const QgsMultiPointXY &multipoint );
222 
234  static QgsGeometry fromPolylineXY( const QgsPolylineXY &polyline );
235 
245  static QgsGeometry fromPolyline( const QgsPolyline &polyline );
246 
248  static QgsGeometry fromMultiPolylineXY( const QgsMultiPolylineXY &multiline );
250  static QgsGeometry fromPolygonXY( const QgsPolygonXY &polygon );
252  static QgsGeometry fromMultiPolygonXY( const QgsMultiPolygonXY &multipoly );
254  static QgsGeometry fromRect( const QgsRectangle &rect );
256  static QgsGeometry collectGeometry( const QVector<QgsGeometry> &geometries );
257 
263  void fromGeos( GEOSGeometry *geos ) SIP_SKIP;
264 
270  void fromWkb( unsigned char *wkb, int length ) SIP_SKIP;
271 
276  void fromWkb( const QByteArray &wkb );
277 
284  GEOSGeometry *exportToGeos( double precision = 0 ) const SIP_SKIP;
285 
290  QgsWkbTypes::Type wkbType() const;
291 
296  QgsWkbTypes::GeometryType type() const;
297 
304  bool isEmpty() const;
305 
307  bool isMultipart() const;
308 
313  bool isGeosEqual( const QgsGeometry & ) const;
314 
319  bool isGeosValid() const;
320 
329  bool isSimple() const;
330 
335  double area() const;
336 
341  double length() const;
342 
349  double distance( const QgsGeometry &geom ) const;
350 
351 #ifndef SIP_RUN
352 
357  QgsAbstractGeometry::vertex_iterator vertices_begin() const;
358 
363  QgsAbstractGeometry::vertex_iterator vertices_end() const;
364 #endif
365 
370  QgsVertexIterator vertices() const;
371 
389  double hausdorffDistance( const QgsGeometry &geom ) const;
390 
409  double hausdorffDistanceDensify( const QgsGeometry &geom, double densifyFraction ) const;
410 
423  //TODO QGIS 3.0 - rename beforeVertex to previousVertex, afterVertex to nextVertex
424  QgsPointXY closestVertex( const QgsPointXY &point, int &atVertex SIP_OUT, int &beforeVertex SIP_OUT, int &afterVertex SIP_OUT, double &sqrDist SIP_OUT ) const;
425 
432  double distanceToVertex( int vertex ) const;
433 
441  double angleAtVertex( int vertex ) const;
442 
455  void adjacentVertices( int atVertex, int &beforeVertex SIP_OUT, int &afterVertex SIP_OUT ) const;
456 
469  bool insertVertex( double x, double y, int beforeVertex );
470 
483  bool insertVertex( const QgsPoint &point, int beforeVertex );
484 
492  bool moveVertex( double x, double y, int atVertex );
493 
501  bool moveVertex( const QgsPoint &p, int atVertex );
502 
514  bool deleteVertex( int atVertex );
515 
521  QgsPoint vertexAt( int atVertex ) const;
522 
528  double sqrDistToVertexAt( QgsPointXY &point SIP_IN, int atVertex ) const;
529 
535  QgsGeometry nearestPoint( const QgsGeometry &other ) const;
536 
542  QgsGeometry shortestLine( const QgsGeometry &other ) const;
543 
550  double closestVertexWithContext( const QgsPointXY &point, int &atVertex SIP_OUT ) const;
551 
563  double closestSegmentWithContext( const QgsPointXY &point, QgsPointXY &minDistPoint SIP_OUT, int &afterVertex SIP_OUT, int *leftOf SIP_OUT = nullptr, double epsilon = DEFAULT_SEGMENT_EPSILON ) const;
564 
570  OperationResult addRing( const QVector<QgsPointXY> &ring );
571 
577  OperationResult addRing( QgsCurve *ring SIP_TRANSFER );
578 
585  OperationResult addPart( const QVector<QgsPointXY> &points, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry ) SIP_PYNAME( addPointsXY );
586 
594 
602 
609  OperationResult addPart( GEOSGeometry *newPart ) SIP_SKIP;
610 
616  OperationResult addPart( const QgsGeometry &newPart ) SIP_PYNAME( addPartGeometry );
617 
624  QgsGeometry removeInteriorRings( double minimumAllowedArea = -1 ) const;
625 
630  OperationResult translate( double dx, double dy, double dz = 0.0, double dm = 0.0 );
631 
636  OperationResult transform( const QgsCoordinateTransform &ct );
637 
646  OperationResult transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
647 
654  OperationResult rotate( double rotation, const QgsPointXY &center );
655 
664  OperationResult splitGeometry( const QVector<QgsPointXY> &splitLine, QVector<QgsGeometry> &newGeometries SIP_OUT, bool topological, QVector<QgsPointXY> &topologyTestPoints SIP_OUT );
665 
670  OperationResult reshapeGeometry( const QgsLineString &reshapeLineString );
671 
677  int makeDifferenceInPlace( const QgsGeometry &other ) SIP_SKIP;
678 
686  QgsGeometry makeDifference( const QgsGeometry &other ) const;
687 
692  QgsRectangle boundingBox() const;
693 
701  QgsGeometry orientedMinimumBoundingBox( double &area SIP_OUT, double &angle SIP_OUT, double &width SIP_OUT, double &height SIP_OUT ) const;
702 
708  QgsGeometry orientedMinimumBoundingBox() const SIP_SKIP;
709 
717  QgsGeometry minimalEnclosingCircle( QgsPointXY &center SIP_OUT, double &radius SIP_OUT, unsigned int segments = 36 ) const;
718 
724  QgsGeometry minimalEnclosingCircle( unsigned int segments = 36 ) const SIP_SKIP;
725 
734  QgsGeometry orthogonalize( double tolerance = 1.0E-8, int maxIterations = 1000, double angleThreshold = 15.0 ) const;
735 
748  QgsGeometry snappedToGrid( double hSpacing, double vSpacing, double dSpacing = 0, double mSpacing = 0 ) const;
749 
751  bool intersects( const QgsRectangle &r ) const;
752 
754  bool intersects( const QgsGeometry &geometry ) const;
755 
757  bool contains( const QgsPointXY *p ) const;
758 
763  bool contains( const QgsGeometry &geometry ) const;
764 
769  bool disjoint( const QgsGeometry &geometry ) const;
770 
775  bool equals( const QgsGeometry &geometry ) const;
776 
781  bool touches( const QgsGeometry &geometry ) const;
782 
787  bool overlaps( const QgsGeometry &geometry ) const;
788 
793  bool within( const QgsGeometry &geometry ) const;
794 
799  bool crosses( const QgsGeometry &geometry ) const;
800 
803  {
804  SideLeft = 0,
806  };
807 
810  {
811  CapRound = 1,
814  };
815 
818  {
819  JoinStyleRound = 1,
822  };
823 
828  QgsGeometry buffer( double distance, int segments ) const;
829 
839  QgsGeometry buffer( double distance, int segments, EndCapStyle endCapStyle, JoinStyle joinStyle, double miterLimit ) const;
840 
849  QgsGeometry offsetCurve( double distance, int segments, JoinStyle joinStyle, double miterLimit ) const;
850 
863  QgsGeometry singleSidedBuffer( double distance, int segments, BufferSide side,
864  JoinStyle joinStyle = JoinStyleRound,
865  double miterLimit = 2.0 ) const;
866 
873  QgsGeometry extendLine( double startDistance, double endDistance ) const;
874 
876  QgsGeometry simplify( double tolerance ) const;
877 
887  QgsGeometry densifyByCount( int extraNodesPerSegment ) const;
888 
903  QgsGeometry densifyByDistance( double distance ) const;
904 
918  QgsGeometry centroid() const;
919 
933  QgsGeometry pointOnSurface() const;
934 
947  QgsGeometry poleOfInaccessibility( double precision, double *distanceToBoundary SIP_OUT = nullptr ) const;
948 
957  QgsGeometry convexHull() const;
958 
974  QgsGeometry voronoiDiagram( const QgsGeometry &extent = QgsGeometry(), double tolerance = 0.0, bool edgesOnly = false ) const;
975 
985  QgsGeometry delaunayTriangulation( double tolerance = 0.0, bool edgesOnly = false ) const;
986 
1006  QgsGeometry subdivide( int maxNodes = 256 ) const;
1007 
1019  QgsGeometry interpolate( double distance ) const;
1020 
1032  double lineLocatePoint( const QgsGeometry &point ) const;
1033 
1043  double interpolateAngle( double distance ) const;
1044 
1053  QgsGeometry intersection( const QgsGeometry &geometry ) const;
1054 
1062  QgsGeometry clipped( const QgsRectangle &rectangle );
1063 
1075  QgsGeometry combine( const QgsGeometry &geometry ) const;
1076 
1085  QgsGeometry mergeLines() const;
1086 
1095  QgsGeometry difference( const QgsGeometry &geometry ) const;
1096 
1105  QgsGeometry symDifference( const QgsGeometry &geometry ) const;
1106 
1108  QgsGeometry extrude( double x, double y );
1109 
1114  QByteArray asWkb() const;
1115 
1121  QString asWkt( int precision = 17 ) const;
1122 
1126  QString asJson( int precision = 17 ) const;
1127 
1135  QgsGeometry convertToType( QgsWkbTypes::GeometryType destType, bool destMultipart = false ) const SIP_FACTORY;
1136 
1137  /* Accessor functions for getting geometry data */
1138 
1143  QgsPointXY asPoint() const;
1144 
1149  QgsPolylineXY asPolyline() const;
1150 
1155  QgsPolygonXY asPolygon() const;
1156 
1161  QgsMultiPointXY asMultiPoint() const;
1162 
1167  QgsMultiPolylineXY asMultiPolyline() const;
1168 
1173  QgsMultiPolygonXY asMultiPolygon() const;
1174 
1179  QVector<QgsGeometry> asGeometryCollection() const;
1180 
1186  QPointF asQPointF() const;
1187 
1194  QPolygonF asQPolygonF() const;
1195 
1202  bool deleteRing( int ringNum, int partNum = 0 );
1203 
1209  bool deletePart( int partNum );
1210 
1219  bool convertToMultiType();
1220 
1230  bool convertToSingleType();
1231 
1242  int avoidIntersections( const QList<QgsVectorLayer *> &avoidIntersectionsLayers,
1243  const QHash<QgsVectorLayer *, QSet<QgsFeatureId> > &ignoreFeatures SIP_PYARGREMOVE = ( QHash<QgsVectorLayer *, QSet<QgsFeatureId> >() ) );
1244 
1263  QgsGeometry makeValid() const;
1264 
1268  class CORE_EXPORT Error
1269  {
1270  QString message;
1271  QgsPointXY location;
1272  bool hasLocation = false;
1273 
1274  public:
1276  : message( QStringLiteral( "none" ) )
1277  {}
1278 
1279  explicit Error( const QString &m )
1280  : message( m )
1281  {}
1282 
1283  Error( const QString &m, const QgsPointXY &p )
1284  : message( m )
1285  , location( p )
1286  , hasLocation( true ) {}
1287 
1288  QString what() { return message; }
1289  QgsPointXY where() { return location; }
1290  bool hasWhere() { return hasLocation; }
1291  };
1292 
1298  {
1301  };
1302 
1309  void validateGeometry( QVector<QgsGeometry::Error> &errors SIP_OUT, ValidationMethod method = ValidatorQgisInternal ) const;
1310 
1316  static QgsGeometry unaryUnion( const QVector<QgsGeometry> &geometries );
1317 
1326  static QgsGeometry polygonize( const QVector<QgsGeometry> &geometries );
1327 
1333  void convertToStraightSegment();
1334 
1341  bool requiresConversionToStraightSegments() const;
1342 
1348  void mapToPixel( const QgsMapToPixel &mtp );
1349 
1355  void draw( QPainter &p ) const;
1356 
1367  bool vertexIdFromVertexNr( int number, QgsVertexId &id SIP_OUT ) const;
1368 
1380  int vertexNrFromVertexId( QgsVertexId id ) const;
1381 
1389  QString lastError() const;
1390 
1396  static GEOSContextHandle_t getGEOSHandler() SIP_SKIP;
1397 
1403  static QgsGeometry fromQPointF( QPointF point );
1404 
1412  static QgsGeometry fromQPolygonF( const QPolygonF &polygon );
1413 
1420  static QgsPolylineXY createPolylineFromQPolygonF( const QPolygonF &polygon ) SIP_FACTORY;
1421 
1428  static QgsPolygonXY createPolygonFromQPolygonF( const QPolygonF &polygon ) SIP_FACTORY;
1429 
1430 #ifndef SIP_RUN
1431 
1441  static bool compare( const QgsPolylineXY &p1, const QgsPolylineXY &p2,
1442  double epsilon = 4 * std::numeric_limits<double>::epsilon() );
1443 
1453  static bool compare( const QgsPolygonXY &p1, const QgsPolygonXY &p2,
1454  double epsilon = 4 * std::numeric_limits<double>::epsilon() );
1455 
1466  static bool compare( const QgsMultiPolygonXY &p1, const QgsMultiPolygonXY &p2,
1467  double epsilon = 4 * std::numeric_limits<double>::epsilon() );
1468 #else
1469 
1488  static bool compare( PyObject *obj1, PyObject *obj2, double epsilon = 4 * DBL_EPSILON );
1489  % MethodCode
1490  {
1491  sipRes = false;
1492  int state0;
1493  int state1;
1494  int sipIsErr = 0;
1495 
1496  if ( PyList_Check( a0 ) && PyList_Check( a1 ) &&
1497  PyList_GET_SIZE( a0 ) && PyList_GET_SIZE( a1 ) )
1498  {
1499  PyObject *o0 = PyList_GetItem( a0, 0 );
1500  PyObject *o1 = PyList_GetItem( a1, 0 );
1501  if ( o0 && o1 )
1502  {
1503  // compare polyline - polyline
1504  if ( sipCanConvertToType( o0, sipType_QgsPointXY, SIP_NOT_NONE ) &&
1505  sipCanConvertToType( o1, sipType_QgsPointXY, SIP_NOT_NONE ) &&
1506  sipCanConvertToType( a0, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) &&
1507  sipCanConvertToType( a1, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) )
1508  {
1509  QgsPolylineXY *p0;
1510  QgsPolylineXY *p1;
1511  p0 = reinterpret_cast<QgsPolylineXY *>( sipConvertToType( a0, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
1512  p1 = reinterpret_cast<QgsPolylineXY *>( sipConvertToType( a1, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
1513  if ( sipIsErr )
1514  {
1515  sipReleaseType( p0, sipType_QVector_0100QgsPointXY, state0 );
1516  sipReleaseType( p1, sipType_QVector_0100QgsPointXY, state1 );
1517  }
1518  else
1519  {
1520  sipRes = QgsGeometry::compare( *p0, *p1, a2 );
1521  }
1522  }
1523  else if ( PyList_Check( o0 ) && PyList_Check( o1 ) &&
1524  PyList_GET_SIZE( o0 ) && PyList_GET_SIZE( o1 ) )
1525  {
1526  PyObject *oo0 = PyList_GetItem( o0, 0 );
1527  PyObject *oo1 = PyList_GetItem( o1, 0 );
1528  if ( oo0 && oo1 )
1529  {
1530  // compare polygon - polygon
1531  if ( sipCanConvertToType( oo0, sipType_QgsPointXY, SIP_NOT_NONE ) &&
1532  sipCanConvertToType( oo1, sipType_QgsPointXY, SIP_NOT_NONE ) &&
1533  sipCanConvertToType( a0, sipType_QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) &&
1534  sipCanConvertToType( a1, sipType_QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) )
1535  {
1536  QgsPolygonXY *p0;
1537  QgsPolygonXY *p1;
1538  p0 = reinterpret_cast<QgsPolygonXY *>( sipConvertToType( a0, sipType_QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
1539  p1 = reinterpret_cast<QgsPolygonXY *>( sipConvertToType( a1, sipType_QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
1540  if ( sipIsErr )
1541  {
1542  sipReleaseType( p0, sipType_QVector_0600QVector_0100QgsPointXY, state0 );
1543  sipReleaseType( p1, sipType_QVector_0600QVector_0100QgsPointXY, state1 );
1544  }
1545  else
1546  {
1547  sipRes = QgsGeometry::compare( *p0, *p1, a2 );
1548  }
1549  }
1550  else if ( PyList_Check( oo0 ) && PyList_Check( oo1 ) &&
1551  PyList_GET_SIZE( oo0 ) && PyList_GET_SIZE( oo1 ) )
1552  {
1553  PyObject *ooo0 = PyList_GetItem( oo0, 0 );
1554  PyObject *ooo1 = PyList_GetItem( oo1, 0 );
1555  if ( ooo0 && ooo1 )
1556  {
1557  // compare multipolygon - multipolygon
1558  if ( sipCanConvertToType( ooo0, sipType_QgsPointXY, SIP_NOT_NONE ) &&
1559  sipCanConvertToType( ooo1, sipType_QgsPointXY, SIP_NOT_NONE ) &&
1560  sipCanConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) &&
1561  sipCanConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) )
1562  {
1563  QgsMultiPolygonXY *p0;
1564  QgsMultiPolygonXY *p1;
1565  p0 = reinterpret_cast<QgsMultiPolygonXY *>( sipConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
1566  p1 = reinterpret_cast<QgsMultiPolygonXY *>( sipConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
1567  if ( sipIsErr )
1568  {
1569  sipReleaseType( p0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, state0 );
1570  sipReleaseType( p1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, state1 );
1571  }
1572  else
1573  {
1574  sipRes = QgsGeometry::compare( *p0, *p1, a2 );
1575  }
1576  }
1577  }
1578  }
1579  }
1580  }
1581  }
1582  }
1583  }
1584  % End
1585 #endif
1586 
1599  QgsGeometry smooth( const unsigned int iterations = 1, const double offset = 0.25,
1600  double minimumDistance = -1.0, double maxAngle = 180.0 ) const;
1601 
1605  static QgsGeometryEngine *createGeometryEngine( const QgsAbstractGeometry *geometry ) SIP_FACTORY;
1606 
1612  static void convertPointList( const QVector<QgsPointXY> &input, QgsPointSequence &output );
1613 
1619  static void convertPointList( const QgsPointSequence &input, QVector<QgsPointXY> &output );
1620 
1622  operator QVariant() const
1623  {
1624  return QVariant::fromValue( *this );
1625  }
1626 
1632  operator bool() const;
1633 
1634  private:
1635 
1636  QgsGeometryPrivate *d; //implicitly shared data pointer
1637 
1639  mutable QString mLastError;
1640 
1645  void detach();
1646 
1651  void reset( std::unique_ptr< QgsAbstractGeometry > newGeometry );
1652 
1653  static void convertToPolyline( const QgsPointSequence &input, QgsPolylineXY &output );
1654  static void convertPolygon( const QgsPolygon &input, QgsPolygonXY &output );
1655 
1657  QgsGeometry convertToPoint( bool destMultipart ) const;
1659  QgsGeometry convertToLine( bool destMultipart ) const;
1661  QgsGeometry convertToPolygon( bool destMultipart ) const;
1662 
1674  std::unique_ptr< QgsLineString > smoothLine( const QgsLineString &line, const unsigned int iterations = 1, const double offset = 0.25,
1675  double minimumDistance = -1, double maxAngle = 180.0 ) const;
1676 
1688  std::unique_ptr< QgsPolygon > smoothPolygon( const QgsPolygon &polygon, const unsigned int iterations = 1, const double offset = 0.25,
1689  double minimumDistance = -1, double maxAngle = 180.0 ) const;
1690 
1691 
1692 }; // class QgsGeometry
1693 
1695 
1696 CORE_EXPORT QDataStream &operator<<( QDataStream &out, const QgsGeometry &geometry );
1699 CORE_EXPORT QDataStream &operator>>( QDataStream &in, QgsGeometry &geometry );
1700 
1701 #endif
Geometry engine misses a method implemented or an error occurred in the geometry engine.
Definition: qgsgeometry.h:127
A rectangle specified with double values.
Definition: qgsrectangle.h:39
The input ring doesn&#39;t have any existing ring to fit into.
Definition: qgsgeometry.h:136
Java-style iterator for traversal of vertices of a geometry.
The source geometry is not multi.
Definition: qgsgeometry.h:131
Use GEOS validation methods.
Definition: qgsgeometry.h:1300
Error(const QString &m)
Definition: qgsgeometry.h:1279
Handles storage of information regarding WKB types and their properties.
Definition: qgswkbtypes.h:40
A class to represent a 2D point.
Definition: qgspointxy.h:43
QVector< QgsPoint > QgsPolyline
Polyline as represented as a vector of points.
Definition: qgsgeometry.h:69
QVector< QgsPolylineXY > QgsPolygonXY
Polygon: first item of the list is outer ring, inner rings (if any) start from second item...
Definition: qgsgeometry.h:73
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:111
Use mitered joins.
Definition: qgsgeometry.h:820
QVector< QgsPointXY > QgsMultiPointXY
A collection of QgsPoints that share a common collection of attributes.
Definition: qgsgeometry.h:79
EndCapStyle
End cap styles for buffers.
Definition: qgsgeometry.h:809
Q_DECLARE_METATYPE(QModelIndex)
OperationResult
Success or failure of a geometry operation.
Definition: qgsgeometry.h:119
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
Definition: MathUtils.cpp:786
QVector< QgsPolygonXY > QgsMultiPolygonXY
A collection of QgsPolygons that share a common collection of attributes.
Definition: qgsgeometry.h:90
Error(const QString &m, const QgsPointXY &p)
Definition: qgsgeometry.h:1283
#define SIP_IN
Definition: qgis_sip.h:56
QVector< QgsPolylineXY > QgsMultiPolylineXY
A collection of QgsPolylines that share a common collection of attributes.
Definition: qgsgeometry.h:83
CORE_EXPORT QDataStream & operator<<(QDataStream &out, const QgsGeometry &geometry)
Writes the geometry to stream out. QGIS version compatibility is not guaranteed.
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:36
Cannot edit layer.
Definition: qgsgeometry.h:128
The selected geometry cannot be found.
Definition: qgsgeometry.h:130
No features were selected.
Definition: qgsgeometry.h:125
More than one features were selected.
Definition: qgsgeometry.h:126
Utility class for identifying a unique vertex within a geometry.
const double DEFAULT_SEGMENT_EPSILON
Default snapping tolerance for segments.
Definition: qgis.h:441
The input ring crosses existing rings (it is not disjoint)
Definition: qgsgeometry.h:135
#define SIP_SKIP
Definition: qgis_sip.h:119
QgsPointXY where()
Definition: qgsgeometry.h:1289
Use internal QgsGeometryValidator method.
Definition: qgsgeometry.h:1299
#define SIP_TRANSFER
Definition: qgis_sip.h:36
The input ring is not closed.
Definition: qgsgeometry.h:133
Square cap (extends past start/end of line by buffer distance)
Definition: qgsgeometry.h:813
Abstract base class for curved geometry type.
Definition: qgscurve.h:35
#define SIP_FACTORY
Definition: qgis_sip.h:69
Abstract base class for all geometries.
The vertex_iterator class provides STL-style iterator for vertices.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:37
CORE_EXPORT QDataStream & operator>>(QDataStream &in, QgsGeometry &geometry)
Reads a geometry from stream in into geometry. QGIS version compatibility is not guaranteed.
Contains geos related utilities and functions.
Definition: qgsgeos.h:36
BufferSide
Side of line to buffer.
Definition: qgsgeometry.h:802
QVector< QgsPoint > QgsPointSequence
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:137
#define SIP_PYARGREMOVE
Definition: qgis_sip.h:139
QVector< QgsPointXY > QgsPolylineXY
Polyline as represented as a vector of two-dimensional points.
Definition: qgsgeometry.h:49
The base geometry on which the operation is done is invalid or empty.
Definition: qgsgeometry.h:123
The input geometry (ring, part, split line, etc.) has not the correct geometry type.
Definition: qgsgeometry.h:124
#define SIP_OUT
Definition: qgis_sip.h:51
Line string geometry type, with support for z-dimension and m-values.
Definition: qgslinestring.h:41
ValidationMethod
Available methods for validating geometries.
Definition: qgsgeometry.h:1297
Buffer to right of line.
Definition: qgsgeometry.h:805
Class for doing transforms between two map coordinate systems.
The input ring is not valid.
Definition: qgsgeometry.h:134
qint64 QgsFeatureId
Definition: qgsfeature.h:37
Contains geometry relation and modification algorithms.
Use beveled joins.
Definition: qgsgeometry.h:821
Polygon geometry type.
Definition: qgspolygon.h:31
JoinStyle
Join styles for buffers.
Definition: qgsgeometry.h:817
Flat cap (in line with start/end of line)
Definition: qgsgeometry.h:812
Represents a vector layer which manages a vector based data sets.
double ANALYSIS_EXPORT leftOf(const QgsPoint &thepoint, const QgsPoint *p1, const QgsPoint *p2)
Returns whether &#39;thepoint&#39; is left or right of the line from &#39;p1&#39; to &#39;p2&#39;. Negativ values mean left a...
Definition: MathUtils.cpp:292
static bool compare(const QgsPolylineXY &p1, const QgsPolylineXY &p2, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compares two polylines for equality within a specified tolerance.
#define SIP_PYNAME(name)
Definition: qgis_sip.h:74