]> gitweb.fperrin.net Git - GpsPrune.git/blob - src/tim/prune/function/RemoveAltitudes.java
Add menu item to remove altitudes from track
[GpsPrune.git] / src / tim / prune / function / RemoveAltitudes.java
1 package tim.prune.function;
2
3 import java.awt.BorderLayout;
4 import java.awt.FlowLayout;
5 import java.awt.event.ActionEvent;
6 import java.awt.event.ActionListener;
7 import java.awt.event.KeyAdapter;
8 import java.awt.event.KeyEvent;
9 import java.awt.event.MouseAdapter;
10
11 import javax.swing.BorderFactory;
12 import javax.swing.JButton;
13 import javax.swing.JDialog;
14 import javax.swing.JLabel;
15 import javax.swing.JPanel;
16 import javax.swing.JTextField;
17
18 import tim.prune.App;
19 import tim.prune.GenericFunction;
20 import tim.prune.I18nManager;
21 import tim.prune.config.Config;
22 import tim.prune.data.Field;
23 import tim.prune.data.Unit;
24 import tim.prune.data.UnitSetLibrary;
25
26 /**
27  * Class to provide the function to add remove the altitude from points in a
28  * track range
29  */
30 public class RemoveAltitudes extends GenericFunction
31 {
32         /**
33          * Constructor
34          * @param inApp application object for callback
35          */
36         public RemoveAltitudes(App inApp)
37         {
38                 super(inApp);
39         }
40
41         /** Get the name key */
42         public String getNameKey() {
43                 return "function.removealtitudes";
44         }
45
46         /**
47          * Begin the function
48          */
49         public void begin()
50         {
51                 int selStart = _app.getTrackInfo().getSelection().getStart();
52                 int selEnd = _app.getTrackInfo().getSelection().getEnd();
53                 if (!_app.getTrackInfo().getTrack().hasData(Field.ALTITUDE, selStart, selEnd))
54                 {
55                         _app.showErrorMessage(getNameKey(), "dialog.addaltitude.noaltitudes");
56                         return;
57                 }
58                 _app.removeAltitudes(selStart, selEnd);
59         }
60 }