# Changeset 9558 in josm for trunk/src/org/openstreetmap/josm/data/projection/proj

Ignore:
Timestamp:
2016-01-21T16:46:00+01:00 (5 years ago)
Message:

always normalize longitude before projection and after inverse projection (see #12186)

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

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

 r9535 } /** * Make sure longitude value is within [-PI, PI] range. * @param lon the longitude in radians * @return lon plus/minus multiples of 2*PI, as needed to get * in [-PI, PI] range */ public static double normalizeLon(double lon) { if (lon >= -Math.PI && lon <= Math.PI) return lon; else { lon = lon % (2 * Math.PI); if (lon > Math.PI) { return lon - 2 * Math.PI; } else if (lon < -Math.PI) { return lon + 2 * Math.PI; } return lon; } } // Iteratively solve equation (7-9) from Snyder. final double cphi2(final double ts) {
• ## trunk/src/org/openstreetmap/josm/data/projection/proj/AlbersEqualArea.java

 r9549 @Override public double[] project(double y, double x) { x = normalizeLon(x); x *= n; double rho = c - n * qsfn(Math.sin(y));
• ## trunk/src/org/openstreetmap/josm/data/projection/proj/LambertConformalConic.java

 r9243 @Override public double[] project(double phi, double lambda) { lambda = normalizeLon(lambda); double sinphi = sin(phi); 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/ObliqueMercator.java

 r9545 lon2 += 2.0 * Math.PI; } centralMeridian = normalizeLon(0.5 * (lon1 + lon2) - centralMeridian = normalizeLonRad(0.5 * (lon1 + lon2) - Math.atan(J * Math.tan(0.5 * B * (lon1 - lon2)) / P) / B); gamma0 = Math.atan(2.0 * Math.sin(B * normalizeLon(lon1 - centralMeridian)) / gamma0 = Math.atan(2.0 * Math.sin(B * normalizeLonRad(lon1 - centralMeridian)) / (Fp - 1.0 / Fp)); azimuth = Math.asin(D * Math.sin(gamma0)); } private double normalizeLonRad(double a) { return Math.toRadians(LatLon.normalizeLon(Math.toDegrees(a))); } @Override public double[] project(double y, double x) { x = normalizeLon(x); double u, v; if (Math.abs(Math.abs(y) - Math.PI/2.0) > EPSILON) {
• ## trunk/src/org/openstreetmap/josm/data/projection/proj/TransverseMercator.java

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