QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgsvectorlayertools.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectorlayertools.h
3 --------------------------------------
4 Date : 29.5.2013
5 Copyright : (C) 2013 Matthias Kuhn
6 Email : matthias at opengis dot ch
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
16#ifndef QGSVECTORLAYERTOOLS_H
17#define QGSVECTORLAYERTOOLS_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
21#include <QObject>
22
23#include "qgsfeature.h"
24#include "qgsgeometry.h"
25
27class QgsVectorLayer;
28class QgsProject;
29
40class CORE_EXPORT QgsVectorLayerTools : public QObject
41{
42 Q_OBJECT
43
44 public:
46
47 // TODO QGIS 4: remove const qualifier
48
62 virtual bool addFeature( QgsVectorLayer *layer, const QgsAttributeMap &defaultValues = QgsAttributeMap(), const QgsGeometry &defaultGeometry = QgsGeometry(), QgsFeature *feature SIP_OUT = nullptr, QWidget *parentWidget = nullptr, bool showModal = true, bool hideParent = false ) const = 0;
63
64 // TODO QGIS 4: remove const qualifier
65
76 virtual bool startEditing( QgsVectorLayer *layer ) const = 0;
77
78 // TODO QGIS 4: remove const qualifier
79
89 virtual bool stopEditing( QgsVectorLayer *layer, bool allowCancel = true ) const = 0;
90
91 // TODO QGIS 4: remove const qualifier
92
100 virtual bool saveEdits( QgsVectorLayer *layer ) const = 0;
101
102 // TODO QGIS 4: remove const qualifier
103
119 virtual bool copyMoveFeatures( QgsVectorLayer *layer, QgsFeatureRequest &request SIP_INOUT, double dx = 0, double dy = 0, QString *errorMsg SIP_OUT = nullptr, const bool topologicalEditing = false, QgsVectorLayer *topologicalLayer = nullptr, QString *childrenInfoMsg = nullptr ) const;
120
127 bool forceSuppressFormPopup() const;
128
137 void setForceSuppressFormPopup( bool forceSuppressFormPopup );
138
144 void setProject( QgsProject *project ) { mProject = project; }
145
151 QgsProject *project() const { return mProject; }
152
153 private:
154
155 QgsProject *mProject = nullptr;
156 bool mForceSuppressFormPopup { false };
157
158
159};
160
161#endif // QGSVECTORLAYERTOOLS_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.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107
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.
QgsProject * project() const
Returns the project to be used by operations when needed.
void setProject(QgsProject *project)
Sets the project to be used by operations when needed.
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.
#define SIP_OUT
Definition qgis_sip.h:58
#define SIP_INOUT
Definition qgis_sip.h:71
QMap< int, QVariant > QgsAttributeMap