Changeset 9860 in josm for trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
- Timestamp:
- 2016-02-23T20:39:21+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r9826 r9860 95 95 * @author Upliner 96 96 * @author Wiktor Niesiobędzki 97 * @param <T> Tile Source class used for this layer 97 98 * @since 3715 98 99 * @since 8526 (copied from TMSLayer) 99 100 */ 100 public abstract class AbstractTileSourceLayer extends ImageryLayer implements ImageObserver, TileLoaderListener, ZoomChangeListener {101 public abstract class AbstractTileSourceLayer<T extends AbstractTMSTileSource> extends ImageryLayer implements ImageObserver, TileLoaderListener, ZoomChangeListener { 101 102 private static final String PREFERENCE_PREFIX = "imagery.generic"; 102 103 … … 151 152 */ 152 153 protected TileCache tileCache; // initialized together with tileSource 153 protected AbstractTMSTileSourcetileSource;154 protected T tileSource; 154 155 protected TileLoader tileLoader; 155 156 … … 173 174 * @throws IllegalArgumentException when Imagery is not supported by layer 174 175 */ 175 protected abstract AbstractTMSTileSourcegetTileSource(ImageryInfo info);176 177 protected Map<String, String> getHeaders(T ileSourcetileSource) {176 protected abstract T getTileSource(ImageryInfo info); 177 178 protected Map<String, String> getHeaders(T tileSource) { 178 179 if (tileSource instanceof TemplatedTileSource) { 179 180 return ((TemplatedTileSource) tileSource).getHeaders(); … … 182 183 } 183 184 184 protected void initTileSource( AbstractTMSTileSourcetileSource) {185 protected void initTileSource(T tileSource) { 185 186 attribution.initialize(tileSource); 186 187 … … 1180 1181 1181 1182 private final TileSet nullTileSet = new TileSet((LatLon) null, (LatLon) null, 0); 1183 1182 1184 private final class TileSet { 1183 1185 int x0, x1, y0, y1; … … 1349 1351 } 1350 1352 1351 private static TileSetInfo getTileSetInfo(TileSet ts) {1353 private static <S extends AbstractTMSTileSource> TileSetInfo getTileSetInfo(AbstractTileSourceLayer<S>.TileSet ts) { 1352 1354 List<Tile> allTiles = ts.allExistingTiles(); 1353 1355 TileSetInfo result = new TileSetInfo(); … … 1374 1376 private final TileSet[] tileSets; 1375 1377 private final TileSetInfo[] tileSetInfos; 1378 1379 @SuppressWarnings("unchecked") 1376 1380 DeepTileSet(EastNorth topLeft, EastNorth botRight, int minZoom, int maxZoom) { 1377 1381 this.topLeft = topLeft; … … 1379 1383 this.minZoom = minZoom; 1380 1384 this.maxZoom = maxZoom; 1381 this.tileSets = new TileSet[maxZoom - minZoom + 1];1385 this.tileSets = new AbstractTileSourceLayer.TileSet[maxZoom - minZoom + 1]; 1382 1386 this.tileSetInfos = new TileSetInfo[maxZoom - minZoom + 1]; 1383 1387 } … … 1742 1746 * To prevent accidental clear of the queue, new download executor is created with separate queue 1743 1747 * 1744 * @param pr ecacheTaskTask responsible for precaching imagery1748 * @param progressMonitor Task responsible for precaching imagery 1745 1749 * @param points lat/lon coordinates to download 1746 1750 * @param bufferX how many units in current Coordinate Reference System to cover in X axis in both sides 1747 1751 * @param bufferY how many units in current Coordinate Reference System to cover in Y axis in both sides 1748 */ 1749 public void downloadAreaToCache(final PrecacheTask precacheTask, List<LatLon> points, double bufferX, double bufferY) { 1752 * @return 1753 */ 1754 public AbstractTileSourceLayer<T>.PrecacheTask downloadAreaToCache(final ProgressMonitor progressMonitor, List<LatLon> points, double bufferX, double bufferY) { 1755 PrecacheTask precacheTask = new PrecacheTask(progressMonitor); 1750 1756 final Set<Tile> requestedTiles = new ConcurrentSkipListSet<>(new Comparator<Tile>() { 1751 1757 @Override … … 1780 1786 loader.createTileLoaderJob(t).submit(); 1781 1787 } 1788 return precacheTask; 1782 1789 } 1783 1790
Note:
See TracChangeset
for help on using the changeset viewer.