QGIS API Documentation  2.99.0-Master (b698612)
Public Member Functions | Properties | List of all members
QgsPoint Class Reference

Point geometry type, with support for z-dimension and m-values. More...

#include <qgspoint.h>

Inheritance diagram for QgsPoint:
Inheritance graph
[legend]

Public Member Functions

 QgsPoint (double x=0.0, double y=0.0, double z=std::numeric_limits< double >::quiet_NaN(), double m=std::numeric_limits< double >::quiet_NaN(), QgsWkbTypes::Type wkbType=QgsWkbTypes::Unknown)
 Construct a point with the provided initial coordinate values. More...
 
 QgsPoint (const QgsPointXY &p)
 Construct a QgsPoint from a QgsPointXY object. More...
 
 QgsPoint (QPointF p)
 Construct a QgsPoint from a QPointF. More...
 
 QgsPoint (QgsWkbTypes::Type wkbType, double x=0.0, double y=0.0, double z=std::numeric_limits< double >::quiet_NaN(), double m=std::numeric_limits< double >::quiet_NaN())
 Create a new point with the given wkbtype and values. More...
 
virtual bool addMValue (double mValue=0) override
 Adds a measure to the geometry, initialized to a preset value. More...
 
virtual bool addZValue (double zValue=0) override
 Adds a z-dimension to the geometry, initialized to a preset value. More...
 
QDomElement asGML2 (QDomDocument &doc, int precision=17, const QString &ns="gml") const override
 Returns a GML2 representation of the geometry. More...
 
QDomElement asGML3 (QDomDocument &doc, int precision=17, const QString &ns="gml") const override
 Returns a GML3 representation of the geometry. More...
 
QString asJSON (int precision=17) const override
 Returns a GeoJSON representation of the geometry. More...
 
QByteArray asWkb () const override
 Returns a WKB representation of the geometry. More...
 
QString asWkt (int precision=17) const override
 Returns a WKT representation of the geometry. More...
 
double azimuth (const QgsPoint &other) const
 Calculates azimuth between this point and other one (clockwise in degree, starting from north) More...
 
virtual QgsAbstractGeometryboundary () const override
 Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the geometry). More...
 
virtual QgsRectangle boundingBox () const override
 Returns the minimal bounding box for the geometry. More...
 
void clear () override
 Clears the geometry, ie reset it to a null geometry. More...
 
virtual QgsPointclone () const override
 Clones the geometry by performing a deep copy. More...
 
virtual double closestSegment (const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon) const override
 Searches for the closest segment of the geometry to a given point. More...
 
bool convertTo (QgsWkbTypes::Type type) override
 Converts the geometry to a specified type. More...
 
virtual QgsCoordinateSequence coordinateSequence () const override
 Retrieves the sequence of geometries, rings and nodes. More...
 
virtual bool deleteVertex (QgsVertexId position) override
 Deletes a vertex within the geometry. More...
 
virtual int dimension () const override
 Returns the inherent dimension of the geometry. More...
 
double distance (double x, double y) const
 Returns the distance between this point and a specified x, y coordinate. More...
 
double distance (const QgsPoint &other) const
 Returns the 2D distance between this point and another point. More...
 
double distance3D (double x, double y, double z) const
 Returns the 3D distance between this point and a specified x, y, z coordinate. More...
 
double distance3D (const QgsPoint &other) const
 Returns the 3D distance between this point and another point. More...
 
double distanceSquared (double x, double y) const
 Returns the squared distance between this point a specified x, y coordinate. More...
 
double distanceSquared (const QgsPoint &other) const
 Returns the squared distance between this point another point. More...
 
double distanceSquared3D (double x, double y, double z) const
 Returns the 3D squared distance between this point a specified x, y, z coordinate. More...
 
double distanceSquared3D (const QgsPoint &other) const
 Returns the 3D squared distance between this point another point. More...
 
void draw (QPainter &p) const override
 Draws the geometry using the specified QPainter. More...
 
virtual bool dropMValue () override
 Drops any measure values which exist in the geometry. More...
 
virtual bool dropZValue () override
 Drops any z-dimensions which exist in the geometry. More...
 
virtual bool fromWkb (QgsConstWkbPtr &wkb) override
 Sets the geometry from a WKB string. More...
 
virtual bool fromWkt (const QString &wkt) override
 Sets the geometry from a WKT string. More...
 
virtual QString geometryType () const override
 Returns a unique string representing the geometry type. More...
 
double inclination (const QgsPoint &other) const
 Calculates inclination between this point and other one (starting from zenith = 0 to nadir = 180. More...
 
virtual bool insertVertex (QgsVertexId position, const QgsPoint &vertex) override
 Inserts a vertex into the geometry. More...
 
bool isEmpty () const override
 Returns true if the geometry is empty. More...
 
double m () const
 Returns the point's m value. More...
 
virtual bool moveVertex (QgsVertexId position, const QgsPoint &newPos) override
 Moves a vertex within the geometry. More...
 
virtual int nCoordinates () const override
 Returns the number of nodes contained in the geometry. More...
 
bool nextVertex (QgsVertexId &id, QgsPoint &vertex) const override
 Returns next vertex id and coordinates. More...
 
bool operator!= (const QgsPoint &pt) const
 
QgsPoint operator+ (QgsVector v) const
 Adds a vector to this point. More...
 
QgsPointoperator+= (QgsVector v)
 Adds a vector to this point in place. More...
 
QgsVector operator- (const QgsPoint &p) const
 Calculates the vector obtained by subtracting a point from this point. More...
 
QgsPoint operator- (QgsVector v) const
 Subtracts a vector from this point. More...
 
QgsPointoperator-= (QgsVector v)
 Subtracts a vector from this point in place. More...
 
bool operator== (const QgsPoint &pt) const
 
virtual int partCount () const override
 Returns count of parts contained in the geometry. More...
 
QgsPoint project (double distance, double azimuth, double inclination=90.0) const
 Returns a new point which correspond to this point projected by a specified distance with specified angles (azimuth and inclination). More...
 
virtual int ringCount (int=0) const override
 Returns the number of rings of which this geometry is built. More...
 
double & rm ()
 Returns a reference to the m value of this point. More...
 
double & rx ()
 Returns a reference to the x-coordinate of this point. More...
 
double & ry ()
 Returns a reference to the y-coordinate of this point. More...
 
double & rz ()
 Returns a reference to the z-coordinate of this point. More...
 
void setM (double m)
 Sets the point's m-value. More...
 
void setX (double x)
 Sets the point's x-coordinate. More...
 
void setY (double y)
 Sets the point's y-coordinate. More...
 
void setZ (double z)
 Sets the point's z-coordinate. More...
 
QPointF toQPointF () const
 Returns the point as a QPointF. More...
 
void transform (const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d=QgsCoordinateTransform::ForwardTransform, bool transformZ=false) override
 Transforms the geometry using a coordinate transform. More...
 
void transform (const QTransform &t) override
 Transforms the geometry using a QTransform object. More...
 
double vertexAngle (QgsVertexId vertex) const override
 Angle undefined. More...
 
virtual QgsPoint vertexAt (QgsVertexId) const override
 Returns the point corresponding to a specified vertex id. More...
 
virtual int vertexCount (int=0, int=0) const override
 Returns the number of vertexes of which this geometry is built. More...
 
double x () const
 Returns the point's x-coordinate. More...
 
double y () const
 Returns the point's y-coordinate. More...
 
double z () const
 Returns the point's z-coordinate. More...
 
- Public Member Functions inherited from QgsAbstractGeometry
 QgsAbstractGeometry ()
 
 QgsAbstractGeometry (const QgsAbstractGeometry &geom)
 
virtual ~QgsAbstractGeometry ()=default
 
virtual double area () const
 Returns the area of the geometry. More...
 
virtual QgsPoint centroid () const
 Returns the centroid of the geometry. More...
 
virtual bool hasCurvedSegments () const
 Returns true if the geometry contains curved segments. More...
 
bool is3D () const
 Returns true if the geometry is 3D and contains a z-value. More...
 
bool isMeasure () const
 Returns true if the geometry contains m values. More...
 
virtual double length () const
 Returns the length of the geometry. More...
 
QgsAbstractGeometryoperator= (const QgsAbstractGeometry &geom)
 
virtual double perimeter () const
 Returns the perimeter of the geometry. More...
 
virtual QgsAbstractGeometrysegmentize (double tolerance=M_PI/180., SegmentationToleranceType toleranceType=MaximumAngle) const
 Returns a version of the geometry without curves. More...
 
virtual QgsAbstractGeometrytoCurveType () const
 Returns the geometry converted to the more generic curve type. More...
 
QgsWkbTypes::Type wkbType () const
 Returns the WKB type of the geometry. More...
 
QString wktTypeStr () const
 Returns the WKT type string of the geometry. More...
 

Properties

double m
 
double x
 
double y
 
double z
 

Additional Inherited Members

- Public Types inherited from QgsAbstractGeometry
enum  SegmentationToleranceType { MaximumAngle = 0, MaximumDifference }
 Segmentation tolerance as maximum angle or maximum difference between approximation and circle. More...
 
- Protected Member Functions inherited from QgsAbstractGeometry
virtual QgsRectangle calculateBoundingBox () const
 Default calculator for the minimal bounding box for the geometry. More...
 
virtual void clearCache () const
 Clears any cached parameters associated with the geometry, e.g., bounding boxes. More...
 
void setZMTypeFromSubGeometry (const QgsAbstractGeometry *subggeom, QgsWkbTypes::Type baseGeomType)
 Updates the geometry type based on whether sub geometries contain z or m values. More...
 
- Protected Attributes inherited from QgsAbstractGeometry
QgsWkbTypes::Type mWkbType
 

Detailed Description

Point geometry type, with support for z-dimension and m-values.

Since
QGIS 3.0, (previously QgsPointv2 since QGIS 2.10)

Definition at line 36 of file qgspoint.h.

Constructor & Destructor Documentation

◆ QgsPoint() [1/4]

QgsPoint::QgsPoint ( double  x = 0.0,
double  y = 0.0,
double  z = std::numeric_limits<double>::quiet_NaN(),
double  m = std::numeric_limits<double>::quiet_NaN(),
QgsWkbTypes::Type  wkbType = QgsWkbTypes::Unknown 
)

Construct a point with the provided initial coordinate values.

If wkbType is set to QgsWkbTypes::Point, QgsWkbTypes::PointZ, QgsWkbTypes::PointM or QgsWkbTypes::PointZM the type will be set accordingly. If it is left to the default QgsWkbTypes::Unknown, the type will be set based on the following rules:

  • If only x and y are specified, the type will be a 2D point.
  • If any or both of the Z and M are specified, the appropriate type will be created.
pt = QgsPoint(43.4, 5.3)
pt.exportToWkt() # Point(43.4 5.3)
pt_z = QgsPoint(120, 343, 77)
pt.exportToWkt() # PointZ(120 343 77)
pt_m = QgsPoint(33, 88, m=5)
pt_m.m() # 5
pt_m.wkbType() # QgsWkbTypes.PointM
pt = QgsPoint(30, 40, wkbType=QgsWkbTypes.PointZ)
pt.z() # nan
pt.wkbType() # QgsWkbTypes.PointZ

Definition at line 34 of file qgspoint.cpp.

◆ QgsPoint() [2/4]

QgsPoint::QgsPoint ( const QgsPointXY p)
explicit

Construct a QgsPoint from a QgsPointXY object.

Definition at line 59 of file qgspoint.cpp.

◆ QgsPoint() [3/4]

QgsPoint::QgsPoint ( QPointF  p)
explicit

Construct a QgsPoint from a QPointF.

Definition at line 69 of file qgspoint.cpp.

◆ QgsPoint() [4/4]

QgsPoint::QgsPoint ( QgsWkbTypes::Type  wkbType,
double  x = 0.0,
double  y = 0.0,
double  z = std::numeric_limits<double>::quiet_NaN(),
double  m = std::numeric_limits<double>::quiet_NaN() 
)
explicit

Create a new point with the given wkbtype and values.

Note
Not available in Python bindings

Definition at line 79 of file qgspoint.cpp.

Member Function Documentation

◆ addMValue()

bool QgsPoint::addMValue ( double  mValue = 0)
overridevirtual

Adds a measure to the geometry, initialized to a preset value.

Parameters
mValueinitial m-value for all nodes
Returns
true on success
Since
QGIS 2.12
See also
dropMValue()
addZValue()

Implements QgsAbstractGeometry.

Definition at line 390 of file qgspoint.cpp.

◆ addZValue()

bool QgsPoint::addZValue ( double  zValue = 0)
overridevirtual

Adds a z-dimension to the geometry, initialized to a preset value.

Parameters
zValueinitial z-value for all nodes
Returns
true on success
Since
QGIS 2.12
See also
dropZValue()
addMValue()

Implements QgsAbstractGeometry.

Definition at line 379 of file qgspoint.cpp.

◆ asGML2()

QDomElement QgsPoint::asGML2 ( QDomDocument &  doc,
int  precision = 17,
const QString &  ns = "gml" 
) const
overridevirtual

Returns a GML2 representation of the geometry.

Parameters
docDOM document
precisionnumber of decimal places for coordinates
nsXML namespace
See also
asWkb
asWkt
asGML3
asJSON

Implements QgsAbstractGeometry.

Definition at line 231 of file qgspoint.cpp.

◆ asGML3()

QDomElement QgsPoint::asGML3 ( QDomDocument &  doc,
int  precision = 17,
const QString &  ns = "gml" 
) const
overridevirtual

Returns a GML3 representation of the geometry.

Parameters
docDOM document
precisionnumber of decimal places for coordinates
nsXML namespace
See also
asWkb
asWkt
asGML2
asJSON

Implements QgsAbstractGeometry.

Definition at line 241 of file qgspoint.cpp.

◆ asJSON()

QString QgsPoint::asJSON ( int  precision = 17) const
overridevirtual

Returns a GeoJSON representation of the geometry.

Parameters
precisionnumber of decimal places for coordinates
See also
asWkb
asWkt
asGML2
asGML3

Implements QgsAbstractGeometry.

Definition at line 261 of file qgspoint.cpp.

◆ asWkb()

QByteArray QgsPoint::asWkb ( ) const
overridevirtual

Returns a WKB representation of the geometry.

See also
asWkt
asGML2
asGML3
asJSON
Since
QGIS 3.0

Implements QgsAbstractGeometry.

Definition at line 197 of file qgspoint.cpp.

◆ asWkt()

QString QgsPoint::asWkt ( int  precision = 17) const
overridevirtual

Returns a WKT representation of the geometry.

Parameters
precisionnumber of decimal places for coordinates
See also
asWkb
asGML2
asGML3
asJSON

Implements QgsAbstractGeometry.

Definition at line 219 of file qgspoint.cpp.

◆ azimuth()

double QgsPoint::azimuth ( const QgsPoint other) const

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

Since
QGIS 3.0

Definition at line 528 of file qgspoint.cpp.

◆ boundary()

QgsAbstractGeometry * QgsPoint::boundary ( ) const
overridevirtual

Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the geometry).

For instance, a polygon geometry will have a boundary consisting of the linestrings for each ring in the polygon.

Returns
boundary for geometry. May be null for some geometry types.
Since
QGIS 3.0

Implements QgsAbstractGeometry.

Definition at line 313 of file qgspoint.cpp.

◆ boundingBox()

virtual QgsRectangle QgsPoint::boundingBox ( ) const
inlineoverridevirtual

Returns the minimal bounding box for the geometry.

Implements QgsAbstractGeometry.

Definition at line 373 of file qgspoint.h.

◆ clear()

void QgsPoint::clear ( )
overridevirtual

Clears the geometry, ie reset it to a null geometry.

Implements QgsAbstractGeometry.

Definition at line 273 of file qgspoint.cpp.

◆ clone()

QgsPoint * QgsPoint::clone ( ) const
overridevirtual

Clones the geometry by performing a deep copy.

Implements QgsAbstractGeometry.

Definition at line 116 of file qgspoint.cpp.

◆ closestSegment()

double QgsPoint::closestSegment ( const QgsPoint pt,
QgsPoint segmentPt,
QgsVertexId vertexAfter,
bool *  leftOf,
double  epsilon 
) const
overridevirtual

Searches for the closest segment of the geometry to a given point.

Parameters
ptspecifies the point to find closest segment to
segmentPtstorage for the closest point within the geometry
vertexAfterstorage for the ID of the vertex at the end of the closest segment
leftOfreturns whether the point lies on the left side of the nearest segment (true if point is to left of segment, false if point is to right of segment)
epsilonepsilon for segment snapping
Returns
squared distance to closest segment or negative value on error

Implements QgsAbstractGeometry.

Definition at line 341 of file qgspoint.cpp.

◆ convertTo()

bool QgsPoint::convertTo ( QgsWkbTypes::Type  type)
overridevirtual

Converts the geometry to a specified type.

Returns
true if conversion was successful
Since
QGIS 2.14

Reimplemented from QgsAbstractGeometry.

Definition at line 433 of file qgspoint.cpp.

◆ coordinateSequence()

QgsCoordinateSequence QgsPoint::coordinateSequence ( ) const
overridevirtual

Retrieves the sequence of geometries, rings and nodes.

Returns
coordinate sequence

Implements QgsAbstractGeometry.

Definition at line 303 of file qgspoint.cpp.

◆ deleteVertex()

virtual bool QgsPoint::deleteVertex ( QgsVertexId  position)
inlineoverridevirtual

Deletes a vertex within the geometry.

Parameters
positionvertex id for vertex to delete
Returns
true if delete was successful
See also
insertVertex
moveVertex

Implements QgsAbstractGeometry.

Definition at line 396 of file qgspoint.h.

◆ dimension()

virtual int QgsPoint::dimension ( ) const
inlineoverridevirtual

Returns the inherent dimension of the geometry.

For example, this is 0 for a point geometry, 1 for a linestring and 2 for a polygon.

Implements QgsAbstractGeometry.

Definition at line 375 of file qgspoint.h.

◆ distance() [1/2]

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

Returns the distance between this point and a specified x, y coordinate.

In certain cases it may be more appropriate to call the faster distanceSquared() method, e.g., when comparing distances.

Since
QGIS 3.0
See also
distanceSquared()

Definition at line 472 of file qgspoint.cpp.

◆ distance() [2/2]

double QgsPoint::distance ( const QgsPoint other) const

Returns the 2D distance between this point and another point.

In certain cases it may be more appropriate to call the faster distanceSquared() method, e.g., when comparing distances.

Since
QGIS 3.0

Definition at line 477 of file qgspoint.cpp.

◆ distance3D() [1/2]

double QgsPoint::distance3D ( double  x,
double  y,
double  z 
) const

Returns the 3D distance between this point and a specified x, y, z coordinate.

In certain cases it may be more appropriate to call the faster distanceSquared() method, e.g., when comparing distances.

Since
QGIS 3.0
See also
distanceSquared()

Definition at line 492 of file qgspoint.cpp.

◆ distance3D() [2/2]

double QgsPoint::distance3D ( const QgsPoint other) const

Returns the 3D distance between this point and another point.

In certain cases it may be more appropriate to call the faster distanceSquared() method, e.g., when comparing distances.

Since
QGIS 3.0

Definition at line 501 of file qgspoint.cpp.

◆ distanceSquared() [1/2]

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

Returns the squared distance between this point a specified x, y coordinate.

Calling this is faster than calling distance(), and may be useful in use cases such as comparing distances where the extra expense of calling distance() is not required.

See also
distance()
Since
QGIS 3.0

Definition at line 482 of file qgspoint.cpp.

◆ distanceSquared() [2/2]

double QgsPoint::distanceSquared ( const QgsPoint other) const

Returns the squared distance between this point another point.

Calling this is faster than calling distance(), and may be useful in use cases such as comparing distances where the extra expense of calling distance() is not required.

See also
distance()
Since
QGIS 3.0

Definition at line 487 of file qgspoint.cpp.

◆ distanceSquared3D() [1/2]

double QgsPoint::distanceSquared3D ( double  x,
double  y,
double  z 
) const

Returns the 3D squared distance between this point a specified x, y, z coordinate.

Calling this is faster than calling distance(), and may be useful in use cases such as comparing distances where the extra expense of calling distance() is not required.

See also
distance()
Since
QGIS 3.0

Definition at line 510 of file qgspoint.cpp.

◆ distanceSquared3D() [2/2]

double QgsPoint::distanceSquared3D ( const QgsPoint other) const

Returns the 3D squared distance between this point another point.

Calling this is faster than calling distance(), and may be useful in use cases such as comparing distances where the extra expense of calling distance() is not required.

See also
distance()
Since
QGIS 3.0

Definition at line 519 of file qgspoint.cpp.

◆ draw()

void QgsPoint::draw ( QPainter &  p) const
overridevirtual

Draws the geometry using the specified QPainter.

Parameters
pdestination QPainter

Implements QgsAbstractGeometry.

Definition at line 268 of file qgspoint.cpp.

◆ dropMValue()

bool QgsPoint::dropMValue ( )
overridevirtual

Drops any measure values which exist in the geometry.

Returns
true if m-values were present and have been removed
See also
addMValue()
dropZValue()
Since
QGIS 2.14

Implements QgsAbstractGeometry.

Definition at line 422 of file qgspoint.cpp.

◆ dropZValue()

bool QgsPoint::dropZValue ( )
overridevirtual

Drops any z-dimensions which exist in the geometry.

Returns
true if Z values were present and have been removed
See also
addZValue()
dropMValue()
Since
QGIS 2.14

Implements QgsAbstractGeometry.

Definition at line 411 of file qgspoint.cpp.

◆ fromWkb()

bool QgsPoint::fromWkb ( QgsConstWkbPtr wkb)
overridevirtual

Sets the geometry from a WKB string.

After successful read the wkb argument will be at the position where the reading has stopped.

See also
fromWkt

Implements QgsAbstractGeometry.

Definition at line 121 of file qgspoint.cpp.

◆ fromWkt()

bool QgsPoint::fromWkt ( const QString &  wkt)
overridevirtual

Sets the geometry from a WKT string.

See also
fromWkb

Implements QgsAbstractGeometry.

Definition at line 149 of file qgspoint.cpp.

◆ geometryType()

virtual QString QgsPoint::geometryType ( ) const
inlineoverridevirtual

Returns a unique string representing the geometry type.

See also
wkbType
wktTypeStr

Implements QgsAbstractGeometry.

Definition at line 374 of file qgspoint.h.

◆ inclination()

double QgsPoint::inclination ( const QgsPoint other) const

Calculates inclination between this point and other one (starting from zenith = 0 to nadir = 180.

Horizon = 90) Returns 90.0 if the distance between this point and other one is equal to 0 (same point).

Since
QGIS 3.0

Definition at line 535 of file qgspoint.cpp.

◆ insertVertex()

virtual bool QgsPoint::insertVertex ( QgsVertexId  position,
const QgsPoint vertex 
)
inlineoverridevirtual

Inserts a vertex into the geometry.

Parameters
positionvertex id for position of inserted vertex
vertexvertex to insert
Returns
true if insert was successful
See also
moveVertex
deleteVertex

Implements QgsAbstractGeometry.

Definition at line 394 of file qgspoint.h.

◆ isEmpty()

bool QgsPoint::isEmpty ( ) const
inlineoverridevirtual

Returns true if the geometry is empty.

Reimplemented from QgsAbstractGeometry.

Definition at line 372 of file qgspoint.h.

◆ m()

double QgsPoint::m ( ) const
inline

Returns the point's m value.

See also
setM()
rm()

Definition at line 142 of file qgspoint.h.

◆ moveVertex()

bool QgsPoint::moveVertex ( QgsVertexId  position,
const QgsPoint newPos 
)
overridevirtual

Moves a vertex within the geometry.

Parameters
positionvertex id for vertex to move
newPosnew position of vertex
Returns
true if move was successful
See also
insertVertex
deleteVertex

Implements QgsAbstractGeometry.

Definition at line 324 of file qgspoint.cpp.

◆ nCoordinates()

virtual int QgsPoint::nCoordinates ( ) const
inlineoverridevirtual

Returns the number of nodes contained in the geometry.

Reimplemented from QgsAbstractGeometry.

Definition at line 390 of file qgspoint.h.

◆ nextVertex()

bool QgsPoint::nextVertex ( QgsVertexId id,
QgsPoint vertex 
) const
overridevirtual

Returns next vertex id and coordinates.

Parameters
idinitial value should be the starting vertex id. The next vertex id will be stored in this variable if found.
vertexcontainer for found node
Returns
false if at end

Implements QgsAbstractGeometry.

Definition at line 351 of file qgspoint.cpp.

◆ operator!=()

bool QgsPoint::operator!= ( const QgsPoint pt) const

Definition at line 111 of file qgspoint.cpp.

◆ operator+()

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

Adds a vector to this point.

Since
QGIS 3.0

Definition at line 363 of file qgspoint.h.

◆ operator+=()

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

Adds a vector to this point in place.

Since
QGIS 3.0

Definition at line 351 of file qgspoint.h.

◆ operator-() [1/2]

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

Calculates the vector obtained by subtracting a point from this point.

Since
QGIS 3.0

Definition at line 345 of file qgspoint.h.

◆ operator-() [2/2]

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

Subtracts a vector from this point.

Since
QGIS 3.0

Definition at line 369 of file qgspoint.h.

◆ operator-=()

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

Subtracts a vector from this point in place.

Since
QGIS 3.0

Definition at line 357 of file qgspoint.h.

◆ operator==()

bool QgsPoint::operator== ( const QgsPoint pt) const

Definition at line 96 of file qgspoint.cpp.

◆ partCount()

virtual int QgsPoint::partCount ( ) const
inlineoverridevirtual

Returns count of parts contained in the geometry.

See also
vertexCount
ringCount

Implements QgsAbstractGeometry.

Definition at line 410 of file qgspoint.h.

◆ project()

QgsPoint QgsPoint::project ( double  distance,
double  azimuth,
double  inclination = 90.0 
) const

Returns a new point which correspond to this point projected by a specified distance with specified angles (azimuth and inclination).

M value is preserved.

Parameters
distancedistance to project
azimuthangle to project in X Y, clockwise in degrees starting from north
inclinationangle to project in Z (3D). If the point is 2D, the Z value is assumed to be 0.
Returns
The point projected. If a 2D point is projected a 3D point will be returned except if inclination is 90. A 3D point is always returned if a 3D point is projected. Example:
p = QgsPoint( 1, 2 ) # 2D point
pr = p.project ( 1, 0 )
# pr is a 2D point: 'Point (1 3)'
pr = p.project ( 1, 0, 90 )
# pr is a 2D point: 'Point (1 3)'
pr = p.project (1, 0, 0 )
# pr is a 3D point: 'PointZ (1 2 1)'
p = QgsPoint( QgsWkbTypes.PointZ, 1, 2, 2 ) # 3D point
pr = p.project ( 1, 0 )
# pr is a 3D point: 'PointZ (1 3 2)'
pr = p.project ( 1, 0, 90 )
# pr is a 3D point: 'PointZ (1 3 2)'
pr = p.project (1, 0, 0 )
# pr is a 3D point: 'PointZ (1 2 3)'
Since
QGIS 3.0

Definition at line 547 of file qgspoint.cpp.

◆ ringCount()

virtual int QgsPoint::ringCount ( int  part = 0) const
inlineoverridevirtual

Returns the number of rings of which this geometry is built.

Implements QgsAbstractGeometry.

Definition at line 409 of file qgspoint.h.

◆ rm()

double& QgsPoint::rm ( )
inline

Returns a reference to the m value of this point.

Using a reference makes it possible to directly manipulate m in place.

See also
m()
setM()
Note
not available in Python bindings

Definition at line 174 of file qgspoint.h.

◆ rx()

double& QgsPoint::rx ( )
inline

Returns a reference to the x-coordinate of this point.

Using a reference makes it possible to directly manipulate x in place.

See also
x()
setX()
Note
not available in Python bindings

Definition at line 150 of file qgspoint.h.

◆ ry()

double& QgsPoint::ry ( )
inline

Returns a reference to the y-coordinate of this point.

Using a reference makes it possible to directly manipulate y in place.

See also
y()
setY()
Note
not available in Python bindings

Definition at line 158 of file qgspoint.h.

◆ rz()

double& QgsPoint::rz ( )
inline

Returns a reference to the z-coordinate of this point.

Using a reference makes it possible to directly manipulate z in place.

See also
z()
setZ()
Note
not available in Python bindings

Definition at line 166 of file qgspoint.h.

◆ setM()

void QgsPoint::setM ( double  m)
inline

Sets the point's m-value.

Note
calling this will have no effect if the point does not contain a m-dimension. Use addMValue() to add a m value and force the point to have an m dimension.
See also
m()
rm()

Definition at line 216 of file qgspoint.h.

◆ setX()

void QgsPoint::setX ( double  x)
inline

Sets the point's x-coordinate.

See also
x()
rx()

Definition at line 180 of file qgspoint.h.

◆ setY()

void QgsPoint::setY ( double  y)
inline

Sets the point's y-coordinate.

See also
y()
ry()

Definition at line 190 of file qgspoint.h.

◆ setZ()

void QgsPoint::setZ ( double  z)
inline

Sets the point's z-coordinate.

Note
calling this will have no effect if the point does not contain a z-dimension. Use addZValue() to add a z value and force the point to have a z dimension.
See also
z()
rz()

Definition at line 202 of file qgspoint.h.

◆ toQPointF()

QPointF QgsPoint::toQPointF ( ) const

Returns the point as a QPointF.

Since
QGIS 2.14

Definition at line 467 of file qgspoint.cpp.

◆ transform() [1/2]

void QgsPoint::transform ( const QgsCoordinateTransform ct,
QgsCoordinateTransform::TransformDirection  d = QgsCoordinateTransform::ForwardTransform,
bool  transformZ = false 
)
overridevirtual

Transforms the geometry using a coordinate transform.

Parameters
ctcoordinate transform
dtransformation direction
transformZset to true to also transform z coordinates. This requires that the z coordinates in the geometry represent height relative to the vertical datum of the source CRS (generally ellipsoidal heights) and are expressed in its vertical units (generally meters). If false, then z coordinates will not be changed by the transform.

Implements QgsAbstractGeometry.

Definition at line 289 of file qgspoint.cpp.

◆ transform() [2/2]

void QgsPoint::transform ( const QTransform &  t)
overridevirtual

Transforms the geometry using a QTransform object.

Parameters
tQTransform transformation

Implements QgsAbstractGeometry.

Definition at line 401 of file qgspoint.cpp.

◆ vertexAngle()

double QgsPoint::vertexAngle ( QgsVertexId  vertex) const
inlineoverridevirtual

Angle undefined.

Always returns 0.0

Parameters
vertexthe vertex id
Returns
0.0

Implements QgsAbstractGeometry.

Definition at line 406 of file qgspoint.h.

◆ vertexAt()

virtual QgsPoint QgsPoint::vertexAt ( QgsVertexId  id) const
inlineoverridevirtual

Returns the point corresponding to a specified vertex id.

Implements QgsAbstractGeometry.

Definition at line 411 of file qgspoint.h.

◆ vertexCount()

virtual int QgsPoint::vertexCount ( int  part = 0,
int  ring = 0 
) const
inlineoverridevirtual

Returns the number of vertexes of which this geometry is built.

Implements QgsAbstractGeometry.

Definition at line 408 of file qgspoint.h.

◆ x()

double QgsPoint::x ( ) const
inline

Returns the point's x-coordinate.

See also
setX()
rx()

Definition at line 124 of file qgspoint.h.

◆ y()

double QgsPoint::y ( ) const
inline

Returns the point's y-coordinate.

See also
setY()
ry()

Definition at line 130 of file qgspoint.h.

◆ z()

double QgsPoint::z ( ) const
inline

Returns the point's z-coordinate.

See also
setZ()
rz()

Definition at line 136 of file qgspoint.h.

Property Documentation

◆ m

double QgsPoint::m
readwrite

Definition at line 43 of file qgspoint.h.

◆ x

double QgsPoint::x
readwrite

Definition at line 40 of file qgspoint.h.

◆ y

double QgsPoint::y
readwrite

Definition at line 41 of file qgspoint.h.

◆ z

double QgsPoint::z
readwrite

Definition at line 42 of file qgspoint.h.


The documentation for this class was generated from the following files: