org.openstreetmap.gui.jmapviewer
Class JTileDownloaderTileLoader

java.lang.Object
  extended by org.openstreetmap.gui.jmapviewer.OsmTileLoader
      extended by org.openstreetmap.gui.jmapviewer.JTileDownloaderTileLoader
All Implemented Interfaces:
TileLoader

public class JTileDownloaderTileLoader
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

Nested Class Summary
protected  class JTileDownloaderTileLoader.FileLoadJob
           
 
Field Summary
protected  java.lang.String cacheDirBase
           
private static java.util.logging.Logger log
           
protected  boolean noDownload
           
protected  boolean saveTiles
           
 
Fields inherited from class org.openstreetmap.gui.jmapviewer.OsmTileLoader
ACCEPT, listener, USER_AGENT
 
Constructor Summary
JTileDownloaderTileLoader(TileLoaderListener map, java.lang.String cacheDirBase)
           
 
Method Summary
 java.lang.Runnable createTileLoaderJob(TileSource source, int tilex, int tiley, int zoom)
          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.
 java.lang.String getCacheDirBase()
           
 void setNoDownload(boolean noDownload)
           
 void setSaveTiles(boolean saveTiles)
          Setter for saveTiles
 void setTileCacheDir(java.lang.String tileCacheDir)
           
 
Methods inherited from class org.openstreetmap.gui.jmapviewer.OsmTileLoader
loadTileFromOsm, prepareHttpUrlConnection, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private static final java.util.logging.Logger log

cacheDirBase

protected java.lang.String cacheDirBase

noDownload

protected boolean noDownload

saveTiles

protected boolean saveTiles
Constructor Detail

JTileDownloaderTileLoader

public JTileDownloaderTileLoader(TileLoaderListener map,
                                 java.lang.String cacheDirBase)
Method Detail

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.

getCacheDirBase

public java.lang.String getCacheDirBase()

setTileCacheDir

public void setTileCacheDir(java.lang.String tileCacheDir)

setNoDownload

public void setNoDownload(boolean noDownload)
Parameters:
noDownload -

setSaveTiles

public void setSaveTiles(boolean saveTiles)
Setter for saveTiles

Parameters:
saveTiles - the saveTiles to set