Ignore:
Timestamp:
2015-06-20T23:42:21+02:00 (9 years ago)
Author:
Don-vip
Message:

checkstyle: enable relevant whitespace checks and fix them

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r8509 r8510  
    149149            int yCurrent0 = current.y - (int) Math.round(offset * dxNext / lenNext);
    150150
    151             if (idx==0) {
     151            if (idx == 0) {
    152152                ++idx;
    153153                prev = current;
     
    172172                int m = dxNext*(yCurrent0 - yPrev0) - dyNext*(xCurrent0 - xPrev0);
    173173
    174                 int cx = xPrev0 + (int) Math.round((double)m * dxPrev / det);
    175                 int cy = yPrev0 + (int) Math.round((double)m * dyPrev / det);
     174                int cx = xPrev0 + (int) Math.round((double) m * dxPrev / det);
     175                int cy = yPrev0 + (int) Math.round((double) m * dyPrev / det);
    176176                ++idx;
    177177                prev = current;
     
    238238    }
    239239
    240     private static Map<Font,Boolean> IS_GLYPH_VECTOR_DOUBLE_TRANSLATION_BUG = new HashMap<>();
     240    private static Map<Font, Boolean> IS_GLYPH_VECTOR_DOUBLE_TRANSLATION_BUG = new HashMap<>();
    241241
    242242    /**
     
    335335        super(g, nc, isInactiveMode);
    336336
    337         if (nc!=null) {
     337        if (nc != null) {
    338338            Component focusOwner = FocusManager.getCurrentManager().getFocusOwner();
    339339            useWiderHighlight = !(focusOwner instanceof AbstractButton || focusOwner == nc);
     
    364364        g.draw(path);
    365365
    366         if(!isInactiveMode && useStrokes && dashes != null) {
     366        if (!isInactiveMode && useStrokes && dashes != null) {
    367367            g.setColor(dashedColor);
    368368            g.setStroke(dashes);
     
    486486                final double h = pb.height - nb.getHeight();
    487487
    488                 final int x2 = pb.x + (int)(w/2.0);
    489                 final int y2 = pb.y + (int)(h/2.0);
     488                final int x2 = pb.x + (int) (w/2.0);
     489                final int y2 = pb.y + (int) (h/2.0);
    490490
    491491                final int nbw = (int) nb.getWidth();
     
    498498                if (!labelOK) {
    499499                    // if center position (C) is not inside osm shape, try naively some other positions as follows:
    500                     final int x1 = pb.x + (int)w/4.0);
    501                     final int x3 = pb.x + (int)(3*w/4.0);
    502                     final int y1 = pb.y + (int)h/4.0);
    503                     final int y3 = pb.y + (int)(3*h/4.0);
     500                    final int x1 = pb.x + (int)   (w/4.0);
     501                    final int x3 = pb.x + (int) (3*w/4.0);
     502                    final int y1 = pb.y + (int)   (h/4.0);
     503                    final int y3 = pb.y + (int) (3*h/4.0);
    504504                    // +-----------+
    505505                    // |  5  1  6  |
     
    526526                if (labelOK) {
    527527                    Font defaultFont = g.getFont();
    528                     int x = (int)(centeredNBounds.getMinX() - nb.getMinX());
    529                     int y = (int)(centeredNBounds.getMinY() - nb.getMinY());
     528                    int x = (int) (centeredNBounds.getMinX() - nb.getMinX());
     529                    int y = (int) (centeredNBounds.getMinY() - nb.getMinY());
    530530                    displayText(null, name, x, y, osm.isDisabled(), text);
    531531                    g.setFont(defaultFont);
     
    707707    @Override
    708708    public void drawNode(Node n, Color color, int size, boolean fill) {
    709         if(size <= 0 && !n.isHighlighted())
     709        if (size <= 0 && !n.isHighlighted())
    710710            return;
    711711
    712712        Point p = nc.getPoint(n);
    713713
    714         if(n.isHighlighted()) {
     714        if (n.isHighlighted()) {
    715715            drawPointHighlight(p, size);
    716716        }
     
    737737
    738738        final int w = img.getWidth(), h = img.getHeight();
    739         if(n.isHighlighted()) {
     739        if (n.isHighlighted()) {
    740740            drawPointHighlight(p, Math.max(w, h));
    741741        }
     
    768768        int radius = s.size / 2;
    769769
    770         if(n.isHighlighted()) {
     770        if (n.isHighlighted()) {
    771771            drawPointHighlight(p, s.size);
    772772        }
     
    861861     */
    862862    private void drawPathHighlight(GeneralPath path, BasicStroke line) {
    863         if(path == null)
     863        if (path == null)
    864864            return;
    865865        g.setColor(highlightColorTransparent);
    866866        float w = line.getLineWidth() + highlightLineWidth;
    867         if (useWiderHighlight) w+=widerHighlight;
    868         while(w >= line.getLineWidth()) {
     867        if (useWiderHighlight) w += widerHighlight;
     868        while (w >= line.getLineWidth()) {
    869869            g.setStroke(new BasicStroke(w, line.getEndCap(), line.getLineJoin(), line.getMiterLimit()));
    870870            g.draw(path);
     
    879879        g.setColor(highlightColorTransparent);
    880880        int s = size + highlightPointRadius;
    881         if (useWiderHighlight) s+=widerHighlight;
    882         while(s >= size) {
     881        if (useWiderHighlight) s += widerHighlight;
     882        while (s >= size) {
    883883            int r = (int) Math.floor(s/2d);
    884884            g.fillRoundRect(p.x-r, p.y-r, s, s, r, r);
     
    890890        // rotate image with direction last node in from to, and scale down image to 16*16 pixels
    891891        Image smallImg = ImageProvider.createRotatedImage(img, angle, new Dimension(16, 16));
    892         int w = smallImg.getWidth(null), h=smallImg.getHeight(null);
    893         g.drawImage(smallImg, (int)(pVia.x+vx+vx2)-w/2, (int)(pVia.y+vy+vy2)-h/2, nc);
     892        int w = smallImg.getWidth(null), h = smallImg.getHeight(null);
     893        g.drawImage(smallImg, (int) (pVia.x+vx+vx2)-w/2, (int) (pVia.y+vy+vy2)-h/2, nc);
    894894
    895895        if (selected) {
    896896            g.setColor(isInactiveMode ? inactiveColor : relationSelectedColor);
    897             g.drawRect((int)(pVia.x+vx+vx2)-w/2-2,(int)(pVia.y+vy+vy2)-h/2-2, w+4, h+4);
     897            g.drawRect((int) (pVia.x+vx+vx2)-w/2-2, (int) (pVia.y+vy+vy2)-h/2-2, w+4, h+4);
    898898        }
    899899    }
     
    906906        /* find the "from", "via" and "to" elements */
    907907        for (RelationMember m : r.getMembers()) {
    908             if(m.getMember().isIncomplete())
     908            if (m.getMember().isIncomplete())
    909909                return;
    910910            else {
    911                 if(m.isWay()) {
     911                if (m.isWay()) {
    912912                    Way w = m.getWay();
    913                     if(w.getNodesCount() < 2) {
     913                    if (w.getNodesCount() < 2) {
    914914                        continue;
    915915                    }
     
    917917                    switch(m.getRole()) {
    918918                    case "from":
    919                         if(fromWay == null) {
     919                        if (fromWay == null) {
    920920                            fromWay = w;
    921921                        }
    922922                        break;
    923923                    case "to":
    924                         if(toWay == null) {
     924                        if (toWay == null) {
    925925                            toWay = w;
    926926                        }
    927927                        break;
    928928                    case "via":
    929                         if(via == null) {
     929                        if (via == null) {
    930930                            via = w;
    931931                        }
    932932                    }
    933                 } else if(m.isNode()) {
     933                } else if (m.isNode()) {
    934934                    Node n = m.getNode();
    935                     if("via".equals(m.getRole()) && via == null) {
     935                    if ("via".equals(m.getRole()) && via == null) {
    936936                        via = n;
    937937                    }
     
    944944
    945945        Node viaNode;
    946         if(via instanceof Node) {
     946        if (via instanceof Node) {
    947947            viaNode = (Node) via;
    948             if(!fromWay.isFirstLastNode(viaNode))
     948            if (!fromWay.isFirstLastNode(viaNode))
    949949                return;
    950950        } else {
     
    955955
    956956            String onewayviastr = viaWay.get("oneway");
    957             if(onewayviastr != null) {
    958                 if("-1".equals(onewayviastr)) {
     957            if (onewayviastr != null) {
     958                if ("-1".equals(onewayviastr)) {
    959959                    onewayvia = Boolean.TRUE;
    960960                    Node tmp = firstNode;
     
    969969            }
    970970
    971             if(fromWay.isFirstLastNode(firstNode)) {
     971            if (fromWay.isFirstLastNode(firstNode)) {
    972972                viaNode = firstNode;
    973973            } else if (!onewayvia && fromWay.isFirstLastNode(lastNode)) {
     
    979979        /* find the "direct" nodes before the via node */
    980980        Node fromNode;
    981         if(fromWay.firstNode() == via) {
     981        if (fromWay.firstNode() == via) {
    982982            fromNode = fromWay.getNode(1);
    983983        } else {
     
    992992           away from the "via" node along the first segment of the "from" way)
    993993         */
    994         double distanceFromVia=14;
     994        double distanceFromVia = 14;
    995995        double dx = pFrom.x >= pVia.x ? pFrom.x - pVia.x : pVia.x - pFrom.x;
    996996        double dy = pFrom.y >= pVia.y ? pFrom.y - pVia.y : pVia.y - pFrom.y;
     
    10071007        double vy = distanceFromVia * Math.sin(fromAngle);
    10081008
    1009         if(pFrom.x < pVia.x) {
     1009        if (pFrom.x < pVia.x) {
    10101010            vx = -vx;
    10111011        }
    1012         if(pFrom.y < pVia.y) {
     1012        if (pFrom.y < pVia.y) {
    10131013            vy = -vy;
    10141014        }
     
    10181018           90degrees away from the first segment of the "from" way)
    10191019         */
    1020         double distanceFromWay=10;
     1020        double distanceFromWay = 10;
    10211021        double vx2 = 0;
    10221022        double vy2 = 0;
    10231023        double iconAngle = 0;
    10241024
    1025         if(pFrom.x >= pVia.x && pFrom.y >= pVia.y) {
    1026             if(!leftHandTraffic) {
     1025        if (pFrom.x >= pVia.x && pFrom.y >= pVia.y) {
     1026            if (!leftHandTraffic) {
    10271027                vx2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg - 90));
    10281028                vy2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg - 90));
     
    10331033            iconAngle = 270+fromAngleDeg;
    10341034        }
    1035         if(pFrom.x < pVia.x && pFrom.y >= pVia.y) {
    1036             if(!leftHandTraffic) {
     1035        if (pFrom.x < pVia.x && pFrom.y >= pVia.y) {
     1036            if (!leftHandTraffic) {
    10371037                vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg));
    10381038                vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg));
     
    10431043            iconAngle = 90-fromAngleDeg;
    10441044        }
    1045         if(pFrom.x < pVia.x && pFrom.y < pVia.y) {
    1046             if(!leftHandTraffic) {
     1045        if (pFrom.x < pVia.x && pFrom.y < pVia.y) {
     1046            if (!leftHandTraffic) {
    10471047                vx2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg + 90));
    10481048                vy2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg + 90));
     
    10531053            iconAngle = 90+fromAngleDeg;
    10541054        }
    1055         if(pFrom.x >= pVia.x && pFrom.y < pVia.y) {
    1056             if(!leftHandTraffic) {
     1055        if (pFrom.x >= pVia.x && pFrom.y < pVia.y) {
     1056            if (!leftHandTraffic) {
    10571057                vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg + 180));
    10581058                vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg + 180));
     
    10961096            poly.addPoint(p.x, p.y);
    10971097
    1098             if(lastPoint != null) {
     1098            if (lastPoint != null) {
    10991099                dx = p.x - lastPoint.x;
    11001100                dy = p.y - lastPoint.y;
     
    11491149            double bestDistanceToCenter = Double.MAX_VALUE;
    11501150            double bestQuality = -1;
    1151             for (int i=0; i<longHalfSegmentStart.size(); i++) {
     1151            for (int i = 0; i < longHalfSegmentStart.size(); i++) {
    11521152                double start = longHalfSegmentStart.get(i);
    11531153                double end = longHalfSegmentEnd.get(i);
     
    12151215        GlyphVector gv = text.font.layoutGlyphVector(frc, chars, 0, chars.length, dirFlag);
    12161216
    1217         for (int i=0; i<gv.getNumGlyphs(); ++i) {
     1217        for (int i = 0; i < gv.getNumGlyphs(); ++i) {
    12181218            Rectangle2D rect = gv.getGlyphLogicalBounds(i).getBounds2D();
    12191219            double t = tStart + offsetSign * (rect.getX() + rect.getWidth()/2) / pathLength;
     
    12711271                    continue;
    12721272                }
    1273                 if(highlightSegs == null) {
     1273                if (highlightSegs == null) {
    12741274                    highlightSegs = new GeneralPath();
    12751275                }
     
    13331333
    13341334                            while (dist < segmentLength) {
    1335                                 for (int i=0; i<2; ++i) {
     1335                                for (int i = 0; i < 2; ++i) {
    13361336                                    float onewaySize = i == 0 ? 3f : 2f;
    13371337                                    GeneralPath onewayPath = i == 0 ? onewayArrowsCasing : onewayArrows;
     
    13611361            lastPoint = p;
    13621362        }
    1363         if(way.isHighlighted()) {
     1363        if (way.isHighlighted()) {
    13641364            drawPathHighlight(path, line);
    13651365        }
     
    14991499            MapCSSStyleSource.STYLE_SOURCE_LOCK.readLock().lock();
    15001500            try {
    1501                 for (int i = from; i<to; i++) {
     1501                for (int i = from; i < to; i++) {
    15021502                    OsmPrimitive osm = input.get(i);
    15031503                    if (osm.isDrawable()) {
     
    16011601            final int noBuckets = (prims.size() + bucketsize - 1) / bucketsize;
    16021602            final boolean singleThread = THREAD_POOL.a == 1 || noBuckets == 1;
    1603             for (int i=0; i<noBuckets; i++) {
     1603            for (int i = 0; i < noBuckets; i++) {
    16041604                int from = i*bucketsize;
    16051605                int to = Math.min((i+1)*bucketsize, prims.size());
     
    16361636            highlightWaySegments = data.getHighlightedWaySegments();
    16371637
    1638             long timeStart=0, timePhase1=0, timeFinished;
     1638            long timeStart = 0, timePhase1 = 0, timeFinished;
    16391639            if (Main.isTraceEnabled()) {
    16401640                timeStart = System.currentTimeMillis();
Note: See TracChangeset for help on using the changeset viewer.