Changeset 30992 in osm for applications/editors/josm/plugins/seachart
- Timestamp:
- 2015-02-15T19:38:42+01:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/seachart/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachart/src/render/Rules.java
r30932 r30992 17 17 import java.util.HashMap; 18 18 19 import s57.S57val; 19 20 import s57.S57val.*; 20 21 import s57.S57att.*; … … 27 28 public class Rules { 28 29 29 public static final Color Yland = new Color(0x50b0ff); 30 public static final Color Yland = new Color(0xeca818); 31 public static final Color Bwater = new Color(0x2ea8d8); 30 32 public static final Color Mline = new Color(0xc480ff); 31 33 public static final Color Msymb = new Color(0xa30075); … … 113 115 } 114 116 117 public static String getAttStr(Feature feature, Obj obj, int idx, Att att) { 118 String str = (String)getAttVal(feature, obj, idx, att); 119 if (str != null) { 120 return str; 121 } 122 return ""; 123 } 124 125 public static Enum<?> getAttEnum(Feature feature, Obj obj, int idx, Att att) { 126 ArrayList<?> list = (ArrayList<?>)getAttVal(feature, obj, idx, att); 127 if (list != null) { 128 return ((ArrayList<Enum>)list).get(0); 129 } 130 return S57val.unknAtt(att); 131 } 132 133 public static ArrayList<?> getAttList(Feature feature, Obj obj, int idx, Att att) { 134 ArrayList<Enum<?>> list = (ArrayList<Enum<?>>)getAttVal(feature, obj, idx, att); 135 if (list != null) { 136 return list; 137 } 138 list = new ArrayList<>(); 139 list.add(S57val.unknAtt(att)); 140 return list; 141 } 142 115 143 static Scheme getScheme(Feature feature, Obj obj) { 116 144 ArrayList<Color> colours = new ArrayList<Color>(); 117 if (colours.size() > 0) { 118 for (ColCOL col : (ArrayList<ColCOL>) getAttVal(feature, obj, 0, Att.COLOUR)) { 119 colours.add(bodyColours.get(col)); 120 } 145 for (ColCOL col : (ArrayList<ColCOL>) getAttList(feature, obj, 0, Att.COLOUR)) { 146 colours.add(bodyColours.get(col)); 121 147 } 122 148 ArrayList<Patt> patterns = new ArrayList<Patt>(); 123 if (patterns.size() > 0) { 124 for (ColPAT pat : (ArrayList<ColPAT>) getAttVal(feature, obj, 0, Att.COLPAT)) { 125 patterns.add(pattMap.get(pat)); 126 } 149 for (ColPAT pat : (ArrayList<ColPAT>) getAttList(feature, obj, 0, Att.COLPAT)) { 150 patterns.add(pattMap.get(pat)); 127 151 } 128 152 return new Scheme(patterns, colours); … … 152 176 public static void rules () { 153 177 ArrayList<Feature> objects; 178 if ((objects = Renderer.map.features.get(Obj.COALNE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature); 154 179 if ((objects = Renderer.map.features.get(Obj.SLCONS)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) shoreline(feature); 155 180 if ((objects = Renderer.map.features.get(Obj.PIPSOL)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) pipelines(feature); … … 229 254 String name = getName(feature); 230 255 switch (feature.type) { 256 case COALNE: 257 Renderer.lineVector(feature, new LineStyle(Color.black, 8, Yland)); 258 break; 231 259 case DRGARE: 232 260 if (Renderer.zoom < 16) … … 274 302 break; 275 303 case SEAARE: 276 CatSEA cat; 277 if ((cat = (CatSEA) getAttVal(feature, feature.type, 0, Att.CATSEA)) != null) { 278 switch (cat) { 279 case SEA_RECH: 280 if ((Renderer.zoom >= 10) && (name != null)) 281 if (feature.geom.prim == Pflag.LINE) { 282 Renderer.lineText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40); 283 } else { 284 Renderer.labelText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 304 switch ((CatSEA) getAttEnum(feature, feature.type, 0, Att.CATSEA)) { 305 case SEA_RECH: 306 if ((Renderer.zoom >= 10) && (name != null)) 307 if (feature.geom.prim == Pflag.LINE) { 308 Renderer.lineText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40); 309 } else { 310 Renderer.labelText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 311 } 312 break; 313 case SEA_BAY: 314 if ((Renderer.zoom >= 12) && (name != null)) 315 if (feature.geom.prim == Pflag.LINE) { 316 Renderer.lineText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40); 317 } else { 318 Renderer.labelText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 319 } 320 break; 321 case SEA_SHOL: 322 if (Renderer.zoom >= 14) { 323 if (feature.geom.prim == Pflag.AREA) { 324 Renderer.lineVector(feature, new LineStyle(new Color(0xc480ff), 4, new float[] { 25, 25 })); 325 if (name != null) { 326 Renderer.labelText(feature, name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 327 Renderer.labelText(feature, "(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC)); 285 328 } 286 break; 287 case SEA_BAY: 288 if ((Renderer.zoom >= 12) && (name != null)) 289 if (feature.geom.prim == Pflag.LINE) { 290 Renderer.lineText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40); 291 } else { 292 Renderer.labelText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 329 } else if (feature.geom.prim == Pflag.LINE) { 330 if (name != null) { 331 Renderer.lineText(feature, name, new Font("Arial", Font.ITALIC, 75), Color.black, 0.5, -40); 332 Renderer.lineText(feature, "(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, 0.5, 0); 293 333 } 294 break; 295 case SEA_SHOL: 296 if (Renderer.zoom >= 14) { 297 if (feature.geom.prim == Pflag.AREA) { 298 Renderer.lineVector(feature, new LineStyle(new Color(0xc480ff), 4, new float[] { 25, 25 })); 299 if (name != null) { 300 Renderer.labelText(feature, name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 301 Renderer.labelText(feature, "(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC)); 302 } 303 } else if (feature.geom.prim == Pflag.LINE) { 304 if (name != null) { 305 Renderer.lineText(feature, name, new Font("Arial", Font.ITALIC, 75), Color.black, 0.5, -40); 306 Renderer.lineText(feature, "(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, 0.5, 0); 307 } 308 } else { 309 if (name != null) { 310 Renderer.labelText(feature, name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 311 Renderer.labelText(feature, "(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC)); 312 } 334 } else { 335 if (name != null) { 336 Renderer.labelText(feature, name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 337 Renderer.labelText(feature, "(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC)); 313 338 } 314 339 } 315 break;316 case SEA_GAT:317 case SEA_NRRW:318 addName(feature, 12, new Font("Arial", Font.PLAIN, 100));319 break;320 default:321 break;322 }323 break;324 }340 } 341 break; 342 case SEA_GAT: 343 case SEA_NRRW: 344 addName(feature, 12, new Font("Arial", Font.PLAIN, 100)); 345 break; 346 default: 347 break; 348 } 349 break; 325 350 case SNDWAV: 326 351 if (Renderer.zoom >= 12) Renderer.fillPattern(feature, Areas.Sandwaves); … … 340 365 private static void beacons(Feature feature) { 341 366 if ((Renderer.zoom >= 14) || ((Renderer.zoom >= 12) && ((feature.type == Obj.BCNLAT) || (feature.type == Obj.BCNCAR)))) { 342 CatLAM cat; 343 BcnSHP shape = (BcnSHP) getAttVal(feature, feature.type, 0, Att.BCNSHP); 344 if (shape == null) 367 BcnSHP shape = (BcnSHP)getAttEnum(feature, feature.type, 0, Att.BCNSHP); 368 if (shape == BcnSHP.BCN_UNKN) 345 369 shape = BcnSHP.BCN_PILE; 346 370 if ((shape == BcnSHP.BCN_WTHY) && (feature.type == Obj.BCNLAT)) { 347 if ((cat = (CatLAM) getAttVal(feature, feature.type, 0, Att.CATLAM)) != null) { 348 switch (cat) { 349 case LAM_PORT: 350 Renderer.symbol(feature, Beacons.WithyPort); 351 break; 352 case LAM_STBD: 353 Renderer.symbol(feature, Beacons.WithyStarboard); 354 break; 355 default: 356 Renderer.symbol(feature, Beacons.Stake, getScheme(feature, feature.type)); 357 } 371 switch ((CatLAM) getAttEnum(feature, feature.type, 0, Att.CATLAM)) { 372 case LAM_PORT: 373 Renderer.symbol(feature, Beacons.WithyPort); 374 break; 375 case LAM_STBD: 376 Renderer.symbol(feature, Beacons.WithyStarboard); 377 break; 378 default: 379 Renderer.symbol(feature, Beacons.Stake, getScheme(feature, feature.type)); 358 380 } 359 381 } else if ((shape == BcnSHP.BCN_PRCH) && (feature.type == Obj.BCNLAT) && !(feature.objs.containsKey(Obj.TOPMAR))) { 360 if ((cat = (CatLAM) getAttVal(feature, feature.type, 0, Att.CATLAM)) != null) { 361 switch (cat) { 362 case LAM_PORT: 363 Renderer.symbol(feature, Beacons.PerchPort); 364 break; 365 case LAM_STBD: 366 Renderer.symbol(feature, Beacons.PerchStarboard); 367 break; 368 default: 369 Renderer.symbol(feature, Beacons.Stake, getScheme(feature, feature.type)); 370 } 371 } else { 372 Renderer.symbol(feature, Beacons.Shapes.get(shape), getScheme(feature, feature.type)); 373 if (feature.objs.containsKey(Obj.TOPMAR)) { 374 Symbol topmark = Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val); 375 if (topmark != null) 376 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), getScheme(feature, Obj.TOPMAR), Topmarks.BeaconDelta); 377 } else if (feature.objs.containsKey(Obj.DAYMAR)) { 378 Symbol topmark = Topmarks.Shapes.get(feature.objs.get(Obj.DAYMAR).get(0).get(Att.TOPSHP).val); 379 if (topmark != null) 380 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.DAYMAR).get(0).get(Att.TOPSHP).val), getScheme(feature, Obj.DAYMAR), Topmarks.BeaconDelta); 381 } 382 } 383 Signals.addSignals(feature); 384 } 382 switch ((CatLAM) getAttEnum(feature, feature.type, 0, Att.CATLAM)) { 383 case LAM_PORT: 384 Renderer.symbol(feature, Beacons.PerchPort); 385 break; 386 case LAM_STBD: 387 Renderer.symbol(feature, Beacons.PerchStarboard); 388 break; 389 default: 390 Renderer.symbol(feature, Beacons.Stake, getScheme(feature, feature.type)); 391 } 392 } else { 393 Renderer.symbol(feature, Beacons.Shapes.get(shape), getScheme(feature, feature.type)); 394 if (feature.objs.containsKey(Obj.TOPMAR)) { 395 Symbol topmark = Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val); 396 if (topmark != null) 397 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), getScheme(feature, Obj.TOPMAR), Topmarks.BeaconDelta); 398 } else if (feature.objs.containsKey(Obj.DAYMAR)) { 399 Symbol topmark = Topmarks.Shapes.get(feature.objs.get(Obj.DAYMAR).get(0).get(Att.TOPSHP).val); 400 if (topmark != null) 401 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.DAYMAR).get(0).get(Att.TOPSHP).val), getScheme(feature, Obj.DAYMAR), Topmarks.BeaconDelta); 402 } 403 } 404 Signals.addSignals(feature); 385 405 } 386 406 } … … 388 408 private static void buoys(Feature feature) { 389 409 if ((Renderer.zoom >= 14) || ((Renderer.zoom >= 12) && ((feature.type == Obj.BOYLAT) || (feature.type == Obj.BOYCAR)))) { 390 BoySHP shape = (BoySHP) getAtt Val(feature, feature.type, 0, Att.BOYSHP);391 if (shape == null) shape = BoySHP.BOY_PILR;410 BoySHP shape = (BoySHP) getAttEnum(feature, feature.type, 0, Att.BOYSHP); 411 if (shape == BoySHP.BOY_UNKN) shape = BoySHP.BOY_PILR; 392 412 Renderer.symbol(feature, Buoys.Shapes.get(shape), getScheme(feature, feature.type)); 393 413 if (feature.objs.containsKey(Obj.TOPMAR)) { … … 474 494 if (Renderer.zoom >= 14) { 475 495 Symbol symb = Harbours.CallPoint2; 476 TrfTRF trf; 477 if ((trf = (TrfTRF) getAttVal(feature, feature.type, 0, Att.TRAFIC)) != null) { 478 if (trf != TrfTRF.TRF_TWOW) { 479 symb = Harbours.CallPoint1; 480 } 496 TrfTRF trf = (TrfTRF) getAttEnum(feature, feature.type, 0, Att.TRAFIC); 497 if (trf != TrfTRF.TRF_TWOW) { 498 symb = Harbours.CallPoint1; 481 499 } 482 500 Double orient = 0.0; … … 486 504 Renderer.symbol(feature, symb, new Delta(Handle.CC, AffineTransform.getRotateInstance(Math.toRadians(orient)))); 487 505 String chn; 488 if ( (chn = (String) getAttVal(feature, feature.type, 0, Att.COMCHA)) != null) {506 if (!(chn = getAttStr(feature, feature.type, 0, Att.COMCHA)).isEmpty()) { 489 507 Renderer.labelText(feature, ("Ch." + chn), new Font("Arial", Font.PLAIN, 50), Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0,50))); 490 508 } … … 571 589 } 572 590 } 573 double radius = (Double)getAttVal(feature, Obj.ACHBRT, 0, Att.RADIUS); 574 if (radius != 0) { 575 UniHLU units = (UniHLU)getAttVal(feature, Obj.ACHBRT, 0, Att.HUNITS); 576 Renderer.lineCircle (feature, new LineStyle(Mline, 4, new float[] { 10, 10 }, null), radius, units); 591 if (getAttVal(feature, Obj.ACHBRT, 0, Att.RADIUS) != null) { 592 double radius; 593 if ((radius = (Double) getAttVal(feature, Obj.ACHBRT, 0, Att.RADIUS)) != 0) { 594 UniHLU units = (UniHLU) getAttEnum(feature, Obj.ACHBRT, 0, Att.HUNITS); 595 if (units == UniHLU.HLU_UNKN) { 596 units = UniHLU.HLU_METR; 597 } 598 Renderer.lineCircle(feature, new LineStyle(Mline, 4, new float[] { 10, 10 }, null), radius, units); 599 } 577 600 } 578 601 break; … … 586 609 } 587 610 addName(feature, 15, new Font("Arial", Font.BOLD, 60), Mline, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0))); 588 ArrayList<StsSTS> sts = (ArrayList<StsSTS>)getAtt Val(feature, Obj.ACHARE, 0, Att.STATUS);589 if ((Renderer.zoom >= 15) && (sts != null) && (sts.contains(StsSTS.STS_RESV))) {611 ArrayList<StsSTS> sts = (ArrayList<StsSTS>)getAttList(feature, Obj.ACHARE, 0, Att.STATUS); 612 if ((Renderer.zoom >= 15) && (sts.contains(StsSTS.STS_RESV))) { 590 613 Renderer.labelText(feature, "Reserved", new Font("Arial", Font.PLAIN, 50), Mline, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60))); 591 614 } 592 615 } 593 ArrayList<CatACH> cats; 594 if ((cats = (ArrayList<CatACH>) getAttVal(feature, Obj.ACHARE, 0, Att.CATACH)) != null) { 595 int dy = (cats.size() - 1) * -30; 596 for (CatACH cat : cats) { 597 switch (cat) { 598 case ACH_DEEP: 599 Renderer.labelText(feature, "DW", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 600 dy += 60; 601 break; 602 case ACH_TANK: 603 Renderer.labelText(feature, "Tanker", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 604 dy += 60; 605 break; 606 case ACH_H24P: 607 Renderer.labelText(feature, "24h", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 608 dy += 60; 609 break; 610 case ACH_EXPL: 611 Renderer.symbol(feature, Harbours.Explosives, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 612 dy += 60; 613 break; 614 case ACH_QUAR: 615 Renderer.symbol(feature, Harbours.Hospital, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 616 dy += 60; 617 break; 618 case ACH_SEAP: 619 Renderer.symbol(feature, Areas.Seaplane, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 620 dy += 60; 621 break; 622 default: 623 } 616 ArrayList<CatACH> cats = (ArrayList<CatACH>) getAttList(feature, Obj.ACHARE, 0, Att.CATACH); 617 int dy = (cats.size() - 1) * -30; 618 for (CatACH cat : cats) { 619 switch (cat) { 620 case ACH_DEEP: 621 Renderer.labelText(feature, "DW", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 622 dy += 60; 623 break; 624 case ACH_TANK: 625 Renderer.labelText(feature, "Tanker", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 626 dy += 60; 627 break; 628 case ACH_H24P: 629 Renderer.labelText(feature, "24h", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 630 dy += 60; 631 break; 632 case ACH_EXPL: 633 Renderer.symbol(feature, Harbours.Explosives, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 634 dy += 60; 635 break; 636 case ACH_QUAR: 637 Renderer.symbol(feature, Harbours.Hospital, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 638 dy += 60; 639 break; 640 case ACH_SEAP: 641 Renderer.symbol(feature, Areas.Seaplane, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 642 dy += 60; 643 break; 644 default: 624 645 } 625 646 } … … 634 655 if (Renderer.zoom >= 16) { 635 656 ArrayList<Symbol> symbols = new ArrayList<Symbol>(); 636 ArrayList<FncFNC> fncs; 637 if ((fncs = (ArrayList<FncFNC>) getAttVal(feature, Obj.BUISGL, 0, Att.FUNCTN)) != null) { 638 for (FncFNC fnc : fncs) { 639 symbols.add(Landmarks.Funcs.get(fnc)); 640 } 641 if (feature.objs.containsKey(Obj.SMCFAC)) { 642 ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttVal(feature, Obj.SMCFAC, 0, Att.CATSCF); 643 for (CatSCF scf : scfs) { 644 symbols.add(Facilities.Cats.get(scf)); 645 } 646 } 647 Renderer.cluster(feature, symbols); 648 } 657 ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) getAttList(feature, Obj.BUISGL, 0, Att.FUNCTN); 658 for (FncFNC fnc : fncs) { 659 symbols.add(Landmarks.Funcs.get(fnc)); 660 } 661 if (feature.objs.containsKey(Obj.SMCFAC)) { 662 ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttList(feature, Obj.SMCFAC, 0, Att.CATSCF); 663 for (CatSCF scf : scfs) { 664 symbols.add(Facilities.Cats.get(scf)); 665 } 666 } 667 Renderer.cluster(feature, symbols); 649 668 } 650 669 break; 651 670 case HRBFAC: 652 671 if (Renderer.zoom >= 12) { 653 ArrayList<CatHAF> cathaf; 654 if ((cathaf = (ArrayList<CatHAF>) getAttVal(feature, Obj.HRBFAC, 0, Att.CATHAF)) != null) { 655 if (cathaf.size() == 1) { 656 switch (cathaf.get(0)) { 657 case HAF_MRNA: 658 Renderer.symbol(feature, Harbours.Marina); 659 break; 660 case HAF_MANF: 661 Renderer.symbol(feature, Harbours.MarinaNF); 662 break; 663 case HAF_FISH: 664 Renderer.symbol(feature, Harbours.Fishing); 665 break; 666 default: 667 Renderer.symbol(feature, Harbours.Harbour); 668 break; 669 } 670 } else { 672 ArrayList<CatHAF> cathaf = (ArrayList<CatHAF>) getAttList(feature, Obj.HRBFAC, 0, Att.CATHAF); 673 if (cathaf.size() == 1) { 674 switch (cathaf.get(0)) { 675 case HAF_MRNA: 676 Renderer.symbol(feature, Harbours.Marina); 677 break; 678 case HAF_MANF: 679 Renderer.symbol(feature, Harbours.MarinaNF); 680 break; 681 case HAF_FISH: 682 Renderer.symbol(feature, Harbours.Fishing); 683 break; 684 default: 671 685 Renderer.symbol(feature, Harbours.Harbour); 672 } 686 break; 687 } 688 } else { 689 Renderer.symbol(feature, Harbours.Harbour); 673 690 } 674 691 } … … 680 697 681 698 private static void landmarks(Feature feature) { 682 ArrayList<CatLMK> cats; 683 ArrayList<FncFNC> fncs; 684 Symbol catSym = new Symbol(); 685 Symbol fncSym = new Symbol(); 686 if ((cats = (ArrayList<CatLMK>) getAttVal(feature, feature.type, 0, Att.CATLMK)) != null) { 687 catSym = Landmarks.Shapes.get(cats.get(0)); 688 } 689 if ((fncs = (ArrayList<FncFNC>) getAttVal(feature, feature.type, 0, Att.FUNCTN)) != null) { 690 fncSym = Landmarks.Funcs.get(fncs.get(0)); 691 } 699 ArrayList<CatLMK> cats = (ArrayList<CatLMK>) getAttList(feature, feature.type, 0, Att.CATLMK); 700 Symbol catSym = Landmarks.Shapes.get(cats.get(0)); 701 ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) getAttList(feature, feature.type, 0, Att.FUNCTN); 702 Symbol fncSym = Landmarks.Funcs.get(fncs.get(0)); 692 703 if ((fncs.get(0) == FncFNC.FNC_CHCH) && (cats.get(0) == CatLMK.LMK_TOWR)) 693 704 catSym = Landmarks.ChurchTower; … … 738 749 if (Renderer.zoom >= 16) { 739 750 ArrayList<Symbol> symbols = new ArrayList<Symbol>(); 740 ArrayList<CatSCF> scfs; 741 if ((scfs = (ArrayList<CatSCF>) getAttVal(feature, Obj.SMCFAC, 0, Att.CATSCF)) != null) { 742 for (CatSCF scf : scfs) { 743 symbols.add(Facilities.Cats.get(scf)); 744 } 745 Renderer.cluster(feature, symbols); 746 } 751 ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttList(feature, Obj.SMCFAC, 0, Att.CATSCF); 752 for (CatSCF scf : scfs) { 753 symbols.add(Facilities.Cats.get(scf)); 754 } 755 Renderer.cluster(feature, symbols); 747 756 } 748 757 } 749 758 750 759 private static void moorings(Feature feature) { 751 CatMOR cat; 752 if ((cat = (CatMOR) getAttVal(feature, feature.type, 0, Att.CATMOR)) != null) { 753 switch (cat) { 754 case MOR_DLPN: 755 Renderer.symbol(feature, Harbours.Dolphin); 756 break; 757 case MOR_DDPN: 758 Renderer.symbol(feature, Harbours.DeviationDolphin); 759 break; 760 case MOR_BLRD: 761 case MOR_POST: 762 Renderer.symbol(feature, Harbours.Bollard); 763 break; 764 case MOR_BUOY: 765 BoySHP shape = (BoySHP) getAttVal(feature, feature.type, 0, Att.BOYSHP); 766 if (shape == BoySHP.BOY_UNKN) 767 shape = BoySHP.BOY_SPHR; 768 Renderer.symbol(feature, Buoys.Shapes.get(shape), getScheme(feature, feature.type)); 769 Renderer.symbol(feature, Topmarks.TopMooring, Topmarks.BuoyDeltas.get(shape)); 770 break; 771 default: 772 break; 773 } 774 Signals.addSignals(feature); 775 } 760 switch ((CatMOR) getAttEnum(feature, feature.type, 0, Att.CATMOR)) { 761 case MOR_DLPN: 762 Renderer.symbol(feature, Harbours.Dolphin); 763 break; 764 case MOR_DDPN: 765 Renderer.symbol(feature, Harbours.DeviationDolphin); 766 break; 767 case MOR_BLRD: 768 case MOR_POST: 769 Renderer.symbol(feature, Harbours.Bollard); 770 break; 771 case MOR_BUOY: 772 BoySHP shape = (BoySHP) getAttEnum(feature, feature.type, 0, Att.BOYSHP); 773 if (shape == BoySHP.BOY_UNKN) { 774 shape = BoySHP.BOY_SPHR; 775 } 776 Renderer.symbol(feature, Buoys.Shapes.get(shape), getScheme(feature, feature.type)); 777 Renderer.symbol(feature, Topmarks.TopMooring, Topmarks.BuoyDeltas.get(shape)); 778 break; 779 default: 780 break; 781 } 782 Signals.addSignals(feature); 776 783 } 777 784 … … 845 852 private static void obstructions(Feature feature) { 846 853 if ((Renderer.zoom >= 12) && (feature.type == Obj.OBSTRN)) { 847 CatOBS cat; 848 if ((cat = (CatOBS) getAttVal(feature, feature.type, 0, Att.CATOBS)) != null) { 849 switch (cat) { 854 switch ((CatOBS) getAttEnum(feature, feature.type, 0, Att.CATOBS)) { 850 855 case OBS_BOOM: 851 856 Renderer.lineVector(feature, new LineStyle(Color.black, 5, new float[] { 20, 20 }, null)); 852 if (Renderer.zoom >= 15) Renderer.lineText(feature, "Boom", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20); 857 if (Renderer.zoom >= 15) { 858 Renderer.lineText(feature, "Boom", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20); 859 } 853 860 default: 854 861 break; 855 } 856 } 862 } 857 863 } 858 864 if ((Renderer.zoom >= 14) && (feature.type == Obj.UWTROC)) { 859 WatLEV lvl; 860 if ((lvl = (WatLEV) getAttVal(feature, feature.type, 0, Att.WATLEV)) != null) { 861 switch (lvl) { 862 case LEV_CVRS: 863 Renderer.symbol(feature, Areas.RockC); 864 break; 865 case LEV_AWSH: 866 Renderer.symbol(feature, Areas.RockA); 867 break; 868 default: 869 Renderer.symbol(feature, Areas.Rock); 870 } 871 } else { 865 switch ((WatLEV) getAttEnum(feature, feature.type, 0, Att.WATLEV)) { 866 case LEV_CVRS: 867 Renderer.symbol(feature, Areas.RockC); 868 break; 869 case LEV_AWSH: 870 Renderer.symbol(feature, Areas.RockA); 871 break; 872 default: 872 873 Renderer.symbol(feature, Areas.Rock); 873 874 } 875 } else { 876 Renderer.symbol(feature, Areas.Rock); 874 877 } 875 878 } … … 898 901 899 902 private static void platforms(Feature feature) { 900 ArrayList<CatOFP> cats; 901 if ((cats = (ArrayList<CatOFP>) getAttVal(feature, Obj.OFSPLF, 0, Att.CATOFP)) != null) { 902 if ((CatOFP) cats.get(0) == CatOFP.OFP_FPSO) 903 Renderer.symbol(feature, Buoys.Storage); 904 else 905 Renderer.symbol(feature, Landmarks.Platform); 906 addName(feature, 15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50))); 907 Signals.addSignals(feature); 908 } 903 ArrayList<CatOFP> cats = (ArrayList<CatOFP>) getAttList(feature, Obj.OFSPLF, 0, Att.CATOFP); 904 if ((CatOFP) cats.get(0) == CatOFP.OFP_FPSO) 905 Renderer.symbol(feature, Buoys.Storage); 906 else 907 Renderer.symbol(feature, Landmarks.Platform); 908 addName(feature, 15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50))); 909 Signals.addSignals(feature); 909 910 } 910 911 … … 912 913 if (Renderer.zoom >= 14) { 913 914 if (feature.type == Obj.CRANES) { 914 if ((CatCRN) getAtt Val(feature, feature.type, 0, Att.CATCRN) == CatCRN.CRN_CONT)915 if ((CatCRN) getAttEnum(feature, feature.type, 0, Att.CATCRN) == CatCRN.CRN_CONT) 915 916 Renderer.symbol(feature, Harbours.ContainerCrane); 916 917 else … … 953 954 private static void shoreline(Feature feature) { 954 955 if (Renderer.zoom >= 12) { 955 CatSLC cat; 956 if ((cat = (CatSLC) getAttVal(feature, feature.type, 0, Att.CATSLC)) != null) { 957 switch (cat) { 958 case SLC_TWAL: 959 WatLEV lev; 960 if ((lev = (WatLEV) getAttVal(feature, feature.type, 0, Att.WATLEV)) != null) { 961 if (lev == WatLEV.LEV_CVRS) { 962 Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 40, 40 }, null)); 963 if (Renderer.zoom >= 15) 964 Renderer.lineText(feature, "(covers)", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, 80); 965 } else { 966 Renderer.lineVector(feature, new LineStyle(Color.black, 10, null, null)); 967 } 968 if (Renderer.zoom >= 15) 969 Renderer.lineText(feature, "Training Wall", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -30); 970 break; 971 } 972 case SLC_SWAY: 973 Renderer.lineVector(feature, new LineStyle(Color.black, 2, null, new Color(0xffe000))); 974 if ((Renderer.zoom >= 16) && feature.objs.containsKey(Obj.SMCFAC)) { 975 ArrayList<Symbol> symbols = new ArrayList<Symbol>(); 976 ArrayList<CatSCF> scfs; 977 if ((scfs = (ArrayList<CatSCF>) getAttVal(feature, Obj.SMCFAC, 0, Att.CATSCF)) != null) { 978 for (CatSCF scf : scfs) { 979 symbols.add(Facilities.Cats.get(scf)); 980 } 981 Renderer.cluster(feature, symbols); 982 } 983 } 984 break; 985 default: 986 break; 987 } 956 switch ((CatSLC) getAttEnum(feature, feature.type, 0, Att.CATSLC)) { 957 case SLC_TWAL: 958 WatLEV lev = (WatLEV) getAttEnum(feature, feature.type, 0, Att.WATLEV); 959 if (lev == WatLEV.LEV_CVRS) { 960 Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 40, 40 }, null)); 961 if (Renderer.zoom >= 15) 962 Renderer.lineText(feature, "(covers)", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, 80); 963 } else { 964 Renderer.lineVector(feature, new LineStyle(Color.black, 10, null, null)); 965 } 966 if (Renderer.zoom >= 15) 967 Renderer.lineText(feature, "Training Wall", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -30); 968 break; 969 case SLC_SWAY: 970 Renderer.lineVector(feature, new LineStyle(Color.black, 2, null, new Color(0xffe000))); 971 if ((Renderer.zoom >= 16) && feature.objs.containsKey(Obj.SMCFAC)) { 972 ArrayList<Symbol> symbols = new ArrayList<Symbol>(); 973 ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttList(feature, Obj.SMCFAC, 0, Att.CATSCF); 974 for (CatSCF scf : scfs) { 975 symbols.add(Facilities.Cats.get(scf)); 976 } 977 Renderer.cluster(feature, symbols); 978 } 979 break; 980 default: 981 break; 988 982 } 989 983 } … … 997 991 Renderer.symbol(feature, Harbours.SignalStation); 998 992 str = "SS"; 999 ArrayList<CatSIT> tcats = (ArrayList<CatSIT>)getAttVal(feature, Obj.SISTAT, 0, Att.CATSIT); 1000 if (tcats != null) { 1001 switch (tcats.get(0)) { 1002 case SIT_IPT: 1003 str += "(INT)"; 1004 break; 1005 case SIT_PRTE: 1006 str += "(Traffic)"; 1007 break; 1008 case SIT_PRTC: 1009 str += "(Port Control)"; 1010 break; 1011 case SIT_LOCK: 1012 str += "(Lock)"; 1013 break; 1014 case SIT_BRDG: 1015 str += "(Bridge)"; 1016 break; 1017 default: 1018 break; 1019 } 993 ArrayList<CatSIT> tcats = (ArrayList<CatSIT>) getAttList(feature, Obj.SISTAT, 0, Att.CATSIT); 994 switch (tcats.get(0)) { 995 case SIT_IPT: 996 str += "(INT)"; 997 break; 998 case SIT_PRTE: 999 str += "(Traffic)"; 1000 break; 1001 case SIT_PRTC: 1002 str += "(Port Control)"; 1003 break; 1004 case SIT_LOCK: 1005 str += "(Lock)"; 1006 break; 1007 case SIT_BRDG: 1008 str += "(Bridge)"; 1009 break; 1010 default: 1011 break; 1020 1012 } 1021 1013 break; … … 1024 1016 str = "SS"; 1025 1017 str = "SS"; 1026 ArrayList<CatSIW> wcats = (ArrayList<CatSIW>)getAttVal(feature, Obj.SISTAW, 0, Att.CATSIW); 1027 if (wcats != null) { 1028 switch (wcats.get(0)) { 1029 case SIW_STRM: 1030 str += "(Storm)"; 1031 break; 1032 case SIW_WTHR: 1033 str += "(Weather)"; 1034 break; 1035 case SIW_ICE: 1036 str += "(Ice)"; 1037 break; 1038 case SIW_TIDG: 1039 str = "Tide gauge"; 1040 break; 1041 case SIW_TIDS: 1042 str = "Tide scale"; 1043 break; 1044 case SIW_TIDE: 1045 str += "(Tide)"; 1046 break; 1047 case SIW_TSTR: 1048 str += "(Stream)"; 1049 break; 1050 case SIW_DNGR: 1051 str += "(Danger)"; 1052 break; 1053 case SIW_MILY: 1054 str += "(Firing)"; 1055 break; 1056 case SIW_TIME: 1057 str += "(Time)"; 1058 break; 1059 default: 1060 break; 1061 } 1018 ArrayList<CatSIW> wcats = (ArrayList<CatSIW>) getAttList(feature, Obj.SISTAW, 0, Att.CATSIW); 1019 switch (wcats.get(0)) { 1020 case SIW_STRM: 1021 str += "(Storm)"; 1022 break; 1023 case SIW_WTHR: 1024 str += "(Weather)"; 1025 break; 1026 case SIW_ICE: 1027 str += "(Ice)"; 1028 break; 1029 case SIW_TIDG: 1030 str = "Tide gauge"; 1031 break; 1032 case SIW_TIDS: 1033 str = "Tide scale"; 1034 break; 1035 case SIW_TIDE: 1036 str += "(Tide)"; 1037 break; 1038 case SIW_TSTR: 1039 str += "(Stream)"; 1040 break; 1041 case SIW_DNGR: 1042 str += "(Danger)"; 1043 break; 1044 case SIW_MILY: 1045 str += "(Firing)"; 1046 break; 1047 case SIW_TIME: 1048 str += "(Time)"; 1049 break; 1050 default: 1051 break; 1062 1052 } 1063 1053 break; … … 1075 1065 Renderer.symbol(feature, Harbours.Pilot); 1076 1066 addName(feature, 15, new Font("Arial", Font.BOLD, 50), Msymb , new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, -40))); 1077 CatPIL cat = (CatPIL) getAtt Val(feature, feature.type, 0, Att.CATPIL);1078 if ( (cat != null) && (cat == CatPIL.PIL_HELI))1067 CatPIL cat = (CatPIL) getAttEnum(feature, feature.type, 0, Att.CATPIL); 1068 if (cat == CatPIL.PIL_HELI) { 1079 1069 Renderer.labelText(feature, "H", new Font("Arial", Font.PLAIN, 40), Msymb, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0))); 1070 } 1080 1071 break; 1081 1072 case CGUSTA: … … 1109 1100 Double ort; 1110 1101 if ((ort = (Double) getAttVal(feature, feature.type, 0, Att.ORIENT)) != null) { 1111 if (ort != null) 1112 str += ort.toString() + "\u0152"; 1102 str += ort.toString() + "\u0152"; 1113 1103 if (!str.isEmpty()) 1114 1104 Renderer.lineText(feature, str, new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20); … … 1123 1113 private static void wrecks(Feature feature) { 1124 1114 if (Renderer.zoom >= 14) { 1125 CatWRK cat; 1126 if ((cat = (CatWRK) getAttVal(feature, feature.type, 0, Att.CATWRK)) != null) { 1127 switch (cat) { 1128 case WRK_DNGR: 1129 case WRK_MSTS: 1130 Renderer.symbol(feature, Areas.WreckD); 1131 break; 1132 case WRK_HULS: 1133 Renderer.symbol(feature, Areas.WreckS); 1134 break; 1135 default: 1136 Renderer.symbol(feature, Areas.WreckND); 1137 } 1115 switch ((CatWRK) getAttEnum(feature, feature.type, 0, Att.CATWRK)) { 1116 case WRK_DNGR: 1117 case WRK_MSTS: 1118 Renderer.symbol(feature, Areas.WreckD); 1119 break; 1120 case WRK_HULS: 1121 Renderer.symbol(feature, Areas.WreckS); 1122 break; 1123 default: 1124 Renderer.symbol(feature, Areas.WreckND); 1138 1125 } 1139 1126 } -
applications/editors/josm/plugins/seachart/src/render/Signals.java
r30894 r30992 107 107 String str = ""; 108 108 if (atts.containsKey(Att.CATFOG)) { 109 str += fogSignals.get( atts.get(Att.CATFOG).val);109 str += fogSignals.get(((ArrayList<?>)(atts.get(Att.CATFOG).val)).get(0)); 110 110 } 111 111 if (atts.containsKey(Att.SIGGRP)) { … … 128 128 Renderer.symbol(feature, Beacons.RadarStation); 129 129 String bstr = ""; 130 CatRTB cat = (CatRTB) Rules.getAtt Val(feature, Obj.RTPBCN, 0, Att.CATRTB);131 String wal = (String) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.RADWAL);130 CatRTB cat = (CatRTB) Rules.getAttEnum(feature, Obj.RTPBCN, 0, Att.CATRTB); 131 String wal = Rules.getAttStr(feature, Obj.RTPBCN, 0, Att.RADWAL); 132 132 switch (cat) { 133 133 case RTB_RAMK: … … 136 136 case RTB_RACN: 137 137 bstr += " Racon"; 138 String astr = (String) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.SIGGRP);138 String astr = Rules.getAttStr(feature, Obj.RTPBCN, 0, Att.SIGGRP); 139 139 if (!astr.isEmpty()) { 140 140 bstr += "(" + astr + ")"; … … 142 142 Double per = (Double) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.SIGPER); 143 143 Double mxr = (Double) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.VALMXR); 144 if ((per != 0) || (mxr != 0)) {144 if ((per != null) || (mxr != null)) { 145 145 bstr += (astr.isEmpty() ? " " : ""); 146 bstr += (per != 0) ? per.toString() + "s" : "";147 bstr += (mxr != 0) ? mxr.toString() + "M" : "";146 if (per != null) bstr += (per != 0) ? per.toString() + "s" : ""; 147 if (mxr != null) bstr += (mxr != 0) ? mxr.toString() + "M" : ""; 148 148 } 149 149 break; … … 151 151 break; 152 152 } 153 if ( wal!= null) {153 if (!wal.isEmpty()) { 154 154 switch (wal) { 155 155 case "0.03-X": … … 168 168 public static void radioStations(Feature feature) { 169 169 Renderer.symbol(feature, Beacons.RadarStation); 170 ArrayList<CatROS> cats = (ArrayList<CatROS>)Rules.getAtt Val(feature, Obj.RDOSTA, 0, Att.CATROS);170 ArrayList<CatROS> cats = (ArrayList<CatROS>)Rules.getAttList(feature, Obj.RDOSTA, 0, Att.CATROS); 171 171 boolean vais = false; 172 172 String bstr = ""; -
applications/editors/josm/plugins/seachart/src/s57/S57att.java
r30894 r30992 363 363 } 364 364 365 public static Att decodeAttribute(long attribute) { // Convert S57 attribute code to OSeaM attribute enumeration365 public static Att decodeAttribute(long attribute) { // Convert S57 attribute code to SCM attribute enumeration 366 366 Att att = S57Att.get((int)attribute); 367 367 return (att != null) ? att : Att.UNKATT; 368 368 } 369 369 370 public static Integer encodeAttribute(String attribute) { // Convert OSeaM attribute enumeration to S57 attribute code370 public static Integer encodeAttribute(String attribute) { // Convert SCM attribute enumeration to S57 attribute code 371 371 if (AttS57.containsKey(attribute)) 372 372 return AttS57.get(attribute); … … 376 376 } 377 377 378 public static Integer encodeAttribute(Att attribute) { // Convert OSeaM attribute enumeration to S57 attribute code378 public static Integer encodeAttribute(Att attribute) { // Convert SCM attribute enumeration to S57 attribute code 379 379 return AttS57.get(attribute) != 0 ? AttS57.get(attribute) : AttIENC.get(attribute); 380 380 } 381 381 382 public static String stringAttribute(Att attribute) { // Convert OSeaM enumeration to OSeaM attribute string382 public static String stringAttribute(Att attribute) { // Convert SCM enumeration to OSM attribute string 383 383 String str = AttStr.get(attribute); 384 384 return str != null ? str : ""; 385 385 } 386 386 387 public static Att enumAttribute(String attribute, Obj obj) { // Convert OS eaM attribute string to OSeaM enumeration387 public static Att enumAttribute(String attribute, Obj obj) { // Convert OSM attribute string to SCM enumeration 388 388 if ((attribute != null) && !attribute.isEmpty()) { 389 389 EnumMap<Obj, Att> map = StrAtt.get(attribute); -
applications/editors/josm/plugins/seachart/src/s57/S57obj.java
r30894 r30992 104 104 ObjStr.put(Obj.BOYLAT, "buoy_lateral"); ObjStr.put(Obj.BOYSAW, "buoy_safe_water"); ObjStr.put(Obj.BOYSPP, "buoy_special_purpose"); 105 105 ObjStr.put(Obj.CBLARE, "cable_area"); ObjStr.put(Obj.CBLOHD, "cable_overhead"); ObjStr.put(Obj.CBLSUB, "cable_submarine"); ObjStr.put(Obj.CANALS, "canal"); 106 ObjStr.put(Obj.CANBNK, "canal _bank"); ObjStr.put(Obj.CTSARE, "cargo_area"); ObjStr.put(Obj.CAUSWY, "causeway"); ObjStr.put(Obj.CTNARE, "caution_area");106 ObjStr.put(Obj.CANBNK, "canalbank"); ObjStr.put(Obj.CTSARE, "cargo_area"); ObjStr.put(Obj.CAUSWY, "causeway"); ObjStr.put(Obj.CTNARE, "caution_area"); 107 107 ObjStr.put(Obj.CHKPNT, "checkpoint"); ObjStr.put(Obj.CGUSTA, "coastguard_station"); ObjStr.put(Obj.COALNE, "coastline"); ObjStr.put(Obj.CONZNE, "contiguous_zone"); 108 108 ObjStr.put(Obj.COSARE, "continental_shelf"); ObjStr.put(Obj.CTRPNT, "control_point"); ObjStr.put(Obj.CONVYR, "conveyor"); ObjStr.put(Obj.CRANES, "crane"); … … 127 127 ObjStr.put(Obj.RAPIDS, "rapids"); ObjStr.put(Obj.RCRTCL, "recommended_route_centreline"); ObjStr.put(Obj.RECTRC, "recommended_track"); 128 128 ObjStr.put(Obj.RCTLPT, "recommended_traffic_lane"); ObjStr.put(Obj.RSCSTA, "rescue_station"); ObjStr.put(Obj.RESARE, "restricted_area"); 129 ObjStr.put(Obj.RETRFL, "retro_reflector"); ObjStr.put(Obj.RIVERS, "river"); ObjStr.put(Obj.RIVBNK, "river _bank"); ObjStr.put(Obj.ROADWY, "road");129 ObjStr.put(Obj.RETRFL, "retro_reflector"); ObjStr.put(Obj.RIVERS, "river"); ObjStr.put(Obj.RIVBNK, "riverbank"); ObjStr.put(Obj.ROADWY, "road"); 130 130 ObjStr.put(Obj.RUNWAY, "runway"); ObjStr.put(Obj.SNDWAV, "sand_waves"); ObjStr.put(Obj.SEAARE, "sea_area"); ObjStr.put(Obj.SPLARE, "seaplane_landing_area"); 131 131 ObjStr.put(Obj.SBDARE, "seabed_area"); ObjStr.put(Obj.SLCONS, "shoreline_construction"); ObjStr.put(Obj.SISTAT, "signal_station_traffic"); … … 155 155 } 156 156 157 public static Obj decodeType(long objl) { // Convert S57 feature code to OSeaM object enumeration157 public static Obj decodeType(long objl) { // Convert S57 feature code to SCM object enumeration 158 158 Obj obj = S57Obj.get((int)objl); 159 159 return (obj != null) ? obj : Obj.UNKOBJ; 160 160 } 161 161 162 public static long encodeType(Obj type) { // Convert OSM object enumeration to S57 feature code162 public static long encodeType(Obj type) { // Convert SCM object enumeration to S57 feature code 163 163 if (ObjS57.containsKey(type)) 164 164 return ObjS57.get(type); … … 168 168 } 169 169 170 public static String stringType(Obj type) { // Convert OSeaM object enumeration to OSeaM object string170 public static String stringType(Obj type) { // Convert SCM object enumeration to OSM object string 171 171 String str = ObjStr.get(type); 172 172 return str != null ? str : ""; 173 173 } 174 174 175 public static Obj enumType(String type) { // Convert OS eaM object string to OSeaM object enumeration175 public static Obj enumType(String type) { // Convert OSM object string to SCM object enumeration 176 176 if ((type != null) && !type.isEmpty() && (StrObj.containsKey(type))) 177 177 return StrObj.get(type); -
applications/editors/josm/plugins/seachart/src/s57/S57val.java
r30894 r30992 1105 1105 } 1106 1106 1107 public static Enum<?> s57Enum(String val, Att att) { // Convert S57 attribute value string to OSeaM enumeration1107 public static Enum<?> s57Enum(String val, Att att) { // Convert S57 attribute value string to SCM enumeration 1108 1108 EnumMap<?, ?> map = keys.get(att).map; 1109 1109 Enum<?> unkn = null; … … 1125 1125 } 1126 1126 1127 public static AttVal<?> decodeValue(String val, Att att) { // Convert S57 attribute value string to OSeaM attribute value1127 public static AttVal<?> decodeValue(String val, Att att) { // Convert S57 attribute value string to SCM attribute value 1128 1128 Conv conv = keys.get(att).conv; 1129 1129 switch (conv) { … … 1132 1132 return new AttVal<String>(att, conv, val); 1133 1133 case E: 1134 return new AttVal<Enum<?>>(att, Conv.E, s57Enum(val, att)); 1134 ArrayList<Enum<?>> list = new ArrayList<Enum<?>>(); 1135 list.add(s57Enum(val, att)); 1136 return new AttVal<ArrayList<?>>(att, Conv.E, list); 1135 1137 case L: 1136 ArrayList<Enum<?>>list = new ArrayList<Enum<?>>();1138 list = new ArrayList<Enum<?>>(); 1137 1139 for (String item : val.split(",")) { 1138 1140 list.add(s57Enum(item, att)); … … 1155 1157 } 1156 1158 1157 public static Integer encodeValue(String val, Att att) { // Convert OSeaM attribute value string to S57 attribute value1159 public static Integer encodeValue(String val, Att att) { // Convert OSM attribute value string to S57 attribute value 1158 1160 EnumMap<?, ?> map = keys.get(att).map; 1159 1161 for (Object item : map.keySet()) { … … 1165 1167 1166 1168 1167 public static String stringValue(AttVal<?> attval) { // Convert OSeaM value object to OSeaM attribute value string1169 public static String stringValue(AttVal<?> attval) { // Convert SCM value object to OSM attribute value string 1168 1170 if (attval != null) { 1169 1171 switch (attval.conv) { … … 1173 1175 case E: 1174 1176 EnumMap<?, ?> map = keys.get(attval.att).map; 1175 return ((S57enum) map.get( attval.val)).val;1177 return ((S57enum) map.get(((ArrayList<?>) attval.val).get(0))).val; 1176 1178 case L: 1177 1179 String str = ""; … … 1192 1194 } 1193 1195 1194 public static Enum<?> osmEnum(String val, Att att) { // Convert OSeaM attribute value string to OSeaM enumeration1196 public static Enum<?> osmEnum(String val, Att att) { // Convert OSM attribute value string to SCM enumeration 1195 1197 EnumMap<?, ?> map = keys.get(att).map; 1196 1198 Enum<?> unkn = null; … … 1206 1208 } 1207 1209 1208 public static AttVal<?> convertValue(String val, Att att) { // Convert OSeaM attribute value string to OSeaM value object1210 public static AttVal<?> convertValue(String val, Att att) { // Convert OSM attribute value string to SCM attribute value 1209 1211 switch (keys.get(att).conv) { 1210 1212 case A: … … 1212 1214 return new AttVal<String>(att, Conv.S, val); 1213 1215 case E: 1214 return new AttVal<Enum<?>>(att, Conv.E, osmEnum(val, att)); 1216 ArrayList<Enum<?>> list = new ArrayList<Enum<?>>(); 1217 list.add(osmEnum(val, att)); 1218 return new AttVal<ArrayList<?>>(att, Conv.E, list); 1215 1219 case L: 1216 ArrayList<Enum<?>>list = new ArrayList<Enum<?>>();1220 list = new ArrayList<Enum<?>>(); 1217 1221 for (String item : val.split(";")) { 1218 1222 list.add(osmEnum(item, att)); … … 1234 1238 return new AttVal<Object>(att, keys.get(att).conv, null); 1235 1239 } 1240 1241 public static Enum<?> unknAtt(Att att) { 1242 return (Enum<?>)(keys.get(att).map.keySet().toArray()[0]); 1243 } 1236 1244 1237 1245 } -
applications/editors/josm/plugins/seachart/src/seachart/ChartImage.java
r30894 r30992 30 30 import render.ChartContext; 31 31 import render.Renderer; 32 import render.Rules; 32 33 import s57.S57map.*; 33 34 … … 65 66 public void paint(Graphics2D g2, MapView mv, Bounds bb) { 66 67 Rectangle rect = Main.map.mapView.getBounds(); 67 g2.setBackground( new Color(0xb5d0d0));68 g2.setBackground(Rules.Bwater); 68 69 g2.clearRect(rect.x, rect.y, rect.width, rect.height); 69 70 g2.setPaint(Color.black);
Note:
See TracChangeset
for help on using the changeset viewer.