QGIS API Documentation  3.25.0-Master (10b47c2603)
qgstrackedvectorlayertools.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstrackedvectorlayertools.h - QgsTrackedVectorLayerTools
3 
4  ---------------------
5  begin : 16.5.2016
6  copyright : (C) 2016 by Matthias Kuhn, OPENGIS.ch
7  email : [email protected]
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 #ifndef QGSTRACKEDVECTORLAYERTOOLS_H
17 #define QGSTRACKEDVECTORLAYERTOOLS_H
18 
19 #include "qgis_core.h"
20 #include "qgsvectorlayertools.h"
21 
27 {
28  Q_OBJECT
29  public:
30 
35 
49  bool addFeature( QgsVectorLayer *layer, const QgsAttributeMap &defaultValues, const QgsGeometry &defaultGeometry, QgsFeature *feature, QWidget *parentWidget = nullptr, bool showModal = true, bool hideParent = false ) const override;
50  bool startEditing( QgsVectorLayer *layer ) const override;
51  bool stopEditing( QgsVectorLayer *layer, bool allowCancel ) const override;
52  bool saveEdits( QgsVectorLayer *layer ) const override;
53  bool copyMoveFeatures( QgsVectorLayer *layer, QgsFeatureRequest &request, double dx = 0, double dy = 0, QString *errorMsg = nullptr, const bool topologicalEditing = false, QgsVectorLayer *topologicalLayer = nullptr ) const override;
54 
58  void setVectorLayerTools( const QgsVectorLayerTools *tools );
59 
63  void rollback();
64 
65  private:
66 
67  const QgsVectorLayerTools *mBackend = nullptr;
68  // TODO QGIS3: remove mutable once methods are no longer const
69  mutable QMap<QgsVectorLayer *, QgsFeatureIds> mAddedFeatures;
70 };
71 
72 #endif // QGSTRACKEDVECTORLAYERTOOLS_H
This class wraps a request for features to a vector layer (or directly its vector data provider).
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:56
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:125
QgsTrackedVectorLayerTools()=default
Constructor for QgsTrackedVectorLayerTools.
Methods in this class are used to handle basic operations on vector layers.
virtual bool startEditing(QgsVectorLayer *layer) const =0
This will be called, whenever a vector layer should be switched to edit mode.
virtual bool saveEdits(QgsVectorLayer *layer) const =0
Should be called, when the features should be committed but the editing session is not ended.
virtual bool copyMoveFeatures(QgsVectorLayer *layer, QgsFeatureRequest &request, double dx=0, double dy=0, QString *errorMsg=nullptr, const bool topologicalEditing=false, QgsVectorLayer *topologicalLayer=nullptr) const
Copy and move features with defined translation.
virtual bool addFeature(QgsVectorLayer *layer, const QgsAttributeMap &defaultValues=QgsAttributeMap(), const QgsGeometry &defaultGeometry=QgsGeometry(), QgsFeature *feature=nullptr, QWidget *parentWidget=nullptr, bool showModal=true, bool hideParent=false) const =0
This method should/will be called, whenever a new feature will be added to the layer.
virtual bool stopEditing(QgsVectorLayer *layer, bool allowCancel=true) const =0
Will be called, when an editing session is ended and the features should be committed.
Represents a vector layer which manages a vector based data sets.
QMap< int, QVariant > QgsAttributeMap
Definition: qgsattributes.h:38