]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/function/ShowThreeDFunction.java
8ba0f41af3ba6b627f1d9e1fa61af29ea9a0840f
[GpsPrune.git] / tim / prune / function / ShowThreeDFunction.java
1 package tim.prune.function;
2
3 import javax.swing.JOptionPane;
4
5 import tim.prune.App;
6 import tim.prune.GenericFunction;
7 import tim.prune.I18nManager;
8 import tim.prune.threedee.ThreeDException;
9 import tim.prune.threedee.ThreeDWindow;
10 import tim.prune.threedee.WindowFactory;
11
12 /**
13  * Class to show the 3d window
14  */
15 public class ShowThreeDFunction extends GenericFunction
16 {
17         /**
18          * Constructor
19          * @param inApp app object
20          */
21         public ShowThreeDFunction(App inApp)
22         {
23                 super(inApp);
24         }
25
26         /**
27          * Get the name key
28          */
29         public String getNameKey() {
30                 return "function.show3d";
31         }
32
33         /**
34          * Show the help screen
35          */
36         public void begin()
37         {
38                 ThreeDWindow window = WindowFactory.getWindow(_parentFrame);
39                 if (window == null)
40                 {
41                         JOptionPane.showMessageDialog(_parentFrame, I18nManager.getText("error.function.nojava3d"),
42                                 I18nManager.getText("error.function.notavailable.title"), JOptionPane.WARNING_MESSAGE);
43                 }
44                 else
45                 {
46                         try
47                         {
48                                 // Pass the track object and show the window
49                                 window.setTrack(_app.getTrackInfo().getTrack());
50                                 window.show();
51                         }
52                         catch (ThreeDException e)
53                         {
54                                 _app.showErrorMessageNoLookup(getNameKey(), I18nManager.getText("error.3d") + ": " + e.getMessage());
55                         }
56                 }
57         }
58 }