Ignore:
Timestamp:
2016-06-29T21:05:34+02:00 (9 years ago)
Author:
donvip
Message:

remove calls to deprecated methods

Location:
applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation
Files:
3 edited

Legend:

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

    r32315 r32443  
    6565        if(currentLayer == null){
    6666            currentLayer = new ElevationProfileLayer(tr("Elevation Profile"));
    67             Main.main.addLayer(currentLayer);
     67            Main.getLayerManager().addLayer(currentLayer);
    6868        }
    6969        return currentLayer;
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/actions/AddElevationLayerAction.java

    r32315 r32443  
    1414
    1515    /**
    16      * 
     16     *
    1717     */
    1818    private static final long serialVersionUID = -745642875640041385L;
     
    2727        if (currentLayer == null) {
    2828            currentLayer = new ElevationGridLayer(tr("Elevation Grid")); // TODO: Better name
    29             Main.main.addLayer(currentLayer);
     29            Main.getLayerManager().addLayer(currentLayer);
    3030        }
    3131    }
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileDialog.java

    r32329 r32443  
    2828import org.openstreetmap.josm.data.SystemOfMeasurement;
    2929import org.openstreetmap.josm.data.gpx.GpxData;
    30 import org.openstreetmap.josm.gui.MapView;
    31 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    3230import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
    3331import org.openstreetmap.josm.gui.layer.GpxLayer;
    3432import org.openstreetmap.josm.gui.layer.Layer;
     33import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent;
     34import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener;
     35import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent;
     36import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;
     37import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
     38import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
    3539import org.openstreetmap.josm.plugins.elevation.ElevationHelper;
    3640import org.openstreetmap.josm.plugins.elevation.IElevationModel;
     
    4549 * connection between layer and elevation profile.
    4650 */
    47 public class ElevationProfileDialog extends ToggleDialog implements LayerChangeListener, ComponentListener {
     51public class ElevationProfileDialog extends ToggleDialog implements LayerChangeListener, ActiveLayerChangeListener, ComponentListener {
    4852
    4953    private static final String EMPTY_DATA_STRING = "-";
     
    194198    @Override
    195199    public void showNotify() {
    196         MapView.addLayerChangeListener(this);
     200        Main.getLayerManager().addLayerChangeListener(this);
     201        Main.getLayerManager().addActiveLayerChangeListener(this);
    197202        if (Main.isDisplayingMapView()) {
    198203            Layer layer = Main.getLayerManager().getActiveLayer();
     
    205210    @Override
    206211    public void hideNotify() {
    207         MapView.removeLayerChangeListener(this);
     212        Main.getLayerManager().removeActiveLayerChangeListener(this);
     213        Main.getLayerManager().removeLayerChangeListener(this);
    208214    }
    209215
     
    348354
    349355    @Override
    350     public void activeLayerChange(Layer oldLayer, Layer newLayer) {
     356    public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
     357        Layer newLayer = Main.getLayerManager().getActiveLayer();
    351358        if (newLayer instanceof GpxLayer) {
    352359            setActiveLayer((GpxLayer) newLayer);
     
    366373            }
    367374
    368             ElevationModel em = layerMap.get(newLayer);
    369             setModel(em);
    370         }
    371     }
    372 
    373     @Override
    374     public void layerAdded(Layer newLayer) {
     375            setModel(layerMap.get(newLayer));
     376        }
     377    }
     378
     379    @Override
     380    public void layerAdded(LayerAddEvent e) {
     381        Layer newLayer = e.getAddedLayer();
    375382        if (newLayer instanceof GpxLayer) {
    376383            GpxLayer gpxLayer = (GpxLayer) newLayer;
     
    380387
    381388    @Override
    382     public void layerRemoved(Layer oldLayer) {
     389    public void layerRemoving(LayerRemoveEvent e) {
     390        Layer oldLayer = e.getRemovedLayer();
    383391        if (layerMap.containsKey(oldLayer)) {
    384392            layerMap.remove(oldLayer);
     
    394402
    395403    @Override
     404    public void layerOrderChanged(LayerOrderChangeEvent e) {
     405    }
     406
     407    @Override
    396408    public void componentHidden(ComponentEvent e) {
    397409    }
Note: See TracChangeset for help on using the changeset viewer.