Ignore:
Timestamp:
2017-05-13T01:12:44+02:00 (3 years ago)
Author:
Don-vip
Message:

see #11889, see #11924, see #13387 - use backported versions of Math.toDegrees/toRadians (more accurate and faster) - to revert when migrating to Java 9

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/coor/LatLon.java

    r11045 r12131  
    88import static java.lang.Math.sin;
    99import static java.lang.Math.sqrt;
    10 import static java.lang.Math.toRadians;
    1110import static org.openstreetmap.josm.data.projection.Ellipsoid.WGS84;
    1211import static org.openstreetmap.josm.tools.I18n.trc;
     12import static org.openstreetmap.josm.tools.Utils.toRadians;
    1313
    1414import java.awt.geom.Area;
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r12100 r12131  
    286286    static final int FLAG_OUTERMEMBER_OF_SELECTED = 8;
    287287
    288     private static final double PHI = Math.toRadians(20);
     288    private static final double PHI = Utils.toRadians(20);
    289289    private static final double cosPHI = Math.cos(PHI);
    290290    private static final double sinPHI = Math.sin(PHI);
     
    978978            fromAngle = Math.atan(dy / dx);
    979979        }
    980         double fromAngleDeg = Math.toDegrees(fromAngle);
     980        double fromAngleDeg = Utils.toDegrees(fromAngle);
    981981
    982982        double vx = distanceFromVia * Math.cos(fromAngle);
     
    10011001        if (pFrom.x >= pVia.x && pFrom.y >= pVia.y) {
    10021002            if (!leftHandTraffic) {
    1003                 vx2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg - 90));
    1004                 vy2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg - 90));
     1003                vx2 = distanceFromWay * Math.cos(Utils.toRadians(fromAngleDeg - 90));
     1004                vy2 = distanceFromWay * Math.sin(Utils.toRadians(fromAngleDeg - 90));
    10051005            } else {
    1006                 vx2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg + 90));
    1007                 vy2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg + 90));
     1006                vx2 = distanceFromWay * Math.cos(Utils.toRadians(fromAngleDeg + 90));
     1007                vy2 = distanceFromWay * Math.sin(Utils.toRadians(fromAngleDeg + 90));
    10081008            }
    10091009            iconAngle = 270+fromAngleDeg;
     
    10111011        if (pFrom.x < pVia.x && pFrom.y >= pVia.y) {
    10121012            if (!leftHandTraffic) {
    1013                 vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg));
    1014                 vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg));
     1013                vx2 = distanceFromWay * Math.sin(Utils.toRadians(fromAngleDeg));
     1014                vy2 = distanceFromWay * Math.cos(Utils.toRadians(fromAngleDeg));
    10151015            } else {
    1016                 vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg + 180));
    1017                 vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg + 180));
     1016                vx2 = distanceFromWay * Math.sin(Utils.toRadians(fromAngleDeg + 180));
     1017                vy2 = distanceFromWay * Math.cos(Utils.toRadians(fromAngleDeg + 180));
    10181018            }
    10191019            iconAngle = 90-fromAngleDeg;
     
    10211021        if (pFrom.x < pVia.x && pFrom.y < pVia.y) {
    10221022            if (!leftHandTraffic) {
    1023                 vx2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg + 90));
    1024                 vy2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg + 90));
     1023                vx2 = distanceFromWay * Math.cos(Utils.toRadians(fromAngleDeg + 90));
     1024                vy2 = distanceFromWay * Math.sin(Utils.toRadians(fromAngleDeg + 90));
    10251025            } else {
    1026                 vx2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg - 90));
    1027                 vy2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg - 90));
     1026                vx2 = distanceFromWay * Math.cos(Utils.toRadians(fromAngleDeg - 90));
     1027                vy2 = distanceFromWay * Math.sin(Utils.toRadians(fromAngleDeg - 90));
    10281028            }
    10291029            iconAngle = 90+fromAngleDeg;
     
    10311031        if (pFrom.x >= pVia.x && pFrom.y < pVia.y) {
    10321032            if (!leftHandTraffic) {
    1033                 vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg + 180));
    1034                 vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg + 180));
     1033                vx2 = distanceFromWay * Math.sin(Utils.toRadians(fromAngleDeg + 180));
     1034                vy2 = distanceFromWay * Math.cos(Utils.toRadians(fromAngleDeg + 180));
    10351035            } else {
    1036                 vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg));
    1037                 vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg));
     1036                vx2 = distanceFromWay * Math.sin(Utils.toRadians(fromAngleDeg));
     1037                vy2 = distanceFromWay * Math.cos(Utils.toRadians(fromAngleDeg));
    10381038            }
    10391039            iconAngle = 270-fromAngleDeg;
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java

    r11452 r12131  
    3232import org.openstreetmap.josm.gui.NavigatableComponent;
    3333import org.openstreetmap.josm.gui.draw.MapPath2D;
     34import org.openstreetmap.josm.tools.Utils;
    3435
    3536/**
     
    9091
    9192    /** Helper variable for {@link #drawSegment} */
    92     private static final ArrowPaintHelper ARROW_PAINT_HELPER = new ArrowPaintHelper(Math.toRadians(20), 10);
     93    private static final ArrowPaintHelper ARROW_PAINT_HELPER = new ArrowPaintHelper(Utils.toRadians(20), 10);
    9394
    9495    /** Helper variable for {@link #visit(Relation)} */
  • trunk/src/org/openstreetmap/josm/data/validation/PaintVisitor.java

    r11893 r12131  
    1818import org.openstreetmap.josm.data.osm.visitor.AbstractVisitor;
    1919import org.openstreetmap.josm.gui.MapView;
     20import org.openstreetmap.josm.tools.Utils;
    2021
    2122/**
     
    144145        double cosT = 5 * Math.cos(t);
    145146        double sinT = 5 * Math.sin(t);
    146         int deg = (int) Math.toDegrees(t);
     147        int deg = (int) Utils.toDegrees(t);
    147148        if (selected) {
    148149            g.setColor(getHighlightColor(color));
Note: See TracChangeset for help on using the changeset viewer.