Changeset 32907 in osm for applications/editors/josm/plugins/seachart/src/render
- Timestamp:
- 2016-09-03T16:43:42+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/seachart/src/render
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachart/src/render/ChartContext.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 … … 17 9 import s57.S57map.Snode; 18 10 11 /** 12 * @author Malcolm Herring 13 */ 19 14 public interface ChartContext { 20 15 enum RuleSet { ALL, BASE, SEAMARK } -
applications/editors/josm/plugins/seachart/src/render/Renderer.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 … … 49 41 import symbols.Symbols.Symbol; 50 42 51 public class Renderer { 52 53 public static final double[] symbolScale = {256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0, 1.0, 0.61, 0.372, 0.227, 0.138, 0.0843, 0.0514, 0.0313, 0.0191, 0.0117, 0.007 }; 43 /** 44 * @author Malcolm Herring 45 */ 46 public final class Renderer { 47 private Renderer() { 48 // Hide default constructor for utilities classes 49 } 50 51 public static final double[] symbolScale = { 52 256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0, 1.0, 0.61, 0.372, 0.227, 0.138, 0.0843, 0.0514, 0.0313, 0.0191, 0.0117, 0.007}; 54 53 55 54 public enum LabelStyle { NONE, RRCT, RECT, ELPS, CIRC, VCLR, PCLR, HCLR } … … 260 259 if (!gap) { 261 260 Symbols.drawSymbol(g2, symbol, sScale, curr.getX(), curr.getY(), new Scheme(col), 262 new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.atan2((succ.getY() - curr.getY()), (succ.getX() - curr.getX())) + Math.toRadians(90)))); 261 new Delta(Handle.BC, AffineTransform.getRotateInstance( 262 Math.atan2((succ.getY() - curr.getY()), (succ.getX() - curr.getX())) + Math.toRadians(90)))); 263 263 } 264 264 if (space > 0) … … 462 462 double po = sw / 2; 463 463 label.add(new Instr(Form.STRK, new BasicStroke(sw, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); 464 Path2D.Double p = new Path2D.Double(); p.moveTo(-height*0.2, -ly-po); p.lineTo(height*0.2, -ly-po); p.moveTo(0, -ly-po); p.lineTo(0, -ly-po-(height*0.15)); 464 Path2D.Double p = new Path2D.Double(); p.moveTo(-height*0.2, -ly-po); 465 p.lineTo(height*0.2, -ly-po); p.moveTo(0, -ly-po); p.lineTo(0, -ly-po-(height*0.15)); 465 466 p.moveTo(-height*0.2, ly+po); p.lineTo((height*0.2), ly+po); p.moveTo(0, ly+po); p.lineTo(0, ly+po+(height*0.15)); 466 467 label.add(new Instr(Form.PLIN, p)); … … 481 482 po = sw / 2; 482 483 label.add(new Instr(Form.STRK, new BasicStroke(sw, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); 483 p = new Path2D.Double(); p.moveTo(-height*0.2, -ly-po); p.lineTo(height*0.2, -ly-po); p.moveTo(0, -ly-po); p.lineTo(0, -ly-po-(height*0.15)); 484 p.moveTo(-height*0.2, ly+po); p.lineTo((height*0.2), ly+po); p.moveTo(0, ly+po); p.lineTo(0, ly+po+(height*0.15)); 484 p = new Path2D.Double(); 485 p.moveTo(-height*0.2, -ly-po); 486 p.lineTo(height*0.2, -ly-po); 487 p.moveTo(0, -ly-po); 488 p.lineTo(0, -ly-po-(height*0.15)); 489 p.moveTo(-height*0.2, ly+po); 490 p.lineTo((height*0.2), ly+po); 491 p.moveTo(0, ly+po); 492 p.lineTo(0, ly+po+(height*0.15)); 485 493 label.add(new Instr(Form.PLIN, p)); 486 label.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Areas.CableFlash, 1, 0, 0, null, new Delta(Handle.CC, new AffineTransform(0, -1, 1, 0, -width/2, 0))))); 487 label.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Areas.CableFlash, 1, 0, 0, null, new Delta(Handle.CC, new AffineTransform(0, -1, 1, 0, width/2, 0))))); 494 label.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Areas.CableFlash, 1, 0, 0, null, 495 new Delta(Handle.CC, new AffineTransform(0, -1, 1, 0, -width/2, 0))))); 496 label.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Areas.CableFlash, 1, 0, 0, null, 497 new Delta(Handle.CC, new AffineTransform(0, -1, 1, 0, width/2, 0))))); 488 498 break; 489 499 case HCLR: … … 502 512 double vo = height / 4; 503 513 label.add(new Instr(Form.STRK, new BasicStroke(sw, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); 504 p = new Path2D.Double(); p.moveTo(-width*0.4-sw, -ly-vo); p.lineTo(-width*0.4-sw, ly+vo); p.moveTo(-width*0.4-sw, 0); p.lineTo(-width*0.4+sw, 0); 505 p.moveTo(width*0.4+sw, -ly-vo); p.lineTo(width*0.4+sw, ly+vo); p.moveTo(width*0.4-sw, 0); p.lineTo(width*0.4+sw, 0); 514 p = new Path2D.Double(); 515 p.moveTo(-width*0.4-sw, -ly-vo); 516 p.lineTo(-width*0.4-sw, ly+vo); 517 p.moveTo(-width*0.4-sw, 0); 518 p.lineTo(-width*0.4+sw, 0); 519 p.moveTo(width*0.4+sw, -ly-vo); 520 p.lineTo(width*0.4+sw, ly+vo); 521 p.moveTo(width*0.4-sw, 0); 522 p.lineTo(width*0.4+sw, 0); 506 523 label.add(new Instr(Form.PLIN, p)); 507 524 break; … … 589 606 } 590 607 double mid = (((s1 + s2) / 2) + (s1 > s2 ? 180 : 0)) % 360; 591 g2.setStroke(new BasicStroke((float) (3.0 * sScale), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1, new float[] {20 * (float) sScale, 20 * (float) sScale}, 0)); 608 g2.setStroke(new BasicStroke((float) (3.0 * sScale), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1, 609 new float[] {20 * (float) sScale, 20 * (float) sScale}, 0)); 592 610 g2.setPaint(Color.black); 593 611 Point2D.Double centre = (Point2D.Double) context.getPoint(Rules.feature.geom.centre); 594 612 double radial = radius * context.mile(Rules.feature); 595 613 if (dir != null) { 596 g2.draw(new Line2D.Double(centre.x, centre.y, centre.x - radial * Math.sin(Math.toRadians(dir)), centre.y + radial * Math.cos(Math.toRadians(dir)))); 614 g2.draw(new Line2D.Double(centre.x, centre.y, centre.x - radial * Math.sin(Math.toRadians(dir)), 615 centre.y + radial * Math.cos(Math.toRadians(dir)))); 597 616 } else { 598 617 if ((s1 != 0.0) || (s2 != 360.0)) { 599 g2.draw(new Line2D.Double(centre.x, centre.y, centre.x - radial * Math.sin(Math.toRadians(s1)), centre.y + radial * Math.cos(Math.toRadians(s1)))); 600 g2.draw(new Line2D.Double(centre.x, centre.y, centre.x - radial * Math.sin(Math.toRadians(s2)), centre.y + radial * Math.cos(Math.toRadians(s2)))); 618 g2.draw(new Line2D.Double(centre.x, centre.y, centre.x - radial * Math.sin(Math.toRadians(s1)), 619 centre.y + radial * Math.cos(Math.toRadians(s1)))); 620 g2.draw(new Line2D.Double(centre.x, centre.y, centre.x - radial * Math.sin(Math.toRadians(s2)), 621 centre.y + radial * Math.cos(Math.toRadians(s2)))); 601 622 } 602 623 } … … 604 625 g2.setStroke(new BasicStroke((float) arcWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1)); 605 626 g2.setPaint(col1); 606 g2.draw(new Arc2D.Double(centre.x - radial, centre.y - radial, 2 * radial, 2 * radial, -(s1 + 90), ((s1 < s2) ? (s1 - s2) : (s1 - s2 - 360)), Arc2D.OPEN)); 627 g2.draw(new Arc2D.Double(centre.x - radial, centre.y - radial, 2 * radial, 2 * radial, -(s1 + 90), 628 ((s1 < s2) ? (s1 - s2) : (s1 - s2 - 360)), Arc2D.OPEN)); 607 629 if (col2 != null) { 608 630 g2.setPaint(col2); 609 g2.draw(new Arc2D.Double(centre.x - radial + arcWidth, centre.y - radial + arcWidth, 2 * (radial - arcWidth), 2 * (radial - arcWidth), -(s1 + 90), ((s1 < s2) ? (s1 - s2) : (s1 - s2 - 360)), Arc2D.OPEN)); 631 g2.draw(new Arc2D.Double(centre.x - radial + arcWidth, centre.y - radial + arcWidth, 2 * (radial - arcWidth), 632 2 * (radial - arcWidth), -(s1 + 90), ((s1 < s2) ? (s1 - s2) : (s1 - s2 - 360)), Arc2D.OPEN)); 610 633 } 611 634 if ((str != null) && (!str.isEmpty())) { -
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(); -
applications/editors/josm/plugins/seachart/src/render/Signals.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 … … 35 27 import symbols.Topmarks; 36 28 29 /** 30 * @author Malcolm Herring 31 */ 37 32 public class Signals extends Rules { 38 33 … … 194 189 } 195 190 if (!str.isEmpty()) { 196 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-60, -30))); 191 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, 192 new Delta(Handle.TR, AffineTransform.getTranslateInstance(-60, -30))); 197 193 } 198 194 } … … 241 237 } 242 238 if (!bstr.isEmpty()) { 243 Renderer.labelText(bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70))); 239 Renderer.labelText(bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, 240 new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70))); 244 241 } 245 242 } … … 358 355 if (Renderer.zoom >= 15) { 359 356 if (vais) { 360 Renderer.labelText("V-AIS", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70))); 357 Renderer.labelText("V-AIS", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, 358 new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70))); 361 359 } 362 360 if (!bstr.isEmpty()) { 363 Renderer.labelText(bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -110))); 361 Renderer.labelText(bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, 362 new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -110))); 364 363 } 365 364 } … … 398 397 } 399 398 } 400 Renderer.symbol(Beacons.LightFlare, new Scheme(LightColours.get(col)), new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.toRadians(120)))); 399 Renderer.symbol(Beacons.LightFlare, new Scheme(LightColours.get(col)), 400 new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.toRadians(120)))); 401 401 if (Renderer.zoom >= 12) { 402 402 String str = ""; … … 438 438 } 439 439 if (srad == radius) { 440 ArrayList<CatLIT> scats = (satts.containsKey(Att.CATLIT)) ? (ArrayList<CatLIT>) satts.get(Att.CATLIT).val : new ArrayList<CatLIT>(); 440 ArrayList<CatLIT> scats = (satts.containsKey(Att.CATLIT)) ? 441 (ArrayList<CatLIT>) satts.get(Att.CATLIT).val : new ArrayList<>(); 441 442 if (scats.contains(CatLIT.LIT_DIR)) { 442 443 if (satts.containsKey(Att.ORIENT)) { … … 504 505 } 505 506 if ((s1 <= 360) && (s2 <= 360) && (s1 != s2)) 506 Renderer.lightSector(LightColours.get(col1), LightColours.get(col2), radius, s1, s2, dir, (Renderer.zoom >= 15) ? str : ""); 507 Renderer.lightSector(LightColours.get(col1), LightColours.get(col2), radius, s1, s2, dir, 508 (Renderer.zoom >= 15) ? str : ""); 507 509 } 508 510 if (Renderer.zoom >= 15) { … … 545 547 sect.rng = atts.containsKey(Att.VALNMR) ? (Double) atts.get(Att.VALNMR).val : 0.0; 546 548 sect.hgt = atts.containsKey(Att.HEIGHT) ? (Double) atts.get(Att.HEIGHT).val : 0.0; 547 ArrayList<ColCOL> cols = (ArrayList<ColCOL>) (atts.containsKey(Att.COLOUR) ? atts.get(Att.COLOUR).val : new ArrayList<>()); 549 ArrayList<ColCOL> cols = (ArrayList<ColCOL>) 550 (atts.containsKey(Att.COLOUR) ? atts.get(Att.COLOUR).val : new ArrayList<>()); 548 551 sect.col = cols.size() > 0 ? cols.get(0) : ColCOL.COL_UNK; 549 552 if ((sect.chr != LitCHR.CHR_UNKN) && (sect.col != null)) … … 555 558 for (ArrayList<LitSect> group : groupings) { 556 559 LitSect mem = group.get(0); 557 if ((lit.dir == mem.dir) && (lit.chr == mem.chr) && (lit.grp.equals(mem.grp)) && (lit.per == mem.per) && (lit.hgt == mem.hgt)) { 560 if ((lit.dir == mem.dir) && (lit.chr == mem.chr) && (lit.grp.equals(mem.grp)) && 561 (lit.per == mem.per) && (lit.hgt == mem.hgt)) { 558 562 group.add(lit); 559 563 found = true; … … 630 634 str += df.format(tmp.hgt) + "m"; 631 635 if (colrng.get(0).rng > 0) 632 str += df.format(colrng.get(0).rng) + ((colrng.size() > 1) ? ((colrng.size() > 2) ? ("-" + df.format(colrng.get(colrng.size() - 1).rng)) : ("/" + df.format(colrng.get(1).rng))) : "") + "M"; 633 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, y))); 636 str += df.format(colrng.get(0).rng) + ((colrng.size() > 1) ? ((colrng.size() > 2) ? 637 ("-" + df.format(colrng.get(colrng.size() - 1).rng)) : ("/" + df.format(colrng.get(1).rng))) : "") + "M"; 638 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, 639 new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, y))); 634 640 y += 40; 635 641 str = ""; … … 680 686 str += (cats.contains(CatLIT.LIT_VERT)) ? "(vert)" : ""; 681 687 str += (cats.contains(CatLIT.LIT_HORI)) ? "(hor)" : ""; 682 str += (!str.isEmpty() && (atts.containsKey(Att.SIGPER) || atts.containsKey(Att.HEIGHT) || atts.containsKey(Att.VALMXR)) && !str.endsWith(")")) ? "." : ""; 688 str += (!str.isEmpty() && (atts.containsKey(Att.SIGPER) || atts.containsKey(Att.HEIGHT) || atts.containsKey(Att.VALMXR)) 689 && !str.endsWith(")")) ? "." : ""; 683 690 str += (atts.containsKey(Att.SIGPER)) ? df.format(atts.get(Att.SIGPER).val) + "s" : ""; 684 691 str += (atts.containsKey(Att.HEIGHT)) ? df.format(atts.get(Att.HEIGHT).val) + "m" : ""; … … 688 695 str += (cats.contains(CatLIT.LIT_UPPR)) ? "(Upper)" : ""; 689 696 str += (cats.contains(CatLIT.LIT_LOWR)) ? "(Lower)" : ""; 690 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, -30))); 697 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, 698 new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, -30))); 691 699 } 692 700 }
Note:
See TracChangeset
for help on using the changeset viewer.