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