16 #ifndef QGSGEOMETRYCOLLECTIONV2_H 17 #define QGSGEOMETRYCOLLECTIONV2_H 22 #include "qgis_core.h" 53 return mGeometries.size();
63 sipRes = sipCpp->numGeometries();
81 return mGeometries.value( n );
99 if ( a0 < 0 || a0 >= sipCpp->numGeometries() )
101 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
106 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
116 void clear()
override;
118 bool removeDuplicateNodes(
double epsilon = 4 * std::numeric_limits<double>::epsilon(),
bool useZValues =
false )
override;
140 virtual bool removeGeometry(
int nr );
150 virtual bool removeGeometry(
int nr );
152 const int count = sipCpp->numGeometries();
153 if ( a0 < 0 || a0 >= count )
155 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
160 return PyBool_FromLong( sipCpp->removeGeometry( a0 ) );
166 void transform(
const QTransform &t,
double zTranslate = 0.0,
double zScale = 1.0,
double mTranslate = 0.0,
double mScale = 1.0 )
override;
168 void draw( QPainter &p )
const override;
171 bool fromWkt(
const QString &wkt )
override;
172 QByteArray
asWkb()
const override;
191 double length()
const override;
192 double area()
const override;
205 int vertexCount(
int part = 0,
int ring = 0 )
const override;
206 int ringCount(
int part = 0 )
const override;
210 bool addZValue(
double zValue = 0 )
override;
211 bool addMValue(
double mValue = 0 )
override;
249 const int count = sipCpp->numGeometries();
250 if ( a0 < -count || a0 >= count )
252 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
257 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
261 return sipConvertFromType( sipCpp->geometryN( count + a0 ), sipType_QgsAbstractGeometry, NULL );
273 void __delitem__(
int index );
275 const int count = sipCpp->numGeometries();
276 if ( a0 >= 0 && a0 < count )
277 sipCpp->removeGeometry( a0 );
278 else if ( a0 < 0 && a0 >= -count )
279 sipCpp->removeGeometry( count + a0 );
282 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
294 sipRes = sipConvertFromNewType(
new QgsGeometryPartIterator( sipCpp ), sipType_QgsGeometryPartIterator, Py_None );
311 virtual bool wktOmitChildType()
const;
316 bool fromCollectionWkt(
const QString &wkt,
const QVector<QgsAbstractGeometry *> &subtypes,
const QString &defaultChildWkbType = QString() );
328 #endif // QGSGEOMETRYCOLLECTIONV2_H virtual QString asWkt(int precision=17) const =0
Returns a WKT representation of the geometry.
virtual bool isEmpty() const
Returns true if the geometry is empty.
A rectangle specified with double values.
virtual QgsAbstractGeometry * snappedToGrid(double hSpacing, double vSpacing, double dSpacing=0, double mSpacing=0) const =0
Makes a new geometry with all the points or vertices snapped to the closest point of the grid...
Java-style iterator for traversal of parts of a geometry.
virtual int vertexNumberFromVertexId(QgsVertexId id) const =0
Returns the vertex number corresponding to a vertex id.
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 bool deleteVertex(QgsVertexId position)=0
Deletes a vertex within the geometry.
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 QgsAbstractGeometry * toCurveType() const =0
Returns the geometry converted to the more generic curve type.
virtual QByteArray asWkb() const =0
Returns a WKB representation of the geometry.
QgsAbstractGeometry & operator=(const QgsAbstractGeometry &geom)
virtual bool hasCurvedSegments() const
Returns true if the geometry contains curved segments.
static bool isMultiType(Type type)
Returns true if the WKB type is a multi type.
virtual bool insertVertex(QgsVertexId position, const QgsPoint &vertex)=0
Inserts a vertex into the geometry.
QVector< QgsRingSequence > QgsCoordinateSequence
virtual bool operator==(const QgsAbstractGeometry &other) const =0
QgsWkbTypes::Type wkbType() const
Returns the WKB type of the geometry.
virtual double vertexAngle(QgsVertexId vertex) const =0
Returns approximate angle at a vertex.
virtual bool addMValue(double mValue=0)=0
Adds a measure to the geometry, initialized to a preset value.
const QgsAbstractGeometry * geometryN(int n) const
Returns a const reference to a geometry from within the collection.
virtual QgsAbstractGeometry * createEmptyWithSameType() const =0
Creates a new geometry with the same class and same WKB type as the original and transfers ownership...
virtual QString asJson(int precision=17) const =0
Returns a GeoJSON representation of the geometry.
virtual QDomElement asGml2(QDomDocument &doc, int precision=17, const QString &ns="gml", AxisOrder axisOrder=QgsAbstractGeometry::AxisOrder::XY) const =0
Returns a GML2 representation of the geometry.
virtual QgsAbstractGeometry * boundary() const =0
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the...
SegmentationToleranceType
Segmentation tolerance as maximum angle or maximum difference between approximation and circle...
virtual bool nextVertex(QgsVertexId &id, QgsPoint &vertex) const =0
Returns next vertex id and coordinates.
virtual QgsRectangle boundingBox() const =0
Returns the minimal bounding box for the geometry.
virtual QgsAbstractGeometry * clone() const =0
Clones the geometry by performing a deep copy.
#define SIP_TYPEHINT(type)
virtual QgsRectangle calculateBoundingBox() const
Default calculator for the minimal bounding box for the geometry.
virtual QgsAbstractGeometry * childGeometry(int index) const
Returns pointer to child geometry (for geometries with child geometries - i.e.
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
virtual bool operator!=(const QgsAbstractGeometry &other) const =0
virtual int nCoordinates() const
Returns the number of nodes contained in the geometry.
virtual double closestSegment(const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, int *leftOf=nullptr, double epsilon=4 *std::numeric_limits< double >::epsilon()) const =0
Searches for the closest segment of the geometry to a given point.
virtual double segmentLength(QgsVertexId startVertex) const =0
Returns the length of the segment of the geometry which begins at startVertex.
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...
virtual QgsAbstractGeometry * segmentize(double tolerance=M_PI/180., SegmentationToleranceType toleranceType=MaximumAngle) const
Returns a version of the geometry without curves.
Utility class for identifying a unique vertex within a geometry.
virtual int ringCount(int part=0) const =0
Returns the number of rings of which this geometry is built.
int numGeometries() const
Returns the number of geometries within the collection.
Abstract base class for all geometries.
virtual int dimension() const =0
Returns the inherent dimension of the geometry.
virtual void clearCache() const
Clears any cached parameters associated with the geometry, e.g., bounding boxes.
const QgsGeometryCollection * cast(const QgsAbstractGeometry *geom) const
Cast the geom to a QgsGeometryCollection.
Point geometry type, with support for z-dimension and m-values.
AxisOrder
Axis order for GML generation.
virtual double length() const
Returns the length of the geometry.
virtual QgsCoordinateSequence coordinateSequence() const =0
Retrieves the sequence of geometries, rings and nodes.
virtual void adjacentVertices(QgsVertexId vertex, QgsVertexId &previousVertex, QgsVertexId &nextVertex) const =0
Returns the vertices adjacent to a specified vertex within a geometry.
QVector< QgsAbstractGeometry * > mGeometries
virtual void clear()=0
Clears the geometry, ie reset it to a null geometry.
virtual bool moveVertex(QgsVertexId position, const QgsPoint &newPos)=0
Moves a vertex within the geometry.
virtual double perimeter() const
Returns the perimeter of the geometry.
virtual void draw(QPainter &p) const =0
Draws the geometry using the specified QPainter.
virtual bool addZValue(double zValue=0)=0
Adds a z-dimension to the geometry, initialized to a preset value.
virtual int vertexCount(int part=0, int ring=0) const =0
Returns the number of vertices of which this geometry is built.
virtual double area() const
Returns the area of the geometry.
virtual bool removeDuplicateNodes(double epsilon=4 *std::numeric_limits< double >::epsilon(), bool useZValues=false)=0
Removes duplicate nodes from the geometry, wherever removing the nodes does not result in a degenerat...
Custom exception class for Coordinate Reference System related exceptions.
virtual int childCount() const
Returns number of child geometries (for geometries with child geometries) or child points (for geomet...
virtual bool dropMValue()=0
Drops any measure values which exist in the geometry.
virtual bool fromWkt(const QString &wkt)=0
Sets the geometry from a WKT string.
virtual QgsPoint vertexAt(QgsVertexId id) const =0
Returns the point corresponding to a specified vertex id.
virtual void swapXy()=0
Swaps the x and y coordinates from the geometry.
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'. Negativ values mean left a...
virtual bool dropZValue()=0
Drops any z-dimensions which exist in the geometry.
virtual int partCount() const =0
Returns count of parts contained in the geometry.
virtual QDomElement asGml3(QDomDocument &doc, int precision=17, const QString &ns="gml", AxisOrder axisOrder=QgsAbstractGeometry::AxisOrder::XY) const =0
Returns a GML3 representation of the geometry.
virtual QString geometryType() const =0
Returns a unique string representing the geometry type.
virtual bool fromWkb(QgsConstWkbPtr &wkb)=0
Sets the geometry from a WKB string.