- Timestamp:
- 2014-12-18T23:00:19+01:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
r7329 r7823 46 46 import org.openstreetmap.gui.jmapviewer.OsmFileCacheTileLoader; 47 47 import org.openstreetmap.gui.jmapviewer.OsmTileLoader; 48 import org.openstreetmap.gui.jmapviewer.TMSFileCacheTileLoader; 48 49 import org.openstreetmap.gui.jmapviewer.Tile; 49 50 import org.openstreetmap.gui.jmapviewer.interfaces.CachedTileLoader; … … 110 111 public static final IntegerProperty PROP_TMS_JOBS = new IntegerProperty("tmsloader.maxjobs", 25); 111 112 public static final StringProperty PROP_TILECACHE_DIR; 113 114 private static final boolean newcache = Main.pref.getBoolean("tms.newcache"); 112 115 113 116 static { 114 117 String defPath = null; 115 118 try { 116 defPath = OsmFileCacheTileLoader.getDefaultCacheDir().getAbsolutePath(); 119 if (newcache) { 120 defPath = new File(Main.pref.getCacheDirectory(), "tms").getAbsolutePath(); 121 } else { 122 defPath = OsmFileCacheTileLoader.getDefaultCacheDir().getAbsolutePath(); 123 } 117 124 } catch (SecurityException e) { 118 125 Main.warn(e); 119 126 } 120 PROP_TILECACHE_DIR = new StringProperty(PREFERENCE_PREFIX + ".tilecache_path", defPath);127 PROP_TILECACHE_DIR = new StringProperty(PREFERENCE_PREFIX + (newcache ? ".tilecache" : ".tilecache_path"), defPath); 121 128 } 122 129 … … 135 142 if (cachePath != null && !cachePath.isEmpty()) { 136 143 try { 137 OsmFileCacheTileLoader loader = new OsmFileCacheTileLoader(listener, new File(cachePath)); 144 OsmFileCacheTileLoader loader; 145 if (newcache) { 146 loader = new TMSFileCacheTileLoader(listener, new File(cachePath)); 147 } else { 148 loader = new OsmFileCacheTileLoader(listener, new File(cachePath)); 149 } 138 150 loader.headers.put("User-Agent", Version.getInstance().getFullAgentString()); 139 151 return loader; … … 319 331 private static class CachedAttributionBingAerialTileSource extends BingAerialTileSource { 320 332 333 public CachedAttributionBingAerialTileSource(String id) { 334 super(id); 335 } 336 321 337 class BingAttributionData extends CacheCustomContent<IOException> { 322 338 … … 374 390 if (info.getImageryType() == ImageryType.TMS) { 375 391 checkUrl(info.getUrl()); 376 TMSTileSource t = new TemplatedTMSTileSource(info.getName(), info.getUrl(), info.get MinZoom(), info.getMaxZoom());392 TMSTileSource t = new TemplatedTMSTileSource(info.getName(), info.getUrl(), info.getId(), info.getMinZoom(), info.getMaxZoom()); 377 393 info.setAttribution(t); 378 394 return t; 379 395 } else if (info.getImageryType() == ImageryType.BING) 380 return new CachedAttributionBingAerialTileSource( );396 return new CachedAttributionBingAerialTileSource(info.getId()); 381 397 else if (info.getImageryType() == ImageryType.SCANEX) { 382 return new ScanexTileSource(info.getName(), info.getUrl(), info.get MaxZoom());398 return new ScanexTileSource(info.getName(), info.getUrl(), info.getId(), info.getMaxZoom()); 383 399 } 384 400 return null;
Note:
See TracChangeset
for help on using the changeset viewer.