mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-04 00:04:25 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			1114 lines
		
	
	
		
			34 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			1114 lines
		
	
	
		
			34 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
/************************************************************************
 | 
						|
 * This file has been generated automatically from                      *
 | 
						|
 *                                                                      *
 | 
						|
 * src/core/geometry/qgsabstractgeometry.h                              *
 | 
						|
 *                                                                      *
 | 
						|
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 | 
						|
 ************************************************************************/
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
typedef QVector< QgsPoint > QgsPointSequence;
 | 
						|
typedef QVector< QVector< QgsPoint > > QgsRingSequence;
 | 
						|
typedef QVector< QVector< QVector< QgsPoint > > > QgsCoordinateSequence;
 | 
						|
 | 
						|
 | 
						|
class QgsAbstractGeometry
 | 
						|
{
 | 
						|
%Docstring(signature="appended")
 | 
						|
Abstract base class for all geometries
 | 
						|
 | 
						|
.. note::
 | 
						|
 | 
						|
   :py:class:`QgsAbstractGeometry` objects are inherently Cartesian/planar geometries. They have no concept of geodesy, and none
 | 
						|
   of the methods or properties exposed from the :py:class:`QgsAbstractGeometry` API (or :py:class:`QgsGeometry` API) utilize
 | 
						|
   geodesic calculations. Accordingly, properties like :py:func:`~length` and :py:func:`~area` and spatial operations like :py:func:`~centroid`
 | 
						|
   are always calculated using strictly Cartesian mathematics. In contrast, the :py:class:`QgsDistanceArea` class exposes
 | 
						|
   methods for working with geodesic calculations and spatial operations on geometries,
 | 
						|
   and should be used whenever calculations which account for the curvature of the Earth (or any other celestial body)
 | 
						|
   are required.
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgsabstractgeometry.h"
 | 
						|
%End
 | 
						|
%ConvertToSubClassCode
 | 
						|
    if ( qgsgeometry_cast<QgsPoint *>( sipCpp ) != nullptr )
 | 
						|
      sipType = sipType_QgsPoint;
 | 
						|
    else if ( qgsgeometry_cast<QgsLineString *>( sipCpp ) != nullptr )
 | 
						|
      sipType = sipType_QgsLineString;
 | 
						|
    else if ( qgsgeometry_cast<QgsCircularString *>( sipCpp ) != nullptr )
 | 
						|
      sipType = sipType_QgsCircularString;
 | 
						|
    else if ( qgsgeometry_cast<QgsCompoundCurve *>( sipCpp ) != nullptr )
 | 
						|
      sipType = sipType_QgsCompoundCurve;
 | 
						|
    else if ( qgsgeometry_cast<QgsTriangle *>( sipCpp ) != nullptr )
 | 
						|
      sipType = sipType_QgsTriangle;
 | 
						|
    else if ( qgsgeometry_cast<QgsPolygon *>( sipCpp ) != nullptr )
 | 
						|
      sipType = sipType_QgsPolygon;
 | 
						|
    else if ( qgsgeometry_cast<QgsCurvePolygon *>( sipCpp ) != nullptr )
 | 
						|
      sipType = sipType_QgsCurvePolygon;
 | 
						|
    else if ( qgsgeometry_cast<QgsMultiPoint *>( sipCpp ) != nullptr )
 | 
						|
      sipType = sipType_QgsMultiPoint;
 | 
						|
    else if ( qgsgeometry_cast<QgsMultiLineString *>( sipCpp ) != nullptr )
 | 
						|
      sipType = sipType_QgsMultiLineString;
 | 
						|
    else if ( qgsgeometry_cast<QgsMultiPolygon *>( sipCpp ) != nullptr )
 | 
						|
      sipType = sipType_QgsMultiPolygon;
 | 
						|
    else if ( qgsgeometry_cast<QgsMultiSurface *>( sipCpp ) != nullptr )
 | 
						|
      sipType = sipType_QgsMultiSurface;
 | 
						|
    else if ( qgsgeometry_cast<QgsMultiCurve *>( sipCpp ) != nullptr )
 | 
						|
      sipType = sipType_QgsMultiCurve;
 | 
						|
    else if ( qgsgeometry_cast<QgsGeometryCollection *>( sipCpp ) != nullptr )
 | 
						|
      sipType = sipType_QgsGeometryCollection;
 | 
						|
    else
 | 
						|
      sipType = 0;
 | 
						|
%End
 | 
						|
  public:
 | 
						|
    static const QMetaObject staticMetaObject;
 | 
						|
 | 
						|
  public:
 | 
						|
 | 
						|
    enum SegmentationToleranceType
 | 
						|
    {
 | 
						|
 | 
						|
      MaximumAngle,
 | 
						|
 | 
						|
      MaximumDifference
 | 
						|
    };
 | 
						|
 | 
						|
    enum AxisOrder
 | 
						|
    {
 | 
						|
 | 
						|
      XY,
 | 
						|
 | 
						|
      YX
 | 
						|
    };
 | 
						|
 | 
						|
    QgsAbstractGeometry();
 | 
						|
    virtual ~QgsAbstractGeometry();
 | 
						|
    QgsAbstractGeometry( const QgsAbstractGeometry &geom );
 | 
						|
 | 
						|
    virtual bool operator==( const QgsAbstractGeometry &other ) const = 0;
 | 
						|
    virtual bool operator!=( const QgsAbstractGeometry &other ) const = 0;
 | 
						|
 | 
						|
    virtual bool fuzzyEqual( const QgsAbstractGeometry &other, double epsilon = 1e-8 ) const = 0;
 | 
						|
%Docstring
 | 
						|
Performs fuzzy comparison between this geometry and ``other`` using an ``epsilon``.
 | 
						|
 | 
						|
The comparison is done by examining the specific values (such as x and y) that define the location of vertices in the geometry.
 | 
						|
 | 
						|
.. seealso:: :py:func:`fuzzyDistanceEqual`
 | 
						|
 | 
						|
.. seealso:: :py:func:`QgsGeometryUtilsBase.fuzzyDistanceEqual`
 | 
						|
 | 
						|
.. versionadded:: 3.36
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool fuzzyDistanceEqual( const QgsAbstractGeometry &other, double epsilon = 1e-8 ) const = 0;
 | 
						|
%Docstring
 | 
						|
Performs fuzzy distance comparison between this geometry and ``other`` using an ``epsilon``.
 | 
						|
 | 
						|
Traditionally, the comparison is done by examining the specific values (such as x and y) that define the location of vertices in the geometry.
 | 
						|
It focuses on the numerical differences or relationships between these values.
 | 
						|
On the other hand, comparing distances between points considers the actual spatial separation or length between the points, regardless of their coordinate values.
 | 
						|
This comparison involves measuring the distance between two points using formulas like the distance formula. Here, it's the "distance comparison" (fuzzyDistanceEqual).
 | 
						|
 | 
						|
.. seealso:: :py:func:`fuzzyEqual`
 | 
						|
 | 
						|
.. seealso:: :py:func:`QgsGeometryUtilsBase.fuzzyEqual`
 | 
						|
 | 
						|
.. versionadded:: 3.36
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsAbstractGeometry *clone() const = 0 /Factory/;
 | 
						|
%Docstring
 | 
						|
Clones the geometry by performing a deep copy
 | 
						|
%End
 | 
						|
 | 
						|
    virtual int compareTo( const QgsAbstractGeometry *other ) const;
 | 
						|
%Docstring
 | 
						|
Comparator for sorting of geometry.
 | 
						|
 | 
						|
.. versionadded:: 3.20
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void clear() = 0;
 | 
						|
%Docstring
 | 
						|
Clears the geometry, ie reset it to a null geometry
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsRectangle boundingBox() const;
 | 
						|
%Docstring
 | 
						|
Returns the minimal bounding box for the geometry
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsBox3D boundingBox3D() const = 0;
 | 
						|
%Docstring
 | 
						|
Returns the 3D bounding box for the geometry.
 | 
						|
 | 
						|
.. versionadded:: 3.34
 | 
						|
%End
 | 
						|
 | 
						|
 | 
						|
    virtual int dimension() const = 0;
 | 
						|
%Docstring
 | 
						|
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.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QString geometryType() const = 0;
 | 
						|
%Docstring
 | 
						|
Returns a unique string representing the geometry type.
 | 
						|
 | 
						|
.. seealso:: :py:func:`wkbType`
 | 
						|
 | 
						|
.. seealso:: :py:func:`wktTypeStr`
 | 
						|
%End
 | 
						|
 | 
						|
    Qgis::WkbType wkbType() const /HoldGIL/;
 | 
						|
%Docstring
 | 
						|
Returns the WKB type of the geometry.
 | 
						|
 | 
						|
.. seealso:: :py:func:`geometryType`
 | 
						|
 | 
						|
.. seealso:: :py:func:`wktTypeStr`
 | 
						|
%End
 | 
						|
 | 
						|
    QString wktTypeStr() const;
 | 
						|
%Docstring
 | 
						|
Returns the WKT type string of the geometry.
 | 
						|
 | 
						|
.. seealso:: :py:func:`geometryType`
 | 
						|
 | 
						|
.. seealso:: :py:func:`wkbType`
 | 
						|
%End
 | 
						|
 | 
						|
    bool is3D() const /HoldGIL/;
 | 
						|
%Docstring
 | 
						|
Returns ``True`` if the geometry is 3D and contains a z-value.
 | 
						|
 | 
						|
.. seealso:: :py:func:`isMeasure`
 | 
						|
%End
 | 
						|
 | 
						|
    bool isMeasure() const /HoldGIL/;
 | 
						|
%Docstring
 | 
						|
Returns ``True`` if the geometry contains m values.
 | 
						|
 | 
						|
.. seealso:: :py:func:`is3D`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsAbstractGeometry *boundary() const = 0 /Factory/;
 | 
						|
%Docstring
 | 
						|
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.
 | 
						|
 | 
						|
:return: boundary for geometry. May be ``None`` for some geometry types.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void normalize() = 0;
 | 
						|
%Docstring
 | 
						|
Reorganizes the geometry into a normalized form (or "canonical" form).
 | 
						|
 | 
						|
Polygon rings will be rearranged so that their starting vertex is the lower left and ring orientation follows the
 | 
						|
right hand rule, collections are ordered by geometry type, and other normalization techniques are applied. The
 | 
						|
resultant geometry will be geometrically equivalent to the original geometry.
 | 
						|
 | 
						|
.. versionadded:: 3.20
 | 
						|
%End
 | 
						|
 | 
						|
 | 
						|
    virtual bool fromWkb( QgsConstWkbPtr &wkb ) = 0;
 | 
						|
%Docstring
 | 
						|
Sets the geometry from a WKB string.
 | 
						|
After successful read the wkb argument will be at the position where the reading has stopped.
 | 
						|
 | 
						|
.. seealso:: :py:func:`fromWkt`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool fromWkt( const QString &wkt ) = 0;
 | 
						|
%Docstring
 | 
						|
Sets the geometry from a WKT string.
 | 
						|
 | 
						|
.. seealso:: :py:func:`fromWkb`
 | 
						|
%End
 | 
						|
 | 
						|
 | 
						|
    enum WkbFlag
 | 
						|
    {
 | 
						|
      FlagExportTrianglesAsPolygons,
 | 
						|
      FlagExportNanAsDoubleMin,
 | 
						|
    };
 | 
						|
    typedef QFlags<QgsAbstractGeometry::WkbFlag> WkbFlags;
 | 
						|
 | 
						|
 | 
						|
    virtual int wkbSize( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const = 0;
 | 
						|
%Docstring
 | 
						|
Returns the length of the QByteArray returned by :py:func:`~QgsAbstractGeometry.asWkb`
 | 
						|
 | 
						|
The optional ``flags`` argument specifies flags controlling WKB export behavior
 | 
						|
 | 
						|
.. versionadded:: 3.16
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QByteArray asWkb( WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const = 0;
 | 
						|
%Docstring
 | 
						|
Returns a WKB representation of the geometry.
 | 
						|
 | 
						|
The optional ``flags`` argument specifies flags controlling WKB export behavior (since QGIS 3.14).
 | 
						|
 | 
						|
.. seealso:: :py:func:`asWkt`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asGml2`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asGml3`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asJson`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QString asWkt( int precision = 17 ) const = 0;
 | 
						|
%Docstring
 | 
						|
Returns a WKT representation of the geometry.
 | 
						|
 | 
						|
:param precision: number of decimal places for coordinates
 | 
						|
 | 
						|
.. seealso:: :py:func:`asWkb`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asGml2`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asGml3`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asJson`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml", AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const = 0;
 | 
						|
%Docstring
 | 
						|
Returns a GML2 representation of the geometry.
 | 
						|
 | 
						|
:param doc: DOM document
 | 
						|
:param precision: number of decimal places for coordinates
 | 
						|
:param ns: XML namespace
 | 
						|
:param axisOrder: Axis order for generated GML
 | 
						|
 | 
						|
.. seealso:: :py:func:`asWkb`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asWkt`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asGml3`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asJson`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml", AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const = 0;
 | 
						|
%Docstring
 | 
						|
Returns a GML3 representation of the geometry.
 | 
						|
 | 
						|
:param doc: DOM document
 | 
						|
:param precision: number of decimal places for coordinates
 | 
						|
:param ns: XML namespace
 | 
						|
:param axisOrder: Axis order for generated GML
 | 
						|
 | 
						|
.. seealso:: :py:func:`asWkb`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asWkt`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asGml2`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asJson`
 | 
						|
%End
 | 
						|
 | 
						|
    QString asJson( int precision = 17 );
 | 
						|
%Docstring
 | 
						|
Returns a GeoJSON representation of the geometry as a QString.
 | 
						|
 | 
						|
:param precision: number of decimal places for coordinates
 | 
						|
 | 
						|
.. seealso:: :py:func:`asWkb`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asWkt`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asGml2`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asGml3`
 | 
						|
 | 
						|
.. seealso:: :py:func:`asJsonObject`
 | 
						|
%End
 | 
						|
 | 
						|
 | 
						|
    virtual QString asKml( int precision = 17 ) const = 0;
 | 
						|
%Docstring
 | 
						|
Returns a KML representation of the geometry.
 | 
						|
 | 
						|
.. versionadded:: 3.12
 | 
						|
%End
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    virtual void transform( const QgsCoordinateTransform &ct, Qgis::TransformDirection d = Qgis::TransformDirection::Forward, bool transformZ = false ) throw( QgsCsException ) = 0;
 | 
						|
%Docstring
 | 
						|
Transforms the geometry using a coordinate transform
 | 
						|
 | 
						|
:param ct: coordinate transform
 | 
						|
:param d: transformation direction
 | 
						|
:param 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.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0,
 | 
						|
                            double mTranslate = 0.0, double mScale = 1.0 ) = 0;
 | 
						|
%Docstring
 | 
						|
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``.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void draw( QPainter &p ) const = 0;
 | 
						|
%Docstring
 | 
						|
Draws the geometry using the specified QPainter.
 | 
						|
 | 
						|
:param p: destination QPainter
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QPainterPath asQPainterPath() const = 0;
 | 
						|
%Docstring
 | 
						|
Returns the geometry represented as a QPainterPath.
 | 
						|
 | 
						|
.. warning::
 | 
						|
 | 
						|
   not all geometry subclasses can be represented by a QPainterPath, e.g.
 | 
						|
   points and multipoint geometries will return an empty path.
 | 
						|
 | 
						|
.. versionadded:: 3.16
 | 
						|
%End
 | 
						|
 | 
						|
    virtual int vertexNumberFromVertexId( QgsVertexId id ) const = 0;
 | 
						|
%Docstring
 | 
						|
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.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex /Out/ ) const = 0;
 | 
						|
%Docstring
 | 
						|
Returns next vertex id and coordinates
 | 
						|
 | 
						|
:param id: initial value should be the starting vertex id. The next vertex id will be stored
 | 
						|
           in this variable if found.
 | 
						|
 | 
						|
:return: - ``False`` if at end
 | 
						|
         - vertex: container for found node
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void adjacentVertices( QgsVertexId vertex, QgsVertexId &previousVertex /Out/, QgsVertexId &nextVertex /Out/ ) const = 0;
 | 
						|
%Docstring
 | 
						|
Returns the vertices adjacent to a specified ``vertex`` within a geometry.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsCoordinateSequence coordinateSequence() const = 0;
 | 
						|
%Docstring
 | 
						|
Retrieves the sequence of geometries, rings and nodes.
 | 
						|
 | 
						|
:return: coordinate sequence
 | 
						|
%End
 | 
						|
 | 
						|
    virtual int nCoordinates() const;
 | 
						|
%Docstring
 | 
						|
Returns the number of nodes contained in the geometry
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsPoint vertexAt( QgsVertexId id ) const = 0;
 | 
						|
%Docstring
 | 
						|
Returns the point corresponding to a specified vertex id
 | 
						|
%End
 | 
						|
 | 
						|
    virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/,
 | 
						|
                                   QgsVertexId &vertexAfter /Out/,
 | 
						|
                                   int *leftOf /Out/ = 0, double epsilon = 4 * DBL_EPSILON ) const = 0;
 | 
						|
%Docstring
 | 
						|
Searches for the closest segment of the geometry to a given point.
 | 
						|
 | 
						|
:param pt: specifies the point to find closest segment to
 | 
						|
:param epsilon: epsilon for segment snapping
 | 
						|
 | 
						|
:return: - squared distance to closest segment or negative value on error
 | 
						|
         - segmentPt: the closest point within the geometry
 | 
						|
         - vertexAfter: 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)
 | 
						|
%End
 | 
						|
 | 
						|
 | 
						|
    virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) = 0;
 | 
						|
%Docstring
 | 
						|
Inserts a vertex into the geometry
 | 
						|
 | 
						|
:param position: vertex id for position of inserted vertex
 | 
						|
:param vertex: vertex to insert
 | 
						|
 | 
						|
:return: ``True`` if insert was successful
 | 
						|
 | 
						|
.. seealso:: :py:func:`moveVertex`
 | 
						|
 | 
						|
.. seealso:: :py:func:`deleteVertex`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) = 0;
 | 
						|
%Docstring
 | 
						|
Moves a vertex within the geometry
 | 
						|
 | 
						|
:param position: vertex id for vertex to move
 | 
						|
:param newPos: new position of vertex
 | 
						|
 | 
						|
:return: ``True`` if move was successful
 | 
						|
 | 
						|
.. seealso:: :py:func:`insertVertex`
 | 
						|
 | 
						|
.. seealso:: :py:func:`deleteVertex`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool deleteVertex( QgsVertexId position ) = 0;
 | 
						|
%Docstring
 | 
						|
Deletes a vertex within the geometry
 | 
						|
 | 
						|
:param position: vertex id for vertex to delete
 | 
						|
 | 
						|
:return: ``True`` if delete was successful
 | 
						|
 | 
						|
.. seealso:: :py:func:`insertVertex`
 | 
						|
 | 
						|
.. seealso:: :py:func:`moveVertex`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual double length() const;
 | 
						|
%Docstring
 | 
						|
Returns the planar, 2-dimensional length of the geometry.
 | 
						|
 | 
						|
.. warning::
 | 
						|
 | 
						|
   QgsAbstractGeometry objects are inherently Cartesian/planar geometries, and the length
 | 
						|
   returned by this method is calculated using strictly Cartesian mathematics. In contrast,
 | 
						|
   the :py:class:`QgsDistanceArea` class exposes methods for calculating the lengths of geometries using
 | 
						|
   geodesic calculations which account for the curvature of the Earth (or any other
 | 
						|
   celestial body).
 | 
						|
 | 
						|
.. seealso:: :py:func:`area`
 | 
						|
 | 
						|
.. seealso:: :py:func:`perimeter`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual double perimeter() const;
 | 
						|
%Docstring
 | 
						|
Returns the planar, 2-dimensional perimeter of the geometry.
 | 
						|
 | 
						|
.. warning::
 | 
						|
 | 
						|
   QgsAbstractGeometry objects are inherently Cartesian/planar geometries, and the perimeter
 | 
						|
   returned by this method is calculated using strictly Cartesian mathematics. In contrast,
 | 
						|
   the :py:class:`QgsDistanceArea` class exposes methods for calculating the perimeters of geometries using
 | 
						|
   geodesic calculations which account for the curvature of the Earth (or any other
 | 
						|
   celestial body).
 | 
						|
 | 
						|
.. seealso:: :py:func:`area`
 | 
						|
 | 
						|
.. seealso:: :py:func:`length`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual double area() const;
 | 
						|
%Docstring
 | 
						|
Returns the planar, 2-dimensional area of the geometry.
 | 
						|
 | 
						|
.. warning::
 | 
						|
 | 
						|
   QgsAbstractGeometry objects are inherently Cartesian/planar geometries, and the area
 | 
						|
   returned by this method is calculated using strictly Cartesian mathematics. In contrast,
 | 
						|
   the :py:class:`QgsDistanceArea` class exposes methods for calculating the areas of geometries using
 | 
						|
   geodesic calculations which account for the curvature of the Earth (or any other
 | 
						|
   celestial body).
 | 
						|
 | 
						|
.. seealso:: :py:func:`length`
 | 
						|
 | 
						|
.. seealso:: :py:func:`perimeter`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual double segmentLength( QgsVertexId startVertex ) const = 0;
 | 
						|
%Docstring
 | 
						|
Returns the length of the segment of the geometry which begins at ``startVertex``.
 | 
						|
 | 
						|
.. warning::
 | 
						|
 | 
						|
   QgsAbstractGeometry objects are inherently Cartesian/planar geometries, and the lengths
 | 
						|
   returned by this method are calculated using strictly Cartesian mathematics.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsPoint centroid() const;
 | 
						|
%Docstring
 | 
						|
Returns the centroid of the geometry
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool isEmpty() const;
 | 
						|
%Docstring
 | 
						|
Returns ``True`` if the geometry is empty
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool hasCurvedSegments() const;
 | 
						|
%Docstring
 | 
						|
Returns ``True`` if the geometry contains curved segments
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool boundingBoxIntersects( const QgsRectangle &rectangle ) const /HoldGIL/;
 | 
						|
%Docstring
 | 
						|
Returns ``True`` if the bounding box of this geometry intersects with a ``rectangle``.
 | 
						|
 | 
						|
Since this test only considers the bounding box of the geometry, is is very fast to
 | 
						|
calculate and handles invalid geometries.
 | 
						|
 | 
						|
.. versionadded:: 3.20
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool boundingBoxIntersects( const QgsBox3D &box3d ) const /HoldGIL/;
 | 
						|
%Docstring
 | 
						|
Returns ``True`` if the bounding box of this geometry intersects with a ``box3d``.
 | 
						|
 | 
						|
Since this test only considers the bounding box of the geometry, is is very fast to
 | 
						|
calculate and handles invalid geometries.
 | 
						|
 | 
						|
.. versionadded:: 3.34
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsAbstractGeometry *segmentize( double tolerance = M_PI / 180., SegmentationToleranceType toleranceType = MaximumAngle ) const /Factory/;
 | 
						|
%Docstring
 | 
						|
Returns a version of the geometry without curves. Caller takes ownership of
 | 
						|
the returned geometry.
 | 
						|
 | 
						|
:param tolerance: segmentation tolerance
 | 
						|
:param toleranceType: maximum segmentation angle or maximum difference between approximation and curve
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsAbstractGeometry *toCurveType() const = 0 /Factory/;
 | 
						|
%Docstring
 | 
						|
Returns the geometry converted to the more generic curve type.
 | 
						|
E.g. :py:class:`QgsLineString` -> :py:class:`QgsCompoundCurve`, :py:class:`QgsPolygon` -> :py:class:`QgsCurvePolygon`,
 | 
						|
:py:class:`QgsMultiLineString` -> :py:class:`QgsMultiCurve`, :py:class:`QgsMultiPolygon` -> :py:class:`QgsMultiSurface`
 | 
						|
 | 
						|
:return: the converted geometry. Caller takes ownership
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsAbstractGeometry *snappedToGrid( double hSpacing, double vSpacing, double dSpacing = 0, double mSpacing = 0, bool removeRedundantPoints = false ) const = 0 /Factory/;
 | 
						|
%Docstring
 | 
						|
Makes a new geometry with all the points or vertices snapped to the closest point of the grid.
 | 
						|
Ownership is transferred to the caller.
 | 
						|
 | 
						|
If the gridified geometry could not be calculated ``None`` 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:
 | 
						|
 | 
						|
.. code-block:: python
 | 
						|
 | 
						|
       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).
 | 
						|
 | 
						|
:param hSpacing: Horizontal spacing of the grid (x axis). 0 to disable.
 | 
						|
:param vSpacing: Vertical spacing of the grid (y axis). 0 to disable.
 | 
						|
:param dSpacing: Depth spacing of the grid (z axis). 0 (default) to disable.
 | 
						|
:param mSpacing: Custom dimension spacing of the grid (m axis). 0 (default) to disable.
 | 
						|
:param removeRedundantPoints: if ``True``, then points which are redundant (e.g. they represent mid points on a straight line segment) will be skipped (since QGIS 3.38)
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsAbstractGeometry *simplifyByDistance( double tolerance ) const = 0 /Factory/;
 | 
						|
%Docstring
 | 
						|
Simplifies the geometry by applying the Douglas Peucker simplification by distance
 | 
						|
algorithm.
 | 
						|
 | 
						|
The caller takes ownership of the returned geometry. Curved geometries will be segmentized prior to simplification.
 | 
						|
 | 
						|
If a simplified geometry cannot be calculated ``None`` will be returned.
 | 
						|
 | 
						|
The returned geometry may be invalid and contain self-intersecting rings.
 | 
						|
 | 
						|
.. versionadded:: 3.38
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool removeDuplicateNodes( double epsilon = 4 * DBL_EPSILON, bool useZValues = false ) = 0;
 | 
						|
%Docstring
 | 
						|
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.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual double vertexAngle( QgsVertexId vertex ) const = 0;
 | 
						|
%Docstring
 | 
						|
Returns approximate angle at a vertex. 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.
 | 
						|
 | 
						|
:param vertex: the vertex id
 | 
						|
 | 
						|
:return: rotation in radians, clockwise from north
 | 
						|
%End
 | 
						|
 | 
						|
    virtual int vertexCount( int part = 0, int ring = 0 ) const = 0;
 | 
						|
%Docstring
 | 
						|
Returns the number of vertices of which this geometry is built.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual int ringCount( int part = 0 ) const = 0;
 | 
						|
%Docstring
 | 
						|
Returns the number of rings of which this geometry is built.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual int partCount() const = 0;
 | 
						|
%Docstring
 | 
						|
Returns count of parts contained in the geometry.
 | 
						|
 | 
						|
.. seealso:: :py:func:`vertexCount`
 | 
						|
 | 
						|
.. seealso:: :py:func:`ringCount`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool addZValue( double zValue = 0 ) = 0;
 | 
						|
%Docstring
 | 
						|
Adds a z-dimension to the geometry, initialized to a preset value.
 | 
						|
 | 
						|
:param zValue: initial z-value for all nodes
 | 
						|
 | 
						|
:return: ``True`` on success
 | 
						|
 | 
						|
.. seealso:: :py:func:`dropZValue`
 | 
						|
 | 
						|
.. seealso:: :py:func:`addMValue`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool addMValue( double mValue = 0 ) = 0;
 | 
						|
%Docstring
 | 
						|
Adds a measure to the geometry, initialized to a preset value.
 | 
						|
 | 
						|
:param mValue: initial m-value for all nodes
 | 
						|
 | 
						|
:return: ``True`` on success
 | 
						|
 | 
						|
.. seealso:: :py:func:`dropMValue`
 | 
						|
 | 
						|
.. seealso:: :py:func:`addZValue`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool dropZValue() = 0;
 | 
						|
%Docstring
 | 
						|
Drops any z-dimensions which exist in the geometry.
 | 
						|
 | 
						|
:return: ``True`` if Z values were present and have been removed
 | 
						|
 | 
						|
.. seealso:: :py:func:`addZValue`
 | 
						|
 | 
						|
.. seealso:: :py:func:`dropMValue`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool dropMValue() = 0;
 | 
						|
%Docstring
 | 
						|
Drops any measure values which exist in the geometry.
 | 
						|
 | 
						|
:return: ``True`` if m-values were present and have been removed
 | 
						|
 | 
						|
.. seealso:: :py:func:`addMValue`
 | 
						|
 | 
						|
.. seealso:: :py:func:`dropZValue`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void swapXy() = 0;
 | 
						|
%Docstring
 | 
						|
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.
 | 
						|
 | 
						|
.. versionadded:: 3.2
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool convertTo( Qgis::WkbType type );
 | 
						|
%Docstring
 | 
						|
Converts the geometry to a specified type.
 | 
						|
 | 
						|
:return: ``True`` if conversion was successful
 | 
						|
%End
 | 
						|
 | 
						|
    virtual const QgsAbstractGeometry *simplifiedTypeRef() const /HoldGIL/;
 | 
						|
%Docstring
 | 
						|
Returns a reference to the simplest lossless representation of this geometry,
 | 
						|
e.g. if the geometry is a multipart geometry type with a single member geometry,
 | 
						|
a reference to that part will be returned.
 | 
						|
 | 
						|
This method employs the following logic:
 | 
						|
 | 
						|
- For multipart geometries containing a single part only a direct reference to that part will be returned.
 | 
						|
- For compound curve geometries containing a single curve only a direct reference to that curve will be returned.
 | 
						|
 | 
						|
This method returns a reference only, and does not involve any geometry cloning.
 | 
						|
 | 
						|
.. note::
 | 
						|
 | 
						|
   Ownership of the returned geometry is NOT transferred, and remains with the original
 | 
						|
   geometry object. Callers must take care to ensure that the original geometry object
 | 
						|
   exists for the lifespan of the returned object.
 | 
						|
 | 
						|
.. versionadded:: 3.20
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool isValid( QString &error /Out/, Qgis::GeometryValidityFlags flags = Qgis::GeometryValidityFlags() ) const = 0;
 | 
						|
%Docstring
 | 
						|
Checks validity of the geometry, and returns ``True`` if the geometry is valid.
 | 
						|
 | 
						|
:param flags: indicates optional flags which control the type of validity checking performed
 | 
						|
              (corresponding to :py:class:`Qgis`.GeometryValidityFlags).
 | 
						|
 | 
						|
:return: - ``True`` if geometry is valid
 | 
						|
         - error: the validity error message
 | 
						|
 | 
						|
.. versionadded:: 3.8
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool transform( QgsAbstractGeometryTransformer *transformer, QgsFeedback *feedback = 0 ) = 0;
 | 
						|
%Docstring
 | 
						|
Transforms the vertices from the geometry in place, using the specified geometry ``transformer``
 | 
						|
object.
 | 
						|
 | 
						|
Depending on the ``transformer`` used, this may result in an invalid geometry.
 | 
						|
 | 
						|
The optional ``feedback`` argument can be used to cancel the transformation before it completes.
 | 
						|
If this is done, the geometry will be left in a semi-transformed state.
 | 
						|
 | 
						|
:return: ``True`` if the geometry was successfully transformed.
 | 
						|
 | 
						|
.. versionadded:: 3.18
 | 
						|
%End
 | 
						|
 | 
						|
 | 
						|
    QgsGeometryPartIterator parts();
 | 
						|
%Docstring
 | 
						|
Returns Java-style iterator for traversal of parts of the geometry. This iterator
 | 
						|
can safely be used to modify parts of the geometry.
 | 
						|
 | 
						|
Example
 | 
						|
 | 
						|
.. code-block:: python
 | 
						|
 | 
						|
       # 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())
 | 
						|
 | 
						|
.. seealso:: :py:func:`vertices`
 | 
						|
 | 
						|
.. versionadded:: 3.6
 | 
						|
%End
 | 
						|
 | 
						|
 | 
						|
    QgsVertexIterator vertices() const;
 | 
						|
%Docstring
 | 
						|
Returns a read-only, Java-style iterator for traversal of vertices of all the geometry, including all geometry parts and rings.
 | 
						|
 | 
						|
.. warning::
 | 
						|
 | 
						|
   The iterator returns a copy of individual vertices, and accordingly geometries cannot be
 | 
						|
   modified using the iterator. See :py:func:`~QgsAbstractGeometry.transformVertices` for a safe method to modify vertices "in-place".
 | 
						|
 | 
						|
Example
 | 
						|
 | 
						|
.. code-block:: python
 | 
						|
 | 
						|
       # 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())
 | 
						|
 | 
						|
.. seealso:: :py:func:`parts`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsAbstractGeometry *createEmptyWithSameType() const = 0 /Factory/;
 | 
						|
%Docstring
 | 
						|
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.
 | 
						|
 | 
						|
.. seealso:: :py:func:`clone`
 | 
						|
%End
 | 
						|
 | 
						|
  protected:
 | 
						|
 | 
						|
    int sortIndex() const;
 | 
						|
%Docstring
 | 
						|
Returns the sort index for the geometry, used in the :py:func:`~QgsAbstractGeometry.compareTo` method to compare
 | 
						|
geometries of different types.
 | 
						|
 | 
						|
.. versionadded:: 3.20
 | 
						|
%End
 | 
						|
 | 
						|
    virtual int compareToSameClass( const QgsAbstractGeometry *other ) const = 0;
 | 
						|
%Docstring
 | 
						|
Compares to an ``other`` geometry of the same class, and returns a integer
 | 
						|
for sorting of the two geometries.
 | 
						|
 | 
						|
.. note::
 | 
						|
 | 
						|
   The actual logic for the sorting is an internal detail only and is subject to change
 | 
						|
   between QGIS versions. The result should only be used for direct comparison of geometries
 | 
						|
   and not stored for later use.
 | 
						|
 | 
						|
.. versionadded:: 3.20
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool hasChildGeometries() const;
 | 
						|
%Docstring
 | 
						|
Returns whether the geometry has any child geometries (``False`` for point / curve, ``True`` otherwise)
 | 
						|
 | 
						|
.. note::
 | 
						|
 | 
						|
   used for vertex_iterator implementation
 | 
						|
%End
 | 
						|
 | 
						|
    virtual int childCount() const;
 | 
						|
%Docstring
 | 
						|
Returns number of child geometries (for geometries with child geometries) or child points (for geometries without child geometries - i.e. curve / point)
 | 
						|
 | 
						|
.. note::
 | 
						|
 | 
						|
   used for vertex_iterator implementation
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsAbstractGeometry *childGeometry( int index ) const;
 | 
						|
%Docstring
 | 
						|
Returns pointer to child geometry (for geometries with child geometries - i.e. geom. collection / polygon)
 | 
						|
 | 
						|
.. note::
 | 
						|
 | 
						|
   used for vertex_iterator implementation
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsPoint childPoint( int index ) const;
 | 
						|
%Docstring
 | 
						|
Returns point at index (for geometries without child geometries - i.e. curve / point)
 | 
						|
 | 
						|
.. note::
 | 
						|
 | 
						|
   used for vertex_iterator implementation
 | 
						|
%End
 | 
						|
 | 
						|
  protected:
 | 
						|
 | 
						|
    void setZMTypeFromSubGeometry( const QgsAbstractGeometry *subggeom, Qgis::WkbType baseGeomType );
 | 
						|
%Docstring
 | 
						|
Updates the geometry type based on whether sub geometries contain z or m values.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsRectangle calculateBoundingBox() const;
 | 
						|
%Docstring
 | 
						|
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.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsBox3D calculateBoundingBox3D() const;
 | 
						|
%Docstring
 | 
						|
Calculates the minimal 3D bounding box for the geometry.
 | 
						|
 | 
						|
.. seealso:: :py:func:`calculateBoundingBox`
 | 
						|
 | 
						|
.. versionadded:: 3.34
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void clearCache() const;
 | 
						|
%Docstring
 | 
						|
Clears any cached parameters associated with the geometry, e.g., bounding boxes
 | 
						|
%End
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
class QgsVertexIterator
 | 
						|
{
 | 
						|
%Docstring(signature="appended")
 | 
						|
Java-style iterator for traversal of vertices of a geometry
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgsabstractgeometry.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    QgsVertexIterator();
 | 
						|
 | 
						|
    QgsVertexIterator( const QgsAbstractGeometry *geometry );
 | 
						|
%Docstring
 | 
						|
Constructs iterator for the given geometry
 | 
						|
%End
 | 
						|
 | 
						|
    bool hasNext() const;
 | 
						|
%Docstring
 | 
						|
Find out whether there are more vertices
 | 
						|
%End
 | 
						|
 | 
						|
    QgsPoint next();
 | 
						|
%Docstring
 | 
						|
Returns next vertex of the geometry (undefined behavior if :py:func:`~QgsVertexIterator.hasNext` returns ``False`` before calling :py:func:`~QgsVertexIterator.next`)
 | 
						|
%End
 | 
						|
 | 
						|
    QgsVertexIterator *__iter__();
 | 
						|
%MethodCode
 | 
						|
    sipRes = sipCpp;
 | 
						|
%End
 | 
						|
 | 
						|
    SIP_PYOBJECT __next__() /TypeHint="QgsPoint"/;
 | 
						|
%MethodCode
 | 
						|
    if ( sipCpp->hasNext() )
 | 
						|
      sipRes = sipConvertFromType( new QgsPoint( sipCpp->next() ), sipType_QgsPoint, Py_None );
 | 
						|
    else
 | 
						|
      PyErr_SetString( PyExc_StopIteration, "" );
 | 
						|
%End
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
class QgsGeometryPartIterator
 | 
						|
{
 | 
						|
%Docstring(signature="appended")
 | 
						|
Java-style iterator for traversal of parts of a geometry
 | 
						|
 | 
						|
.. versionadded:: 3.6
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgsabstractgeometry.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    QgsGeometryPartIterator();
 | 
						|
 | 
						|
    QgsGeometryPartIterator( QgsAbstractGeometry *geometry );
 | 
						|
%Docstring
 | 
						|
Constructs iterator for the given geometry
 | 
						|
%End
 | 
						|
 | 
						|
    bool hasNext() const /HoldGIL/;
 | 
						|
%Docstring
 | 
						|
Find out whether there are more parts
 | 
						|
%End
 | 
						|
 | 
						|
    QgsAbstractGeometry *next();
 | 
						|
%Docstring
 | 
						|
Returns next part of the geometry (undefined behavior if :py:func:`~QgsGeometryPartIterator.hasNext` returns ``False`` before calling :py:func:`~QgsGeometryPartIterator.next`)
 | 
						|
%End
 | 
						|
 | 
						|
    QgsGeometryPartIterator *__iter__();
 | 
						|
%MethodCode
 | 
						|
    sipRes = sipCpp;
 | 
						|
%End
 | 
						|
 | 
						|
    SIP_PYOBJECT __next__() /TypeHint="QgsAbstractGeometry"/;
 | 
						|
%MethodCode
 | 
						|
    if ( sipCpp->hasNext() )
 | 
						|
      sipRes = sipConvertFromType( sipCpp->next(), sipType_QgsAbstractGeometry, NULL );
 | 
						|
    else
 | 
						|
      PyErr_SetString( PyExc_StopIteration, "" );
 | 
						|
%End
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
class QgsGeometryConstPartIterator
 | 
						|
{
 | 
						|
%Docstring(signature="appended")
 | 
						|
Java-style iterator for const traversal of parts of a geometry
 | 
						|
 | 
						|
.. versionadded:: 3.6
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgsabstractgeometry.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    QgsGeometryConstPartIterator();
 | 
						|
 | 
						|
    QgsGeometryConstPartIterator( const QgsAbstractGeometry *geometry );
 | 
						|
%Docstring
 | 
						|
Constructs iterator for the given geometry
 | 
						|
%End
 | 
						|
 | 
						|
    bool hasNext() const /HoldGIL/;
 | 
						|
%Docstring
 | 
						|
Find out whether there are more parts
 | 
						|
%End
 | 
						|
 | 
						|
    const QgsAbstractGeometry *next();
 | 
						|
%Docstring
 | 
						|
Returns next part of the geometry (undefined behavior if :py:func:`~QgsGeometryConstPartIterator.hasNext` returns ``False`` before calling :py:func:`~QgsGeometryConstPartIterator.next`)
 | 
						|
%End
 | 
						|
 | 
						|
    QgsGeometryConstPartIterator *__iter__();
 | 
						|
%MethodCode
 | 
						|
    sipRes = sipCpp;
 | 
						|
%End
 | 
						|
 | 
						|
    SIP_PYOBJECT __next__() /TypeHint="QgsAbstractGeometry"/;
 | 
						|
%MethodCode
 | 
						|
    if ( sipCpp->hasNext() )
 | 
						|
      sipRes = sipConvertFromType( const_cast< QgsAbstractGeometry * >( sipCpp->next() ), sipType_QgsAbstractGeometry, NULL );
 | 
						|
    else
 | 
						|
      PyErr_SetString( PyExc_StopIteration, "" );
 | 
						|
%End
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
QFlags<QgsAbstractGeometry::WkbFlag> operator|(QgsAbstractGeometry::WkbFlag f1, QFlags<QgsAbstractGeometry::WkbFlag> f2);
 | 
						|
 | 
						|
 | 
						|
/************************************************************************
 | 
						|
 * This file has been generated automatically from                      *
 | 
						|
 *                                                                      *
 | 
						|
 * src/core/geometry/qgsabstractgeometry.h                              *
 | 
						|
 *                                                                      *
 | 
						|
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 | 
						|
 ************************************************************************/
 |