Changeset 23762 in osm for applications/editors/josm
- Timestamp:
- 2010-10-23T15:52:13+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileDialog.java
r23759 r23762 19 19 import java.awt.BorderLayout; 20 20 import java.awt.Font; 21 import java.awt.GridBagConstraints;22 21 import java.awt.GridLayout; 23 import java.awt.Insets;24 22 import java.awt.event.ActionEvent; 25 23 import java.awt.event.ActionListener; … … 36 34 import javax.swing.JPanel; 37 35 import javax.swing.JRadioButton; 38 import javax.swing.JSeparator;39 36 import javax.swing.JTextField; 40 37 … … 57 54 /** 58 55 * @author Oliver 59 * 56 * Implements a JOSM ToggleDialog to show the elevation profile. It monitors the 57 * connection between layer and elevation profile. 60 58 */ 61 59 public class ElevationProfileDialog extends ToggleDialog implements … … 68 66 */ 69 67 private static final long serialVersionUID = -868463893732535577L; 68 /* Elevation profile instance */ 69 private IElevationProfile profile; 70 /* GPX data */ 71 private GpxLayer activeLayer = null; 72 private HashMap<GpxLayer, ElevationModel> layerMap = new HashMap<GpxLayer, ElevationModel>(); 73 74 /* UI elements */ 75 private ElevationProfilePanel profPanel; 70 76 private JLabel minHeightLabel; 71 77 private JLabel maxHeightLabel; 72 73 private IElevationProfile profile;74 private ElevationProfilePanel profPanel;75 private GpxLayer activeLayer = null;76 private HashMap<GpxLayer, ElevationModel> layerMap = new HashMap<GpxLayer, ElevationModel>();77 private List<IElevationModelListener> listeners = new ArrayList<IElevationModelListener>();78 78 private JLabel avrgHeightLabel; 79 79 private JLabel elevationGainLabel; 80 80 private JLabel totalTimeLabel; 81 81 private JLabel distLabel; 82 82 private JRadioButton geoidNone; 83 83 private JRadioButton geoidAuto; 84 84 private JRadioButton geoidFixed; 85 85 private JTextField geoidFixedValue; 86 /* Listener to the elevation model */ 87 private List<IElevationModelListener> listeners = new ArrayList<IElevationModelListener>(); 86 88 87 private ElevationProfileLayer profileLayer; 88 private JLabel distLabel; 89 /** 90 * Corresponding layer instance within map view. 91 */ 92 private ElevationProfileLayer profileLayer; 89 93 90 94 /** … … 384 388 } 385 389 390 /* (non-Javadoc) 391 * @see org.openstreetmap.josm.gui.MapView.LayerChangeListener#activeLayerChange(org.openstreetmap.josm.gui.layer.Layer, org.openstreetmap.josm.gui.layer.Layer) 392 */ 386 393 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 387 394 if (newLayer instanceof GpxLayer) { … … 390 397 } 391 398 399 /** 400 * Internal helper to create elevation data for a new layer. 401 * @param newLayer The layer added by the user. 402 */ 392 403 private void createLayer(Layer newLayer) { 393 404 if (newLayer != null) { … … 400 411 } 401 412 413 /** 414 * Internal helper to update internal cache and synchronize elevation model. 415 * @param newLayer The layer added by the user. 416 */ 402 417 private void setActiveLayer(GpxLayer newLayer) { 403 418 if (activeLayer != newLayer) { … … 416 431 ElevationModel em = layerMap.get(newLayer); 417 432 em.setSliceSize(slices); 418 setModel(em); 419 420 } 421 } 422 433 setModel(em); 434 } 435 } 436 437 /* (non-Javadoc) 438 * @see org.openstreetmap.josm.gui.MapView.LayerChangeListener#layerAdded(org.openstreetmap.josm.gui.layer.Layer) 439 */ 423 440 public void layerAdded(Layer newLayer) { 424 441 createLayer(newLayer); 425 442 } 426 443 444 /* (non-Javadoc) 445 * @see org.openstreetmap.josm.gui.MapView.LayerChangeListener#layerRemoved(org.openstreetmap.josm.gui.layer.Layer) 446 */ 427 447 public void layerRemoved(Layer oldLayer) { 428 448 if (layerMap.containsKey(oldLayer)) { 429 // TODO: Handle UI stuff properly430 449 layerMap.remove(oldLayer); 431 450 } … … 436 455 } 437 456 457 /* (non-Javadoc) 458 * @see org.openstreetmap.josm.gui.MapView.EditLayerChangeListener#editLayerChanged(org.openstreetmap.josm.gui.layer.OsmDataLayer, org.openstreetmap.josm.gui.layer.OsmDataLayer) 459 */ 438 460 public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) { 439 461 // Nothing to do...
Note:
See TracChangeset
for help on using the changeset viewer.