16 #ifndef QGSGEOMETRYCOLLECTION_H
17 #define QGSGEOMETRYCOLLECTION_H
22 #include "qgis_core.h"
59 return mGeometries.size();
69 sipRes = sipCpp->numGeometries();
87 return mGeometries.value( n );
105 if ( a0 < 0 || a0 >= sipCpp->numGeometries() )
107 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
112 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
122 void clear() override;
124 bool removeDuplicateNodes(
double epsilon = 4 * std::numeric_limits<
double>::epsilon(),
bool useZValues = false ) override;
127 int vertexNumberFromVertexId(
QgsVertexId id ) const override;
156 virtual bool removeGeometry(
int nr );
166 virtual bool removeGeometry(
int nr );
168 const int count = sipCpp->numGeometries();
169 if ( a0 < 0 || a0 >= count )
171 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
176 return PyBool_FromLong( sipCpp->removeGeometry( a0 ) );
182 void transform( const QTransform &t,
double zTranslate = 0.0,
double zScale = 1.0,
double mTranslate = 0.0,
double mScale = 1.0 ) override;
184 void draw( QPainter &p ) const override;
185 QPainterPath asQPainterPath() const override;
188 bool fromWkt( const QString &wkt ) override;
192 QString asWkt(
int precision = 17 ) const override;
196 QString asKml(
int precision = 17 ) const override;
201 int nCoordinates() const override;
209 bool deleteVertex(
QgsVertexId position ) override;
215 bool hasCurvedSegments() const override
SIP_HOLDGIL;
222 QgsAbstractGeometry *segmentize(
double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const override
SIP_FACTORY;
224 double vertexAngle(
QgsVertexId vertex ) const override;
225 double segmentLength(
QgsVertexId startVertex ) const override;
226 int vertexCount(
int part = 0,
int ring = 0 ) const override;
227 int ringCount(
int part = 0 ) const override;
228 int partCount() const override;
230 bool isValid( QString &error
SIP_OUT,
int flags = 0 ) const override;
232 bool addZValue(
double zValue = 0 ) override;
233 bool addMValue(
double mValue = 0 ) override;
234 bool dropZValue() override;
235 bool dropMValue() override;
236 void swapXy() override;
273 const int count = sipCpp->numGeometries();
274 if ( a0 < -count || a0 >= count )
276 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
281 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
285 return sipConvertFromType( sipCpp->geometryN( count + a0 ), sipType_QgsAbstractGeometry, NULL );
297 void __delitem__(
int index );
299 const int count = sipCpp->numGeometries();
300 if ( a0 >= 0 && a0 < count )
301 sipCpp->removeGeometry( a0 );
302 else if ( a0 < 0 && a0 >= -count )
303 sipCpp->removeGeometry( count + a0 );
306 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
318 sipRes = sipConvertFromNewType( new
QgsGeometryPartIterator( sipCpp ), sipType_QgsGeometryPartIterator, Py_None );
325 int childCount() const override;
335 virtual
bool wktOmitChildType() const;
340 bool fromCollectionWkt( const QString &wkt, const QVector<
QgsAbstractGeometry *> &subtypes, const QString &defaultChildWkbType = QString() );
343 void clearCache() const override;
348 mutable
bool mHasCachedValidity = false;
349 mutable QString mValidityFailureReason;
Abstract base class for all geometries.
virtual void transformVertices(const std::function< QgsPoint(const QgsPoint &) > &transform)
Transforms the vertices from the geometry in place, applying the transform function to every vertex.
virtual QgsAbstractGeometry * createEmptyWithSameType() const =0
Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
virtual QgsAbstractGeometry * clone() const =0
Clones the geometry by performing a deep copy.
QgsAbstractGeometry & operator=(const QgsAbstractGeometry &geom)
virtual bool operator!=(const QgsAbstractGeometry &other) const =0
virtual void transform(const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d=QgsCoordinateTransform::ForwardTransform, bool transformZ=false) SIP_THROW(QgsCsException)=0
Transforms the geometry using a coordinate transform.
virtual bool isEmpty() const
Returns true if the geometry is empty.
virtual void filterVertices(const std::function< bool(const QgsPoint &) > &filter)
Filters the vertices from the geometry in place, removing any which do not return true for the filter...
QgsWkbTypes::Type wkbType() const SIP_HOLDGIL
Returns the WKB type of the geometry.
virtual bool operator==(const QgsAbstractGeometry &other) const =0
Custom exception class for Coordinate Reference System related exceptions.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
static const QgsGeometryCollection * cast(const QgsAbstractGeometry *geom)
Cast the geom to a QgsGeometryCollection.
int numGeometries() const SIP_HOLDGIL
Returns the number of geometries within the collection.
const QgsAbstractGeometry * geometryN(int n) const
Returns a const reference to a geometry from within the collection.
Java-style iterator for traversal of parts of a geometry.
Point geometry type, with support for z-dimension and m-values.
A rectangle specified with double values.
static bool isMultiType(Type type) SIP_HOLDGIL
Returns true if the WKB type is a multi type.
double ANALYSIS_EXPORT leftOf(const QgsPoint &thepoint, const QgsPoint *p1, const QgsPoint *p2)
Returns whether 'thepoint' is left or right of the line from 'p1' to 'p2'. Negative values mean left ...
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
#define SIP_TYPEHINT(type)
QVector< QgsRingSequence > QgsCoordinateSequence
double closestSegment(const QgsPolylineXY &pl, const QgsPointXY &pt, int &vertexAfter, double epsilon)
Utility class for identifying a unique vertex within a geometry.