Changeset 35685 in osm for applications/editors/josm/plugins
- Timestamp:
- 2021-01-13T10:42:07+01:00 (4 years ago)
- Location:
- applications/editors/josm/plugins/seachart
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachart/jchart/src/jchart/Jchart.java
r35404 r35685 4 4 import java.awt.Color; 5 5 import java.awt.Dimension; 6 import java.awt.Font; 6 7 import java.awt.Graphics2D; 7 8 import java.awt.Rectangle; … … 127 128 public static void main(String[] args) throws Exception { 128 129 if (args.length < 4) { 129 System.err.println("Usage: java -jar j render.jar <osm data file> <zoom> <scale> <output image file> [<bounds (S W N E)>]");130 System.err.println("Usage: java -jar jchart.jar <osm data file> <zoom> <scale> <output image file> [<bounds (S W N E)>]"); 130 131 System.exit(-1); 131 132 } … … 152 153 Graphics2D g2 = img.createGraphics(); 153 154 Renderer.reRender(g2, new Rectangle((int) size.getX(), (int) size.getY()), zoom, Double.parseDouble(args[2]), map, context); 155 156 //Renderer.labelText("000", new Font("Arial", Font.PLAIN, 20), Color.red); 154 157 try { 155 158 ImageIO.write(img, "png", new File(args[3])); -
applications/editors/josm/plugins/seachart/src/render/Renderer.java
r35483 r35685 97 97 } 98 98 99 public static void symbol(Symbol symbol, double scale, Delta delta) { 100 Point2D point = context.getPoint(Rules.feature.geom.centre); 101 Symbols.drawSymbol(g2, symbol, (sScale * scale), point.getX(), point.getY(), null, delta); 102 } 103 99 104 public static void symbol(Symbol symbol, Scheme scheme, Delta delta) { 100 105 Point2D point = context.getPoint(Rules.feature.geom.centre); 101 106 Symbols.drawSymbol(g2, symbol, sScale, point.getX(), point.getY(), scheme, delta); 107 } 108 109 public static void symbol(Symbol symbol, double scale, Scheme scheme) { 110 Point2D point = context.getPoint(Rules.feature.geom.centre); 111 Symbols.drawSymbol(g2, symbol, (sScale * scale), point.getX(), point.getY(), scheme, null); 102 112 } 103 113 … … 426 436 g2.draw(p); 427 437 Symbol legend = new Symbol(); 428 legend.add(new Instr(Form.BBOX, new Rectangle2D.Double(0, 0, 500, 100)));429 Path2D.Double path = new Path2D.Double(); path.moveTo(0, 0); path.lineTo( 500, 0); path.lineTo(500, 100); path.lineTo(0, 100); path.closePath();438 legend.add(new Instr(Form.BBOX, new Rectangle2D.Double(0, 0, 600, 250))); 439 Path2D.Double path = new Path2D.Double(); path.moveTo(0, 0); path.lineTo(600, 0); path.lineTo(600, 250); path.lineTo(0, 250); path.closePath(); 430 440 legend.add(new Instr(Form.FILL, Color.white)); 431 441 legend.add(new Instr(Form.PGON, path)); 432 legend.add(new Instr(Form.TEXT, new Caption("Mercator Projection", new Font("Arial", Font.PLAIN, 50), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(250, 60))))); 442 legend.add(new Instr(Form.TEXT, new Caption("Mercator Projection", new Font("Arial", Font.PLAIN, 50), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(300, 60))))); 443 legend.add(new Instr(Form.TEXT, new Caption("© OpenStreetMap contributors", new Font("Arial", Font.PLAIN, 30), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 40))))); 444 legend.add(new Instr(Form.TEXT, new Caption("EMODnet Bathymetry Consortium (2018)", new Font("Arial", Font.PLAIN, 30), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 40))))); 445 legend.add(new Instr(Form.TEXT, new Caption("EMODnet Digital Bathymetry (DTM)", new Font("Arial", Font.PLAIN, 30), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 40))))); 446 legend.add(new Instr(Form.TEXT, new Caption("http://doi.org/10.12770/18ff0d48-b203-4a65-94a9-5fd8b0ec35f6", new Font("Arial", Font.PLAIN, 20), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 35))))); 433 447 point = context.getPoint(new Snode(map.bounds.minlat, map.bounds.minlon)); 434 448 Symbols.drawSymbol(g2, legend, sScale, point.getX(), point.getY(), null, new Delta(Handle.BL, AffineTransform.getTranslateInstance(0, 0))); 435 legend = new Symbol(); 436 legend.add(new Instr(Form.BBOX, new Rectangle2D.Double(0, 0, 500, 100))); 437 legend.add(new Instr(Form.TEXT, new Caption("© OpenStreetMap contributors", new Font("Arial", Font.PLAIN, 30), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(250, 100))))); 438 point = context.getPoint(new Snode(map.bounds.minlat, map.bounds.minlon)); 439 Symbols.drawSymbol(g2, legend, sScale, point.getX(), point.getY(), null, new Delta(Handle.BL, AffineTransform.getTranslateInstance(0, 0))); 440 } 441 } 442 449 } 450 } 451 443 452 public static void lineCircle(LineStyle style, double radius, UniHLU units) { 444 453 switch (units) { -
applications/editors/josm/plugins/seachart/src/render/Rules.java
r35483 r35685 317 317 if (testObject(Obj.SPLARE)) for (Feature f : objects) if (testFeature(f)) areas(); 318 318 if (testObject(Obj.SEAARE)) for (Feature f : objects) if (testFeature(f)) areas(); 319 if (testObject(Obj.CBLARE)) for (Feature f : objects) if (testFeature(f)) areas(); 320 if (testObject(Obj.PIPARE)) for (Feature f : objects) if (testFeature(f)) areas(); 319 321 if (testObject(Obj.DMPGRD)) for (Feature f : objects) if (testFeature(f)) areas(); 320 322 if (testObject(Obj.OBSTRN)) for (Feature f : objects) if (testFeature(f)) obstructions(); … … 395 397 break; 396 398 case DEPARE: 397 Double depmax = 0.0; 398 if (((depmax = (Double) getAttVal(Obj.DEPARE, Att.DRVAL2)) != null) && (depmax <= 0.0)) { 399 Renderer.lineVector(new LineStyle(Symbols.Gdries)); 399 Double depmax = (Double) getAttVal(Obj.DEPARE, Att.DRVAL2); 400 if (depmax != null) { 401 if (depmax <= 0.0) { 402 Renderer.lineVector(new LineStyle(Symbols.Gdries)); 403 } else if (depmax <= 2.0) { 404 Renderer.lineVector(new LineStyle(Color.blue, 2, new Color(0x2090ff))); 405 } else if (depmax <= 5.0) { 406 Renderer.lineVector(new LineStyle(Color.blue, 2, new Color(0x40a0ff))); 407 } else if (depmax <= 10.0) { 408 Renderer.lineVector(new LineStyle(Color.blue, 2, new Color(0x60b0ff))); 409 } else if (depmax <= 15.0) { 410 Renderer.lineVector(new LineStyle(Color.blue, 2, new Color(0x80c0ff))); 411 } else if (depmax <= 20.0) { 412 Renderer.lineVector(new LineStyle(Color.blue, 2, new Color(0xa0d0ff))); 413 } else if (depmax <= 50.0) { 414 Renderer.lineVector(new LineStyle(Color.blue, 2, new Color(0xc0e0ff))); 415 } else { 416 Renderer.lineVector(new LineStyle(Color.blue, 2, new Color(0xe0f0ff))); 417 } 400 418 } 401 419 break; … … 547 565 Renderer.symbol(Areas.Plane, new Scheme(Symbols.Msymb)); 548 566 Renderer.lineSymbols(Areas.Restricted, 0.5, Areas.LinePlane, null, 10, Symbols.Mline); 549 } 550 addName(15, new Font("Arial", Font.BOLD, 80), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90))); 551 break; 567 addName(15, new Font("Arial", Font.BOLD, 80), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90))); 568 } 569 break; 570 case CBLARE: 571 if (Renderer.zoom >= 12) { 572 Renderer.lineSymbols(Areas.Restricted, 1.0, Areas.Cable, null, 4, Symbols.Mline); 573 } 574 break; 575 case PIPARE: 576 if (Renderer.zoom >= 12) { 577 Renderer.lineSymbols(Areas.Restricted, 1.0, Areas.Pipeline, null, 4, Symbols.Mline); 578 break; 579 } 552 580 default: 553 581 break; … … 721 749 double depth = (double) getAttVal(Obj.SOUNDG, Att.VALSOU); 722 750 Color col = new Color(0x00ffffff, true); 723 if (depth > 0.0) col = Symbols.Bwater; 724 if (depth > 5.0) col = new Color(0xcde2f1); 725 if (depth > 20.0) col = new Color(0xe6eff8); 726 if (depth > 50.0) col = new Color(0xf3f8fc); 751 if (depth > 0.0) col = new Color(0x2090ff); 752 if (depth > 2.0) col = new Color(0x40a0ff); 753 if (depth > 5.0) col = new Color(0x60b0ff); 754 if (depth > 10.0) col = new Color(0x80c0ff); 755 if (depth > 15.0) col = new Color(0xa0d0ff); 756 if (depth > 20.0) col = new Color(0xc0e0ff); 757 if (depth > 50.0) col = new Color(0xe0f0ff); 727 758 Renderer.rasterPixel(Math.toRadians(1.0/60.0/16.0), col); 728 759 } else if ((Renderer.zoom >= 14) && hasAttribute(Obj.SOUNDG, Att.VALSOU)) { … … 862 893 case ACHARE: 863 894 if (Renderer.zoom >= 12) { 895 ArrayList<CatACH> cats = (ArrayList<CatACH>) getAttList(Obj.ACHARE, Att.CATACH); 864 896 if (feature.geom.prim != Pflag.AREA) { 865 897 Renderer.symbol(Harbours.Anchorage, new Scheme(Color.black)); 866 898 } else { 867 Renderer.symbol(Harbours.Anchorage, new Scheme(Symbols.Mline)); 899 if (cats.contains(CatACH.ACH_SMCM)) { 900 Renderer.symbol(Buoys.Shapes.get(BoySHP.BOY_SPHR), new Scheme(Symbols.Msymb)); 901 Renderer.symbol(Topmarks.TopMooring, Topmarks.BuoyDeltas.get(BoySHP.BOY_SPHR)); 902 } else { 903 Renderer.symbol(Harbours.Anchorage, new Scheme(Symbols.Mline)); 904 } 868 905 Renderer.lineSymbols(Areas.Restricted, 1.0, Areas.LineAnchor, null, 10, Symbols.Mline); 869 906 } … … 873 910 Renderer.labelText("Reserved", new Font("Arial", Font.PLAIN, 50), Symbols.Mline, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60))); 874 911 } 875 ArrayList<CatACH> cats = (ArrayList<CatACH>) getAttList(Obj.ACHARE, Att.CATACH);876 912 int dy = (cats.size() - 1) * -30; 877 913 for (CatACH cat : cats) { … … 899 935 case ACH_SEAP: 900 936 Renderer.symbol(Areas.Seaplane, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 937 dy += 60; 938 break; 939 case ACH_SMCF: 940 case ACH_SMCM: 941 Renderer.labelText("Small", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 942 Renderer.labelText("Craft", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.LC, AffineTransform.getTranslateInstance(60, dy))); 901 943 dy += 60; 902 944 break; … … 1117 1159 break; 1118 1160 case MOR_BUOY: 1119 if (Renderer.zoom >= 1 7) {1161 if (Renderer.zoom >= 16) { 1120 1162 BoySHP shape = (BoySHP) getAttEnum(feature.type, Att.BOYSHP); 1121 1163 if (shape == BoySHP.BOY_UNKN) { 1122 1164 shape = BoySHP.BOY_SPHR; 1123 1165 } 1124 Renderer.symbol(Buoys.Shapes.get(shape), getScheme(feature.type));1125 Renderer.symbol(Topmarks.TopMooring, Topmarks.BuoyDeltas.get(shape));1166 Renderer.symbol(Buoys.Shapes.get(shape), (1.0 / (1.0 + (0.25 * (18 - Renderer.zoom)))), getScheme(feature.type)); 1167 Renderer.symbol(Topmarks.TopMooring, (1.0 / (1.0 + (0.25 * (18 - Renderer.zoom)))), Topmarks.BuoyDeltas.get(shape)); 1126 1168 Signals.addSignals(); 1127 1169 addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(60, -50))); … … 1235 1277 } 1236 1278 } 1279 if (getAttEnum(feature.type, Att.CATOBS) == CatOBS.OBS_FLGD) { 1280 Renderer.symbol(Areas.Foul, new Scheme(Color.black)); 1281 if (feature.geom.prim == Pflag.AREA) { 1282 Renderer.lineSymbols(Areas.Dash, 1.0, Areas.LineFoul, null, 10, Color.black); 1283 } 1284 } 1237 1285 } 1238 1286 if ((Renderer.zoom >= 14) && (feature.type == Obj.UWTROC)) { … … 1246 1294 default: 1247 1295 Renderer.symbol(Areas.Rock); 1296 break; 1248 1297 } 1249 1298 } -
applications/editors/josm/plugins/seachart/src/render/Signals.java
r35483 r35685 603 603 } 604 604 } else { 605 if ( Renderer.zoom >= 15) {605 if ((Renderer.zoom >= 15) && (lights.get(0) != null)) { 606 606 AttMap atts = lights.get(0); 607 607 ArrayList<CatLIT> cats = new ArrayList<>(); -
applications/editors/josm/plugins/seachart/src/symbols/Areas.java
r35460 r35685 81 81 } 82 82 83 public static final Symbol Dash = new Symbol(); 84 static { 85 Dash.add(new Instr(Form.BBOX, new Rectangle2D.Double(-15, -30, 30, 30))); 86 Dash.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND))); 87 Dash.add(new Instr(Form.LINE, new Line2D.Double(0, 0, 0, -30))); 88 } 89 90 public static final Symbol Foul = new Symbol(); 91 static { 92 Foul.add(new Instr(Form.BBOX, new Rectangle2D.Double(-30, -60, 60, 60))); 93 Foul.add(new Instr(Form.STRK, new BasicStroke(8, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND))); 94 Foul.add(new Instr(Form.FILL, Color.black)); 95 Path2D.Double p = new Path2D.Double(); 96 p.moveTo(0, -30); p.lineTo(-20, 30); 97 p.moveTo(20, -30); p.lineTo(0, 30); 98 p.moveTo(-20, -15); p.lineTo(30, -15); 99 p.moveTo(-30, 15); p.lineTo(20, 15); 100 Foul.add(new Instr(Form.PLIN, p)); 101 } 102 83 103 public static final Symbol LaneArrow = new Symbol(); 84 104 static { … … 95 115 LineAnchor.add(new Instr(Form.BBOX, new Rectangle2D.Double(-30, -60, 60, 90))); 96 116 LineAnchor.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Harbours.Anchor, 0.5, 0, 0, null, new Delta(Handle.CC, AffineTransform.getRotateInstance(Math.toRadians(-90.0)))))); 117 } 118 119 public static final Symbol LineFoul = new Symbol(); 120 static { 121 LineFoul.add(new Instr(Form.BBOX, new Rectangle2D.Double(-30, -60, 60, 90))); 122 LineFoul.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Foul, 0.5, 0, 0, null, new Delta(Handle.CC, AffineTransform.getRotateInstance(Math.toRadians(-90.0)))))); 97 123 } 98 124
Note:
See TracChangeset
for help on using the changeset viewer.