Changeset 26975 in osm for applications
- Timestamp:
- 2011-10-28T07:55:25+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSource.java
r26973 r26975 8 8 9 9 public class TemplatedTMSTileSource extends TMSTileSource { 10 10 11 11 private Random rand = null; 12 12 private String[] randomParts = null; 13 13 private Map<String, String> headers = new HashMap<String, String>(); 14 14 15 15 public static final String PATTERN_ZOOM = "\\{(?:(\\d+)-)?zoom([+-]\\d+)?\\}"; 16 16 public static final String PATTERN_X = "\\{x\\}"; 17 17 public static final String PATTERN_Y = "\\{y\\}"; 18 18 public static final String PATTERN_Y_YAHOO = "\\{!y\\}"; 19 public static final String PATTERN_NEG_Y = "\\{-y\\}"; 19 20 public static final String PATTERN_SWITCH = "\\{switch:([^}]+)\\}"; 20 21 public static final String PATTERN_HEADER = "\\{header\\(([^,]+),([^}]+)\\)\\}"; 21 22 22 23 public static final String[] ALL_PATTERNS = { 23 PATTERN_HEADER, PATTERN_ZOOM, PATTERN_X, PATTERN_Y, PATTERN_Y_YAHOO, PATTERN_SWITCH 24 PATTERN_HEADER, PATTERN_ZOOM, PATTERN_X, PATTERN_Y, PATTERN_Y_YAHOO, PATTERN_NEG_Y, 25 PATTERN_SWITCH 24 26 }; 25 27 26 28 public TemplatedTMSTileSource(String name, String url, int maxZoom) { 27 29 super(name, url, maxZoom); … … 75 77 .replaceAll(PATTERN_X, Integer.toString(tilex)) 76 78 .replaceAll(PATTERN_Y, Integer.toString(tiley)) 77 .replaceAll(PATTERN_Y_YAHOO, Integer.toString((int)Math.pow(2, zoom)-1-tiley)); 79 .replaceAll(PATTERN_Y_YAHOO, Integer.toString((int)Math.pow(2, zoom-1)-1-tiley)) 80 .replaceAll(PATTERN_NEG_Y, Integer.toString((int)Math.pow(2, zoom)-1-tiley)); 78 81 if (rand != null) { 79 82 r = r.replaceAll(PATTERN_SWITCH, randomParts[rand.nextInt(randomParts.length)]);
Note:
See TracChangeset
for help on using the changeset viewer.