QGIS API Documentation  2.99.0-Master (7fe5405)
qgsvectorlayereditutils.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectorlayereditutils.h
3  ---------------------
4  begin : Dezember 2012
5  copyright : (C) 2012 by Martin Dobias
6  email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSVECTORLAYEREDITUTILS_H
16 #define QGSVECTORLAYEREDITUTILS_H
17 
18 
19 #include "qgis_core.h"
20 #include "qgsfeature.h"
21 
22 #include "qgsvectorlayer.h"
23 #include "qgsgeometry.h"
24 
25 class QgsGeometryCache;
26 class QgsCurve;
27 
31 class CORE_EXPORT QgsVectorLayerEditUtils
32 {
33  public:
35 
36  inline QgsGeometryCache* cache() { return L->cache(); }
37 
38 
43  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
44 
49  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
50 
56  bool moveVertex( const QgsPointV2& p, QgsFeatureId atFeatureId, int atVertex );
57 
63  QgsVectorLayer::EditResult deleteVertex( QgsFeatureId featureId, int vertex );
64 
78  // TODO QGIS 3.0 returns an enum instead of a magic constant
79  int addRing( const QList<QgsPoint>& ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = nullptr );
80 
95  // TODO QGIS 3.0 returns an enum instead of a magic constant
96  int addRing( QgsCurve* ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = nullptr );
97 
108  // TODO QGIS 3.0 returns an enum instead of a magic constant
109  int addPart( const QList<QgsPoint>& ring, QgsFeatureId featureId );
110 
122  // TODO QGIS 3.0 returns an enum instead of a magic constant
123  int addPart( const QgsPointSequence &ring, QgsFeatureId featureId );
124 
125  // @note available in python bindings as addCurvedPart
126  // TODO QGIS 3.0 returns an enum instead of a magic constant
127  int addPart( QgsCurve* ring, QgsFeatureId featureId );
128 
135  int translateFeature( QgsFeatureId featureId, double dx, double dy );
136 
144  // TODO QGIS 3.0 returns an enum instead of a magic constant
145  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
146 
154  // TODO QGIS 3.0 returns an enum instead of a magic constant
155  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
156 
162  int addTopologicalPoints( const QgsGeometry& geom );
163 
171  int addTopologicalPoints( const QgsPoint& p );
172 
178  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
179 
180  protected:
181 
184  int boundingBoxFromPointList( const QList<QgsPoint>& list, double& xmin, double& ymin, double& xmax, double& ymax ) const;
185 
187 };
188 
189 #endif // QGSVECTORLAYEREDITUTILS_H
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:348
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:79
Point geometry type, with support for z-dimension and m-values.
Definition: qgspointv2.h:36
Abstract base class for curved geometry type.
Definition: qgscurve.h:33
A class to represent a point.
Definition: qgspoint.h:143
qint64 QgsFeatureId
Definition: qgsfeature.h:33
QList< QgsPointV2 > QgsPointSequence
Represents a vector layer which manages a vector based data sets.
EditResult
Result of an edit operation.