1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.imagery;
|
---|
3 |
|
---|
4 | import java.util.concurrent.ThreadPoolExecutor;
|
---|
5 |
|
---|
6 | import org.apache.commons.jcs.access.behavior.ICacheAccess;
|
---|
7 | import org.openstreetmap.gui.jmapviewer.Tile;
|
---|
8 | import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener;
|
---|
9 | import 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 | */
|
---|
17 | public 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 | }
|
---|