QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
qgspoint.h
Go to the documentation of this file.
1/***************************************************************************
2 qgspointv2.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 QGSPOINT_H
19#define QGSPOINT_H
20
21#include "qgis_core.h"
22#include "qgis_sip.h"
23#include "qgsabstractgeometry.h"
25#include "qgsrectangle.h"
26
27/***************************************************************************
28 * This class is considered CRITICAL and any change MUST be accompanied with
29 * full unit tests in testqgsgeometry.cpp.
30 * See details in QEP #17
31 ****************************************************************************/
32
48class CORE_EXPORT QgsPoint: public QgsAbstractGeometry
49{
50 Q_GADGET
51
52 Q_PROPERTY( double x READ x WRITE setX )
53 Q_PROPERTY( double y READ y WRITE setY )
54 Q_PROPERTY( double z READ z WRITE setZ )
55 Q_PROPERTY( double m READ m WRITE setM )
56
57 public:
58
85#ifndef SIP_RUN
86 QgsPoint( double x = std::numeric_limits<double>::quiet_NaN(), double y = std::numeric_limits<double>::quiet_NaN(), double z = std::numeric_limits<double>::quiet_NaN(), double m = std::numeric_limits<double>::quiet_NaN(), Qgis::WkbType wkbType = Qgis::WkbType::Unknown );
87#else
88 QgsPoint( SIP_PYOBJECT x SIP_TYPEHINT( Optional[Union[QgsPoint, QPointF, float]] ) = Py_None, SIP_PYOBJECT y SIP_TYPEHINT( Optional[float] ) = Py_None, SIP_PYOBJECT z SIP_TYPEHINT( Optional[float] ) = Py_None, SIP_PYOBJECT m SIP_TYPEHINT( Optional[float] ) = Py_None, SIP_PYOBJECT wkbType SIP_TYPEHINT( Optional[int] ) = Py_None ) [( double x = 0.0, double y = 0.0, double z = 0.0, double m = 0.0, Qgis::WkbType wkbType = Qgis::WkbType::Unknown )];
89 % MethodCode
90 if ( sipCanConvertToType( a0, sipType_QgsPointXY, SIP_NOT_NONE ) && a1 == Py_None && a2 == Py_None && a3 == Py_None && a4 == Py_None )
91 {
92 int state;
93 sipIsErr = 0;
94
95 QgsPointXY *p = reinterpret_cast<QgsPointXY *>( sipConvertToType( a0, sipType_QgsPointXY, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
96 if ( sipIsErr )
97 {
98 sipReleaseType( p, sipType_QgsPointXY, state );
99 }
100 else
101 {
102 sipCpp = new sipQgsPoint( QgsPoint( *p ) );
103 }
104 }
105 else if ( sipCanConvertToType( a0, sipType_QPointF, SIP_NOT_NONE ) && a1 == Py_None && a2 == Py_None && a3 == Py_None && a4 == Py_None )
106 {
107 int state;
108 sipIsErr = 0;
109
110 QPointF *p = reinterpret_cast<QPointF *>( sipConvertToType( a0, sipType_QPointF, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
111 if ( sipIsErr )
112 {
113 sipReleaseType( p, sipType_QPointF, state );
114 }
115 else
116 {
117 sipCpp = new sipQgsPoint( QgsPoint( *p ) );
118 }
119 }
120 else if (
121 ( a0 == Py_None || PyFloat_AsDouble( a0 ) != -1.0 || !PyErr_Occurred() ) &&
122 ( a1 == Py_None || PyFloat_AsDouble( a1 ) != -1.0 || !PyErr_Occurred() ) &&
123 ( a2 == Py_None || PyFloat_AsDouble( a2 ) != -1.0 || !PyErr_Occurred() ) &&
124 ( a3 == Py_None || PyFloat_AsDouble( a3 ) != -1.0 || !PyErr_Occurred() ) )
125 {
126 double x = a0 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a0 );
127 double y = a1 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a1 );
128 double z = a2 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a2 );
129 double m = a3 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a3 );
130 Qgis::WkbType wkbType = a4 == Py_None ? Qgis::WkbType::Unknown : static_cast<Qgis::WkbType>( sipConvertToEnum( a4, sipType_Qgis_WkbType ) );
131 sipCpp = new sipQgsPoint( QgsPoint( x, y, z, m, wkbType ) );
132 }
133 else // Invalid ctor arguments
134 {
135 PyErr_SetString( PyExc_TypeError, QStringLiteral( "Invalid type in constructor arguments." ).toUtf8().constData() );
136 sipIsErr = 1;
137 }
138 % End
139#endif
140
144 explicit QgsPoint( const QgsPointXY &p ) SIP_SKIP;
145
149 explicit QgsPoint( QPointF p ) SIP_SKIP;
150
156 explicit QgsPoint( Qgis::WkbType wkbType, double x = std::numeric_limits<double>::quiet_NaN(), double y = std::numeric_limits<double>::quiet_NaN(), double z = std::numeric_limits<double>::quiet_NaN(), double m = std::numeric_limits<double>::quiet_NaN() ) SIP_SKIP;
157
158#ifndef SIP_RUN
159 private:
160 bool fuzzyHelper( double epsilon,
161 const QgsAbstractGeometry &other,
162 bool is3DFlag,
163 bool isMeasureFlag,
164 std::function<bool( double, double, double, double, double, double, double, double, double )> comparator3DMeasure,
165 std::function<bool( double, double, double, double, double, double, double )> comparator3D,
166 std::function<bool( double, double, double, double, double, double, double )> comparatorMeasure,
167 std::function<bool( double, double, double, double, double )> comparator2D ) const
168 {
169 const QgsPoint *pt = qgsgeometry_cast< const QgsPoint * >( &other );
170 if ( !pt )
171 return false;
172
173 const Qgis::WkbType type = wkbType();
174
175 if ( pt->wkbType() != type )
176 return false;
177
178 if ( is3DFlag && isMeasureFlag )
179 {
180 return comparator3DMeasure( epsilon, mX, mY, mZ, mM, pt->x(), pt->y(), pt->z(), pt->m() );
181 }
182 else if ( is3DFlag )
183 {
184 return comparator3D( epsilon, mX, mY, mZ, pt->x(), pt->y(), pt->z() );
185 }
186 else if ( isMeasureFlag )
187 {
188 return comparatorMeasure( epsilon, mX, mY, mM, pt->x(), pt->y(), pt->m() );
189 }
190 return comparator2D( epsilon, mX, mY, pt->x(), pt->y() );
191 }
192#endif // !SIP_RUN
193
194 public:
195 bool fuzzyEqual( const QgsAbstractGeometry &other, double epsilon = 1e-8 ) const override SIP_HOLDGIL
196 {
197 return fuzzyHelper(
198 epsilon,
199 other,
200 is3D(),
201 isMeasure(),
202 []( double epsilon, double x1, double y1, double z1, double m1,
203 double x2, double y2, double z2, double m2 )
204 {
205 return QgsGeometryUtilsBase::fuzzyEqual( epsilon, x1, y1, z1, m1, x2, y2, z2, m2 );
206 },
207 []( double epsilon, double x1, double y1, double z1,
208 double x2, double y2, double z2 )
209 {
210 return QgsGeometryUtilsBase::fuzzyEqual( epsilon, x1, y1, z1, x2, y2, z2 );
211 },
212 []( double epsilon, double x1, double y1, double m1,
213 double x2, double y2, double m2 )
214 {
215 return QgsGeometryUtilsBase::fuzzyEqual( epsilon, x1, y1, m1, x2, y2, m2 );
216 },
217 []( double epsilon, double x1, double y1,
218 double x2, double y2 )
219 {
220 return QgsGeometryUtilsBase::fuzzyEqual( epsilon, x1, y1, x2, y2 );
221 } );
222 }
223
224 bool fuzzyDistanceEqual( const QgsAbstractGeometry &other, double epsilon = 1e-8 ) const override SIP_HOLDGIL
225 {
226 return fuzzyHelper(
227 epsilon,
228 other,
229 is3D(),
230 isMeasure(),
231 []( double epsilon, double x1, double y1, double z1, double m1,
232 double x2, double y2, double z2, double m2 )
233 {
234 return QgsGeometryUtilsBase::fuzzyDistanceEqual( epsilon, x1, y1, z1, m1, x2, y2, z2, m2 );
235 },
236 []( double epsilon, double x1, double y1, double z1,
237 double x2, double y2, double z2 )
238 {
239 return QgsGeometryUtilsBase::fuzzyDistanceEqual( epsilon, x1, y1, z1, x2, y2, z2 );
240 },
241 []( double epsilon, double x1, double y1, double m1,
242 double x2, double y2, double m2 )
243 {
244 return QgsGeometryUtilsBase::fuzzyDistanceEqual( epsilon, x1, y1, m1, x2, y2, m2 );
245 },
246 []( double epsilon, double x1, double y1,
247 double x2, double y2 )
248 {
249 return QgsGeometryUtilsBase::fuzzyDistanceEqual( epsilon, x1, y1, x2, y2 );
250 } );
251 }
252
253 bool operator==( const QgsAbstractGeometry &other ) const override SIP_HOLDGIL
254 {
255 return fuzzyEqual( other, 1e-8 );
256 }
257
258 bool operator!=( const QgsAbstractGeometry &other ) const override SIP_HOLDGIL
259 {
260 return !fuzzyEqual( other, 1e-8 );
261 }
262
268 double x() const SIP_HOLDGIL { return mX; }
269
275 double y() const SIP_HOLDGIL { return mY; }
276
282 double z() const SIP_HOLDGIL { return mZ; }
283
289 double m() const SIP_HOLDGIL { return mM; }
290
298 double &rx() SIP_SKIP { clearCache(); return mX; }
299
307 double &ry() SIP_SKIP { clearCache(); return mY; }
308
316 double &rz() SIP_SKIP { clearCache(); return mZ; }
317
325 double &rm() SIP_SKIP { clearCache(); return mM; }
326
332 void setX( double x ) SIP_HOLDGIL
333 {
334 clearCache();
335 mX = x;
336 }
337
343 void setY( double y ) SIP_HOLDGIL
344 {
345 clearCache();
346 mY = y;
347 }
348
356 void setZ( double z ) SIP_HOLDGIL
357 {
358 if ( !is3D() )
359 return;
360 clearCache();
361 mZ = z;
362 }
363
371 void setM( double m ) SIP_HOLDGIL
372 {
373 if ( !isMeasure() )
374 return;
375 clearCache();
376 mM = m;
377 }
378
382 QPointF toQPointF() const SIP_HOLDGIL
383 {
384 return QPointF( mX, mY );
385 }
386
393 double distance( double x, double y ) const SIP_HOLDGIL
394 {
395 return QgsGeometryUtilsBase::distance2D( mX, mY, x, y );
396 }
397
404 double distance( const QgsPoint &other ) const SIP_HOLDGIL
405 {
406 return QgsGeometryUtilsBase::distance2D( mX, mY, other.x(), other.y() );
407 }
408
415 double distanceSquared( double x, double y ) const SIP_HOLDGIL
416 {
417 return QgsGeometryUtilsBase::sqrDistance2D( mX, mY, x, y );
418 }
419
426 double distanceSquared( const QgsPoint &other ) const SIP_HOLDGIL
427 {
428 return QgsGeometryUtilsBase::sqrDistance2D( mX, mY, other.x(), other.y() );
429 }
430
437 double distance3D( double x, double y, double z ) const SIP_HOLDGIL
438 {
439 if ( is3D() || !std::isnan( z ) )
440 {
441 return QgsGeometryUtilsBase::distance3D( mX, mY, mZ, x, y, z );
442 }
443 return QgsGeometryUtilsBase::distance2D( mX, mY, x, y );
444 }
445
452 double distance3D( const QgsPoint &other ) const SIP_HOLDGIL
453 {
454 if ( is3D() || other.is3D() )
455 {
456 return QgsGeometryUtilsBase::distance3D( mX, mY, mZ, other.x(), other.y(), other.z() );
457 }
458 return QgsGeometryUtilsBase::distance2D( mX, mY, other.x(), other.y() );
459 }
460
467 double distanceSquared3D( double x, double y, double z ) const SIP_HOLDGIL
468 {
469 if ( is3D() || !std::isnan( z ) )
470 {
471 return QgsGeometryUtilsBase::sqrDistance3D( mX, mY, mZ, x, y, z );
472 }
473 return QgsGeometryUtilsBase::sqrDistance2D( mX, mY, x, y );
474 }
475
482 double distanceSquared3D( const QgsPoint &other ) const SIP_HOLDGIL
483 {
484 if ( is3D() || other.is3D() )
485 {
486 return QgsGeometryUtilsBase::sqrDistance3D( mX, mY, mZ, other.x(), other.y(), other.z() );
487 }
488 return QgsGeometryUtilsBase::sqrDistance2D( mX, mY, other.x(), other.y() );
489 }
490
494 double azimuth( const QgsPoint &other ) const SIP_HOLDGIL;
495
500 double inclination( const QgsPoint &other ) const SIP_HOLDGIL;
501
531 QgsPoint project( double distance, double azimuth, double inclination = 90.0 ) const SIP_HOLDGIL;
532
536 QgsVector operator-( const QgsPoint &p ) const SIP_HOLDGIL { return QgsVector( mX - p.mX, mY - p.mY ); }
537
541 QgsPoint &operator+=( QgsVector v ) SIP_HOLDGIL { mX += v.x(); mY += v.y(); return *this; }
542
546 QgsPoint &operator-=( QgsVector v ) SIP_HOLDGIL { mX -= v.x(); mY -= v.y(); return *this; }
547
551 QgsPoint operator+( QgsVector v ) const SIP_HOLDGIL { QgsPoint r = *this; r.rx() += v.x(); r.ry() += v.y(); return r; }
552
556 QgsPoint operator-( QgsVector v ) const SIP_HOLDGIL { QgsPoint r = *this; r.rx() -= v.x(); r.ry() -= v.y(); return r; }
557
558 //implementation of inherited methods
559 void normalize() final SIP_HOLDGIL;
560 bool isEmpty() const override SIP_HOLDGIL;
561 QgsBox3D boundingBox3D() const override SIP_HOLDGIL;
562 QString geometryType() const override SIP_HOLDGIL;
563 int dimension() const override SIP_HOLDGIL;
564 QgsPoint *clone() const override SIP_FACTORY;
565 QgsPoint *snappedToGrid( double hSpacing, double vSpacing, double dSpacing = 0, double mSpacing = 0, bool removeRedundantPoints = false ) const override SIP_FACTORY;
566 QgsPoint *simplifyByDistance( double tolerance ) const override SIP_FACTORY;
567 bool removeDuplicateNodes( double epsilon = 4 * std::numeric_limits<double>::epsilon(), bool useZValues = false ) override;
568 void clear() override;
569 bool fromWkb( QgsConstWkbPtr &wkb ) override;
570 bool fromWkt( const QString &wkt ) override;
571 int wkbSize( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const override;
572 QByteArray asWkb( QgsAbstractGeometry::WkbFlags = QgsAbstractGeometry::WkbFlags() ) const override;
573 QString asWkt( int precision = 17 ) const override;
574 QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const override;
575 QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const override;
576 json asJsonObject( int precision = 17 ) const override SIP_SKIP;
577 QString asKml( int precision = 17 ) const override;
578 void draw( QPainter &p ) const override;
579 QPainterPath asQPainterPath() const override;
580 void transform( const QgsCoordinateTransform &ct, Qgis::TransformDirection d = Qgis::TransformDirection::Forward, bool transformZ = false ) override SIP_THROW( QgsCsException );
581 void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 ) override;
582 QgsCoordinateSequence coordinateSequence() const override;
583 int nCoordinates() const override SIP_HOLDGIL;
584 int vertexNumberFromVertexId( QgsVertexId id ) const override;
585 QgsAbstractGeometry *boundary() const override SIP_FACTORY;
586 bool isValid( QString &error SIP_OUT, Qgis::GeometryValidityFlags flags = Qgis::GeometryValidityFlags() ) const override SIP_HOLDGIL;
587
588 //low-level editing
589 bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override;
590 bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override;
591 bool deleteVertex( QgsVertexId position ) override;
592
593 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;
594 bool nextVertex( QgsVertexId &id, QgsPoint &vertex SIP_OUT ) const override;
595 void adjacentVertices( QgsVertexId vertex, QgsVertexId &previousVertex SIP_OUT, QgsVertexId &nextVertex SIP_OUT ) const override;
596
602 double vertexAngle( QgsVertexId vertex ) const override;
603
604 int vertexCount( int /*part*/ = 0, int /*ring*/ = 0 ) const override;
605 int ringCount( int /*part*/ = 0 ) const override;
606 int partCount() const override;
607 QgsPoint vertexAt( QgsVertexId /*id*/ ) const override;
608 QgsPoint *toCurveType() const override SIP_FACTORY;
609 double segmentLength( QgsVertexId startVertex ) const override;
610 bool boundingBoxIntersects( const QgsRectangle &rectangle ) const override SIP_HOLDGIL;
611 bool boundingBoxIntersects( const QgsBox3D &box3d ) const override SIP_HOLDGIL;
612
613 bool addZValue( double zValue = 0 ) override;
614 bool addMValue( double mValue = 0 ) override;
615 bool dropZValue() override;
616 bool dropMValue() override;
617 void swapXy() override;
618 bool convertTo( Qgis::WkbType type ) override;
619
620 bool transform( QgsAbstractGeometryTransformer *transformer, QgsFeedback *feedback = nullptr ) override;
621
622#ifndef SIP_RUN
623
624 void filterVertices( const std::function< bool( const QgsPoint & ) > &filter ) override;
625 void transformVertices( const std::function< QgsPoint( const QgsPoint & ) > &transform ) override;
626
633 inline static const QgsPoint *cast( const QgsAbstractGeometry *geom )
634 {
635 if ( geom && QgsWkbTypes::flatType( geom->wkbType() ) == Qgis::WkbType::Point )
636 return static_cast<const QgsPoint *>( geom );
637 return nullptr;
638 }
639#endif
640
642
643#ifdef SIP_RUN
644 SIP_PYOBJECT __repr__();
645 % MethodCode
646 QString str = QStringLiteral( "<QgsPoint: %1>" ).arg( sipCpp->asWkt() );
647 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
648 % End
649#endif
650
651 protected:
652
653 int compareToSameClass( const QgsAbstractGeometry *other ) const final;
654 int childCount() const override;
655 QgsPoint childPoint( int index ) const override;
656
657 private:
658 double mX;
659 double mY;
660 double mZ;
661 double mM;
662};
663
664// clazy:excludeall=qstring-allocations
665
666#endif // QGSPOINT_H
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:256
@ Unknown
Unknown.
An abstract base class for classes which transform geometries by transforming input points to output ...
Abstract base class for all geometries.
virtual QgsPoint childPoint(int index) const
Returns point at index (for geometries without child geometries - i.e.
bool isMeasure() const
Returns true if the geometry contains m values.
virtual int childCount() const
Returns number of child geometries (for geometries with child geometries) or child points (for geomet...
virtual void transformVertices(const std::function< QgsPoint(const QgsPoint &) > &transform)
Transforms the vertices from the geometry in place, applying the transform function to every vertex.
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
virtual QgsAbstractGeometry * createEmptyWithSameType() const =0
Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
virtual void clearCache() const
Clears any cached parameters associated with the geometry, e.g., bounding boxes.
Qgis::WkbType wkbType() const
Returns the WKB type of the geometry.
virtual bool fuzzyEqual(const QgsAbstractGeometry &other, double epsilon=1e-8) const =0
Performs fuzzy comparison between this geometry and other using an epsilon.
virtual void normalize()=0
Reorganizes the geometry into a normalized form (or "canonical" form).
virtual void filterVertices(const std::function< bool(const QgsPoint &) > &filter)
Filters the vertices from the geometry in place, removing any which do not return true for the filter...
virtual int compareToSameClass(const QgsAbstractGeometry *other) const =0
Compares to an other geometry of the same class, and returns a integer for sorting of the two geometr...
A 3-dimensional box composed of x, y, z coordinates.
Definition qgsbox3d.h:43
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.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
static double sqrDistance2D(double x1, double y1, double x2, double y2)
Returns the squared 2D distance between (x1, y1) and (x2, y2).
static double distance2D(double x1, double y1, double x2, double y2)
Returns the 2D distance between (x1, y1) and (x2, y2).
static bool fuzzyEqual(T epsilon, const Args &... args) noexcept
Performs fuzzy comparison between pairs of values within a specified epsilon.
static double distance3D(double x1, double y1, double z1, double x2, double y2, double z2)
Returns the 3D distance between (x1, y1, z1) and (x2, y2, z2).
static double sqrDistance3D(double x1, double y1, double z1, double x2, double y2, double z2)
Returns the squared 3D distance between (x1, y1, z1) and (x2, y2, z2).
static bool fuzzyDistanceEqual(T epsilon, const Args &... args) noexcept
Compare equality between multiple pairs of values with a specified epsilon.
A class to represent a 2D point.
Definition qgspointxy.h:60
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:49
double z() const
Returns the point's z-coordinate.
Definition qgspoint.h:282
bool fuzzyDistanceEqual(const QgsAbstractGeometry &other, double epsilon=1e-8) const override
Performs fuzzy distance comparison between this geometry and other using an epsilon.
Definition qgspoint.h:224
void setY(double y)
Sets the point's y-coordinate.
Definition qgspoint.h:343
bool operator==(const QgsAbstractGeometry &other) const override
Definition qgspoint.h:253
double distance3D(const QgsPoint &other) const
Returns the Cartesian 3D distance between this point and another point.
Definition qgspoint.h:452
QgsPoint operator-(QgsVector v) const
Subtracts a vector from this point.
Definition qgspoint.h:556
double & rx()
Returns a reference to the x-coordinate of this point.
Definition qgspoint.h:298
QgsPoint operator+(QgsVector v) const
Adds a vector to this point.
Definition qgspoint.h:551
double distanceSquared3D(const QgsPoint &other) const
Returns the Cartesian 3D squared distance between this point and another point.
Definition qgspoint.h:482
void setX(double x)
Sets the point's x-coordinate.
Definition qgspoint.h:332
QgsPoint & operator+=(QgsVector v)
Adds a vector to this point in place.
Definition qgspoint.h:541
static const QgsPoint * cast(const QgsAbstractGeometry *geom)
Cast the geom to a QgsPoint.
Definition qgspoint.h:633
QPointF toQPointF() const
Returns the point as a QPointF.
Definition qgspoint.h:382
double distance(const QgsPoint &other) const
Returns the Cartesian 2D distance between this point and another point.
Definition qgspoint.h:404
double distance3D(double x, double y, double z) const
Returns the Cartesian 3D distance between this point and a specified x, y, z coordinate.
Definition qgspoint.h:437
double distanceSquared3D(double x, double y, double z) const
Returns the Cartesian 3D squared distance between this point and a specified x, y,...
Definition qgspoint.h:467
double z
Definition qgspoint.h:54
double x
Definition qgspoint.h:52
void setM(double m)
Sets the point's m-value.
Definition qgspoint.h:371
double y() const
Returns the point's y-coordinate.
Definition qgspoint.h:275
QgsPoint & operator-=(QgsVector v)
Subtracts a vector from this point in place.
Definition qgspoint.h:546
bool fuzzyEqual(const QgsAbstractGeometry &other, double epsilon=1e-8) const override
Performs fuzzy comparison between this geometry and other using an epsilon.
Definition qgspoint.h:195
double distanceSquared(const QgsPoint &other) const
Returns the Cartesian 2D squared distance between this point another point.
Definition qgspoint.h:426
double distance(double x, double y) const
Returns the Cartesian 2D distance between this point and a specified x, y coordinate.
Definition qgspoint.h:393
double m() const
Returns the point's m value.
Definition qgspoint.h:289
double & ry()
Returns a reference to the y-coordinate of this point.
Definition qgspoint.h:307
void setZ(double z)
Sets the point's z-coordinate.
Definition qgspoint.h:356
double distanceSquared(double x, double y) const
Returns the Cartesian 2D squared distance between this point a specified x, y coordinate.
Definition qgspoint.h:415
double m
Definition qgspoint.h:55
double y
Definition qgspoint.h:53
bool operator!=(const QgsAbstractGeometry &other) const override
Definition qgspoint.h:258
double & rz()
Returns a reference to the z-coordinate of this point.
Definition qgspoint.h:316
double & rm()
Returns a reference to the m value of this point.
Definition qgspoint.h:325
double x() const
Returns the point's x-coordinate.
Definition qgspoint.h:268
A rectangle specified with double values.
A class to represent a vector.
Definition qgsvector.h:30
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
#define str(x)
Definition qgis.cpp:38
#define SIP_TYPEHINT(type)
Definition qgis_sip.h:232
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_OUT
Definition qgis_sip.h:58
#define SIP_HOLDGIL
Definition qgis_sip.h:171
#define SIP_FACTORY
Definition qgis_sip.h:76
#define SIP_THROW(name,...)
Definition qgis_sip.h:203
QVector< QgsRingSequence > QgsCoordinateSequence
double closestSegment(const QgsPolylineXY &pl, const QgsPointXY &pt, int &vertexAfter, double epsilon)
Definition qgstracer.cpp:69
int precision
Utility class for identifying a unique vertex within a geometry.
Definition qgsvertexid.h:30