Ignore:
Timestamp:
2016-05-11T04:44:00+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:S2184 - Math operands should be cast before assignment

Location:
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint
Files:
4 edited

Legend:

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

    r8616 r10181  
    221221                    int x = (p.x+lastP.x)/2;
    222222                    int y = (p.y+lastP.y)/2;
    223                     path.moveTo(x-virtualNodeSize, y);
    224                     path.lineTo(x+virtualNodeSize, y);
    225                     path.moveTo(x, y-virtualNodeSize);
    226                     path.lineTo(x, y+virtualNodeSize);
     223                    path.moveTo((float) x-virtualNodeSize, y);
     224                    path.lineTo((float) x+virtualNodeSize, y);
     225                    path.moveTo(x, (float) y-virtualNodeSize);
     226                    path.lineTo(x, (float) y+virtualNodeSize);
    227227                }
    228228                lastP = p;
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/LineClip.java

    r9243 r10181  
    3939        }
    4040        return cohenSutherland(p1.x, p1.y, p2.x, p2.y, clipBounds.x, clipBounds.y,
    41                 clipBounds.x + clipBounds.width, clipBounds.y + clipBounds.height);
     41                (long) clipBounds.x + clipBounds.width,
     42                (long) clipBounds.y + clipBounds.height);
    4243    }
    4344
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r10000 r10181  
    144144            int dxNext = next.x - current.x;
    145145            int dyNext = next.y - current.y;
    146             double lenNext = Math.sqrt(dxNext*dxNext + dyNext*dyNext);
     146            double lenNext = Math.sqrt((double) dxNext*dxNext + (double) dyNext*dyNext);
    147147
    148148            if (lenNext == 0) {
     
    814814                final double segmentLength = thisP.distance(lastP);
    815815
    816                 final double dx = thisP.x - lastP.x;
    817                 final double dy = thisP.y - lastP.y;
     816                final double dx = (double) thisP.x - lastP.x;
     817                final double dy = (double) thisP.y - lastP.y;
    818818
    819819                // pos is the position from the beginning of the current segment
     
    12631263
    12641264            if (lastPoint != null) {
    1265                 dx = p.x - lastPoint.x;
    1266                 dy = p.y - lastPoint.y;
     1265                dx = (long) p.x - lastPoint.x;
     1266                dy = (long) p.y - lastPoint.y;
    12671267                double segmentLength = Math.sqrt(dx*dx + dy*dy);
    12681268                if (segmentLength > 2*(rec.getWidth()+4)) {
     
    17561756        // Can be optimized if it turns out to be slow.
    17571757        for (int i = 1; i < poly.npoints; ++i) {
    1758             dx = poly.xpoints[i] - poly.xpoints[i-1];
    1759             dy = poly.ypoints[i] - poly.ypoints[i-1];
     1758            dx = (long) poly.xpoints[i] - poly.xpoints[i-1];
     1759            dy = (long) poly.ypoints[i] - poly.ypoints[i-1];
    17601760            segLen = Math.sqrt(dx*dx + dy*dy);
    17611761            if (totalLen > curLen + segLen) {
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java

    r9243 r10181  
    432432                final double sy = l * (p1.y - p2.y);
    433433
    434                 path.lineTo(p2.x + (int) Math.round(cosPHI * sx - sinPHI * sy), p2.y + (int) Math.round(sinPHI * sx + cosPHI * sy));
    435                 path.moveTo(p2.x + (int) Math.round(cosPHI * sx + sinPHI * sy), p2.y + (int) Math.round(-sinPHI * sx + cosPHI * sy));
     434                path.lineTo(p2.x + (float) Math.round(cosPHI * sx - sinPHI * sy), p2.y + (float) Math.round(sinPHI * sx + cosPHI * sy));
     435                path.moveTo(p2.x + (float) Math.round(cosPHI * sx + sinPHI * sy), p2.y + (float) Math.round(-sinPHI * sx + cosPHI * sy));
    436436                path.lineTo(p2.x, p2.y);
    437437            }
Note: See TracChangeset for help on using the changeset viewer.