QGIS API Documentation  2.11.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
64  int addRing( const QList<QgsPoint>& ring );
65 
74  int addRing( QgsCurveV2* ring );
75 
85  int addPart( const QList<QgsPoint>& ring, QgsFeatureId featureId );
86 
87  int addPart( QgsCurveV2* ring, QgsFeatureId featureId );
88 
94  int translateFeature( QgsFeatureId featureId, double dx, double dy );
95 
103  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
104 
112  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
113 
119  int addTopologicalPoints( const QgsGeometry *geom );
120 
128  int addTopologicalPoints( const QgsPoint& p );
129 
135  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
136 
137  protected:
138 
141  int boundingBoxFromPointList( const QList<QgsPoint>& list, double& xmin, double& ymin, double& xmax, double& ymax ) const;
142 
144 };
145 
146 #endif // QGSVECTORLAYEREDITUTILS_H
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:75
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.