Changeset 30249 in osm for applications/viewer/jmapviewer/src/org
- Timestamp:
- 2014-01-31T14:33:28+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/ScanexTileSource.java
r30247 r30249 5 5 6 6 import org.openstreetmap.gui.jmapviewer.OsmMercator; 7 8 /* 9 * This tilesource uses different to OsmMercator projection. 10 * 11 * Earth is assumed an ellipsoid in this projection, unlike 12 * sphere in OsmMercator, so latitude calculation differs 13 * a lot. 14 * 15 * The longitude calculation is the same as in OsmMercator, 16 * we inherit it from AbstractTMSTileSource. 17 * 18 * TODO: correct getDistance() method. 19 */ 7 20 8 21 public class ScanexTileSource extends TMSTileSource { … … 69 82 } 70 83 84 85 /* 86 * Latitude to Y and back calculations. 87 */ 71 88 private static double RADIUS_E = 6378137; /* radius of Earth at equator, m */ 72 89 private static double EQUATOR = 40075016.68557849; /* equator length, m */ 73 90 private static double E = 0.0818191908426; /* eccentricity of Earth's ellipsoid */ 91 92 @Override 93 public int LatToY(double lat, int zoom) { 94 return (int )(latToTileY(lat, zoom) * OsmMercator.TILE_SIZE); 95 } 96 97 @Override 98 public double YToLat(int y, int zoom) { 99 return tileYToLat((double )y / OsmMercator.TILE_SIZE, zoom); 100 } 74 101 75 102 @Override … … 82 109 83 110 @Override 84 public double lonToTileX(double lon, int zoom) {85 return (RADIUS_E * lon * Math.PI / (90*EQUATOR) + 1) * Math.pow(2.0, zoom - 1);111 public double tileYToLat(int y, int zoom) { 112 return tileYToLat((double )y, zoom); 86 113 } 87 114 … … 94 121 */ 95 122 private double cached_lat = 0; 96 97 @Override 98 public double tileYToLat(int y, int zoom) { 123 private double tileYToLat(double y, int zoom) { 99 124 double lat0, lat; 100 125 … … 131 156 return (f/df); 132 157 } 133 134 @Override135 public double tileXToLon(int x, int zoom) {136 return (x / Math.pow(2.0, zoom - 1) - 1) * (90*EQUATOR) / RADIUS_E / Math.PI;137 }138 158 }
Note:
See TracChangeset
for help on using the changeset viewer.