X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fundo%2FUndoAppendPoints.java;fp=tim%2Fprune%2Fundo%2FUndoAppendPoints.java;h=14e147b7913b6be04912cbbc6ca42f5c37652826;hp=0000000000000000000000000000000000000000;hb=92dad5df664287acb51728e9ea599f150765d34a;hpb=81843c3d8d0771bf00d0f26034a13aa515465c78 diff --git a/tim/prune/undo/UndoAppendPoints.java b/tim/prune/undo/UndoAppendPoints.java new file mode 100644 index 0000000..14e147b --- /dev/null +++ b/tim/prune/undo/UndoAppendPoints.java @@ -0,0 +1,51 @@ +package tim.prune.undo; + +import tim.prune.I18nManager; +import tim.prune.data.TrackInfo; + +/** + * Operation to undo an operation (such as create marker waypoints) + * in which a number of points were appended to the track + */ +public class UndoAppendPoints implements UndoOperation +{ + private int _previousTrackLength = -1; + private int _numAppended = 0; + + + /** + * Constructor + */ + public UndoAppendPoints(int inTrackLength) + { + _previousTrackLength = inTrackLength; + } + + /** + * @param inNumPoints number of points appended to track + */ + public void setNumPointsAppended(int inNumPoints) + { + _numAppended = inNumPoints; + } + + /** + * @return description of operation including number of points loaded + */ + public String getDescription() + { + return I18nManager.getText("undo.insert") + " (" + _numAppended + ")"; + } + + /** + * 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 + { + // crop track to previous size + inTrackInfo.getTrack().cropTo(_previousTrackLength); + // clear selection + inTrackInfo.getSelection().clearAll(); + } +}