63 Q_PROPERTY(
double x READ x WRITE setX )
64 Q_PROPERTY(
double y READ y WRITE setY )
168 return QPointF( mX, mY );
175 QString toString(
int precision = -1 )
const;
181 QString asWkt()
const;
277 if ( isEmpty() && other.
isEmpty() )
279 if ( isEmpty() && !other.
isEmpty() )
281 if ( ! isEmpty() && other.
isEmpty() )
290 if ( isEmpty() && other.
isEmpty() )
292 if ( isEmpty() && !other.
isEmpty() )
294 if ( ! isEmpty() && other.
isEmpty() )
310 if ( &other !=
this )
348 operator QVariant()
const
350 return QVariant::fromValue( *
this );
354 SIP_PYOBJECT __repr__();
356 QString
str = QStringLiteral(
"<QgsPointXY: %1>" ).arg( sipCpp->asWkt() );
357 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
366 SIP_PYOBJECT __getitem__(
int );
370 sipRes = Py_BuildValue(
"d", sipCpp->x() );
374 sipRes = Py_BuildValue(
"d", sipCpp->y() );
378 QString msg = QString(
"Bad index: %1" ).arg( a0 );
379 PyErr_SetString( PyExc_IndexError, msg.toLatin1().constData() );
383 long __hash__()
const;
385 sipRes =
qHash( *sipCpp );
398 bool mIsEmpty =
true;
408 const bool nan1X = std::isnan( p1.x() );
409 const bool nan2X = std::isnan( p2.x() );
410 if ( nan1X != nan2X )
415 const bool nan1Y = std::isnan( p1.y() );
416 const bool nan2Y = std::isnan( p2.y() );
417 if ( nan1Y != nan2Y )
429 os << p.toString().toLocal8Bit().data();
436 const uint h1 =
qHash(
static_cast< quint64
>( p.mX ) );
437 const uint h2 =
qHash(
static_cast< quint64
>( p.mY ) );
438 hash = h1 ^ ( h2 << 1 );
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.
A class to represent a 2D point.
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
Inequality operator.
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)
Assignment.
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.
bool operator==(const QgsPointXY &other)
equality operator
Point geometry type, with support for z-dimension and m-values.
A class to represent a 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.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
const double DEFAULT_SEGMENT_EPSILON
Default snapping tolerance for segments.
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
uint qHash(const QgsPointXY &p)
std::ostream & operator<<(std::ostream &os, const QgsPointXY &p)