001 package org.openstreetmap.gui.jmapviewer.tilesources; 002 003 public class OsmTileSource { 004 005 public static final String MAP_MAPNIK = "http://tile.openstreetmap.org"; 006 007 public static class Mapnik extends AbstractOsmTileSource { 008 public Mapnik() { 009 super("Mapnik", MAP_MAPNIK); 010 } 011 012 public TileUpdate getTileUpdate() { 013 return TileUpdate.IfNoneMatch; 014 } 015 } 016 017 public static class CycleMap extends AbstractOsmTileSource { 018 019 private static final String PATTERN = "http://%s.tile.opencyclemap.org/cycle"; 020 021 private static final String[] SERVER = { "a", "b", "c" }; 022 023 private int SERVER_NUM = 0; 024 025 public CycleMap() { 026 super("OSM Cycle Map", PATTERN); 027 } 028 029 @Override 030 public String getBaseUrl() { 031 String url = String.format(this.baseUrl, new Object[] { SERVER[SERVER_NUM] }); 032 SERVER_NUM = (SERVER_NUM + 1) % SERVER.length; 033 return url; 034 } 035 036 @Override 037 public int getMaxZoom() { 038 return 17; 039 } 040 041 public TileUpdate getTileUpdate() { 042 return TileUpdate.LastModified; 043 } 044 } 045 }