QGIS API Documentation  3.20.0-Odense (decaadbb31)
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 QgsGeometry::OperationResult addPart (QgsAbstractGeometry *geometry, std::unique_ptr< QgsAbstractGeometry > part)
 Add a part to multi type geometry. More...
 
static QgsGeometry::OperationResult addRing (QgsAbstractGeometry *geometry, std::unique_ptr< QgsCurve > ring)
 Add an interior ring to a geometry. More...
 
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. More...
 
static bool deletePart (QgsAbstractGeometry *geom, int partNum)
 Deletes a part from a geometry. More...
 
static bool deleteRing (QgsAbstractGeometry *geom, int ringNum, int partNum=0)
 Deletes a ring from a geometry. More...
 

Detailed Description

Convenience functions for geometry editing.

Note
not available in Python bindings
Since
QGIS 2.10

Definition at line 38 of file qgsgeometryeditutils.h.

Member Function Documentation

◆ addPart()

QgsGeometry::OperationResult 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 98 of file qgsgeometryeditutils.cpp.

◆ addRing()

QgsGeometry::OperationResult 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 29 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

Definition at line 225 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 209 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 176 of file qgsgeometryeditutils.cpp.


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