|
QGIS API Documentation 4.3.0-Master (901db8dfa85)
|
Contains utility functions for editing vector layers. More...
#include <qgsvectorlayereditutils.h>
Public Member Functions | |
| QgsVectorLayerEditUtils (QgsVectorLayer *layer) | |
| Qgis::GeometryOperationResult | addPart (const QgsPointSequence &ring, QgsFeatureId featureId) |
| Adds a new part polygon to a multipart feature. | |
| Q_DECL_DEPRECATED Qgis::GeometryOperationResult | addPart (const QVector< QgsPointXY > &ring, QgsFeatureId featureId) |
| Adds a new part polygon to a multipart feature. | |
| Qgis::GeometryOperationResult | addPart (QgsCurve *ring, QgsFeatureId featureId) |
| Adds a new polygon part consisting of an exterior ring only to a multipart or geometryless feature. | |
| Qgis::GeometryOperationResult | addPart (QgsCurvePolygon *polygon, QgsFeatureId featureId) |
| Adds a new polygon part to a multipart or geometryless feature. | |
| Qgis::GeometryOperationResult | addRing (const QgsPointSequence &ring, const QgsFeatureIds &targetFeatureIds=QgsFeatureIds(), QgsFeatureId *modifiedFeatureId=nullptr) |
| Adds a ring to polygon/multipolygon features. | |
| Q_DECL_DEPRECATED Qgis::GeometryOperationResult | addRing (const QVector< QgsPointXY > &ring, const QgsFeatureIds &targetFeatureIds=QgsFeatureIds(), QgsFeatureId *modifiedFeatureId=nullptr) |
| Adds a ring to polygon/multipolygon features. | |
| Qgis::GeometryOperationResult | addRing (QgsCurve *ring, const QgsFeatureIds &targetFeatureIds=QgsFeatureIds(), QgsFeatureId *modifiedFeatureId=nullptr) |
| Adds a ring to polygon/multipolygon features. | |
| Qgis::GeometryOperationResult | addRingV2 (QgsCurve *ring, const QgsFeatureIds &targetFeatureIds=QgsFeatureIds(), QgsFeatureIds *modifiedFeatureIds=nullptr) |
| Adds a ring to polygon/multipolygon features. | |
| int | addTopologicalPoints (const QgsGeometry &geom) |
| Adds topological points for every vertex of the geometry. | |
| int | addTopologicalPoints (const QgsPoint &p) |
| Adds a vertex to segments which intersect point p but don't already have a vertex there. | |
| int | addTopologicalPoints (const QgsPointSequence &ps) |
| Adds a vertex to segments which intersect point p but don't already have a vertex there. | |
| int | addTopologicalPoints (const QgsPointXY &p) |
| Adds a vertex to segments which intersect point p but don't already have a vertex there. | |
| Qgis::VectorEditResult | deleteVertex (QgsFeatureId featureId, int vertex) |
| Deletes a vertex from a feature. | |
| Qgis::VectorEditResult | deleteVertices (QgsFeatureId featureId, const QSet< int > &vertices) |
| Deletes a set of vertices from a feature. | |
| bool | insertVertex (const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex) |
| Inserts a new vertex before the given vertex number, in the given ring, item (first number is index 0), and feature Not meaningful for Point geometries. | |
| bool | insertVertex (double x, double y, QgsFeatureId atFeatureId, int beforeVertex) |
| Insert a new vertex before the given vertex number, in the given ring, item (first number is index 0), and feature Not meaningful for Point geometries. | |
| bool | mergeFeatures (const QgsFeatureId &targetFeatureId, const QgsFeatureIds &mergeFeatureIds, const QgsAttributes &mergeAttributes, const QgsGeometry &unionGeometry, QString &errorMessage) |
| Merge features into a single one. | |
| bool | moveVertex (const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex) |
| Moves the vertex at the given position number, ring and item (first number is index 0), and feature to the given coordinates. | |
| bool | moveVertex (double x, double y, QgsFeatureId atFeatureId, int atVertex) |
| Moves the vertex at the given position number, ring and item (first number is index 0), and feature to the given coordinates. | |
| Qgis::GeometryOperationResult | splitFeatures (const QgsCurve *curve, QgsPointSequence &topologyTestPoints, bool preserveCircular=false, bool topologicalEditing=false) |
| Splits features cut by the given curve. | |
| Qgis::GeometryOperationResult | splitFeatures (const QgsPointSequence &splitLine, bool topologicalEditing=false) |
| Splits features cut by the given line. | |
| Q_DECL_DEPRECATED Qgis::GeometryOperationResult | splitFeatures (const QVector< QgsPointXY > &splitLine, bool topologicalEditing=false) |
| Splits features cut by the given line. | |
| Qgis::GeometryOperationResult | splitParts (const QgsPointSequence &splitLine, bool topologicalEditing=false) |
| Splits parts cut by the given line. | |
| Q_DECL_DEPRECATED Qgis::GeometryOperationResult | splitParts (const QVector< QgsPointXY > &splitLine, bool topologicalEditing=false) |
| Splits parts cut by the given line. | |
| int | translateFeature (QgsFeatureId featureId, double dx, double dy) |
| Translates feature by dx, dy. | |
Contains utility functions for editing vector layers.
Definition at line 32 of file qgsvectorlayereditutils.h.
| QgsVectorLayerEditUtils::QgsVectorLayerEditUtils | ( | QgsVectorLayer * | layer | ) |
Definition at line 41 of file qgsvectorlayereditutils.cpp.
| Qgis::GeometryOperationResult QgsVectorLayerEditUtils::addPart | ( | const QgsPointSequence & | ring, |
| QgsFeatureId | featureId ) |
Adds a new part polygon to a multipart feature.
Definition at line 356 of file qgsvectorlayereditutils.cpp.
| Qgis::GeometryOperationResult QgsVectorLayerEditUtils::addPart | ( | const QVector< QgsPointXY > & | ring, |
| QgsFeatureId | featureId ) |
Adds a new part polygon to a multipart feature.
QgsGeometry::InvalidInput
Definition at line 346 of file qgsvectorlayereditutils.cpp.
| Qgis::GeometryOperationResult QgsVectorLayerEditUtils::addPart | ( | QgsCurve * | ring, |
| QgsFeatureId | featureId ) |
Adds a new polygon part consisting of an exterior ring only to a multipart or geometryless feature.
Definition at line 390 of file qgsvectorlayereditutils.cpp.
| Qgis::GeometryOperationResult QgsVectorLayerEditUtils::addPart | ( | QgsCurvePolygon * | polygon, |
| QgsFeatureId | featureId ) |
Adds a new polygon part to a multipart or geometryless feature.
Definition at line 430 of file qgsvectorlayereditutils.cpp.
| Qgis::GeometryOperationResult QgsVectorLayerEditUtils::addRing | ( | const QgsPointSequence & | ring, |
| const QgsFeatureIds & | targetFeatureIds = QgsFeatureIds(), | ||
| QgsFeatureId * | modifiedFeatureId = nullptr ) |
Adds a ring to polygon/multipolygon features.
| ring | ring to add |
| targetFeatureIds | if specified, only these features will be the candidates for adding a ring. Otherwise all intersecting features are tested and the ring is added to the first valid feature. |
| modifiedFeatureId | if specified, feature ID for feature that ring was added to will be stored in this parameter |
Definition at line 319 of file qgsvectorlayereditutils.cpp.
| Qgis::GeometryOperationResult QgsVectorLayerEditUtils::addRing | ( | const QVector< QgsPointXY > & | ring, |
| const QgsFeatureIds & | targetFeatureIds = QgsFeatureIds(), | ||
| QgsFeatureId * | modifiedFeatureId = nullptr ) |
Adds a ring to polygon/multipolygon features.
| ring | ring to add |
| targetFeatureIds | if specified, only these features will be the candidates for adding a ring. Otherwise all intersecting features are tested and the ring is added to the first valid feature. |
| modifiedFeatureId | if specified, feature ID for feature that ring was added to will be stored in this parameter |
Definition at line 309 of file qgsvectorlayereditutils.cpp.
| Qgis::GeometryOperationResult QgsVectorLayerEditUtils::addRing | ( | QgsCurve * | ring, |
| const QgsFeatureIds & | targetFeatureIds = QgsFeatureIds(), | ||
| QgsFeatureId * | modifiedFeatureId = nullptr ) |
Adds a ring to polygon/multipolygon features.
| ring | ring to add |
| targetFeatureIds | if specified, only these features will be the candidates for adding a ring. Otherwise all intersecting features are tested and the ring is added to the first valid feature. |
| modifiedFeatureId | if specified, feature ID for feature that ring was added to will be stored in this parameter |
Definition at line 325 of file qgsvectorlayereditutils.cpp.
| Qgis::GeometryOperationResult QgsVectorLayerEditUtils::addRingV2 | ( | QgsCurve * | ring, |
| const QgsFeatureIds & | targetFeatureIds = QgsFeatureIds(), | ||
| QgsFeatureIds * | modifiedFeatureIds = nullptr ) |
Adds a ring to polygon/multipolygon features.
| ring | ring to add (ownership is transferred) |
| targetFeatureIds | if specified, only these features will be the candidates for adding a ring. Otherwise all intersecting features are tested and the ring is added to all valid features. |
| modifiedFeatureIds | if specified, feature IDS for features that ring was added to will be stored in this parameter |
Definition at line 339 of file qgsvectorlayereditutils.cpp.
| int QgsVectorLayerEditUtils::addTopologicalPoints | ( | const QgsGeometry & | geom | ) |
Adds topological points for every vertex of the geometry.
| geom | the geometry where each vertex is added to segments of other features |
Definition at line 918 of file qgsvectorlayereditutils.cpp.
| int QgsVectorLayerEditUtils::addTopologicalPoints | ( | const QgsPoint & | p | ) |
Adds a vertex to segments which intersect point p but don't already have a vertex there.
If a feature already has a vertex at position p, no additional vertex is inserted. This method is useful for topological editing.
Definition at line 943 of file qgsvectorlayereditutils.cpp.
| int QgsVectorLayerEditUtils::addTopologicalPoints | ( | const QgsPointSequence & | ps | ) |
Adds a vertex to segments which intersect point p but don't already have a vertex there.
If a feature already has a vertex at position p, no additional vertex is inserted. This method is useful for topological editing.
Definition at line 973 of file qgsvectorlayereditutils.cpp.
| int QgsVectorLayerEditUtils::addTopologicalPoints | ( | const QgsPointXY & | p | ) |
Adds a vertex to segments which intersect point p but don't already have a vertex there.
If a feature already has a vertex at position p, no additional vertex is inserted. This method is useful for topological editing.
Definition at line 998 of file qgsvectorlayereditutils.cpp.
| Qgis::VectorEditResult QgsVectorLayerEditUtils::deleteVertex | ( | QgsFeatureId | featureId, |
| int | vertex ) |
Deletes a vertex from a feature.
| featureId | ID of feature to remove vertex from |
| vertex | index of vertex to delete |
Definition at line 116 of file qgsvectorlayereditutils.cpp.
| Qgis::VectorEditResult QgsVectorLayerEditUtils::deleteVertices | ( | QgsFeatureId | featureId, |
| const QSet< int > & | vertices ) |
Deletes a set of vertices from a feature.
| featureId | ID of feature to remove vertices from |
| vertices | set of vertex indices to delete |
Definition at line 121 of file qgsvectorlayereditutils.cpp.
| bool QgsVectorLayerEditUtils::insertVertex | ( | const QgsPoint & | point, |
| QgsFeatureId | atFeatureId, | ||
| int | beforeVertex ) |
Inserts a new vertex before the given vertex number, in the given ring, item (first number is index 0), and feature Not meaningful for Point geometries.
Definition at line 62 of file qgsvectorlayereditutils.cpp.
| bool QgsVectorLayerEditUtils::insertVertex | ( | double | x, |
| double | y, | ||
| QgsFeatureId | atFeatureId, | ||
| int | beforeVertex ) |
Insert a new vertex before the given vertex number, in the given ring, item (first number is index 0), and feature Not meaningful for Point geometries.
Definition at line 45 of file qgsvectorlayereditutils.cpp.
| bool QgsVectorLayerEditUtils::mergeFeatures | ( | const QgsFeatureId & | targetFeatureId, |
| const QgsFeatureIds & | mergeFeatureIds, | ||
| const QgsAttributes & | mergeAttributes, | ||
| const QgsGeometry & | unionGeometry, | ||
| QString & | errorMessage ) |
Merge features into a single one.
| targetFeatureId | id of the target feature (will be updated) |
| mergeFeatureIds | id list of features to merge (will be deleted) |
| mergeAttributes | are the resulting attributes in the merged feature |
| unionGeometry | is the resulting geometry of the merged feature |
| errorMessage | will be set to a descriptive error message if any occurs |
true if the merge was successful, or false if the operation failed.Definition at line 1003 of file qgsvectorlayereditutils.cpp.
| bool QgsVectorLayerEditUtils::moveVertex | ( | const QgsPoint & | p, |
| QgsFeatureId | atFeatureId, | ||
| int | atVertex ) |
Moves the vertex at the given position number, ring and item (first number is index 0), and feature to the given coordinates.
Definition at line 85 of file qgsvectorlayereditutils.cpp.
| bool QgsVectorLayerEditUtils::moveVertex | ( | double | x, |
| double | y, | ||
| QgsFeatureId | atFeatureId, | ||
| int | atVertex ) |
Moves the vertex at the given position number, ring and item (first number is index 0), and feature to the given coordinates.
Definition at line 79 of file qgsvectorlayereditutils.cpp.
| Qgis::GeometryOperationResult QgsVectorLayerEditUtils::splitFeatures | ( | const QgsCurve * | curve, |
| QgsPointSequence & | topologyTestPoints, | ||
| bool | preserveCircular = false, | ||
| bool | topologicalEditing = false ) |
Splits features cut by the given curve.
| curve | line that splits the layer features | |
| [out] | topologyTestPoints | topological points to be tested against other layers. Points from curve geometries are not yet fully supported. |
| preserveCircular | whether if circular strings are reconstructed from segmentized geometries after splitting. From GEOS 3.15 on, this parameter is unused, and circular strings are preserved. | |
| topologicalEditing | true if topological editing is enabled |
Definition at line 518 of file qgsvectorlayereditutils.cpp.
| Qgis::GeometryOperationResult QgsVectorLayerEditUtils::splitFeatures | ( | const QgsPointSequence & | splitLine, |
| bool | topologicalEditing = false ) |
Splits features cut by the given line.
| splitLine | line that splits the layer features |
| topologicalEditing | true if topological editing is enabled |
Definition at line 510 of file qgsvectorlayereditutils.cpp.
| Qgis::GeometryOperationResult QgsVectorLayerEditUtils::splitFeatures | ( | const QVector< QgsPointXY > & | splitLine, |
| bool | topologicalEditing = false ) |
Splits features cut by the given line.
| splitLine | line that splits the layer features |
| topologicalEditing | true if topological editing is enabled |
Definition at line 500 of file qgsvectorlayereditutils.cpp.
| Qgis::GeometryOperationResult QgsVectorLayerEditUtils::splitParts | ( | const QgsPointSequence & | splitLine, |
| bool | topologicalEditing = false ) |
Splits parts cut by the given line.
| splitLine | line that splits the layer feature parts |
| topologicalEditing | true if topological editing is enabled |
Definition at line 798 of file qgsvectorlayereditutils.cpp.
| Qgis::GeometryOperationResult QgsVectorLayerEditUtils::splitParts | ( | const QVector< QgsPointXY > & | splitLine, |
| bool | topologicalEditing = false ) |
Splits parts cut by the given line.
| splitLine | line that splits the layer feature parts |
| topologicalEditing | true if topological editing is enabled |
QgsGeometry::SplitCannotSplitPoint
Definition at line 788 of file qgsvectorlayereditutils.cpp.
| int QgsVectorLayerEditUtils::translateFeature | ( | QgsFeatureId | featureId, |
| double | dx, | ||
| double | dy ) |
Translates feature by dx, dy.
| featureId | id of the feature to translate |
| dx | translation of x-coordinate |
| dy | translation of y-coordinate |
Definition at line 481 of file qgsvectorlayereditutils.cpp.