62 Q_PROPERTY(
double x READ x WRITE setX )
63 Q_PROPERTY(
double y READ y WRITE setY )
171 return QPointF( mX, mY );
178 QString toString(
int precision = -1 )
const;
184 QString asWkt()
const;
192 return ( mX - x ) * ( mX - x ) + ( mY - y ) * ( mY - y );
201 return sqrDist( other.x(), other.y() );
213 return std::sqrt( sqrDist( x, y ) );
224 return std::sqrt( sqrDist( other ) );
266 if ( isEmpty() && other.
isEmpty() )
268 if ( isEmpty() && !other.
isEmpty() )
270 if ( ! isEmpty() && other.
isEmpty() )
283 if ( isEmpty() && other.
isEmpty() )
285 if ( isEmpty() && !other.
isEmpty() )
287 if ( ! isEmpty() && other.
isEmpty() )
307 if ( &other !=
this )
345 operator QVariant()
const
347 return QVariant::fromValue( *
this );
351 SIP_PYOBJECT __repr__();
353 QString
str = QStringLiteral(
"<QgsPointXY: %1>" ).arg( sipCpp->asWkt() );
354 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
363 SIP_PYOBJECT __getitem__(
int );
367 sipRes = Py_BuildValue(
"d", sipCpp->x() );
371 sipRes = Py_BuildValue(
"d", sipCpp->y() );
375 QString msg = QString(
"Bad index: %1" ).arg( a0 );
376 PyErr_SetString( PyExc_IndexError, msg.toLatin1().constData() );
380 long __hash__()
const;
382 sipRes =
qHash( *sipCpp );
395 bool mIsEmpty =
true;
405 const bool nan1X = std::isnan( p1.x() );
406 const bool nan2X = std::isnan( p2.x() );
407 if ( nan1X != nan2X )
412 const bool nan1Y = std::isnan( p1.y() );
413 const bool nan2Y = std::isnan( p2.y() );
414 if ( nan1Y != nan2Y )
426 os << p.toString().toLocal8Bit().data();
433 const uint h1 =
qHash(
static_cast< quint64
>( p.mX ) );
434 const uint h2 =
qHash(
static_cast< quint64
>( p.mY ) );
435 hash = h1 ^ ( h2 << 1 );
A class to represent a 2D point.
QgsPointXY & operator=(const QgsPointXY &other) SIP_HOLDGIL
Assignment.
double distance(const QgsPointXY &other) const SIP_HOLDGIL
Returns the distance between this point and another point.
bool isEmpty() const SIP_HOLDGIL
Returns true if the geometry is empty.
QgsPointXY operator*(double scalar) const
Multiplies the coordinates in this point by a scalar quantity.
bool operator==(const QgsPointXY &other) SIP_HOLDGIL
equality operator
QgsPointXY & operator-=(QgsVector v)
Subtracts a vector from this point in place.
void set(double x, double y) SIP_HOLDGIL
Sets the x and y value of the point.
double sqrDist(const QgsPointXY &other) const SIP_HOLDGIL
Returns the squared distance between this point another point.
QgsPointXY(QPointF point) SIP_HOLDGIL
Create a point from a QPointF.
QgsPointXY operator-(QgsVector v) const
Subtracts a vector from this point.
double sqrDist(double x, double y) const SIP_HOLDGIL
Returns the squared distance between this point a specified x, y coordinate.
void setX(double x) SIP_HOLDGIL
Sets the x value of the point.
QgsPointXY(QPoint point) SIP_HOLDGIL
Create a point from a QPoint.
bool operator!=(const QgsPointXY &other) const SIP_HOLDGIL
Inequality operator.
QgsPointXY()=default
Default constructor.
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.
void multiply(double scalar) SIP_HOLDGIL
Multiply x and y by the given value.
QgsPointXY(double x, double y) SIP_HOLDGIL
Create a point from x,y coordinates.
QgsPointXY & operator+=(QgsVector v)
Adds a vector to this point in place.
bool compare(const QgsPointXY &other, double epsilon=4 *std::numeric_limits< double >::epsilon()) const SIP_HOLDGIL
Compares this point with another point with a fuzzy tolerance.
double x() const SIP_HOLDGIL
Gets the x value of the point.
QgsVector operator-(const QgsPointXY &p) const
Calculates the vector obtained by subtracting a point from this point.
double distance(double x, double y) const SIP_HOLDGIL
Returns the distance between this point and a specified x, y coordinate.
double y() const SIP_HOLDGIL
Gets the y value of the point.
void setY(double y) SIP_HOLDGIL
Sets the y value of the point.
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.
A class to represent a vector.
double y() const SIP_HOLDGIL
Returns the vector's y-component.
double x() const SIP_HOLDGIL
Returns the vector's x-component.
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)