X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fundo%2FUndoConnectPhotoWithClone.java;fp=tim%2Fprune%2Fundo%2FUndoConnectPhotoWithClone.java;h=2fb2ca6a8c3514e803163dc2a9fb9e192dcd07b9;hb=52bf9e8686c916be37a26a0b75340393d4478b05;hp=0000000000000000000000000000000000000000;hpb=ca9bdb3916f9c39adbbf95d06ac95c21dafbb4e6;p=GpsPrune.git diff --git a/tim/prune/undo/UndoConnectPhotoWithClone.java b/tim/prune/undo/UndoConnectPhotoWithClone.java new file mode 100644 index 0000000..2fb2ca6 --- /dev/null +++ b/tim/prune/undo/UndoConnectPhotoWithClone.java @@ -0,0 +1,41 @@ +package tim.prune.undo; + +import tim.prune.data.DataPoint; +import tim.prune.data.TrackInfo; + +/** + * Operation to undo the connection of a photo to a point + * where the point had to be cloned + */ +public class UndoConnectPhotoWithClone extends UndoConnectPhoto +{ + /** Additional undo object for removing inserted point */ + private UndoInsert _undoInsert = null; + + + /** + * Constructor + * @param inPoint data point + * @param inFilename filename of photo + * @param inIndex index of cloned point + */ + public UndoConnectPhotoWithClone(DataPoint inPoint, String inFilename, int inIndex) + { + super(inPoint, inFilename); + // Make an undo object for the insert + _undoInsert = new UndoInsert(inIndex, 1); + } + + /** + * Perform the undo operation on the given Track + * @param inTrackInfo TrackInfo object on which to perform the operation + */ + public void performUndo(TrackInfo inTrackInfo) throws UndoException + { + //System.out.println("Performing undo: (" + super.getDescription() + ", " + _undoInsert.getDescription() + ")"); + // Firstly, undo connect + super.performUndo(inTrackInfo); + // Next, undo insert to remove cloned point + _undoInsert.performUndo(inTrackInfo); + } +}