QGIS API Documentation  2.12.0-Lyon
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 
50  bool moveVertex( const QgsPointV2& p, QgsFeatureId atFeatureId, int atVertex );
51 
54  bool deleteVertex( QgsFeatureId atFeatureId, int atVertex );
55 
68  int addRing( const QList<QgsPoint>& ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = 0 );
69 
82  int addRing( QgsCurveV2* ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = 0 );
83 
93  int addPart( const QList<QgsPoint>& ring, QgsFeatureId featureId );
94 
95  int addPart( QgsCurveV2* ring, QgsFeatureId featureId );
96 
102  int translateFeature( QgsFeatureId featureId, double dx, double dy );
103 
111  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
112 
120  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
121 
127  int addTopologicalPoints( const QgsGeometry *geom );
128 
136  int addTopologicalPoints( const QgsPoint& p );
137 
143  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
144 
145  protected:
146 
149  int boundingBoxFromPointList( const QList<QgsPoint>& list, double& xmin, double& ymin, double& xmax, double& ymax ) const;
150 
152 };
153 
154 #endif // QGSVECTORLAYEREDITUTILS_H
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:422
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:76
Point geometry type.
Definition: qgspointv2.h:29
A class to represent a point.
Definition: qgspoint.h:63
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.