QGIS API Documentation 3.41.0-Master (64d82d4c163)
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 sipCpp = new sipQgsPoint( QgsPoint( *p ) );
99 }
100 sipReleaseType( p, sipType_QgsPointXY, state );
101 }
102 else if ( sipCanConvertToType( a0, sipType_QPointF, SIP_NOT_NONE ) && a1 == Py_None && a2 == Py_None && a3 == Py_None && a4 == Py_None )
103 {
104 int state;
105 sipIsErr = 0;
106
107 QPointF *p = reinterpret_cast<QPointF *>( sipConvertToType( a0, sipType_QPointF, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
108 if ( !sipIsErr )
109 {
110 sipCpp = new sipQgsPoint( QgsPoint( *p ) );
111 }
112 sipReleaseType( p, sipType_QPointF, state );
113 }
114 else if (
115 ( a0 == Py_None || PyFloat_AsDouble( a0 ) != -1.0 || !PyErr_Occurred() ) &&
116 ( a1 == Py_None || PyFloat_AsDouble( a1 ) != -1.0 || !PyErr_Occurred() ) &&
117 ( a2 == Py_None || PyFloat_AsDouble( a2 ) != -1.0 || !PyErr_Occurred() ) &&
118 ( a3 == Py_None || PyFloat_AsDouble( a3 ) != -1.0 || !PyErr_Occurred() ) )
119 {
120 double x = a0 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a0 );
121 double y = a1 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a1 );
122 double z = a2 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a2 );
123 double m = a3 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a3 );
124 Qgis::WkbType wkbType = a4 == Py_None ? Qgis::WkbType::Unknown : static_cast<Qgis::WkbType>( sipConvertToEnum( a4, sipType_Qgis_WkbType ) );
125 sipCpp = new sipQgsPoint( QgsPoint( x, y, z, m, wkbType ) );
126 }
127 else // Invalid ctor arguments
128 {
129 PyErr_SetString( PyExc_TypeError, QStringLiteral( "Invalid type in constructor arguments." ).toUtf8().constData() );
130 sipIsErr = 1;
131 }
132 % End
133#endif
134
138 explicit QgsPoint( const QgsPointXY &p ) SIP_SKIP;
139
143 explicit QgsPoint( QPointF p ) SIP_SKIP;
144
150 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;
151
152#ifndef SIP_RUN
153 private:
154 bool fuzzyHelper( double epsilon,
155 const QgsAbstractGeometry &other,
156 bool is3DFlag,
157 bool isMeasureFlag,
158 std::function<bool( double, double, double, double, double, double, double, double, double )> comparator3DMeasure,
159 std::function<bool( double, double, double, double, double, double, double )> comparator3D,
160 std::function<bool( double, double, double, double, double, double, double )> comparatorMeasure,
161 std::function<bool( double, double, double, double, double )> comparator2D ) const
162 {
163 const QgsPoint *pt = qgsgeometry_cast< const QgsPoint * >( &other );
164 if ( !pt )
165 return false;
166
167 const Qgis::WkbType type = wkbType();
168
169 if ( pt->wkbType() != type )
170 return false;
171
172 if ( is3DFlag && isMeasureFlag )
173 {
174 return comparator3DMeasure( epsilon, mX, mY, mZ, mM, pt->x(), pt->y(), pt->z(), pt->m() );
175 }
176 else if ( is3DFlag )
177 {
178 return comparator3D( epsilon, mX, mY, mZ, pt->x(), pt->y(), pt->z() );
179 }
180 else if ( isMeasureFlag )
181 {
182 return comparatorMeasure( epsilon, mX, mY, mM, pt->x(), pt->y(), pt->m() );
183 }
184 return comparator2D( epsilon, mX, mY, pt->x(), pt->y() );
185 }
186#endif // !SIP_RUN
187
188 public:
189 bool fuzzyEqual( const QgsAbstractGeometry &other, double epsilon = 1e-8 ) const override SIP_HOLDGIL
190 {
191 return fuzzyHelper(
192 epsilon,
193 other,
194 is3D(),
195 isMeasure(),
196 []( double epsilon, double x1, double y1, double z1, double m1,
197 double x2, double y2, double z2, double m2 )
198 {
199 return QgsGeometryUtilsBase::fuzzyEqual( epsilon, x1, y1, z1, m1, x2, y2, z2, m2 );
200 },
201 []( double epsilon, double x1, double y1, double z1,
202 double x2, double y2, double z2 )
203 {
204 return QgsGeometryUtilsBase::fuzzyEqual( epsilon, x1, y1, z1, x2, y2, z2 );
205 },
206 []( double epsilon, double x1, double y1, double m1,
207 double x2, double y2, double m2 )
208 {
209 return QgsGeometryUtilsBase::fuzzyEqual( epsilon, x1, y1, m1, x2, y2, m2 );
210 },
211 []( double epsilon, double x1, double y1,
212 double x2, double y2 )
213 {
214 return QgsGeometryUtilsBase::fuzzyEqual( epsilon, x1, y1, x2, y2 );
215 } );
216 }
217
218 bool fuzzyDistanceEqual( const QgsAbstractGeometry &other, double epsilon = 1e-8 ) const override SIP_HOLDGIL
219 {
220 return fuzzyHelper(
221 epsilon,
222 other,
223 is3D(),
224 isMeasure(),
225 []( double epsilon, double x1, double y1, double z1, double m1,
226 double x2, double y2, double z2, double m2 )
227 {
228 return QgsGeometryUtilsBase::fuzzyDistanceEqual( epsilon, x1, y1, z1, m1, x2, y2, z2, m2 );
229 },
230 []( double epsilon, double x1, double y1, double z1,
231 double x2, double y2, double z2 )
232 {
233 return QgsGeometryUtilsBase::fuzzyDistanceEqual( epsilon, x1, y1, z1, x2, y2, z2 );
234 },
235 []( double epsilon, double x1, double y1, double m1,
236 double x2, double y2, double m2 )
237 {
238 return QgsGeometryUtilsBase::fuzzyDistanceEqual( epsilon, x1, y1, m1, x2, y2, m2 );
239 },
240 []( double epsilon, double x1, double y1,
241 double x2, double y2 )
242 {
243 return QgsGeometryUtilsBase::fuzzyDistanceEqual( epsilon, x1, y1, x2, y2 );
244 } );
245 }
246
247 bool operator==( const QgsAbstractGeometry &other ) const override SIP_HOLDGIL
248 {
249 return fuzzyEqual( other, 1e-8 );
250 }
251
252 bool operator!=( const QgsAbstractGeometry &other ) const override SIP_HOLDGIL
253 {
254 return !fuzzyEqual( other, 1e-8 );
255 }
256
262 double x() const SIP_HOLDGIL { return mX; }
263
269 double y() const SIP_HOLDGIL { return mY; }
270
276 double z() const SIP_HOLDGIL { return mZ; }
277
283 double m() const SIP_HOLDGIL { return mM; }
284
292 double &rx() SIP_SKIP { clearCache(); return mX; }
293
301 double &ry() SIP_SKIP { clearCache(); return mY; }
302
310 double &rz() SIP_SKIP { clearCache(); return mZ; }
311
319 double &rm() SIP_SKIP { clearCache(); return mM; }
320
326 void setX( double x ) SIP_HOLDGIL
327 {
328 clearCache();
329 mX = x;
330 }
331
337 void setY( double y ) SIP_HOLDGIL
338 {
339 clearCache();
340 mY = y;
341 }
342
350 void setZ( double z ) SIP_HOLDGIL
351 {
352 if ( !is3D() )
353 return;
354 clearCache();
355 mZ = z;
356 }
357
365 void setM( double m ) SIP_HOLDGIL
366 {
367 if ( !isMeasure() )
368 return;
369 clearCache();
370 mM = m;
371 }
372
376 QPointF toQPointF() const SIP_HOLDGIL
377 {
378 return QPointF( mX, mY );
379 }
380
387 double distance( double x, double y ) const SIP_HOLDGIL
388 {
389 return QgsGeometryUtilsBase::distance2D( mX, mY, x, y );
390 }
391
398 double distance( const QgsPoint &other ) const SIP_HOLDGIL
399 {
400 return QgsGeometryUtilsBase::distance2D( mX, mY, other.x(), other.y() );
401 }
402
409 double distanceSquared( double x, double y ) const SIP_HOLDGIL
410 {
411 return QgsGeometryUtilsBase::sqrDistance2D( mX, mY, x, y );
412 }
413
420 double distanceSquared( const QgsPoint &other ) const SIP_HOLDGIL
421 {
422 return QgsGeometryUtilsBase::sqrDistance2D( mX, mY, other.x(), other.y() );
423 }
424
431 double distance3D( double x, double y, double z ) const SIP_HOLDGIL
432 {
433 if ( is3D() || !std::isnan( z ) )
434 {
435 return QgsGeometryUtilsBase::distance3D( mX, mY, mZ, x, y, z );
436 }
437 return QgsGeometryUtilsBase::distance2D( mX, mY, x, y );
438 }
439
446 double distance3D( const QgsPoint &other ) const SIP_HOLDGIL
447 {
448 if ( is3D() || other.is3D() )
449 {
450 return QgsGeometryUtilsBase::distance3D( mX, mY, mZ, other.x(), other.y(), other.z() );
451 }
452 return QgsGeometryUtilsBase::distance2D( mX, mY, other.x(), other.y() );
453 }
454
461 double distanceSquared3D( double x, double y, double z ) const SIP_HOLDGIL
462 {
463 if ( is3D() || !std::isnan( z ) )
464 {
465 return QgsGeometryUtilsBase::sqrDistance3D( mX, mY, mZ, x, y, z );
466 }
467 return QgsGeometryUtilsBase::sqrDistance2D( mX, mY, x, y );
468 }
469
476 double distanceSquared3D( const QgsPoint &other ) const SIP_HOLDGIL
477 {
478 if ( is3D() || other.is3D() )
479 {
480 return QgsGeometryUtilsBase::sqrDistance3D( mX, mY, mZ, other.x(), other.y(), other.z() );
481 }
482 return QgsGeometryUtilsBase::sqrDistance2D( mX, mY, other.x(), other.y() );
483 }
484
488 double azimuth( const QgsPoint &other ) const SIP_HOLDGIL;
489
494 double inclination( const QgsPoint &other ) const SIP_HOLDGIL;
495
525 QgsPoint project( double distance, double azimuth, double inclination = 90.0 ) const SIP_HOLDGIL;
526
530 QgsVector operator-( const QgsPoint &p ) const SIP_HOLDGIL { return QgsVector( mX - p.mX, mY - p.mY ); }
531
535 QgsPoint &operator+=( QgsVector v ) SIP_HOLDGIL { mX += v.x(); mY += v.y(); return *this; }
536
540 QgsPoint &operator-=( QgsVector v ) SIP_HOLDGIL { mX -= v.x(); mY -= v.y(); return *this; }
541
545 QgsPoint operator+( QgsVector v ) const SIP_HOLDGIL { QgsPoint r = *this; r.rx() += v.x(); r.ry() += v.y(); return r; }
546
550 QgsPoint operator-( QgsVector v ) const SIP_HOLDGIL { QgsPoint r = *this; r.rx() -= v.x(); r.ry() -= v.y(); return r; }
551
552 //implementation of inherited methods
553 void normalize() final SIP_HOLDGIL;
554 bool isEmpty() const override SIP_HOLDGIL;
555 QgsBox3D boundingBox3D() const override SIP_HOLDGIL;
556 QString geometryType() const override SIP_HOLDGIL;
557 int dimension() const override SIP_HOLDGIL;
558 QgsPoint *clone() const override SIP_FACTORY;
559 QgsPoint *snappedToGrid( double hSpacing, double vSpacing, double dSpacing = 0, double mSpacing = 0, bool removeRedundantPoints = false ) const override SIP_FACTORY;
560 QgsPoint *simplifyByDistance( double tolerance ) const override SIP_FACTORY;
561 bool removeDuplicateNodes( double epsilon = 4 * std::numeric_limits<double>::epsilon(), bool useZValues = false ) override;
562 void clear() override;
563 bool fromWkb( QgsConstWkbPtr &wkb ) override;
564 bool fromWkt( const QString &wkt ) override;
565 int wkbSize( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const override;
566 QByteArray asWkb( QgsAbstractGeometry::WkbFlags = QgsAbstractGeometry::WkbFlags() ) const override;
567 QString asWkt( int precision = 17 ) const override;
568 QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const override;
569 QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const override;
570 json asJsonObject( int precision = 17 ) const override SIP_SKIP;
571 QString asKml( int precision = 17 ) const override;
572 void draw( QPainter &p ) const override;
573 QPainterPath asQPainterPath() const override;
574 void transform( const QgsCoordinateTransform &ct, Qgis::TransformDirection d = Qgis::TransformDirection::Forward, bool transformZ = false ) override SIP_THROW( QgsCsException );
575 void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 ) override;
576 QgsCoordinateSequence coordinateSequence() const override;
577 int nCoordinates() const override SIP_HOLDGIL;
578 int vertexNumberFromVertexId( QgsVertexId id ) const override;
579 QgsAbstractGeometry *boundary() const override SIP_FACTORY;
580 bool isValid( QString &error SIP_OUT, Qgis::GeometryValidityFlags flags = Qgis::GeometryValidityFlags() ) const override SIP_HOLDGIL;
581
582 //low-level editing
583 bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override;
584 bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override;
585 bool deleteVertex( QgsVertexId position ) override;
586
587 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;
588 bool nextVertex( QgsVertexId &id, QgsPoint &vertex SIP_OUT ) const override;
589 void adjacentVertices( QgsVertexId vertex, QgsVertexId &previousVertex SIP_OUT, QgsVertexId &nextVertex SIP_OUT ) const override;
590
596 double vertexAngle( QgsVertexId vertex ) const override;
597
598 int vertexCount( int /*part*/ = 0, int /*ring*/ = 0 ) const override;
599 int ringCount( int /*part*/ = 0 ) const override;
600 int partCount() const override;
601 QgsPoint vertexAt( QgsVertexId /*id*/ ) const override;
602 QgsPoint *toCurveType() const override SIP_FACTORY;
603 double segmentLength( QgsVertexId startVertex ) const override;
604 bool boundingBoxIntersects( const QgsRectangle &rectangle ) const override SIP_HOLDGIL;
605 bool boundingBoxIntersects( const QgsBox3D &box3d ) const override SIP_HOLDGIL;
606
607 bool addZValue( double zValue = 0 ) override;
608 bool addMValue( double mValue = 0 ) override;
609 bool dropZValue() override;
610 bool dropMValue() override;
611 void swapXy() override;
612 bool convertTo( Qgis::WkbType type ) override;
613
614 bool transform( QgsAbstractGeometryTransformer *transformer, QgsFeedback *feedback = nullptr ) override;
615
616#ifndef SIP_RUN
617
618 void filterVertices( const std::function< bool( const QgsPoint & ) > &filter ) override;
619 void transformVertices( const std::function< QgsPoint( const QgsPoint & ) > &transform ) override;
620
627 inline static const QgsPoint *cast( const QgsAbstractGeometry *geom )
628 {
629 if ( geom && QgsWkbTypes::flatType( geom->wkbType() ) == Qgis::WkbType::Point )
630 return static_cast<const QgsPoint *>( geom );
631 return nullptr;
632 }
633#endif
634
636
637#ifdef SIP_RUN
638 SIP_PYOBJECT __repr__();
639 % MethodCode
640 QString str = QStringLiteral( "<QgsPoint: %1>" ).arg( sipCpp->asWkt() );
641 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
642 % End
643#endif
644
645 protected:
646
647 int compareToSameClass( const QgsAbstractGeometry *other ) const final;
648 int childCount() const override;
649 QgsPoint childPoint( int index ) const override;
650
651 private:
652 double mX;
653 double mY;
654 double mZ;
655 double mM;
656};
657
658// clazy:excludeall=qstring-allocations
659
660#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:276
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:218
void setY(double y)
Sets the point's y-coordinate.
Definition qgspoint.h:337
bool operator==(const QgsAbstractGeometry &other) const override
Definition qgspoint.h:247
double distance3D(const QgsPoint &other) const
Returns the Cartesian 3D distance between this point and another point.
Definition qgspoint.h:446
QgsPoint operator-(QgsVector v) const
Subtracts a vector from this point.
Definition qgspoint.h:550
double & rx()
Returns a reference to the x-coordinate of this point.
Definition qgspoint.h:292
QgsPoint operator+(QgsVector v) const
Adds a vector to this point.
Definition qgspoint.h:545
double distanceSquared3D(const QgsPoint &other) const
Returns the Cartesian 3D squared distance between this point and another point.
Definition qgspoint.h:476
void setX(double x)
Sets the point's x-coordinate.
Definition qgspoint.h:326
QgsPoint & operator+=(QgsVector v)
Adds a vector to this point in place.
Definition qgspoint.h:535
static const QgsPoint * cast(const QgsAbstractGeometry *geom)
Cast the geom to a QgsPoint.
Definition qgspoint.h:627
QPointF toQPointF() const
Returns the point as a QPointF.
Definition qgspoint.h:376
double distance(const QgsPoint &other) const
Returns the Cartesian 2D distance between this point and another point.
Definition qgspoint.h:398
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:431
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:461
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:365
double y() const
Returns the point's y-coordinate.
Definition qgspoint.h:269
QgsPoint & operator-=(QgsVector v)
Subtracts a vector from this point in place.
Definition qgspoint.h:540
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:189
double distanceSquared(const QgsPoint &other) const
Returns the Cartesian 2D squared distance between this point another point.
Definition qgspoint.h:420
double distance(double x, double y) const
Returns the Cartesian 2D distance between this point and a specified x, y coordinate.
Definition qgspoint.h:387
double m() const
Returns the point's m value.
Definition qgspoint.h:283
double & ry()
Returns a reference to the y-coordinate of this point.
Definition qgspoint.h:301
void setZ(double z)
Sets the point's z-coordinate.
Definition qgspoint.h:350
double distanceSquared(double x, double y) const
Returns the Cartesian 2D squared distance between this point a specified x, y coordinate.
Definition qgspoint.h:409
double m
Definition qgspoint.h:55
double y
Definition qgspoint.h:53
bool operator!=(const QgsAbstractGeometry &other) const override
Definition qgspoint.h:252
double & rz()
Returns a reference to the z-coordinate of this point.
Definition qgspoint.h:310
double & rm()
Returns a reference to the m value of this point.
Definition qgspoint.h:319
double x() const
Returns the point's x-coordinate.
Definition qgspoint.h:262
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 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:70
int precision
Utility class for identifying a unique vertex within a geometry.
Definition qgsvertexid.h:30