QGIS API Documentation
3.8.0-Zanzibar (11aff65)
|
A class to represent a 2D point. More...
#include <qgspointxy.h>
Public Member Functions | |
QgsPointXY ()=default | |
Default constructor. More... | |
QgsPointXY (const QgsPointXY &p) | |
Create a point from another point. More... | |
QgsPointXY (double x, double y) | |
Create a point from x,y coordinates. More... | |
QgsPointXY (QPointF point) | |
Create a point from a QPointF. More... | |
QgsPointXY (QPoint point) | |
Create a point from a QPoint. More... | |
QgsPointXY (const QgsPoint &point) | |
Create a new point. More... | |
~QgsPointXY ()=default | |
QString | asWkt () const |
Returns the well known text representation for the point (e.g. More... | |
double | azimuth (const QgsPointXY &other) const |
Calculates azimuth between this point and other one (clockwise in degree, starting from north) More... | |
bool | compare (const QgsPointXY &other, double epsilon=4 *std::numeric_limits< double >::epsilon()) const |
Compares this point with another point with a fuzzy tolerance. More... | |
double | distance (double x, double y) const |
Returns the distance between this point and a specified x, y coordinate. More... | |
double | distance (const QgsPointXY &other) const |
Returns the distance between this point and another point. More... | |
void | multiply (double scalar) |
Multiply x and y by the given value. More... | |
operator QVariant () const | |
Allows direct construction of QVariants from points. More... | |
bool | operator!= (const QgsPointXY &other) const |
Inequality operator. More... | |
QgsPointXY | operator* (double scalar) const |
Multiplies the coordinates in this point by a scalar quantity. More... | |
QgsPointXY & | operator*= (double scalar) |
Multiplies the coordinates in this point by a scalar quantity in place. More... | |
QgsPointXY | operator+ (QgsVector v) const |
Adds a vector to this point. More... | |
QgsPointXY & | operator+= (QgsVector v) |
Adds a vector to this point in place. More... | |
QgsVector | operator- (const QgsPointXY &p) const |
Calculates the vector obtained by subtracting a point from this point. More... | |
QgsPointXY | operator- (QgsVector v) const |
Subtracts a vector from this point. More... | |
QgsPointXY & | operator-= (QgsVector v) |
Subtracts a vector from this point in place. More... | |
QgsPointXY | operator/ (double scalar) const |
Divides the coordinates in this point by a scalar quantity. More... | |
QgsPointXY & | operator/= (double scalar) |
Divides the coordinates in this point by a scalar quantity in place. More... | |
QgsPointXY & | operator= (const QgsPointXY &other) |
Assignment. More... | |
bool | operator== (const QgsPointXY &other) |
equality operator More... | |
QgsPointXY | project (double distance, double bearing) const |
Returns a new point which corresponds to this point projected by a specified distance in a specified bearing. More... | |
void | set (double x, double y) |
Sets the x and y value of the point. More... | |
void | setX (double x) |
Sets the x value of the point. More... | |
void | setY (double y) |
Sets the y value of the point. More... | |
double | sqrDist (double x, double y) const |
Returns the squared distance between this point a specified x, y coordinate. More... | |
double | sqrDist (const QgsPointXY &other) const |
Returns the squared distance between this point another point. More... | |
double | sqrDistToSegment (double x1, double y1, double x2, double y2, QgsPointXY &minDistPoint, double epsilon=DEFAULT_SEGMENT_EPSILON) const |
Returns the minimum distance between this point and a segment. More... | |
QPointF | toQPointF () const |
Converts a point to a QPointF. More... | |
QString | toString (int precision=-1) const |
Returns a string representation of the point (x, y) with a preset precision. More... | |
double | x () const |
Gets the x value of the point. More... | |
double | y () const |
Gets the y value of the point. More... | |
Properties | |
double | x |
double | y |
Friends | |
uint | qHash (const QgsPointXY &pnt) |
A class to represent a 2D point.
A QgsPointXY represents a position with X and Y coordinates. In most scenarios it is preferable to use a QgsPoint instead which also supports Z and M values.
Definition at line 43 of file qgspointxy.h.
|
default |
Default constructor.
QgsPointXY::QgsPointXY | ( | const QgsPointXY & | p | ) |
Create a point from another point.
Definition at line 28 of file qgspointxy.cpp.
|
inline |
Create a point from x,y coordinates.
x | x coordinate |
y | y coordinate |
Definition at line 62 of file qgspointxy.h.
|
inline |
Create a point from a QPointF.
point | QPointF source |
Definition at line 72 of file qgspointxy.h.
|
inline |
Create a point from a QPoint.
point | QPoint source |
Definition at line 82 of file qgspointxy.h.
QgsPointXY::QgsPointXY | ( | const QgsPoint & | point | ) |
Create a new point.
Z and M values will be dropped.
Definition at line 34 of file qgspointxy.cpp.
|
default |
QString QgsPointXY::asWkt | ( | ) | const |
Returns the well known text representation for the point (e.g.
"POINT(x y)"). The wkt is created without an SRID.
Definition at line 58 of file qgspointxy.cpp.
double QgsPointXY::azimuth | ( | const QgsPointXY & | other | ) | const |
Calculates azimuth between this point and other one (clockwise in degree, starting from north)
Definition at line 63 of file qgspointxy.cpp.
|
inline |
Compares this point with another point with a fuzzy tolerance.
other | point to compare with |
epsilon | maximum difference for coordinates between the points |
true
if points are equal within specified tolerance Definition at line 228 of file qgspointxy.h.
|
inline |
Returns the distance between this point and a specified x, y coordinate.
x | x-coordniate |
y | y-coordinate |
Definition at line 190 of file qgspointxy.h.
|
inline |
Returns the distance between this point and another point.
other | other point |
Definition at line 201 of file qgspointxy.h.
|
inline |
Multiply x and y by the given value.
Definition at line 246 of file qgspointxy.h.
|
inline |
Allows direct construction of QVariants from points.
Definition at line 292 of file qgspointxy.h.
|
inline |
Inequality operator.
Definition at line 240 of file qgspointxy.h.
|
inline |
Multiplies the coordinates in this point by a scalar quantity.
Definition at line 280 of file qgspointxy.h.
|
inline |
Multiplies the coordinates in this point by a scalar quantity in place.
Definition at line 286 of file qgspointxy.h.
|
inline |
Adds a vector to this point.
Definition at line 274 of file qgspointxy.h.
|
inline |
Adds a vector to this point in place.
Definition at line 268 of file qgspointxy.h.
|
inline |
Calculates the vector obtained by subtracting a point from this point.
Definition at line 265 of file qgspointxy.h.
|
inline |
Subtracts a vector from this point.
Definition at line 277 of file qgspointxy.h.
|
inline |
Subtracts a vector from this point in place.
Definition at line 271 of file qgspointxy.h.
|
inline |
Divides the coordinates in this point by a scalar quantity.
Definition at line 283 of file qgspointxy.h.
|
inline |
Divides the coordinates in this point by a scalar quantity in place.
Definition at line 289 of file qgspointxy.h.
|
inline |
Assignment.
Definition at line 253 of file qgspointxy.h.
|
inline |
equality operator
Definition at line 234 of file qgspointxy.h.
QgsPointXY QgsPointXY::project | ( | double | distance, |
double | bearing | ||
) | const |
Returns a new point which corresponds to this point projected by a specified distance in a specified bearing.
distance | distance to project |
bearing | angle to project in, clockwise in degrees starting from north |
Definition at line 70 of file qgspointxy.cpp.
|
inline |
Sets the x and y value of the point.
Definition at line 119 of file qgspointxy.h.
|
inline |
Sets the x value of the point.
x | x coordinate |
Definition at line 104 of file qgspointxy.h.
|
inline |
Sets the y value of the point.
y | y coordinate |
Definition at line 113 of file qgspointxy.h.
|
inline |
Returns the squared distance between this point a specified x, y coordinate.
Definition at line 169 of file qgspointxy.h.
|
inline |
Returns the squared distance between this point another point.
Definition at line 178 of file qgspointxy.h.
double QgsPointXY::sqrDistToSegment | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2, | ||
QgsPointXY & | minDistPoint, | ||
double | epsilon = DEFAULT_SEGMENT_EPSILON |
||
) | const |
Returns the minimum distance between this point and a segment.
Definition at line 78 of file qgspointxy.cpp.
|
inline |
Converts a point to a QPointF.
Definition at line 148 of file qgspointxy.h.
QString QgsPointXY::toString | ( | int | precision = -1 | ) | const |
Returns a string representation of the point (x, y) with a preset precision.
If precision is -1, then a default precision will be used.
Definition at line 40 of file qgspointxy.cpp.
|
inline |
|
inline |
|
friend |
Definition at line 362 of file qgspointxy.h.
|
readwrite |
Definition at line 47 of file qgspointxy.h.
|
readwrite |
Definition at line 48 of file qgspointxy.h.