Changeset 6987 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2014-04-16T02:29:53+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
r6986 r6987 739 739 * Also contains functions that convert preferences object to JavaScript object and back 740 740 */ 741 public static class PreferencesUtils {741 public static final class PreferencesUtils { 742 742 743 743 private PreferencesUtils() { -
trunk/src/org/openstreetmap/josm/data/osm/DataIntegrityProblemException.java
r5170 r6987 4 4 public class DataIntegrityProblemException extends RuntimeException { 5 5 6 private String htmlMessage;6 private final String htmlMessage; 7 7 8 8 public DataIntegrityProblemException(String message) { 9 super(message);9 this(message, null); 10 10 } 11 11 -
trunk/src/org/openstreetmap/josm/data/projection/Ellipsoid.java
r6974 r6987 237 237 * convert cartesian coordinates to ellipsoidal coordinates 238 238 * 239 * @param XYZthe coordinates in meters (X, Y, Z)239 * @param xyz the coordinates in meters (X, Y, Z) 240 240 * @return The corresponding latitude and longitude in degrees 241 241 */ 242 public LatLon cart2LatLon(double[] XYZ) { 243 return cart2LatLon(XYZ, 1e-11); 244 } 245 public LatLon cart2LatLon(double[] XYZ, double epsilon) { 246 double norm = Math.sqrt(XYZ[0] * XYZ[0] + XYZ[1] * XYZ[1]); 247 double lg = 2.0 * Math.atan(XYZ[1] / (XYZ[0] + norm)); 248 double lt = Math.atan(XYZ[2] / (norm * (1.0 - (a * e2 / Math.sqrt(XYZ[0] * XYZ[0] + XYZ[1] * XYZ[1] + XYZ[2] * XYZ[2]))))); 242 public LatLon cart2LatLon(double[] xyz) { 243 return cart2LatLon(xyz, 1e-11); 244 } 245 246 public LatLon cart2LatLon(double[] xyz, double epsilon) { 247 double norm = Math.sqrt(xyz[0] * xyz[0] + xyz[1] * xyz[1]); 248 double lg = 2.0 * Math.atan(xyz[1] / (xyz[0] + norm)); 249 double lt = Math.atan(xyz[2] / (norm * (1.0 - (a * e2 / Math.sqrt(xyz[0] * xyz[0] + xyz[1] * xyz[1] + xyz[2] * xyz[2]))))); 249 250 double delta = 1.0; 250 251 while (delta > epsilon) { 251 252 double s2 = Math.sin(lt); 252 253 s2 *= s2; 253 double l = Math.atan(( XYZ[2] / norm)254 double l = Math.atan((xyz[2] / norm) 254 255 / (1.0 - (a * e2 * Math.cos(lt) / (norm * Math.sqrt(1.0 - e2 * s2))))); 255 256 delta = Math.abs(l - lt); … … 270 271 271 272 double Rn = a / Math.sqrt(1 - e2 * Math.pow(Math.sin(phi), 2)); 272 double[] XYZ= new double[3];273 XYZ[0] = Rn * Math.cos(phi) * Math.cos(lambda);274 XYZ[1] = Rn * Math.cos(phi) * Math.sin(lambda);275 XYZ[2] = Rn * (1 - e2) * Math.sin(phi);276 277 return XYZ;273 double[] xyz = new double[3]; 274 xyz[0] = Rn * Math.cos(phi) * Math.cos(lambda); 275 xyz[1] = Rn * Math.cos(phi) * Math.sin(lambda); 276 xyz[2] = Rn * (1 - e2) * Math.sin(phi); 277 278 return xyz; 278 279 } 279 280 }
Note:
See TracChangeset
for help on using the changeset viewer.