QGIS API Documentation  2.10.1-Pisa
QgsPoint Class Reference

A class to represent a point. More...

`#include <qgspoint.h>`

## Public Member Functions

QgsPoint ()
Default constructor. More...

QgsPoint (const QgsPoint &p)

QgsPoint (double x, double y)

QgsPoint (const QPointF &point)

QgsPoint (const QPoint &point)

~QgsPoint ()

double azimuth (const QgsPoint &other)
Calculates azimuth between this point and other one (clockwise in degree, starting from north) More...

bool compare (const QgsPoint &other, double epsilon=4 *DBL_EPSILON) const
Compares this point with another point with a fuzzy tolerance. More...

void multiply (const double &scalar)
Multiply x and y by the given value. More...

int onSegment (const QgsPoint &a, const QgsPoint &b) const
Test if this point is on the segment defined by points a, b. More...

bool operator!= (const QgsPoint &other) const
Inequality operator. More...

QgsPoint operator+ (const QgsVector &v) const

QgsPointoperator+= (const QgsVector &v)

QgsVector operator- (QgsPoint p) const

QgsPoint operator- (const QgsVector &v) const

QgsPointoperator-= (const QgsVector &v)

QgsPointoperator= (const QgsPoint &other)
Assignment. More...

bool operator== (const QgsPoint &other)
equality operator More...

void set (double x, double y)

void setX (double x)

void setY (double y)

double sqrDist (double x, double y) const
Returns the squared distance between this point and x,y. More...

double sqrDist (const QgsPoint &other) const
Returns the squared distance between this and other point. More...

double sqrDistToSegment (double x1, double y1, double x2, double y2, QgsPoint &minDistPoint, double epsilon=DEFAULT_SEGMENT_EPSILON) const
Returns the minimum distance between this point and a segment. More...

QString toDegreesMinutes (int thePrecision, const bool useSuffix=true, const bool padded=false) const
Return a string representation as degrees minutes. More...

QString toDegreesMinutesSeconds (int thePrecision, const bool useSuffix=true, const bool padded=false) const
Return a string representation as degrees minutes seconds. More...

QPointF toQPointF () const
Converts a point to a QPointF. More...

QString toString () const
String representation of the point (x,y) More...

QString toString (int thePrecision) const
As above but with precision for string representation of a point. More...

QString wellKnownText () const

double x () const

double y () const

## Friends

uint qHash (const QgsPoint &pnt)

## Detailed Description

A class to represent a point.

Currently no Z axis / 2.5D support is implemented.

Definition at line 63 of file qgspoint.h.

## Constructor & Destructor Documentation

 QgsPoint::QgsPoint ( )
inline

Default constructor.

Definition at line 67 of file qgspoint.h.

 QgsPoint::QgsPoint ( const QgsPoint & p )

Create a point from another point

Definition at line 115 of file qgspoint.cpp.

 QgsPoint::QgsPoint ( double x, double y )
inline

Create a point from x,y coordinates

Parameters
 x x coordinate y y coordinate

Definition at line 77 of file qgspoint.h.

 QgsPoint::QgsPoint ( const QPointF & point )
inline

Create a point from a QPointF

Parameters
 point QPointF source
Note

Definition at line 85 of file qgspoint.h.

 QgsPoint::QgsPoint ( const QPoint & point )
inline

Create a point from a QPoint

Parameters
 point QPoint source
Note

Definition at line 93 of file qgspoint.h.

 QgsPoint::~QgsPoint ( )
inline

Definition at line 97 of file qgspoint.h.

## Member Function Documentation

 double QgsPoint::azimuth ( const QgsPoint & other )

Calculates azimuth between this point and other one (clockwise in degree, starting from north)

Definition at line 355 of file qgspoint.cpp.

 bool QgsPoint::compare ( const QgsPoint & other, double epsilon = `4 * DBL_EPSILON` ) const

Compares this point with another point with a fuzzy tolerance.

Parameters
 other point to compare with epsilon maximum difference for coordinates between the points
Returns
true if points are equal within specified tolerance
Note

Definition at line 362 of file qgspoint.cpp.

 void QgsPoint::multiply ( const double & scalar )

Multiply x and y by the given value.

Definition at line 395 of file qgspoint.cpp.

 int QgsPoint::onSegment ( const QgsPoint & a, const QgsPoint & b ) const

Test if this point is on the segment defined by points a, b.

Returns
0 if this point is not on the open ray through a and b, 1 if point is on open ray a, 2 if point is within line segment, 3 if point is on open ray b.

Definition at line 401 of file qgspoint.cpp.

 bool QgsPoint::operator!= ( const QgsPoint & other ) const

Inequality operator.

Definition at line 376 of file qgspoint.cpp.

 QgsPoint QgsPoint::operator+ ( const QgsVector & v ) const
inline

Definition at line 221 of file qgspoint.h.

 QgsPoint& QgsPoint::operator+= ( const QgsVector & v )
inline

Definition at line 219 of file qgspoint.h.

 QgsVector QgsPoint::operator- ( QgsPoint p ) const
inline

Definition at line 218 of file qgspoint.h.

 QgsPoint QgsPoint::operator- ( const QgsVector & v ) const
inline

Definition at line 222 of file qgspoint.h.

 QgsPoint& QgsPoint::operator-= ( const QgsVector & v )
inline

Definition at line 220 of file qgspoint.h.

 QgsPoint & QgsPoint::operator= ( const QgsPoint & other )

Assignment.

Definition at line 384 of file qgspoint.cpp.

 bool QgsPoint::operator== ( const QgsPoint & other )

equality operator

Definition at line 368 of file qgspoint.cpp.

 void QgsPoint::set ( double x, double y )
inline

Sets the x and y value of the point

Definition at line 117 of file qgspoint.h.

 void QgsPoint::setX ( double x )
inline

Sets the x value of the point

Parameters
 x x coordinate

Definition at line 103 of file qgspoint.h.

 void QgsPoint::setY ( double y )
inline

Sets the y value of the point

Parameters
 y y coordinate

Definition at line 111 of file qgspoint.h.

 double QgsPoint::sqrDist ( double x, double y ) const

Returns the squared distance between this point and x,y.

Definition at line 345 of file qgspoint.cpp.

 double QgsPoint::sqrDist ( const QgsPoint & other ) const

Returns the squared distance between this and other point.

Definition at line 350 of file qgspoint.cpp.

 double QgsPoint::sqrDistToSegment ( double x1, double y1, double x2, double y2, QgsPoint & minDistPoint, double epsilon = `DEFAULT_SEGMENT_EPSILON` ) const

Returns the minimum distance between this point and a segment.

Definition at line 431 of file qgspoint.cpp.

 QString QgsPoint::toDegreesMinutes ( int thePrecision, const bool useSuffix = `true`, const bool padded = `false` ) const

Return a string representation as degrees minutes.

Its up to the calling function to ensure that this point can be meaningfully represented in this form.

Parameters
 thePrecision number of decimal points to use for minutes useSuffix set to true to include a direction suffix (eg 'N'), set to false to use a "-" prefix for west and south coordinates padded set to true to force minutes to use two decimals, eg, '05' instead of '5'.

Definition at line 256 of file qgspoint.cpp.

 QString QgsPoint::toDegreesMinutesSeconds ( int thePrecision, const bool useSuffix = `true`, const bool padded = `false` ) const

Return a string representation as degrees minutes seconds.

Its up to the calling function to ensure that this point can be meaningfully represented in this form.

Parameters
 thePrecision number of decimal points to use for seconds useSuffix set to true to include a direction suffix (eg 'N'), set to false to use a "-" prefix for west and south coordinates padded set to true to force minutes and seconds to use two decimals, eg, '05' instead of '5'.

Definition at line 142 of file qgspoint.cpp.

 QPointF QgsPoint::toQPointF ( ) const

Converts a point to a QPointF.

Returns
QPointF with same x and y values
Note

Definition at line 121 of file qgspoint.cpp.

 QString QgsPoint::toString ( ) const

String representation of the point (x,y)

Definition at line 126 of file qgspoint.cpp.

 QString QgsPoint::toString ( int thePrecision ) const

As above but with precision for string representation of a point.

Definition at line 135 of file qgspoint.cpp.

 QString QgsPoint::wellKnownText ( ) const

Return the well known text representation for the point. The wkt is created without an SRID.

Returns
Well known text in the form POINT(x y)

Definition at line 340 of file qgspoint.cpp.

 double QgsPoint::x ( ) const
inline

Get the x value of the point

Returns
x coordinate

Definition at line 126 of file qgspoint.h.

 double QgsPoint::y ( ) const
inline

Get the y value of the point

Returns
y coordinate

Definition at line 134 of file qgspoint.h.

## Friends And Related Function Documentation

 uint qHash ( const QgsPoint & pnt )
friend

Definition at line 252 of file qgspoint.h.

The documentation for this class was generated from the following files:
• /tmp/buildd/qgis-2.10.1+git20150822+dd4475c+20trusty/src/core/qgspoint.h
• /tmp/buildd/qgis-2.10.1+git20150822+dd4475c+20trusty/src/core/qgspoint.cpp