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

Last change on this file since 8526 was 8526, checked in by wiktorn, 9 years ago

Introduce WMS layer based on TMS. (closes: #11255)

HEADS UP: After this patch you need to manually remove JAX-B generated file/class: org/w3/_2001/xmlschema/Adapter1.java to compile the tree again.

  • create AbstractTileSourceLayer based on TMSLayer as a base for TMS, WMS and (future) WMTS layers, (addresses #11459)
  • WMS layer now uses JCS Caching (closes: #7363)
  • introduce new conversion methods in TileSource, that convert both X and Y (lat and lon) in one call. This is necessary for other than PseudoMercator projections
    • introduce TileXY class that represents X and Y indexes of tile in tile matrix/space
    • mark old conversion methods as deprecated
    • refactor JMapViewer and JOSM to new methods
    • change use of Coordinate class to ICoordinate where appropiate
  • extract CachedAttributionBingAerialTileSource to separate file
  • create TemplatedWMSTileSource that provides the WMS Layer with square (according to current projection) tiles (closes: #11572, closes: #7682, addresses: #5454)
  • implemented precaching imagery along GPX track for AbstractTileSourceLayer, so now it work for both - WMS and TMS (closes: #9154)
  • implemented common righ-click menu on map view, as well on layer list (closes #3591)
  • create separate build commands for JMapViewer classes to easily spot, when josm classes are used within JMapViewer
  • remove unnecessary classes of previous WMS implementation - GeorefImage, wms-cache.xsd (and JAXB task from build), WMSCache, WMSRequest, WMSGrabber, HTMLGrabber, WMSException
File size: 1.7 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.imagery;
3
4import java.util.Map;
5import java.util.concurrent.ThreadPoolExecutor;
6
7import org.apache.commons.jcs.access.behavior.ICacheAccess;
8import org.openstreetmap.gui.jmapviewer.Tile;
9import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener;
10import org.openstreetmap.josm.Main;
11import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
12
13/**
14 * Separate class to handle WMS jobs, as it needs to react differently to HTTP response codes from WMS server
15 *
16 * @author Wiktor Niesiobędzki
17 * @since TODO
18 *
19 */
20public class WMSCachedTileLoaderJob extends TMSCachedTileLoaderJob {
21
22 /**
23 * Creates a job - that will download specific tile
24 * @param listener will be notified, when tile has loaded
25 * @param tile to load
26 * @param cache to use (get/put)
27 * @param connectTimeout to tile source
28 * @param readTimeout to tile source
29 * @param headers to be sent with request
30 * @param downloadExecutor that will execute the download task (if needed)
31 */
32 public WMSCachedTileLoaderJob(TileLoaderListener listener, Tile tile,
33 ICacheAccess<String, BufferedImageCacheEntry> cache, int connectTimeout, int readTimeout,
34 Map<String, String> headers, ThreadPoolExecutor downloadExecutor) {
35 super(listener, tile, cache, connectTimeout, readTimeout, headers, downloadExecutor);
36 }
37
38 @Override
39 public String getCacheKey() {
40 // include projection in cache key, as with different projections different response will be returned from server
41 String key = super.getCacheKey();
42 if (key != null) {
43 return Main.getProjection().toCode() + key;
44 }
45 return null;
46 }
47
48}
Note: See TracBrowser for help on using the repository browser.