org.grinvin.gred.undoable

Class ChangeCoordinates

Implemented Interfaces:
UndoableChange

public class ChangeCoordinates
extends InternationalizedUndoableChange

Undoable change for moving elements in a graph.

Constructor Summary

ChangeCoordinates(Embedding embedding, String key)
Create an undoable change object for moving elements in an embedding.

Method Summary

void
addMovement(Vertex v, double[] oldCoordinates, double[] newCoordinates)
Add a movement of the given vertex form old to new coordinates.
void
redo()
Revertes an undo by moving all vertices to their new positions.
void
undo()
Undoes the effect of this change by moving all vertices back to their original position.

Methods inherited from class org.grinvin.gred.undoable.InternationalizedUndoableChange

getRedoCaption, getUndoCaption, redo, undo

Constructor Details

ChangeCoordinates

public ChangeCoordinates(Embedding embedding,
                         String key)
Create an undoable change object for moving elements in an embedding. Individual movements should be added later with addMovement(Vertex,double[],double[]).
Parameters:
embedding - Corresponding embedding
key - Resource key for the undo/redo captions for this move

Method Details

addMovement

public void addMovement(Vertex v,
                        double[] oldCoordinates,
                        double[] newCoordinates)
Add a movement of the given vertex form old to new coordinates. If boths sets of coordinates are exactly the same, then no operation is performed.

redo

public void redo()
Revertes an undo by moving all vertices to their new positions.
Overrides:
redo in interface InternationalizedUndoableChange

undo

public void undo()
Undoes the effect of this change by moving all vertices back to their original position.
Overrides:
undo in interface InternationalizedUndoableChange