Ignore:
Timestamp:
2016-03-03T17:21:33+01:00 (8 years ago)
Author:
malcolmh
Message:

[SeaChart] Fix floats

Location:
applications/editors/josm/plugins/seachart/src/render
Files:
2 edited

Legend:

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

    r32090 r32093  
    628628        }
    629629       
     630        @SuppressWarnings("unchecked")
    630631        private static void floats() {
    631632                if (Renderer.zoom >= 12) {
     
    643644                                break;
    644645                        }
    645                         if (feature.objs.get(Obj.TOPMAR) != null)
    646                                 Renderer.symbol(Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), getScheme(Obj.TOPMAR), Topmarks.FloatDelta);
     646                        if (feature.objs.containsKey(Obj.TOPMAR)) {
     647                                AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0);
     648                                if (topmap.containsKey(Att.TOPSHP)) {
     649                                        Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.TOPMAR), Topmarks.FloatDelta);
     650                                }
     651                        } else if (feature.objs.containsKey(Obj.DAYMAR)) {
     652                                AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0);
     653                                if (topmap.containsKey(Att.TOPSHP)) {
     654                                        Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.DAYMAR), Topmarks.FloatDelta);
     655                                }
     656                        }
    647657                        addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50)));
    648658                        Signals.addSignals();
  • applications/editors/josm/plugins/seachart/src/render/Signals.java

    r32090 r32093  
    117117                        case BCNSAW:
    118118                        case BCNSPP:
     119                                if ((Rules.feature.objs.containsKey(Obj.TOPMAR)) || (Rules.feature.objs.containsKey(Obj.DAYMAR))) {
     120                                        Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -140)));
     121                                } else {
     122                                        Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -80)));
     123                                }
     124                                break;
    119125                        case LITFLT:
    120126                        case LITVES:
    121127                        case BOYINB:
    122128                                if ((Rules.feature.objs.containsKey(Obj.TOPMAR)) || (Rules.feature.objs.containsKey(Obj.DAYMAR))) {
    123                                         Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -140)));
     129                                        Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -110)));
    124130                                } else {
    125                                         Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -80)));
     131                                        Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -60)));
    126132                                }
    127133                                break;
     
    140146                        case BOYSPP:
    141147                                if ((Rules.feature.objs.containsKey(Obj.TOPMAR)) || (Rules.feature.objs.containsKey(Obj.DAYMAR))) {
    142                                         if (Rules.testAttribute(Rules.feature.type, Att.BOYSHP, BoySHP.BOY_PILR) || Rules.testAttribute(Rules.feature.type, Att.BOYSHP, BoySHP.BOY_PILR)) {
    143                                                 Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(45, -140)));
     148                                        if (Rules.testAttribute(Rules.feature.type, Att.BOYSHP, BoySHP.BOY_PILR) || Rules.testAttribute(Rules.feature.type, Att.BOYSHP, BoySHP.BOY_SPAR)) {
     149                                                Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(50, -160)));
    144150                                        } else {
    145151                                                Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(25, -80)));
    146152                                        }
    147153                                } else {
    148                                         if (Rules.testAttribute(Rules.feature.type, Att.BOYSHP, BoySHP.BOY_PILR) || Rules.testAttribute(Rules.feature.type, Att.BOYSHP, BoySHP.BOY_PILR)) {
     154                                        if (Rules.testAttribute(Rules.feature.type, Att.BOYSHP, BoySHP.BOY_PILR) || Rules.testAttribute(Rules.feature.type, Att.BOYSHP, BoySHP.BOY_SPAR)) {
    149155                                                Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(30, -100)));
    150156                                        } else {
     
    164170                if (Renderer.zoom >= 15) {
    165171                        AttMap atts = Rules.feature.objs.get(Obj.FOGSIG).get(0);
    166                         String str = "";
    167                         if (atts.containsKey(Att.CATFOG)) {
    168                                 str += fogSignals.get(((ArrayList<?>) (atts.get(Att.CATFOG).val)).get(0));
    169                         }
    170                         if (atts.containsKey(Att.SIGGRP)) {
    171                                 str += "(" + atts.get(Att.SIGGRP).val + ")";
    172                         } else {
    173                                 str += " ";
    174                         }
    175                         if (atts.containsKey(Att.SIGPER)) {
    176                                 str += df.format(atts.get(Att.SIGPER).val) + "s";
    177                         }
    178                         if (atts.containsKey(Att.VALMXR)) {
    179                                 str += df.format(atts.get(Att.VALMXR).val) + "M";
    180                         }
    181                         if (!str.isEmpty()) {
    182                                 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-60, -30)));
     172                        if (atts != null) {
     173                                String str = "";
     174                                if (atts.containsKey(Att.CATFOG)) {
     175                                        str += fogSignals.get(((ArrayList<?>) (atts.get(Att.CATFOG).val)).get(0));
     176                                }
     177                                if (atts.containsKey(Att.SIGGRP)) {
     178                                        str += "(" + atts.get(Att.SIGGRP).val + ")";
     179                                } else {
     180                                        str += " ";
     181                                }
     182                                if (atts.containsKey(Att.SIGPER)) {
     183                                        str += df.format(atts.get(Att.SIGPER).val) + "s";
     184                                }
     185                                if (atts.containsKey(Att.VALMXR)) {
     186                                        str += df.format(atts.get(Att.VALMXR).val) + "M";
     187                                }
     188                                if (!str.isEmpty()) {
     189                                        Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-60, -30)));
     190                                }
    183191                        }
    184192                }
Note: See TracChangeset for help on using the changeset viewer.