+ {
+ // See if the track has any altitudes at all - if not, show a tip to use SRTM
+ if (!_app.getTrackInfo().getTrack().hasAltitudeData()) {
+ _app.showTip(TipManager.Tip_UseSrtmFor3d);
+ }
+ // Show a dialog to get the parameters
+ if (_dialog == null)
+ {
+ _dialog = new JDialog(_app.getFrame(), I18nManager.getText(getNameKey()), true);
+ _dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ _dialog.getContentPane().add(makeDialogComponents());
+ _dialog.pack();
+ }
+ final int exaggFactor = Config.getConfigInt(Config.KEY_HEIGHT_EXAGGERATION);
+ if (exaggFactor > 0) {
+ _exaggField.setValue(exaggFactor / 100.0);
+ }
+ _baseImagePanel.updateBaseImageDetails();
+ _dialog.setLocationRelativeTo(_app.getFrame());
+ _dialog.setVisible(true);
+ }
+ }
+
+ /**
+ * Make the dialog components to select the options
+ * @return JPanel holding the gui elements
+ */
+ private JPanel makeDialogComponents()
+ {
+ JPanel mainPanel = new JPanel();
+ mainPanel.setLayout(new BorderLayout(4, 4));
+
+ JPanel innerPanel = new JPanel();
+ innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
+ // Panel for altitude exaggeration
+ JPanel exaggPanel = new JPanel();
+ exaggPanel.setLayout(new FlowLayout());
+ exaggPanel.add(new JLabel(I18nManager.getText("dialog.3d.altitudefactor") + ": "));
+ _exaggField = new DecimalNumberField(); // don't allow negative numbers
+ _exaggField.setText("5.0");
+ exaggPanel.add(_exaggField);
+ innerPanel.add(exaggPanel);
+ innerPanel.add(Box.createVerticalStrut(4));
+
+ // Panel for terrain
+ _terrainPanel = new TerrainDefinitionPanel();
+ innerPanel.add(_terrainPanel);
+ mainPanel.add(innerPanel, BorderLayout.NORTH);
+ innerPanel.add(Box.createVerticalStrut(4));
+
+ // Panel for base image (null because we don't need callback)
+ _baseImagePanel = new BaseImageDefinitionPanel(null, _dialog, _app.getTrackInfo().getTrack());
+ innerPanel.add(_baseImagePanel);
+
+ // OK, Cancel buttons
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
+ JButton okButton = new JButton(I18nManager.getText("button.ok"));
+ okButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e)
+ {
+ _dialog.dispose();
+ new Thread(new Runnable() {
+ public void run() {
+ finish(); // needs to be in separate thread
+ }
+ }).start();
+ }
+ });
+ buttonPanel.add(okButton);
+ JButton cancelButton = new JButton(I18nManager.getText("button.cancel"));
+ cancelButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e)
+ {
+ _dialog.dispose();
+ }
+ });
+ buttonPanel.add(cancelButton);
+ mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+
+ return mainPanel;
+ }
+
+ /**
+ * All parameters have been selected in the input dialog, now we can go to the 3d window
+ */
+ private void finish()
+ {
+ // Store exaggeration factor in config
+ Config.setConfigInt(Config.KEY_HEIGHT_EXAGGERATION, (int) (_exaggField.getValue() * 100));
+ ThreeDWindow window = WindowFactory.getWindow(_parentFrame);
+ if (window != null)