16#ifndef QGSGEOMETRYCOLLECTION_H
17#define QGSGEOMETRYCOLLECTION_H
60 return mGeometries.size();
70 sipRes = sipCpp->numGeometries();
88 return mGeometries.value( n );
107 if ( a0 < 0 || a0 >= sipCpp->numGeometries() )
109 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
114 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
124 void clear() override;
126 bool removeDuplicateNodes(
double epsilon = 4 * std::numeric_limits<
double>::epsilon(),
bool useZValues = false ) override;
129 int vertexNumberFromVertexId(
QgsVertexId id ) const override;
159 virtual bool removeGeometry(
int nr );
168 virtual bool removeGeometry(
int nr );
170 const int count = sipCpp->numGeometries();
171 if ( a0 < 0 || a0 >= count )
173 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
178 return PyBool_FromLong( sipCpp->removeGeometry( a0 ) );
185 void transform( const QTransform &t,
double zTranslate = 0.0,
double zScale = 1.0,
double mTranslate = 0.0,
double mScale = 1.0 ) override;
187 void draw( QPainter &p ) const override;
188 QPainterPath asQPainterPath() const override;
191 bool fromWkt( const QString &wkt ) override;
195 QString asWkt(
int precision = 17 ) const override;
199 QString asKml(
int precision = 17 ) const override;
204 int nCoordinates() const override;
212 bool deleteVertex(
QgsVertexId position ) override;
218 bool hasCurvedSegments() const override
SIP_HOLDGIL;
225 QgsAbstractGeometry *segmentize(
double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const override
SIP_FACTORY;
227 double vertexAngle(
QgsVertexId vertex ) const override;
228 double segmentLength(
QgsVertexId startVertex ) const override;
229 int vertexCount(
int part = 0,
int ring = 0 ) const override;
230 int ringCount(
int part = 0 ) const override;
231 int partCount() const override;
233 bool isValid( QString &error
SIP_OUT,
Qgis::GeometryValidityFlags flags =
Qgis::GeometryValidityFlags() ) const override;
235 bool addZValue(
double zValue = 0 ) override;
236 bool addMValue(
double mValue = 0 ) override;
237 bool dropZValue() override;
238 bool dropMValue() override;
239 void swapXy() override;
279 const int count = sipCpp->numGeometries();
280 if ( a0 < -count || a0 >= count )
282 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
287 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
291 return sipConvertFromType( sipCpp->geometryN( count + a0 ), sipType_QgsAbstractGeometry, NULL );
305 void __delitem__(
int index );
307 const int count = sipCpp->numGeometries();
308 if ( a0 >= 0 && a0 < count )
309 sipCpp->removeGeometry( a0 );
310 else if ( a0 < 0 && a0 >= -count )
311 sipCpp->removeGeometry( count + a0 );
314 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
326 sipRes = sipConvertFromNewType( new
QgsGeometryPartIterator( sipCpp ), sipType_QgsGeometryPartIterator, Py_None );
333 int childCount() const override;
344 virtual
bool wktOmitChildType() const;
349 bool fromCollectionWkt( const QString &wkt, const QVector<
QgsAbstractGeometry *> &subtypes, const QString &defaultChildWkbType = QString() );
352 void clearCache() const override;
357 mutable
bool mHasCachedValidity = false;
358 mutable QString mValidityFailureReason;
The Qgis class provides global constants for use throughout the application.
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.
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
virtual QgsAbstractGeometry * clone() const =0
Clones the geometry by performing a deep copy.
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)
#define SIP_THROW(name,...)
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.