QGIS API Documentation  2.12.0-Lyon
Public Member Functions | List of all members
QgsPointV2 Class Reference

Point geometry type. More...

#include <qgspointv2.h>

Inheritance diagram for QgsPointV2:
Inheritance graph
[legend]

Public Member Functions

 QgsPointV2 (double x=0.0, double y=0.0)
 
 QgsPointV2 (const QgsPoint &p)
 
 QgsPointV2 (QgsWKBTypes::Type type, double x=0.0, double y=0.0, double z=0.0, double m=0.0)
 
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 QgsRectangle calculateBoundingBox () const override
 Calculates 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...
 
virtual void coordinateSequence (QList< QList< QList< QgsPointV2 > > > &coord) const override
 Retrieves the sequence of geometries, rings and nodes. More...
 
virtual bool deleteVertex (const 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 fromWkb (const unsigned char *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 (const QgsVertexId &position, const QgsPointV2 &vertex) override
 Inserts a vertex into the geometry. More...
 
double m () const
 
virtual bool moveVertex (const QgsVertexId &position, const QgsPointV2 &newPos) override
 Moves a vertex within 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
 
virtual int ringCount (int=0) const override
 
void setM (double m)
 
void setX (double x)
 
void setY (double y)
 
void setZ (double z)
 
void transform (const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d=QgsCoordinateTransform::ForwardTransform) 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 (const QgsVertexId &vertex) const override
 Angle undefined. More...
 
virtual QgsPointV2 vertexAt (const 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
 
double y () const
 
double z () const
 
- Public Member Functions inherited from QgsAbstractGeometryV2
 QgsAbstractGeometryV2 ()
 
 QgsAbstractGeometryV2 (const QgsAbstractGeometryV2 &geom)
 
virtual ~QgsAbstractGeometryV2 ()
 
virtual double area () const
 Returns the area of the geometry. More...
 
QgsRectangle boundingBox () const
 Returns the minimal bounding box for 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...
 
int nCoordinates () const
 Returns the number of nodes contained in the geometry. More...
 
virtual QgsAbstractGeometryV2operator= (const QgsAbstractGeometryV2 &geom)
 
virtual double perimeter () const
 Returns the perimeter of the geometry. More...
 
virtual QgsAbstractGeometryV2segmentize () const
 Returns a version of the geometry without curves. 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

- Protected Member Functions inherited from QgsAbstractGeometryV2
void setZMTypeFromSubGeometry (const QgsAbstractGeometryV2 *subggeom, QgsWKBTypes::Type baseGeomType)
 Updates the geometry type based on whether sub geometries contain z or m values. More...
 
- Static Protected Member Functions inherited from QgsAbstractGeometryV2
static bool readWkbHeader (QgsConstWkbPtr &wkbPtr, QgsWKBTypes::Type &wkbType, bool &endianSwap, QgsWKBTypes::Type expectedType)
 Reads a WKB header and tests its validity. More...
 
- Protected Attributes inherited from QgsAbstractGeometryV2
QgsRectangle mBoundingBox
 
QgsWKBTypes::Type mWkbType
 

Detailed Description

Point geometry type.

Note
added in QGIS 2.10
this API is not considered stable and may change for 2.12

Definition at line 29 of file qgspointv2.h.

Constructor & Destructor Documentation

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

Definition at line 27 of file qgspointv2.cpp.

QgsPointV2::QgsPointV2 ( const QgsPoint p)

Definition at line 32 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 
)

Definition at line 37 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
addZValue

Implements QgsAbstractGeometryV2.

Definition at line 270 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
addMValue

Implements QgsAbstractGeometryV2.

Definition at line 260 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 160 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 170 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 184 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 129 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 148 of file qgspointv2.cpp.

virtual QgsRectangle QgsPointV2::calculateBoundingBox ( ) const
inlineoverridevirtual

Calculates the minimal bounding box for the geometry.

Derived classes should override this method to return the correct bounding box.

Reimplemented from QgsAbstractGeometryV2.

Definition at line 68 of file qgspointv2.h.

void QgsPointV2::clear ( )
overridevirtual

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

Implements QgsAbstractGeometryV2.

Definition at line 196 of file qgspointv2.cpp.

QgsPointV2 * QgsPointV2::clone ( ) const
overridevirtual

Clones the geometry by performing a deep copy.

Implements QgsAbstractGeometryV2.

Definition at line 56 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 for search
segmentPtstorage for the closest point within the geometry
vertexAfterstorage for the id of the vertex after the closest segment
leftOfreturns if the point lies on the left of right side of the segment ( < 0 means left, > 0 means right )
epsilonepsilon for segment snapping
Returns
squared distance to closest segment

Implements QgsAbstractGeometryV2.

Definition at line 232 of file qgspointv2.cpp.

void QgsPointV2::coordinateSequence ( QList< QList< QList< QgsPointV2 > > > &  coord) const
overridevirtual

Retrieves the sequence of geometries, rings and nodes.

Parameters
coorddestination for coordinate sequence.

Implements QgsAbstractGeometryV2.

Definition at line 207 of file qgspointv2.cpp.

virtual bool QgsPointV2::deleteVertex ( const 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 84 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 55 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 191 of file qgspointv2.cpp.

bool QgsPointV2::fromWkb ( const unsigned char *  wkb)
overridevirtual

Sets the geometry from a WKB string.

See also
fromWkt

Implements QgsAbstractGeometryV2.

Definition at line 61 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 81 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 52 of file qgspointv2.h.

virtual bool QgsPointV2::insertVertex ( const 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 82 of file qgspointv2.h.

double QgsPointV2::m ( ) const
inline

Definition at line 45 of file qgspointv2.h.

bool QgsPointV2::moveVertex ( const 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 215 of file qgspointv2.cpp.

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 238 of file qgspointv2.cpp.

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

Definition at line 51 of file qgspointv2.cpp.

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

Definition at line 42 of file qgspointv2.cpp.

virtual int QgsPointV2::partCount ( ) const
inlineoverridevirtual

Implements QgsAbstractGeometryV2.

Definition at line 96 of file qgspointv2.h.

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

Implements QgsAbstractGeometryV2.

Definition at line 95 of file qgspointv2.h.

void QgsPointV2::setM ( double  m)
inline

Definition at line 50 of file qgspointv2.h.

void QgsPointV2::setX ( double  x)
inline

Definition at line 47 of file qgspointv2.h.

void QgsPointV2::setY ( double  y)
inline

Definition at line 48 of file qgspointv2.h.

void QgsPointV2::setZ ( double  z)
inline

Definition at line 49 of file qgspointv2.h.

void QgsPointV2::transform ( const QgsCoordinateTransform ct,
QgsCoordinateTransform::TransformDirection  d = QgsCoordinateTransform::ForwardTransform 
)
overridevirtual

Transforms the geometry using a coordinate transform.

Parameters
ctcoordinate transform
dtransformation direction

Implements QgsAbstractGeometryV2.

Definition at line 202 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 280 of file qgspointv2.cpp.

double QgsPointV2::vertexAngle ( const QgsVertexId vertex) const
inlineoverridevirtual

Angle undefined.

Always returns 0.0

Parameters
vertexthe vertex id
Returns
0.0

Implements QgsAbstractGeometryV2.

Definition at line 92 of file qgspointv2.h.

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

Returns the point corresponding to a specified vertex id.

Implements QgsAbstractGeometryV2.

Definition at line 97 of file qgspointv2.h.

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

Implements QgsAbstractGeometryV2.

Definition at line 94 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 122 of file qgspointv2.cpp.

double QgsPointV2::x ( ) const
inline

Definition at line 42 of file qgspointv2.h.

double QgsPointV2::y ( ) const
inline

Definition at line 43 of file qgspointv2.h.

double QgsPointV2::z ( ) const
inline

Definition at line 44 of file qgspointv2.h.


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