21 #include "qgis_core.h" 47 Q_PROPERTY(
double x READ x WRITE setX )
48 Q_PROPERTY(
double y READ y WRITE setY )
119 void set(
double x,
double y )
148 QPointF toQPointF()
const;
154 QString toString(
int precision = -1 )
const;
160 QString asWkt()
const;
166 double sqrDist(
double x,
double y )
const;
172 double sqrDist(
const QgsPointXY &other )
const;
181 double distance(
double x,
double y )
const;
189 double distance(
const QgsPointXY &other )
const;
195 double azimuth(
const QgsPointXY &other )
const;
204 QgsPointXY project(
double distance,
double bearing )
const;
213 bool compare(
const QgsPointXY &other,
double epsilon = 4 * DBL_EPSILON )
const;
222 void multiply(
double scalar );
255 operator QVariant()
const 257 return QVariant::fromValue( *
this );
261 SIP_PYOBJECT __repr__();
263 QString str =
"(" + QString::number( sipCpp->x() ) +
"," + QString::number( sipCpp->y() ) +
")";
265 sipRes = PyUnicode_FromString( str.toUtf8().data() );
274 SIP_PYOBJECT __getitem__(
int );
278 sipRes = Py_BuildValue(
"d", sipCpp->x() );
282 sipRes = Py_BuildValue(
"d", sipCpp->y() );
286 QString msg = QString(
"Bad index: %1" ).arg( a0 );
287 PyErr_SetString( PyExc_IndexError, msg.toAscii().constData() );
291 long __hash__()
const;
293 sipRes =
qHash( *sipCpp );
322 os << p.toString().toLocal8Bit().data();
329 uint h1 =
qHash( static_cast< quint64 >( p.mX ) );
330 uint h2 =
qHash( static_cast< quint64 >( p.mY ) );
331 hash = h1 ^ ( h2 << 1 );
QgsPointXY & operator*=(double scalar)
Multiplies the coordinates in this point by a scalar quantity in place.
uint qHash(const QgsPointXY &p)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
A class to represent a 2D point.
bool operator==(const QgsPointXY &p1, const QgsPointXY &p2)
QgsVector operator-(const QgsPointXY &p) const
Calculates the vector obtained by subtracting a point from this point.
Q_DECLARE_METATYPE(QModelIndex)
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
Compare two doubles (but allow some difference)
const double DEFAULT_SEGMENT_EPSILON
Default snapping tolerance for segments.
void setY(double y)
Sets the y value of the point.
double x() const
Get the x value of the point.
Point geometry type, with support for z-dimension and m-values.
void setX(double x)
Sets the x value of the point.
QgsPointXY(QPoint point)
Create a point from a QPoint.
A class to represent a vector.
QgsPointXY & operator+=(QgsVector v)
Adds a vector to this point in place.
std::ostream & operator<<(std::ostream &os, const QgsPointXY &p)
QgsPointXY & operator-=(QgsVector v)
Subtracts a vector from this point in place.
QgsPointXY operator+(QgsVector v) const
Adds a vector to this point.
QgsPointXY(QPointF point)
Create a point from a QPointF.
QgsPointXY operator-(QgsVector v) const
Subtracts a vector from this point.
double y() const
Get the y value of the point.
QgsPointXY operator*(double scalar) const
Multiplies the coordinates in this point by a scalar quantity.
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.
double x() const
Returns the vector's x-component.
double y() const
Returns the vector's y-component.