33using namespace Qt::StringLiterals;
65 Q_PROPERTY(
double x READ
x WRITE
setX )
66 Q_PROPERTY(
double y READ
y WRITE
setY )
169 return QPointF( mX, mY );
176 QString toString(
int precision = -1 )
const;
182 QString asWkt()
const;
308 if ( &other !=
this )
346 operator QVariant()
const
348 return QVariant::fromValue( *
this );
352 SIP_PYOBJECT __repr__();
354 QString str = u
"<QgsPointXY: %1>"_s.arg( sipCpp->asWkt() );
355 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
364 SIP_PYOBJECT __getitem__(
int );
368 sipRes = Py_BuildValue(
"d", sipCpp->x() );
372 sipRes = Py_BuildValue(
"d", sipCpp->y() );
376 QString msg = QString(
"Bad index: %1" ).arg( a0 );
377 PyErr_SetString( PyExc_IndexError, msg.toLatin1().constData() );
381 long __hash__()
const;
383 sipRes =
qHash( *sipCpp );
396 bool mIsEmpty =
true;
398 friend uint
qHash(
const QgsPointXY &pnt );
407 os << p.toString().toLocal8Bit().data();
414 const uint h1 =
qHash(
static_cast< quint64
>( p.mX ) );
415 const uint h2 =
qHash(
static_cast< quint64
>( p.mY ) );
416 hash = h1 ^ ( h2 << 1 );
static const double DEFAULT_SEGMENT_EPSILON
Default snapping tolerance for segments.
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 bool fuzzyDistanceEqual(T epsilon, const Args &... args) noexcept
Compare equality between multiple pairs of values with a specified epsilon.
double x() const
Gets the x value of the point.
QgsPointXY(QPoint point)
Create a point from a QPoint.
QgsPointXY operator*(double scalar) const
Multiplies the coordinates in this point by a scalar quantity.
QgsPointXY & operator-=(QgsVector v)
Subtracts a vector from this point in place.
QgsPointXY(QPointF point)
Create a point from a QPointF.
double sqrDist(double x, double y) const
Returns the squared distance between this point a specified x, y coordinate.
double distance(double x, double y) const
Returns the distance between this point and a specified x, y coordinate.
QgsPointXY operator-(QgsVector v) const
Subtracts a vector from this point.
void setY(double y)
Sets the y value of the point.
double distance(const QgsPointXY &other) const
Returns the distance between this point and another point.
void multiply(double scalar)
Multiply x and y by the given value.
QgsPointXY & operator*=(double scalar)
Multiplies the coordinates in this point by a scalar quantity in place.
QgsPointXY operator/(double scalar) const
Divides the coordinates in this point by a scalar quantity.
QgsPointXY & operator/=(double scalar)
Divides the coordinates in this point by a scalar quantity in place.
bool compare(const QgsPointXY &other, double epsilon=4 *std::numeric_limits< double >::epsilon()) const
Compares this point with another point with a fuzzy tolerance.
bool operator==(const QgsPointXY &other) const
bool operator!=(const QgsPointXY &other) const
void set(double x, double y)
Sets the x and y value of the point.
QgsPointXY & operator+=(QgsVector v)
Adds a vector to this point in place.
QgsPointXY & operator=(const QgsPointXY &other)
QgsVector operator-(const QgsPointXY &p) const
Calculates the vector obtained by subtracting a point from this point.
double y() const
Gets the y value of the point.
double sqrDist(const QgsPointXY &other) const
Returns the squared distance between this point another point.
void setX(double x)
Sets the x value of the point.
bool distanceCompare(const QgsPointXY &other, double epsilon=4 *std::numeric_limits< double >::epsilon()) const
Compares this point with another point with a fuzzy tolerance using distance comparison.
bool isEmpty() const
Returns true if the geometry is empty.
QPointF toQPointF() const
Converts a point to a QPointF.
QgsPointXY operator+(QgsVector v) const
Adds a vector to this point.
Point geometry type, with support for z-dimension and m-values.
Represent a 2-dimensional vector.
double y() const
Returns the vector's y-component.
double x() const
Returns the vector's x-component.
uint qHash(const QVariant &variant)
Hash for QVariant.
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
uint qHash(const QgsPointXY &p)