QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
21 #include "qgis_core.h"
47 Q_PROPERTY(
double x READ x WRITE setX )
48 Q_PROPERTY(
double y READ y WRITE setY )
156 return QPointF( mX, mY );
163 QString toString(
int precision = -1 )
const;
169 QString asWkt()
const;
177 return ( mX - x ) * ( mX - x ) + ( mY - y ) * ( mY - y );
186 return sqrDist( other.x(), other.y() );
198 return std::sqrt( sqrDist( x, y ) );
209 return std::sqrt( sqrDist( other ) );
251 if ( isEmpty() && other.
isEmpty() )
253 if ( isEmpty() && !other.
isEmpty() )
255 if ( ! isEmpty() && other.
isEmpty() )
268 if ( isEmpty() && other.
isEmpty() )
270 if ( isEmpty() && !other.
isEmpty() )
272 if ( ! isEmpty() && other.
isEmpty() )
292 if ( &other !=
this )
330 operator QVariant()
const
332 return QVariant::fromValue( *
this );
336 SIP_PYOBJECT __repr__();
338 QString str = QStringLiteral(
"<QgsPointXY: %1>" ).arg( sipCpp->asWkt() );
339 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
348 SIP_PYOBJECT __getitem__(
int );
352 sipRes = Py_BuildValue(
"d", sipCpp->x() );
356 sipRes = Py_BuildValue(
"d", sipCpp->y() );
360 QString msg = QString(
"Bad index: %1" ).arg( a0 );
361 PyErr_SetString( PyExc_IndexError, msg.toLatin1().constData() );
365 long __hash__()
const;
367 sipRes =
qHash( *sipCpp );
380 bool mIsEmpty =
true;
390 const bool nan1X = std::isnan( p1.x() );
391 const bool nan2X = std::isnan( p2.x() );
392 if ( nan1X != nan2X )
397 const bool nan1Y = std::isnan( p1.y() );
398 const bool nan2Y = std::isnan( p2.y() );
399 if ( nan1Y != nan2Y )
411 os << p.toString().toLocal8Bit().data();
418 uint h1 =
qHash(
static_cast< quint64
>( p.mX ) );
419 uint h2 =
qHash(
static_cast< quint64
>( p.mY ) );
420 hash = h1 ^ ( h2 << 1 );
425 #endif //QGSPOINTXY_H
double distance(double x, double y) const SIP_HOLDGIL
Returns the distance between this point and a specified x, y coordinate.
double x() const SIP_HOLDGIL
Gets the x value of the point.
QgsPointXY(QPointF point) SIP_HOLDGIL
Create a point from a QPointF.
QgsPointXY operator+(QgsVector v) const
Adds a vector to this point.
Point geometry type, with support for z-dimension and m-values.
double y() const SIP_HOLDGIL
Gets the y value of the point.
QgsPointXY & operator+=(QgsVector v)
Adds a vector to this point in place.
void setY(double y) SIP_HOLDGIL
Sets the y value of the point.
QgsPointXY & operator/=(double scalar)
Divides the coordinates in this point by a scalar quantity in place.
QgsVector operator-(const QgsPointXY &p) const
Calculates the vector obtained by subtracting a point from this point.
QPointF toQPointF() const
Converts a point to a QPointF.
bool isEmpty() const SIP_HOLDGIL
Returns true if the geometry is empty.
double distance(const QgsPointXY &other) const SIP_HOLDGIL
Returns the distance between this point and another point.
const double DEFAULT_SEGMENT_EPSILON
Default snapping tolerance for segments.
void setX(double x) SIP_HOLDGIL
Sets the x value of the point.
void set(double x, double y) SIP_HOLDGIL
Sets the x and y value of the point.
Q_DECLARE_METATYPE(QgsMeshTimeSettings)
QgsPointXY(QPoint point) SIP_HOLDGIL
Create a point from a QPoint.
double sqrDist(double x, double y) const SIP_HOLDGIL
Returns the squared distance between this point a specified x, y coordinate.
QgsPointXY & operator=(const QgsPointXY &other) SIP_HOLDGIL
Assignment.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
QgsPointXY & operator-=(QgsVector v)
Subtracts a vector from this point in place.
double x() const SIP_HOLDGIL
Returns the vector's x-component.
double y() const SIP_HOLDGIL
Returns the vector's y-component.
QgsPointXY()=default
Default constructor.
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 sqrDist(const QgsPointXY &other) const SIP_HOLDGIL
Returns the squared distance between this point another point.
QgsPointXY operator/(double scalar) const
Divides the coordinates in this point by a scalar quantity.
A class to represent a 2D point.
QgsPointXY & operator*=(double scalar)
Multiplies the coordinates in this point by a scalar quantity in place.
QgsPointXY operator*(double scalar) const
Multiplies the coordinates in this point by a scalar quantity.
QgsPointXY(double x, double y) SIP_HOLDGIL
Create a point from x,y coordinates.
void multiply(double scalar) SIP_HOLDGIL
Multiply x and y by the given value.
A class to represent a vector.
std::ostream & operator<<(std::ostream &os, const QgsPointXY &p)
bool operator!=(const QgsPointXY &other) const SIP_HOLDGIL
Inequality operator.
bool operator==(const QgsPointXY &other) SIP_HOLDGIL
equality operator
uint qHash(const QgsPointXY &p)
QgsPointXY operator-(QgsVector v) const
Subtracts a vector from this point.