Changeset 3878 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2011-02-09T13:01:08+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
r3835 r3878 33 33 if (info.isBlacklisted()) { 34 34 setEnabled(false); 35 } else if (info.getImageryType() == ImageryType.TMS || info.getImageryType() == ImageryType.BING ) {35 } else if (info.getImageryType() == ImageryType.TMS || info.getImageryType() == ImageryType.BING || info.getImageryType() == ImageryType.SCANEX) { 36 36 setEnabled(true); 37 37 } else if (Main.map != null && Main.map.mapView != null && !Main.map.mapView.getAllLayers().isEmpty()) { -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r3826 r3878 16 16 TMS("tms"), 17 17 HTML("html"), 18 BING("bing"); 18 BING("bing"), 19 SCANEX("scanex"); 19 20 20 21 private String urlString; -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r3826 r3878 80 80 81 81 @Override public String getTermsOfUseURL() { return source.getTermsOfUseURL(); } 82 83 @Override public double latToTileY(double lat, int zoom) { return source.latToTileY(lat,zoom); } 84 85 @Override public double lonToTileX(double lon, int zoom) { return source.lonToTileX(lon,zoom); } 86 87 @Override public double tileYToLat(int y, int zoom) { return tileYToLat(y, zoom); } 88 89 @Override public double tileXToLon(int x, int zoom) { return tileXToLon(x, zoom); } 82 90 } 83 91 -
trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
r3852 r3878 131 131 if (info.getImageryType() == ImageryType.WMS || info.getImageryType() == ImageryType.HTML) 132 132 return new WMSLayer(info); 133 else if (info.getImageryType() == ImageryType.TMS || info.getImageryType() == ImageryType.BING )133 else if (info.getImageryType() == ImageryType.TMS || info.getImageryType() == ImageryType.BING || info.getImageryType() == ImageryType.SCANEX) 134 134 return new TMSLayer(info); 135 135 else throw new AssertionError(); -
trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
r3826 r3878 43 43 import org.openstreetmap.gui.jmapviewer.OsmFileCacheTileLoader; 44 44 import org.openstreetmap.gui.jmapviewer.OsmTileLoader; 45 import org.openstreetmap.gui.jmapviewer.ScanexIRSTileSource; 45 46 import org.openstreetmap.gui.jmapviewer.TMSTileSource; 46 47 import org.openstreetmap.gui.jmapviewer.TemplatedTMSTileSource; … … 238 239 } else if (info.getImageryType() == ImageryType.BING) 239 240 return new BingAerialTileSource(); 241 else if (info.getImageryType() == ImageryType.SCANEX) 242 return new ScanexIRSTileSource(); 240 243 return null; 241 244 } … … 286 289 LatLon topLeft = mv.getLatLon(0, 0); 287 290 LatLon botRight = mv.getLatLon(mv.getWidth(), mv.getHeight()); 288 double x1 = lonToTileX(topLeft.lon(), zoom);289 double y1 = latToTileY(topLeft.lat(), zoom);290 double x2 = lonToTileX(botRight.lon(), zoom);291 double y2 = latToTileY(botRight.lat(), zoom);291 double x1 = tileSource.lonToTileX(topLeft.lon(), zoom); 292 double y1 = tileSource.latToTileY(topLeft.lat(), zoom); 293 double x2 = tileSource.lonToTileX(botRight.lon(), zoom); 294 double y2 = tileSource.latToTileY(botRight.lat(), zoom); 292 295 293 296 int screenPixels = mv.getWidth()*mv.getHeight(); … … 677 680 { 678 681 int zoom = t.getZoom(); 679 return new LatLon(tile YToLat(t.getYtile(), zoom),680 tile XToLon(t.getXtile(), zoom));682 return new LatLon(tileSource.tileYToLat(t.getYtile(), zoom), 683 tileSource.tileXToLon(t.getXtile(), zoom)); 681 684 } 682 685 … … 866 869 } 867 870 private Point pixelPos(Tile t) { 868 double lon = tile XToLon(t.getXtile(), t.getZoom());869 LatLon tmpLL = new LatLon(tile YToLat(t.getYtile(), t.getZoom()), lon);871 double lon = tileSource.tileXToLon(t.getXtile(), t.getZoom()); 872 LatLon tmpLL = new LatLon(tileSource.tileYToLat(t.getYtile(), t.getZoom()), lon); 870 873 return pixelPos(tmpLL); 871 874 } … … 898 901 return; 899 902 900 x0 = (int) lonToTileX(topLeft.lon(), zoom);901 y0 = (int) latToTileY(topLeft.lat(), zoom);902 x1 = (int) lonToTileX(botRight.lon(), zoom);903 y1 = (int) latToTileY(botRight.lat(), zoom);903 x0 = (int)tileSource.lonToTileX(topLeft.lon(), zoom); 904 y0 = (int)tileSource.latToTileY(topLeft.lat(), zoom); 905 x1 = (int)tileSource.lonToTileX(botRight.lon(), zoom); 906 y1 = (int)tileSource.latToTileY(botRight.lat(), zoom); 904 907 if (x0 > x1) { 905 908 int tmp = x0; … … 1303 1306 return needRedraw; 1304 1307 } 1305 1306 private static double latToTileY(double lat, int zoom) {1307 double l = lat / 180 * Math.PI;1308 double pf = Math.log(Math.tan(l) + (1 / Math.cos(l)));1309 return Math.pow(2.0, zoom - 1) * (Math.PI - pf) / Math.PI;1310 }1311 1312 private static double lonToTileX(double lon, int zoom) {1313 return Math.pow(2.0, zoom - 3) * (lon + 180.0) / 45.0;1314 }1315 1316 private static double tileYToLat(int y, int zoom) {1317 return Math.atan(Math.sinh(Math.PI1318 - (Math.PI * y / Math.pow(2.0, zoom - 1))))1319 * 180 / Math.PI;1320 }1321 1322 private static double tileXToLon(int x, int zoom) {1323 return x * 45.0 / Math.pow(2.0, zoom - 3) - 180.0;1324 }1325 1308 }
Note:
See TracChangeset
for help on using the changeset viewer.