QgsGeometryEditUtils class
Convenience functions for geometry editing.
Contents
- Reference
Public static functions
-
static auto addPart(QgsAbstractGeometry* geometry,
std::unique_ptr<QgsAbstractGeometry> part) -> QgsGeometry::
OperationResult - Add a part to multi type geometry.
-
static auto addRing(QgsAbstractGeometry* geometry,
std::unique_ptr<QgsCurve> ring) -> QgsGeometry::
OperationResult - Add an interior ring to a geometry.
- static auto avoidIntersections(const QgsAbstractGeometry& geom, const QList<QgsVectorLayer*>& avoidIntersectionsLayers, const QHash<QgsVectorLayer*, QSet<QgsFeatureId>>& ignoreFeatures = (QHash<QgsVectorLayer*, QSet<QgsFeatureId>>())) -> std::unique_ptr<QgsAbstractGeometry>
- Alters a geometry so that it avoids intersections with features from all open vector layers.
- static auto deletePart(QgsAbstractGeometry* geom, int partNum) -> bool
- Deletes a part from a geometry.
- static auto deleteRing(QgsAbstractGeometry* geom, int ringNum, int partNum = 0) -> bool
- Deletes a ring from a geometry.
Function documentation
static QgsGeometry:: OperationResult QgsGeometryEditUtils:: addPart(QgsAbstractGeometry* geometry,
std::unique_ptr<QgsAbstractGeometry> part)
Add a part to multi type geometry.
| 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 |
|---|
Ownership of the part is transferred.
static QgsGeometry:: OperationResult QgsGeometryEditUtils:: addRing(QgsAbstractGeometry* geometry,
std::unique_ptr<QgsCurve> ring)
Add an interior ring to a geometry.
| 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 |
|---|
Ownership of the ring is transferred.
static std::unique_ptr<QgsAbstractGeometry> QgsGeometryEditUtils:: avoidIntersections(const QgsAbstractGeometry& geom,
const QList<QgsVectorLayer*>& avoidIntersectionsLayers,
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.
| Parameters | |
|---|---|
| geom | geometry to alter |
| avoidIntersectionsLayers | list of layers to check for intersections |
| ignoreFeatures | map of layer to feature id of features to ignore |
static bool QgsGeometryEditUtils:: deletePart(QgsAbstractGeometry* geom,
int partNum)
Deletes a part from a geometry.
| Returns | true if delete was successful |
|---|
static bool QgsGeometryEditUtils:: deleteRing(QgsAbstractGeometry* geom,
int ringNum,
int partNum = 0)
Deletes a ring from a geometry.
| Returns | true if delete was successful |
|---|