Ticket #11061: josm_gui.patch

File josm_gui.patch, 1.2 KB (added by p.janaszek, 9 years ago)
  • src/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSource.java

     
    1313    private String[] randomParts = null;
    1414    private Map<String, String> headers = new HashMap<>();
    1515
     16    public static final String COOKIE_HEADER   = "Cookie";
    1617    public static final String PATTERN_ZOOM    = "\\{(?:(\\d+)-)?z(?:oom)?([+-]\\d+)?\\}";
    1718    public static final String PATTERN_X       = "\\{x\\}";
    1819    public static final String PATTERN_Y       = "\\{y\\}";
     
    3637        handleTemplate();
    3738    }
    3839
     40    public TemplatedTMSTileSource(String name, String url, String id, int minZoom, int maxZoom, String cookies) {
     41        super(name, url, id, minZoom, maxZoom);
     42        if (cookies != null) {
     43            headers.put(COOKIE_HEADER, cookies);
     44        }
     45        handleTemplate();
     46    }
     47
    3948    private void handleTemplate() {
    4049        // Capturing group pattern on switch values
    4150        Matcher m = Pattern.compile(".*"+PATTERN_SWITCH+".*").matcher(baseUrl);