source: josm/trunk/src/org/openstreetmap/josm/data/imagery/WMSCachedTileLoaderJob.java@ 13733

Last change on this file since 13733 was 13733, checked in by wiktorn, 6 years ago

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

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.imagery;
3
4import java.util.concurrent.ThreadPoolExecutor;
5
6import org.apache.commons.jcs.access.behavior.ICacheAccess;
7import org.openstreetmap.gui.jmapviewer.Tile;
8import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener;
9import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
10
11/**
12 * Separate class to handle WMS jobs, as it needs to react differently to HTTP response codes from WMS server
13 *
14 * @author Wiktor Niesiobędzki
15 * @since 8526
16 */
17public class WMSCachedTileLoaderJob extends TMSCachedTileLoaderJob {
18
19 /**
20 * Creates a job - that will download specific tile
21 * @param listener will be notified, when tile has loaded
22 * @param tile to load
23 * @param cache to use (get/put)
24 * @param options options for tile job
25 * @param downloadExecutor that will execute the download task (if needed)
26 */
27 public WMSCachedTileLoaderJob(TileLoaderListener listener,
28 Tile tile,
29 ICacheAccess<String, BufferedImageCacheEntry> cache,
30 TileJobOptions options,
31 ThreadPoolExecutor downloadExecutor) {
32 super(listener, tile, cache, options, downloadExecutor);
33 }
34
35 @Override
36 public String getCacheKey() {
37 // include projection in cache key, as with different projections different response will be returned from server
38 String key = super.getCacheKey();
39 if (key != null) {
40 return key + tile.getSource().getServerCRS();
41 }
42 return null;
43 }
44}
Note: See TracBrowser for help on using the repository browser.