QGIS API Documentation 3.39.0-Master (52f98f8c831)
Loading...
Searching...
No Matches
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
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
28{
29 Q_OBJECT
30 public:
31
36
48 bool addFeatureV2( QgsVectorLayer *layer, const QgsAttributeMap &defaultValues, const QgsGeometry &defaultGeometry, QgsFeature *feature SIP_OUT, const QgsVectorLayerToolsContext &context ) const override;
49 bool startEditing( QgsVectorLayer *layer ) const override;
50 bool stopEditing( QgsVectorLayer *layer, bool allowCancel ) const override;
51 bool saveEdits( QgsVectorLayer *layer ) const override;
52 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;
53
57 void setVectorLayerTools( const QgsVectorLayerTools *tools );
58
62 void rollback();
63
64 private:
65
66 const QgsVectorLayerTools *mBackend = nullptr;
67 // TODO QGIS3: remove mutable once methods are no longer const
68 mutable QMap<QgsVectorLayer *, QgsFeatureIds> mAddedFeatures;
69};
70
71#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:58
A geometry is the spatial representation of a feature.
QgsTrackedVectorLayerTools()=default
Constructor for QgsTrackedVectorLayerTools.
Contains settings which reflect the context in which vector layer tool operations should consider.
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, 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 data sets.
#define SIP_OUT
Definition qgis_sip.h:58
QMap< int, QVariant > QgsAttributeMap