QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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_sip.h"
21 #include "qgsfeatureid.h"
22 #include "qgsvectorlayer.h"
23 
24 class QgsCurve;
25 class QgsGeometry;
26 
31 class CORE_EXPORT QgsVectorLayerEditUtils
32 {
33  public:
35 
41  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
42 
48  bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex );
49 
55  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
56 
63  bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 );
64 
71  Qgis::VectorEditResult deleteVertex( QgsFeatureId featureId, int vertex );
72 
82  Q_DECL_DEPRECATED Qgis::GeometryOperationResult addRing( const QVector<QgsPointXY> &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = nullptr ) SIP_DEPRECATED;
83 
92  Qgis::GeometryOperationResult addRing( const QgsPointSequence &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = nullptr );
93 
103  Qgis::GeometryOperationResult addRing( QgsCurve *ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = nullptr ) SIP_PYNAME( addCurvedRing );
104 
116  Q_DECL_DEPRECATED Qgis::GeometryOperationResult addPart( const QVector<QgsPointXY> &ring, QgsFeatureId featureId ) SIP_DEPRECATED;
117 
130  Qgis::GeometryOperationResult addPart( const QgsPointSequence &ring, QgsFeatureId featureId );
131 
144  Qgis::GeometryOperationResult addPart( QgsCurve *ring, QgsFeatureId featureId ) SIP_PYNAME( addCurvedPart );
145 
153  int translateFeature( QgsFeatureId featureId, double dx, double dy );
154 
170  Q_DECL_DEPRECATED Qgis::GeometryOperationResult splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) SIP_DEPRECATED;
171 
185  Qgis::GeometryOperationResult splitParts( const QgsPointSequence &splitLine, bool topologicalEditing = false );
186 
194  Q_DECL_DEPRECATED Qgis::GeometryOperationResult splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) SIP_DEPRECATED;
195 
202  Qgis::GeometryOperationResult splitFeatures( const QgsPointSequence &splitLine, bool topologicalEditing = false );
203 
213  Qgis::GeometryOperationResult splitFeatures( const QgsCurve *curve, QgsPointSequence &topologyTestPoints SIP_OUT, bool preserveCircular = false, bool topologicalEditing = false );
214 
223  int addTopologicalPoints( const QgsGeometry &geom );
224 
234  int addTopologicalPoints( const QgsPointXY &p );
235 
246  int addTopologicalPoints( const QgsPoint &p );
247 
258  int addTopologicalPoints( const QgsPointSequence &ps );
259 
260  private:
261 
266  bool boundingBoxFromPointList( const QgsPointSequence &list, double &xmin, double &ymin, double &xmax, double &ymax ) const;
267 
268  QgsVectorLayer *mLayer = nullptr;
269 };
270 
271 #endif // QGSVECTORLAYEREDITUTILS_H
QgsCurve
Abstract base class for curved geometry type.
Definition: qgscurve.h:35
SIP_PYNAME
#define SIP_PYNAME(name)
Definition: qgis_sip.h:81
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:48
SIP_OUT
#define SIP_OUT
Definition: qgis_sip.h:58
qgsfeatureid.h
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
qgis_sip.h
Qgis::GeometryOperationResult
GeometryOperationResult
Success or failure of a geometry operation.
Definition: qgis.h:901
QgsFeatureIds
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeatureid.h:37
qgsvectorlayer.h
QgsPointXY
A class to represent a 2D point.
Definition: qgspointxy.h:58
QgsPointSequence
QVector< QgsPoint > QgsPointSequence
Definition: qgsabstractgeometry.h:52
QgsGeometry
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:124
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
Qgis::VectorEditResult
VectorEditResult
Specifies the result of a vector layer edit operation.
Definition: qgis.h:791
QgsVectorLayerEditUtils
Definition: qgsvectorlayereditutils.h:31
QgsFeatureId
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Definition: qgsfeatureid.h:28