Ignore:
Timestamp:
2013-07-24T18:01:58+02:00 (11 years ago)
Author:
akks
Message:

[josm_utilsplugin2. josm_commandline, josm_livegps, josm_reverter, josm_opendata, josm_videomapping]:
rearrange menu items and change menu accelerators, add Netbeans projects, fix some syntax warnings

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  
    1414import org.openstreetmap.gui.jmapviewer.OsmTileLoader;
    1515import org.openstreetmap.gui.jmapviewer.Tile;
     16import org.openstreetmap.gui.jmapviewer.interfaces.CachedTileLoader;
     17import org.openstreetmap.gui.jmapviewer.interfaces.TileClearController;
    1618import org.openstreetmap.gui.jmapviewer.interfaces.TileJob;
    1719import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener;
     
    2426 * @author Alexei Kasatkin, based on OsmFileCacheTileLoader by @author Jan Peter Stotz, @author Stefan Zeller
    2527 */
    26 class OsmDBTilesLoader extends OsmTileLoader {
     28class OsmDBTilesLoader extends OsmTileLoader implements CachedTileLoader {
    2729   
    2830   
     
    4951    }
    5052
     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   
    5163    protected class DatabaseLoadJob implements TileJob {
    5264
  • applications/editors/josm/plugins/imagerycache/src/org/openstreetmap/josm/plugins/imagerycache/TileDAOMapDB.java

    r29690 r29769  
    66import org.mapdb.DB;
    77import org.mapdb.DBMaker;
     8import org.openstreetmap.josm.Main;
    89import org.openstreetmap.josm.data.preferences.BooleanProperty;
    910
     
    186187    }
    187188
     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    }
    188203}
Note: See TracChangeset for help on using the changeset viewer.