X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fundo%2FUndoCompress.java;fp=tim%2Fprune%2Fundo%2FUndoCompress.java;h=0000000000000000000000000000000000000000;hb=4d5796d02a15808311c09448d79e6e7d1de9d636;hp=50582215aaf82aeb265c52b3cddac6ca5cb7b7b7;hpb=f1b92378a792131ac8fb33a869405851d5b2d1f7;p=GpsPrune.git diff --git a/tim/prune/undo/UndoCompress.java b/tim/prune/undo/UndoCompress.java deleted file mode 100644 index 5058221..0000000 --- a/tim/prune/undo/UndoCompress.java +++ /dev/null @@ -1,74 +0,0 @@ -package tim.prune.undo; - -import tim.prune.I18nManager; -import tim.prune.data.DataPoint; -import tim.prune.data.Track; -import tim.prune.data.TrackInfo; - -/** - * Operation to undo a track compression - */ -public class UndoCompress implements UndoOperation -{ - private DataPoint[] _contents = null; - protected int _numPointsDeleted = -1; - private boolean[] _segmentStarts = null; - - - /** - * Constructor - * @param inTrack track contents to copy - */ - public UndoCompress(Track inTrack) - { - _contents = inTrack.cloneContents(); - // Copy boolean segment start flags - _segmentStarts = new boolean[inTrack.getNumPoints()]; - for (int i=0; i 0) - desc = desc + " (" + _numPointsDeleted + ")"; - return desc; - } - - - /** - * 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 - { - // restore track to previous values - inTrackInfo.getTrack().replaceContents(_contents); - // Copy boolean segment start flags - Track track = inTrackInfo.getTrack(); - if (_segmentStarts.length != track.getNumPoints()) - throw new UndoException("Cannot undo compress - track length no longer matches"); - for (int i=0; i<_segmentStarts.length; i++) { - track.getPoint(i).setSegmentStart(_segmentStarts[i]); - } - // clear selection - inTrackInfo.getSelection().clearAll(); - } -} \ No newline at end of file