QGIS API Documentation  2.13.0-Master
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:
29 
31 
32  inline QgsGeometryCache* cache() { return L->cache(); }
33 
34 
39  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
40 
45  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
46 
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 
78  int addRing( const QList<QgsPoint>& ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = nullptr );
79 
92  int addRing( QgsCurveV2* ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = nullptr );
93 
103  int addPart( const QList<QgsPoint>& ring, QgsFeatureId featureId );
104 
105  int addPart( QgsCurveV2* ring, QgsFeatureId featureId );
106 
112  int translateFeature( QgsFeatureId featureId, double dx, double dy );
113 
121  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
122 
130  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
131 
137  int addTopologicalPoints( const QgsGeometry *geom );
138 
146  int addTopologicalPoints( const QgsPoint& p );
147 
153  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
154 
155  protected:
156 
159  int boundingBoxFromPointList( const QList<QgsPoint>& list, double& xmin, double& ymin, double& xmax, double& ymax ) const;
160 
162 };
163 
164 #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.