QGIS API Documentation  2.18.3-Las Palmas (77b8c3d)
Public Member Functions | List of all members
QgsPointV2 Class Reference

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

#include <qgspointv2.h>

Inheritance diagram for QgsPointV2:
Inheritance graph
[legend]

Public Member Functions

 QgsPointV2 (double x=0.0, double y=0.0)
 Construct a 2 dimensional point with an initial x and y coordinate. More...
 
 QgsPointV2 (const QgsPoint &p)
 Construct a QgsPointV2 from a QgsPoint object. More...
 
 QgsPointV2 (QPointF p)
 Construct a QgsPointV2 from a QPointF. More...
 
 QgsPointV2 (QgsWKBTypes::Type type, double x=0.0, double y=0.0, double z=0.0, double m=0.0)
 Construct a point with a specified type (eg PointZ, PointM) and initial x, y, z, and m 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...
 
unsigned char * asWkb (int &binarySize) 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...
 
virtual QgsAbstractGeometryV2boundary () 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 QgsPointV2clone () const override
 Clones the geometry by performing a deep copy. More...
 
double closestSegment (const QgsPointV2 &pt, QgsPointV2 &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 QgsCoordinateSequenceV2 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...
 
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...
 
virtual bool insertVertex (QgsVertexId position, const QgsPointV2 &vertex) override
 Inserts a vertex into the geometry. More...
 
double m () const
 Returns the point's m value. More...
 
virtual bool moveVertex (QgsVertexId position, const QgsPointV2 &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, QgsPointV2 &vertex) const override
 Returns next vertex id and coordinates. More...
 
bool operator!= (const QgsPointV2 &pt) const
 
bool operator== (const QgsPointV2 &pt) const
 
virtual int partCount () const override
 Returns count of parts contained in the geometry. More...
 
virtual int ringCount (int=0) const override
 
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 QgsPointV2 vertexAt (QgsVertexId) const override
 Returns the point corresponding to a specified vertex id. More...
 
virtual int vertexCount (int=0, int=0) const override
 
int wkbSize () const override
 Returns the size of the WKB representation of the geometry. 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 QgsAbstractGeometryV2
 QgsAbstractGeometryV2 ()
 
 QgsAbstractGeometryV2 (const QgsAbstractGeometryV2 &geom)
 
virtual ~QgsAbstractGeometryV2 ()
 
virtual double area () const
 Returns the area of the geometry. More...
 
virtual QgsPointV2 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 isEmpty () const
 Returns true if the geometry is empty. More...
 
bool isMeasure () const
 Returns true if the geometry contains m values. More...
 
virtual double length () const
 Returns the length of the geometry. More...
 
virtual QgsAbstractGeometryV2operator= (const QgsAbstractGeometryV2 &geom)
 
virtual double perimeter () const
 Returns the perimeter of the geometry. More...
 
virtual QgsAbstractGeometryV2segmentize (double tolerance=M_PI/180., SegmentationToleranceType toleranceType=MaximumAngle) const
 Returns a version of the geometry without curves. More...
 
virtual QgsAbstractGeometryV2toCurveType () 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...
 

Additional Inherited Members

- Public Types inherited from QgsAbstractGeometryV2
enum  SegmentationToleranceType { MaximumAngle = 0, MaximumDifference }
 Segmentation tolerance as maximum angle or maximum difference between approximation and circle. More...
 
- Protected Member Functions inherited from QgsAbstractGeometryV2
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, eg bounding boxes. More...
 
void setZMTypeFromSubGeometry (const QgsAbstractGeometryV2 *subggeom, QgsWKBTypes::Type baseGeomType)
 Updates the geometry type based on whether sub geometries contain z or m values. More...
 
- Protected Attributes inherited from QgsAbstractGeometryV2
QgsWKBTypes::Type mWkbType
 

Detailed Description

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

Note
added in QGIS 2.10

Definition at line 34 of file qgspointv2.h.

Constructor & Destructor Documentation

QgsPointV2::QgsPointV2 ( double  x = 0.0,
double  y = 0.0 
)

Construct a 2 dimensional point with an initial x and y coordinate.

Parameters
xx-coordinate of point
yy-coordinate of point

Definition at line 33 of file qgspointv2.cpp.

QgsPointV2::QgsPointV2 ( const QgsPoint p)
explicit

Construct a QgsPointV2 from a QgsPoint object.

Definition at line 43 of file qgspointv2.cpp.

QgsPointV2::QgsPointV2 ( QPointF  p)
explicit

Construct a QgsPointV2 from a QPointF.

Definition at line 53 of file qgspointv2.cpp.

QgsPointV2::QgsPointV2 ( QgsWKBTypes::Type  type,
double  x = 0.0,
double  y = 0.0,
double  z = 0.0,
double  m = 0.0 
)

Construct a point with a specified type (eg PointZ, PointM) and initial x, y, z, and m values.

Parameters
typepoint type
xx-coordinate of point
yy-coordinate of point
zz-coordinate of point, for PointZ or PointZM types
mm-value of point, for PointM or PointZM types

Definition at line 63 of file qgspointv2.cpp.

Member Function Documentation

bool QgsPointV2::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
Note
added in QGIS 2.12
See also
dropMValue()
addZValue()

Implements QgsAbstractGeometryV2.

Definition at line 361 of file qgspointv2.cpp.

bool QgsPointV2::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
Note
added in QGIS 2.12
See also
dropZValue()
addMValue()

Implements QgsAbstractGeometryV2.

Definition at line 350 of file qgspointv2.cpp.

QDomElement QgsPointV2::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 QgsAbstractGeometryV2.

Definition at line 212 of file qgspointv2.cpp.

QDomElement QgsPointV2::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 QgsAbstractGeometryV2.

Definition at line 222 of file qgspointv2.cpp.

QString QgsPointV2::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 QgsAbstractGeometryV2.

Definition at line 242 of file qgspointv2.cpp.

unsigned char * QgsPointV2::asWkb ( int &  binarySize) const
overridevirtual

Returns a WKB representation of the geometry.

Parameters
binarySizewill be set to the size of the returned WKB string
See also
wkbSize
asWkt
asGML2
asGML3
asJSON

Implements QgsAbstractGeometryV2.

Definition at line 181 of file qgspointv2.cpp.

QString QgsPointV2::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 QgsAbstractGeometryV2.

Definition at line 200 of file qgspointv2.cpp.

QgsAbstractGeometryV2 * QgsPointV2::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.
Note
added in QGIS 2.18

Implements QgsAbstractGeometryV2.

Definition at line 284 of file qgspointv2.cpp.

virtual QgsRectangle QgsPointV2::boundingBox ( ) const
inlineoverridevirtual

Returns the minimal bounding box for the geometry.

Implements QgsAbstractGeometryV2.

Definition at line 154 of file qgspointv2.h.

void QgsPointV2::clear ( )
overridevirtual

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

Implements QgsAbstractGeometryV2.

Definition at line 254 of file qgspointv2.cpp.

QgsPointV2 * QgsPointV2::clone ( ) const
overridevirtual

Clones the geometry by performing a deep copy.

Implements QgsAbstractGeometryV2.

Definition at line 94 of file qgspointv2.cpp.

double QgsPointV2::closestSegment ( const QgsPointV2 pt,
QgsPointV2 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 QgsAbstractGeometryV2.

Definition at line 312 of file qgspointv2.cpp.

bool QgsPointV2::convertTo ( QgsWKBTypes::Type  type)
overridevirtual

Converts the geometry to a specified type.

Returns
true if conversion was successful
Note
added in QGIS 2.14

Reimplemented from QgsAbstractGeometryV2.

Definition at line 404 of file qgspointv2.cpp.

QgsCoordinateSequenceV2 QgsPointV2::coordinateSequence ( ) const
overridevirtual

Retrieves the sequence of geometries, rings and nodes.

Returns
coordinate sequence

Implements QgsAbstractGeometryV2.

Definition at line 274 of file qgspointv2.cpp.

virtual bool QgsPointV2::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 QgsAbstractGeometryV2.

Definition at line 178 of file qgspointv2.h.

virtual int QgsPointV2::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 QgsAbstractGeometryV2.

Definition at line 156 of file qgspointv2.h.

void QgsPointV2::draw ( QPainter p) const
overridevirtual

Draws the geometry using the specified QPainter.

Parameters
pdestination QPainter

Implements QgsAbstractGeometryV2.

Definition at line 249 of file qgspointv2.cpp.

bool QgsPointV2::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()
Note
added in QGIS 2.14

Implements QgsAbstractGeometryV2.

Definition at line 393 of file qgspointv2.cpp.

bool QgsPointV2::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()
Note
added in QGIS 2.14

Implements QgsAbstractGeometryV2.

Definition at line 382 of file qgspointv2.cpp.

bool QgsPointV2::fromWkb ( QgsConstWkbPtr  wkb)
overridevirtual

Sets the geometry from a WKB string.

See also
fromWkt

Implements QgsAbstractGeometryV2.

Definition at line 99 of file qgspointv2.cpp.

bool QgsPointV2::fromWkt ( const QString wkt)
overridevirtual

Sets the geometry from a WKT string.

See also
fromWkb

Implements QgsAbstractGeometryV2.

Definition at line 127 of file qgspointv2.cpp.

virtual QString QgsPointV2::geometryType ( ) const
inlineoverridevirtual

Returns a unique string representing the geometry type.

See also
wkbType
wktTypeStr

Implements QgsAbstractGeometryV2.

Definition at line 155 of file qgspointv2.h.

virtual bool QgsPointV2::insertVertex ( QgsVertexId  position,
const QgsPointV2 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 QgsAbstractGeometryV2.

Definition at line 176 of file qgspointv2.h.

double QgsPointV2::m ( ) const
inline

Returns the point's m value.

See also
setM()
rm()

Definition at line 86 of file qgspointv2.h.

bool QgsPointV2::moveVertex ( QgsVertexId  position,
const QgsPointV2 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 QgsAbstractGeometryV2.

Definition at line 295 of file qgspointv2.cpp.

virtual int QgsPointV2::nCoordinates ( ) const
inlineoverridevirtual

Returns the number of nodes contained in the geometry.

Reimplemented from QgsAbstractGeometryV2.

Definition at line 172 of file qgspointv2.h.

bool QgsPointV2::nextVertex ( QgsVertexId id,
QgsPointV2 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 QgsAbstractGeometryV2.

Definition at line 322 of file qgspointv2.cpp.

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

Definition at line 89 of file qgspointv2.cpp.

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

Definition at line 80 of file qgspointv2.cpp.

virtual int QgsPointV2::partCount ( ) const
inlineoverridevirtual

Returns count of parts contained in the geometry.

See also
vertexCount
ringCount

Implements QgsAbstractGeometryV2.

Definition at line 190 of file qgspointv2.h.

virtual int QgsPointV2::ringCount ( int  = 0) const
inlineoverridevirtual

Implements QgsAbstractGeometryV2.

Definition at line 189 of file qgspointv2.h.

double& QgsPointV2::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 118 of file qgspointv2.h.

double& QgsPointV2::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 94 of file qgspointv2.h.

double& QgsPointV2::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 102 of file qgspointv2.h.

double& QgsPointV2::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 110 of file qgspointv2.h.

void QgsPointV2::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 146 of file qgspointv2.h.

void QgsPointV2::setX ( double  x)
inline

Sets the point's x-coordinate.

See also
x()
rx()

Definition at line 124 of file qgspointv2.h.

void QgsPointV2::setY ( double  y)
inline

Sets the point's y-coordinate.

See also
y()
ry()

Definition at line 130 of file qgspointv2.h.

void QgsPointV2::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 138 of file qgspointv2.h.

QPointF QgsPointV2::toQPointF ( ) const

Returns the point as a QPointF.

Note
added in QGIS 2.14

Definition at line 438 of file qgspointv2.cpp.

void QgsPointV2::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 QgsAbstractGeometryV2.

Definition at line 260 of file qgspointv2.cpp.

void QgsPointV2::transform ( const QTransform t)
overridevirtual

Transforms the geometry using a QTransform object.

Parameters
tQTransform transformation

Implements QgsAbstractGeometryV2.

Definition at line 372 of file qgspointv2.cpp.

double QgsPointV2::vertexAngle ( QgsVertexId  vertex) const
inlineoverridevirtual

Angle undefined.

Always returns 0.0

Parameters
vertexthe vertex id
Returns
0.0

Implements QgsAbstractGeometryV2.

Definition at line 186 of file qgspointv2.h.

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

Returns the point corresponding to a specified vertex id.

Implements QgsAbstractGeometryV2.

Definition at line 191 of file qgspointv2.h.

virtual int QgsPointV2::vertexCount ( int  = 0,
int  = 0 
) const
inlineoverridevirtual

Implements QgsAbstractGeometryV2.

Definition at line 188 of file qgspointv2.h.

int QgsPointV2::wkbSize ( ) const
overridevirtual

Returns the size of the WKB representation of the geometry.

See also
asWkb

Implements QgsAbstractGeometryV2.

Definition at line 168 of file qgspointv2.cpp.

double QgsPointV2::x ( ) const
inline

Returns the point's x-coordinate.

See also
setX()
rx()

Definition at line 68 of file qgspointv2.h.

double QgsPointV2::y ( ) const
inline

Returns the point's y-coordinate.

See also
setY()
ry()

Definition at line 74 of file qgspointv2.h.

double QgsPointV2::z ( ) const
inline

Returns the point's z-coordinate.

See also
setZ()
rz()

Definition at line 80 of file qgspointv2.h.


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