Changeset 32907 in osm for applications/editors/josm/plugins/seachart/src/render/Rules.java
- Timestamp:
- 2016-09-03T16:43:42+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachart/src/render/Rules.java
r32394 r32907 1 /* Copyright 2014 Malcolm Herring 2 * 3 * This is free software: you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation, version 3 of the License. 6 * 7 * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>. 8 */ 9 1 // License: GPL. For details, see LICENSE file. 10 2 package render; 11 3 … … 81 73 import symbols.Topmarks; 82 74 75 /** 76 * @author Malcolm Herring 77 */ 83 78 public class Rules { 84 79 … … 257 252 258 253 public static void rules() { 254 // CHECKSTYLE.OFF: NeedBraces 259 255 if ((Renderer.context.ruleset() == RuleSet.ALL) || (Renderer.context.ruleset() == RuleSet.BASE)) { 260 256 if (testObject(Obj.LNDARE)) for (Feature f : objects) if (testFeature(f)) areas(); … … 351 347 if (testObject(Obj.BCNSPP)) for (Feature f : objects) if (testFeature(f)) beacons(); 352 348 } 349 // CHECKSTYLE.ON: NeedBraces 353 350 } 354 351 … … 417 414 Renderer.symbol(Areas.MarineFarm); 418 415 } 419 if ((feature.geom.area > 0.2) || ((feature.geom.area > 0.05) && (Renderer.zoom >= 14)) || ((feature.geom.area > 0.005) && (Renderer.zoom >= 16))) { 416 if ((feature.geom.area > 0.2) || ((feature.geom.area > 0.05) && (Renderer.zoom >= 14)) || 417 ((feature.geom.area > 0.005) && (Renderer.zoom >= 16))) { 420 418 Renderer.lineVector(new LineStyle(Color.black, 4, new float[] {10, 10})); 421 419 } … … 450 448 Renderer.lineText(name, new Font("Arial", Font.PLAIN, 150), Color.black, -40); 451 449 } else { 452 Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 450 Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black, 451 new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 453 452 } 454 453 break; … … 458 457 Renderer.lineText(name, new Font("Arial", Font.PLAIN, 150), Color.black, -40); 459 458 } else { 460 Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 459 Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black, 460 new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 461 461 } 462 462 break; … … 466 466 Renderer.lineVector(new LineStyle(new Color(0xc480ff), 4, new float[] {25, 25})); 467 467 if (name != null) { 468 Renderer.labelText(name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 468 Renderer.labelText(name, new Font("Arial", Font.ITALIC, 75), Color.black, 469 new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 469 470 Renderer.labelText("(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC)); 470 471 } … … 476 477 } else { 477 478 if (name != null) { 478 Renderer.labelText(name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 479 Renderer.labelText(name, new Font("Arial", Font.ITALIC, 75), Color.black, 480 new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40))); 479 481 Renderer.labelText("(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC)); 480 482 } … … 554 556 AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0); 555 557 if (topmap.containsKey(Att.TOPSHP)) { 556 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.TOPMAR), Topmarks.BeaconDelta); 558 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), 559 getScheme(Obj.TOPMAR), Topmarks.BeaconDelta); 557 560 } 558 561 } else if (feature.objs.containsKey(Obj.DAYMAR)) { 559 562 AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0); 560 563 if (topmap.containsKey(Att.TOPSHP)) { 561 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.DAYMAR), Topmarks.BeaconDelta); 564 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), 565 getScheme(Obj.DAYMAR), Topmarks.BeaconDelta); 562 566 } 563 567 } … … 580 584 AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0); 581 585 if (topmap.containsKey(Att.TOPSHP)) { 582 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.TOPMAR), Topmarks.BuoyDeltas.get(shape)); 586 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), 587 getScheme(Obj.TOPMAR), Topmarks.BuoyDeltas.get(shape)); 583 588 } 584 589 } else if (feature.objs.containsKey(Obj.DAYMAR)) { 585 590 AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0); 586 591 if (topmap.containsKey(Att.TOPSHP)) { 587 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.DAYMAR), Topmarks.BuoyDeltas.get(shape)); 592 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), 593 getScheme(Obj.DAYMAR), Topmarks.BuoyDeltas.get(shape)); 588 594 } 589 595 } … … 621 627 } 622 628 if (hstr.isEmpty() && !vstr.isEmpty()) { 623 Renderer.labelText(vstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.CC)); 629 Renderer.labelText(vstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.VCLR, Color.black, Color.white, 630 new Delta(Handle.CC)); 624 631 } else if (!hstr.isEmpty() && !vstr.isEmpty()) { 625 Renderer.labelText(vstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.BC)); 626 Renderer.labelText(hstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.HCLR, Color.black, Color.white, new Delta(Handle.TC)); 632 Renderer.labelText(vstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.VCLR, Color.black, Color.white, 633 new Delta(Handle.BC)); 634 Renderer.labelText(hstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.HCLR, Color.black, Color.white, 635 new Delta(Handle.TC)); 627 636 } else if (!hstr.isEmpty() && vstr.isEmpty()) { 628 Renderer.labelText(hstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.HCLR, Color.black, Color.white, new Delta(Handle.CC)); 637 Renderer.labelText(hstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.HCLR, Color.black, Color.white, 638 new Delta(Handle.CC)); 629 639 } 630 640 } … … 645 655 if (atts != null) { 646 656 if (atts.containsKey(Att.VERCLR)) { 647 Renderer.labelText(String.valueOf(atts.get(Att.VERCLR).val), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.VCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 25))); 657 Renderer.labelText(String.valueOf(atts.get(Att.VERCLR).val), new Font("Arial", Font.PLAIN, 50), 658 Color.black, LabelStyle.VCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 25))); 648 659 } else if (atts.containsKey(Att.VERCSA)) { 649 Renderer.labelText(String.valueOf(atts.get(Att.VERCSA).val), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.PCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 25))); 660 Renderer.labelText(String.valueOf(atts.get(Att.VERCSA).val), new Font("Arial", Font.PLAIN, 50), 661 Color.black, LabelStyle.PCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 25))); 650 662 } 651 663 } … … 668 680 String chn; 669 681 if (!(chn = getAttStr(feature.type, Att.COMCHA)).isEmpty()) { 670 Renderer.labelText(("Ch." + chn), new Font("Arial", Font.PLAIN, 50), Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 50))); 682 Renderer.labelText(("Ch." + chn), new Font("Arial", Font.PLAIN, 50), Color.black, 683 new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 50))); 671 684 } 672 685 } … … 692 705 dd = (tok.length == 2) ? tok[1] : ""; 693 706 } 694 Renderer.labelText(ul, new Font("Arial", Font.PLAIN, 30), Color.black, new Delta(Handle.RC, AffineTransform.getTranslateInstance(10, 15))); 695 Renderer.labelText(id, new Font("Arial", Font.PLAIN, 30), Color.black, new Delta(Handle.RC, AffineTransform.getTranslateInstance(10, 0))); 696 Renderer.labelText(dd, new Font("Arial", Font.PLAIN, 20), Color.black, new Delta(Handle.LC, AffineTransform.getTranslateInstance(15, 10))); 707 Renderer.labelText(ul, new Font("Arial", Font.PLAIN, 30), Color.black, 708 new Delta(Handle.RC, AffineTransform.getTranslateInstance(10, 15))); 709 Renderer.labelText(id, new Font("Arial", Font.PLAIN, 30), Color.black, 710 new Delta(Handle.RC, AffineTransform.getTranslateInstance(10, 0))); 711 Renderer.labelText(dd, new Font("Arial", Font.PLAIN, 20), Color.black, 712 new Delta(Handle.LC, AffineTransform.getTranslateInstance(15, 10))); 697 713 } 698 714 break; … … 741 757 } 742 758 str += String.format("%1.0f", dist); 743 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.CC, AffineTransform.getTranslateInstance(0, 45))); 759 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, 760 new Delta(Handle.CC, AffineTransform.getTranslateInstance(0, 45))); 744 761 } 745 762 } … … 749 766 @SuppressWarnings("unchecked") 750 767 private static void floats() { 751 if ((Renderer.zoom >= 12) || ((Renderer.zoom >= 11) && ((feature.type == Obj.LITVES) || (feature.type == Obj.BOYINB) || hasObject(Obj.RTPBCN)))) { 768 if ((Renderer.zoom >= 12) || ((Renderer.zoom >= 11) && ((feature.type == Obj.LITVES) || 769 (feature.type == Obj.BOYINB) || hasObject(Obj.RTPBCN)))) { 752 770 switch (feature.type) { 753 771 case LITVES: … … 766 784 AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0); 767 785 if (topmap.containsKey(Att.TOPSHP)) { 768 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.TOPMAR), Topmarks.FloatDelta); 786 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), 787 getScheme(Obj.TOPMAR), Topmarks.FloatDelta); 769 788 } 770 789 } else if (feature.objs.containsKey(Obj.DAYMAR)) { 771 790 AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0); 772 791 if (topmap.containsKey(Att.TOPSHP)) { 773 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.DAYMAR), Topmarks.FloatDelta); 792 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), 793 getScheme(Obj.DAYMAR), Topmarks.FloatDelta); 774 794 } 775 795 } … … 795 815 Renderer.symbol(Harbours.Anchor, new Scheme(Symbols.Msymb)); 796 816 if (Renderer.zoom >= 15) { 797 Renderer.labelText(name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Symbols.Msymb, LabelStyle.RRCT, Symbols.Msymb, Color.white, new Delta(Handle.BC)); 817 Renderer.labelText(name == null ? "" : name, 818 new Font("Arial", Font.PLAIN, 30), Symbols.Msymb, LabelStyle.RRCT, Symbols.Msymb, Color.white, new Delta(Handle.BC)); 798 819 } 799 820 } … … 820 841 ArrayList<StsSTS> sts = (ArrayList<StsSTS>) getAttList(Obj.ACHARE, Att.STATUS); 821 842 if ((Renderer.zoom >= 15) && (sts.contains(StsSTS.STS_RESV))) { 822 Renderer.labelText("Reserved", new Font("Arial", Font.PLAIN, 50), Symbols.Mline, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60))); 843 Renderer.labelText("Reserved", 844 new Font("Arial", Font.PLAIN, 50), Symbols.Mline, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60))); 823 845 } 824 846 ArrayList<CatACH> cats = (ArrayList<CatACH>) getAttList(Obj.ACHARE, Att.CATACH); … … 827 849 switch (cat) { 828 850 case ACH_DEEP: 829 Renderer.labelText("DW", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 851 Renderer.labelText("DW", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, 852 new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 830 853 dy += 60; 831 854 break; 832 855 case ACH_TANK: 833 Renderer.labelText("Tanker", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 856 Renderer.labelText("Tanker", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, 857 new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 834 858 dy += 60; 835 859 break; 836 860 case ACH_H24P: 837 Renderer.labelText("24h", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 861 Renderer.labelText("24h", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, 862 new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 838 863 dy += 60; 839 864 break; 840 865 case ACH_EXPL: 841 Renderer.symbol(Harbours.Explosives, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 866 Renderer.symbol(Harbours.Explosives, new Scheme(Symbols.Msymb), 867 new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 842 868 dy += 60; 843 869 break; 844 870 case ACH_QUAR: 845 Renderer.symbol(Harbours.Hospital, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 871 Renderer.symbol(Harbours.Hospital, new Scheme(Symbols.Msymb), 872 new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 846 873 dy += 60; 847 874 break; 848 875 case ACH_SEAP: 849 Renderer.symbol(Areas.Seaplane, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 876 Renderer.symbol(Areas.Seaplane, new Scheme(Symbols.Msymb), 877 new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 850 878 dy += 60; 851 879 break; … … 858 886 if (Renderer.zoom >= 14) { 859 887 Renderer.lineVector(new LineStyle(Symbols.Mline, 6, new float[] {20, 20})); 860 Renderer.labelText(name == null ? " " : name, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, LabelStyle.RRCT, Symbols.Mline, Color.white); 888 Renderer.labelText(name == null ? " " : name, 889 new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, LabelStyle.RRCT, Symbols.Mline, Color.white); 861 890 } 862 891 break; … … 1034 1063 AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0); 1035 1064 if (topmap.containsKey(Att.TOPSHP)) { 1036 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.TOPMAR), Topmarks.LightDelta); 1065 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), 1066 getScheme(Obj.TOPMAR), Topmarks.LightDelta); 1037 1067 } 1038 1068 } else if (feature.objs.containsKey(Obj.DAYMAR)) { 1039 1069 AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0); 1040 1070 if (topmap.containsKey(Att.TOPSHP)) { 1041 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.DAYMAR), Topmarks.LightDelta); 1071 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), 1072 getScheme(Obj.DAYMAR), Topmarks.LightDelta); 1042 1073 } 1043 1074 } … … 1215 1246 } 1216 1247 if (verclr > 0) { 1217 Renderer.labelText(String.valueOf(verclr), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.VCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 25))); 1248 Renderer.labelText(String.valueOf(verclr), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.VCLR, 1249 Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 25))); 1218 1250 } 1219 1251 } … … 1400 1432 Renderer.symbol(Harbours.SignalStation); 1401 1433 Renderer.symbol(Beacons.RadarStation); 1402 Renderer.labelText("Ra", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70))); 1434 Renderer.labelText("Ra", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, 1435 new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70))); 1403 1436 break; 1404 1437 case PILBOP: 1405 1438 Renderer.symbol(Harbours.Pilot); 1406 addName(15, new Font("Arial", Font.BOLD, 40), Symbols.Msymb, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, -40))); 1439 addName(15, new Font("Arial", Font.BOLD, 40), Symbols.Msymb, 1440 new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, -40))); 1407 1441 CatPIL cat = (CatPIL) getAttEnum(feature.type, Att.CATPIL); 1408 1442 if (cat == CatPIL.PIL_HELI) { 1409 Renderer.labelText("H", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0))); 1443 Renderer.labelText("H", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, 1444 new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0))); 1410 1445 } 1411 1446 break; … … 1413 1448 Renderer.symbol(Harbours.SignalStation); 1414 1449 str = "CG"; 1415 if (feature.objs.containsKey(Obj.RSCSTA)) Renderer.symbol(Harbours.Rescue, new Delta(Handle.CC, AffineTransform.getTranslateInstance(130, 0))); 1450 if (feature.objs.containsKey(Obj.RSCSTA)) Renderer.symbol(Harbours.Rescue, 1451 new Delta(Handle.CC, AffineTransform.getTranslateInstance(130, 0))); 1416 1452 break; 1417 1453 case RSCSTA: … … 1422 1458 } 1423 1459 if ((Renderer.zoom >= 15) && !str.isEmpty()) { 1424 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.LC, AffineTransform.getTranslateInstance(40, 0))); 1460 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, 1461 new Delta(Handle.LC, AffineTransform.getTranslateInstance(40, 0))); 1425 1462 } 1426 1463 Signals.addSignals();
Note:
See TracChangeset
for help on using the changeset viewer.
