Ignore:
Timestamp:
2018-05-12T14:18:57+02:00 (6 years ago)
Author:
wiktorn
Message:

Imagery definition refactor

Extend imagery definitions by:

  • allowing setting default layers for WMS_ENDPOINT and WMTS
  • allowing setting minimum expires time for tile for this imagery
  • allowing setting custom headers that will be sent for all requests

(get map, get capabilities) for this imagery

Additional changes in code:

  • use TileJobOptions to pass miscellaneous options to loaders
  • refactor WMSImagery to use SAX parser

See: #15981, #7953, #16224, #15940, #16249

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoader.java

    r13112 r13733  
    22package org.openstreetmap.josm.data.imagery;
    33
    4 import java.util.Map;
    54import java.util.concurrent.ThreadPoolExecutor;
    65import java.util.concurrent.TimeUnit;
     
    2726
    2827    protected final ICacheAccess<String, BufferedImageCacheEntry> cache;
    29     protected final int connectTimeout;
    30     protected final int readTimeout;
    31     protected final Map<String, String> headers;
    3228    protected final TileLoaderListener listener;
    3329
     
    5046
    5147    private ThreadPoolExecutor downloadExecutor = DEFAULT_DOWNLOAD_JOB_DISPATCHER;
     48    protected final TileJobOptions options;
    5249
    5350    /**
    5451     * Constructor
    5552     * @param listener          called when tile loading has finished
    56      * @param cache              of the cache
    57      * @param connectTimeout    to remote resource
    58      * @param readTimeout       to remote resource
    59      * @param headers           HTTP headers to be sent along with request
     53     * @param cache             of the cache
     54     * @param options           tile job options
    6055     */
    6156    public TMSCachedTileLoader(TileLoaderListener listener, ICacheAccess<String, BufferedImageCacheEntry> cache,
    62             int connectTimeout, int readTimeout, Map<String, String> headers) {
     57           TileJobOptions options) {
    6358        CheckParameterUtil.ensureParameterNotNull(cache, "cache");
    6459        this.cache = cache;
    65         this.connectTimeout = connectTimeout;
    66         this.readTimeout = readTimeout;
    67         this.headers = headers;
     60        this.options = options;
    6861        this.listener = listener;
    6962    }
     
    9891    @Override
    9992    public TileJob createTileLoaderJob(Tile tile) {
    100         return new TMSCachedTileLoaderJob(listener, tile, cache,
    101                 connectTimeout, readTimeout, headers, getDownloadExecutor());
     93        return new TMSCachedTileLoaderJob(
     94                listener,
     95                tile,
     96                cache,
     97                options,
     98                getDownloadExecutor());
    10299    }
    103100
Note: See TracChangeset for help on using the changeset viewer.