Changeset 23762 in osm


Ignore:
Timestamp:
2010-10-23T15:52:13+02:00 (14 years ago)
Author:
oliverw
Message:

Added documentation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileDialog.java

    r23759 r23762  
    1919import java.awt.BorderLayout;
    2020import java.awt.Font;
    21 import java.awt.GridBagConstraints;
    2221import java.awt.GridLayout;
    23 import java.awt.Insets;
    2422import java.awt.event.ActionEvent;
    2523import java.awt.event.ActionListener;
     
    3634import javax.swing.JPanel;
    3735import javax.swing.JRadioButton;
    38 import javax.swing.JSeparator;
    3936import javax.swing.JTextField;
    4037
     
    5754/**
    5855 * @author Oliver
    59  *
     56 * Implements a JOSM ToggleDialog to show the elevation profile. It monitors the
     57 * connection between layer and elevation profile.
    6058 */
    6159public class ElevationProfileDialog extends ToggleDialog implements
     
    6866         */
    6967        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;
    7076        private JLabel minHeightLabel;
    7177        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>();
    7878        private JLabel avrgHeightLabel;
    7979        private JLabel elevationGainLabel;
    8080        private JLabel totalTimeLabel;
    81 
     81        private JLabel distLabel;
    8282        private JRadioButton geoidNone;
    8383        private JRadioButton geoidAuto;
    8484        private JRadioButton geoidFixed;
    8585        private JTextField geoidFixedValue;
     86        /* Listener to the elevation model */
     87        private List<IElevationModelListener> listeners = new ArrayList<IElevationModelListener>();
    8688       
    87         private ElevationProfileLayer profileLayer;
    88         private JLabel distLabel;
     89        /**
     90         * Corresponding layer instance within map view.
     91         */
     92        private ElevationProfileLayer profileLayer;     
    8993
    9094        /**
     
    384388        }
    385389
     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         */
    386393        public void activeLayerChange(Layer oldLayer, Layer newLayer) {
    387394                if (newLayer instanceof GpxLayer) {
     
    390397        }
    391398
     399        /**
     400         * Internal helper to create elevation data for a new layer.
     401         * @param newLayer The layer added by the user.
     402         */
    392403        private void createLayer(Layer newLayer) {
    393404                if (newLayer != null) {
     
    400411        }
    401412
     413        /**
     414         * Internal helper to update internal cache and synchronize elevation model.
     415         * @param newLayer The layer added by the user.
     416         */
    402417        private void setActiveLayer(GpxLayer newLayer) {
    403418                if (activeLayer != newLayer) {
     
    416431                        ElevationModel em = layerMap.get(newLayer);
    417432                        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         */
    423440        public void layerAdded(Layer newLayer) {
    424441                createLayer(newLayer);
    425442        }
    426443
     444        /* (non-Javadoc)
     445         * @see org.openstreetmap.josm.gui.MapView.LayerChangeListener#layerRemoved(org.openstreetmap.josm.gui.layer.Layer)
     446         */
    427447        public void layerRemoved(Layer oldLayer) {
    428448                if (layerMap.containsKey(oldLayer)) {
    429                         // TODO: Handle UI stuff properly
    430449                        layerMap.remove(oldLayer);
    431450                }
     
    436455        }
    437456
     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         */
    438460        public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) {
    439461                // Nothing to do...
Note: See TracChangeset for help on using the changeset viewer.