Changeset 33313 in osm for applications/viewer
- Timestamp:
- 2017-05-16T19:00:23+02:00 (8 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
r32723 r33313 44 44 */ 45 45 public class JMapViewer extends JPanel implements TileLoaderListener { 46 47 private static final long serialVersionUID = 1L; 46 48 47 49 /** whether debug mode is enabled or not */ … … 503 505 else if (p != null) { 504 506 Integer radius = getLatOffset(marker.getLat(), marker.getLon(), marker.getRadius(), false); 505 radius = radius == null ? null : p.y - radius .intValue();507 radius = radius == null ? null : p.y - radius; 506 508 return radius; 507 509 } else -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/OsmTileSource.java
r31790 r33313 1 1 // License: GPL. For details, see Readme.txt file. 2 2 package org.openstreetmap.gui.jmapviewer.tilesources; 3 4 import java.io.IOException; 5 6 import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate; 3 7 4 8 /** … … 63 67 } 64 68 } 69 70 /** 71 * The "Transport Map" OSM tile source. 72 * 73 * Template for thunderforest.com 74 */ 75 public static class TransportMap extends AbstractOsmTileSource { 76 77 private static final String API_KEY = "API_KEY_HERE"; 78 79 private static final String PATTERN = "https://%s.tile.thunderforest.com/transport"; 80 81 private static final String[] SERVER = { "a", "b", "c" }; 82 83 private int serverNum; 84 85 /** 86 * Constructs a new {@code TransportMap} tile source. 87 */ 88 public TransportMap() { 89 super("OSM Transport Map", PATTERN, "osmtransportmap"); 90 } 91 92 @Override 93 public String getBaseUrl() { 94 String url = String.format(this.baseUrl, new Object[] {SERVER[serverNum]}); 95 serverNum = (serverNum + 1) % SERVER.length; 96 return url; 97 } 98 99 @Override 100 public int getMaxZoom() { 101 return 18; 102 } 103 104 @Override 105 public String getTileUrl(int zoom, int tilex, int tiley) throws IOException { 106 return this.getBaseUrl() + getTilePath(zoom, tilex, tiley); // + "?apikey=" + API_KEY; 107 } 108 109 @Override 110 public String getAttributionText(int zoom, ICoordinate topLeft, ICoordinate botRight) { 111 return "Maps © Thunderforest, Data © OpenStreetMap contributors"; 112 } 113 114 @Override 115 public String getAttributionLinkURL() { 116 return "http://www.thunderforest.com/"; 117 } 118 } 119 65 120 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/ScanexTileSource.java
r33128 r33313 110 110 111 111 // Latitude to Y and back calculations. 112 private static double RADIUS_E = 6378137; /* radius of Earth at equator, m */113 private static double EQUATOR = 40075016.68557849; /* equator length, m */114 private static double E = 0.0818191908426; /* eccentricity of Earth's ellipsoid */112 private static final double RADIUS_E = 6378137; /* radius of Earth at equator, m */ 113 private static final double EQUATOR = 40075016.68557849; /* equator length, m */ 114 private static final double E = 0.0818191908426; /* eccentricity of Earth's ellipsoid */ 115 115 116 116 @Override 117 117 public Point latLonToXY(double lat, double lon, int zoom) { 118 118 return new Point( 119 (int) osmMercator.lonToX(lon, zoom),120 (int) latToTileY(lat, zoom)119 (int) Math.round(osmMercator.lonToX(lon, zoom)), 120 (int) Math.round(latToTileY(lat, zoom)) 121 121 ); 122 122 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/TMSTileSource.java
r33286 r33313 51 51 public Point latLonToXY(double lat, double lon, int zoom) { 52 52 return new Point( 53 (int) osmMercator.lonToX(lon, zoom),54 (int) osmMercator.latToY(lat, zoom)53 (int) Math.round(osmMercator.lonToX(lon, zoom)), 54 (int) Math.round(osmMercator.latToY(lat, zoom)) 55 55 ); 56 56 }
Note:
See TracChangeset
for help on using the changeset viewer.