Changeset 33320 in osm for applications/viewer/jmapviewer


Ignore:
Timestamp:
2017-05-17T10:57:09+02:00 (8 years ago)
Author:
bastik
Message:

see #14796 - make API key an abstract getter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/OsmTileSource.java

    r33314 r33320  
    7272     *
    7373     * Template for thunderforest.com.
    74      * Requires registration of an API key (see {@link #API_KEY}).
    7574     */
    76     public static class TransportMap extends AbstractOsmTileSource {
    77 
    78         private static final String API_KEY = "API_KEY_HERE";
     75    public abstract static class TransportMap extends AbstractOsmTileSource {
    7976
    8077        private static final String PATTERN = "https://%s.tile.thunderforest.com/transport";
     
    9087            super("OSM Transport Map", PATTERN, "osmtransportmap");
    9188        }
     89
     90        /**
     91         * Get the thunderforest API key.
     92         *
     93         * Needs to be registered at their web site.
     94         * @return the API key
     95         */
     96        protected abstract String getApiKey();
    9297
    9398        @Override
     
    105110        @Override
    106111        public String getTileUrl(int zoom, int tilex, int tiley) throws IOException {
    107             return this.getBaseUrl() + getTilePath(zoom, tilex, tiley) + "?apikey=" + API_KEY;
     112            return this.getBaseUrl() + getTilePath(zoom, tilex, tiley) + "?apikey=" + getApiKey();
    108113        }
    109114
Note: See TracChangeset for help on using the changeset viewer.