Ignore:
Timestamp:
2016-06-23T14:17:55+02:00 (10 years ago)
Author:
malcolmh
Message:

updates

File:
1 edited

Legend:

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

    r32105 r32380  
    215215                        if (testObject(Obj.ROADWY)) for (Feature f : objects) if (testFeature(f)) highways();
    216216                        if (testObject(Obj.RAILWY)) for (Feature f : objects) if (testFeature(f)) highways();
     217                }
     218                if (Renderer.context.ruleset() == RuleSet.ALL) {
     219                        if (testObject(Obj.SOUNDG)) for (Feature f : objects) if (testFeature(f)) depths();
     220                        if (testObject(Obj.DEPCNT)) for (Feature f : objects) if (testFeature(f)) depths();
    217221                }
    218222                if (testObject(Obj.SLCONS)) for (Feature f : objects) if (testFeature(f)) shoreline();
     
    388392                                if ((Renderer.zoom >= 10) && (name != null))
    389393                                        if (feature.geom.prim == Pflag.LINE) {
    390                                                 Renderer.lineText(name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40);
     394                                                Renderer.lineText(name, new Font("Arial", Font.PLAIN, 150), Color.black, -40);
    391395                                        } else {
    392396                                                Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
     
    396400                                if ((Renderer.zoom >= 12) && (name != null))
    397401                                        if (feature.geom.prim == Pflag.LINE) {
    398                                                 Renderer.lineText(name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40);
     402                                                Renderer.lineText(name, new Font("Arial", Font.PLAIN, 150), Color.black, -40);
    399403                                        } else {
    400404                                                Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
     
    411415                                        } else if (feature.geom.prim == Pflag.LINE) {
    412416                                                if (name != null) {
    413                                                         Renderer.lineText(name, new Font("Arial", Font.ITALIC, 75), Color.black, 0.5, -40);
    414                                                         Renderer.lineText("(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, 0.5, 0);
     417                                                        Renderer.lineText(name, new Font("Arial", Font.ITALIC, 75), Color.black, -40);
     418                                                        Renderer.lineText("(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, 0);
    415419                                                }
    416420                                        } else {
     
    503507                                }
    504508                        }
     509                        if (hasObject(Obj.NOTMRK))
     510                                notices();
    505511                        addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(60, -50)));
    506512                        Signals.addSignals();
     
    608614                                Renderer.labelText(("Ch." + chn), new Font("Arial", Font.PLAIN, 50), Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0,50)));
    609615                        }
     616                }
     617        }
     618       
     619        private static void depths() {
     620                switch (feature.type) {
     621                case SOUNDG:
     622                        if ((Renderer.zoom >= 14) && hasAttribute(Obj.SOUNDG, Att.VALSOU)) {
     623                                double depth = (double)getAttVal(Obj.SOUNDG, Att.VALSOU);
     624                                String dstr = df.format(depth);
     625                                String tok[] = dstr.split("[-.]");
     626                                String ul = "";
     627                                String id = tok[0];
     628                                String dd = "";
     629                                if (tok[0].equals("")) {
     630                                        for (int i = 0; i <  tok[1].length(); i++)
     631                                                ul += "_";
     632                                        id = tok[1];
     633                                        dd = (tok.length == 3) ? tok[2] : "";
     634                                } else {
     635                                        dd = (tok.length == 2) ? tok[1] : "";
     636                                }
     637                                Renderer.labelText(ul, new Font("Arial", Font.PLAIN, 30), Color.black, new Delta(Handle.RC, AffineTransform.getTranslateInstance(10,15)));
     638                                Renderer.labelText(id, new Font("Arial", Font.PLAIN, 30), Color.black, new Delta(Handle.RC, AffineTransform.getTranslateInstance(10,0)));
     639                                Renderer.labelText(dd, new Font("Arial", Font.PLAIN, 20), Color.black, new Delta(Handle.LC, AffineTransform.getTranslateInstance(15,10)));
     640                        }
     641                        break;
     642                case DEPCNT:
     643                        break;
     644                default:
     645                        break;
    610646                }
    611647        }
     
    700736                case ACHBRT:
    701737                        if (Renderer.zoom >= 14) {
    702                                 Renderer.symbol(Harbours.Anchorage, new Scheme(Symbols.Mline));
     738                                Renderer.symbol(Harbours.Anchor, new Scheme(Symbols.Msymb));
    703739                                if (Renderer.zoom >= 15) {
    704                                         Renderer.labelText(name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Symbols.Msymb, LabelStyle.RRCT, Symbols.Mline, Color.white, new Delta(Handle.BC));
     740                                        Renderer.labelText(name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Symbols.Msymb, LabelStyle.RRCT, Symbols.Msymb, Color.white, new Delta(Handle.BC));
    705741                                }
    706742                        }
     
    9931029        }
    9941030
     1031        @SuppressWarnings("unchecked")
    9951032        private static void notices() {
    9961033                if (Renderer.zoom >= 14) {
     
    10021039                        case BCNSAW:
    10031040                        case BCNSPP:
    1004                                 dy = 45.0;
     1041                                if (testAttribute(Obj.TOPMAR, Att.TOPSHP, TopSHP.TOP_BORD) || testAttribute(Obj.DAYMAR, Att.TOPSHP, TopSHP.TOP_BORD)) {
     1042                                        dy = -100.0;
     1043                                } else {
     1044                                        dy = -45.0;
     1045                                }
    10051046                                break;
    10061047                        case NOTMRK:
     
    10231064                                int i = 0;
    10241065                                for (AttMap atts : objs.values()) {
    1025                                         if (atts.get(Att.MARSYS) != null) sys = (MarSYS)(getAttEnum(Obj.NOTMRK, Att.MARSYS));
    1026                                         if (atts.get(Att.BNKWTW) != null) bnk = (BnkWTW)(getAttEnum(Obj.NOTMRK, Att.BNKWTW));
     1066                                        if (atts.get(Att.MARSYS) != null) sys = ((ArrayList<MarSYS>)(atts.get(Att.MARSYS).val)).get(0);
     1067                                        if (atts.get(Att.BNKWTW) != null) bnk = ((ArrayList<BnkWTW>)(atts.get(Att.BNKWTW).val)).get(0);
    10271068                                        CatNMK cat = CatNMK.NMK_UNKN;
    1028                                         if (atts.get(Att.CATNMK) != null) cat = (CatNMK)(getAttEnum(Obj.NOTMRK, Att.CATNMK));
     1069                                        if (atts.get(Att.CATNMK) != null) cat = ((ArrayList<CatNMK>)(atts.get(Att.CATNMK).val)).get(0);
    10291070                                        Symbol sym = Notices.getNotice(cat, sys, bnk);
    10301071                                        Scheme sch = Notices.getScheme(sys, bnk);
     1072                                        ArrayList<AddMRK> add = new ArrayList<>();
     1073                                        if (atts.get(Att.ADDMRK) != null) add = (ArrayList<AddMRK>)(atts.get(Att.ADDMRK).val);
    10311074                                        Handle h = Handle.CC;
     1075                                        double ax = 0.0;
     1076                                        double ay = 0.0;
    10321077                                        switch (i) {
    10331078                                        case 0:
     
    10351080                                                break;
    10361081                                        case 1:
    1037                                                 if (n <= 3)
     1082                                                if (n <= 3) {
    10381083                                                        h = Handle.RC;
    1039                                                 else
     1084                                                        ax = -30;
     1085                                                        ay = dy;
     1086                                                }
     1087                                                else {
    10401088                                                        h = Handle.BR;
     1089                                                }
    10411090                                                break;
    10421091                                        case 2:
     
    10561105                                                break;
    10571106                                        }
    1058                                         if (h != null) Renderer.symbol(sym, sch, new Delta(h, AffineTransform.getTranslateInstance(dx, dy)));
     1107                                        if (h != null) {
     1108                                                Renderer.symbol(sym, sch, new Delta(h, AffineTransform.getTranslateInstance(dx, dy)));
     1109                                                if (!add.isEmpty()) Renderer.symbol(Notices.NoticeBoard, new Delta(Handle.BC, AffineTransform.getTranslateInstance(ax, ay - 30)));
     1110                                        }
    10591111                                        i++;
    10601112                                }
     
    10691121                                Renderer.lineVector(new LineStyle(Color.black, 5, new float[] { 20, 20 }, null));
    10701122                                if (Renderer.zoom >= 15) {
    1071                                         Renderer.lineText("Boom", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
     1123                                        Renderer.lineText("Boom", new Font("Arial", Font.PLAIN, 80), Color.black, -20);
    10721124                                }
    10731125                        default:
     
    11861238                                                Renderer.lineVector(new LineStyle(Color.black, 10, new float[] { 40, 40 }, null));
    11871239                                                if (Renderer.zoom >= 15)
    1188                                                         Renderer.lineText("(covers)", new Font("Arial", Font.PLAIN, 60), Color.black, 0.5, 80);
     1240                                                        Renderer.lineText("(covers)", new Font("Arial", Font.PLAIN, 60), Color.black, 80);
    11891241                                        } else {
    11901242                                                Renderer.lineVector(new LineStyle(Color.black, 10, null, null));
    11911243                                        }
    11921244                                        if (Renderer.zoom >= 15)
    1193                                                 Renderer.lineText("Training Wall", new Font("Arial", Font.PLAIN, 60), Color.black, 0.5, -30);
     1245                                                Renderer.lineText("Training Wall", new Font("Arial", Font.PLAIN, 60), Color.black, -30);
    11941246                                        break;
    11951247                                case SLC_SWAY:
     
    13331385                                str += df.format(ort) + "º";
    13341386                                if (!str.isEmpty())
    1335                                         Renderer.lineText(str, new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
     1387                                        Renderer.lineText(str, new Font("Arial", Font.PLAIN, 80), Color.black, -20);
    13361388                        }
    13371389                }
Note: See TracChangeset for help on using the changeset viewer.