Changeset 26975 in osm for applications/viewer


Ignore:
Timestamp:
2011-10-28T07:55:25+02:00 (13 years ago)
Author:
stoecker
Message:

fix Yahoo and add new negative y style pattern

File:
1 edited

Legend:

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

    r26973 r26975  
    88
    99public class TemplatedTMSTileSource extends TMSTileSource {
    10    
     10
    1111    private Random rand = null;
    1212    private String[] randomParts = null;
    1313    private Map<String, String> headers = new HashMap<String, String>();
    14    
     14
    1515    public static final String PATTERN_ZOOM    = "\\{(?:(\\d+)-)?zoom([+-]\\d+)?\\}";
    1616    public static final String PATTERN_X       = "\\{x\\}";
    1717    public static final String PATTERN_Y       = "\\{y\\}";
    1818    public static final String PATTERN_Y_YAHOO = "\\{!y\\}";
     19    public static final String PATTERN_NEG_Y   = "\\{-y\\}";
    1920    public static final String PATTERN_SWITCH  = "\\{switch:([^}]+)\\}";
    2021    public static final String PATTERN_HEADER  = "\\{header\\(([^,]+),([^}]+)\\)\\}";
    21    
     22
    2223    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
    2426    };
    25    
     27
    2628    public TemplatedTMSTileSource(String name, String url, int maxZoom) {
    2729        super(name, url, maxZoom);
     
    7577            .replaceAll(PATTERN_X, Integer.toString(tilex))
    7678            .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));
    7881        if (rand != null) {
    7982            r = r.replaceAll(PATTERN_SWITCH, randomParts[rand.nextInt(randomParts.length)]);
Note: See TracChangeset for help on using the changeset viewer.