Ignore:
Timestamp:
2017-11-17T00:48:06+01:00 (7 years ago)
Author:
donvip
Message:

fix deprecation warnings

Location:
applications/editors/josm/plugins/ElevationProfile
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/ElevationProfile

    • Property svn:ignore
      •  

        old new  
        88checkstyle-josm-ElevationProfile.xml
        99findbugs-josm-ElevationProfile.xml
         10spotbugs-josm-ElevationProfile.xml
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationProfilePlugin.java

    r33215 r33815  
    66import java.awt.Color;
    77
    8 import org.openstreetmap.josm.Main;
    98import org.openstreetmap.josm.gui.IconToggleButton;
     9import org.openstreetmap.josm.gui.MainApplication;
    1010import org.openstreetmap.josm.gui.MainMenu;
    1111import org.openstreetmap.josm.gui.MapFrame;
     
    3535
    3636        // TODO: Disable this view as long as it is not stable
    37         MainMenu.add(Main.main.menu.imagerySubMenu, new AddElevationLayerAction(), false, 0);
     37        MainMenu.add(MainApplication.getMenu().imagerySubMenu, new AddElevationLayerAction(), false, 0);
    3838    }
    3939
     
    6464        if (currentLayer == null) {
    6565            currentLayer = new ElevationProfileLayer(tr("Elevation Profile"));
    66             Main.getLayerManager().addLayer(currentLayer);
     66            MainApplication.getLayerManager().addLayer(currentLayer);
    6767        }
    6868        return currentLayer;
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/actions/AddElevationLayerAction.java

    r32443 r33815  
    66import java.awt.event.ActionEvent;
    77
    8 import org.openstreetmap.josm.Main;
    98import org.openstreetmap.josm.actions.JosmAction;
     9import org.openstreetmap.josm.gui.MainApplication;
    1010import org.openstreetmap.josm.gui.layer.Layer;
    1111import org.openstreetmap.josm.plugins.elevation.grid.ElevationGridLayer;
     
    2727        if (currentLayer == null) {
    2828            currentLayer = new ElevationGridLayer(tr("Elevation Grid")); // TODO: Better name
    29             Main.getLayerManager().addLayer(currentLayer);
     29            MainApplication.getLayerManager().addLayer(currentLayer);
    3030        }
    3131    }
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridLayer.java

    r33551 r33815  
    1818import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener;
    1919import org.openstreetmap.gui.jmapviewer.interfaces.TileSource;
    20 import org.openstreetmap.josm.Main;
    2120import org.openstreetmap.josm.data.Bounds;
    2221import org.openstreetmap.josm.data.coor.LatLon;
     
    2726import org.openstreetmap.josm.plugins.elevation.IVertexRenderer;
    2827import org.openstreetmap.josm.tools.ImageProvider;
     28import org.openstreetmap.josm.tools.Logging;
    2929
    3030/**
     
    114114    public void tileLoadingFinished(Tile tile, boolean success) {
    115115        try {
    116             if (Main.map != null) {
    117                 Main.map.repaint(100);
    118             }
     116            invalidate();
    119117        } catch (Exception ex) {
    120             System.err.println(ex);
    121             ex.printStackTrace(System.err);
     118            Logging.error(ex);
    122119        }
    123120    }
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/DefaultElevationProfileRenderer.java

    r32775 r33815  
    1919import java.util.List;
    2020
     21import org.openstreetmap.josm.Main;
    2122import org.openstreetmap.josm.data.gpx.WayPoint;
    2223import org.openstreetmap.josm.gui.MapView;
     
    150151
    151152        // transform to view
    152         Point pnt1 = mv.getPoint(wpt1.getEastNorth());
    153         Point pnt2 = mv.getPoint(wpt2.getEastNorth());
     153        Point pnt1 = mv.getPoint(wpt1.getEastNorth(Main.getProjection()));
     154        Point pnt2 = mv.getPoint(wpt2.getEastNorth(Main.getProjection()));
    154155
    155156        // use thick line, if possible
     
    188189
    189190        Color c = getColorForWaypoint(profile, wpt, kind);
    190         Point pnt = mv.getPoint(wpt.getEastNorth());
     191        Point pnt = mv.getPoint(wpt.getEastNorth(Main.getProjection()));
    191192
    192193        /* Paint full hour label */
     
    235236        Color c = getColorForWaypoint(profile, wpt, kind);
    236237        int eleH = (int) ElevationHelper.getElevation(wpt);
    237         Point pnt = mv.getPoint(wpt.getEastNorth());
     238        Point pnt = mv.getPoint(wpt.getEastNorth(Main.getProjection()));
    238239
    239240        TriangleDir td = TriangleDir.Up;
     
    359360
    360361        Color c = getColorForWaypoint(profile, wpt, kind);
    361         Point pnt = mv.getPoint(wpt.getEastNorth());
     362        Point pnt = mv.getPoint(wpt.getEastNorth(Main.getProjection()));
    362363        drawSphere(g, Color.WHITE, c, pnt.x, pnt.y, BIG_WPT_RADIUS);
    363364    }
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileDialog.java

    r32775 r33815  
    2525import javax.swing.event.ListDataListener;
    2626
    27 import org.openstreetmap.josm.Main;
    2827import org.openstreetmap.josm.data.SystemOfMeasurement;
    2928import org.openstreetmap.josm.data.gpx.GpxData;
     29import org.openstreetmap.josm.gui.MainApplication;
    3030import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
    3131import org.openstreetmap.josm.gui.layer.GpxLayer;
     
    162162        zoomButton.addActionListener(new ActionListener() {
    163163            @Override
    164             public void actionPerformed(ActionEvent arg0) {
     164            public void actionPerformed(ActionEvent e) {
    165165                if (model != null) {
    166166                    IElevationProfile profile = model.getCurrentProfile();
    167167                    if (profile != null) {
    168                         Main.map.mapView.zoomTo(profile.getBounds());
     168                        MainApplication.getMap().mapView.zoomTo(profile.getBounds());
    169169                    }
    170170                }
     
    198198    @Override
    199199    public void showNotify() {
    200         Main.getLayerManager().addLayerChangeListener(this);
    201         Main.getLayerManager().addActiveLayerChangeListener(this);
    202         if (Main.isDisplayingMapView()) {
    203             Layer layer = Main.getLayerManager().getActiveLayer();
     200        MainApplication.getLayerManager().addLayerChangeListener(this);
     201        MainApplication.getLayerManager().addActiveLayerChangeListener(this);
     202        if (MainApplication.isDisplayingMapView()) {
     203            Layer layer = MainApplication.getLayerManager().getActiveLayer();
    204204            if (layer instanceof GpxLayer) {
    205205                setActiveLayer((GpxLayer) layer);
     
    210210    @Override
    211211    public void hideNotify() {
    212         Main.getLayerManager().removeActiveLayerChangeListener(this);
    213         Main.getLayerManager().removeLayerChangeListener(this);
     212        MainApplication.getLayerManager().removeActiveLayerChangeListener(this);
     213        MainApplication.getLayerManager().removeLayerChangeListener(this);
    214214    }
    215215
     
    353353    @Override
    354354    public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
    355         Layer newLayer = Main.getLayerManager().getActiveLayer();
     355        Layer newLayer = MainApplication.getLayerManager().getActiveLayer();
    356356        if (newLayer instanceof GpxLayer) {
    357357            setActiveLayer((GpxLayer) newLayer);
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileLayer.java

    r32775 r33815  
    1010import javax.swing.Icon;
    1111
    12 import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.data.Bounds;
    1413import org.openstreetmap.josm.data.gpx.WayPoint;
     
    6261        if (this.profile != profile) {
    6362            this.profile = profile;
    64             Main.map.repaint();
     63            invalidate();
    6564        }
    6665    }
     
    208207        if (selWayPoint != newWayPoint) {
    209208            selWayPoint = newWayPoint;
    210             Main.map.repaint();
     209            invalidate();
    211210        }
    212211    }
Note: See TracChangeset for help on using the changeset viewer.