QGIS API Documentation  2.99.0-Master (c558d51)
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 #include "qgsgeometry.h"
23 
24 class QgsGeometryCache;
25 class QgsCurve;
26 
30 class CORE_EXPORT QgsVectorLayerEditUtils
31 {
32  public:
34 
35  inline QgsGeometryCache* cache() { return L->cache(); }
36 
37 
42  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
43 
48  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
49 
55  bool moveVertex( const QgsPointV2& p, QgsFeatureId atFeatureId, int atVertex );
56 
62  QgsVectorLayer::EditResult deleteVertex( QgsFeatureId featureId, int vertex );
63 
77  // TODO QGIS 3.0 returns an enum instead of a magic constant
78  int addRing( const QList<QgsPoint>& ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = nullptr );
79 
94  // TODO QGIS 3.0 returns an enum instead of a magic constant
95  int addRing( QgsCurve* ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = nullptr );
96 
107  // TODO QGIS 3.0 returns an enum instead of a magic constant
108  int addPart( const QList<QgsPoint>& ring, QgsFeatureId featureId );
109 
121  // TODO QGIS 3.0 returns an enum instead of a magic constant
122  int addPart( const QgsPointSequence &ring, QgsFeatureId featureId );
123 
124  // @note available in python bindings as addCurvedPart
125  // TODO QGIS 3.0 returns an enum instead of a magic constant
126  int addPart( QgsCurve* ring, QgsFeatureId featureId );
127 
134  int translateFeature( QgsFeatureId featureId, double dx, double dy );
135 
143  // TODO QGIS 3.0 returns an enum instead of a magic constant
144  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
145 
153  // TODO QGIS 3.0 returns an enum instead of a magic constant
154  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
155 
161  int addTopologicalPoints( const QgsGeometry& geom );
162 
170  int addTopologicalPoints( const QgsPoint& p );
171 
177  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
178 
179  protected:
180 
183  int boundingBoxFromPointList( const QList<QgsPoint>& list, double& xmin, double& ymin, double& xmax, double& ymax ) const;
184 
186 };
187 
188 #endif // QGSVECTORLAYEREDITUTILS_H
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:355
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:78
Point geometry type, with support for z-dimension and m-values.
Definition: qgspointv2.h:35
Abstract base class for curved geometry type.
Definition: qgscurve.h:32
A class to represent a point.
Definition: qgspoint.h:111
qint64 QgsFeatureId
Definition: qgsfeature.h:32
QList< QgsPointV2 > QgsPointSequence
Represents a vector layer which manages a vector based data sets.
EditResult
Result of an edit operation.