QGIS API Documentation 4.1.0-Master (659fe69c07c)
Loading...
Searching...
No Matches
qgslinestring.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslinestring.h
3 -----------------
4 begin : September 2014
5 copyright : (C) 2014 by Marco Hugentobler
6 email : marco at sourcepole dot ch
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSLINESTRING_H
19#define QGSLINESTRING_H
20
21
22#include "qgis_core.h"
23#include "qgis_sip.h"
24#include "qgscompoundcurve.h"
25#include "qgscurve.h"
27#include "qgssimplecurve.h"
28
29#include <QPolygonF>
30#include <QString>
31
32using namespace Qt::StringLiterals;
33
35class QgsBox3D;
36
37/***************************************************************************
38 * This class is considered CRITICAL and any change MUST be accompanied with
39 * full unit tests in testqgsgeometry.cpp.
40 * See details in QEP #17
41 ****************************************************************************/
42
48class CORE_EXPORT QgsLineString : public QgsSimpleCurve
49{
50 public:
51 // clang-format off
56 // clang-format on
57#ifndef SIP_RUN
58
64 QgsLineString( const QVector<QgsPoint> &points );
65
71 QgsLineString( const QVector<QgsPointXY> &points );
72#else
73// clang-format off
74
82 QgsLineString( SIP_PYOBJECT points SIP_TYPEHINT( Sequence[Union[QgsPoint, QgsPointXY, Sequence[float]]] ) ) SIP_HOLDGIL [( const QVector<double> &x, const QVector<double> &y, const QVector<double> &z = QVector<double>(), const QVector<double> &m = QVector<double>(), bool is25DType = false )];
83 % MethodCode
84 if ( !PySequence_Check( a0 ) )
85 {
86 PyErr_SetString( PyExc_TypeError, u"A sequence of QgsPoint, QgsPointXY or array of floats is expected"_s.toUtf8().constData() );
87 sipIsErr = 1;
88 }
89 else
90 {
91 int state;
92 const int size = PySequence_Size( a0 );
93 QVector< double > xl;
94 QVector< double > yl;
95 bool hasZ = false;
96 QVector< double > zl;
97 bool hasM = false;
98 QVector< double > ml;
99 xl.reserve( size );
100 yl.reserve( size );
101
102 bool is25D = false;
103
104 sipIsErr = 0;
105 for ( int i = 0; i < size; ++i )
106 {
107 PyObject *value = PySequence_GetItem( a0, i );
108 if ( !value )
109 {
110 PyErr_SetString( PyExc_TypeError, u"Invalid type at index %1."_s.arg( i ) .toUtf8().constData() );
111 sipIsErr = 1;
112 break;
113 }
114
115 if ( PySequence_Check( value ) )
116 {
117 const int elementSize = PySequence_Size( value );
118 if ( elementSize < 2 || elementSize > 4 )
119 {
120 sipIsErr = 1;
121 PyErr_SetString( PyExc_TypeError, u"Invalid sequence size at index %1. Expected an array of 2-4 float values, got %2."_s.arg( i ).arg( elementSize ).toUtf8().constData() );
122 Py_DECREF( value );
123 break;
124 }
125 else
126 {
127 sipIsErr = 0;
128 for ( int j = 0; j < elementSize; ++j )
129 {
130 PyObject *element = PySequence_GetItem( value, j );
131 if ( !element )
132 {
133 PyErr_SetString( PyExc_TypeError, u"Invalid type at index %1."_s.arg( i ) .toUtf8().constData() );
134 sipIsErr = 1;
135 break;
136 }
137
138 PyErr_Clear();
139 double d = PyFloat_AsDouble( element );
140 if ( PyErr_Occurred() )
141 {
142 Py_DECREF( element );
143 sipIsErr = 1;
144 break;
145 }
146 if ( j == 0 )
147 xl.append( d );
148 else if ( j == 1 )
149 yl.append( d );
150
151 if ( i == 0 && j == 2 )
152 {
153 hasZ = true;
154 zl.reserve( size );
155 zl.append( d );
156 }
157 else if ( i > 0 && j == 2 && hasZ )
158 {
159 zl.append( d );
160 }
161
162 if ( i == 0 && j == 3 )
163 {
164 hasM = true;
165 ml.reserve( size );
166 ml.append( d );
167 }
168 else if ( i > 0 && j == 3 && hasM )
169 {
170 ml.append( d );
171 }
172
173 Py_DECREF( element );
174 }
175
176 if ( hasZ && elementSize < 3 )
177 zl.append( std::numeric_limits< double >::quiet_NaN() );
178 if ( hasM && elementSize < 4 )
179 ml.append( std::numeric_limits< double >::quiet_NaN() );
180
181 Py_DECREF( value );
182 if ( sipIsErr )
183 {
184 break;
185 }
186 }
187 }
188 else
189 {
190 if ( sipCanConvertToType( value, sipType_QgsPointXY, SIP_NOT_NONE ) )
191 {
192 sipIsErr = 0;
193 QgsPointXY *p = reinterpret_cast<QgsPointXY *>( sipConvertToType( value, sipType_QgsPointXY, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
194 if ( !sipIsErr )
195 {
196 xl.append( p->x() );
197 yl.append( p->y() );
198 }
199 sipReleaseType( p, sipType_QgsPointXY, state );
200 }
201 else if ( sipCanConvertToType( value, sipType_QgsPoint, SIP_NOT_NONE ) )
202 {
203 sipIsErr = 0;
204 QgsPoint *p = reinterpret_cast<QgsPoint *>( sipConvertToType( value, sipType_QgsPoint, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
205 if ( !sipIsErr )
206 {
207 xl.append( p->x() );
208 yl.append( p->y() );
209
210 if ( i == 0 && p->is3D() )
211 {
212 hasZ = true;
213 zl.reserve( size );
214 zl.append( p->z() );
215 }
216 else if ( i > 0 && hasZ )
217 {
218 zl.append( p->z() );
219 }
220
221 if ( i == 0 && p->isMeasure() )
222 {
223 hasM = true;
224 ml.reserve( size );
225 ml.append( p->m() );
226 }
227 else if ( i > 0 && hasM )
228 {
229 ml.append( p->m() );
230 }
231
232 if ( i == 0 && p->wkbType() == Qgis::WkbType::Point25D )
233 is25D = true;
234 }
235 sipReleaseType( p, sipType_QgsPoint, state );
236 }
237 else
238 {
239 sipIsErr = 1;
240 }
241
242 Py_DECREF( value );
243
244 if ( sipIsErr )
245 {
246 // couldn't convert the sequence value to a QgsPoint or QgsPointXY
247 PyErr_SetString( PyExc_TypeError, u"Invalid type at index %1. Expected QgsPoint, QgsPointXY or array of floats."_s.arg( i ) .toUtf8().constData() );
248 break;
249 }
250 }
251 }
252 if ( sipIsErr == 0 )
253 sipCpp = new sipQgsLineString( QgsLineString( xl, yl, zl, ml, is25D ) );
254 }
255 % End
256// clang-format on
257#endif
258
264
282 QgsLineString( const QVector<double> &x, const QVector<double> &y,
283 const QVector<double> &z = QVector<double>(),
284 const QVector<double> &m = QVector<double>(), bool is25DType = false ) SIP_HOLDGIL;
285
290 QgsLineString( const QgsPoint &p1, const QgsPoint &p2 ) SIP_HOLDGIL;
291
302 static std::unique_ptr< QgsLineString > fromBezierCurve( const QgsPoint &start, const QgsPoint &controlPoint1, const QgsPoint &controlPoint2, const QgsPoint &end, int segments = 30 );
303
309 static std::unique_ptr< QgsLineString > fromQPolygonF( const QPolygonF &polygon );
310
311#ifndef SIP_RUN
312 using QgsSimpleCurve::setPoints; // make all setPoints() functions eligible for overload resolution
313#endif // !SIP_RUN
314
328 void setPoints( size_t size, const double *x, const double *y, const double *z = nullptr, const double *m = nullptr ) SIP_SKIP;
329
334 void addVertex( const QgsPoint &pt );
335
337 void close();
338
343 QgsCompoundCurve *toCurveType() const override SIP_FACTORY;
344
350 void extend( double startDistance, double endDistance );
351
352#ifndef SIP_RUN
353
359 void visitPointsByRegularDistance( double distance, const std::function< bool( double x, double y, double z, double m,
360 double startSegmentX, double startSegmentY, double startSegmentZ, double startSegmentM,
361 double endSegmentX, double endSegmentY, double endSegmentZ, double endSegmentM
362 ) > &visitPoint ) const;
363#endif
364
365 //reimplemented methods
366 QString geometryType() const override SIP_HOLDGIL;
367
368 QgsLineString *clone() const override SIP_FACTORY;
369 void clear() override;
370 int indexOf( const QgsPoint &point ) const final;
371 bool isValid( QString &error SIP_OUT, Qgis::GeometryValidityFlags flags = Qgis::GeometryValidityFlags() ) const override;
372 QgsLineString *snappedToGrid( double hSpacing, double vSpacing, double dSpacing = 0, double mSpacing = 0, bool removeRedundantPoints = false ) const override SIP_FACTORY;
373 bool removeDuplicateNodes( double epsilon = 4 * std::numeric_limits<double>::epsilon(), bool useZValues = false ) override;
374 bool isClosed() const override SIP_HOLDGIL;
375 bool isClosed2D() const override SIP_HOLDGIL;
376 bool boundingBoxIntersects( const QgsRectangle &rectangle ) const override SIP_HOLDGIL;
377 bool boundingBoxIntersects( const QgsBox3D &box3d ) const override SIP_HOLDGIL;
378
386 QVector< QgsVertexId > collectDuplicateNodes( double epsilon = 4 * std::numeric_limits<double>::epsilon(), bool useZValues = false ) const;
387
388 QPolygonF asQPolygonF() const override;
389
390 QgsLineString *simplifyByDistance( double tolerance ) const override SIP_FACTORY;
391
392 QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const override;
393 QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const override;
394 json asJsonObject( int precision = 17 ) const override SIP_SKIP;
395 QString asKml( int precision = 17 ) const override;
396
397 //curve interface
398 double length() const override SIP_HOLDGIL;
399
400#ifndef SIP_RUN
401 std::tuple< std::unique_ptr< QgsCurve >, std::unique_ptr< QgsCurve > > splitCurveAtVertex( int index ) const final;
402#endif
403
412 QVector<QgsLineString *> splitToDisjointXYParts() const SIP_FACTORY;
413
420 double length3D() const SIP_HOLDGIL;
421
428 QgsLineString *curveToLine( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const override SIP_FACTORY;
429
430 void draw( QPainter &p ) const override;
431
432 void addToPainterPath( QPainterPath &path ) const override;
433 void drawAsPolygon( QPainter &p ) const override;
434
435 bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override;
436 bool deleteVertex( QgsVertexId position ) override;
437 bool deleteVertices( const QSet<QgsVertexId> &positions ) override;
438
439 QgsLineString *reversed() const override SIP_FACTORY;
440 QgsPoint *interpolatePoint( double distance ) const override SIP_FACTORY;
441 QgsLineString *curveSubstring( double startDistance, double endDistance ) const override SIP_FACTORY;
442
443 double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, int *leftOf SIP_OUT = nullptr, double epsilon = 4 * std::numeric_limits<double>::epsilon() ) const override;
444 bool pointAt( int node, QgsPoint &point, Qgis::VertexType &type ) const override;
445
446 QgsPoint centroid() const override;
447
458 void sumUpArea( double &sum SIP_OUT ) const override;
459
470 void sumUpArea3D( double &sum SIP_OUT ) const override;
471
472 double vertexAngle( QgsVertexId vertex ) const override;
473 double segmentLength( QgsVertexId startVertex ) const override;
474 double distanceBetweenVertices( QgsVertexId fromVertex, QgsVertexId toVertex ) const override;
475
476 bool convertTo( Qgis::WkbType type ) override;
477
478#ifndef SIP_RUN
487 inline static const QgsLineString *cast( const QgsAbstractGeometry *geom ) // cppcheck-suppress duplInheritedMember
488 {
489 if ( geom && QgsWkbTypes::flatType( geom->wkbType() ) == Qgis::WkbType::LineString )
490 return static_cast<const QgsLineString *>( geom );
491 return nullptr;
492 }
493
502 inline static QgsLineString *cast( QgsAbstractGeometry *geom ) // cppcheck-suppress duplInheritedMember
503 {
504 if ( geom && QgsWkbTypes::flatType( geom->wkbType() ) == Qgis::WkbType::LineString )
505 return static_cast<QgsLineString *>( geom );
506 return nullptr;
507 }
508#endif
509
511
512#ifdef SIP_RUN
513// clang-format off
514 SIP_PYOBJECT __repr__();
515 % MethodCode
516 QString wkt = sipCpp->asWkt();
517 if ( wkt.length() > 1000 )
518 wkt = wkt.left( 1000 ) + u"..."_s;
519 QString str = u"<QgsLineString: %1>"_s.arg( wkt );
520 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
521 % End
522
532 SIP_PYOBJECT __getitem__( int index ) SIP_TYPEHINT( QgsPoint );
533 % MethodCode
534 const int count = sipCpp->numPoints();
535 if ( a0 < -count || a0 >= count )
536 {
537 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
538 sipIsErr = 1;
539 }
540 else
541 {
542 std::unique_ptr< QgsPoint > p;
543 if ( a0 >= 0 )
544 p = std::make_unique< QgsPoint >( sipCpp->pointN( a0 ) );
545 else
546 p = std::make_unique< QgsPoint >( sipCpp->pointN( count + a0 ) );
547 sipRes = sipConvertFromType( p.release(), sipType_QgsPoint, Py_None );
548 }
549 % End
550
560 void __setitem__( int index, const QgsPoint &point );
561 % MethodCode
562 const int count = sipCpp->numPoints();
563 if ( a0 < -count || a0 >= count )
564 {
565 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
566 sipIsErr = 1;
567 }
568 else
569 {
570 if ( a0 < 0 )
571 a0 = count + a0;
572 sipCpp->setXAt( a0, a1->x() );
573 sipCpp->setYAt( a0, a1->y() );
574 if ( sipCpp->isMeasure() )
575 sipCpp->setMAt( a0, a1->m() );
576 if ( sipCpp->is3D() )
577 sipCpp->setZAt( a0, a1->z() );
578 }
579 % End
580
581
591 void __delitem__( int index );
592 % MethodCode
593 const int count = sipCpp->numPoints();
594 if ( a0 >= 0 && a0 < count )
595 sipCpp->deleteVertex( QgsVertexId( -1, -1, a0 ) );
596 else if ( a0 < 0 && a0 >= -count )
597 sipCpp->deleteVertex( QgsVertexId( -1, -1, count + a0 ) );
598 else
599 {
600 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
601 sipIsErr = 1;
602 }
603 % End
604
605// clang-format on
606#endif
607
614 Q_DECL_DEPRECATED QgsBox3D calculateBoundingBox3d() const SIP_DEPRECATED;
615
621 QgsBox3D calculateBoundingBox3D() const override;
622
629 std::unique_ptr< QgsLineString > measuredLine( double start, double end ) const;
630
644 std::unique_ptr< QgsLineString > interpolateM( bool use3DDistance = true ) const;
645
670 bool lineLocatePointByM( double m, double &x SIP_OUT, double &y SIP_OUT, double &z SIP_OUT, double &distanceFromStart SIP_OUT, bool use3DDistance = true ) const;
671
672 private:
678 void fromWkbPoints( Qgis::WkbType type, const QgsConstWkbPtr &wkb )
679 {
680 mWkbType = type;
682 }
683
684 bool lineLocatePointByMPrivate( double m, double &x, double &y, double &z, double &distanceFromStart, bool use3DDistance, bool haveInterpolatedM ) const;
685
686 friend class QgsPolygon;
687 friend class QgsTriangle;
688 friend class TestQgsGeometry;
689
690};
691
692// clazy:excludeall=qstring-allocations
693
694#endif // QGSLINESTRING_H
QFlags< GeometryValidityFlag > GeometryValidityFlags
Geometry validity flags.
Definition qgis.h:2197
VertexType
Types of vertex.
Definition qgis.h:3247
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:294
@ LineString
LineString.
Definition qgis.h:297
@ Point25D
Point25D.
Definition qgis.h:361
virtual QgsAbstractGeometry * snappedToGrid(double hSpacing, double vSpacing, double dSpacing=0, double mSpacing=0, bool removeRedundantPoints=false) const =0
Makes a new geometry with all the points or vertices snapped to the closest point of the grid.
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 bool convertTo(Qgis::WkbType type)
Converts the geometry to a specified type.
virtual double vertexAngle(QgsVertexId vertex) const =0
Returns approximate angle at a vertex.
virtual void draw(QPainter &p) const =0
Draws the geometry using the specified QPainter.
bool isMeasure() const
Returns true if the geometry contains m values.
virtual QgsAbstractGeometry * simplifyByDistance(double tolerance) const =0
Simplifies the geometry by applying the Douglas Peucker simplification by distance algorithm.
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
AxisOrder
Axis order for GML generation.
@ XY
X comes before Y (or lon before lat).
virtual QString geometryType() const =0
Returns a unique string representing the geometry type.
virtual QgsAbstractGeometry * createEmptyWithSameType() const =0
Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
virtual bool deleteVertices(const QSet< QgsVertexId > &positions)=0
Deletes vertices within the geometry.
virtual QDomElement asGml2(QDomDocument &doc, int precision=17, const QString &ns="gml", AxisOrder axisOrder=QgsAbstractGeometry::AxisOrder::XY) const =0
Returns a GML2 representation of the geometry.
Qgis::WkbType wkbType() const
Returns the WKB type of the geometry.
virtual bool insertVertex(QgsVertexId position, const QgsPoint &vertex)=0
Inserts a vertex into the geometry.
virtual double length() const
Returns the planar, 2-dimensional length of the geometry.
virtual json asJsonObject(int precision=17) const
Returns a json object representation of the geometry.
virtual QDomElement asGml3(QDomDocument &doc, int precision=17, const QString &ns="gml", AxisOrder axisOrder=QgsAbstractGeometry::AxisOrder::XY) const =0
Returns a GML3 representation of the geometry.
virtual bool boundingBoxIntersects(const QgsRectangle &rectangle) const
Returns true if the bounding box of this geometry intersects with a rectangle.
virtual bool deleteVertex(QgsVertexId position)=0
Deletes a vertex within the geometry.
virtual QgsPoint centroid() const
Returns the centroid of the geometry.
virtual double segmentLength(QgsVertexId startVertex) const =0
Returns the length of the segment of the geometry which begins at startVertex.
virtual bool removeDuplicateNodes(double epsilon=4 *std::numeric_limits< double >::epsilon(), bool useZValues=false)=0
Removes duplicate nodes from the geometry, wherever removing the nodes does not result in a degenerat...
QgsAbstractGeometry()=default
virtual double closestSegment(const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, int *leftOf=nullptr, double epsilon=4 *std::numeric_limits< double >::epsilon()) const =0
Searches for the closest segment of the geometry to a given point.
A 3-dimensional box composed of x, y, z coordinates.
Definition qgsbox3d.h:45
Compound curve geometry type.
virtual bool pointAt(int node, QgsPoint &point, Qgis::VertexType &type) const =0
Returns the point and vertex type of a point within the curve.
virtual QgsCurve * curveSubstring(double startDistance, double endDistance) const =0
Returns a new curve representing a substring of this curve.
virtual bool isClosed() const
Returns true if the curve is closed.
Definition qgscurve.cpp:53
bool isValid(QString &error, Qgis::GeometryValidityFlags flags=Qgis::GeometryValidityFlags()) const override
Checks validity of the geometry, and returns true if the geometry is valid.
Definition qgscurve.cpp:247
virtual bool isClosed2D() const
Returns true if the curve is closed.
Definition qgscurve.cpp:42
virtual QPolygonF asQPolygonF() const
Returns a QPolygonF representing the points.
Definition qgscurve.cpp:271
virtual void addToPainterPath(QPainterPath &path) const =0
Adds a curve to a painter path.
virtual int indexOf(const QgsPoint &point) const =0
Returns the index of the first vertex matching the given point, or -1 if a matching vertex is not fou...
QgsCurve * toCurveType() const override
Returns the geometry converted to the more generic curve type.
Definition qgscurve.cpp:206
virtual void sumUpArea(double &sum) const =0
Sums up the area of the curve by iterating over the vertices (shoelace formula).
QString asKml(int precision=17) const override
Returns a KML representation of the geometry.
Definition qgscurve.cpp:164
virtual QgsPoint * interpolatePoint(double distance) const =0
Returns an interpolated point on the curve at the specified distance.
QgsCurve * clone() const override=0
Clones the geometry by performing a deep copy.
virtual double distanceBetweenVertices(QgsVertexId fromVertex, QgsVertexId toVertex) const =0
Returns the distance along the curve between two vertices.
virtual std::tuple< std::unique_ptr< QgsCurve >, std::unique_ptr< QgsCurve > > splitCurveAtVertex(int index) const =0
Splits the curve at the specified vertex index, returning two curves which represent the portion of t...
virtual void drawAsPolygon(QPainter &p) const =0
Draws the curve as a polygon on the specified QPainter.
virtual QgsLineString * curveToLine(double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const =0
Returns a new line string geometry corresponding to a segmentized approximation of the curve.
virtual void sumUpArea3D(double &sum) const =0
Sums up the 3d area of the curve by iterating over the vertices (shoelace formula).
Represents a single 2D line segment, consisting of a 2D start and end vertex only.
Line string geometry type, with support for z-dimension and m-values.
static std::unique_ptr< QgsLineString > fromBezierCurve(const QgsPoint &start, const QgsPoint &controlPoint1, const QgsPoint &controlPoint2, const QgsPoint &end, int segments=30)
Returns a new linestring created by segmentizing the bezier curve between start and end,...
QVector< QgsLineString * > splitToDisjointXYParts() const
Divides the linestring into parts that don't share any points or lines.
double length3D() const
Returns the length in 3D world of the line string.
static std::unique_ptr< QgsLineString > fromQPolygonF(const QPolygonF &polygon)
Returns a new linestring from a QPolygonF polygon input.
QgsLineString()
Constructor for an empty linestring geometry.
static const QgsLineString * cast(const QgsAbstractGeometry *geom)
Cast the geom to a QgsLineString.
friend class TestQgsGeometry
friend class QgsPolygon
void close()
Closes the line string by appending the first point to the end of the line, if it is not already clos...
void extend(double startDistance, double endDistance)
Extends the line geometry by extrapolating out the start or end of the line by a specified distance.
static QgsLineString * cast(QgsAbstractGeometry *geom)
Cast the geom to a QgsLineString.
QVector< QgsVertexId > collectDuplicateNodes(double epsilon=4 *std::numeric_limits< double >::epsilon(), bool useZValues=false) const
Returns a list of any duplicate nodes contained in the geometry, within the specified tolerance.
void addVertex(const QgsPoint &pt)
Adds a new vertex to the end of the line string.
friend class QgsTriangle
Represents a 2D point.
Definition qgspointxy.h:62
double y
Definition qgspointxy.h:66
double x
Definition qgspointxy.h:65
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:53
double z
Definition qgspoint.h:58
double x
Definition qgspoint.h:56
double m
Definition qgspoint.h:59
double y
Definition qgspoint.h:57
A rectangle specified with double values.
QgsSimpleCurve()=default
void points(QgsPointSequence &pts) const override
Returns a list of points within the curve.
void clear() override
Clears the geometry, ie reset it to a null geometry.
void setPoints(const QgsPointSequence &points)
Resets the simple curve to match the specified list of points.
void importVerticesFromWkb(const QgsConstWkbPtr &wkb)
Imports vertices from wkb geometry representation.
QgsSimpleCurve * reversed() const override
Returns a reversed copy of the curve, where the direction of the curve has been flipped.
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
#define SIP_TYPEHINT(type)
Definition qgis_sip.h:237
#define SIP_DEPRECATED
Definition qgis_sip.h:113
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_OUT
Definition qgis_sip.h:57
#define SIP_HOLDGIL
Definition qgis_sip.h:178
#define SIP_FACTORY
Definition qgis_sip.h:83
void visitPointsByRegularDistance(const QgsLineString *line, const QgsLineString *linePainterUnits, bool emitFirstPoint, const double distance, const double averageAngleLengthPainterUnits, const VisitPointFunction &visitPoint)
QLineF segment(int index, QRectF rect, double radius)
Utility class for identifying a unique vertex within a geometry.
Definition qgsvertexid.h:35