QgsAbstractGeometry class
Abstract base class for all geometries.
Contents
Derived classes
- class QgsCurve
- Abstract base class for curved geometry type.
- class QgsGeometryCollection
- Geometry collection.
- class QgsPoint
- Point geometry type, with support for z-dimension and m-values.
Public types
- class const_part_iterator
- The part_
iterator class provides STL-style iterator for const references to geometry parts. - class part_iterator
- The part_
iterator class provides STL-style iterator for geometry parts. - class vertex_iterator
- The vertex_
iterator class provides STL-style iterator for vertices. - enum AxisOrder { XY = 0, YX }
- Axis order for GML generation.
- enum SegmentationToleranceType { MaximumAngle = 0, MaximumDifference }
- Segmentation tolerance as maximum angle or maximum difference between approximation and circle.
Constructors, destructors, conversion operators
- QgsAbstractGeometry() defaulted
- Constructor for QgsAbstractGeometry.
Public functions
- auto addMValue(double mValue = 0) -> bool pure virtual
- Adds a measure to the geometry, initialized to a preset value.
- auto addZValue(double zValue = 0) -> bool pure virtual
- Adds a z-dimension to the geometry, initialized to a preset value.
- void adjacentVertices(QgsVertexId vertex, QgsVertexId& previousVertex, QgsVertexId& nextVertex) const pure virtual
- Returns the vertices adjacent to a specified vertex within a geometry.
- auto area() const -> double virtual
- Returns the area of the geometry.
- auto asGml2(QDomDocument& doc, int precision = 17, const QString& ns = "gml", AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY) const -> QDomElement pure virtual
- Returns a GML2 representation of the geometry.
- auto asGml3(QDomDocument& doc, int precision = 17, const QString& ns = "gml", AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY) const -> QDomElement pure virtual
- Returns a GML3 representation of the geometry.
- auto asJson(int precision = 17) const -> QString pure virtual
- Returns a GeoJSON representation of the geometry.
- auto asWkb() const -> QByteArray pure virtual
- Returns a WKB representation of the geometry.
- auto asWkt(int precision = 17) const -> QString pure virtual
- Returns a WKT representation of the geometry.
- auto boundary() const -> QgsAbstractGeometry* pure virtual
- Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the geometry).
- auto boundingBox() const -> QgsRectangle pure virtual
- Returns the minimal bounding box for the geometry.
- auto centroid() const -> QgsPoint virtual
- Returns the centroid of the geometry.
- void clear() pure virtual
- Clears the geometry, ie reset it to a null geometry.
- auto clone() const -> QgsAbstractGeometry* pure virtual
- 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 pure virtual
- Searches for the closest segment of the geometry to a given point.
-
auto const_parts_begin() const -> const_
part_ iterator - Returns STL-style iterator pointing to the const first part of the geometry.
-
auto const_parts_end() const -> const_
part_ iterator - Returns STL-style iterator pointing to the imaginary const part after the last part of the geometry.
-
auto convertTo(QgsWkbTypes::
Type type) -> bool virtual - Converts the geometry to a specified type.
- auto coordinateSequence() const -> QgsCoordinateSequence pure virtual
- Retrieves the sequence of geometries, rings and nodes.
- auto createEmptyWithSameType() const -> QgsAbstractGeometry* pure virtual
- Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
- auto deleteVertex(QgsVertexId position) -> bool pure virtual
- Deletes a vertex within the geometry.
- auto dimension() const -> int pure virtual
- Returns the inherent dimension of the geometry.
- void draw(QPainter& p) const pure virtual
- Draws the geometry using the specified QPainter.
- auto dropMValue() -> bool pure virtual
- Drops any measure values which exist in the geometry.
- auto dropZValue() -> bool pure virtual
- Drops any z-dimensions which exist in the geometry.
- void filterVertices(const std::function<bool(const QgsPoint&)>& filter) virtual
- 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 pure virtual
- Sets the geometry from a WKB string.
- auto fromWkt(const QString& wkt) -> bool pure virtual
- Sets the geometry from a WKT string.
- auto geometryType() const -> QString pure virtual
- Returns a unique string representing the geometry type.
- auto hasCurvedSegments() const -> bool virtual
- Returns true if the geometry contains curved segments.
- auto insertVertex(QgsVertexId position, const QgsPoint& vertex) -> bool pure virtual
- Inserts a vertex into the geometry.
- auto is3D() const -> bool
- Returns true if the geometry is 3D and contains a z-value.
- auto isEmpty() const -> bool virtual
- Returns true if the geometry is empty.
- auto isMeasure() const -> bool
- Returns true if the geometry contains m values.
- auto length() const -> double virtual
- Returns the length of the geometry.
- auto moveVertex(QgsVertexId position, const QgsPoint& newPos) -> bool pure virtual
- Moves a vertex within the geometry.
- auto nCoordinates() const -> int virtual
- Returns the number of nodes contained in the geometry.
- auto nextVertex(QgsVertexId& id, QgsPoint& vertex) const -> bool pure virtual
- Returns next vertex id and coordinates.
- auto partCount() const -> int pure virtual
- Returns count of parts contained in the geometry.
- auto parts() const -> QgsGeometryConstPartIterator
- Returns Java-style iterator for traversal of parts of the geometry.
- auto parts() -> QgsGeometryPartIterator
- Returns Java-style iterator for traversal of parts of the geometry.
-
auto parts_begin() -> part_
iterator - Returns STL-style iterator pointing to the first part of the geometry.
-
auto parts_end() -> part_
iterator - Returns STL-style iterator pointing to the imaginary part after the last part of the geometry.
- auto perimeter() const -> double virtual
- Returns the perimeter of the geometry.
- auto removeDuplicateNodes(double epsilon = 4*std::numeric_limits<double>::epsilon(), bool useZValues = false) -> bool pure virtual
- Removes duplicate nodes from the geometry, wherever removing the nodes does not result in a degenerate geometry.
- auto ringCount(int part = 0) const -> int pure virtual
- Returns the number of rings of which this geometry is built.
- auto segmentize(double tolerance = M_PI/180., SegmentationToleranceType toleranceType = MaximumAngle) const -> QgsAbstractGeometry* virtual
- Returns a version of the geometry without curves.
- auto segmentLength(QgsVertexId startVertex) const -> double pure virtual
- Returns the length of the segment of the geometry which begins at startVertex.
- auto snappedToGrid(double hSpacing, double vSpacing, double dSpacing = 0, double mSpacing = 0) const -> QgsAbstractGeometry* pure virtual
- Makes a new geometry with all the points or vertices snapped to the closest point of the grid.
- void swapXy() pure virtual
- Swaps the x and y coordinates from the geometry.
- auto toCurveType() const -> QgsAbstractGeometry* pure virtual
- Returns the geometry converted to the more generic curve type.
-
void transform(const QgsCoordinateTransform& ct,
QgsCoordinateTransform::
TransformDirection d = QgsCoordinateTransform:: ForwardTransform, bool transformZ = false) pure 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) pure virtual
- Transforms the x and y components of the geometry using a QTransform object t.
- void transformVertices(const std::function<QgsPoint(const QgsPoint&)>& transform) virtual
- Transforms the vertices from the geometry in place, applying the transform function to every vertex.
- auto vertexAngle(QgsVertexId vertex) const -> double pure virtual
- Returns approximate angle at a vertex.
- auto vertexAt(QgsVertexId id) const -> QgsPoint pure virtual
- Returns the point corresponding to a specified vertex id.
- auto vertexCount(int part = 0, int ring = 0) const -> int pure virtual
- Returns the number of vertices of which this geometry is built.
- auto vertexNumberFromVertexId(QgsVertexId id) const -> int pure virtual
- Returns the vertex number corresponding to a vertex id.
- auto vertices() const -> QgsVertexIterator
- Returns a read-only, Java-style iterator for traversal of vertices of all the geometry, including all geometry parts and rings.
-
auto vertices_begin() const -> vertex_
iterator - Returns STL-style iterator pointing to the first vertex of the geometry.
-
auto vertices_end() const -> vertex_
iterator - Returns STL-style iterator pointing to the imaginary vertex after the last vertex of the geometry.
-
auto wkbType() const -> QgsWkbTypes::
Type - Returns the WKB type of the geometry.
- auto wktTypeStr() const -> QString
- Returns the WKT type string of the geometry.
Protected functions
- auto calculateBoundingBox() const -> QgsRectangle virtual
- Default calculator for the minimal bounding box for the geometry.
- auto childCount() const -> int virtual
- Returns number of child geometries (for geometries with child geometries) or child points (for geometries without child geometries - i.e.
- auto childGeometry(int index) const -> QgsAbstractGeometry* virtual
- Returns pointer to child geometry (for geometries with child geometries - i.e.
- auto childPoint(int index) const -> QgsPoint virtual
- Returns point at index (for geometries without child geometries - i.e.
- void clearCache() const virtual
- Clears any cached parameters associated with the geometry, e.g., bounding boxes.
- auto hasChildGeometries() const -> bool virtual
- Returns whether the geometry has any child geometries (false for point / curve, true otherwise)
-
void setZMTypeFromSubGeometry(const QgsAbstractGeometry* subggeom,
QgsWkbTypes::
Type baseGeomType) - Updates the geometry type based on whether sub geometries contain z or m values.
Enum documentation
enum QgsAbstractGeometry:: SegmentationToleranceType
Segmentation tolerance as maximum angle or maximum difference between approximation and circle.
| Enumerators | |
|---|---|
| MaximumAngle |
Maximum angle between generating radii (lines from arc center to output vertices) |
| MaximumDifference |
Maximum distance between an arbitrary point on the original curve and closest point on its approximation. |
Function documentation
bool QgsAbstractGeometry:: addMValue(double mValue = 0) pure virtual
Adds a measure to the geometry, initialized to a preset value.
| Parameters | |
|---|---|
| mValue | initial m-value for all nodes |
| Returns | true on success |
bool QgsAbstractGeometry:: addZValue(double zValue = 0) pure virtual
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 QgsAbstractGeometry:: adjacentVertices(QgsVertexId vertex,
QgsVertexId& previousVertex,
QgsVertexId& nextVertex) const pure virtual
Returns the vertices adjacent to a specified vertex within a geometry.
double QgsAbstractGeometry:: area() const virtual
Returns the area of the geometry.
QDomElement QgsAbstractGeometry:: asGml2(QDomDocument& doc,
int precision = 17,
const QString& ns = "gml",
AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY) const pure virtual
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 QgsAbstractGeometry:: asGml3(QDomDocument& doc,
int precision = 17,
const QString& ns = "gml",
AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY) const pure virtual
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 QgsAbstractGeometry:: asJson(int precision = 17) const pure virtual
Returns a GeoJSON representation of the geometry.
| Parameters | |
|---|---|
| precision | number of decimal places for coordinates |
QByteArray QgsAbstractGeometry:: asWkb() const pure virtual
Returns a WKB representation of the geometry.
QString QgsAbstractGeometry:: asWkt(int precision = 17) const pure virtual
Returns a WKT representation of the geometry.
| Parameters | |
|---|---|
| precision | number of decimal places for coordinates |
QgsAbstractGeometry* QgsAbstractGeometry:: boundary() const pure virtual
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.
double QgsAbstractGeometry:: closestSegment(const QgsPoint& pt,
QgsPoint& segmentPt,
QgsVertexId& vertexAfter,
int* leftOf = nullptr,
double epsilon = 4*std::numeric_limits<double>::epsilon()) const pure virtual
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 |
const_ part_ iterator QgsAbstractGeometry:: const_parts_begin() const
Returns STL-style iterator pointing to the const first part of the geometry.
const_ part_ iterator QgsAbstractGeometry:: const_parts_end() const
Returns STL-style iterator pointing to the imaginary const part after the last part of the geometry.
bool QgsAbstractGeometry:: convertTo(QgsWkbTypes:: Type type) virtual
Converts the geometry to a specified type.
| Returns | true if conversion was successful |
|---|
QgsCoordinateSequence QgsAbstractGeometry:: coordinateSequence() const pure virtual
Retrieves the sequence of geometries, rings and nodes.
| Returns | coordinate sequence |
|---|
QgsAbstractGeometry* QgsAbstractGeometry:: createEmptyWithSameType() const pure virtual
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 QgsAbstractGeometry:: deleteVertex(QgsVertexId position) pure virtual
Deletes a vertex within the geometry.
| Parameters | |
|---|---|
| position | vertex id for vertex to delete |
| Returns | true if delete was successful |
int QgsAbstractGeometry:: dimension() const pure virtual
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.
void QgsAbstractGeometry:: draw(QPainter& p) const pure virtual
Draws the geometry using the specified QPainter.
| Parameters | |
|---|---|
| p | destination QPainter |
bool QgsAbstractGeometry:: dropMValue() pure virtual
Drops any measure values which exist in the geometry.
| Returns | true if m-values were present and have been removed |
|---|
bool QgsAbstractGeometry:: dropZValue() pure virtual
Drops any z-dimensions which exist in the geometry.
| Returns | true if Z values were present and have been removed |
|---|
void QgsAbstractGeometry:: filterVertices(const std::function<bool(const QgsPoint&)>& filter) virtual
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 QgsAbstractGeometry:: fromWkb(QgsConstWkbPtr& wkb) pure virtual
Sets the geometry from a WKB string.
After successful read the wkb argument will be at the position where the reading has stopped.
bool QgsAbstractGeometry:: fromWkt(const QString& wkt) pure virtual
Sets the geometry from a WKT string.
QString QgsAbstractGeometry:: geometryType() const pure virtual
Returns a unique string representing the geometry type.
bool QgsAbstractGeometry:: insertVertex(QgsVertexId position,
const QgsPoint& vertex) pure virtual
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 |
bool QgsAbstractGeometry:: is3D() const
Returns true if the geometry is 3D and contains a z-value.
bool QgsAbstractGeometry:: isMeasure() const
Returns true if the geometry contains m values.
double QgsAbstractGeometry:: length() const virtual
Returns the length of the geometry.
bool QgsAbstractGeometry:: moveVertex(QgsVertexId position,
const QgsPoint& newPos) pure virtual
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 QgsAbstractGeometry:: nextVertex(QgsVertexId& id,
QgsPoint& vertex) const pure virtual
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 |
int QgsAbstractGeometry:: partCount() const pure virtual
Returns count of parts contained in the geometry.
QgsGeometryConstPartIterator QgsAbstractGeometry:: parts() const
Returns Java-style iterator for traversal of parts of the geometry.
This iterator returns read-only references to parts and cannot be used to modify the parts.
QgsGeometryPartIterator QgsAbstractGeometry:: parts()
Returns Java-style iterator for traversal of parts of the geometry.
This iterator can safely be used to modify parts of the geometry.
Example:
# print the WKT representation of each part in a multi-point geometry geometry = QgsMultiPoint.fromWkt( 'MultiPoint( 0 0, 1 1, 2 2)' ) for part in geometry.parts(): print(part.asWkt()) # single part geometries only have one part - this loop will iterate once only geometry = QgsLineString.fromWkt( 'LineString( 0 0, 10 10 )' ) for part in geometry.parts(): print(part.asWkt()) # parts can be modified during the iteration geometry = QgsMultiPoint.fromWkt( 'MultiPoint( 0 0, 1 1, 2 2)' ) for part in geometry.parts(): part.transform(ct) # part iteration can also be combined with vertex iteration geometry = QgsMultiPolygon.fromWkt( 'MultiPolygon((( 0 0, 0 10, 10 10, 10 0, 0 0 ),( 5 5, 5 6, 6 6, 6 5, 5 5)),((20 2, 22 2, 22 4, 20 4, 20 2)))' ) for part in geometry.parts(): for v in part.vertices(): print(v.x(), v.y())
part_ iterator QgsAbstractGeometry:: parts_begin()
Returns STL-style iterator pointing to the first part of the geometry.
part_ iterator QgsAbstractGeometry:: parts_end()
Returns STL-style iterator pointing to the imaginary part after the last part of the geometry.
double QgsAbstractGeometry:: perimeter() const virtual
Returns the perimeter of the geometry.
bool QgsAbstractGeometry:: removeDuplicateNodes(double epsilon = 4*std::numeric_limits<double>::epsilon(),
bool useZValues = false) pure virtual
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.
QgsAbstractGeometry* QgsAbstractGeometry:: segmentize(double tolerance = M_PI/180.,
SegmentationToleranceType toleranceType = MaximumAngle) const virtual
Returns a version of the geometry without curves.
| Parameters | |
|---|---|
| tolerance | segmentation tolerance |
| toleranceType | maximum segmentation angle or maximum difference between approximation and curve |
Caller takes ownership of the returned geometry.
double QgsAbstractGeometry:: segmentLength(QgsVertexId startVertex) const pure virtual
Returns the length of the segment of the geometry which begins at startVertex.
QgsAbstractGeometry* QgsAbstractGeometry:: snappedToGrid(double hSpacing,
double vSpacing,
double dSpacing = 0,
double mSpacing = 0) const pure virtual
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 QgsAbstractGeometry:: swapXy() pure virtual
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.
QgsAbstractGeometry* QgsAbstractGeometry:: toCurveType() const pure virtual
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
void QgsAbstractGeometry:: transform(const QgsCoordinateTransform& ct,
QgsCoordinateTransform:: TransformDirection d = QgsCoordinateTransform:: ForwardTransform,
bool transformZ = false) pure 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 QgsAbstractGeometry:: transform(const QTransform& t,
double zTranslate = 0.0,
double zScale = 1.0,
double mTranslate = 0.0,
double mScale = 1.0) pure virtual
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 QgsAbstractGeometry:: transformVertices(const std::function<QgsPoint(const QgsPoint&)>& transform) virtual
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 QgsAbstractGeometry:: vertexAngle(QgsVertexId vertex) const pure virtual
Returns approximate angle at a vertex.
| Parameters | |
|---|---|
| vertex | the vertex id |
| Returns | rotation in radians, clockwise from north |
This is usually the average angle between adjacent segments, and can be pictured as the orientation of a line following the curvature of the geometry at the specified vertex.
int QgsAbstractGeometry:: vertexNumberFromVertexId(QgsVertexId id) const pure virtual
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.
QgsVertexIterator QgsAbstractGeometry:: vertices() const
Returns a read-only, Java-style iterator for traversal of vertices of all the geometry, including all geometry parts and rings.
Example:
# print the x and y coordinate for each vertex in a LineString geometry = QgsLineString.fromWkt( 'LineString( 0 0, 1 1, 2 2)' ) for v in geometry.vertices(): print(v.x(), v.y()) # vertex iteration includes all parts and rings geometry = QgsMultiPolygon.fromWkt( 'MultiPolygon((( 0 0, 0 10, 10 10, 10 0, 0 0 ),( 5 5, 5 6, 6 6, 6 5, 5 5)),((20 2, 22 2, 22 4, 20 4, 20 2)))' ) for v in geometry.vertices(): print(v.x(), v.y())
vertex_ iterator QgsAbstractGeometry:: vertices_begin() const
Returns STL-style iterator pointing to the first vertex of the geometry.
vertex_ iterator QgsAbstractGeometry:: vertices_end() const
Returns STL-style iterator pointing to the imaginary vertex after the last vertex of the geometry.
QgsWkbTypes:: Type QgsAbstractGeometry:: wkbType() const
Returns the WKB type of the geometry.
QString QgsAbstractGeometry:: wktTypeStr() const
Returns the WKT type string of the geometry.
QgsRectangle QgsAbstractGeometry:: calculateBoundingBox() const virtual protected
Default calculator for the minimal bounding box for the geometry.
Derived classes should override this method if a more efficient bounding box calculation is available.
int QgsAbstractGeometry:: childCount() const virtual protected
Returns number of child geometries (for geometries with child geometries) or child points (for geometries without child geometries - i.e.
curve / point)
QgsAbstractGeometry* QgsAbstractGeometry:: childGeometry(int index) const virtual protected
Returns pointer to child geometry (for geometries with child geometries - i.e.
geom. collection / polygon)
QgsPoint QgsAbstractGeometry:: childPoint(int index) const virtual protected
Returns point at index (for geometries without child geometries - i.e.
curve / point)
bool QgsAbstractGeometry:: hasChildGeometries() const virtual protected
Returns whether the geometry has any child geometries (false for point / curve, true otherwise)