QgsPoint class
Point geometry type, with support for z-dimension and m-values.
Contents
Base classes
- class QgsAbstractGeometry
- Abstract base class for all geometries.
Constructors, destructors, conversion operators
-
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.
- QgsPoint(const QgsPointXY& p) explicit
- Construct a QgsPoint from a QgsPointXY object.
- QgsPoint(QPointF p) explicit
- Construct a QgsPoint from a QPointF.
-
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.
Public functions
- auto addMValue(double mValue = 0) -> bool override
- Adds a measure to the geometry, initialized to a preset value.
- auto addZValue(double zValue = 0) -> bool override
- Adds a z-dimension to the geometry, initialized to a preset value.
- void adjacentVertices(QgsVertexId vertex, QgsVertexId& previousVertex, QgsVertexId& nextVertex) const override
- Returns the vertices adjacent to a specified vertex within a geometry.
-
auto asGml2(QDomDocument& doc,
int precision = 17,
const QString& ns = "gml",
QgsAbstractGeometry::
AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY) const -> QDomElement override - Returns a GML2 representation of the geometry.
-
auto asGml3(QDomDocument& doc,
int precision = 17,
const QString& ns = "gml",
QgsAbstractGeometry::
AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY) const -> QDomElement override - Returns a GML3 representation of the geometry.
- auto asJson(int precision = 17) const -> QString override
- Returns a GeoJSON representation of the geometry.
- auto asWkb() const -> QByteArray override
- Returns a WKB representation of the geometry.
- auto asWkt(int precision = 17) const -> QString override
- Returns a WKT representation of the geometry.
- auto azimuth(const QgsPoint& other) const -> double
- Calculates azimuth between this point and other one (clockwise in degree, starting from north)
- auto boundary() const -> QgsAbstractGeometry* override
- Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the geometry).
- auto boundingBox() const -> QgsRectangle override
- Returns the minimal bounding box for the geometry.
- auto cast(const QgsAbstractGeometry* geom) const -> const QgsPoint*
- Cast the geom to a QgsPoint.
- void clear() override
- Clears the geometry, ie reset it to a null geometry.
- auto clone() const -> QgsPoint* override
- Clones the geometry by performing a deep copy.
- auto closestSegment(const QgsPoint& pt, QgsPoint& segmentPt, QgsVertexId& vertexAfter, int* leftOf = nullptr, double epsilon = 4*std::numeric_limits<double>::epsilon()) const -> double override
- Searches for the closest segment of the geometry to a given point.
-
auto convertTo(QgsWkbTypes::
Type type) -> bool override - Converts the geometry to a specified type.
- auto coordinateSequence() const -> QgsCoordinateSequence override
- Retrieves the sequence of geometries, rings and nodes.
- auto createEmptyWithSameType() const -> QgsPoint* override
- Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
- auto deleteVertex(QgsVertexId position) -> bool override
- Deletes a vertex within the geometry.
- auto dimension() const -> int override
- Returns the inherent dimension of the geometry.
- auto distance(double x, double y) const -> double
- Returns the distance between this point and a specified x, y coordinate.
- auto distance(const QgsPoint& other) const -> double
- Returns the 2D distance between this point and another point.
- auto distance3D(double x, double y, double z) const -> double
- Returns the 3D distance between this point and a specified x, y, z coordinate.
- auto distance3D(const QgsPoint& other) const -> double
- Returns the 3D distance between this point and another point.
- auto distanceSquared(double x, double y) const -> double
- Returns the squared distance between this point a specified x, y coordinate.
- auto distanceSquared(const QgsPoint& other) const -> double
- Returns the squared distance between this point another point.
- auto distanceSquared3D(double x, double y, double z) const -> double
- Returns the 3D squared distance between this point a specified x, y, z coordinate.
- auto distanceSquared3D(const QgsPoint& other) const -> double
- Returns the 3D squared distance between this point another point.
- void draw(QPainter& p) const override
- Draws the geometry using the specified QPainter.
- auto dropMValue() -> bool override
- Drops any measure values which exist in the geometry.
- auto dropZValue() -> bool override
- Drops any z-dimensions which exist in the geometry.
- void filterVertices(const std::function<bool(const QgsPoint&)>& filter) override
- Filters the vertices from the geometry in place, removing any which do not return true for the filter function check.
- auto fromWkb(QgsConstWkbPtr& wkb) -> bool override
- Sets the geometry from a WKB string.
- auto fromWkt(const QString& wkt) -> bool override
- Sets the geometry from a WKT string.
- auto geometryType() const -> QString override
- Returns a unique string representing the geometry type.
- auto inclination(const QgsPoint& other) const -> double
- Calculates inclination between this point and other one (starting from zenith = 0 to nadir = 180.
- auto insertVertex(QgsVertexId position, const QgsPoint& vertex) -> bool override
- Inserts a vertex into the geometry.
- auto isEmpty() const -> bool override
- Returns true if the geometry is empty.
- auto m() const -> double
- Returns the point's m value.
- auto moveVertex(QgsVertexId position, const QgsPoint& newPos) -> bool override
- Moves a vertex within the geometry.
- auto nCoordinates() const -> int override
- Returns the number of nodes contained in the geometry.
- auto nextVertex(QgsVertexId& id, QgsPoint& vertex) const -> bool override
- Returns next vertex id and coordinates.
- auto operator+(QgsVector v) const -> QgsPoint
- Adds a vector to this point.
- auto operator+=(QgsVector v) -> QgsPoint&
- Adds a vector to this point in place.
- auto operator-(const QgsPoint& p) const -> QgsVector
- Calculates the vector obtained by subtracting a point from this point.
- auto operator-(QgsVector v) const -> QgsPoint
- Subtracts a vector from this point.
- auto operator-=(QgsVector v) -> QgsPoint&
- Subtracts a vector from this point in place.
- auto partCount() const -> int override
- Returns count of parts contained in the geometry.
- auto project(double distance, double azimuth, double inclination = 90.0) const -> QgsPoint
- Returns a new point which correspond to this point projected by a specified distance with specified angles (azimuth and inclination).
- auto removeDuplicateNodes(double epsilon = 4*std::numeric_limits<double>::epsilon(), bool useZValues = false) -> bool override
- Removes duplicate nodes from the geometry, wherever removing the nodes does not result in a degenerate geometry.
- auto ringCount(int part = 0) const -> int override
- Returns the number of rings of which this geometry is built.
- auto rm() -> double&
- Returns a reference to the m value of this point.
- auto rx() -> double&
- Returns a reference to the x-coordinate of this point.
- auto ry() -> double&
- Returns a reference to the y-coordinate of this point.
- auto rz() -> double&
- Returns a reference to the z-coordinate of this point.
- auto segmentLength(QgsVertexId startVertex) const -> double override
- Returns the length of the segment of the geometry which begins at startVertex.
- void setM(double m)
- Sets the point's m-value.
- void setX(double x)
- Sets the point's x-coordinate.
- void setY(double y)
- Sets the point's y-coordinate.
- void setZ(double z)
- Sets the point's z-coordinate.
- auto snappedToGrid(double hSpacing, double vSpacing, double dSpacing = 0, double mSpacing = 0) const -> QgsPoint* override
- Makes a new geometry with all the points or vertices snapped to the closest point of the grid.
- void swapXy() override
- Swaps the x and y coordinates from the geometry.
- auto toCurveType() const -> QgsPoint* override
- Returns the geometry converted to the more generic curve type.
- auto toQPointF() const -> QPointF
- Returns the point as a QPointF.
-
void transform(const QgsCoordinateTransform& ct,
QgsCoordinateTransform::
TransformDirection d = QgsCoordinateTransform:: ForwardTransform, bool transformZ = false) virtual - Transforms the geometry using a coordinate transform.
- void transform(const QTransform& t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0) override
- Transforms the x and y components of the geometry using a QTransform object t.
- void transformVertices(const std::function<QgsPoint(const QgsPoint&)>& transform) override
- Transforms the vertices from the geometry in place, applying the transform function to every vertex.
- auto vertexAngle(QgsVertexId vertex) const -> double override
- Angle undefined.
- auto vertexAt(QgsVertexId id) const -> QgsPoint override
- Returns the point corresponding to a specified vertex id.
- auto vertexCount(int part = 0, int ring = 0) const -> int override
- Returns the number of vertices of which this geometry is built.
- auto vertexNumberFromVertexId(QgsVertexId id) const -> int override
- Returns the vertex number corresponding to a vertex id.
- auto x() const -> double
- Returns the point's x-coordinate.
- auto y() const -> double
- Returns the point's y-coordinate.
- auto z() const -> double
- Returns the point's z-coordinate.
Protected functions
- auto childCount() const -> int override
- Returns number of child geometries (for geometries with child geometries) or child points (for geometries without child geometries - i.e.
- auto childPoint(int index) const -> QgsPoint override
- Returns point at index (for geometries without child geometries - i.e.
Function documentation
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::, QgsWkbTypes::, QgsWkbTypes:: or QgsWkbTypes:: the type will be set accordingly. If it is left to the default QgsWkbTypes::, 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.asWkt() # Point(43.4 5.3) pt_z = QgsPoint(120, 343, 77) pt.asWkt() # 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
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.
bool QgsPoint:: addMValue(double mValue = 0) override
Adds a measure to the geometry, initialized to a preset value.
| Parameters | |
|---|---|
| mValue | initial m-value for all nodes |
| Returns | true on success |
bool QgsPoint:: addZValue(double zValue = 0) override
Adds a z-dimension to the geometry, initialized to a preset value.
| Parameters | |
|---|---|
| zValue | initial z-value for all nodes |
| Returns | true on success |
void QgsPoint:: adjacentVertices(QgsVertexId vertex,
QgsVertexId& previousVertex,
QgsVertexId& nextVertex) const override
Returns the vertices adjacent to a specified vertex within a geometry.
QDomElement QgsPoint:: asGml2(QDomDocument& doc,
int precision = 17,
const QString& ns = "gml",
QgsAbstractGeometry:: AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY) const override
Returns a GML2 representation of the geometry.
| Parameters | |
|---|---|
| doc | DOM document |
| precision | number of decimal places for coordinates |
| ns | XML namespace |
| axisOrder | Axis order for generated GML |
QDomElement QgsPoint:: asGml3(QDomDocument& doc,
int precision = 17,
const QString& ns = "gml",
QgsAbstractGeometry:: AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY) const override
Returns a GML3 representation of the geometry.
| Parameters | |
|---|---|
| doc | DOM document |
| precision | number of decimal places for coordinates |
| ns | XML namespace |
| axisOrder | Axis order for generated GML |
QString QgsPoint:: asJson(int precision = 17) const override
Returns a GeoJSON representation of the geometry.
| Parameters | |
|---|---|
| precision | number of decimal places for coordinates |
QByteArray QgsPoint:: asWkb() const override
Returns a WKB representation of the geometry.
QString QgsPoint:: asWkt(int precision = 17) const override
Returns a WKT representation of the geometry.
| Parameters | |
|---|---|
| precision | number of decimal places for coordinates |
QgsAbstractGeometry* QgsPoint:: boundary() const override
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the geometry).
| Returns | boundary for geometry. May be null for some geometry types. |
|---|
For instance, a polygon geometry will have a boundary consisting of the linestrings for each ring in the polygon.
const QgsPoint* QgsPoint:: cast(const QgsAbstractGeometry* geom) const
Cast the geom to a QgsPoint.
Should be used by qgsgeometry_cast<QgsPoint *>( geometry ).
double QgsPoint:: closestSegment(const QgsPoint& pt,
QgsPoint& segmentPt,
QgsVertexId& vertexAfter,
int* leftOf = nullptr,
double epsilon = 4*std::numeric_limits<double>::epsilon()) const override
Searches for the closest segment of the geometry to a given point.
| Parameters | |
|---|---|
| pt | specifies the point to find closest segment to |
| segmentPt | storage for the closest point within the geometry |
| vertexAfter | storage for the ID of the vertex at the end of the closest segment |
| leftOf | indicates whether the point lies on the left side of the geometry (-1 if point is to the left of the geometry, +1 if the point is to the right of the geometry, or 0 for cases where left/right could not be determined, e.g. point exactly on a line) false if point is to right of segment) |
| epsilon | epsilon for segment snapping |
| Returns | squared distance to closest segment or negative value on error |
bool QgsPoint:: convertTo(QgsWkbTypes:: Type type) override
Converts the geometry to a specified type.
| Returns | true if conversion was successful |
|---|
QgsCoordinateSequence QgsPoint:: coordinateSequence() const override
Retrieves the sequence of geometries, rings and nodes.
| Returns | coordinate sequence |
|---|
QgsPoint* QgsPoint:: createEmptyWithSameType() const override
Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
To create it, the geometry is default constructed and then the WKB is changed.
bool QgsPoint:: deleteVertex(QgsVertexId position) override
Deletes a vertex within the geometry.
| Parameters | |
|---|---|
| position | vertex id for vertex to delete |
| Returns | true if delete was successful |
int QgsPoint:: dimension() const override
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.
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.
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.
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.
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.
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.
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.
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.
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.
void QgsPoint:: draw(QPainter& p) const override
Draws the geometry using the specified QPainter.
| Parameters | |
|---|---|
| p | destination QPainter |
bool QgsPoint:: dropMValue() override
Drops any measure values which exist in the geometry.
| Returns | true if m-values were present and have been removed |
|---|
bool QgsPoint:: dropZValue() override
Drops any z-dimensions which exist in the geometry.
| Returns | true if Z values were present and have been removed |
|---|
void QgsPoint:: filterVertices(const std::function<bool(const QgsPoint&)>& filter) override
Filters the vertices from the geometry in place, removing any which do not return true for the filter function check.
Has no meaning when called on a single point geometry.
Depending on the filter used, this may result in an invalid geometry.
bool QgsPoint:: fromWkb(QgsConstWkbPtr& wkb) override
Sets the geometry from a WKB string.
After successful read the wkb argument will be at the position where the reading has stopped.
bool QgsPoint:: fromWkt(const QString& wkt) override
Sets the geometry from a WKT string.
QString QgsPoint:: geometryType() const override
Returns a unique string representing the geometry type.
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).
bool QgsPoint:: insertVertex(QgsVertexId position,
const QgsPoint& vertex) override
Inserts a vertex into the geometry.
| Parameters | |
|---|---|
| position | vertex id for position of inserted vertex |
| vertex | vertex to insert |
| Returns | true if insert was successful |
double QgsPoint:: m() const
Returns the point's m value.
bool QgsPoint:: moveVertex(QgsVertexId position,
const QgsPoint& newPos) override
Moves a vertex within the geometry.
| Parameters | |
|---|---|
| position | vertex id for vertex to move |
| newPos | new position of vertex |
| Returns | true if move was successful |
bool QgsPoint:: nextVertex(QgsVertexId& id,
QgsPoint& vertex) const override
Returns next vertex id and coordinates.
| Parameters | |
|---|---|
| id | initial value should be the starting vertex id. The next vertex id will be stored in this variable if found. |
| vertex | container for found node |
| Returns | false if at end |
QgsPoint& QgsPoint:: operator+=(QgsVector v)
Adds a vector to this point in place.
QgsPoint& QgsPoint:: operator-=(QgsVector v)
Subtracts a vector from this point in place.
int QgsPoint:: partCount() const override
Returns count of parts contained in the geometry.
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).
| Parameters | |
|---|---|
| distance | distance to project |
| azimuth | angle to project in X Y, clockwise in degrees starting from north |
| inclination | angle 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)' |
M value is preserved.
bool QgsPoint:: removeDuplicateNodes(double epsilon = 4*std::numeric_limits<double>::epsilon(),
bool useZValues = false) override
Removes duplicate nodes from the geometry, wherever removing the nodes does not result in a degenerate geometry.
The epsilon parameter specifies the tolerance for coordinates when determining that vertices are identical.
By default, z values are not considered when detecting duplicate nodes. E.g. two nodes with the same x and y coordinate but different z values will still be considered duplicate and one will be removed. If useZValues is true, then the z values are also tested and nodes with the same x and y but different z will be maintained.
Note that duplicate nodes are not tested between different parts of a multipart geometry. E.g. a multipoint geometry with overlapping points will not be changed by this method.
The function will return true if nodes were removed, or false if no duplicate nodes were found.
double& QgsPoint:: rm()
Returns a reference to the m value of this point.
Using a reference makes it possible to directly manipulate m in place.
double& QgsPoint:: rx()
Returns a reference to the x-coordinate of this point.
Using a reference makes it possible to directly manipulate x in place.
double& QgsPoint:: ry()
Returns a reference to the y-coordinate of this point.
Using a reference makes it possible to directly manipulate y in place.
double& QgsPoint:: rz()
Returns a reference to the z-coordinate of this point.
Using a reference makes it possible to directly manipulate z in place.
double QgsPoint:: segmentLength(QgsVertexId startVertex) const override
Returns the length of the segment of the geometry which begins at startVertex.
void QgsPoint:: setM(double m)
Sets the point's m-value.
void QgsPoint:: setX(double x)
Sets the point's x-coordinate.
void QgsPoint:: setY(double y)
Sets the point's y-coordinate.
void QgsPoint:: setZ(double z)
Sets the point's z-coordinate.
QgsPoint* QgsPoint:: snappedToGrid(double hSpacing,
double vSpacing,
double dSpacing = 0,
double mSpacing = 0) const override
Makes a new geometry with all the points or vertices snapped to the closest point of the grid.
| Parameters | |
|---|---|
| hSpacing | Horizontal spacing of the grid (x axis). 0 to disable. |
| vSpacing | Vertical spacing of the grid (y axis). 0 to disable. |
| dSpacing | Depth spacing of the grid (z axis). 0 (default) to disable. |
| mSpacing | Custom dimension spacing of the grid (m axis). 0 (default) to disable. |
Ownership is transferred to the caller.
If the gridified geometry could not be calculated a nullptr will be returned. It may generate an invalid geometry (in some corner cases). It can also be thought as rounding the edges and it may be useful for removing errors. Example: geometry->snappedToGrid(1, 1); In this case we use a 2D grid of 1x1 to gridify. In this case, it can be thought like rounding the x and y of all the points/vertices to full units (remove all decimals).
void QgsPoint:: swapXy() override
Swaps the x and y coordinates from the geometry.
This can be used to repair geometries which have accidentally had their latitude and longitude coordinates reversed.
QgsPoint* QgsPoint:: toCurveType() const override
Returns the geometry converted to the more generic curve type.
| Returns | the converted geometry. Caller takes ownership |
|---|
E.g. QgsLineString -> QgsCompoundCurve, QgsPolygon -> QgsCurvePolygon, QgsMultiLineString -> QgsMultiCurve, QgsMultiPolygon -> QgsMultiSurface
QPointF QgsPoint:: toQPointF() const
Returns the point as a QPointF.
void QgsPoint:: transform(const QgsCoordinateTransform& ct,
QgsCoordinateTransform:: TransformDirection d = QgsCoordinateTransform:: ForwardTransform,
bool transformZ = false) virtual
Transforms the geometry using a coordinate transform.
| Parameters | |
|---|---|
| ct | coordinate transform |
| d | transformation direction |
| transformZ | set 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. |
void QgsPoint:: transform(const QTransform& t,
double zTranslate = 0.0,
double zScale = 1.0,
double mTranslate = 0.0,
double mScale = 1.0) override
Transforms the x and y components of the geometry using a QTransform object t.
Optionally, the geometry's z values can be scaled via zScale and translated via zTranslate. Similarly, m-values can be scaled via mScale and translated via mTranslate.
void QgsPoint:: transformVertices(const std::function<QgsPoint(const QgsPoint&)>& transform) override
Transforms the vertices from the geometry in place, applying the transform function to every vertex.
Depending on the transform used, this may result in an invalid geometry.
Transform functions are not permitted to alter the dimensionality of vertices. If a transform which adds (or removes) z/m values is desired, first call the corresponding addZValue() or addMValue() function to change the geometry's dimensionality and then transform.
double QgsPoint:: vertexAngle(QgsVertexId vertex) const override
Angle undefined.
| Parameters | |
|---|---|
| vertex | the vertex id |
| Returns | 0.0 |
Always returns 0.0
int QgsPoint:: vertexNumberFromVertexId(QgsVertexId id) const override
Returns the vertex number corresponding to a vertex id.
The vertex numbers start at 0, so a return value of 0 corresponds to the first vertex.
Returns -1 if a corresponding vertex could not be found.
double QgsPoint:: x() const
Returns the point's x-coordinate.
double QgsPoint:: y() const
Returns the point's y-coordinate.
double QgsPoint:: z() const
Returns the point's z-coordinate.
int QgsPoint:: childCount() const override protected
Returns number of child geometries (for geometries with child geometries) or child points (for geometries without child geometries - i.e.
curve / point)
QgsPoint QgsPoint:: childPoint(int index) const override protected
Returns point at index (for geometries without child geometries - i.e.
curve / point)