QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
QgsGeometryEditUtils Class Reference

Convenience functions for geometry editing. More...

#include <qgsgeometryeditutils.h>

Static Public Member Functions

static Qgis::GeometryOperationResult addPart (QgsAbstractGeometry *geometry, std::unique_ptr< QgsAbstractGeometry > part)
 Add a part to multi type geometry.
 
static Qgis::GeometryOperationResult addRing (QgsAbstractGeometry *geometry, std::unique_ptr< QgsCurve > ring)
 Add an interior ring to a geometry.
 
static std::unique_ptr< QgsAbstractGeometryavoidIntersections (const QgsAbstractGeometry &geom, const QList< QgsVectorLayer * > &avoidIntersectionsLayers, bool &haveInvalidGeometry, const QHash< QgsVectorLayer *, QSet< QgsFeatureId > > &ignoreFeatures=(QHash< QgsVectorLayer *, QSet< QgsFeatureId > >()))
 Alters a geometry so that it avoids intersections with features from all open vector layers.
 
static bool deletePart (QgsAbstractGeometry *geom, int partNum)
 Deletes a part from a geometry.
 
static bool deleteRing (QgsAbstractGeometry *geom, int ringNum, int partNum=0)
 Deletes a ring from a geometry.
 

Detailed Description

Convenience functions for geometry editing.

Note
not available in Python bindings

Definition at line 37 of file qgsgeometryeditutils.h.

Member Function Documentation

◆ addPart()

Qgis::GeometryOperationResult QgsGeometryEditUtils::addPart ( QgsAbstractGeometry geometry,
std::unique_ptr< QgsAbstractGeometry part 
)
static

Add a part to multi type geometry.

Ownership of the part is transferred.

Returns
0 in case of success, 1 if not a multigeometry, 2 if part is not a valid geometry, 3 if new polygon ring not disjoint with existing polygons of the feature

Definition at line 96 of file qgsgeometryeditutils.cpp.

◆ addRing()

Qgis::GeometryOperationResult QgsGeometryEditUtils::addRing ( QgsAbstractGeometry geometry,
std::unique_ptr< QgsCurve ring 
)
static

Add an interior ring to a geometry.

Ownership of the ring is transferred.

Returns
0 in case of success (ring added), 1 problem with geometry type, 2 ring not closed, 3 ring is not valid geometry, 4 ring not disjoint with existing rings, 5 no polygon found which contained the ring

Definition at line 27 of file qgsgeometryeditutils.cpp.

◆ avoidIntersections()

std::unique_ptr< QgsAbstractGeometry > QgsGeometryEditUtils::avoidIntersections ( const QgsAbstractGeometry geom,
const QList< QgsVectorLayer * > &  avoidIntersectionsLayers,
bool &  haveInvalidGeometry,
const QHash< QgsVectorLayer *, QSet< QgsFeatureId > > &  ignoreFeatures = ( QHash<QgsVectorLayer *, QSet<QgsFeatureId> >() ) 
)
static

Alters a geometry so that it avoids intersections with features from all open vector layers.

Parameters
geomgeometry to alter
avoidIntersectionsLayerslist of layers to check for intersections
haveInvalidGeometryreturns true if at least one geometry intersected is invalid. In this case, the algorithm may not work and return the same geometry as the input. You must fix your intersecting geometries.
ignoreFeaturesmap of layer to feature id of features to ignore
Returns
the modified geometry or a null unique_ptr if the geom polygon doesn't intersect any geometry in avoidIntersectionsLayers

Definition at line 278 of file qgsgeometryeditutils.cpp.

◆ deletePart()

bool QgsGeometryEditUtils::deletePart ( QgsAbstractGeometry geom,
int  partNum 
)
static

Deletes a part from a geometry.

Returns
true if delete was successful

Definition at line 262 of file qgsgeometryeditutils.cpp.

◆ deleteRing()

bool QgsGeometryEditUtils::deleteRing ( QgsAbstractGeometry geom,
int  ringNum,
int  partNum = 0 
)
static

Deletes a ring from a geometry.

Returns
true if delete was successful

Definition at line 229 of file qgsgeometryeditutils.cpp.


The documentation for this class was generated from the following files: