QGIS API Documentation
3.18.1-Zürich (202f1bf7e5)
|
Methods in this class are used to handle basic operations on vector layers. More...
#include <qgsvectorlayertools.h>
Public Member Functions | |
QgsVectorLayerTools () | |
virtual bool | addFeature (QgsVectorLayer *layer, const QgsAttributeMap &defaultValues=QgsAttributeMap(), const QgsGeometry &defaultGeometry=QgsGeometry(), QgsFeature *feature=nullptr) const =0 |
This method should/will be called, whenever a new feature will be added to the layer. More... | |
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. More... | |
bool | forceSuppressFormPopup () const |
Returns force suppress form popup status. More... | |
virtual bool | saveEdits (QgsVectorLayer *layer) const =0 |
Should be called, when the features should be committed but the editing session is not ended. More... | |
void | setForceSuppressFormPopup (bool forceSuppressFormPopup) |
Sets force suppress form popup status to forceSuppressFormPopup. More... | |
virtual bool | startEditing (QgsVectorLayer *layer) const =0 |
This will be called, whenever a vector layer should be switched to edit mode. More... | |
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. More... | |
Methods in this class are used to handle basic operations on vector layers.
With an implementation of this class, parts of the application can ask for an operation to be done and the implementation will then take care of it.
Reimplement this class, if you need to have custom checks or GUI elements in your application.
Definition at line 39 of file qgsvectorlayertools.h.
QgsVectorLayerTools::QgsVectorLayerTools | ( | ) |
Definition at line 24 of file qgsvectorlayertools.cpp.
|
pure virtual |
This method should/will be called, whenever a new feature will be added to the layer.
layer | The layer to which the feature should be added |
defaultValues | Default values for the feature to add |
defaultGeometry | A default geometry to add to the feature |
feature | Updated feature after adding will be written back to this |
true
in case of success, false
if the operation failed/was aborted Implemented in QgsTrackedVectorLayerTools.
|
virtual |
Copy and move features with defined translation.
layer | The layer |
request | The request for the features to be moved. It will be assigned to a new feature request with the newly copied features. |
dx | The translation on x |
dy | The translation on y |
errorMsg | If given, it will contain the error message |
topologicalEditing | If true , the function will perform topological editing of the vertices of layer on layer and topologicalLayer |
topologicalLayer | The layer where vertices from the moved features of layer will be added |
true
if all features could be copied. Reimplemented in QgsTrackedVectorLayerTools.
Definition at line 28 of file qgsvectorlayertools.cpp.
bool QgsVectorLayerTools::forceSuppressFormPopup | ( | ) | const |
Returns force suppress form popup status.
true
if force suppress form popup is set. Definition at line 110 of file qgsvectorlayertools.cpp.
|
pure virtual |
Should be called, when the features should be committed but the editing session is not ended.
layer | The layer to commit |
true
if successful Implemented in QgsTrackedVectorLayerTools.
void QgsVectorLayerTools::setForceSuppressFormPopup | ( | bool | forceSuppressFormPopup | ) |
Sets force suppress form popup status to forceSuppressFormPopup.
This flag will override the layer and general settings regarding the automatic opening of the attribute form dialog when digitizing is completed.
Definition at line 115 of file qgsvectorlayertools.cpp.
|
pure virtual |
This will be called, whenever a vector layer should be switched to edit mode.
Check the providers capability to edit in here. If successful layer->startEditing() will be called and true
returned.
layer | The layer on which to start an edit session |
true
, if the editing session was started Implemented in QgsTrackedVectorLayerTools.
|
pure virtual |
Will be called, when an editing session is ended and the features should be committed.
Appropriate dialogs should be shown like
layer | The layer to commit |
allowCancel | true if a cancel button should be offered |
true
if successful Implemented in QgsTrackedVectorLayerTools.