QGIS API Documentation  2.99.0-Master (69af2f5)
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 
28 #include "qgis_core.h"
29 #include "qgis.h"
30 
31 
32 #if defined(GEOS_VERSION_MAJOR) && (GEOS_VERSION_MAJOR<3)
33 #define GEOSGeometry struct GEOSGeom_t
34 #define GEOSCoordSequence struct GEOSCoordSeq_t
35 #endif
36 
37 #include "qgsabstractgeometry.h"
38 #include "qgsfeature.h"
39 #include "qgspointxy.h"
40 #include "qgspoint.h"
41 
42 
43 class QgsGeometryEngine;
44 class QgsVectorLayer;
45 class QgsMapToPixel;
46 class QPainter;
47 class QgsPolygonV2;
49 
51 typedef QVector<QgsPointXY> QgsPolyline;
52 
54 #ifndef SIP_RUN
55 typedef QVector<QgsPolyline> QgsPolygon;
56 #else
57 typedef QVector<QVector<QgsPointXY>> QgsPolygon;
58 #endif
59 
61 #ifndef SIP_RUN
62 typedef QVector<QgsPointXY> QgsMultiPoint;
63 #else
64 typedef QVector<QgsPointXY> QgsMultiPoint;
65 #endif
66 
68 #ifndef SIP_RUN
69 typedef QVector<QgsPolyline> QgsMultiPolyline;
70 #else
71 typedef QVector<QVector<QgsPointXY>> QgsMultiPolyline;
72 #endif
73 
75 #ifndef SIP_RUN
76 typedef QVector<QgsPolygon> QgsMultiPolygon;
77 #else
78 typedef QVector<QVector<QVector<QgsPointXY>>> QgsMultiPolygon;
79 #endif
80 
81 class QgsRectangle;
82 
83 class QgsConstWkbPtr;
84 
85 struct QgsGeometryPrivate;
86 
96 class CORE_EXPORT QgsGeometry
97 {
98  public:
100  QgsGeometry();
101 
103  QgsGeometry( const QgsGeometry & );
104 
108  QgsGeometry &operator=( QgsGeometry const &rhs ) SIP_SKIP;
109 
114  explicit QgsGeometry( QgsAbstractGeometry *geom SIP_TRANSFER );
115 
116 
117  ~QgsGeometry();
118 
123  QgsAbstractGeometry *geometry() const;
124 
129  void setGeometry( QgsAbstractGeometry *geometry SIP_TRANSFER );
130 
137  bool isNull() const;
138 
140  static QgsGeometry fromWkt( const QString &wkt );
142  static QgsGeometry fromPoint( const QgsPointXY &point );
144  static QgsGeometry fromMultiPoint( const QgsMultiPoint &multipoint );
146  static QgsGeometry fromPolyline( const QgsPolyline &polyline );
148  static QgsGeometry fromMultiPolyline( const QgsMultiPolyline &multiline );
150  static QgsGeometry fromPolygon( const QgsPolygon &polygon );
152  static QgsGeometry fromMultiPolygon( const QgsMultiPolygon &multipoly );
154  static QgsGeometry fromRect( const QgsRectangle &rect );
156  static QgsGeometry collectGeometry( const QList< QgsGeometry > &geometries );
157 
163  void fromGeos( GEOSGeometry *geos ) SIP_SKIP;
164 
170  void fromWkb( unsigned char *wkb, int length ) SIP_SKIP;
171 
176  void fromWkb( const QByteArray &wkb );
177 
183  GEOSGeometry *exportToGeos( double precision = 0 ) const SIP_SKIP;
184 
188  QgsWkbTypes::Type wkbType() const;
189 
193  QgsWkbTypes::GeometryType type() const;
194 
201  bool isEmpty() const;
202 
204  bool isMultipart() const;
205 
209  bool isGeosEqual( const QgsGeometry & ) const;
210 
214  bool isGeosValid() const;
215 
223  bool isSimple() const;
224 
228  double area() const;
229 
233  double length() const;
234 
241  double distance( const QgsGeometry &geom ) const;
242 
255  //TODO QGIS 3.0 - rename beforeVertex to previousVertex, afterVertex to nextVertex
256  QgsPointXY closestVertex( const QgsPointXY &point, int &atVertex SIP_OUT, int &beforeVertex SIP_OUT, int &afterVertex SIP_OUT, double &sqrDist SIP_OUT ) const;
257 
264  double distanceToVertex( int vertex ) const;
265 
273  double angleAtVertex( int vertex ) const;
274 
287  void adjacentVertices( int atVertex, int &beforeVertex SIP_OUT, int &afterVertex SIP_OUT ) const;
288 
300  bool insertVertex( double x, double y, int beforeVertex );
301 
313  bool insertVertex( const QgsPoint &point, int beforeVertex );
314 
321  bool moveVertex( double x, double y, int atVertex );
322 
329  bool moveVertex( const QgsPoint &p, int atVertex );
330 
341  bool deleteVertex( int atVertex );
342 
348  QgsPointXY vertexAt( int atVertex ) const;
349 
355  double sqrDistToVertexAt( QgsPointXY &point SIP_IN, int atVertex ) const;
356 
361  QgsGeometry nearestPoint( const QgsGeometry &other ) const;
362 
367  QgsGeometry shortestLine( const QgsGeometry &other ) const;
368 
375  double closestVertexWithContext( const QgsPointXY &point, int &atVertex SIP_OUT ) const;
376 
387 #ifndef SIP_RUN
388  double closestSegmentWithContext( const QgsPointXY &point, QgsPointXY &minDistPoint, int &afterVertex, double *leftOf = nullptr, double epsilon = DEFAULT_SEGMENT_EPSILON ) const;
389 #else
390  double closestSegmentWithContext( const QgsPointXY &point, QgsPointXY &minDistPoint SIP_OUT, int &afterVertex SIP_OUT ) const;
391 #endif
392 
396  int addRing( const QList<QgsPointXY> &ring );
397  // TODO QGIS 3.0 returns an enum instead of a magic constant
398 
402  int addRing( QgsCurve *ring SIP_TRANSFER );
403  // TODO QGIS 3.0 returns an enum instead of a magic constant
404 
411  int addPart( const QList<QgsPointXY> &points, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry ) SIP_PYNAME( addPoints );
412  // TODO QGIS 3.0 returns an enum instead of a magic constant
413 
420  int addPart( const QgsPointSequence &points, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry ) SIP_PYNAME( addPointsV2 );
421  // TODO QGIS 3.0 returns an enum instead of a magic constant
422 
429  int addPart( QgsAbstractGeometry *part SIP_TRANSFER, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry );
430  // TODO QGIS 3.0 returns an enum instead of a magic constant
431 
438  int addPart( GEOSGeometry *newPart ) SIP_SKIP;
439  // TODO QGIS 3.0 returns an enum instead of a magic constant
440 
447  int addPart( const QgsGeometry &newPart ) SIP_PYNAME( addPartGeometry );
448  // TODO QGIS 3.0 returns an enum instead of a magic constant
449 
456  QgsGeometry removeInteriorRings( double minimumAllowedArea = -1 ) const;
457 
460  int translate( double dx, double dy );
461 
464  int transform( const QgsCoordinateTransform &ct );
465 
469  int transform( const QTransform &ct );
470 
476  int rotate( double rotation, const QgsPointXY &center );
477 
484  // TODO QGIS 3.0 returns an enum instead of a magic constant
485  int splitGeometry( const QList<QgsPointXY> &splitLine,
486  QList<QgsGeometry> &newGeometries SIP_OUT,
487  bool topological,
488  QList<QgsPointXY> &topologyTestPoints SIP_OUT );
489 
494  int reshapeGeometry( const QgsLineString &reshapeLineString );
495 
501  int makeDifferenceInPlace( const QgsGeometry &other ) SIP_SKIP;
502 
509  QgsGeometry makeDifference( const QgsGeometry &other ) const;
510 
515  QgsRectangle boundingBox() const;
516 
524  QgsGeometry orientedMinimumBoundingBox( double &area SIP_OUT, double &angle SIP_OUT, double &width SIP_OUT, double &height SIP_OUT ) const;
525 
534  QgsGeometry orthogonalize( double tolerance = 1.0E-8, int maxIterations = 1000, double angleThreshold = 15.0 ) const;
535 
537  bool intersects( const QgsRectangle &r ) const;
538 
540  bool intersects( const QgsGeometry &geometry ) const;
541 
543  bool contains( const QgsPointXY *p ) const;
544 
547  bool contains( const QgsGeometry &geometry ) const;
548 
551  bool disjoint( const QgsGeometry &geometry ) const;
552 
555  bool equals( const QgsGeometry &geometry ) const;
556 
559  bool touches( const QgsGeometry &geometry ) const;
560 
563  bool overlaps( const QgsGeometry &geometry ) const;
564 
567  bool within( const QgsGeometry &geometry ) const;
568 
571  bool crosses( const QgsGeometry &geometry ) const;
572 
575  {
576  SideLeft = 0,
578  };
579 
582  {
583  CapRound = 1,
586  };
587 
590  {
591  JoinStyleRound = 1,
594  };
595 
598  QgsGeometry buffer( double distance, int segments ) const;
599 
608  QgsGeometry buffer( double distance, int segments, EndCapStyle endCapStyle, JoinStyle joinStyle, double mitreLimit ) const;
609 
617  QgsGeometry offsetCurve( double distance, int segments, JoinStyle joinStyle, double mitreLimit ) const;
618 
631  QgsGeometry singleSidedBuffer( double distance, int segments, BufferSide side,
632  JoinStyle joinStyle = JoinStyleRound,
633  double mitreLimit = 2.0 ) const;
634 
641  QgsGeometry extendLine( double startDistance, double endDistance ) const;
642 
644  QgsGeometry simplify( double tolerance ) const;
645 
655  QgsGeometry densifyByCount( int extraNodesPerSegment ) const;
656 
671  QgsGeometry densifyByDistance( double distance ) const;
672 
680  QgsGeometry centroid() const;
681 
689  QgsGeometry pointOnSurface() const;
690 
703  QgsGeometry poleOfInaccessibility( double precision, double *distanceToBoundary SIP_OUT = nullptr ) const;
704 
706  QgsGeometry convexHull() const;
707 
723  QgsGeometry voronoiDiagram( const QgsGeometry &extent = QgsGeometry(), double tolerance = 0.0, bool edgesOnly = false ) const;
724 
734  QgsGeometry delaunayTriangulation( double tolerance = 0.0, bool edgesOnly = false ) const;
735 
750  QgsGeometry subdivide( int maxNodes = 256 ) const;
751 
757  QgsGeometry interpolate( double distance ) const;
758 
769  double lineLocatePoint( const QgsGeometry &point ) const;
770 
779  double interpolateAngle( double distance ) const;
780 
782  QgsGeometry intersection( const QgsGeometry &geometry ) const;
783 
791  QgsGeometry clipped( const QgsRectangle &rectangle );
792 
797  QgsGeometry combine( const QgsGeometry &geometry ) const;
798 
806  QgsGeometry mergeLines() const;
807 
809  QgsGeometry difference( const QgsGeometry &geometry ) const;
810 
812  QgsGeometry symDifference( const QgsGeometry &geometry ) const;
813 
815  QgsGeometry extrude( double x, double y );
816 
820  QByteArray exportToWkb() const;
821 
826  QString exportToWkt( int precision = 17 ) const;
827 
834  QString exportToGeoJSON( int precision = 17 ) const;
835 
842  QgsGeometry convertToType( QgsWkbTypes::GeometryType destType, bool destMultipart = false ) const SIP_FACTORY;
843 
844  /* Accessor functions for getting geometry data */
845 
849  QgsPointXY asPoint() const;
850 
854  QgsPolyline asPolyline() const;
855 
859  QgsPolygon asPolygon() const;
860 
863  QgsMultiPoint asMultiPoint() const;
864 
867  QgsMultiPolyline asMultiPolyline() const;
868 
871  QgsMultiPolygon asMultiPolygon() const;
872 
875  QList<QgsGeometry> asGeometryCollection() const;
876 
881  QPointF asQPointF() const;
882 
888  QPolygonF asQPolygonF() const;
889 
894  bool deleteRing( int ringNum, int partNum = 0 );
895 
899  bool deletePart( int partNum );
900 
909  bool convertToMultiType();
910 
920  bool convertToSingleType();
921 
931  int avoidIntersections( const QList<QgsVectorLayer *> &avoidIntersectionsLayers,
932  const QHash<QgsVectorLayer *, QSet<QgsFeatureId> > &ignoreFeatures SIP_PYARGREMOVE = ( QHash<QgsVectorLayer *, QSet<QgsFeatureId> >() ) );
933 
946  QgsGeometry makeValid();
947 
950  class CORE_EXPORT Error
951  {
952  QString message;
953  QgsPointXY location;
954  bool hasLocation;
955 
956  public:
958  : message( QStringLiteral( "none" ) )
959  , hasLocation( false ) {}
960 
961  explicit Error( const QString &m )
962  : message( m )
963  , hasLocation( false ) {}
964 
965  Error( const QString &m, const QgsPointXY &p )
966  : message( m )
967  , location( p )
968  , hasLocation( true ) {}
969 
970  QString what() { return message; }
971  QgsPointXY where() { return location; }
972  bool hasWhere() { return hasLocation; }
973  };
974 
980  {
983  };
984 
990  void validateGeometry( QList<QgsGeometry::Error> &errors SIP_OUT, ValidationMethod method = ValidatorQgisInternal );
991 
996  static QgsGeometry unaryUnion( const QList<QgsGeometry> &geometries );
997 
1006  static QgsGeometry polygonize( const QList< QgsGeometry> &geometries );
1007 
1012  void convertToStraightSegment();
1013 
1019  bool requiresConversionToStraightSegments() const;
1020 
1025  void mapToPixel( const QgsMapToPixel &mtp );
1026 
1031  void draw( QPainter &p ) const;
1032 
1040  bool vertexIdFromVertexNr( int nr, QgsVertexId &id SIP_OUT ) const;
1041 
1048  int vertexNrFromVertexId( QgsVertexId i ) const;
1049 
1054  static GEOSContextHandle_t getGEOSHandler() SIP_SKIP;
1055 
1060  static QgsGeometry fromQPointF( QPointF point );
1061 
1068  static QgsGeometry fromQPolygonF( const QPolygonF &polygon );
1069 
1075  static QgsPolyline createPolylineFromQPolygonF( const QPolygonF &polygon ) SIP_FACTORY;
1076 
1082  static QgsPolygon createPolygonFromQPolygonF( const QPolygonF &polygon ) SIP_FACTORY;
1083 
1084 #ifndef SIP_RUN
1085 
1094  static bool compare( const QgsPolyline &p1, const QgsPolyline &p2,
1095  double epsilon = 4 * std::numeric_limits<double>::epsilon() );
1096 
1105  static bool compare( const QgsPolygon &p1, const QgsPolygon &p2,
1106  double epsilon = 4 * std::numeric_limits<double>::epsilon() );
1107 
1117  static bool compare( const QgsMultiPolygon &p1, const QgsMultiPolygon &p2,
1118  double epsilon = 4 * std::numeric_limits<double>::epsilon() );
1119 #else
1120 
1138  static bool compare( PyObject *obj1, PyObject *obj2, double epsilon = 4 * DBL_EPSILON );
1139  % MethodCode
1140  {
1141  sipRes = false;
1142  int state0;
1143  int state1;
1144  int sipIsErr = 0;
1145 
1146  if ( PyList_Check( a0 ) && PyList_Check( a1 ) &&
1147  PyList_GET_SIZE( a0 ) && PyList_GET_SIZE( a1 ) )
1148  {
1149  PyObject *o0 = PyList_GetItem( a0, 0 );
1150  PyObject *o1 = PyList_GetItem( a1, 0 );
1151  if ( o0 && o1 )
1152  {
1153  // compare polyline - polyline
1154  if ( sipCanConvertToType( o0, sipType_QgsPointXY, SIP_NOT_NONE ) &&
1155  sipCanConvertToType( o1, sipType_QgsPointXY, SIP_NOT_NONE ) &&
1156  sipCanConvertToType( a0, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) &&
1157  sipCanConvertToType( a1, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) )
1158  {
1159  QgsPolyline *p0;
1160  QgsPolyline *p1;
1161  p0 = reinterpret_cast<QgsPolyline *>( sipConvertToType( a0, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
1162  p1 = reinterpret_cast<QgsPolyline *>( sipConvertToType( a1, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
1163  if ( sipIsErr )
1164  {
1165  sipReleaseType( p0, sipType_QVector_0100QgsPointXY, state0 );
1166  sipReleaseType( p1, sipType_QVector_0100QgsPointXY, state1 );
1167  }
1168  else
1169  {
1170  sipRes = QgsGeometry::compare( *p0, *p1, a2 );
1171  }
1172  }
1173  else if ( PyList_Check( o0 ) && PyList_Check( o1 ) &&
1174  PyList_GET_SIZE( o0 ) && PyList_GET_SIZE( o1 ) )
1175  {
1176  PyObject *oo0 = PyList_GetItem( o0, 0 );
1177  PyObject *oo1 = PyList_GetItem( o1, 0 );
1178  if ( oo0 && oo1 )
1179  {
1180  // compare polygon - polygon
1181  if ( sipCanConvertToType( oo0, sipType_QgsPointXY, SIP_NOT_NONE ) &&
1182  sipCanConvertToType( oo1, sipType_QgsPointXY, SIP_NOT_NONE ) &&
1183  sipCanConvertToType( a0, sipType_QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) &&
1184  sipCanConvertToType( a1, sipType_QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) )
1185  {
1186  QgsPolygon *p0;
1187  QgsPolygon *p1;
1188  p0 = reinterpret_cast<QgsPolygon *>( sipConvertToType( a0, sipType_QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
1189  p1 = reinterpret_cast<QgsPolygon *>( sipConvertToType( a1, sipType_QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
1190  if ( sipIsErr )
1191  {
1192  sipReleaseType( p0, sipType_QVector_0600QVector_0100QgsPointXY, state0 );
1193  sipReleaseType( p1, sipType_QVector_0600QVector_0100QgsPointXY, state1 );
1194  }
1195  else
1196  {
1197  sipRes = QgsGeometry::compare( *p0, *p1, a2 );
1198  }
1199  }
1200  else if ( PyList_Check( oo0 ) && PyList_Check( oo1 ) &&
1201  PyList_GET_SIZE( oo0 ) && PyList_GET_SIZE( oo1 ) )
1202  {
1203  PyObject *ooo0 = PyList_GetItem( oo0, 0 );
1204  PyObject *ooo1 = PyList_GetItem( oo1, 0 );
1205  if ( ooo0 && ooo1 )
1206  {
1207  // compare multipolygon - multipolygon
1208  if ( sipCanConvertToType( ooo0, sipType_QgsPointXY, SIP_NOT_NONE ) &&
1209  sipCanConvertToType( ooo1, sipType_QgsPointXY, SIP_NOT_NONE ) &&
1210  sipCanConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) &&
1211  sipCanConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) )
1212  {
1213  QgsMultiPolygon *p0;
1214  QgsMultiPolygon *p1;
1215  p0 = reinterpret_cast<QgsMultiPolygon *>( sipConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
1216  p1 = reinterpret_cast<QgsMultiPolygon *>( sipConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
1217  if ( sipIsErr )
1218  {
1219  sipReleaseType( p0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, state0 );
1220  sipReleaseType( p1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, state1 );
1221  }
1222  else
1223  {
1224  sipRes = QgsGeometry::compare( *p0, *p1, a2 );
1225  }
1226  }
1227  }
1228  }
1229  }
1230  }
1231  }
1232  }
1233  }
1234  % End
1235 #endif
1236 
1248  QgsGeometry smooth( const unsigned int iterations = 1, const double offset = 0.25,
1249  double minimumDistance = -1.0, double maxAngle = 180.0 ) const;
1250 
1253  static QgsGeometryEngine *createGeometryEngine( const QgsAbstractGeometry *geometry ) SIP_FACTORY;
1254 
1259  static void convertPointList( const QList<QgsPointXY> &input, QgsPointSequence &output );
1260 
1265  static void convertPointList( const QgsPointSequence &input, QList<QgsPointXY> &output );
1266 
1268  operator QVariant() const
1269  {
1270  return QVariant::fromValue( *this );
1271  }
1272 
1277  operator bool() const;
1278 
1279  private:
1280 
1281  QgsGeometryPrivate *d; //implicitly shared data pointer
1282 
1283  void detach( bool cloneGeom = true ); //make sure mGeometry only referenced from this instance
1284 
1285  static void convertToPolyline( const QgsPointSequence &input, QgsPolyline &output );
1286  static void convertPolygon( const QgsPolygonV2 &input, QgsPolygon &output );
1287 
1289  QgsGeometry convertToPoint( bool destMultipart ) const;
1291  QgsGeometry convertToLine( bool destMultipart ) const;
1293  QgsGeometry convertToPolygon( bool destMultipart ) const;
1294 
1305  QgsLineString *smoothLine( const QgsLineString &line, const unsigned int iterations = 1, const double offset = 0.25,
1306  double minimumDistance = -1, double maxAngle = 180.0 ) const;
1307 
1318  QgsPolygonV2 *smoothPolygon( const QgsPolygonV2 &polygon, const unsigned int iterations = 1, const double offset = 0.25,
1319  double minimumDistance = -1, double maxAngle = 180.0 ) const;
1320 
1321 
1322 }; // class QgsGeometry
1323 
1325 
1326 CORE_EXPORT QDataStream &operator<<( QDataStream &out, const QgsGeometry &geometry );
1329 CORE_EXPORT QDataStream &operator>>( QDataStream &in, QgsGeometry &geometry );
1330 
1331 #endif
A rectangle specified with double values.
Definition: qgsrectangle.h:38
Use GEOS validation methods.
Definition: qgsgeometry.h:982
Error(const QString &m)
Definition: qgsgeometry.h:961
static bool compare(const QgsPolyline &p1, const QgsPolyline &p2, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compares two polylines for equality within a specified tolerance.
double ANALYSIS_EXPORT leftOf(QgsPoint *thepoint, QgsPoint *p1, 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.cc:310
A class to represent a 2D point.
Definition: qgspointxy.h:42
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:96
EndCapStyle
End cap styles for buffers.
Definition: qgsgeometry.h:581
Q_DECLARE_METATYPE(QModelIndex)
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.cc:857
Error(const QString &m, const QgsPointXY &p)
Definition: qgsgeometry.h:965
QVector< QgsPointXY > QgsPolyline
Polyline is represented as a vector of points.
Definition: qgsgeometry.h:48
#define SIP_IN
Definition: qgis_sip.h:44
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:35
Polygon geometry type.
Definition: qgspolygon.h:30
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:66
Utility class for identifying a unique vertex within a geometry.
const double DEFAULT_SEGMENT_EPSILON
Default snapping tolerance for segments.
Definition: qgis.h:338
#define SIP_SKIP
Definition: qgis_sip.h:107
QgsPointXY where()
Definition: qgsgeometry.h:971
Use internal QgsGeometryValidator method.
Definition: qgsgeometry.h:981
#define SIP_TRANSFER
Definition: qgis_sip.h:24
QVector< QgsPolygon > QgsMultiPolygon
A collection of QgsPolygons that share a common collection of attributes.
Definition: qgsgeometry.h:76
Square cap (extends past start/end of line by buffer distance)
Definition: qgsgeometry.h:585
Abstract base class for curved geometry type.
Definition: qgscurve.h:34
#define SIP_FACTORY
Definition: qgis_sip.h:57
QVector< QgsPolyline > QgsPolygon
Polygon: first item of the list is outer ring, inner rings (if any) start from second item...
Definition: qgsgeometry.h:55
Abstract base class for all geometries.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:36
CORE_EXPORT QDataStream & operator>>(QDataStream &in, QgsGeometry &geometry)
Reads a geometry from stream in into geometry. QGIS version compatibility is not guaranteed.
QVector< QgsPolyline > QgsMultiPolyline
A collection of QgsPolylines that share a common collection of attributes.
Definition: qgsgeometry.h:69
BufferSide
Side of line to buffer.
Definition: qgsgeometry.h:574
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:136
#define SIP_PYARGREMOVE
Definition: qgis_sip.h:127
#define SIP_OUT
Definition: qgis_sip.h:39
Line string geometry type, with support for z-dimension and m-values.
Definition: qgslinestring.h:40
ValidationMethod
Available methods for validating geometries.
Definition: qgsgeometry.h:979
QVector< QgsPointXY > QgsMultiPoint
A collection of QgsPoints that share a common collection of attributes.
Definition: qgsgeometry.h:62
Buffer to right of line.
Definition: qgsgeometry.h:577
Class for doing transforms between two map coordinate systems.
qint64 QgsFeatureId
Definition: qgsfeature.h:37
Contains geometry relation and modification algorithms.
Use mitred joins.
Definition: qgsgeometry.h:592
Use beveled joins.
Definition: qgsgeometry.h:593
JoinStyle
Join styles for buffers.
Definition: qgsgeometry.h:589
QList< QgsPoint > QgsPointSequence
Flat cap (in line with start/end of line)
Definition: qgsgeometry.h:584
Represents a vector layer which manages a vector based data sets.
#define SIP_PYNAME(name)
Definition: qgis_sip.h:62