Changeset 11601 in josm for trunk/src/org/openstreetmap/josm/data/projection/proj
 Timestamp:
 20170223T01:03:15+01:00 (2 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/org/openstreetmap/josm/data/projection/proj/LambertAzimuthalEqualArea.java
r10378 r11601 183 183 @Override 184 184 public double[] invproject(double x, double y) { 185 final double lambda, phi;186 185 switch (mode) { 187 186 case EQUATORIAL: // Fall through 188 case OBLIQUE: { 189 x /= dd; 190 y *= dd; 191 final double rho = Math.hypot(x, y); 192 if (rho < FINE_EPSILON) { 193 lambda = 0.0; 194 phi = latitudeOfOrigin; 195 } else { 196 double sCe, cCe, ab; 197 sCe = 2.0 * Math.asin(0.5 * rho / rq); 198 cCe = Math.cos(sCe); 199 sCe = Math.sin(sCe); 200 x *= sCe; 201 if (mode == Mode.OBLIQUE) { 202 ab = cCe * sinb1 + y * sCe * cosb1 / rho; 203 y = rho * cosb1 * cCe  y * sinb1 * sCe; 204 } else { 205 ab = y * sCe / rho; 206 y = rho * cCe; 207 } 208 lambda = Math.atan2(x, y); 209 phi = authlat(Math.asin(ab)); 210 } 211 break; 187 case OBLIQUE: 188 return invprojectEO(x, y); 189 case NORTH_POLE: 190 return invprojectNS(x, y); 191 case SOUTH_POLE: 192 return invprojectNS(x, y); 193 default: 194 throw new AssertionError(mode); 195 } 196 } 197 198 private double[] invprojectEO(double x, double y) { 199 final double lambda; 200 final double phi; 201 x /= dd; 202 y *= dd; 203 final double rho = Math.hypot(x, y); 204 if (rho < FINE_EPSILON) { 205 lambda = 0.0; 206 phi = latitudeOfOrigin; 207 } else { 208 final double ab; 209 double sCe = 2.0 * Math.asin(0.5 * rho / rq); 210 double cCe = Math.cos(sCe); 211 sCe = Math.sin(sCe); 212 x *= sCe; 213 if (mode == Mode.OBLIQUE) { 214 ab = cCe * sinb1 + y * sCe * cosb1 / rho; 215 y = rho * cosb1 * cCe  y * sinb1 * sCe; 216 } else { 217 ab = y * sCe / rho; 218 y = rho * cCe; 212 219 } 213 case NORTH_POLE: { 214 y = y; 215 // Fall through 220 lambda = Math.atan2(x, y); 221 phi = authlat(Math.asin(ab)); 222 } 223 return new double[] {phi, lambda}; 224 } 225 226 private double[] invprojectNS(double x, double y) { 227 final double lambda; 228 final double phi; 229 final double q = x*x + y*y; 230 if (q == 0) { 231 lambda = 0.; 232 phi = latitudeOfOrigin; 233 } else { 234 double ab = 1.0  q / qp; 235 if (mode == Mode.SOUTH_POLE) { 236 ab = ab; 216 237 } 217 case SOUTH_POLE: { 218 final double q = x*x + y*y; 219 if (q == 0) { 220 lambda = 0.; 221 phi = latitudeOfOrigin; 222 } else { 223 double ab = 1.0  q / qp; 224 if (mode == Mode.SOUTH_POLE) { 225 ab = ab; 226 } 227 lambda = Math.atan2(x, y); 228 phi = authlat(Math.asin(ab)); 229 } 230 break; 231 } 232 default: { 233 throw new AssertionError(mode); 234 } 238 lambda = Math.atan2(x, y); 239 phi = authlat(Math.asin(ab)); 235 240 } 236 241 return new double[] {phi, lambda}; 237 242 } 238 239 243 240 244 /**
Note: See TracChangeset
for help on using the changeset viewer.