Changeset 33313 in osm for applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/OsmTileSource.java
- Timestamp:
- 2017-05-16T19:00:23+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.