QGIS API Documentation 3.43.0-Master (c67cf405802)
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 : matthias@opengis.ch
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"
22
29{
30 Q_OBJECT
31 public:
32
34
46 bool addFeatureV2( QgsVectorLayer *layer, const QgsAttributeMap &defaultValues, const QgsGeometry &defaultGeometry, QgsFeature *feature SIP_OUT, const QgsVectorLayerToolsContext &context ) const override;
47 bool startEditing( QgsVectorLayer *layer ) const override;
48 bool stopEditing( QgsVectorLayer *layer, bool allowCancel ) const override;
49 bool saveEdits( QgsVectorLayer *layer ) const override;
50 bool copyMoveFeatures( QgsVectorLayer *layer, QgsFeatureRequest &request, double dx = 0, double dy = 0, QString *errorMsg = nullptr, const bool topologicalEditing = false, QgsVectorLayer *topologicalLayer = nullptr, QString *childrenInfoMsg = nullptr ) const override;
51
55 void setVectorLayerTools( const QgsVectorLayerTools *tools );
56
60 void rollback();
61
62 private:
63
64 const QgsVectorLayerTools *mBackend = nullptr;
65 // TODO QGIS3: remove mutable once methods are no longer const
66 mutable QMap<QgsVectorLayer *, QgsFeatureIds> mAddedFeatures;
67};
68
69#endif // QGSTRACKEDVECTORLAYERTOOLS_H
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:58
A geometry is the spatial representation of a feature.
Vector layer tools subclass which "tracks" edits.
QgsTrackedVectorLayerTools()=default
Contains settings which reflect the context in which vector layer tool operations should be considere...
Used to handle basic editing 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, QString *childrenInfoMsg=nullptr) const
Copy and move features with defined translation.
virtual bool addFeatureV2(QgsVectorLayer *layer, const QgsAttributeMap &defaultValues=QgsAttributeMap(), const QgsGeometry &defaultGeometry=QgsGeometry(), QgsFeature *feature=nullptr, const QgsVectorLayerToolsContext &context=QgsVectorLayerToolsContext()) const
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 dataset.
#define SIP_OUT
Definition qgis_sip.h:58
QMap< int, QVariant > QgsAttributeMap