File: UndoCreatePoint.java

package info (click to toggle)
gpsprune 19.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,516 kB
  • sloc: java: 42,704; sh: 25; makefile: 24; python: 15
file content (37 lines) | stat: -rw-r--r-- 962 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package tim.prune.undo;

import tim.prune.I18nManager;
import tim.prune.data.TrackInfo;

/**
 * Undo creation of new point
 */
public class UndoCreatePoint implements UndoOperation
{
	/**
	 * @return description of operation
	 */
	public String getDescription()
	{
		return I18nManager.getText("undo.createpoint");
	}


	/**
	 * 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
	{
		if (inTrackInfo.getTrack().getNumPoints() < 1)
		{
			throw new UndoException(getDescription());
		}
		// Reset selection if last point selected
		if (inTrackInfo.getSelection().getCurrentPointIndex() == (inTrackInfo.getTrack().getNumPoints()-1)) {
			inTrackInfo.getSelection().clearAll(); // Note: Informers told twice now!
		}
		// Remove last point
		inTrackInfo.getTrack().cropTo(inTrackInfo.getTrack().getNumPoints() - 1);
	}
}