- Timestamp:
- 2015-08-12T23:10:17+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java
r8624 r8659 39 39 40 40 private static volatile CompositeCacheManager cacheManager = null; 41 private static long maxObjectTTL = Long.MAX_VALUE;41 private static long maxObjectTTL = -1; 42 42 private static final String PREFERENCE_PREFIX = "jcs.cache"; 43 43 private static final AuxiliaryCacheFactory diskCacheFactory = new IndexedDiskCacheFactory(); -
trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java
r8652 r8659 43 43 private int[] tileXMax; 44 44 private int[] tileYMax; 45 private double[] degreesPerTile; 45 46 46 47 private static final Pattern PATTERN_HEADER = Pattern.compile("\\{header\\(([^,]+),([^}]+)\\)\\}"); … … 95 96 tileXMax = new int[getMaxZoom() + 1]; 96 97 tileYMax = new int[getMaxZoom() + 1]; 98 degreesPerTile = new double[getMaxZoom() +1]; 97 99 for (int zoom = getMinZoom(); zoom <= getMaxZoom(); zoom++) { 98 100 TileXY maxTileIndex = latLonToTileXY(bottomRight.toCoordinate(), zoom); 99 101 tileXMax[zoom] = maxTileIndex.getXIndex(); 100 102 tileYMax[zoom] = maxTileIndex.getYIndex(); 101 } 103 int tilesPerZoom = (int) Math.pow(2d, zoom - 1); 104 degreesPerTile[zoom] = Math.max( 105 Math.abs(max.getY() - min.getY()) / tilesPerZoom, 106 Math.abs(max.getX() - min.getX()) / tilesPerZoom 107 ); 108 109 } 110 102 111 } 103 112 … … 382 391 383 392 private double getDegreesPerTile(int zoom) { 384 Projection proj = Main.getProjection(); 385 EastNorth min = proj.latlon2eastNorth(worldBounds.getMin()); 386 EastNorth max = proj.latlon2eastNorth(worldBounds.getMax()); 387 388 int tilesPerZoom = (int) Math.pow(2d, zoom - 1); 389 return Math.max( 390 Math.abs(max.getY() - min.getY()) / tilesPerZoom, 391 Math.abs(max.getX() - min.getX()) / tilesPerZoom 392 ); 393 return degreesPerTile[zoom]; 393 394 } 394 395 -
trunk/src/org/openstreetmap/josm/gui/layer/AbstractCachedTileSourceLayer.java
r8647 r8659 36 36 */ 37 37 public static final IntegerProperty MAX_DISK_CACHE_SIZE = new IntegerProperty(PREFERENCE_PREFIX + "max_disk_size", 512); 38 39 /**40 * use fairly small memory cache, as cached objects are quite big, as they contain BufferedImages41 */42 public static final IntegerProperty MEMORY_CACHE_SIZE = new IntegerProperty(PREFERENCE_PREFIX + "cache.max_objects_ram", 200);43 38 44 39 private ICacheAccess<String, BufferedImageCacheEntry> cache; -
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r8648 r8659 134 134 public boolean showErrors; 135 135 136 protected TileCache tileCache; 136 /** 137 * use fairly small memory cache, as cached objects are quite big, as they contain BufferedImages 138 */ 139 public static final IntegerProperty MEMORY_CACHE_SIZE = new IntegerProperty(PREFERENCE_PREFIX + "cache.max_objects_ram", 200); 140 141 /* 142 * use MemoryTileCache instead of tileLoader JCS cache, as tileLoader caches only content (byte[] of image) 143 * and MemoryTileCache caches whole Tile. This gives huge performance improvement when a lot of tiles are visible 144 * in MapView (for example - when limiting min zoom in imagery) 145 * 146 * Use static instance so memory is shared between layers to prevent out of memory exceptions, when user is working with many layers 147 */ 148 protected static TileCache tileCache = new MemoryTileCache(MEMORY_CACHE_SIZE.get()); 137 149 protected AbstractTMSTileSource tileSource; 138 150 protected TileLoader tileLoader; … … 174 186 175 187 tileLoader = getTileLoaderFactory().makeTileLoader(this, headers); 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 visible179 * in MapView (for example - when limiting min zoom in imagery)180 */181 tileCache = new MemoryTileCache(AbstractCachedTileSourceLayer.MEMORY_CACHE_SIZE.get());182 188 183 189 try {
Note:
See TracChangeset
for help on using the changeset viewer.