Changeset 16974 in osm for applications/viewer/jmapviewer/src/org
- Timestamp:
- 2009-08-10T14:45:01+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmMercator.java
r16959 r16974 90 90 * Transforms pixel coordinate X to longitude 91 91 * 92 * <p> 93 * Mathematical optimization<br> 94 * <code> 95 * lon = toDegree((aX - falseEasting(aZoomlevel)) / radius(aZoomlevel))<br> 96 * lon = 180 / PI * ((aX - getMaxPixels(aZoomlevel) / 2) / getMaxPixels(aZoomlevel) / (2 * PI)<br> 97 * lon = 180 * ((aX - getMaxPixels(aZoomlevel) / 2) / getMaxPixels(aZoomlevel))<br> 98 * lon = 360 / getMaxPixels(aZoomlevel) * (aX - getMaxPixels(aZoomlevel) / 2)<br> 99 * lon = 360 * aX / getMaxPixels(aZoomlevel) - 180<br> 100 * </code> 101 * </p> 92 102 * @param aX 93 103 * [0..2^Zoomlevel*TILE_WIDTH[ 94 104 * @return ]-180..180[ 105 * @author Jan Peter Stotz 95 106 */ 96 107 public static double XToLon(int aX, int aZoomlevel) { 97 aX -= falseEasting(aZoomlevel); 98 double longRadians = aX / radius(aZoomlevel); 99 double longDegrees = Math.toDegrees(longRadians); 100 return longDegrees; 108 return ((360d * aX) / getMaxPixels(aZoomlevel)) - 180.0; 101 109 } 102 110
Note:
See TracChangeset
for help on using the changeset viewer.