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 );
106 if ( a0 < 0 || a0 >= sipCpp->numGeometries() )
108 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
113 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
123 void clear() override;
125 bool removeDuplicateNodes(
double epsilon = 4 * std::numeric_limits<
double>::epsilon(),
bool useZValues = false ) override;
128 int vertexNumberFromVertexId(
QgsVertexId id ) const override;
158 virtual bool removeGeometry(
int nr );
167 virtual bool removeGeometry(
int nr );
169 const int count = sipCpp->numGeometries();
170 if ( a0 < 0 || a0 >= count )
172 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
177 return PyBool_FromLong( sipCpp->removeGeometry( a0 ) );
184 void transform( const QTransform &t,
double zTranslate = 0.0,
double zScale = 1.0,
double mTranslate = 0.0,
double mScale = 1.0 ) override;
186 void draw( QPainter &p ) const override;
187 QPainterPath asQPainterPath() const override;
190 bool fromWkt( const QString &wkt ) override;
194 QString asWkt(
int precision = 17 ) const override;
198 QString asKml(
int precision = 17 ) const override;
203 int nCoordinates() const override;
211 bool deleteVertex(
QgsVertexId position ) override;
217 bool hasCurvedSegments() const override
SIP_HOLDGIL;
224 QgsAbstractGeometry *segmentize(
double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const override
SIP_FACTORY;
226 double vertexAngle(
QgsVertexId vertex ) const override;
227 double segmentLength(
QgsVertexId startVertex ) const override;
228 int vertexCount(
int part = 0,
int ring = 0 ) const override;
229 int ringCount(
int part = 0 ) const override;
230 int partCount() const override;
232 bool isValid( QString &error
SIP_OUT,
int flags = 0 ) const override;
234 bool addZValue(
double zValue = 0 ) override;
235 bool addMValue(
double mValue = 0 ) override;
236 bool dropZValue() override;
237 bool dropMValue() override;
238 void swapXy() override;
278 const int count = sipCpp->numGeometries();
279 if ( a0 < -count || a0 >= count )
281 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
286 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
290 return sipConvertFromType( sipCpp->geometryN( count + a0 ), sipType_QgsAbstractGeometry, NULL );
304 void __delitem__(
int index );
306 const int count = sipCpp->numGeometries();
307 if ( a0 >= 0 && a0 < count )
308 sipCpp->removeGeometry( a0 );
309 else if ( a0 < 0 && a0 >= -count )
310 sipCpp->removeGeometry( count + a0 );
313 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
325 sipRes = sipConvertFromNewType( new
QgsGeometryPartIterator( sipCpp ), sipType_QgsGeometryPartIterator, Py_None );
332 int childCount() const override;
343 virtual
bool wktOmitChildType() const;
348 bool fromCollectionWkt( const QString &wkt, const QVector<
QgsAbstractGeometry *> &subtypes, const QString &defaultChildWkbType = QString() );
351 void clearCache() const override;
356 mutable
bool mHasCachedValidity = false;
357 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 bool isEmpty() const
Returns true if the geometry is empty.
virtual void normalize()=0
Reorganizes the geometry into a normalized form (or "canonical" form).
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.