QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 "qgsfeature.h"
20 
21 #include "qgsvectorlayer.h"
22 
23 class QgsGeometryCache;
24 class QgsCurveV2;
25 
29 class CORE_EXPORT QgsVectorLayerEditUtils
30 {
31  public:
33 
34  inline QgsGeometryCache* cache() { return L->cache(); }
35 
36 
41  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
42 
47  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
48 
54  bool moveVertex( const QgsPointV2& p, QgsFeatureId atFeatureId, int atVertex );
55 
59  Q_DECL_DEPRECATED bool deleteVertex( QgsFeatureId atFeatureId, int atVertex );
60 
66  //TODO QGIS 3.0 - rename to deleteVertex
67  QgsVectorLayer::EditResult deleteVertexV2( QgsFeatureId featureId, int vertex );
68 
82  // TODO QGIS 3.0 returns an enum instead of a magic constant
83  int addRing( const QList<QgsPoint>& ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = nullptr );
84 
99  // TODO QGIS 3.0 returns an enum instead of a magic constant
100  int addRing( QgsCurveV2* ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = nullptr );
101 
112  // TODO QGIS 3.0 returns an enum instead of a magic constant
113  int addPart( const QList<QgsPoint>& ring, QgsFeatureId featureId );
114 
126  // TODO QGIS 3.0 returns an enum instead of a magic constant
127  int addPart( const QgsPointSequenceV2 &ring, QgsFeatureId featureId );
128 
129  // @note available in python bindings as addCurvedPart
130  // TODO QGIS 3.0 returns an enum instead of a magic constant
131  int addPart( QgsCurveV2* ring, QgsFeatureId featureId );
132 
139  int translateFeature( QgsFeatureId featureId, double dx, double dy );
140 
148  // TODO QGIS 3.0 returns an enum instead of a magic constant
149  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
150 
158  // TODO QGIS 3.0 returns an enum instead of a magic constant
159  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
160 
166  int addTopologicalPoints( const QgsGeometry *geom );
167 
175  int addTopologicalPoints( const QgsPoint& p );
176 
182  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
183 
184  protected:
185 
188  int boundingBoxFromPointList( const QList<QgsPoint>& list, double& xmin, double& ymin, double& xmax, double& ymax ) const;
189 
191 };
192 
193 #endif // QGSVECTORLAYEREDITUTILS_H
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:439
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:76
Point geometry type, with support for z-dimension and m-values.
Definition: qgspointv2.h:34
A class to represent a point.
Definition: qgspoint.h:117
qint64 QgsFeatureId
Definition: qgsfeature.h:31
Abstract base class for curved geometry type.
Definition: qgscurvev2.h:32
Represents a vector layer which manages a vector based data sets.
EditResult
Result of an edit operation.