21#include <nlohmann/json.hpp>
36#include <QPainterPath>
39using namespace Qt::StringLiterals;
53 auto result = std::make_unique< QgsCurvePolygon >();
55 return result.release();
60 return u
"CurvePolygon"_s;
75 mExteriorRing.reset( p.mExteriorRing->clone() );
80 mInteriorRings.push_back( ring->clone() );
139 std::unique_ptr< QgsCurve > currentCurve;
140 for (
int i = 0; i < nRings; ++i )
143 wkbPtr -= 1 +
sizeof( int );
147 currentCurve = std::make_unique<QgsLineString>();
151 currentCurve = std::make_unique<QgsCircularString>();
155 currentCurve = std::make_unique<QgsCompoundCurve>();
161 currentCurve->fromWkb( wkbPtr );
186 QString secondWithoutParentheses =
parts.second;
187 secondWithoutParentheses = secondWithoutParentheses.remove(
'(' ).remove(
')' ).simplified().remove(
' ' );
188 if ( (
parts.second.compare(
"EMPTY"_L1, Qt::CaseInsensitive ) == 0 ) || secondWithoutParentheses.isEmpty() )
191 QString defaultChildWkbType = u
"LineString%1%2"_s.arg(
is3D() ? u
"Z"_s : QString(),
isMeasure() ? u
"M"_s : QString() );
194 for (
const QString &childWkt : blocks )
236 hasZ = hasZ || curve->is3D();
237 hasM = hasM || curve->isMeasure();
260 int binarySize =
sizeof( char ) +
sizeof( quint32 ) +
sizeof( quint32 );
267 binarySize += curve->wkbSize( flags );
278 wkbPtr << static_cast<quint32>(
wkbType() );
286 wkbPtr << curve->asWkb( flags );
306 childWkt = childWkt.mid( childWkt.indexOf(
'(' ) );
308 wkt += childWkt +
',';
312 if ( !curve->isEmpty() )
314 QString childWkt = curve->asWkt( precision );
318 childWkt = childWkt.mid( childWkt.indexOf(
'(' ) );
320 wkt += childWkt +
',';
323 if ( wkt.endsWith(
',' ) )
335 QDomElement elemPolygon = doc.createElementNS( ns, u
"Polygon"_s );
340 QDomElement elemOuterBoundaryIs = doc.createElementNS( ns, u
"outerBoundaryIs"_s );
341 std::unique_ptr< QgsLineString > exteriorLineString(
exteriorRing()->curveToLine() );
342 QDomElement outerRing = exteriorLineString->asGml2( doc, precision, ns, axisOrder );
343 outerRing.toElement().setTagName( u
"LinearRing"_s );
344 elemOuterBoundaryIs.appendChild( outerRing );
345 elemPolygon.appendChild( elemOuterBoundaryIs );
346 std::unique_ptr< QgsLineString > interiorLineString;
349 QDomElement elemInnerBoundaryIs = doc.createElementNS( ns, u
"innerBoundaryIs"_s );
350 interiorLineString.reset(
interiorRing( i )->curveToLine() );
351 QDomElement innerRing = interiorLineString->asGml2( doc, precision, ns, axisOrder );
352 innerRing.toElement().setTagName( u
"LinearRing"_s );
353 elemInnerBoundaryIs.appendChild( innerRing );
354 elemPolygon.appendChild( elemInnerBoundaryIs );
361 QDomElement elemCurvePolygon = doc.createElementNS( ns, u
"Polygon"_s );
364 return elemCurvePolygon;
366 const auto exportRing = [&doc, precision, &ns, axisOrder](
const QgsCurve *ring ) {
367 QDomElement ringElem = ring->asGml3( doc, precision, ns, axisOrder );
368 if ( ringElem.tagName() ==
"LineString"_L1 )
370 ringElem.setTagName( u
"LinearRing"_s );
372 else if ( ringElem.tagName() ==
"CompositeCurve"_L1 )
374 ringElem.setTagName( u
"Ring"_s );
376 else if ( ringElem.tagName() ==
"Curve"_L1 )
378 QDomElement ringElemNew = doc.createElementNS( ns, u
"Ring"_s );
379 QDomElement curveMemberElem = doc.createElementNS( ns, u
"curveMember"_s );
380 ringElemNew.appendChild( curveMemberElem );
381 curveMemberElem.appendChild( ringElem );
382 ringElem = std::move( ringElemNew );
387 QDomElement elemExterior = doc.createElementNS( ns, u
"exterior"_s );
388 elemExterior.appendChild( exportRing(
exteriorRing() ) );
389 elemCurvePolygon.appendChild( elemExterior );
393 QDomElement elemInterior = doc.createElementNS( ns, u
"interior"_s );
394 elemInterior.appendChild( exportRing(
interiorRing( i ) ) );
395 elemCurvePolygon.appendChild( elemInterior );
397 return elemCurvePolygon;
407 json coordinates( json::array() );
410 std::unique_ptr< QgsLineString > exteriorLineString( lExteriorRing->curveToLine() );
412 exteriorLineString->points( exteriorPts );
415 std::unique_ptr< QgsLineString > interiorLineString;
418 interiorLineString.reset(
interiorRing( i )->curveToLine() );
420 interiorLineString->points( interiorPts );
424 return { {
"type",
"Polygon" }, {
"coordinates", coordinates } };
429 json geometries = json::array();
432 geometries.push_back( lExteriorRing->asJsonObject( precision, profile ) );
438 return { {
"type",
"CurvePolygon" }, {
"geometries", geometries } };
447 kml.append(
"<Polygon>"_L1 );
450 kml.append(
"<outerBoundaryIs>"_L1 );
452 kml.append(
"</outerBoundaryIs>"_L1 );
455 for (
const QgsCurve *ring : interiorRings )
457 kml.append(
"<innerBoundaryIs>"_L1 );
458 kml.append( ring->asKml( precision ) );
459 kml.append(
"</innerBoundaryIs>"_L1 );
461 kml.append(
"</Polygon>"_L1 );
490 double totalArea = 0.0;
496 totalArea += std::fabs(
area );
502 if ( ring->isRing() )
504 ring->sumUpArea(
area );
505 totalArea -= std::fabs(
area );
518 double totalArea3D = 0.0;
524 totalArea3D += std::abs(
area3D );
530 if ( ring->isRing() )
532 ring->sumUpArea3D(
area3D );
533 totalArea3D -= std::abs(
area3D );
560 return 4.0 * M_PI *
area() / pow( p, 2.0 );
565 auto polygon = std::make_unique<QgsPolygon>();
567 return polygon.release();
569 polygon->setExteriorRing(
exteriorRing()->curveToLine() );
570 QVector<QgsCurve *> interiors;
572 interiors.reserve( n );
573 for (
int i = 0; i < n; ++i )
577 polygon->setInteriorRings( interiors );
578 return polygon.release();
594 multiCurve->
reserve( nInteriorRings + 1 );
596 for (
int i = 0; i < nInteriorRings; ++i )
613 auto exterior = std::unique_ptr<QgsCurve> {
static_cast< QgsCurve *
>(
mExteriorRing->snappedToGrid( hSpacing, vSpacing, dSpacing, mSpacing, removeRedundantPoints ) ) };
618 polygon->mExteriorRing = std::move( exterior );
626 QgsCurve *gridifiedInterior =
static_cast< QgsCurve *
>( interior->snappedToGrid( hSpacing, vSpacing, dSpacing, mSpacing, removeRedundantPoints ) );
628 if ( !gridifiedInterior )
631 polygon->mInteriorRings.append( gridifiedInterior );
634 return polygon.release();
643 std::unique_ptr< QgsAbstractGeometry > exterior(
mExteriorRing->simplifyByDistance( tolerance ) );
647 auto polygon = std::make_unique< QgsPolygon >( qgis::down_cast< QgsLineString * >( exterior.release() ) );
655 std::unique_ptr< QgsAbstractGeometry > simplifiedRing( interior->simplifyByDistance( tolerance ) );
656 if ( !simplifiedRing )
662 polygon->mInteriorRings.append( qgis::down_cast< QgsLineString * >( simplifiedRing.release() ) );
665 return polygon.release();
671 auto cleanRing = [epsilon, useZValues](
QgsCurve *ring ) ->
bool {
672 if ( ring->numPoints() <= 4 )
675 if ( ring->removeDuplicateNodes( epsilon, useZValues ) )
679 ring->pointAt( 0, startPoint, type );
681 ring->moveVertex(
QgsVertexId( -1, -1, ring->numPoints() - 1 ), startPoint );
693 if ( cleanRing( ring ) )
721 if ( ring->boundingBoxIntersects( box3d ) )
758 if ( ring->boundingBoxIntersects( box ) )
774 auto poly = std::make_unique<QgsPolygon>();
777 return poly.release();
780 poly->setExteriorRing(
mExteriorRing->curveToLine( tolerance, toleranceType ) );
782 QVector<QgsCurve *> rings;
786 rings.push_back( ring->curveToLine( tolerance, toleranceType ) );
788 poly->setInteriorRings( rings );
789 return poly.release();
847 else if ( !ring->
is3D() )
872 for (
int ringIndex =
mInteriorRings.size() - 1; ringIndex >= 0; --ringIndex )
874 if ( minimumAllowedArea < 0 )
880 if ( std::fabs(
area ) < minimumAllowedArea )
890 QVector<QgsCurve *> validRings;
894 if ( !curve->isRing() )
917 std::unique_ptr< QgsCurve > flipped(
mExteriorRing->reversed() );
921 QVector<QgsCurve *> validRings;
928 validRings << flipped;
947 QVector<QgsCurve *> validRings;
954 validRings << flipped;
977 QPainterPath ringPath = ring->asQPainterPath();
978 ringPath.closeSubpath();
979 p.addPath( ringPath );
1001 ring->addToPainterPath( path );
1016 curve->transform( ct, d, transformZ );
1025 mExteriorRing->transform( t, zTranslate, zScale, mTranslate, mScale );
1030 curve->transform( t, zTranslate, zScale, mTranslate, mScale );
1049 ring->points( sequence.back().back() );
1066 count += ring->nCoordinates();
1092 if (
id.ring == i + 1 )
1095 if ( partNumber == -1 )
1097 return number + partNumber;
1121 QVector<QgsCurve *> segmentList;
1173 if ( vertex.
vertex == 0 && n < 3 )
1177 else if ( vertex.
vertex == 0 )
1185 if ( vertex.
vertex == n - 1 && n < 3 )
1189 else if ( vertex.
vertex == n - 1 )
1208 if ( vertex.
ring == 0 )
1236 else if ( vId.
vertex == n )
1253 bool success = ring->
moveVertex( vId, newPos );
1259 else if ( vId.
vertex == n - 1 )
1268 const int interiorRingId = vId.
ring - 1;
1280 if ( vId.
ring == 0 )
1304 else if ( vId.
vertex == n - 1 )
1313 if ( positions.empty() )
1318 QMap<int, QList<QgsVertexId >> ringVertices;
1326 ringVertices[pos.ring].append(
QgsVertexId( 0, 0, pos.vertex ) );
1329 QMapIterator<int, QList<QgsVertexId >> ringVerticesIt( ringVertices );
1331 ringVerticesIt.toBack();
1332 while ( ringVerticesIt.hasPrevious() )
1334 ringVerticesIt.previous();
1335 QList<QgsVertexId>
vertices = ringVerticesIt.value();
1336 int ringId = ringVerticesIt.key();
1338 const int interiorRingId = ringId - 1;
1395 if (
vertices.last().vertex == n - 1 )
1399 else if (
vertices.first().vertex == 0 )
1414 if (
id.part == 0 &&
id.ring >= 0 &&
id.ring <
mInteriorRings.size() + 1 )
1433 if ( ring->hasCurvedSegments() )
1443 return toPolygon( tolerance, toleranceType );
1500 curve->addZValue( zValue );
1517 curve->addMValue( mValue );
1533 curve->dropZValue();
1549 curve->dropMValue();
1580 if ( !res || ( feedback && feedback->
isCanceled() ) )
1588 res = curve->transform( transformer );
1607 curve->filterVertices( filter );
1640 if ( !otherPolygon )
1650 if ( shellComp != 0 )
1658 if ( nHole1 < nHole2 )
1662 if ( nHole1 > nHole2 )
1667 for (
int i = 0; i < nHole1; i++ )
1670 if ( holeComp != 0 )
@ CounterClockwise
Counter-clockwise direction.
@ Clockwise
Clockwise direction.
VertexType
Types of vertex.
GeoJsonProfile
GeoJson export Profile according to OGC Features and Geometries JSON - Part 1: Core https://docs....
@ Legacy
Legacy GeoJson profile used in QGIS prior to 4.2, which included some non-standard extensions and dev...
@ Rfc7946
GeoJson profile compliant with RFC7946 standard "http://www.opengis.net/def/profile/OGC/0/rfc7946".
@ JsonFg
GeoJson profile from OGC Features and Geometries JSON Part 1: core "http://www.opengis....
@ JsonFgPlus
GeoJson profile from OGC Features and Geometries JSON Part 1: core "http://www.opengis....
WkbType
The WKB type describes the number of dimensions a geometry has.
@ CompoundCurve
CompoundCurve.
@ CircularString
CircularString.
@ CurvePolygon
CurvePolygon.
TransformDirection
Indicates the direction (forward or inverse) of a transform.
virtual bool addZValue(double zValue=0)=0
Adds a z-dimension to the geometry, initialized to a preset value.
virtual bool moveVertex(QgsVertexId position, const QgsPoint &newPos)=0
Moves a vertex within the geometry.
SegmentationToleranceType
Segmentation tolerance as maximum angle or maximum difference between approximation and circle.
virtual double vertexAngle(QgsVertexId vertex) const =0
Returns approximate angle at a vertex.
virtual bool dropMValue()=0
Drops any measure values which exist in the geometry.
QgsVertexIterator vertices() const
Returns a read-only, Java-style iterator for traversal of vertices of all the geometry,...
bool isMeasure() const
Returns true if the geometry contains m values.
QFlags< WkbFlag > WkbFlags
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
AxisOrder
Axis order for GML generation.
QString wktTypeStr() const
Returns the WKT type string of the geometry.
virtual bool deleteVertices(const QSet< QgsVertexId > &positions)=0
Deletes vertices within the geometry.
QgsAbstractGeometry & operator=(const QgsAbstractGeometry &geom)
virtual bool addMValue(double mValue=0)=0
Adds a measure to the geometry, initialized to a preset value.
Qgis::WkbType wkbType() const
Returns the WKB type of the geometry.
virtual bool insertVertex(QgsVertexId position, const QgsPoint &vertex)=0
Inserts a vertex into the geometry.
void setZMTypeFromSubGeometry(const QgsAbstractGeometry *subggeom, Qgis::WkbType baseGeomType)
Updates the geometry type based on whether sub geometries contain z or m values.
virtual bool boundingBoxIntersects(const QgsRectangle &rectangle) const
Returns true if the bounding box of this geometry intersects with a rectangle.
virtual bool deleteVertex(QgsVertexId position)=0
Deletes a vertex within the geometry.
virtual bool dropZValue()=0
Drops any z-dimensions which exist in the geometry.
virtual double segmentLength(QgsVertexId startVertex) const =0
Returns the length of the segment of the geometry which begins at startVertex.
QgsAbstractGeometry()=default
QgsGeometryConstPartIterator parts() const
Returns Java-style iterator for traversal of parts of the geometry.
static endian_t endian()
Returns whether this machine uses big or little endian.
A 3-dimensional box composed of x, y, z coordinates.
Circular string geometry type.
Compound curve geometry type.
void addVertex(const QgsPoint &pt)
Adds a vertex to the end of the geometry.
Qgis::WkbType readHeader() const
readHeader
QByteArray asWkb(QgsAbstractGeometry::WkbFlags flags=QgsAbstractGeometry::WkbFlags()) const override
Returns a WKB representation of the geometry.
int numInteriorRings() const
Returns the number of interior rings contained with the curve polygon.
QgsCoordinateSequence coordinateSequence() const override
Retrieves the sequence of geometries, rings and nodes.
int wkbSize(QgsAbstractGeometry::WkbFlags flags=QgsAbstractGeometry::WkbFlags()) const override
Returns the length of the QByteArray returned by asWkb().
bool moveVertex(QgsVertexId position, const QgsPoint &newPos) override
Moves a vertex within the geometry.
QString asWkt(int precision=17) const override
Returns a WKT representation of the geometry.
bool addZValue(double zValue=0) override
Adds a z-dimension to the geometry, initialized to a preset value.
QDomElement asGml2(QDomDocument &doc, int precision=17, const QString &ns="gml", QgsAbstractGeometry::AxisOrder axisOrder=QgsAbstractGeometry::AxisOrder::XY) const override
Returns a GML2 representation of the geometry.
double vertexAngle(QgsVertexId vertex) const override
Returns approximate rotation angle for a vertex.
bool hasCurvedSegments() const override
Returns true if the geometry contains curved segments.
const QgsCurve * exteriorRing() const
Returns the curve polygon's exterior ring.
QgsAbstractGeometry * boundary() const override
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the...
QgsCurvePolygon * createEmptyWithSameType() const override
Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
bool hasVertex(QgsVertexId position) const override
Returns true if the geometry contains a vertex matching the given position.
QPainterPath asQPainterPath() const override
Returns the geometry represented as a QPainterPath.
void swapXy() override
Swaps the x and y coordinates from the geometry.
bool isEmpty() const override
Returns true if the geometry is empty.
int vertexCount(int part=0, int ring=0) const override
Returns the number of vertices of which this geometry is built.
virtual QgsPolygon * toPolygon(double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const
Returns a new polygon geometry corresponding to a segmentized approximation of the curve.
QVector< QgsCurve * > mInteriorRings
bool fromWkb(QgsConstWkbPtr &wkb) override
Sets the geometry from a WKB string.
void normalize() final
Reorganizes the geometry into a normalized form (or "canonical" form).
void removeInteriorRings(double minimumAllowedArea=-1)
Removes the interior rings from the polygon.
QgsCurvePolygon * clone() const override
Clones the geometry by performing a deep copy.
const QgsCurve * interiorRing(int i) const
Retrieves an interior ring from the curve polygon.
double area() const override
Returns the planar, 2-dimensional area of the geometry.
QgsCurvePolygon * toCurveType() const override
Returns the geometry converted to the more generic curve type.
void forceRHR()
Forces the geometry to respect the Right-Hand-Rule, in which the area that is bounded by the polygon ...
QgsCurvePolygon * simplifyByDistance(double tolerance) const override
Simplifies the geometry by applying the Douglas Peucker simplification by distance algorithm.
QString asKml(int precision=17) const override
Returns a KML representation of the geometry.
void clear() override
Clears the geometry, ie reset it to a null geometry.
QgsBox3D calculateBoundingBox3D() const override
Calculates the minimal 3D bounding box for the geometry.
virtual void setExteriorRing(QgsCurve *ring)
Sets the exterior ring of the polygon.
double closestSegment(const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, int *leftOf=nullptr, double epsilon=4 *std::numeric_limits< double >::epsilon()) const override
Searches for the closest segment of the geometry to a given point.
int partCount() const override
Returns count of parts contained in the geometry.
int nCoordinates() const override
Returns the number of nodes contained in the geometry.
void filterVertices(const std::function< bool(const QgsPoint &) > &filter) override
Filters the vertices from the geometry in place, removing any which do not return true for the filter...
void adjacentVertices(QgsVertexId vertex, QgsVertexId &previousVertex, QgsVertexId &nextVertex) const override
Returns the vertices adjacent to a specified vertex within a geometry.
void draw(QPainter &p) const override
Draws the geometry using the specified QPainter.
double perimeter() const override
Returns the planar, 2-dimensional perimeter of the geometry.
bool addMValue(double mValue=0) override
Adds a measure to the geometry, initialized to a preset value.
QgsCurvePolygon & operator=(const QgsCurvePolygon &p)
void forceCounterClockwise()
Forces the polygon to respect the exterior ring is counter-clockwise, interior rings are clockwise co...
bool dropZValue() override
Drops any z-dimensions which exist in the geometry.
double area3D() const override
Returns the 3-dimensional surface area of the geometry.
void forceClockwise()
Forces the polygon to respect the exterior ring is clockwise, interior rings are counter-clockwise co...
double roundness() const
Returns the roundness of the curve polygon.
virtual void addInteriorRing(QgsCurve *ring)
Adds an interior ring to the geometry (takes ownership).
bool boundingBoxIntersects(const QgsBox3D &box3d) const override
Returns true if the bounding box of this geometry intersects with a box3d.
~QgsCurvePolygon() override
int dimension() const override
Returns the inherent dimension of the geometry.
bool nextVertex(QgsVertexId &id, QgsPoint &vertex) const override
Returns next vertex id and coordinates.
QgsPoint vertexAt(QgsVertexId id) const override
Returns the point corresponding to a specified vertex id.
virtual QgsPolygon * surfaceToPolygon() const
Gets a polygon representation of this surface.
int ringCount(int part=0) const override
Returns the number of rings of which this geometry is built.
bool insertVertex(QgsVertexId position, const QgsPoint &vertex) override
Inserts a vertex into the geometry.
bool fromWkt(const QString &wkt) override
Sets the geometry from a WKT string.
void removeInvalidRings()
Removes any interior rings which are not valid from the polygon.
QgsAbstractGeometry * segmentize(double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const override
Returns a geometry without curves.
int vertexNumberFromVertexId(QgsVertexId id) const override
Returns the vertex number corresponding to a vertex id.
QString geometryType() const override
Returns a unique string representing the geometry type.
void transformVertices(const std::function< QgsPoint(const QgsPoint &) > &transform) override
Transforms the vertices from the geometry in place, applying the transform function to every vertex.
int childCount() const override
Returns number of child geometries (for geometries with child geometries) or child points (for geomet...
bool deleteVertex(QgsVertexId position) override
Deletes a vertex within the geometry.
QDomElement asGml3(QDomDocument &doc, int precision=17, const QString &ns="gml", QgsAbstractGeometry::AxisOrder axisOrder=QgsAbstractGeometry::AxisOrder::XY) const override
Returns a GML3 representation of the geometry.
bool removeDuplicateNodes(double epsilon=4 *std::numeric_limits< double >::epsilon(), bool useZValues=false) override
Removes duplicate nodes from the geometry, wherever removing the nodes does not result in a degenerat...
QgsCurvePolygon * snappedToGrid(double hSpacing, double vSpacing, double dSpacing=0, double mSpacing=0, bool removeRedundantPoints=false) const override
Makes a new geometry with all the points or vertices snapped to the closest point of the grid.
bool dropMValue() override
Drops any measure values which exist in the geometry.
bool deleteVertices(const QSet< QgsVertexId > &positions) override
Deletes vertices within the geometry.
QgsAbstractGeometry * childGeometry(int index) const override
Returns pointer to child geometry (for geometries with child geometries - i.e.
void setInteriorRings(const QVector< QgsCurve * > &rings)
Sets all interior rings (takes ownership).
bool removeInteriorRing(int ringIndex)
Removes an interior ring from the polygon.
std::unique_ptr< QgsCurve > mExteriorRing
json asJsonObject(int precision=17, Qgis::GeoJsonProfile profile=Qgis::GeoJsonProfile::Legacy) const override
Returns a json object representation of the geometry with the given precision and profile.
int compareToSameClass(const QgsAbstractGeometry *other) const final
Compares to an other geometry of the same class, and returns a integer for sorting of the two geometr...
double segmentLength(QgsVertexId startVertex) const override
Returns the length of the segment of the geometry which begins at startVertex.
void transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection d=Qgis::TransformDirection::Forward, bool transformZ=false) override
Transforms the geometry using a coordinate transform.
Abstract base class for curved geometry type.
virtual int numPoints() const =0
Returns the number of points in the curve.
QgsPoint vertexAt(QgsVertexId id) const override
Returns the point corresponding to a specified vertex id.
QgsCurve * clone() const override=0
Clones the geometry by performing a deep copy.
bool hasVertex(QgsVertexId position) const override
Returns true if the geometry contains a vertex matching the given position.
bool nextVertex(QgsVertexId &id, QgsPoint &vertex) const override
Returns next vertex id and coordinates.
virtual QgsCurve * reversed() const =0
Returns a reversed copy of the curve, where the direction of the curve has been flipped.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
bool isCanceled() const
Tells whether the operation has been canceled already.
void reserve(int size)
Attempts to allocate memory for at least size geometries.
static QStringList wktGetChildBlocks(const QString &wkt, const QString &defaultType=QString())
Parses a WKT string and returns of list of blocks contained in the WKT.
static QPair< Qgis::WkbType, QString > wktReadBlock(const QString &wkt)
Parses a WKT block of the format "TYPE( contents )" and returns a pair of geometry type to contents (...
static double closestSegmentFromComponents(T &container, ComponentType ctype, const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, int *leftOf, double epsilon)
static json pointsToJson(const QgsPointSequence &points, int precision, Qgis::GeoJsonProfile profile)
Returns coordinates as json object.
Line string geometry type, with support for z-dimension and m-values.
Multi curve geometry collection.
bool addGeometry(QgsAbstractGeometry *g) override
Adds a geometry and takes ownership. Returns true in case of success.
Point geometry type, with support for z-dimension and m-values.
A rectangle specified with double values.
void clearCache() const override
Clears any cached parameters associated with the geometry, e.g., bounding boxes.
QString mValidityFailureReason
static Qgis::WkbType dropM(Qgis::WkbType type)
Drops the m dimension (if present) for a WKB type and returns the new type.
static Qgis::GeometryType geometryType(Qgis::WkbType type)
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
static Qgis::WkbType dropZ(Qgis::WkbType type)
Drops the z dimension (if present) for a WKB type and returns the new type.
static Qgis::WkbType addM(Qgis::WkbType type)
Adds the m dimension to a WKB type and returns the new type.
static Qgis::WkbType addZ(Qgis::WkbType type)
Adds the z dimension to a WKB type and returns the new type.
static Q_INVOKABLE bool hasZ(Qgis::WkbType type)
Tests whether a WKB type contains the z-dimension.
static Q_INVOKABLE bool hasM(Qgis::WkbType type)
Tests whether a WKB type contains m values.
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
#define BUILTIN_UNREACHABLE
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference).
T qgsgeometry_cast(QgsAbstractGeometry *geom)
QVector< QgsRingSequence > QgsCoordinateSequence
QVector< QgsPointSequence > QgsRingSequence
QVector< QgsPoint > QgsPointSequence
void ringAdjacentVertices(const QgsCurve *curve, QgsVertexId vertex, QgsVertexId &previousVertex, QgsVertexId &nextVertex)
Utility class for identifying a unique vertex within a geometry.