Changeset 29731 in osm for applications/viewer/jmapviewer/src
- Timestamp:
- 2013-06-29T09:32:08+02:00 (11 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/MemoryTileCache.java
r28505 r29731 37 37 } 38 38 39 @Override 39 40 public void addTile(Tile tile) { 40 41 CacheEntry entry = createCacheEntry(tile); … … 45 46 } 46 47 48 @Override 47 49 public Tile getTile(TileSource source, int x, int y, int z) { 48 50 CacheEntry entry = hashtable.get(Tile.getTileKey(source, x, y, z)); … … 90 92 } 91 93 94 @Override 92 95 public int getTileCount() { 93 96 return hashtable.size(); … … 166 169 */ 167 170 public synchronized void addFirst(CacheEntry element) { 171 if (element == null) return; 168 172 if (elementCount == 0) { 169 173 firstElement = element; … … 186 190 */ 187 191 public synchronized void removeEntry(CacheEntry element) { 192 if (element == null) return; 188 193 if (element.next != null) { 189 194 element.next.prev = element.prev; -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmFileCacheTileLoader.java
r29528 r29731 26 26 import java.util.logging.Logger; 27 27 28 import org.openstreetmap.gui.jmapviewer.interfaces.CachedTileLoader; 29 import org.openstreetmap.gui.jmapviewer.interfaces.TileClearController; 28 30 import org.openstreetmap.gui.jmapviewer.interfaces.TileJob; 29 31 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader; … … 40 42 * @author Stefan Zeller 41 43 */ 42 public class OsmFileCacheTileLoader extends OsmTileLoader {44 public class OsmFileCacheTileLoader extends OsmTileLoader implements CachedTileLoader { 43 45 44 46 private static final Logger log = Logger.getLogger(OsmFileCacheTileLoader.class.getName()); … … 140 142 } 141 143 144 @Override 142 145 public Tile getTile() { 143 146 return tile; 144 147 } 145 148 149 @Override 146 150 public void run() { 147 151 synchronized (tile) { … … 159 163 TileJob job = new TileJob() { 160 164 165 @Override 161 166 public void run() { 162 167 loadOrUpdateTile(); 163 168 } 169 @Override 164 170 public Tile getTile() { 165 171 return tile; … … 486 492 this.cacheDirBase = dir.getAbsolutePath(); 487 493 } 488 489 public static interface TileClearController { 490 491 void initClearDir(File dir); 492 493 void initClearFiles(File[] files); 494 495 boolean cancel(); 496 497 void fileDeleted(File file); 498 499 void clearFinished(); 500 } 501 494 495 @Override 502 496 public void clearCache(TileSource source) { 503 497 clearCache(source, null); 504 498 } 505 499 500 @Override 506 501 public void clearCache(TileSource source, TileClearController controller) { 507 502 File dir = getSourceCacheDir(source);
Note:
See TracChangeset
for help on using the changeset viewer.