Changeset 29769 in osm for applications/editors/josm/plugins/imagerycache/src/org
- Timestamp:
- 2013-07-24T18:01:58+02:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/imagerycache/src/org/openstreetmap/josm/plugins/imagerycache
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagerycache/src/org/openstreetmap/josm/plugins/imagerycache/OsmDBTilesLoader.java
r29690 r29769 14 14 import org.openstreetmap.gui.jmapviewer.OsmTileLoader; 15 15 import org.openstreetmap.gui.jmapviewer.Tile; 16 import org.openstreetmap.gui.jmapviewer.interfaces.CachedTileLoader; 17 import org.openstreetmap.gui.jmapviewer.interfaces.TileClearController; 16 18 import org.openstreetmap.gui.jmapviewer.interfaces.TileJob; 17 19 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener; … … 24 26 * @author Alexei Kasatkin, based on OsmFileCacheTileLoader by @author Jan Peter Stotz, @author Stefan Zeller 25 27 */ 26 class OsmDBTilesLoader extends OsmTileLoader {28 class OsmDBTilesLoader extends OsmTileLoader implements CachedTileLoader { 27 29 28 30 … … 49 51 } 50 52 53 @Override 54 public void clearCache(TileSource source) { 55 clearCache(source, null); 56 } 57 58 @Override 59 public void clearCache(TileSource source, TileClearController controller) { 60 dao.cleanStorage(source.getName()); 61 } 62 51 63 protected class DatabaseLoadJob implements TileJob { 52 64 -
applications/editors/josm/plugins/imagerycache/src/org/openstreetmap/josm/plugins/imagerycache/TileDAOMapDB.java
r29690 r29769 6 6 import org.mapdb.DB; 7 7 import org.mapdb.DBMaker; 8 import org.openstreetmap.josm.Main; 8 9 import org.openstreetmap.josm.data.preferences.BooleanProperty; 9 10 … … 186 187 } 187 188 189 public void cleanStorage(String name) { 190 Main.info("Cleaning storage: {0}", name); 191 dbs.get(name).close(); 192 for (int t=0; t<20; t++) { 193 try { 194 String fname = getDBFileName(name, t); 195 File f = new File(cacheFolder, fname); 196 if (!f.exists() || !f.canWrite()) continue; 197 f.delete(); 198 } catch (Exception e) { 199 Main.warn("Can not delete file"); 200 } 201 } 202 } 188 203 }
Note:
See TracChangeset
for help on using the changeset viewer.