QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgsgeometry.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgeometry.h - Geometry (stored as Open Geospatial Consortium WKB)
3 -------------------------------------------------------------------
4Date : 02 May 2005
5Copyright : (C) 2005 by Brendan Morley
6email : 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 <functional>
20
21#include <QDomDocument>
22#include <QJsonObject>
23#include <QSet>
24#include <QString>
25#include <QVector>
26
27#include <climits>
28#include <limits>
29#include <memory>
30
31#include "qgis_core.h"
32#include "qgis_sip.h"
33
34#include "qgsabstractgeometry.h"
35#include "qgspointxy.h"
36#include "qgspoint.h"
37#include "qgsfeatureid.h"
38#include "qgsvertexid.h"
39
40#ifndef SIP_RUN
41#include "json_fwd.hpp"
42using namespace nlohmann;
43#endif
44
46class QgsVectorLayer;
47class QgsMapToPixel;
48class QPainter;
49class QgsPolygon;
50class QgsLineString;
51class QgsCurve;
52class QgsFeedback;
53
63typedef QVector<QgsPointXY> QgsPolylineXY;
64
73
75#ifndef SIP_RUN
76typedef QVector<QgsPolylineXY> QgsPolygonXY;
77#else
78typedef QVector<QVector<QgsPointXY>> QgsPolygonXY;
79#endif
80
82typedef QVector<QgsPointXY> QgsMultiPointXY;
83
85#ifndef SIP_RUN
86typedef QVector<QgsPolylineXY> QgsMultiPolylineXY;
87#else
88typedef QVector<QVector<QgsPointXY>> QgsMultiPolylineXY;
89#endif
90
92#ifndef SIP_RUN
93typedef QVector<QgsPolygonXY> QgsMultiPolygonXY;
94#else
95typedef QVector<QVector<QVector<QgsPointXY>>> QgsMultiPolygonXY;
96#endif
97
98class QgsRectangle;
99
100class QgsConstWkbPtr;
101
102struct QgsGeometryPrivate;
103
110class CORE_EXPORT QgsGeometryParameters
111{
112 public:
113
124 double gridSize() const { return mGridSize; }
125
136 void setGridSize( double size ) { mGridSize = size; }
137
138 private:
139
140 double mGridSize = -1;
141};
142
163class CORE_EXPORT QgsGeometry
164{
165 Q_GADGET
166 Q_PROPERTY( bool isNull READ isNull )
167 Q_PROPERTY( Qgis::GeometryType type READ type )
168
169 public:
170
173
175 QgsGeometry( const QgsGeometry & );
176
181 QgsGeometry &operator=( QgsGeometry const &rhs ) SIP_SKIP;
182
189
195 explicit QgsGeometry( std::unique_ptr< QgsAbstractGeometry > geom ) SIP_SKIP;
196
197 virtual ~QgsGeometry();
198
210 const QgsAbstractGeometry *constGet() const SIP_HOLDGIL;
211
224 QgsAbstractGeometry *get();
225
238 void set( QgsAbstractGeometry *geometry SIP_TRANSFER ) SIP_DEPRECATED;
239
248 bool isNull() const SIP_HOLDGIL;
249
251 static QgsGeometry fromWkt( const QString &wkt );
253 static QgsGeometry fromPointXY( const QgsPointXY &point ) SIP_HOLDGIL;
254
260 static QgsGeometry fromPoint( const QgsPoint &point ) SIP_HOLDGIL;
261
263 static QgsGeometry fromMultiPointXY( const QgsMultiPointXY &multipoint );
264
276 static QgsGeometry fromPolylineXY( const QgsPolylineXY &polyline );
277
287 static QgsGeometry fromPolyline( const QgsPolyline &polyline );
288
292 static QgsGeometry fromMultiPolylineXY( const QgsMultiPolylineXY &multiline );
293
294#ifndef SIP_RUN
295
299#else
300
318#endif
319 static QgsGeometry fromPolygonXY( const QgsPolygonXY &polygon );
320
324 static QgsGeometry fromMultiPolygonXY( const QgsMultiPolygonXY &multipoly );
325
327 static QgsGeometry fromRect( const QgsRectangle &rect ) SIP_HOLDGIL;
328
334 static QgsGeometry fromBox3D( const QgsBox3D &box ) SIP_HOLDGIL;
335
336
338 static QgsGeometry collectGeometry( const QVector<QgsGeometry> &geometries );
339
355 static QgsGeometry createWedgeBuffer( const QgsPoint &center, double azimuth, double angularWidth,
356 double outerRadius, double innerRadius = 0 );
357
363 void fromWkb( unsigned char *wkb, int length ) SIP_SKIP;
364
369 void fromWkb( const QByteArray &wkb );
370
375 Qgis::WkbType wkbType() const SIP_HOLDGIL;
376
381 Qgis::GeometryType type() const SIP_HOLDGIL;
382
389 bool isEmpty() const;
390
392 bool isMultipart() const SIP_HOLDGIL;
393
408 bool equals( const QgsGeometry &geometry ) const;
409
426 bool isGeosEqual( const QgsGeometry & ) const;
427
435 bool isGeosValid( Qgis::GeometryValidityFlags flags = Qgis::GeometryValidityFlags() ) const;
436
445 bool isSimple() const;
446
460 bool isAxisParallelRectangle( double maximumDeviation, bool simpleRectanglesOnly = false ) const;
461
474 double area() const;
475
490 double length() const;
491
499 double distance( const QgsGeometry &geom ) const;
500
501#ifndef SIP_RUN
502
503 // TODO QGIS 4: consider renaming vertices_begin, vertices_end, parts_begin, parts_end, etc
504 // to camelCase
505
510 QgsAbstractGeometry::vertex_iterator vertices_begin() const;
511
516 QgsAbstractGeometry::vertex_iterator vertices_end() const;
517#endif
518
542 QgsVertexIterator vertices() const;
543
544#ifndef SIP_RUN
545
555
565
574 QgsAbstractGeometry::const_part_iterator const_parts_begin() const;
575
584 QgsAbstractGeometry::const_part_iterator const_parts_end() const;
585#endif
586
625
658 QgsGeometryConstPartIterator constParts() const;
659
677 double hausdorffDistance( const QgsGeometry &geom ) const;
678
697 double hausdorffDistanceDensify( const QgsGeometry &geom, double densifyFraction ) const;
698
713 double frechetDistance( const QgsGeometry &geom ) const SIP_THROW( QgsNotSupportedException );
714
737 double frechetDistanceDensify( const QgsGeometry &geom, double densifyFraction ) const SIP_THROW( QgsNotSupportedException );
738
751 QgsPointXY closestVertex( const QgsPointXY &point, int &closestVertexIndex SIP_OUT, int &previousVertexIndex SIP_OUT, int &nextVertexIndex SIP_OUT, double &sqrDist SIP_OUT ) const;
752
761 double distanceToVertex( int vertex ) const;
762
770 double angleAtVertex( int vertex ) const;
771
784 void adjacentVertices( int atVertex, int &beforeVertex SIP_OUT, int &afterVertex SIP_OUT ) const;
785
798 bool insertVertex( double x, double y, int beforeVertex );
799
812 bool insertVertex( const QgsPoint &point, int beforeVertex );
813
821 bool moveVertex( double x, double y, int atVertex );
822
830 bool moveVertex( const QgsPoint &p, int atVertex );
831
843 bool deleteVertex( int atVertex );
844
852 bool toggleCircularAtVertex( int atVertex );
853
859 QgsPoint vertexAt( int atVertex ) const;
860
866 double sqrDistToVertexAt( QgsPointXY &point SIP_IN, int atVertex ) const;
867
873 QgsGeometry nearestPoint( const QgsGeometry &other ) const;
874
885 QgsGeometry shortestLine( const QgsGeometry &other ) const;
886
893 double closestVertexWithContext( const QgsPointXY &point, int &atVertex SIP_OUT ) const;
894
906 double closestSegmentWithContext( const QgsPointXY &point, QgsPointXY &minDistPoint SIP_OUT, int &nextVertexIndex SIP_OUT, int *leftOrRightOfSegment SIP_OUT = nullptr, double epsilon = DEFAULT_SEGMENT_EPSILON ) const;
907
913 Qgis::GeometryOperationResult addRing( const QVector<QgsPointXY> &ring );
914
921
928 Qgis::GeometryOperationResult addPart( const QVector<QgsPointXY> &points, Qgis::GeometryType geomType = Qgis::GeometryType::Unknown ) SIP_PYNAME( addPointsXY );
929
937
945
951 Qgis::GeometryOperationResult addPart( const QgsGeometry &newPart ) SIP_PYNAME( addPartGeometry );
952
959 QgsGeometry removeInteriorRings( double minimumAllowedArea = -1 ) const;
960
965 Qgis::GeometryOperationResult translate( double dx, double dy, double dz = 0.0, double dm = 0.0 );
966
982
991 Qgis::GeometryOperationResult transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
992
999 Qgis::GeometryOperationResult rotate( double rotation, const QgsPointXY &center );
1000
1011 Q_DECL_DEPRECATED Qgis::GeometryOperationResult splitGeometry( const QVector<QgsPointXY> &splitLine, QVector<QgsGeometry> &newGeometries, bool topological, QVector<QgsPointXY> &topologyTestPoints, bool splitFeature = true ) SIP_SKIP;
1012
1035 Qgis::GeometryOperationResult splitGeometry( const QgsPointSequence &splitLine, QVector<QgsGeometry> &newGeometries SIP_OUT, bool topological, QgsPointSequence &topologyTestPoints SIP_OUT, bool splitFeature = true, bool skipIntersectionTest SIP_PYARGREMOVE = false ) SIP_SKIP;
1036
1037
1038 /*
1039 This SIP code is to support overloaded methods of splitGeometry.
1040 When the deprecated method is removed in QGIS 4.0 this code can be dropped
1041 TODO QGIS 4 remove MethodCode
1042 */
1043#ifdef SIP_RUN
1044
1063 SIP_PYOBJECT splitGeometry( SIP_PYOBJECT splitLine SIP_TYPEHINT( List[Union[QgsPoint, QgsPointXY]] ), bool topological, bool splitFeature = true ) SIP_TYPEHINT( Tuple[Qgis.GeometryOperationResult, Union[List[QgsPoint], List[QgsPointXY]], Union[List[QgsPoint], List[QgsPointXY]]] );
1064 % MethodCode
1065 {
1066 int sipIsErr = 0;
1067 int state;
1068
1069 if ( PyList_Check( a0 ) && PyList_GET_SIZE( a0 ) )
1070 {
1071 PyObject *p0 = PyList_GetItem( a0, 0 );
1072 if ( sipCanConvertToType( p0, sipType_QgsPointXY, SIP_NOT_NONE ) &&
1073 sipCanConvertToType( a0, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) )
1074 {
1075 QVector<QgsGeometry> newGeometries;
1076 QVector<QgsPointXY> topologyTestPoints;
1077
1078 QVector<QgsPointXY> *splitLine = reinterpret_cast<QVector<QgsPointXY> *>( sipConvertToType( a0, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
1079 if ( sipIsErr )
1080 {
1081 sipReleaseType( splitLine, sipType_QVector_0100QgsPointXY, state );
1082 }
1083 else
1084 {
1085 Qgis::GeometryOperationResult result = sipCpp->splitGeometry( *splitLine, newGeometries, a1, topologyTestPoints, a2 );
1086
1087 PyObject *o0 = sipConvertFromEnum( static_cast<int>( result ), sipType_Qgis_GeometryOperationResult );
1088 PyObject *o1 = sipConvertFromType( &newGeometries, sipType_QVector_0100QgsGeometry, Py_None );
1089 PyObject *o2 = sipConvertFromType( &topologyTestPoints, sipType_QVector_0100QgsPointXY, Py_None );
1090
1091 sipRes = PyTuple_New( 3 );
1092 PyTuple_SET_ITEM( sipRes, 0, o0 );
1093 PyTuple_SET_ITEM( sipRes, 1, o1 );
1094 PyTuple_SET_ITEM( sipRes, 2, o2 );
1095 }
1096 }
1097
1098 else if ( sipCanConvertToType( p0, sipType_QgsPoint, SIP_NOT_NONE ) &&
1099 sipCanConvertToType( a0, sipType_QVector_0100QgsPoint, SIP_NOT_NONE ) )
1100 {
1101 QVector<QgsGeometry> newGeometries;
1102 QVector<QgsPoint> topologyTestPoints;
1103
1104 QVector<QgsPoint> *splitLine = reinterpret_cast<QVector<QgsPoint> *>( sipConvertToType( a0, sipType_QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
1105 if ( sipIsErr )
1106 {
1107 sipReleaseType( splitLine, sipType_QVector_0100QgsPoint, state );
1108 }
1109 else
1110 {
1111 Qgis::GeometryOperationResult result = sipCpp->splitGeometry( *splitLine, newGeometries, a1, topologyTestPoints, a2 );
1112
1113 PyObject *o0 = sipConvertFromEnum( static_cast<int>( result ), sipType_Qgis_GeometryOperationResult );
1114 PyObject *o1 = sipConvertFromType( &newGeometries, sipType_QVector_0100QgsGeometry, Py_None );
1115 PyObject *o2 = sipConvertFromType( &topologyTestPoints, sipType_QVector_0100QgsPoint, Py_None );
1116
1117 sipRes = PyTuple_New( 3 );
1118 PyTuple_SET_ITEM( sipRes, 0, o0 );
1119 PyTuple_SET_ITEM( sipRes, 1, o1 );
1120 PyTuple_SET_ITEM( sipRes, 2, o2 );
1121 }
1122 }
1123 else
1124 {
1125 sipIsErr = 1;
1126 PyErr_SetString( PyExc_TypeError, QStringLiteral( "Could not convert first argument to a list of QgsPoint or QgsPointXY." ).toUtf8().constData() );
1127 }
1128 }
1129 else
1130 {
1131 sipIsErr = 1;
1132 PyErr_SetString( PyExc_TypeError, QStringLiteral( "First argument is not a list of points or is empty." ).toUtf8().constData() );
1133 }
1134 }
1135 % End
1136#endif
1137
1149 Qgis::GeometryOperationResult splitGeometry( const QgsCurve *curve, QVector<QgsGeometry> &newGeometries SIP_OUT, bool preserveCircular, bool topological, QgsPointSequence &topologyTestPoints SIP_OUT, bool splitFeature = true );
1150
1155 Qgis::GeometryOperationResult reshapeGeometry( const QgsLineString &reshapeLineString );
1156
1162 int makeDifferenceInPlace( const QgsGeometry &other ) SIP_SKIP;
1163
1171 QgsGeometry makeDifference( const QgsGeometry &other ) const;
1172
1177 QgsRectangle boundingBox() const;
1178
1184 QgsBox3D boundingBox3D() const;
1185
1197 QgsGeometry orientedMinimumBoundingBox( double &area SIP_OUT, double &angle SIP_OUT, double &width SIP_OUT, double &height SIP_OUT ) const;
1198
1208 QgsGeometry orientedMinimumBoundingBox() const SIP_SKIP;
1209
1218 QgsGeometry minimalEnclosingCircle( QgsPointXY &center SIP_OUT, double &radius SIP_OUT, unsigned int segments = 36 ) const;
1219
1225 QgsGeometry minimalEnclosingCircle( unsigned int segments = 36 ) const SIP_SKIP;
1226
1235 QgsGeometry orthogonalize( double tolerance = 1.0E-8, int maxIterations = 1000, double angleThreshold = 15.0 ) const;
1236
1249 QgsGeometry triangularWaves( double wavelength, double amplitude, bool strictWavelength = false ) const;
1250
1269 QgsGeometry triangularWavesRandomized( double minimumWavelength, double maximumWavelength, double minimumAmplitude, double maximumAmplitude, unsigned long seed = 0 ) const;
1270
1283 QgsGeometry squareWaves( double wavelength, double amplitude, bool strictWavelength = false ) const;
1284
1303 QgsGeometry squareWavesRandomized( double minimumWavelength, double maximumWavelength, double minimumAmplitude, double maximumAmplitude, unsigned long seed = 0 ) const;
1304
1317 QgsGeometry roundWaves( double wavelength, double amplitude, bool strictWavelength = false ) const;
1318
1337 QgsGeometry roundWavesRandomized( double minimumWavelength, double maximumWavelength, double minimumAmplitude, double maximumAmplitude, unsigned long seed = 0 ) const;
1338
1352 QgsGeometry applyDashPattern( const QVector< double > &pattern,
1353 Qgis::DashPatternLineEndingRule startRule = Qgis::DashPatternLineEndingRule::NoRule,
1354 Qgis::DashPatternLineEndingRule endRule = Qgis::DashPatternLineEndingRule::NoRule,
1355 Qgis::DashPatternSizeAdjustment adjustment = Qgis::DashPatternSizeAdjustment::ScaleBothDashAndGap,
1356 double patternOffset = 0 ) const;
1357
1370 QgsGeometry snappedToGrid( double hSpacing, double vSpacing, double dSpacing = 0, double mSpacing = 0 ) const;
1371
1392 bool removeDuplicateNodes( double epsilon = 4 * std::numeric_limits<double>::epsilon(), bool useZValues = false );
1393
1403 bool intersects( const QgsRectangle &rectangle ) const;
1404
1419 bool intersects( const QgsGeometry &geometry ) const;
1420
1430 bool boundingBoxIntersects( const QgsRectangle &rectangle ) const;
1431
1441 bool boundingBoxIntersects( const QgsGeometry &geometry ) const;
1442
1446 bool contains( const QgsPointXY *p ) const;
1447
1458 bool contains( const QgsGeometry &geometry ) const;
1459
1470 bool disjoint( const QgsGeometry &geometry ) const;
1471
1482 bool touches( const QgsGeometry &geometry ) const;
1483
1494 bool overlaps( const QgsGeometry &geometry ) const;
1495
1506 bool within( const QgsGeometry &geometry ) const;
1507
1518 bool crosses( const QgsGeometry &geometry ) const;
1519
1527 QgsGeometry buffer( double distance, int segments ) const;
1528
1541 QgsGeometry buffer( double distance, int segments, Qgis::EndCapStyle endCapStyle, Qgis::JoinStyle joinStyle, double miterLimit ) const;
1542
1551 QgsGeometry offsetCurve( double distance, int segments, Qgis::JoinStyle joinStyle, double miterLimit ) const;
1552
1568 QgsGeometry singleSidedBuffer( double distance, int segments, Qgis::BufferSide side,
1569 Qgis::JoinStyle joinStyle = Qgis::JoinStyle::Round,
1570 double miterLimit = 2.0 ) const;
1571
1589 QgsGeometry taperedBuffer( double startWidth, double endWidth, int segments ) const;
1590
1605 QgsGeometry variableWidthBufferByM( int segments ) const;
1606
1613 QgsGeometry extendLine( double startDistance, double endDistance ) const;
1614
1616 QgsGeometry simplify( double tolerance ) const;
1617
1627 QgsGeometry densifyByCount( int extraNodesPerSegment ) const;
1628
1643 QgsGeometry densifyByDistance( double distance ) const;
1644
1660 QgsGeometry convertToCurves( double distanceTolerance = 1e-8, double angleTolerance = 1e-8 ) const;
1661
1675 QgsGeometry centroid() const;
1676
1690 QgsGeometry pointOnSurface() const;
1691
1704 QgsGeometry poleOfInaccessibility( double precision, double *distanceToBoundary SIP_OUT = nullptr ) const;
1705
1729 QgsGeometry largestEmptyCircle( double tolerance, const QgsGeometry &boundary = QgsGeometry() ) const SIP_THROW( QgsNotSupportedException );
1730
1745 QgsGeometry minimumWidth() const SIP_THROW( QgsNotSupportedException );
1746
1768 double minimumClearance() const SIP_THROW( QgsNotSupportedException );
1769
1781 QgsGeometry minimumClearanceLine() const SIP_THROW( QgsNotSupportedException );
1782
1791 QgsGeometry convexHull() const;
1792
1806 QgsGeometry concaveHull( double targetPercent, bool allowHoles = false ) const SIP_THROW( QgsNotSupportedException );
1807
1823 QgsGeometry voronoiDiagram( const QgsGeometry &extent = QgsGeometry(), double tolerance = 0.0, bool edgesOnly = false ) const;
1824
1834 QgsGeometry delaunayTriangulation( double tolerance = 0.0, bool edgesOnly = false ) const;
1835
1846 QgsGeometry node() const;
1847
1862 QgsGeometry sharedPaths( const QgsGeometry &other ) const;
1863
1886 QgsGeometry subdivide( int maxNodes = 256, const QgsGeometryParameters &parameters = QgsGeometryParameters() ) const;
1887
1903 QgsGeometry interpolate( double distance ) const;
1904
1916 double lineLocatePoint( const QgsGeometry &point ) const;
1917
1927 double interpolateAngle( double distance ) const;
1928
1940 QgsGeometry intersection( const QgsGeometry &geometry, const QgsGeometryParameters &parameters = QgsGeometryParameters() ) const;
1941
1949 QgsGeometry clipped( const QgsRectangle &rectangle );
1950
1965 QgsGeometry combine( const QgsGeometry &geometry, const QgsGeometryParameters &parameters = QgsGeometryParameters() ) const;
1966
1975 QgsGeometry mergeLines() const;
1976
1988 QgsGeometry difference( const QgsGeometry &geometry, const QgsGeometryParameters &parameters = QgsGeometryParameters() ) const;
1989
2001 QgsGeometry symDifference( const QgsGeometry &geometry, const QgsGeometryParameters &parameters = QgsGeometryParameters() ) const;
2002
2004 QgsGeometry extrude( double x, double y );
2005
2006#ifndef SIP_RUN
2007
2029 QVector< QgsPointXY > randomPointsInPolygon( int count, const std::function< bool( const QgsPointXY & ) > &acceptPoint, unsigned long seed = 0, QgsFeedback *feedback = nullptr, int maxTriesPerPoint = 0 ) const;
2030
2044 QVector< QgsPointXY > randomPointsInPolygon( int count, unsigned long seed = 0, QgsFeedback *feedback = nullptr ) const;
2046#else
2047
2061 SIP_PYOBJECT randomPointsInPolygon( int count, unsigned long seed = 0 ) const SIP_TYPEHINT( QgsPolylineXY );
2062 % MethodCode
2063 const Qgis::GeometryType type = sipCpp->type();
2064 if ( sipCpp->isNull() )
2065 {
2066 PyErr_SetString( PyExc_ValueError, QStringLiteral( "Cannot generate points inside a null geometry." ).toUtf8().constData() );
2067 sipIsErr = 1;
2068 }
2069 else if ( type != Qgis::GeometryType::Polygon )
2070 {
2071 PyErr_SetString( PyExc_TypeError, QStringLiteral( "Cannot generate points inside a %1 geometry. Only Polygon types are permitted." ).arg( QgsWkbTypes::displayString( sipCpp->wkbType() ) ).toUtf8().constData() );
2072 sipIsErr = 1;
2073 }
2074 else
2075 {
2076 const sipTypeDef *qvector_type = sipFindType( "QVector<QgsPointXY>" );
2077 sipRes = sipConvertFromNewType( new QVector< QgsPointXY >( sipCpp->randomPointsInPolygon( a0, a1 ) ), qvector_type, Py_None );
2078 }
2079 % End
2080
2081
2082#endif
2084
2092 int wkbSize( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const;
2093
2101 QByteArray asWkb( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const;
2102
2108 QString asWkt( int precision = 17 ) const;
2109
2110#ifdef SIP_RUN
2111 SIP_PYOBJECT __repr__();
2112 % MethodCode
2113 QString str;
2114 if ( sipCpp->isNull() )
2115 str = QStringLiteral( "<QgsGeometry: null>" );
2116 else
2117 {
2118 QString wkt = sipCpp->asWkt();
2119 if ( wkt.length() > 1000 )
2120 wkt = wkt.left( 1000 ) + QStringLiteral( "..." );
2121 str = QStringLiteral( "<QgsGeometry: %1>" ).arg( wkt );
2122 }
2123 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
2124 % End
2125#endif
2126
2130 QString asJson( int precision = 17 ) const;
2131
2137 virtual json asJsonObject( int precision = 17 ) const SIP_SKIP;
2138
2165 QVector< QgsGeometry > coerceToType( Qgis::WkbType type, double defaultZ = 0, double defaultM = 0 ) const;
2166
2179 QgsGeometry convertToType( Qgis::GeometryType destType, bool destMultipart = false ) const;
2180
2181 /* Accessor functions for getting geometry data */
2182
2183#ifndef SIP_RUN
2184
2193 QgsPointXY asPoint() const;
2194#else
2195
2206 SIP_PYOBJECT asPoint() const SIP_TYPEHINT( QgsPointXY );
2207 % MethodCode
2208 if ( sipCpp->isNull() )
2209 {
2210 PyErr_SetString( PyExc_ValueError, QStringLiteral( "Null geometry cannot be converted to a point." ).toUtf8().constData() );
2211 sipIsErr = 1;
2212 }
2213 else
2214 {
2215 const QgsAbstractGeometry *geom = sipCpp->constGet();
2217 {
2218 PyErr_SetString( PyExc_TypeError, QStringLiteral( "%1 geometry cannot be converted to a point. Only Point types are permitted." ).arg( QgsWkbTypes::displayString( geom->wkbType() ) ).toUtf8().constData() );
2219 sipIsErr = 1;
2220 }
2221 else
2222 {
2223 sipRes = sipConvertFromNewType( new QgsPointXY( sipCpp->asPoint() ), sipType_QgsPointXY, Py_None );
2224 }
2225 }
2226 % End
2227#endif
2228
2229#ifndef SIP_RUN
2230
2239 QgsPolylineXY asPolyline() const;
2240#else
2241
2253 SIP_PYOBJECT asPolyline() const SIP_TYPEHINT( QgsPolylineXY );
2254 % MethodCode
2255 const Qgis::WkbType type = sipCpp->wkbType();
2256 if ( sipCpp->isNull() )
2257 {
2258 PyErr_SetString( PyExc_ValueError, QStringLiteral( "Null geometry cannot be converted to a polyline." ).toUtf8().constData() );
2259 sipIsErr = 1;
2260 }
2262 {
2263 PyErr_SetString( PyExc_TypeError, QStringLiteral( "%1 geometry cannot be converted to a polyline. Only single line or curve types are permitted." ).arg( QgsWkbTypes::displayString( type ) ).toUtf8().constData() );
2264 sipIsErr = 1;
2265 }
2266 else
2267 {
2268 const sipTypeDef *qvector_type = sipFindType( "QVector< QgsPointXY >" );
2269 sipRes = sipConvertFromNewType( new QgsPolylineXY( sipCpp->asPolyline() ), qvector_type, Py_None );
2270 }
2271 % End
2272#endif
2273
2274#ifndef SIP_RUN
2275
2284 QgsPolygonXY asPolygon() const;
2285#else
2286
2298 SIP_PYOBJECT asPolygon() const SIP_TYPEHINT( QgsPolygonXY );
2299 % MethodCode
2300 const Qgis::WkbType type = sipCpp->wkbType();
2301 if ( sipCpp->isNull() )
2302 {
2303 PyErr_SetString( PyExc_ValueError, QStringLiteral( "Null geometry cannot be converted to a polygon." ).toUtf8().constData() );
2304 sipIsErr = 1;
2305 }
2307 {
2308 PyErr_SetString( PyExc_TypeError, QStringLiteral( "%1 geometry cannot be converted to a polygon. Only single polygon or curve polygon types are permitted." ).arg( QgsWkbTypes::displayString( type ) ).toUtf8().constData() );
2309 sipIsErr = 1;
2310 }
2311 else
2312 {
2313 const sipTypeDef *qvector_type = sipFindType( "QVector<QVector<QgsPointXY>>" );
2314 sipRes = sipConvertFromNewType( new QgsPolygonXY( sipCpp->asPolygon() ), qvector_type, Py_None );
2315 }
2316 % End
2317#endif
2318
2319#ifndef SIP_RUN
2320
2328 QgsMultiPointXY asMultiPoint() const;
2329#else
2330
2341 SIP_PYOBJECT asMultiPoint() const SIP_TYPEHINT( QgsMultiPointXY );
2342 % MethodCode
2343 const Qgis::WkbType type = sipCpp->wkbType();
2344 if ( sipCpp->isNull() )
2345 {
2346 PyErr_SetString( PyExc_ValueError, QStringLiteral( "Null geometry cannot be converted to a multipoint." ).toUtf8().constData() );
2347 sipIsErr = 1;
2348 }
2350 {
2351 PyErr_SetString( PyExc_TypeError, QStringLiteral( "%1 geometry cannot be converted to a multipoint. Only multipoint types are permitted." ).arg( QgsWkbTypes::displayString( type ) ).toUtf8().constData() );
2352 sipIsErr = 1;
2353 }
2354 else
2355 {
2356 const sipTypeDef *qvector_type = sipFindType( "QVector< QgsPointXY >" );
2357 sipRes = sipConvertFromNewType( new QgsPolylineXY( sipCpp->asMultiPoint() ), qvector_type, Py_None );
2358 }
2359 % End
2360#endif
2361
2362#ifndef SIP_RUN
2363
2372 QgsMultiPolylineXY asMultiPolyline() const;
2373#else
2374
2386 SIP_PYOBJECT asMultiPolyline() const SIP_TYPEHINT( QgsMultiPolylineXY );
2387 % MethodCode
2388 const Qgis::WkbType type = sipCpp->wkbType();
2389 if ( sipCpp->isNull() )
2390 {
2391 PyErr_SetString( PyExc_ValueError, QStringLiteral( "Null geometry cannot be converted to a multilinestring." ).toUtf8().constData() );
2392 sipIsErr = 1;
2393 }
2395 {
2396 PyErr_SetString( PyExc_TypeError, QStringLiteral( "%1 geometry cannot be converted to a multilinestring. Only multi linestring or curves are permitted." ).arg( QgsWkbTypes::displayString( type ) ).toUtf8().constData() );
2397 sipIsErr = 1;
2398 }
2399 else
2400 {
2401 const sipTypeDef *qvector_type = sipFindType( "QVector<QVector<QgsPointXY>>" );
2402 sipRes = sipConvertFromNewType( new QgsMultiPolylineXY( sipCpp->asMultiPolyline() ), qvector_type, Py_None );
2403 }
2404 % End
2405#endif
2406
2407#ifndef SIP_RUN
2408
2417 QgsMultiPolygonXY asMultiPolygon() const;
2418#else
2419
2431 SIP_PYOBJECT asMultiPolygon() const SIP_TYPEHINT( QgsMultiPolygonXY );
2432 % MethodCode
2433 const Qgis::WkbType type = sipCpp->wkbType();
2434 if ( sipCpp->isNull() )
2435 {
2436 PyErr_SetString( PyExc_ValueError, QStringLiteral( "Null geometry cannot be converted to a multipolygon." ).toUtf8().constData() );
2437 sipIsErr = 1;
2438 }
2440 {
2441 PyErr_SetString( PyExc_TypeError, QStringLiteral( "%1 geometry cannot be converted to a multipolygon. Only multi polygon or curves are permitted." ).arg( QgsWkbTypes::displayString( type ) ).toUtf8().constData() );
2442 sipIsErr = 1;
2443 }
2444 else
2445 {
2446 const sipTypeDef *qvector_type = sipFindType( "QVector<QVector<QVector<QgsPointXY>>>" );
2447 sipRes = sipConvertFromNewType( new QgsMultiPolygonXY( sipCpp->asMultiPolygon() ), qvector_type, Py_None );
2448 }
2449 % End
2450#endif
2451
2456 QVector<QgsGeometry> asGeometryCollection() const;
2457
2463 QPointF asQPointF() const SIP_HOLDGIL;
2464
2477 QPolygonF asQPolygonF() const SIP_HOLDGIL;
2478
2485 bool deleteRing( int ringNum, int partNum = 0 );
2486
2492 bool deletePart( int partNum );
2493
2502 bool convertToMultiType();
2503
2519 bool convertToCurvedMultiType();
2520
2530 bool convertToSingleType();
2531
2541 bool convertGeometryCollectionToSubclass( Qgis::GeometryType geomType );
2542
2555 Q_DECL_DEPRECATED int avoidIntersections( const QList<QgsVectorLayer *> &avoidIntersectionsLayers,
2556 const QHash<QgsVectorLayer *, QSet<QgsFeatureId> > &ignoreFeatures SIP_PYARGREMOVE = ( QHash<QgsVectorLayer *, QSet<QgsFeatureId> >() ) ) SIP_DEPRECATED;
2557
2569 Qgis::GeometryOperationResult avoidIntersectionsV2( const QList<QgsVectorLayer *> &avoidIntersectionsLayers,
2570 const QHash<QgsVectorLayer *, QSet<QgsFeatureId> > &ignoreFeatures SIP_PYARGREMOVE = ( QHash<QgsVectorLayer *, QSet<QgsFeatureId> >() ) );
2571
2593 QgsGeometry makeValid( Qgis::MakeValidMethod method = Qgis::MakeValidMethod::Linework, bool keepCollapsed = false ) const SIP_THROW( QgsNotSupportedException );
2594
2607 QgsGeometry forceRHR() const;
2608
2617 QgsGeometry forcePolygonClockwise() const;
2618
2627 QgsGeometry forcePolygonCounterClockwise() const;
2628
2633 class CORE_EXPORT Error
2634 {
2635 public:
2637 : mMessage( QStringLiteral( "none" ) )
2638 {}
2639
2640 explicit Error( const QString &m )
2641 : mMessage( m )
2642 {}
2643
2644 Error( const QString &m, const QgsPointXY &p )
2645 : mMessage( m )
2646 , mLocation( p )
2647 , mHasLocation( true ) {}
2648
2652 QString what() const;
2653
2657 QgsPointXY where() const;
2658
2662 bool hasWhere() const;
2663
2664#ifdef SIP_RUN
2665 SIP_PYOBJECT __repr__();
2666 % MethodCode
2667 QString str = QStringLiteral( "<QgsGeometry.Error: %1>" ).arg( sipCpp->what() );
2668 sipRes = PyUnicode_FromString( str.toUtf8().data() );
2669 % End
2670#endif
2671
2672 // TODO c++20 - replace with = default
2673 bool operator==( const QgsGeometry::Error &other ) const
2674 {
2675 return other.mMessage == mMessage && other.mHasLocation == mHasLocation && other.mLocation == mLocation;
2676 }
2677
2678 private:
2679 QString mMessage;
2680 QgsPointXY mLocation;
2681 bool mHasLocation = false;
2682 };
2683
2692 void validateGeometry( QVector<QgsGeometry::Error> &errors SIP_OUT, Qgis::GeometryValidationEngine method = Qgis::GeometryValidationEngine::QgisInternal, Qgis::GeometryValidityFlags flags = Qgis::GeometryValidityFlags() ) const;
2693
2703 void normalize();
2704
2713 static QgsGeometry unaryUnion( const QVector<QgsGeometry> &geometries, const QgsGeometryParameters &parameters = QgsGeometryParameters() );
2714
2723 static QgsGeometry polygonize( const QVector<QgsGeometry> &geometries );
2724
2732 void convertToStraightSegment( double tolerance = M_PI / 180., QgsAbstractGeometry::SegmentationToleranceType toleranceType = QgsAbstractGeometry::MaximumAngle );
2733
2740 bool requiresConversionToStraightSegments() const;
2741
2747 void mapToPixel( const QgsMapToPixel &mtp );
2748
2754 void draw( QPainter &p ) const;
2755
2766 bool vertexIdFromVertexNr( int number, QgsVertexId &id SIP_OUT ) const;
2767
2779 int vertexNrFromVertexId( QgsVertexId id ) const;
2780
2788 QString lastError() const SIP_HOLDGIL;
2789
2799 void filterVertices( const std::function< bool( const QgsPoint & ) > &filter ) SIP_SKIP;
2800
2815 void transformVertices( const std::function< QgsPoint( const QgsPoint & ) > &transform ) SIP_SKIP;
2816
2822 static QgsGeometry fromQPointF( QPointF point ) SIP_HOLDGIL;
2823
2831 static QgsGeometry fromQPolygonF( const QPolygonF &polygon );
2832
2840 Q_DECL_DEPRECATED static QgsPolylineXY createPolylineFromQPolygonF( const QPolygonF &polygon ) SIP_DEPRECATED;
2841
2849 Q_DECL_DEPRECATED static QgsPolygonXY createPolygonFromQPolygonF( const QPolygonF &polygon ) SIP_DEPRECATED;
2850
2851#ifndef SIP_RUN
2852
2862 static bool compare( const QgsPolylineXY &p1, const QgsPolylineXY &p2,
2863 double epsilon = 4 * std::numeric_limits<double>::epsilon() );
2864
2874 static bool compare( const QgsPolygonXY &p1, const QgsPolygonXY &p2,
2875 double epsilon = 4 * std::numeric_limits<double>::epsilon() );
2876
2887 static bool compare( const QgsMultiPolygonXY &p1, const QgsMultiPolygonXY &p2,
2888 double epsilon = 4 * std::numeric_limits<double>::epsilon() );
2889#else
2890
2910 static bool compare( PyObject *obj1, PyObject *obj2, double epsilon = 4 * std::numeric_limits<double>::epsilon() );
2911 % MethodCode
2912 {
2913 sipRes = false;
2914 int state0;
2915 int state1;
2916 int sipIsErr = 0;
2917
2918 if ( PyList_Check( a0 ) && PyList_Check( a1 ) &&
2919 PyList_GET_SIZE( a0 ) && PyList_GET_SIZE( a1 ) )
2920 {
2921 PyObject *o0 = PyList_GetItem( a0, 0 );
2922 PyObject *o1 = PyList_GetItem( a1, 0 );
2923 if ( o0 && o1 )
2924 {
2925 // compare polyline - polyline
2926 if ( sipCanConvertToType( o0, sipType_QgsPointXY, SIP_NOT_NONE ) &&
2927 sipCanConvertToType( o1, sipType_QgsPointXY, SIP_NOT_NONE ) &&
2928 sipCanConvertToType( a0, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) &&
2929 sipCanConvertToType( a1, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) )
2930 {
2931 QgsPolylineXY *p0;
2932 QgsPolylineXY *p1;
2933 p0 = reinterpret_cast<QgsPolylineXY *>( sipConvertToType( a0, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
2934 p1 = reinterpret_cast<QgsPolylineXY *>( sipConvertToType( a1, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
2935 if ( sipIsErr )
2936 {
2937 sipReleaseType( p0, sipType_QVector_0100QgsPointXY, state0 );
2938 sipReleaseType( p1, sipType_QVector_0100QgsPointXY, state1 );
2939 }
2940 else
2941 {
2942 sipRes = QgsGeometry::compare( *p0, *p1, a2 );
2943 }
2944 }
2945 else if ( PyList_Check( o0 ) && PyList_Check( o1 ) &&
2946 PyList_GET_SIZE( o0 ) && PyList_GET_SIZE( o1 ) )
2947 {
2948 PyObject *oo0 = PyList_GetItem( o0, 0 );
2949 PyObject *oo1 = PyList_GetItem( o1, 0 );
2950 if ( oo0 && oo1 )
2951 {
2952 // compare polygon - polygon
2953 if ( sipCanConvertToType( oo0, sipType_QgsPointXY, SIP_NOT_NONE ) &&
2954 sipCanConvertToType( oo1, sipType_QgsPointXY, SIP_NOT_NONE ) &&
2955 sipCanConvertToType( a0, sipType_QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) &&
2956 sipCanConvertToType( a1, sipType_QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) )
2957 {
2958 QgsPolygonXY *p0;
2959 QgsPolygonXY *p1;
2960 p0 = reinterpret_cast<QgsPolygonXY *>( sipConvertToType( a0, sipType_QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
2961 p1 = reinterpret_cast<QgsPolygonXY *>( sipConvertToType( a1, sipType_QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
2962 if ( sipIsErr )
2963 {
2964 sipReleaseType( p0, sipType_QVector_0600QVector_0100QgsPointXY, state0 );
2965 sipReleaseType( p1, sipType_QVector_0600QVector_0100QgsPointXY, state1 );
2966 }
2967 else
2968 {
2969 sipRes = QgsGeometry::compare( *p0, *p1, a2 );
2970 }
2971 }
2972 else if ( PyList_Check( oo0 ) && PyList_Check( oo1 ) &&
2973 PyList_GET_SIZE( oo0 ) && PyList_GET_SIZE( oo1 ) )
2974 {
2975 PyObject *ooo0 = PyList_GetItem( oo0, 0 );
2976 PyObject *ooo1 = PyList_GetItem( oo1, 0 );
2977 if ( ooo0 && ooo1 )
2978 {
2979 // compare multipolygon - multipolygon
2980 if ( sipCanConvertToType( ooo0, sipType_QgsPointXY, SIP_NOT_NONE ) &&
2981 sipCanConvertToType( ooo1, sipType_QgsPointXY, SIP_NOT_NONE ) &&
2982 sipCanConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) &&
2983 sipCanConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) )
2984 {
2987 p0 = reinterpret_cast<QgsMultiPolygonXY *>( sipConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
2988 p1 = reinterpret_cast<QgsMultiPolygonXY *>( sipConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
2989 if ( sipIsErr )
2990 {
2991 sipReleaseType( p0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, state0 );
2992 sipReleaseType( p1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, state1 );
2993 }
2994 else
2995 {
2996 sipRes = QgsGeometry::compare( *p0, *p1, a2 );
2997 }
2998 }
2999 }
3000 }
3001 }
3002 }
3003 }
3004 }
3005 }
3006 % End
3007#endif
3008
3025 QgsGeometry smooth( unsigned int iterations = 1, double offset = 0.25,
3026 double minimumDistance = -1.0, double maxAngle = 180.0 ) const;
3027
3065 static QgsGeometryEngine *createGeometryEngine( const QgsAbstractGeometry *geometry ) SIP_FACTORY;
3066
3072 static void convertPointList( const QVector<QgsPointXY> &input, QgsPointSequence &output );
3073
3079 static void convertPointList( const QgsPointSequence &input, QVector<QgsPointXY> &output );
3080
3082 operator QVariant() const
3083 {
3084 return QVariant::fromValue( *this );
3085 }
3086
3087 private:
3088
3089 QgsGeometryPrivate *d; //implicitly shared data pointer
3090
3092 mutable QString mLastError;
3093
3098 void detach();
3099
3104 void reset( std::unique_ptr< QgsAbstractGeometry > newGeometry );
3105
3106 static void convertPolygon( const QgsPolygon &input, QgsPolygonXY &output );
3107
3109 QgsGeometry convertToPoint( bool destMultipart ) const;
3111 QgsGeometry convertToLine( bool destMultipart ) const;
3113 QgsGeometry convertToPolygon( bool destMultipart ) const;
3114
3126 std::unique_ptr< QgsLineString > smoothLine( const QgsLineString &line, unsigned int iterations = 1, double offset = 0.25,
3127 double minimumDistance = -1, double maxAngle = 180.0 ) const;
3128
3140 std::unique_ptr< QgsPolygon > smoothPolygon( const QgsPolygon &polygon, unsigned int iterations = 1, double offset = 0.25,
3141 double minimumDistance = -1, double maxAngle = 180.0 ) const;
3142
3143
3145
3146}; // class QgsGeometry
3147
3149
3150
3151CORE_EXPORT QDataStream &operator<<( QDataStream &out, const QgsGeometry &geometry );
3153CORE_EXPORT QDataStream &operator>>( QDataStream &in, QgsGeometry &geometry );
3154
3155#endif
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
GeometryOperationResult
Success or failure of a geometry operation.
Definition qgis.h:1520
GeometryValidationEngine
Available engines for validating geometries.
Definition qgis.h:1562
@ QgisInternal
Use internal QgsGeometryValidator method.
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Definition qgis.h:255
@ Polygon
Polygons.
@ Unknown
Unknown types.
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:182
TransformDirection
Flags for raster layer temporal capabilities.
Definition qgis.h:1937
@ Forward
Forward transform (from source to destination)
The part_iterator class provides STL-style iterator for const references to geometry parts.
The part_iterator class provides STL-style iterator for geometry parts.
The vertex_iterator class provides STL-style iterator for vertices.
Abstract base class for all geometries.
SegmentationToleranceType
Segmentation tolerance as maximum angle or maximum difference between approximation and circle.
@ MaximumAngle
Maximum angle between generating radii (lines from arc center to output vertices)
virtual const QgsAbstractGeometry * simplifiedTypeRef() const
Returns a reference to the simplest lossless representation of this geometry, e.g.
Qgis::WkbType wkbType() const
Returns the WKB type of the geometry.
A 3-dimensional box composed of x, y, z coordinates.
Definition qgsbox3d.h:44
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.
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.
A geometry engine is a low-level representation of a QgsAbstractGeometry object, optimised for use wi...
Encapsulates parameters under which a geometry operation is performed.
double gridSize() const
Returns the grid size which will be used to snap vertices of a geometry.
void setGridSize(double size)
Sets the grid size which will be used to snap vertices of a geometry.
Java-style iterator for traversal of parts of a geometry.
A geometry error.
Error(const QString &m)
Error(const QString &m, const QgsPointXY &p)
bool operator==(const QgsGeometry::Error &other) const
A geometry is the spatial representation of a feature.
QVector< QgsPointXY > randomPointsInPolygon(int count, const std::function< bool(const QgsPointXY &) > &acceptPoint, unsigned long seed=0, QgsFeedback *feedback=nullptr, int maxTriesPerPoint=0) const
Returns a list of count random points generated inside a (multi)polygon geometry (if acceptPoint is s...
QVector< QgsPointXY > randomPointsInPolygon(int count, unsigned long seed=0, QgsFeedback *feedback=nullptr) const
Returns a list of count random points generated inside a (multi)polygon geometry.
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.
This class offers geometry processing methods.
Line string geometry type, with support for z-dimension and m-values.
Perform transforms between map coordinates and device coordinates.
Custom exception class which is raised when an operation is not supported.
A class to represent a 2D point.
Definition qgspointxy.h:59
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:49
Polygon geometry type.
Definition qgspolygon.h:34
A rectangle specified with double values.
Represents a vector layer which manages a vector based data sets.
Java-style iterator for traversal of vertices of a geometry.
static Qgis::GeometryType geometryType(Qgis::WkbType type)
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
static bool isMultiType(Qgis::WkbType type)
Returns true if the WKB type is a multi type.
static QString displayString(Qgis::WkbType type)
Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geom...
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
#define str(x)
Definition qgis.cpp:38
const double DEFAULT_SEGMENT_EPSILON
Default snapping tolerance for segments.
Definition qgis.h:4875
#define SIP_TYPEHINT(type)
Definition qgis_sip.h:227
#define SIP_IN
Definition qgis_sip.h:63
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_PYNAME(name)
Definition qgis_sip.h:81
#define SIP_PYARGREMOVE
Definition qgis_sip.h:151
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_OUT
Definition qgis_sip.h:58
#define SIP_HOLDGIL
Definition qgis_sip.h:166
#define SIP_FACTORY
Definition qgis_sip.h:76
#define SIP_THROW(name,...)
Definition qgis_sip.h:198
QVector< QgsPoint > QgsPointSequence
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
QVector< QgsPolylineXY > QgsPolygonXY
Polygon: first item of the list is outer ring, inner rings (if any) start from second item.
Definition qgsgeometry.h:76
CORE_EXPORT QDataStream & operator>>(QDataStream &in, QgsGeometry &geometry)
Reads a geometry from stream in into geometry. QGIS version compatibility is not guaranteed.
CORE_EXPORT QDataStream & operator<<(QDataStream &out, const QgsGeometry &geometry)
Writes the geometry to stream out. QGIS version compatibility is not guaranteed.
QVector< QgsPolylineXY > QgsMultiPolylineXY
A collection of QgsPolylines that share a common collection of attributes.
Definition qgsgeometry.h:86
QVector< QgsPointXY > QgsMultiPointXY
A collection of QgsPoints that share a common collection of attributes.
Definition qgsgeometry.h:82
QVector< QgsPointXY > QgsPolylineXY
Polyline as represented as a vector of two-dimensional points.
Definition qgsgeometry.h:63
QVector< QgsPolygonXY > QgsMultiPolygonXY
A collection of QgsPolygons that share a common collection of attributes.
Definition qgsgeometry.h:93
QgsPointSequence QgsPolyline
Polyline as represented as a vector of points.
Definition qgsgeometry.h:72
int precision
Utility class for identifying a unique vertex within a geometry.
Definition qgsvertexid.h:31