- Timestamp:
- 2016-03-23T21:52:44+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r9983 r10033 9 9 import static java.lang.Math.sqrt; 10 10 import static java.lang.Math.toRadians; 11 import static org.openstreetmap.josm.data.projection.Ellipsoid.WGS84; 11 12 import static org.openstreetmap.josm.tools.I18n.trc; 12 13 … … 325 326 */ 326 327 public double greatCircleDistance(LatLon other) { 327 double R = 6378135;328 328 double sinHalfLat = sin(toRadians(other.lat() - this.lat()) / 2); 329 329 double sinHalfLon = sin(toRadians(other.lon() - this.lon()) / 2); 330 double d = 2 * R* asin(330 double d = 2 * WGS84.a * asin( 331 331 sqrt(sinHalfLat*sinHalfLat + 332 332 cos(toRadians(this.lat()))*cos(toRadians(other.lat()))*sinHalfLon*sinHalfLon)); … … 336 336 if (java.lang.Double.isNaN(d)) { 337 337 Main.error("NaN in greatCircleDistance"); 338 d = PI * R;338 d = PI * WGS84.a; 339 339 } 340 340 return d; -
trunk/src/org/openstreetmap/josm/data/projection/Ellipsoid.java
r10001 r10033 101 101 */ 102 102 public static final Ellipsoid WGS84 = Ellipsoid.create_a_rf(6378137.0, 298.257223563); 103 104 103 105 104 /** -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
r9239 r10033 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 3 4 import static org.openstreetmap.josm.data.projection.Ellipsoid.WGS84; 3 5 4 6 import java.util.Collection; … … 637 639 } 638 640 639 private static final double R = 6378135;640 641 641 public static double level2scale(int lvl) { 642 642 if (lvl < 0) … … 644 644 // preliminary formula - map such that mapnik imagery tiles of the same 645 645 // or similar level are displayed at the given scale 646 return 2.0 * Math.PI * R/ Math.pow(2.0, lvl) / 2.56;646 return 2.0 * Math.PI * WGS84.a / Math.pow(2.0, lvl) / 2.56; 647 647 } 648 648 … … 650 650 if (scale < 0) 651 651 throw new IllegalArgumentException("scale must be >= 0 but is "+scale); 652 return (int) Math.floor(Math.log(2 * Math.PI * R/ 2.56 / scale) / Math.log(2));652 return (int) Math.floor(Math.log(2 * Math.PI * WGS84.a / 2.56 / scale) / Math.log(2)); 653 653 } 654 654
Note:
See TracChangeset
for help on using the changeset viewer.