Changeset 35794 in osm for applications
- Timestamp:
- 2021-07-17T22:14:15+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachart/src/render/Renderer.java
r35788 r35794 378 378 left = Math.ceil(left / nspan); 379 379 left = Math.toRadians((left * nspan) - 180.0); 380 double ndeg = Math.toRadians(nspan); 380 381 double tspan = 60 * Math.toDegrees(map.bounds.maxlat - map.bounds.minlat) / (context.grid() / (ratio < 1.0 ? ratio : 1.0)); 381 382 mult = 1.0; … … 402 403 bottom = Math.ceil(bottom / tspan); 403 404 bottom = Math.toRadians((bottom * tspan) - 90.0); 405 double tdeg = Math.toRadians(tspan); 404 406 g2.setStroke(new BasicStroke((float) (style.width * sScale), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)); 405 407 Path2D.Double p = new Path2D.Double(); 406 for (double lon = left; lon < map.bounds.maxlon; lon += Math.toRadians(nspan)) {408 for (double lon = left; lon < map.bounds.maxlon; lon += ndeg) { 407 409 point = context.getPoint(new Snode(map.bounds.maxlat, lon)); 408 410 p.moveTo(point.getX(), point.getY()); 409 411 point = context.getPoint(new Snode(map.bounds.minlat, lon)); 410 412 p.lineTo(point.getX(), point.getY()); 411 for (int i = 1; i < 10; i++) {412 int grad = (i % (ndiv ? 2 : 5)) == 0 ? 2 : 1;413 point = context.getPoint(new Snode(map.bounds.maxlat, lon + (i * (nspan / 10))));414 p.moveTo(point.getX(), point.getY());415 point = context.getPoint(new Snode(map.bounds.maxlat - (grad * (tspan / 10)), lon + (i * (nspan / 10))));416 p.lineTo(point.getX(), point.getY());417 point = context.getPoint(new Snode(map.bounds.minlat, lon + (i * (nspan / 10))));418 p.moveTo(point.getX(), point.getY());419 point = context.getPoint(new Snode(map.bounds.minlat + (grad * (tspan / 10)), lon + (i * (nspan / 10))));420 p.lineTo(point.getX(), point.getY());421 }422 413 double deg = Math.toDegrees(lon); 423 414 String ew = (deg < -0.001) ? "W" : (deg > 0.001) ? "E" : ""; … … 428 419 Symbol label = new Symbol(); 429 420 if (point.getX() > 600.0) { 430 label.add(new Instr(Form.TEXT, new Caption(dstr, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-10, - 20)))));421 label.add(new Instr(Form.TEXT, new Caption(dstr, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-10, -40))))); 431 422 label.add(new Instr(Form.TEXT, new Caption(mstr, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, 0))))); 432 423 Symbols.drawSymbol(g2, label, sScale, point.getX(), point.getY(), null, null); 424 } 425 for (int i = 1; i < 10; i++) { 426 int grad = (i % (ndiv ? 2 : 5)) == 0 ? 2 : 1; 427 point = context.getPoint(new Snode(map.bounds.maxlat, lon + (i * (ndeg / 10)))); 428 p.moveTo(point.getX(), point.getY()); 429 point = context.getPoint(new Snode(map.bounds.maxlat - (grad * (tdeg / 20)), lon + (i * (ndeg / 10)))); 430 p.lineTo(point.getX(), point.getY()); 431 point = context.getPoint(new Snode(map.bounds.minlat, lon + (i * (ndeg / 10)))); 432 p.moveTo(point.getX(), point.getY()); 433 point = context.getPoint(new Snode(map.bounds.minlat + (grad * (tdeg / 20)), lon + (i * (ndeg / 10)))); 434 p.lineTo(point.getX(), point.getY()); 433 435 } 434 436 } … … 437 439 g2.setStroke(new BasicStroke((float) (style.width * sScale), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)); 438 440 p = new Path2D.Double(); 439 for (double lat = bottom; lat < map.bounds.maxlat; lat += Math.toRadians(tspan)) {441 for (double lat = bottom; lat < map.bounds.maxlat; lat += tdeg) { 440 442 point = context.getPoint(new Snode(lat, map.bounds.maxlon)); 441 443 p.moveTo(point.getX(), point.getY()); … … 450 452 Symbol label = new Symbol(); 451 453 if (point.getY() < (context.getPoint(new Snode(map.bounds.minlat, map.bounds.minlon)).getY() - 200.0)) { 452 label.add(new Instr(Form.TEXT, new Caption(dstr, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.BL, AffineTransform.getTranslateInstance( 10, -10)))));454 label.add(new Instr(Form.TEXT, new Caption(dstr, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.BL, AffineTransform.getTranslateInstance(40, -10))))); 453 455 label.add(new Instr(Form.TEXT, new Caption(mstr, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.BL, AffineTransform.getTranslateInstance(0, 50))))); 454 456 Symbols.drawSymbol(g2, label, sScale, point.getX(), point.getY(), null, null); 457 } 458 for (int i = 1; i < 10; i++) { 459 int grad = (i % (tdiv ? 2 : 5)) == 0 ? 2 : 1; 460 point = context.getPoint(new Snode(lat + (i * (tdeg / 10)), map.bounds.maxlon)); 461 p.moveTo(point.getX(), point.getY()); 462 point = context.getPoint(new Snode(lat + (i * (tdeg / 10)), map.bounds.maxlon - (grad * (ndeg / 20)))); 463 p.lineTo(point.getX(), point.getY()); 464 point = context.getPoint(new Snode(lat + (i * (tdeg / 10)), map.bounds.minlon)); 465 p.moveTo(point.getX(), point.getY()); 466 point = context.getPoint(new Snode(lat + (i * (tdeg / 10)), map.bounds.minlon + (grad * (ndeg / 20)))); 467 p.lineTo(point.getX(), point.getY()); 455 468 } 456 469 }
Note:
See TracChangeset
for help on using the changeset viewer.