#include <qgsvectorlayerundocommand.h>
Public Types | |
typedef QMap< int, AttributeChangeEntry > | AttributeChanges |
Public Member Functions | |
QgsUndoCommand (QgsVectorLayer *layer, QString text) | |
void | undo () |
Necessary function to provide undo operation. | |
void | redo () |
Necessary function to provide redo operation. | |
void | storeGeometryChange (int featureId, QgsGeometry &original, QgsGeometry &target) |
Function to store changes in geometry to be returned to this state after undo/redo. | |
void | storeAttributeChange (int featureId, int field, QVariant original, QVariant target, bool isFirstChange) |
Stores changes of attributes for the feature to be returned to this state after undo/redo. | |
void | storeFeatureDelete (int featureId) |
Add id of feature to deleted list to be reverted if needed afterwards. | |
void | storeFeatureAdd (QgsFeature &feature) |
Add new feature to list of new features to be stored for undo/redo operations. | |
void | storeAttributeAdd (int index, const QgsField &value) |
Add new attribute to list of attributes to be used for attributes of features for undo/redo operations. | |
void | storeAttributeDelete (int index, const QgsField &orig) |
Add deleted attribute which is to be stored for undo/redo operations. | |
Private Attributes | |
bool | mFirstRun |
Variable to disable first run of undo, because it's automaticaly done after push. | |
QgsVectorLayer * | mLayer |
Layer on which operations should be performed. | |
QMap< int, GeometryChangeEntry > | mGeometryChange |
Map of changes of geometry for features it describes changes of geometry. | |
QMap< int, AttributeChanges > | mAttributeChange |
Map of changes of atrributes for features which describes changes of attributes. | |
QgsFeatureIds | mDeletedFeatureIdChange |
Deleted feature IDs which are not commited. | |
QgsFieldMap | mAddedAttributes |
added attributes fields which are not commited | |
QgsFieldMap | mDeletedAttributes |
deleted attributes fields which are not commited | |
QgsFeatureList | mAddedFeatures |
New features which are not commited. | |
Friends | |
class | QgsVectorLayer |
Classes | |
class | AttributeChangeEntry |
change structure for attribute for undo/redo purpose More... | |
class | GeometryChangeEntry |
change structure to geometry for undo/redo purpose More... |
Definition at line 28 of file qgsvectorlayerundocommand.h.
typedef QMap<int, AttributeChangeEntry> QgsUndoCommand::AttributeChanges |
Definition at line 41 of file qgsvectorlayerundocommand.h.
QgsUndoCommand::QgsUndoCommand | ( | QgsVectorLayer * | layer, | |
QString | text | |||
) |
void QgsUndoCommand::undo | ( | ) |
Necessary function to provide undo operation.
Definition at line 67 of file qgsvectorlayerundocommand.cpp.
References mLayer, and QgsVectorLayer::undoEditCommand().
void QgsUndoCommand::redo | ( | ) |
Necessary function to provide redo operation.
Definition at line 54 of file qgsvectorlayerundocommand.cpp.
References mFirstRun, mLayer, and QgsVectorLayer::redoEditCommand().
void QgsUndoCommand::storeGeometryChange | ( | int | featureId, | |
QgsGeometry & | original, | |||
QgsGeometry & | target | |||
) |
Function to store changes in geometry to be returned to this state after undo/redo.
featureId | id of feature edited | |
original | original geometry of feature which was changed | |
target | changed geometry which was changed |
Definition at line 73 of file qgsvectorlayerundocommand.cpp.
References mGeometryChange.
Referenced by QgsVectorLayer::editGeometryChange().
void QgsUndoCommand::storeAttributeChange | ( | int | featureId, | |
int | field, | |||
QVariant | original, | |||
QVariant | target, | |||
bool | isFirstChange | |||
) |
Stores changes of attributes for the feature to be returned to this state after undo/redo.
featureId | id of feature for which this chaged is stored | |
field | field identifier of field which was changed | |
original | original value of attribute before change | |
target | target value of attribute after change | |
isFirstChange | flag if this change is the first one |
Definition at line 89 of file qgsvectorlayerundocommand.cpp.
References QgsUndoCommand::AttributeChangeEntry::isFirstChange, mAttributeChange, QgsUndoCommand::AttributeChangeEntry::original, and QgsUndoCommand::AttributeChangeEntry::target.
Referenced by QgsVectorLayer::editAttributeChange().
void QgsUndoCommand::storeFeatureDelete | ( | int | featureId | ) |
Add id of feature to deleted list to be reverted if needed afterwards.
featureId | id of feature which is to be deleted |
Definition at line 108 of file qgsvectorlayerundocommand.cpp.
References mDeletedFeatureIdChange.
Referenced by QgsVectorLayer::editFeatureDelete().
void QgsUndoCommand::storeFeatureAdd | ( | QgsFeature & | feature | ) |
Add new feature to list of new features to be stored for undo/redo operations.
feature | feature which is to be added |
Definition at line 113 of file qgsvectorlayerundocommand.cpp.
References mAddedFeatures.
Referenced by QgsVectorLayer::editFeatureAdd().
void QgsUndoCommand::storeAttributeAdd | ( | int | index, | |
const QgsField & | value | |||
) |
Add new attribute to list of attributes to be used for attributes of features for undo/redo operations.
index | index of attribute which is to be added | |
value | field description which is to be stored |
Definition at line 98 of file qgsvectorlayerundocommand.cpp.
References mAddedAttributes.
Referenced by QgsVectorLayer::addAttribute().
void QgsUndoCommand::storeAttributeDelete | ( | int | index, | |
const QgsField & | orig | |||
) |
Add deleted attribute which is to be stored for undo/redo operations.
index | index od attribute definition which is to be deleted | |
orig | deleted field's description |
Definition at line 103 of file qgsvectorlayerundocommand.cpp.
References mDeletedAttributes.
Referenced by QgsVectorLayer::deleteAttribute().
friend class QgsVectorLayer [friend] |
Definition at line 144 of file qgsvectorlayerundocommand.h.
bool QgsUndoCommand::mFirstRun [private] |
Variable to disable first run of undo, because it's automaticaly done after push.
Definition at line 116 of file qgsvectorlayerundocommand.h.
Referenced by QgsUndoCommand(), and redo().
QgsVectorLayer* QgsUndoCommand::mLayer [private] |
Layer on which operations should be performed.
Definition at line 119 of file qgsvectorlayerundocommand.h.
Referenced by QgsUndoCommand(), redo(), and undo().
QMap<int, GeometryChangeEntry> QgsUndoCommand::mGeometryChange [private] |
Map of changes of geometry for features it describes changes of geometry.
Definition at line 122 of file qgsvectorlayerundocommand.h.
Referenced by QgsVectorLayer::redoEditCommand(), storeGeometryChange(), and QgsVectorLayer::undoEditCommand().
QMap<int, AttributeChanges> QgsUndoCommand::mAttributeChange [private] |
Map of changes of atrributes for features which describes changes of attributes.
Definition at line 125 of file qgsvectorlayerundocommand.h.
Referenced by QgsVectorLayer::redoEditCommand(), storeAttributeChange(), and QgsVectorLayer::undoEditCommand().
Deleted feature IDs which are not commited.
Note a feature can be added and then deleted again before the change is committed - in that case the added feature would be removed from mAddedFeatures only and *not* entered here.
Definition at line 131 of file qgsvectorlayerundocommand.h.
Referenced by QgsVectorLayer::redoEditCommand(), storeFeatureDelete(), and QgsVectorLayer::undoEditCommand().
QgsFieldMap QgsUndoCommand::mAddedAttributes [private] |
added attributes fields which are not commited
Definition at line 134 of file qgsvectorlayerundocommand.h.
Referenced by QgsVectorLayer::redoEditCommand(), storeAttributeAdd(), and QgsVectorLayer::undoEditCommand().
deleted attributes fields which are not commited
Definition at line 137 of file qgsvectorlayerundocommand.h.
Referenced by QgsVectorLayer::redoEditCommand(), storeAttributeDelete(), and QgsVectorLayer::undoEditCommand().
QgsFeatureList QgsUndoCommand::mAddedFeatures [private] |
New features which are not commited.
Note a feature can be added and then changed, therefore the details here can be overridden by mChangedAttributeValues and mChangedGeometries.
Definition at line 142 of file qgsvectorlayerundocommand.h.
Referenced by QgsVectorLayer::redoEditCommand(), storeFeatureAdd(), and QgsVectorLayer::undoEditCommand().