- Timestamp:
- 2016-01-21T16:46:00+01:00 (9 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/data_nodist/projection/projection-regression-test-data
r9549 r9558 6244 6244 ll 49.23525189671949 -54.40128360306443 6245 6245 en -4263130.034442673 2917092.5518731494 6246 ll2 50156.3548390288 246510.824131962236246 ll2 50156.3548390288 -89.17586803776794 6247 6247 EPSG:3060 6248 6248 ll -1.1011308836770013 155.39223808455847 … … 8564 8564 ll 35.30468974675124 -181.75048187801644 8565 8565 en 67958.20646357589 3917197.8125596363 8566 ll2 35.30468974617765 -181.750481878607648566 ll2 35.30468974617765 178.24951812139236 8567 8567 EPSG:32602 8568 8568 ll -0.35895685791257925 -175.75420623162898 … … 9124 9124 ll -36.29211488935783 181.82910716731914 9125 9125 en 933779.944968744 5972815.905636139 9126 ll2 -36.29211488867873 181.829107167921689126 ll2 -36.29211488867873 -178.17089283207832 9127 9127 EPSG:32761 9128 9128 ll -38.055794555690284 -128.52440162080111 -
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r9419 r9558 102 102 103 103 /** 104 * Make sure longitude value is within <code>[-180, 180]</code> range. 105 * @param lon the longitude in degrees 106 * @return lon plus/minus multiples of <code>360</code>, as needed to get 107 * in <code>[-180, 180]</code> range 108 */ 109 public static double normalizeLon(double lon) { 110 if (lon >= -180 && lon <= 180) 111 return lon; 112 else { 113 lon = lon % 360.0; 114 if (lon > 180) { 115 return lon - 360; 116 } else if (lon < -180) { 117 return lon + 360; 118 } 119 return lon; 120 } 121 } 122 123 /** 104 124 * Replies true if lat is in the range [-90,90] and lon is in the range [-180,180] 105 125 * -
trunk/src/org/openstreetmap/josm/data/projection/AbstractProjection.java
r9135 r9558 71 71 public EastNorth latlon2eastNorth(LatLon ll) { 72 72 ll = datum.fromWGS84(ll); 73 double[] en = proj.project(Math.toRadians(ll.lat()), Math.toRadians( ll.lon() - lon0 - pm));73 double[] en = proj.project(Math.toRadians(ll.lat()), Math.toRadians(LatLon.normalizeLon(ll.lon() - lon0 - pm))); 74 74 return new EastNorth(ellps.a * k0 * en[0] + x0, ellps.a * k0 * en[1] + y0); 75 75 } … … 78 78 public LatLon eastNorth2latlon(EastNorth en) { 79 79 double[] latlon_rad = proj.invproject((en.east() - x0) / ellps.a / k0, (en.north() - y0) / ellps.a / k0); 80 LatLon ll = new LatLon(Math.toDegrees(latlon_rad[0]), Math.toDegrees(latlon_rad[1]) + lon0 + pm);80 LatLon ll = new LatLon(Math.toDegrees(latlon_rad[0]), LatLon.normalizeLon(Math.toDegrees(latlon_rad[1]) + lon0 + pm)); 81 81 return datum.toWGS84(ll); 82 82 } -
trunk/src/org/openstreetmap/josm/data/projection/proj/AbstractProj.java
r9535 r9558 137 137 } 138 138 139 /**140 * Make sure longitude value is within <code>[-PI, PI]</code> range.141 * @param lon the longitude in radians142 * @return lon plus/minus multiples of <code>2*PI</code>, as needed to get143 * in <code>[-PI, PI]</code> range144 */145 public static double normalizeLon(double lon) {146 if (lon >= -Math.PI && lon <= Math.PI)147 return lon;148 else {149 lon = lon % (2 * Math.PI);150 if (lon > Math.PI) {151 return lon - 2 * Math.PI;152 } else if (lon < -Math.PI) {153 return lon + 2 * Math.PI;154 }155 return lon;156 }157 }158 159 139 // Iteratively solve equation (7-9) from Snyder. 160 140 final double cphi2(final double ts) { -
trunk/src/org/openstreetmap/josm/data/projection/proj/AlbersEqualArea.java
r9549 r9558 129 129 @Override 130 130 public double[] project(double y, double x) { 131 x = normalizeLon(x);132 131 x *= n; 133 132 double rho = c - n * qsfn(Math.sin(y)); -
trunk/src/org/openstreetmap/josm/data/projection/proj/LambertConformalConic.java
r9243 r9558 159 159 @Override 160 160 public double[] project(double phi, double lambda) { 161 lambda = normalizeLon(lambda);162 161 double sinphi = sin(phi); 163 162 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 r9558 288 288 lon2 += 2.0 * Math.PI; 289 289 } 290 centralMeridian = normalizeLon (0.5 * (lon1 + lon2) -290 centralMeridian = normalizeLonRad(0.5 * (lon1 + lon2) - 291 291 Math.atan(J * Math.tan(0.5 * B * (lon1 - lon2)) / P) / B); 292 gamma0 = Math.atan(2.0 * Math.sin(B * normalizeLon (lon1 - centralMeridian)) /292 gamma0 = Math.atan(2.0 * Math.sin(B * normalizeLonRad(lon1 - centralMeridian)) / 293 293 (Fp - 1.0 / Fp)); 294 294 azimuth = Math.asin(D * Math.sin(gamma0)); … … 359 359 } 360 360 361 private double normalizeLonRad(double a) { 362 return Math.toRadians(LatLon.normalizeLon(Math.toDegrees(a))); 363 } 364 361 365 @Override 362 366 public double[] project(double y, double x) { 363 x = normalizeLon(x);364 367 double u, v; 365 368 if (Math.abs(Math.abs(y) - Math.PI/2.0) > EPSILON) { -
trunk/src/org/openstreetmap/josm/data/projection/proj/TransverseMercator.java
r9139 r9558 126 126 @Override 127 127 public double[] project(double y, double x) { 128 x = normalizeLon(x);129 128 double sinphi = Math.sin(y); 130 129 double cosphi = Math.cos(y);
Note:
See TracChangeset
for help on using the changeset viewer.