QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Public Member Functions | List of all members
QgsVectorLayerEditUtils Class Reference

#include <qgsvectorlayereditutils.h>

Public Member Functions

 QgsVectorLayerEditUtils (QgsVectorLayer *layer)
 
QgsGeometry::OperationResult addPart (const QList< QgsPointXY > &ring, QgsFeatureId featureId)
 Adds a new part polygon to a multipart feature. More...
 
QgsGeometry::OperationResult addPart (const QgsPointSequence &ring, QgsFeatureId featureId)
 Adds a new part polygon to a multipart feature. More...
 
QgsGeometry::OperationResult addPart (QgsCurve *ring, QgsFeatureId featureId)
 Adds a new part polygon to a multipart feature. More...
 
QgsGeometry::OperationResult addRing (const QVector< QgsPointXY > &ring, const QgsFeatureIds &targetFeatureIds=QgsFeatureIds(), QgsFeatureId *modifiedFeatureId=nullptr)
 Adds a ring to polygon/multipolygon features. More...
 
QgsGeometry::OperationResult addRing (QgsCurve *ring, const QgsFeatureIds &targetFeatureIds=QgsFeatureIds(), QgsFeatureId *modifiedFeatureId=nullptr)
 Adds a ring to polygon/multipolygon features. More...
 
int addTopologicalPoints (const QgsGeometry &geom)
 Adds topological points for every vertex of the geometry. More...
 
int addTopologicalPoints (const QgsPointXY &p)
 Adds a vertex to segments which intersect point p but don't already have a vertex there. More...
 
QgsVectorLayer::EditResult deleteVertex (QgsFeatureId featureId, int vertex)
 Deletes a vertex from a feature. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
QgsGeometry::OperationResult splitFeatures (const QVector< QgsPointXY > &splitLine, bool topologicalEditing=false)
 Splits features cut by the given line. More...
 
QgsGeometry::OperationResult splitParts (const QVector< QgsPointXY > &splitLine, bool topologicalEditing=false)
 Splits parts cut by the given line. More...
 
int translateFeature (QgsFeatureId featureId, double dx, double dy)
 Translates feature by dx, dy. More...
 

Detailed Description

Definition at line 31 of file qgsvectorlayereditutils.h.

Constructor & Destructor Documentation

QgsVectorLayerEditUtils::QgsVectorLayerEditUtils ( QgsVectorLayer layer)

Definition at line 33 of file qgsvectorlayereditutils.cpp.

Member Function Documentation

QgsGeometry::OperationResult QgsVectorLayerEditUtils::addPart ( const QList< QgsPointXY > &  ring,
QgsFeatureId  featureId 
)

Adds a new part polygon to a multipart feature.

Returns
- QgsGeometry::Success

Definition at line 176 of file qgsvectorlayereditutils.cpp.

QgsGeometry::OperationResult QgsVectorLayerEditUtils::addPart ( const QgsPointSequence ring,
QgsFeatureId  featureId 
)

Adds a new part polygon to a multipart feature.

Returns
- QgsGeometry::Success
Note
available in python bindings as addPartV2

Definition at line 186 of file qgsvectorlayereditutils.cpp.

QgsGeometry::OperationResult QgsVectorLayerEditUtils::addPart ( QgsCurve ring,
QgsFeatureId  featureId 
)

Adds a new part polygon to a multipart feature.

Returns
- QgsGeometry::Success
Note
available in python bindings as addCurvedPart

Definition at line 221 of file qgsvectorlayereditutils.cpp.

QgsGeometry::OperationResult QgsVectorLayerEditUtils::addRing ( const QVector< QgsPointXY > &  ring,
const QgsFeatureIds targetFeatureIds = QgsFeatureIds(),
QgsFeatureId modifiedFeatureId = nullptr 
)

Adds a ring to polygon/multipolygon features.

Parameters
ringring to add
targetFeatureIdsif 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.
modifiedFeatureIdif specified, feature ID for feature that ring was added to will be stored in this parameter
Returns
OperationResult result code: success or reason of failure

Definition at line 120 of file qgsvectorlayereditutils.cpp.

QgsGeometry::OperationResult QgsVectorLayerEditUtils::addRing ( QgsCurve ring,
const QgsFeatureIds targetFeatureIds = QgsFeatureIds(),
QgsFeatureId modifiedFeatureId = nullptr 
)

Adds a ring to polygon/multipolygon features.

Parameters
ringring to add
targetFeatureIdsif 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.
modifiedFeatureIdif specified, feature ID for feature that ring was added to will be stored in this parameter
Returns
OperationResult result code: success or reason of failure
Note
available in python bindings as addCurvedRing

Definition at line 126 of file qgsvectorlayereditutils.cpp.

int QgsVectorLayerEditUtils::addTopologicalPoints ( const QgsGeometry geom)

Adds topological points for every vertex of the geometry.

Parameters
geomthe geometry where each vertex is added to segments of other features
Returns
0 in case of success
Note
geom is not going to be modified by the function

Definition at line 504 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.

Parameters
pposition of the vertex
Returns
0 in case of success

Definition at line 610 of file qgsvectorlayereditutils.cpp.

QgsVectorLayer::EditResult QgsVectorLayerEditUtils::deleteVertex ( QgsFeatureId  featureId,
int  vertex 
)

Deletes a vertex from a feature.

Parameters
featureIdID of feature to remove vertex from
vertexindex of vertex to delete
Since
QGIS 2.14

Definition at line 96 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 38 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 55 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 72 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.

Note
available in Python bindings as moveVertexV2

Definition at line 78 of file qgsvectorlayereditutils.cpp.

QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitFeatures ( const QVector< QgsPointXY > &  splitLine,
bool  topologicalEditing = false 
)

Splits features cut by the given line.

Parameters
splitLineline that splits the layer features
topologicalEditingtrue if topological editing is enabled
Returns
0 in case of success, 4 if there is a selection but no feature split

Definition at line 277 of file qgsvectorlayereditutils.cpp.

QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitParts ( const QVector< QgsPointXY > &  splitLine,
bool  topologicalEditing = false 
)

Splits parts cut by the given line.

Parameters
splitLineline that splits the layer feature parts
topologicalEditingtrue if topological editing is enabled
Returns
- QgsGeometry::InvalidBaseGeometry

Definition at line 387 of file qgsvectorlayereditutils.cpp.

int QgsVectorLayerEditUtils::translateFeature ( QgsFeatureId  featureId,
double  dx,
double  dy 
)

Translates feature by dx, dy.

Parameters
featureIdid of the feature to translate
dxtranslation of x-coordinate
dytranslation of y-coordinate
Returns
0 in case of success

Definition at line 257 of file qgsvectorlayereditutils.cpp.


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