Ignore:
Timestamp:
2011-06-28T18:50:13+02:00 (13 years ago)
Author:
jttt
Message:

Better fix for #6519

File:
1 edited

Legend:

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

    r4178 r4181  
    223223    }
    224224
    225     private double toInterval(double value, double min, double max) {
     225    private double toIntervalLat(double value, double min, double max) {
    226226        if (value < min)
    227227            return min;
     
    231231    }
    232232
     233    private double toIntervalLon(double value) {
     234        if (value < -180 || value > 180) {
     235            value = (value + 180) % 360;
     236            if (value < 0) {
     237                value += 360;
     238            }
     239            return value - 180;
     240        } else
     241            return value;
     242    }
     243
    233244    public void normalize() {
    234         minLat = toInterval(minLat, -90, 90);
    235         maxLat = toInterval(maxLat, -90, 90);
    236         minLon = toInterval(minLon, -180, 180);
    237         maxLon = toInterval(maxLon, -180, 180);
     245        minLat = toIntervalLat(minLat, -90, 90);
     246        maxLat = toIntervalLat(maxLat, -90, 90);
     247        minLon = toIntervalLon(minLon);
     248        maxLon = toIntervalLon(maxLon);
    238249    }
    239250
Note: See TracChangeset for help on using the changeset viewer.