Changeset 9116 in josm for trunk/src


Ignore:
Timestamp:
2015-12-13T22:29:34+01:00 (9 years ago)
Author:
bastiK
Message:

fix projection near 180 degree meridian (see #12186)

Location:
trunk/src/org/openstreetmap/josm/data/projection/proj
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/projection/proj/AbstractProj.java

    r9112 r9116  
    121121    }
    122122
     123    public static double normalizeLon(double lon) {
     124        if (lon >= - Math.PI && lon <= Math.PI)
     125            return lon;
     126        else {
     127            lon = lon % (2 * Math.PI);
     128            if (lon > Math.PI) {
     129                return lon - 2 * Math.PI;
     130            } else if (lon < -Math.PI) {
     131                return lon + 2 * Math.PI;
     132            }
     133            return lon;
     134        }
     135    }
    123136}
  • trunk/src/org/openstreetmap/josm/data/projection/proj/LambertConformalConic.java

    r8510 r9116  
    2424 * @author Pieren
    2525 */
    26 public class LambertConformalConic implements Proj {
     26public class LambertConformalConic extends AbstractProj {
    2727
    2828    protected Ellipsoid ellps;
     
    154154    @Override
    155155    public double[] project(double phi, double lambda) {
     156        lambda = normalizeLon(lambda);
    156157        double sinphi = sin(phi);
    157158        double l = (0.5*log((1+sinphi)/(1-sinphi))) - e/2*log((1+e*sinphi)/(1-e*sinphi));
  • trunk/src/org/openstreetmap/josm/data/projection/proj/TransverseMercator.java

    r9112 r9116  
    125125    @Override
    126126    public double[] project(double y, double x) {
     127        x = normalizeLon(x);
    127128        double sinphi = Math.sin(y);
    128129        double cosphi = Math.cos(y);
Note: See TracChangeset for help on using the changeset viewer.