mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -04:00
- don't create a whole set of empty possible geometries, just use wkb types directly - don't expose to python -- this method is an internal detail. No-one has been relying on it, as calling it would have immediately crashed due to the missing SIP_TRANSFER annotation.
399 lines
12 KiB
Plaintext
399 lines
12 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/geometry/qgsgeometrycollection.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QgsGeometryCollection: QgsAbstractGeometry
|
|
{
|
|
%Docstring(signature="appended")
|
|
Geometry collection.
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsgeometrycollection.h"
|
|
%End
|
|
public:
|
|
|
|
|
|
QgsGeometryCollection() /HoldGIL/;
|
|
%Docstring
|
|
Constructor for an empty geometry collection.
|
|
%End
|
|
|
|
QgsGeometryCollection( const QgsGeometryCollection &c );
|
|
~QgsGeometryCollection();
|
|
|
|
virtual bool operator==( const QgsAbstractGeometry &other ) const;
|
|
|
|
virtual bool operator!=( const QgsAbstractGeometry &other ) const;
|
|
|
|
public:
|
|
virtual bool fuzzyEqual( const QgsAbstractGeometry &other, double epsilon = 1e-8 ) const /HoldGIL/;
|
|
virtual bool fuzzyDistanceEqual( const QgsAbstractGeometry &other, double epsilon = 1e-8 ) const /HoldGIL/;
|
|
|
|
virtual QgsGeometryCollection *clone() const /Factory/;
|
|
|
|
|
|
int numGeometries() const /HoldGIL/;
|
|
%Docstring
|
|
Returns the number of geometries within the collection.
|
|
%End
|
|
|
|
|
|
int __len__() const;
|
|
%Docstring
|
|
Returns the number of geometries within the collection.
|
|
%End
|
|
%MethodCode
|
|
sipRes = sipCpp->numGeometries();
|
|
%End
|
|
|
|
//! Ensures that bool(obj) returns ``True`` (otherwise __len__() would be used)
|
|
int __bool__() const;
|
|
%MethodCode
|
|
sipRes = true;
|
|
%End
|
|
|
|
|
|
|
|
|
|
SIP_PYOBJECT geometryN( int n ) /TypeHint="QgsAbstractGeometry"/;
|
|
%Docstring
|
|
Returns a geometry from within the collection.
|
|
|
|
:param n: index of geometry to return.
|
|
|
|
:raises IndexError: if no geometry with the specified index exists.
|
|
%End
|
|
%MethodCode
|
|
if ( a0 < 0 || a0 >= sipCpp->numGeometries() )
|
|
{
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
sipIsErr = 1;
|
|
}
|
|
else
|
|
{
|
|
return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
|
|
}
|
|
%End
|
|
|
|
|
|
virtual bool isEmpty() const /HoldGIL/;
|
|
|
|
virtual int dimension() const /HoldGIL/;
|
|
|
|
virtual QString geometryType() const /HoldGIL/;
|
|
|
|
virtual void clear();
|
|
|
|
virtual QgsGeometryCollection *snappedToGrid( double hSpacing, double vSpacing, double dSpacing = 0, double mSpacing = 0, bool removeRedundantPoints = false ) const /Factory/;
|
|
|
|
virtual bool removeDuplicateNodes( double epsilon = 4 * DBL_EPSILON, bool useZValues = false );
|
|
|
|
virtual QgsAbstractGeometry *boundary() const /Factory/;
|
|
|
|
virtual void adjacentVertices( QgsVertexId vertex, QgsVertexId &previousVertex /Out/, QgsVertexId &nextVertex /Out/ ) const;
|
|
|
|
virtual int vertexNumberFromVertexId( QgsVertexId id ) const;
|
|
|
|
virtual bool boundingBoxIntersects( const QgsBox3D &box3d ) const /HoldGIL/;
|
|
|
|
|
|
void reserve( int size ) /HoldGIL/;
|
|
%Docstring
|
|
Attempts to allocate memory for at least ``size`` geometries.
|
|
|
|
If the number of geometries is known in advance, calling this function
|
|
prior to adding geometries will prevent reallocations and memory
|
|
fragmentation.
|
|
|
|
.. versionadded:: 3.10
|
|
%End
|
|
|
|
virtual bool addGeometry( QgsAbstractGeometry *g /Transfer/ );
|
|
%Docstring
|
|
Adds a geometry and takes ownership. Returns ``True`` in case of
|
|
success.
|
|
%End
|
|
|
|
virtual bool addGeometries( const QVector< QgsAbstractGeometry * > &geometries /Transfer/ );
|
|
%Docstring
|
|
Adds a list of geometries to the collection, transferring ownership to
|
|
the collection.
|
|
|
|
Returns ``True`` in case of success.
|
|
|
|
.. versionadded:: 3.38
|
|
%End
|
|
|
|
virtual bool insertGeometry( QgsAbstractGeometry *g /Transfer/, int index );
|
|
%Docstring
|
|
Inserts a geometry before a specified index and takes ownership. Returns
|
|
``True`` in case of success.
|
|
|
|
:param g: geometry to insert. Ownership is transferred to the
|
|
collection.
|
|
:param index: position to insert geometry before
|
|
%End
|
|
|
|
|
|
virtual bool removeGeometry( int nr );
|
|
%Docstring
|
|
Removes a geometry from the collection by index.
|
|
|
|
:return: ``True`` if removal was successful.
|
|
|
|
:raises IndexError: if no geometry with the specified index exists.
|
|
%End
|
|
%MethodCode
|
|
const int count = sipCpp->numGeometries();
|
|
if ( a0 < 0 || a0 >= count )
|
|
{
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
sipIsErr = 1;
|
|
}
|
|
else
|
|
{
|
|
return PyBool_FromLong( sipCpp->removeGeometry( a0 ) );
|
|
}
|
|
%End
|
|
|
|
QVector< QgsAbstractGeometry * > takeGeometries() /Transfer/;
|
|
%Docstring
|
|
Removes all geometries from the collection, returning them and their
|
|
ownership to the caller.
|
|
|
|
.. versionadded:: 3.38
|
|
%End
|
|
|
|
void normalize() final /HoldGIL/;
|
|
virtual void transform( const QgsCoordinateTransform &ct, Qgis::TransformDirection d = Qgis::TransformDirection::Forward, bool transformZ = false ) throw( QgsCsException );
|
|
|
|
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
|
|
|
|
|
|
virtual void draw( QPainter &p ) const;
|
|
|
|
virtual QPainterPath asQPainterPath() const;
|
|
|
|
|
|
virtual bool fromWkb( QgsConstWkbPtr &wkb );
|
|
|
|
virtual bool fromWkt( const QString &wkt );
|
|
|
|
|
|
virtual int wkbSize( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const;
|
|
|
|
virtual QByteArray asWkb( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const;
|
|
|
|
virtual QString asWkt( int precision = 17 ) const;
|
|
|
|
virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const;
|
|
|
|
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const;
|
|
|
|
virtual QString asKml( int precision = 17 ) const;
|
|
|
|
|
|
virtual QgsBox3D boundingBox3D() const;
|
|
|
|
|
|
virtual QgsCoordinateSequence coordinateSequence() const;
|
|
|
|
virtual int nCoordinates() const;
|
|
|
|
|
|
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, int *leftOf /Out/ = 0, double epsilon = 4 * DBL_EPSILON ) const;
|
|
|
|
virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex /Out/ ) const;
|
|
|
|
|
|
virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex );
|
|
|
|
virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos );
|
|
|
|
virtual bool deleteVertex( QgsVertexId position );
|
|
|
|
|
|
virtual double length() const /HoldGIL/;
|
|
|
|
virtual double area() const /HoldGIL/;
|
|
|
|
virtual double perimeter() const /HoldGIL/;
|
|
|
|
|
|
virtual bool hasCurvedSegments() const /HoldGIL/;
|
|
|
|
|
|
virtual QgsAbstractGeometry *segmentize( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const /Factory/;
|
|
|
|
%Docstring
|
|
Returns a geometry without curves. Caller takes ownership
|
|
|
|
:param tolerance: segmentation tolerance
|
|
:param toleranceType: maximum segmentation angle or maximum difference
|
|
between approximation and curve
|
|
%End
|
|
|
|
virtual double vertexAngle( QgsVertexId vertex ) const;
|
|
|
|
virtual double segmentLength( QgsVertexId startVertex ) const;
|
|
|
|
virtual int vertexCount( int part = 0, int ring = 0 ) const;
|
|
|
|
virtual int ringCount( int part = 0 ) const;
|
|
|
|
virtual int partCount() const;
|
|
|
|
virtual QgsPoint vertexAt( QgsVertexId id ) const;
|
|
|
|
virtual bool isValid( QString &error /Out/, Qgis::GeometryValidityFlags flags = Qgis::GeometryValidityFlags() ) const;
|
|
|
|
|
|
virtual bool addZValue( double zValue = 0 );
|
|
|
|
virtual bool addMValue( double mValue = 0 );
|
|
|
|
virtual bool dropZValue();
|
|
|
|
virtual bool dropMValue();
|
|
|
|
virtual void swapXy();
|
|
|
|
virtual QgsGeometryCollection *toCurveType() const /Factory/;
|
|
|
|
virtual const QgsAbstractGeometry *simplifiedTypeRef() const /HoldGIL/;
|
|
|
|
virtual QgsGeometryCollection *simplifyByDistance( double tolerance ) const /Factory/;
|
|
|
|
virtual bool transform( QgsAbstractGeometryTransformer *transformer, QgsFeedback *feedback = 0 );
|
|
|
|
|
|
|
|
|
|
|
|
SIP_PYOBJECT __getitem__( int index ) /TypeHint="QgsAbstractGeometry"/;
|
|
%Docstring
|
|
Returns the geometry at the specified ``index``.
|
|
|
|
Indexes can be less than 0, in which case they correspond to geometries
|
|
from the end of the collect. E.g. an index of -1 corresponds to the last
|
|
geometry in the collection.
|
|
|
|
:raises IndexError: if no geometry with the specified ``index`` exists.
|
|
|
|
.. versionadded:: 3.6
|
|
%End
|
|
%MethodCode
|
|
const int count = sipCpp->numGeometries();
|
|
if ( a0 < -count || a0 >= count )
|
|
{
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
sipIsErr = 1;
|
|
}
|
|
else if ( a0 >= 0 )
|
|
{
|
|
return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
|
|
}
|
|
else
|
|
{
|
|
return sipConvertFromType( sipCpp->geometryN( count + a0 ), sipType_QgsAbstractGeometry, NULL );
|
|
}
|
|
%End
|
|
|
|
void __delitem__( int index );
|
|
%Docstring
|
|
Deletes the geometry at the specified ``index``.
|
|
|
|
Indexes can be less than 0, in which case they correspond to geometries
|
|
from the end of the collection. E.g. an index of -1 corresponds to the
|
|
last geometry in the collection.
|
|
|
|
:raises IndexError: if no geometry at the ``index`` exists
|
|
|
|
.. versionadded:: 3.6
|
|
%End
|
|
%MethodCode
|
|
const int count = sipCpp->numGeometries();
|
|
if ( a0 >= 0 && a0 < count )
|
|
sipCpp->removeGeometry( a0 );
|
|
else if ( a0 < 0 && a0 >= -count )
|
|
sipCpp->removeGeometry( count + a0 );
|
|
else
|
|
{
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
sipIsErr = 1;
|
|
}
|
|
%End
|
|
|
|
SIP_PYOBJECT __iter__() /TypeHint="QgsGeometryPartIterator"/;
|
|
%Docstring
|
|
Iterates through all geometries in the collection.
|
|
|
|
.. versionadded:: 3.6
|
|
%End
|
|
%MethodCode
|
|
sipRes = sipConvertFromNewType( new QgsGeometryPartIterator( sipCpp ), sipType_QgsGeometryPartIterator, Py_None );
|
|
%End
|
|
|
|
QgsGeometryCollection *extractPartsByType( Qgis::WkbType type, bool useFlatType = true ) const /Factory/;
|
|
%Docstring
|
|
Returns a new QgsGeometryCollection subclass which consists of the parts
|
|
of this collection which match the specified WKB ``type``.
|
|
|
|
For instance, if ``type`` is :py:class:`Qgis`.WkbType.Polygon, then the
|
|
returned object will be a :py:class:`QgsMultiPolygon` object containing
|
|
just the polygons from this collection.
|
|
|
|
If ``useFlatType`` is ``True``, then the WKB types of component
|
|
geometries from this collection will be flattened prior to comparing
|
|
with ``type``. (I.e. the presence of Z / M dimensions will be ignored
|
|
when comparing against ``type``).
|
|
|
|
.. versionadded:: 3.36
|
|
%End
|
|
|
|
virtual QgsGeometryCollection *createEmptyWithSameType() const /Factory/;
|
|
|
|
|
|
protected:
|
|
virtual int childCount() const;
|
|
|
|
virtual QgsAbstractGeometry *childGeometry( int index ) const;
|
|
|
|
int compareToSameClass( const QgsAbstractGeometry *other ) const final;
|
|
|
|
protected:
|
|
|
|
virtual bool wktOmitChildType() const;
|
|
%Docstring
|
|
Returns whether child type names are omitted from Wkt representations of
|
|
the collection
|
|
%End
|
|
|
|
|
|
virtual QgsBox3D calculateBoundingBox3D() const;
|
|
|
|
virtual void clearCache() const;
|
|
|
|
|
|
};
|
|
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/geometry/qgsgeometrycollection.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|