Changeset 8647 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2015-08-08T12:32:18+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/layer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/AbstractCachedTileSourceLayer.java
r8628 r8647 89 89 try { 90 90 cache = JCSCacheManager.getCache(getCacheName(), 91 getMemoryCacheSize(),91 0, 92 92 getDiskCacheSize(), 93 93 CachedTileLoaderFactory.PROP_TILECACHE_DIR.get()); … … 126 126 try { 127 127 return JCSCacheManager.getCache(name, 128 MEMORY_CACHE_SIZE.get(),129 MAX_DISK_CACHE_SIZE.get() * 1024, // MAX_DISK_CACHE_SIZE is in MB 128 0, 129 MAX_DISK_CACHE_SIZE.get() * 1024, // MAX_DISK_CACHE_SIZE is in MB, needs to by in sync with getDiskCacheSize 130 130 CachedTileLoaderFactory.PROP_TILECACHE_DIR.get()); 131 131 } catch (IOException e) { … … 137 137 protected abstract Class<? extends TileLoader> getTileLoaderClass(); 138 138 139 protected int getMemoryCacheSize() {140 return MEMORY_CACHE_SIZE.get();141 }142 143 139 protected int getDiskCacheSize() { 144 140 return MAX_DISK_CACHE_SIZE.get() * 1024; -
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r8644 r8647 174 174 175 175 tileLoader = getTileLoaderFactory().makeTileLoader(this, headers); 176 if (tileLoader instanceof TMSCachedTileLoader) { 177 tileCache = (TileCache) tileLoader; 178 } else { 179 tileCache = new MemoryTileCache(); 180 } 176 /* 177 * use MemoryTileCache instead of tileLoader JCS cache, as tileLoader caches only content (byte[] of image) 178 * and MemoryTileCache caches whole Tile. This gives huge performance improvement when a lot of tiles are visible 179 * in MapView (for example - when limiting min zoom in imagery) 180 */ 181 tileCache = new MemoryTileCache(AbstractCachedTileSourceLayer.MEMORY_CACHE_SIZE.get()); 181 182 182 183 try { 183 184 if ("file".equalsIgnoreCase(new URL(tileSource.getBaseUrl()).getProtocol())) { 184 185 tileLoader = new OsmTileLoader(this); 185 tileCache = new MemoryTileCache();186 186 } 187 187 } catch (MalformedURLException e) { … … 1484 1484 //g.drawString("currentZoomLevel=" + currentZoomLevel, 120, 120); 1485 1485 g.setColor(Color.lightGray); 1486 if (!autoZoom) { 1487 if (ts.insane()) { 1488 myDrawString(g, tr("zoom in to load any tiles"), 120, 120); 1489 } else if (ts.tooLarge()) { 1490 myDrawString(g, tr("zoom in to load more tiles"), 120, 120); 1491 } else if (ts.tooSmall()) { 1492 myDrawString(g, tr("increase zoom level to see more detail"), 120, 120); 1493 } 1494 } 1495 1496 if (zoom < getMinZoomLvl() && (ts.insane() || ts.tooLarge())) { 1486 1487 if (ts.insane()) { 1497 1488 myDrawString(g, tr("zoom in to load any tiles"), 120, 120); 1489 } else if (ts.tooLarge()) { 1490 myDrawString(g, tr("zoom in to load more tiles"), 120, 120); 1491 } else if (!autoZoom && ts.tooSmall()) { 1492 myDrawString(g, tr("increase zoom level to see more detail"), 120, 120); 1498 1493 } 1499 1494
Note:
See TracChangeset
for help on using the changeset viewer.