Changeset 31044 in osm for applications/editors/josm/plugins/seachart/src/render
- Timestamp:
- 2015-03-03T17:08:26+01:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/seachart/src/render
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachart/src/render/Renderer.java
r31031 r31044 36 36 static int zoom; 37 37 38 public static void reRender(Graphics2D g, Rectangle rect, int z, double factor, S57map m, ChartContext c) { 38 public static void reRender(Graphics2D g, RuleSet set, Rectangle rect, int z, double factor, S57map m, ChartContext c) { 39 39 g2 = g; 40 40 zoom = z; … … 43 43 sScale = symbolScale[zoom] * factor; 44 44 if (map != null) { 45 g2.setBackground( Rules.Bwater);45 g2.setBackground(Symbols.Bwater); 46 46 g2.clearRect(rect.x, rect.y, rect.width, rect.height); 47 47 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 48 48 g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP); 49 49 g2.setStroke(new BasicStroke(0, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); 50 Rules.rules( RuleSet.BASE);50 Rules.rules(set); 51 51 } 52 52 } … … 327 327 } 328 328 329 330 329 public static void fillPattern(Feature feature, BufferedImage image) { 331 330 Path2D.Double p = new Path2D.Double(); -
applications/editors/josm/plugins/seachart/src/render/Rules.java
r31028 r31044 30 30 public enum RuleSet { ALL, BASE, SEAMARK } 31 31 32 public static final Color Yland = new Color(0xdcb820);33 public static final Color Bwater = new Color(0x3ea8c8);34 public static final Color Gdries = new Color(0x50b050);35 public static final Color Mline = new Color(0xc480ff);36 public static final Color Msymb = new Color(0xa30075);37 38 32 static final EnumMap<ColCOL, Color> bodyColours = new EnumMap<ColCOL, Color>(ColCOL.class); 39 33 static { … … 129 123 ArrayList<?> list = (ArrayList<?>)getAttVal(feature, obj, idx, att); 130 124 if (list != null) { 131 return ((ArrayList<Enum>)list).get(0); 125 return ((ArrayList<Enum<?>>)list).get(0); 132 126 } 133 127 return S57val.unknAtt(att); … … 179 173 static Feature feature; 180 174 static ArrayList<Feature> objects; 181 static RuleSet ruleset; 175 static RuleSet ruleset; 176 182 177 static boolean testObject(Obj obj) { 183 178 return ((objects = Renderer.map.features.get(obj)) != null); … … 290 285 Double depmax = 0.0; 291 286 if (((depmax = (Double) getAttVal(feature, Obj.DEPARE, 0, Att.DRVAL2)) != null) && (depmax <= 0.0)) { 292 Renderer.lineVector(feature, new LineStyle(Gdries)); 287 Renderer.lineVector(feature, new LineStyle(Symbols.Gdries)); 293 288 } 294 289 break; 295 290 case LAKARE: 296 291 case RIVBNK: 297 Renderer.lineVector(feature, new LineStyle(Bwater, 10, Bwater)); 292 Renderer.lineVector(feature, new LineStyle(Symbols.Bwater, 10, Symbols.Bwater)); 298 293 break; 299 294 case DRGARE: … … 307 302 if (feature.geom.area > 2.0) { 308 303 if (Renderer.zoom < 16) 309 Renderer.lineVector(feature, new LineStyle(Mline, 8, new float[] { 50, 50 }, new Color(0x40ffffff, true))); 304 Renderer.lineVector(feature, new LineStyle(Symbols.Mline, 8, new float[] { 50, 50 }, new Color(0x40ffffff, true))); 310 305 else 311 Renderer.lineVector(feature, new LineStyle(Mline, 8, new float[] { 50, 50 })); 306 Renderer.lineVector(feature, new LineStyle(Symbols.Mline, 8, new float[] { 50, 50 })); 312 307 } else { 313 308 if (Renderer.zoom >= 14) … … 318 313 case LOKBSN: 319 314 case HRBBSN: 320 Renderer.lineVector(feature, new LineStyle(Color.black, 10, Bwater)); 315 Renderer.lineVector(feature, new LineStyle(Color.black, 10, Symbols.Bwater)); 321 316 break; 322 317 case HRBFAC: 323 318 if (feature.objs.get(Obj.HRBBSN) != null) { 324 Renderer.lineVector(feature, new LineStyle(Color.black, 10, Bwater)); 319 Renderer.lineVector(feature, new LineStyle(Color.black, 10, Symbols.Bwater)); 325 320 } 326 321 break; 327 322 case LNDARE: 328 Renderer.lineVector(feature, new LineStyle(Yland)); 323 Renderer.lineVector(feature, new LineStyle(Symbols.Yland)); 329 324 break; 330 325 case MARCUL: … … 348 343 case MIPARE: 349 344 if (Renderer.zoom >= 12) { 350 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, Mline); 345 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, Symbols.Mline); 351 346 if (testAttribute(feature, feature.type, 0, Att.CATREA, CatREA.REA_NWAK)) { 352 347 Renderer.symbol(feature, Areas.NoWake); … … 406 401 case SPLARE: 407 402 if (Renderer.zoom >= 12) { 408 Renderer.symbol(feature, Areas.Plane, new Scheme(Msymb)); 409 Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, null, 10, Mline); 403 Renderer.symbol(feature, Areas.Plane, new Scheme(Symbols.Msymb)); 404 Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, null, 10, Symbols.Mline); 410 405 } 411 406 addName(feature, 15, new Font("Arial", Font.BOLD, 80), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90))); … … 525 520 if ((Renderer.zoom >= 16) && (feature.geom.length < 2)) { 526 521 if (feature.type == Obj.CBLSUB) { 527 Renderer.lineSymbols(feature, Areas.Cable, 0.0, null, null, 0, Mline); 522 Renderer.lineSymbols(feature, Areas.Cable, 0.0, null, null, 0, Symbols.Mline); 528 523 } else if (feature.type == Obj.CBLOHD) { 529 524 AttMap atts = feature.objs.get(Obj.CBLOHD).get(0); … … 637 632 case ACHBRT: 638 633 if (Renderer.zoom >= 14) { 639 Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Mline)); 634 Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Symbols.Mline)); 640 635 if (Renderer.zoom >= 15) { 641 Renderer.labelText(feature, name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Msymb, LabelStyle.RRCT, Mline, Color.white, new Delta(Handle.BC)); 636 Renderer.labelText(feature, name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Symbols.Msymb, LabelStyle.RRCT, Symbols.Mline, Color.white, new Delta(Handle.BC)); 642 637 } 643 638 } … … 649 644 units = UniHLU.HLU_METR; 650 645 } 651 Renderer.lineCircle(feature, new LineStyle(Mline, 4, new float[] { 10, 10 }, null), radius, units); 646 Renderer.lineCircle(feature, new LineStyle(Symbols.Mline, 4, new float[] { 10, 10 }, null), radius, units); 652 647 } 653 648 } … … 658 653 Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Color.black)); 659 654 } else { 660 Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Mline)); 661 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, Areas.LineAnchor, null, 10, Mline); 662 } 663 addName(feature, 15, new Font("Arial", Font.BOLD, 60), Mline, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0))); 655 Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Symbols.Mline)); 656 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, Areas.LineAnchor, null, 10, Symbols.Mline); 657 } 658 addName(feature, 15, new Font("Arial", Font.BOLD, 60), Symbols.Mline, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0))); 664 659 ArrayList<StsSTS> sts = (ArrayList<StsSTS>)getAttList(feature, Obj.ACHARE, 0, Att.STATUS); 665 660 if ((Renderer.zoom >= 15) && (sts.contains(StsSTS.STS_RESV))) { 666 Renderer.labelText(feature, "Reserved", new Font("Arial", Font.PLAIN, 50), Mline, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60))); 661 Renderer.labelText(feature, "Reserved", new Font("Arial", Font.PLAIN, 50), Symbols.Mline, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60))); 667 662 } 668 663 } … … 672 667 switch (cat) { 673 668 case ACH_DEEP: 674 Renderer.labelText(feature, "DW", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 669 Renderer.labelText(feature, "DW", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 675 670 dy += 60; 676 671 break; 677 672 case ACH_TANK: 678 Renderer.labelText(feature, "Tanker", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 673 Renderer.labelText(feature, "Tanker", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 679 674 dy += 60; 680 675 break; 681 676 case ACH_H24P: 682 Renderer.labelText(feature, "24h", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 677 Renderer.labelText(feature, "24h", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 683 678 dy += 60; 684 679 break; 685 680 case ACH_EXPL: 686 Renderer.symbol(feature, Harbours.Explosives, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 681 Renderer.symbol(feature, Harbours.Explosives, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 687 682 dy += 60; 688 683 break; 689 684 case ACH_QUAR: 690 Renderer.symbol(feature, Harbours.Hospital, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 685 Renderer.symbol(feature, Harbours.Hospital, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 691 686 dy += 60; 692 687 break; 693 688 case ACH_SEAP: 694 Renderer.symbol(feature, Areas.Seaplane, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 689 Renderer.symbol(feature, Areas.Seaplane, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 695 690 dy += 60; 696 691 break; … … 701 696 case BERTHS: 702 697 if (Renderer.zoom >= 14) { 703 Renderer.lineVector(feature, new LineStyle(Mline, 6, new float[] { 20, 20 })); 704 Renderer.labelText(feature, name == null ? " " : name, new Font("Arial", Font.PLAIN, 40), Msymb, LabelStyle.RRCT, Mline, Color.white); 698 Renderer.lineVector(feature, new LineStyle(Symbols.Mline, 6, new float[] { 20, 20 })); 699 Renderer.labelText(feature, name == null ? " " : name, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, LabelStyle.RRCT, Symbols.Mline, Color.white); 705 700 } 706 701 break; … … 961 956 if ((Renderer.zoom >= 16) && (feature.geom.length < 2)) { 962 957 if (feature.type == Obj.PIPSOL) { 963 Renderer.lineSymbols(feature, Areas.Pipeline, 1.0, null, null, 0, Mline); 958 Renderer.lineSymbols(feature, Areas.Pipeline, 1.0, null, null, 0, Symbols.Mline); 964 959 } else if (feature.type == Obj.PIPOHD) { 965 960 Renderer.lineVector(feature, new LineStyle(Color.black, 8)); … … 1010 1005 case TSSRON: 1011 1006 if (Renderer.zoom <= 15) 1012 Renderer.lineVector(feature, new LineStyle( new Color(0x80c48080, true)));1007 Renderer.lineVector(feature, new LineStyle(Symbols.Mline)); 1013 1008 else 1014 Renderer.lineVector(feature, new LineStyle( new Color(0x80c48080, true), 20, null, null));1015 addName(feature, 10, new Font("Arial", Font.BOLD, 150), new Color(0x80c48080, true));1009 Renderer.lineVector(feature, new LineStyle(Symbols.Mline, 20, null, null)); 1010 addName(feature, 10, new Font("Arial", Font.BOLD, 150), Symbols.Mline); 1016 1011 break; 1017 1012 case TSELNE: 1018 Renderer.lineVector(feature, new LineStyle( new Color(0x80c48080, true), 20, null, null));1013 Renderer.lineVector(feature, new LineStyle(Symbols.Mline, 20, null, null)); 1019 1014 break; 1020 1015 case TSSLPT: 1021 Renderer.lineSymbols(feature, Areas.LaneArrow, 0.5, null, null, 0, new Color(0x80c48080, true));1016 Renderer.lineSymbols(feature, Areas.LaneArrow, 0.5, null, null, 0, Symbols.Mline); 1022 1017 break; 1023 1018 case TSSBND: 1024 Renderer.lineVector(feature, new LineStyle( new Color(0x80c48080, true), 20, new float[] { 40, 40 }, null));1019 Renderer.lineVector(feature, new LineStyle(Symbols.Mline, 20, new float[] { 40, 40 }, null)); 1025 1020 break; 1026 1021 case ISTZNE: 1027 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, new Color(0x80c48080, true));1022 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, Symbols.Mline); 1028 1023 break; 1029 1024 default: … … 1033 1028 1034 1029 private static void shoreline() { 1030 CatSLC cat = (CatSLC) getAttEnum(feature, feature.type, 0, Att.CATSLC); 1035 1031 if ((ruleset == RuleSet.ALL) || (ruleset == RuleSet.BASE)) { 1036 Renderer.lineVector(feature, new LineStyle(Color.black, 10, Yland)); 1032 if ((cat != CatSLC.SLC_SWAY) && (cat != CatSLC.SLC_TWAL)) { 1033 Renderer.lineVector(feature, new LineStyle(Color.black, 10, Symbols.Yland)); 1034 } 1037 1035 } 1038 1036 if ((ruleset == RuleSet.ALL) || (ruleset == RuleSet.SEAMARK)) { 1039 1037 if (Renderer.zoom >= 12) { 1040 switch ( (CatSLC) getAttEnum(feature, feature.type, 0, Att.CATSLC)) {1038 switch (cat) { 1041 1039 case SLC_TWAL: 1042 1040 WatLEV lev = (WatLEV) getAttEnum(feature, feature.type, 0, Att.WATLEV); … … 1145 1143 Renderer.symbol(feature, Harbours.SignalStation); 1146 1144 Renderer.symbol(feature, Beacons.RadarStation); 1147 Renderer.labelText(feature, "Ra", new Font("Arial", Font.PLAIN, 40), Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70))); 1145 Renderer.labelText(feature, "Ra", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70))); 1148 1146 break; 1149 1147 case PILBOP: 1150 1148 Renderer.symbol(feature, Harbours.Pilot); 1151 addName(feature, 15, new Font("Arial", Font.BOLD, 50), Msymb , new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, -40))); 1149 addName(feature, 15, new Font("Arial", Font.BOLD, 50), Symbols.Msymb , new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, -40))); 1152 1150 CatPIL cat = (CatPIL) getAttEnum(feature, feature.type, 0, Att.CATPIL); 1153 1151 if (cat == CatPIL.PIL_HELI) { 1154 Renderer.labelText(feature, "H", new Font("Arial", Font.PLAIN, 40), Msymb, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0))); 1152 Renderer.labelText(feature, "H", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0))); 1155 1153 } 1156 1154 break; … … 1193 1191 1194 1192 private static void waterways() { 1195 Renderer.lineVector(feature, new LineStyle(Bwater, 20)); 1193 Renderer.lineVector(feature, new LineStyle(Symbols.Bwater, 20)); 1196 1194 } 1197 1195 -
applications/editors/josm/plugins/seachart/src/render/Signals.java
r30992 r31044 21 21 import s57.S57map.*; 22 22 import symbols.Beacons; 23 import symbols.Symbols; 23 24 import symbols.Topmarks; 24 25 import symbols.Symbols.*; … … 162 163 } 163 164 if ((Renderer.zoom >= 15) && !bstr.isEmpty()) { 164 Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40), Rules.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70)));165 Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70))); 165 166 } 166 167 } … … 273 274 if (Renderer.zoom >= 15) { 274 275 if (vais) { 275 Renderer.labelText(feature, "V-AIS", new Font("Arial", Font.PLAIN, 40), Rules.Msymb, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));276 Renderer.labelText(feature, "V-AIS", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70))); 276 277 } 277 278 if (!bstr.isEmpty()) { 278 Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40), Rules.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -110)));279 Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -110))); 279 280 } 280 281 }
Note:
See TracChangeset
for help on using the changeset viewer.