Ignore:
Timestamp:
2016-09-03T16:43:42+02:00 (10 years ago)
Author:
donvip
Message:

checkstyle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.
    102package render;
    113
     
    4941import symbols.Symbols.Symbol;
    5042
    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 */
     46public 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};
    5453
    5554    public enum LabelStyle { NONE, RRCT, RECT, ELPS, CIRC, VCLR, PCLR, HCLR }
     
    260259                                if (!gap) {
    261260                                    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))));
    263263                                }
    264264                                if (space > 0)
     
    462462            double po = sw / 2;
    463463            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));
    465466            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));
    466467            label.add(new Instr(Form.PLIN, p));
     
    481482            po = sw / 2;
    482483            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));
    485493            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)))));
    488498            break;
    489499        case HCLR:
     
    502512            double vo = height / 4;
    503513            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);
    506523            label.add(new Instr(Form.PLIN, p));
    507524            break;
     
    589606        }
    590607        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));
    592610        g2.setPaint(Color.black);
    593611        Point2D.Double centre = (Point2D.Double) context.getPoint(Rules.feature.geom.centre);
    594612        double radial = radius * context.mile(Rules.feature);
    595613        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))));
    597616        } else {
    598617            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))));
    601622            }
    602623        }
     
    604625        g2.setStroke(new BasicStroke((float) arcWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1));
    605626        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));
    607629        if (col2 != null) {
    608630            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));
    610633        }
    611634        if ((str != null) && (!str.isEmpty())) {
Note: See TracChangeset for help on using the changeset viewer.