Changeset 32380 in osm for applications/editors/josm/plugins/seachart/src/render/Rules.java
- Timestamp:
- 2016-06-23T14:17:55+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachart/src/render/Rules.java
r32105 r32380 215 215 if (testObject(Obj.ROADWY)) for (Feature f : objects) if (testFeature(f)) highways(); 216 216 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(); 217 221 } 218 222 if (testObject(Obj.SLCONS)) for (Feature f : objects) if (testFeature(f)) shoreline(); … … 388 392 if ((Renderer.zoom >= 10) && (name != null)) 389 393 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); 391 395 } else { 392 396 Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); … … 396 400 if ((Renderer.zoom >= 12) && (name != null)) 397 401 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); 399 403 } else { 400 404 Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); … … 411 415 } else if (feature.geom.prim == Pflag.LINE) { 412 416 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); 415 419 } 416 420 } else { … … 503 507 } 504 508 } 509 if (hasObject(Obj.NOTMRK)) 510 notices(); 505 511 addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(60, -50))); 506 512 Signals.addSignals(); … … 608 614 Renderer.labelText(("Ch." + chn), new Font("Arial", Font.PLAIN, 50), Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0,50))); 609 615 } 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; 610 646 } 611 647 } … … 700 736 case ACHBRT: 701 737 if (Renderer.zoom >= 14) { 702 Renderer.symbol(Harbours.Anchor age, new Scheme(Symbols.Mline));738 Renderer.symbol(Harbours.Anchor, new Scheme(Symbols.Msymb)); 703 739 if (Renderer.zoom >= 15) { 704 Renderer.labelText(name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Symbols.Msymb, LabelStyle.RRCT, Symbols.M line, 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)); 705 741 } 706 742 } … … 993 1029 } 994 1030 1031 @SuppressWarnings("unchecked") 995 1032 private static void notices() { 996 1033 if (Renderer.zoom >= 14) { … … 1002 1039 case BCNSAW: 1003 1040 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 } 1005 1046 break; 1006 1047 case NOTMRK: … … 1023 1064 int i = 0; 1024 1065 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); 1027 1068 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); 1029 1070 Symbol sym = Notices.getNotice(cat, sys, bnk); 1030 1071 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); 1031 1074 Handle h = Handle.CC; 1075 double ax = 0.0; 1076 double ay = 0.0; 1032 1077 switch (i) { 1033 1078 case 0: … … 1035 1080 break; 1036 1081 case 1: 1037 if (n <= 3) 1082 if (n <= 3) { 1038 1083 h = Handle.RC; 1039 else 1084 ax = -30; 1085 ay = dy; 1086 } 1087 else { 1040 1088 h = Handle.BR; 1089 } 1041 1090 break; 1042 1091 case 2: … … 1056 1105 break; 1057 1106 } 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 } 1059 1111 i++; 1060 1112 } … … 1069 1121 Renderer.lineVector(new LineStyle(Color.black, 5, new float[] { 20, 20 }, null)); 1070 1122 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); 1072 1124 } 1073 1125 default: … … 1186 1238 Renderer.lineVector(new LineStyle(Color.black, 10, new float[] { 40, 40 }, null)); 1187 1239 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); 1189 1241 } else { 1190 1242 Renderer.lineVector(new LineStyle(Color.black, 10, null, null)); 1191 1243 } 1192 1244 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); 1194 1246 break; 1195 1247 case SLC_SWAY: … … 1333 1385 str += df.format(ort) + "º"; 1334 1386 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); 1336 1388 } 1337 1389 }
Note:
See TracChangeset
for help on using the changeset viewer.
