QGIS API Documentation  2.14.0-Essen
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 
26 class CORE_EXPORT QgsVectorLayerEditUtils
27 {
28  public:
30 
31  inline QgsGeometryCache* cache() { return L->cache(); }
32 
33 
38  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
39 
44  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
45 
51  bool moveVertex( const QgsPointV2& p, QgsFeatureId atFeatureId, int atVertex );
52 
56  Q_DECL_DEPRECATED bool deleteVertex( QgsFeatureId atFeatureId, int atVertex );
57 
63  //TODO QGIS 3.0 - rename to deleteVertex
64  QgsVectorLayer::EditResult deleteVertexV2( QgsFeatureId featureId, int vertex );
65 
79  // TODO QGIS 3.0 returns an enum instead of a magic constant
80  int addRing( const QList<QgsPoint>& ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = nullptr );
81 
96  // TODO QGIS 3.0 returns an enum instead of a magic constant
97  int addRing( QgsCurveV2* ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = nullptr );
98 
109  // TODO QGIS 3.0 returns an enum instead of a magic constant
110  int addPart( const QList<QgsPoint>& ring, QgsFeatureId featureId );
111 
123  // TODO QGIS 3.0 returns an enum instead of a magic constant
124  int addPart( const QgsPointSequenceV2 &ring, QgsFeatureId featureId );
125 
126  // @note available in python bindings as addCurvedPart
127  // TODO QGIS 3.0 returns an enum instead of a magic constant
128  int addPart( QgsCurveV2* ring, QgsFeatureId featureId );
129 
136  int translateFeature( QgsFeatureId featureId, double dx, double dy );
137 
145  // TODO QGIS 3.0 returns an enum instead of a magic constant
146  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
147 
155  // TODO QGIS 3.0 returns an enum instead of a magic constant
156  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
157 
163  int addTopologicalPoints( const QgsGeometry *geom );
164 
172  int addTopologicalPoints( const QgsPoint& p );
173 
179  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
180 
181  protected:
182 
185  int boundingBoxFromPointList( const QList<QgsPoint>& list, double& xmin, double& ymin, double& xmax, double& ymax ) const;
186 
188 };
189 
190 #endif // QGSVECTORLAYEREDITUTILS_H
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:433
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:65
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.