]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/undo/UndoAppendPoints.java
Version 19, May 2018
[GpsPrune.git] / tim / prune / undo / UndoAppendPoints.java
1 package tim.prune.undo;\r
2 \r
3 import tim.prune.I18nManager;\r
4 import tim.prune.data.TrackInfo;\r
5 \r
6 /**\r
7  * Operation to undo an operation (such as create marker waypoints)\r
8  * in which a number of points were appended to the track\r
9  */\r
10 public class UndoAppendPoints implements UndoOperation\r
11 {\r
12         private int _previousTrackLength = -1;\r
13         private int _numAppended = 0;\r
14 \r
15 \r
16         /**\r
17          * Constructor\r
18          */\r
19         public UndoAppendPoints(int inTrackLength)\r
20         {\r
21                 _previousTrackLength = inTrackLength;\r
22         }\r
23 \r
24         /**\r
25          * @param inNumPoints number of points appended to track\r
26          */\r
27         public void setNumPointsAppended(int inNumPoints)\r
28         {\r
29                 _numAppended = inNumPoints;\r
30         }\r
31 \r
32         /**\r
33          * @return description of operation including number of points loaded\r
34          */\r
35         public String getDescription()\r
36         {\r
37                 return I18nManager.getText("undo.insert") + " (" + _numAppended + ")";\r
38         }\r
39 \r
40         /**\r
41          * Perform the undo operation on the given Track\r
42          * @param inTrackInfo TrackInfo object on which to perform the operation\r
43          */\r
44         public void performUndo(TrackInfo inTrackInfo) throws UndoException\r
45         {\r
46                 // crop track to previous size\r
47                 inTrackInfo.getTrack().cropTo(_previousTrackLength);\r
48                 // clear selection\r
49                 inTrackInfo.getSelection().clearAll();\r
50         }\r
51 }\r