org.openstreetmap.gui.jmapviewer
Class OsmFileCacheTileLoader
java.lang.Object
org.openstreetmap.gui.jmapviewer.OsmTileLoader
org.openstreetmap.gui.jmapviewer.OsmFileCacheTileLoader
- All Implemented Interfaces:
- TileLoader
public class OsmFileCacheTileLoader
- extends OsmTileLoader
A TileLoader
implementation that loads tiles from OSM via HTTP and
saves all loaded files in a directory located in the the temporary directory.
If a tile is present in this file cache it will not be loaded from OSM again.
- Author:
- Jan Peter Stotz
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
log
private static final java.util.logging.Logger log
ETAG_FILE_EXT
private static final java.lang.String ETAG_FILE_EXT
- See Also:
- Constant Field Values
ETAG_CHARSET
private static final java.nio.charset.Charset ETAG_CHARSET
FILE_AGE_ONE_DAY
public static final long FILE_AGE_ONE_DAY
- See Also:
- Constant Field Values
FILE_AGE_ONE_WEEK
public static final long FILE_AGE_ONE_WEEK
- See Also:
- Constant Field Values
cacheDirBase
protected java.lang.String cacheDirBase
maxCacheFileAge
protected long maxCacheFileAge
recheckAfter
protected long recheckAfter
OsmFileCacheTileLoader
public OsmFileCacheTileLoader(TileLoaderListener map)
createTileLoaderJob
public java.lang.Runnable createTileLoaderJob(TileSource source,
int tilex,
int tiley,
int zoom)
- Description copied from interface:
TileLoader
- A typical
TileLoader.createTileLoaderJob(org.openstreetmap.gui.jmapviewer.interfaces.TileSource, int, int, int)
implementation
should create and return a new Runnable
instance that performs the
load action.
- Specified by:
createTileLoaderJob
in interface TileLoader
- Overrides:
createTileLoaderJob
in class OsmTileLoader
- Returns:
Runnable
implementation that performs the desired load
action.
getMaxFileAge
public long getMaxFileAge()
setCacheMaxFileAge
public void setCacheMaxFileAge(long maxFileAge)
- Sets the maximum age of the local cached tile in the file system. If a
local tile is older than the specified file age
OsmFileCacheTileLoader
will connect to the tile server and check
if a newer tile is available using the mechanism specified for the
selected tile source/server.
- Parameters:
maxFileAge
- maximum age in milliseconds- See Also:
FILE_AGE_ONE_DAY
,
FILE_AGE_ONE_WEEK
,
TileSource.getTileUpdate()
getCacheDirBase
public java.lang.String getCacheDirBase()
setTileCacheDir
public void setTileCacheDir(java.lang.String tileCacheDir)