QGIS API Documentation  2.99.0-Master (d55fa22)
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 "qgspoint.h"
40 #include "qgspointv2.h"
41 
42 
43 class QgsGeometryEngine;
44 class QgsVectorLayer;
45 class QgsMapToPixel;
46 class QPainter;
47 class QgsPolygonV2;
49 
51 typedef QVector<QgsPoint> QgsPolyline;
52 
54 #ifndef SIP_RUN
55 typedef QVector<QgsPolyline> QgsPolygon;
56 #else
57 typedef QVector<QVector<QgsPoint>> QgsPolygon;
58 #endif
59 
61 #ifndef SIP_RUN
62 typedef QVector<QgsPoint> QgsMultiPoint;
63 #else
64 typedef QVector<QgsPoint> QgsMultiPoint;
65 #endif
66 
68 #ifndef SIP_RUN
69 typedef QVector<QgsPolyline> QgsMultiPolyline;
70 #else
71 typedef QVector<QVector<QgsPoint>> QgsMultiPolyline;
72 #endif
73 
75 #ifndef SIP_RUN
76 typedef QVector<QgsPolygon> QgsMultiPolygon;
77 #else
78 typedef QVector<QVector<QVector<QgsPoint>>> 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 QgsPoint &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  QgsPoint closestVertex( const QgsPoint &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 QgsPointV2 &point, int beforeVertex );
314 
321  bool moveVertex( double x, double y, int atVertex );
322 
329  bool moveVertex( const QgsPointV2 &p, int atVertex );
330 
341  bool deleteVertex( int atVertex );
342 
348  QgsPoint vertexAt( int atVertex ) const;
349 
355  double sqrDistToVertexAt( QgsPoint &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 QgsPoint &point, int &atVertex SIP_OUT ) const;
376 
387 #ifndef SIP_RUN
388  double closestSegmentWithContext( const QgsPoint &point, QgsPoint &minDistPoint, int &afterVertex, double *leftOf = nullptr, double epsilon = DEFAULT_SEGMENT_EPSILON ) const;
389 #else
390  double closestSegmentWithContext( const QgsPoint &point, QgsPoint &minDistPoint SIP_OUT, int &afterVertex SIP_OUT ) const;
391 #endif
392 
396  int addRing( const QList<QgsPoint> &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<QgsPoint> &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 QgsPoint &center );
477 
484  // TODO QGIS 3.0 returns an enum instead of a magic constant
485  int splitGeometry( const QList<QgsPoint> &splitLine,
486  QList<QgsGeometry> &newGeometries SIP_OUT,
487  bool topological,
488  QList<QgsPoint> &topologyTestPoints SIP_OUT );
489 
494  int reshapeGeometry( const QList<QgsPoint> &reshapeWithLine );
495 
500  int makeDifference( const QgsGeometry *other );
501 
508  QgsGeometry makeDifference( const QgsGeometry &other ) const;
509 
514  QgsRectangle boundingBox() const;
515 
523  QgsGeometry orientedMinimumBoundingBox( double &area SIP_OUT, double &angle SIP_OUT, double &width SIP_OUT, double &height SIP_OUT ) const;
524 
533  QgsGeometry orthogonalize( double tolerance = 1.0E-8, int maxIterations = 1000, double angleThreshold = 15.0 ) const;
534 
536  bool intersects( const QgsRectangle &r ) const;
537 
539  bool intersects( const QgsGeometry &geometry ) const;
540 
542  bool contains( const QgsPoint *p ) const;
543 
546  bool contains( const QgsGeometry &geometry ) const;
547 
550  bool disjoint( const QgsGeometry &geometry ) const;
551 
554  bool equals( const QgsGeometry &geometry ) const;
555 
558  bool touches( const QgsGeometry &geometry ) const;
559 
562  bool overlaps( const QgsGeometry &geometry ) const;
563 
566  bool within( const QgsGeometry &geometry ) const;
567 
570  bool crosses( const QgsGeometry &geometry ) const;
571 
574  {
575  SideLeft = 0,
577  };
578 
581  {
582  CapRound = 1,
585  };
586 
589  {
590  JoinStyleRound = 1,
593  };
594 
597  QgsGeometry buffer( double distance, int segments ) const;
598 
607  QgsGeometry buffer( double distance, int segments, EndCapStyle endCapStyle, JoinStyle joinStyle, double mitreLimit ) const;
608 
616  QgsGeometry offsetCurve( double distance, int segments, JoinStyle joinStyle, double mitreLimit ) const;
617 
630  QgsGeometry singleSidedBuffer( double distance, int segments, BufferSide side,
631  JoinStyle joinStyle = JoinStyleRound,
632  double mitreLimit = 2.0 ) const;
633 
640  QgsGeometry extendLine( double startDistance, double endDistance ) const;
641 
643  QgsGeometry simplify( double tolerance ) const;
644 
654  QgsGeometry densifyByCount( int extraNodesPerSegment ) const;
655 
670  QgsGeometry densifyByDistance( double distance ) const;
671 
679  QgsGeometry centroid() const;
680 
688  QgsGeometry pointOnSurface() const;
689 
702  QgsGeometry poleOfInaccessibility( double precision, double *distanceToBoundary SIP_OUT = nullptr ) const;
703 
705  QgsGeometry convexHull() const;
706 
722  QgsGeometry voronoiDiagram( const QgsGeometry &extent = QgsGeometry(), double tolerance = 0.0, bool edgesOnly = false ) const;
723 
733  QgsGeometry delaunayTriangulation( double tolerance = 0.0, bool edgesOnly = false ) const;
734 
740  QgsGeometry interpolate( double distance ) const;
741 
752  double lineLocatePoint( const QgsGeometry &point ) const;
753 
762  double interpolateAngle( double distance ) const;
763 
765  QgsGeometry intersection( const QgsGeometry &geometry ) const;
766 
771  QgsGeometry combine( const QgsGeometry &geometry ) const;
772 
780  QgsGeometry mergeLines() const;
781 
783  QgsGeometry difference( const QgsGeometry &geometry ) const;
784 
786  QgsGeometry symDifference( const QgsGeometry &geometry ) const;
787 
789  QgsGeometry extrude( double x, double y );
790 
794  QByteArray exportToWkb() const;
795 
800  QString exportToWkt( int precision = 17 ) const;
801 
808  QString exportToGeoJSON( int precision = 17 ) const;
809 
816  QgsGeometry convertToType( QgsWkbTypes::GeometryType destType, bool destMultipart = false ) const SIP_FACTORY;
817 
818  /* Accessor functions for getting geometry data */
819 
823  QgsPoint asPoint() const;
824 
828  QgsPolyline asPolyline() const;
829 
833  QgsPolygon asPolygon() const;
834 
837  QgsMultiPoint asMultiPoint() const;
838 
841  QgsMultiPolyline asMultiPolyline() const;
842 
845  QgsMultiPolygon asMultiPolygon() const;
846 
849  QList<QgsGeometry> asGeometryCollection() const;
850 
855  QPointF asQPointF() const;
856 
862  QPolygonF asQPolygonF() const;
863 
868  bool deleteRing( int ringNum, int partNum = 0 );
869 
873  bool deletePart( int partNum );
874 
883  bool convertToMultiType();
884 
894  bool convertToSingleType();
895 
905  int avoidIntersections( const QList<QgsVectorLayer *> &avoidIntersectionsLayers,
906  const QHash<QgsVectorLayer *, QSet<QgsFeatureId> > &ignoreFeatures SIP_PYARGREMOVE = ( QHash<QgsVectorLayer *, QSet<QgsFeatureId> >() ) );
907 
920  QgsGeometry makeValid();
921 
924  class CORE_EXPORT Error
925  {
926  QString message;
927  QgsPoint location;
928  bool hasLocation;
929 
930  public:
932  : message( QStringLiteral( "none" ) )
933  , hasLocation( false ) {}
934 
935  explicit Error( const QString &m )
936  : message( m )
937  , hasLocation( false ) {}
938 
939  Error( const QString &m, const QgsPoint &p )
940  : message( m )
941  , location( p )
942  , hasLocation( true ) {}
943 
944  QString what() { return message; }
945  QgsPoint where() { return location; }
946  bool hasWhere() { return hasLocation; }
947  };
948 
953  void validateGeometry( QList<QgsGeometry::Error> &errors SIP_OUT );
954 
959  static QgsGeometry unaryUnion( const QList<QgsGeometry> &geometries );
960 
969  static QgsGeometry polygonize( const QList< QgsGeometry> &geometries );
970 
975  void convertToStraightSegment();
976 
982  bool requiresConversionToStraightSegments() const;
983 
988  void mapToPixel( const QgsMapToPixel &mtp );
989 
990  // not implemented for 2.10
991  /* Clips the geometry using the specified rectangle
992  * \param rect clip rectangle
993  * \since QGIS 2.10
994  */
995  // void clip( const QgsRectangle& rect );
996 
1001  void draw( QPainter &p ) const;
1002 
1010  bool vertexIdFromVertexNr( int nr, QgsVertexId &id SIP_OUT ) const;
1011 
1018  int vertexNrFromVertexId( QgsVertexId i ) const;
1019 
1024  static GEOSContextHandle_t getGEOSHandler() SIP_SKIP;
1025 
1030  static QgsGeometry fromQPointF( QPointF point );
1031 
1038  static QgsGeometry fromQPolygonF( const QPolygonF &polygon );
1039 
1045  static QgsPolyline createPolylineFromQPolygonF( const QPolygonF &polygon ) SIP_FACTORY;
1046 
1052  static QgsPolygon createPolygonFromQPolygonF( const QPolygonF &polygon ) SIP_FACTORY;
1053 
1054 #ifndef SIP_RUN
1055 
1064  static bool compare( const QgsPolyline &p1, const QgsPolyline &p2,
1065  double epsilon = 4 * std::numeric_limits<double>::epsilon() );
1066 
1075  static bool compare( const QgsPolygon &p1, const QgsPolygon &p2,
1076  double epsilon = 4 * std::numeric_limits<double>::epsilon() );
1077 
1087  static bool compare( const QgsMultiPolygon &p1, const QgsMultiPolygon &p2,
1088  double epsilon = 4 * std::numeric_limits<double>::epsilon() );
1089 #else
1090 
1108  static bool compare( PyObject *obj1, PyObject *obj2, double epsilon = 4 * DBL_EPSILON );
1109  % MethodCode
1110  {
1111  sipRes = false;
1112  int state0;
1113  int state1;
1114  int sipIsErr = 0;
1115 
1116  if ( PyList_Check( a0 ) && PyList_Check( a1 ) &&
1117  PyList_GET_SIZE( a0 ) && PyList_GET_SIZE( a1 ) )
1118  {
1119  PyObject *o0 = PyList_GetItem( a0, 0 );
1120  PyObject *o1 = PyList_GetItem( a1, 0 );
1121  if ( o0 && o1 )
1122  {
1123  // compare polyline - polyline
1124  if ( sipCanConvertToType( o0, sipType_QgsPoint, SIP_NOT_NONE ) &&
1125  sipCanConvertToType( o1, sipType_QgsPoint, SIP_NOT_NONE ) &&
1126  sipCanConvertToType( a0, sipType_QVector_0100QgsPoint, SIP_NOT_NONE ) &&
1127  sipCanConvertToType( a1, sipType_QVector_0100QgsPoint, SIP_NOT_NONE ) )
1128  {
1129  QgsPolyline *p0;
1130  QgsPolyline *p1;
1131  p0 = reinterpret_cast<QgsPolyline *>( sipConvertToType( a0, sipType_QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
1132  p1 = reinterpret_cast<QgsPolyline *>( sipConvertToType( a1, sipType_QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
1133  if ( sipIsErr )
1134  {
1135  sipReleaseType( p0, sipType_QVector_0100QgsPoint, state0 );
1136  sipReleaseType( p1, sipType_QVector_0100QgsPoint, state1 );
1137  }
1138  else
1139  {
1140  sipRes = QgsGeometry::compare( *p0, *p1, a2 );
1141  }
1142  }
1143  else if ( PyList_Check( o0 ) && PyList_Check( o1 ) &&
1144  PyList_GET_SIZE( o0 ) && PyList_GET_SIZE( o1 ) )
1145  {
1146  PyObject *oo0 = PyList_GetItem( o0, 0 );
1147  PyObject *oo1 = PyList_GetItem( o1, 0 );
1148  if ( oo0 && oo1 )
1149  {
1150  // compare polygon - polygon
1151  if ( sipCanConvertToType( oo0, sipType_QgsPoint, SIP_NOT_NONE ) &&
1152  sipCanConvertToType( oo1, sipType_QgsPoint, SIP_NOT_NONE ) &&
1153  sipCanConvertToType( a0, sipType_QVector_0600QVector_0100QgsPoint, SIP_NOT_NONE ) &&
1154  sipCanConvertToType( a1, sipType_QVector_0600QVector_0100QgsPoint, SIP_NOT_NONE ) )
1155  {
1156  QgsPolygon *p0;
1157  QgsPolygon *p1;
1158  p0 = reinterpret_cast<QgsPolygon *>( sipConvertToType( a0, sipType_QVector_0600QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
1159  p1 = reinterpret_cast<QgsPolygon *>( sipConvertToType( a1, sipType_QVector_0600QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
1160  if ( sipIsErr )
1161  {
1162  sipReleaseType( p0, sipType_QVector_0600QVector_0100QgsPoint, state0 );
1163  sipReleaseType( p1, sipType_QVector_0600QVector_0100QgsPoint, state1 );
1164  }
1165  else
1166  {
1167  sipRes = QgsGeometry::compare( *p0, *p1, a2 );
1168  }
1169  }
1170  else if ( PyList_Check( oo0 ) && PyList_Check( oo1 ) &&
1171  PyList_GET_SIZE( oo0 ) && PyList_GET_SIZE( oo1 ) )
1172  {
1173  PyObject *ooo0 = PyList_GetItem( oo0, 0 );
1174  PyObject *ooo1 = PyList_GetItem( oo1, 0 );
1175  if ( ooo0 && ooo1 )
1176  {
1177  // compare multipolygon - multipolygon
1178  if ( sipCanConvertToType( ooo0, sipType_QgsPoint, SIP_NOT_NONE ) &&
1179  sipCanConvertToType( ooo1, sipType_QgsPoint, SIP_NOT_NONE ) &&
1180  sipCanConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, SIP_NOT_NONE ) &&
1181  sipCanConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, SIP_NOT_NONE ) )
1182  {
1183  QgsMultiPolygon *p0;
1184  QgsMultiPolygon *p1;
1185  p0 = reinterpret_cast<QgsMultiPolygon *>( sipConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
1186  p1 = reinterpret_cast<QgsMultiPolygon *>( sipConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
1187  if ( sipIsErr )
1188  {
1189  sipReleaseType( p0, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, state0 );
1190  sipReleaseType( p1, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, state1 );
1191  }
1192  else
1193  {
1194  sipRes = QgsGeometry::compare( *p0, *p1, a2 );
1195  }
1196  }
1197  }
1198  }
1199  }
1200  }
1201  }
1202  }
1203  }
1204  % End
1205 #endif
1206 
1218  QgsGeometry smooth( const unsigned int iterations = 1, const double offset = 0.25,
1219  double minimumDistance = -1.0, double maxAngle = 180.0 ) const;
1220 
1223  static QgsGeometryEngine *createGeometryEngine( const QgsAbstractGeometry *geometry ) SIP_FACTORY;
1224 
1229  static void convertPointList( const QList<QgsPoint> &input, QgsPointSequence &output );
1230 
1235  static void convertPointList( const QgsPointSequence &input, QList<QgsPoint> &output );
1236 
1238  operator QVariant() const
1239  {
1240  return QVariant::fromValue( *this );
1241  }
1242 
1247  operator bool() const;
1248 
1249  private:
1250 
1251  QgsGeometryPrivate *d; //implicitly shared data pointer
1252 
1253  void detach( bool cloneGeom = true ); //make sure mGeometry only referenced from this instance
1254 
1255  static void convertToPolyline( const QgsPointSequence &input, QgsPolyline &output );
1256  static void convertPolygon( const QgsPolygonV2 &input, QgsPolygon &output );
1257 
1259  QgsGeometry convertToPoint( bool destMultipart ) const;
1261  QgsGeometry convertToLine( bool destMultipart ) const;
1263  QgsGeometry convertToPolygon( bool destMultipart ) const;
1264 
1275  QgsLineString *smoothLine( const QgsLineString &line, const unsigned int iterations = 1, const double offset = 0.25,
1276  double minimumDistance = -1, double maxAngle = 180.0 ) const;
1277 
1288  QgsPolygonV2 *smoothPolygon( const QgsPolygonV2 &polygon, const unsigned int iterations = 1, const double offset = 0.25,
1289  double minimumDistance = -1, double maxAngle = 180.0 ) const;
1290 
1291 
1292 }; // class QgsGeometry
1293 
1295 
1296 CORE_EXPORT QDataStream &operator<<( QDataStream &out, const QgsGeometry &geometry );
1299 CORE_EXPORT QDataStream &operator>>( QDataStream &in, QgsGeometry &geometry );
1300 
1301 #endif
double ANALYSIS_EXPORT leftOf(Point3D *thepoint, Point3D *p1, Point3D *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 rectangle specified with double values.
Definition: qgsrectangle.h:38
QList< QgsPointV2 > QgsPointSequence
QgsPoint where()
Definition: qgsgeometry.h:945
Error(const QString &m)
Definition: qgsgeometry.h:935
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.
QVector< QgsPoint > QgsPolyline
Polyline is represented as a vector of points.
Definition: qgsgeometry.h:48
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:96
EndCapStyle
End cap styles for buffers.
Definition: qgsgeometry.h:580
Q_DECLARE_METATYPE(QModelIndex)
#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:328
#define SIP_SKIP
Definition: qgis_sip.h:87
Point geometry type, with support for z-dimension and m-values.
Definition: qgspointv2.h:37
#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
QVector< QgsPoint > QgsMultiPoint
A collection of QgsPoints that share a common collection of attributes.
Definition: qgsgeometry.h:62
Square cap (extends past start/end of line by buffer distance)
Definition: qgsgeometry.h:584
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.
A class to represent a point.
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.
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:573
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:107
#define SIP_OUT
Definition: qgis_sip.h:39
Line string geometry type, with support for z-dimension and m-values.
Definition: qgslinestring.h:40
Buffer to right of line.
Definition: qgsgeometry.h:576
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:591
Use beveled joins.
Definition: qgsgeometry.h:592
JoinStyle
Join styles for buffers.
Definition: qgsgeometry.h:588
Flat cap (in line with start/end of line)
Definition: qgsgeometry.h:583
Represents a vector layer which manages a vector based data sets.
double ANALYSIS_EXPORT angle(Point3D *p1, Point3D *p2, Point3D *p3, Point3D *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
Definition: MathUtils.cc:857
Error(const QString &m, const QgsPoint &p)
Definition: qgsgeometry.h:939
#define SIP_PYNAME(name)
Definition: qgis_sip.h:62