Ignore:
Timestamp:
2017-10-19T17:19:20+02:00 (7 years ago)
Author:
malcolmh
Message:

Replace deprecations

Location:
applications/editors/josm/plugins/seachart/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/seachart/src/render/Signals.java

    r32995 r33724  
    417417                        continue;
    418418                    }
    419                     if (atts.containsKey(Att.LITRAD)) {
    420                         radius = (Double) atts.get(Att.LITRAD).val;
    421                     }
    422419                    if (atts.containsKey(Att.CATLIT)) {
    423420                        ArrayList<CatLIT> cats = (ArrayList<CatLIT>) atts.get(Att.CATLIT).val;
     
    434431                                    if (satts == atts)
    435432                                        continue;
    436                                     if (satts.containsKey(Att.LITRAD)) {
    437                                         srad = (Double) satts.get(Att.LITRAD).val;
    438                                     }
    439433                                    if (srad == radius) {
    440434                                        ArrayList<CatLIT> scats = (ArrayList<CatLIT>) ((satts.containsKey(Att.CATLIT)) ?
  • applications/editors/josm/plugins/seachart/src/s57/S57att.java

    r32992 r33724  
    2929        MEAWAT, MEANAM, OTHWAT, OTHNAM, REFLEV, SDRLEV, VCRLEV, SCHREF, USESHP, CURVHW, CURVLW, CURVMW, CURVOW, APTREF, SHPTYP, UPDMSG, ADDMRK, CATNMK, CATBRT, CATBUN,
    3030        CATCCL, CATCOM, CATHBR, CATRFD, CATTML, CATGAG, CATVTR, CATTAB, CATEXS, LG_SPD, LG_SPR, LG_BME, LG_LGS, LG_DRT, LG_WDP, LG_WDU, LG_REL, LG_FNC, LG_DES, LG_PBR,
    31         LC_CSI, LC_CSE, LC_ASI, LC_ASE, LC_CCI, LC_CCE, LC_BM1, LC_BM2, LC_LG1, LC_LG2, LC_DR1, LC_DR2, LC_SP1, LC_SP2, LC_WD1, LC_WD2, LITRAD, CATCVR, HUNITS
     31        LC_CSI, LC_CSE, LC_ASI, LC_ASE, LC_CCI, LC_CCE, LC_BM1, LC_BM2, LC_LG1, LC_LG2, LC_DR1, LC_DR2, LC_SP1, LC_SP2, LC_WD1, LC_WD2, CATCVR, HUNITS
    3232    }
    3333
     
    145145        AttStr.put(Att.CURVLW, "low_velocity"); AttStr.put(Att.CURVMW, "mean_velocity"); AttStr.put(Att.CURVOW, "other_velocity"); AttStr.put(Att.APTREF, "passing_time");
    146146        AttStr.put(Att.CATCOM, "category"); AttStr.put(Att.CATCVR, "category"); AttStr.put(Att.CATEXS, "category"); AttStr.put(Att.SHPTYP, "ship");
    147         AttStr.put(Att.UPDMSG, "message"); AttStr.put(Att.LITRAD, "radius");
     147        AttStr.put(Att.UPDMSG, "message");
    148148    }
    149149
     
    448448        Quality.put(Obj.UNKOBJ, Att.QUASOU); }
    449449
    450     private static final EnumMap<Obj, Att> Radius = new EnumMap<>(Obj.class); static {
    451         Radius.put(Obj.UNKOBJ, Att.RADIUS); Radius.put(Obj.LIGHTS, Att.LITRAD); }
    452 
    453     private static final EnumMap<Obj, Att> Range = new EnumMap<>(Obj.class); static {
     450   private static final EnumMap<Obj, Att> Range = new EnumMap<>(Obj.class); static {
    454451        Range.put(Obj.UNKOBJ, Att.VALNMR); }
    455452
     
    595592        StrAtt.put("operation", Operation); StrAtt.put("orientation", Orientation); StrAtt.put("passing_time", Passing_time); StrAtt.put("period", Period); StrAtt.put("period_end", Period_end);
    596593        StrAtt.put("period_start", Period_start); StrAtt.put("pilot_district", Pilot_district); StrAtt.put("position_quality", Position_quality); StrAtt.put("positional_accuracy", Positional_accuracy);
    597         StrAtt.put("producing_country", Producing_country); StrAtt.put("product", Product); StrAtt.put("quality", Quality); StrAtt.put("radius", Radius); StrAtt.put("range", Range);
     594        StrAtt.put("producing_country", Producing_country); StrAtt.put("product", Product); StrAtt.put("quality", Quality); StrAtt.put("range", Range);
    598595        StrAtt.put("reference", Reference); StrAtt.put("reflectivity", Reflectivity); StrAtt.put("restriction", Restriction); StrAtt.put("schedule", Schedule); StrAtt.put("shape", Shape);
    599596        StrAtt.put("sector_end", Sector_end); StrAtt.put("sector_start", Sector_start); StrAtt.put("sequence", Sequence); StrAtt.put("shift", Shift); StrAtt.put("ship", Ship);
  • applications/editors/josm/plugins/seachart/src/s57/S57osm.java

    r32909 r33724  
    5252        OSMtags.put("landuse=industrial", new KeyVal<>(Obj.BUAARE, Att.UNKATT, null, null)); OSMtags.put("landuse=commercial", new KeyVal<>(Obj.BUAARE, Att.UNKATT, null, null));
    5353        OSMtags.put("landuse=retail", new KeyVal<>(Obj.BUAARE, Att.UNKATT, null, null)); OSMtags.put("landuse=residential", new KeyVal<>(Obj.BUAARE, Att.UNKATT, null, null));
    54         OSMtags.put("place=city", new KeyVal<>(Obj.BUAARE, Att.CATBUA, Conv.E, CatBUA.BUA_CITY)); OSMtags.put("place=town", new KeyVal<>(Obj.BUAARE, Att.CATBUA, Conv.E, CatBUA.BUA_TOWN));
    55         OSMtags.put("place=village", new KeyVal<>(Obj.BUAARE, Att.CATBUA, Conv.E, CatBUA.BUA_VLLG));
    5654    }
    5755
  • applications/editors/josm/plugins/seachart/src/s57/S57val.java

    r32907 r33724  
    15051505        keys.put(Att.LC_DR1, new S57key(Conv.F, null)); keys.put(Att.LC_DR2, new S57key(Conv.F, null)); keys.put(Att.LC_SP1, new S57key(Conv.F, null));
    15061506        keys.put(Att.LC_SP2, new S57key(Conv.F, null)); keys.put(Att.LC_WD1, new S57key(Conv.F, null)); keys.put(Att.LC_WD2, new S57key(Conv.F, null));
    1507         keys.put(Att.LITRAD, new S57key(Conv.F, null)); keys.put(Att.CATCVR, new S57key(Conv.E, Catcvr));
     1507        keys.put(Att.CATCVR, new S57key(Conv.E, Catcvr));
    15081508    }
    15091509
  • applications/editors/josm/plugins/seachart/src/seachart/ChartImage.java

    r33222 r33724  
    1111import javax.swing.Action;
    1212
    13 import org.openstreetmap.josm.Main;
     13import org.openstreetmap.josm.gui.MainApplication;
    1414import org.openstreetmap.josm.data.Bounds;
    1515import org.openstreetmap.josm.data.coor.LatLon;
     
    7070    @Override
    7171    public void paint(Graphics2D g2, MapView mv, Bounds bb) {
    72         Rectangle rect = Main.map.mapView.getBounds();
     72        Rectangle rect = MainApplication.getMap().mapView.getBounds();
    7373        Renderer.reRender(g2, rect, zoom, Math.pow(2, (zoom-12)), SeachartAction.map, this);
    7474        g2.setPaint(Color.black);
     
    8484    @Override
    8585    public void zoomChanged() {
    86         if ((Main.map != null) && (Main.map.mapView != null)) {
    87             Bounds bounds = Main.map.mapView.getRealBounds();
     86        if ((MainApplication.getMap() != null) && (MainApplication.getMap().mapView != null)) {
     87            Bounds bounds = MainApplication.getMap().mapView.getRealBounds();
    8888            top = bounds.getMax().lat();
    8989            bottom = bounds.getMin().lat();
    9090            left = bounds.getMin().lon();
    9191            right = bounds.getMax().lon();
    92             width = Main.map.mapView.getBounds().getWidth();
    93             height = Main.map.mapView.getBounds().getHeight();
     92            width = MainApplication.getMap().mapView.getBounds().getWidth();
     93            height = MainApplication.getMap().mapView.getBounds().getHeight();
    9494            zoom = ((int) Math.min(18, Math.max(9, Math.round(Math.floor(Math.log(1024 / bounds.asRect().height) / Math.log(2))))));
    9595        }
     
    9898    @Override
    9999    public Point2D.Double getPoint(Snode coord) {
    100         return (Double) Main.map.mapView.getPoint2D(new LatLon(Math.toDegrees(coord.lat), Math.toDegrees(coord.lon)));
     100        return (Double) MainApplication.getMap().mapView.getPoint2D(new LatLon(Math.toDegrees(coord.lat), Math.toDegrees(coord.lon)));
    101101    }
    102102
    103103    @Override
    104104    public double mile(Feature feature) {
    105         return 185000 / Main.map.mapView.getDist100Pixel();
     105        return 185000 / MainApplication.getMap().mapView.getDist100Pixel();
    106106    }
    107107
  • applications/editors/josm/plugins/seachart/src/seachart/Seachart.java

    r32907 r33724  
    22package seachart;
    33
    4 import org.openstreetmap.josm.Main;
     4import org.openstreetmap.josm.gui.MainApplication;
    55import org.openstreetmap.josm.gui.MainMenu;
    66import org.openstreetmap.josm.plugins.Plugin;
     
    1414    public Seachart(PluginInformation info) {
    1515        super(info);
    16         MainMenu.add(Main.main.menu.imageryMenu, new SeachartAction());
     16        MainMenu.add(MainApplication.getMenu().imageryMenu, new SeachartAction());
    1717    }
    1818}
  • applications/editors/josm/plugins/seachart/src/seachart/SeachartAction.java

    r33105 r33724  
    77import javax.swing.SwingUtilities;
    88
    9 import org.openstreetmap.josm.Main;
     9import org.openstreetmap.josm.gui.MainApplication;
    1010import org.openstreetmap.josm.actions.JosmAction;
    1111import org.openstreetmap.josm.data.Bounds;
     
    124124        rendering = new ChartImage(new ImageryInfo("SeaChart"));
    125125        rendering.setBackgroundLayer(true);
    126         Main.getLayerManager().addLayer(rendering);
    127         Main.getLayerManager().addAndFireActiveLayerChangeListener(this);
    128         Main.getLayerManager().addLayerChangeListener(this);
     126        MainApplication.getLayerManager().addLayer(rendering);
     127        MainApplication.getLayerManager().addAndFireActiveLayerChangeListener(this);
     128        MainApplication.getLayerManager().addLayerChangeListener(this);
    129129    }
    130130
     
    132132        if (isOpen) {
    133133                try {
    134             Main.getLayerManager().removeActiveLayerChangeListener(this);
    135             Main.getLayerManager().removeLayerChangeListener(this);
    136             Main.getLayerManager().removeLayer(rendering);
     134            MainApplication.getLayerManager().removeActiveLayerChangeListener(this);
     135            MainApplication.getLayerManager().removeLayerChangeListener(this);
     136            MainApplication.getLayerManager().removeLayer(rendering);
    137137                } catch (Exception e) {
    138138                        // Assume that this can't be serious?
     
    149149            oldLayer.data.removeDataSetListener(dataSetListener);
    150150        }
    151         OsmDataLayer newLayer = Main.getLayerManager().getEditLayer();
     151        OsmDataLayer newLayer = MainApplication.getLayerManager().getEditLayer();
    152152        if (newLayer != null) {
    153153            newLayer.data.addDataSetListener(dataSetListener);
Note: See TracChangeset for help on using the changeset viewer.