QGIS API Documentation  2.99.0-Master (b95d432)
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 "qgis.h"
21 #include "qgsfeature.h"
22 
23 #include "qgsvectorlayer.h"
24 #include "qgsgeometry.h"
25 
26 class QgsCurve;
27 
31 class CORE_EXPORT QgsVectorLayerEditUtils
32 {
33  public:
35 
40  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
41 
46  bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex );
47 
52  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
53 
59  bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 );
60 
66  QgsVectorLayer::EditResult deleteVertex( QgsFeatureId featureId, int vertex );
67 
81  // TODO QGIS 3.0 returns an enum instead of a magic constant
82  int addRing( const QList<QgsPointXY> &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = nullptr );
83 
98  // TODO QGIS 3.0 returns an enum instead of a magic constant
99  int addRing( QgsCurve *ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = nullptr ) SIP_PYNAME( addCurvedRing );
100 
111  // TODO QGIS 3.0 returns an enum instead of a magic constant
112  int addPart( const QList<QgsPointXY> &ring, QgsFeatureId featureId );
113 
125  // TODO QGIS 3.0 returns an enum instead of a magic constant
126  int addPart( const QgsPointSequence &ring, QgsFeatureId featureId );
127 
129  // TODO QGIS 3.0 returns an enum instead of a magic constant
130  int addPart( QgsCurve *ring, QgsFeatureId featureId ) SIP_PYNAME( addCurvedPart );
131 
138  int translateFeature( QgsFeatureId featureId, double dx, double dy );
139 
147  // TODO QGIS 3.0 returns an enum instead of a magic constant
148  int splitParts( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
149 
157  // TODO QGIS 3.0 returns an enum instead of a magic constant
158  int splitFeatures( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
159 
165  int addTopologicalPoints( const QgsGeometry &geom );
166 
174  int addTopologicalPoints( const QgsPointXY &p );
175 
176  protected:
177 
180  int boundingBoxFromPointList( const QList<QgsPointXY> &list, double &xmin, double &ymin, double &xmax, double &ymax ) const;
181 
182  private:
183 
184  QgsVectorLayer *L = nullptr;
185 };
186 
187 #endif // QGSVECTORLAYEREDITUTILS_H
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:519
A class to represent a 2D point.
Definition: qgspointxy.h:42
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:96
Abstract base class for curved geometry type.
Definition: qgscurve.h:34
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:36
qint64 QgsFeatureId
Definition: qgsfeature.h:37
QList< QgsPoint > QgsPointSequence
Represents a vector layer which manages a vector based data sets.
EditResult
Result of an edit operation.
#define SIP_PYNAME(name)
Definition: qgis_sip.h:74