QgsUndoCommand Class Reference

Class to support universal undo command sequence for application, basic for. More...

#include <qgsvectorlayerundocommand.h>

Collaboration diagram for QgsUndoCommand:

Collaboration graph
[legend]

List of all members.

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.
QgsVectorLayermLayer
 Layer on which operations should be performed.
QMap< int, GeometryChangeEntrymGeometryChange
 Map of changes of geometry for features it describes changes of geometry.
QMap< int, AttributeChangesmAttributeChange
 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...


Detailed Description

Class to support universal undo command sequence for application, basic for.

Definition at line 28 of file qgsvectorlayerundocommand.h.


Member Typedef Documentation

Definition at line 41 of file qgsvectorlayerundocommand.h.


Constructor & Destructor Documentation

QgsUndoCommand::QgsUndoCommand ( QgsVectorLayer layer,
QString  text 
)

Definition at line 46 of file qgsvectorlayerundocommand.cpp.

References mFirstRun, and mLayer.


Member Function Documentation

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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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().


Friends And Related Function Documentation

friend class QgsVectorLayer [friend]

Definition at line 144 of file qgsvectorlayerundocommand.h.


Member Data Documentation

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().

Layer on which operations should be performed.

Definition at line 119 of file qgsvectorlayerundocommand.h.

Referenced by QgsUndoCommand(), redo(), and undo().

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().

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().

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().

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().


The documentation for this class was generated from the following files:

Generated on Sat Feb 4 19:17:56 2012 for Quantum GIS API Documentation by  doxygen 1.5.6