public class TileCacheManager
extends java.lang.Object
TileCacheManager
class provides convenient access to the
default tile cache.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_MAX_CACHE_SIZE_PROP
The default tile maximum cache size property (specified in Mb).
|
Modifier | Constructor and Description |
---|---|
protected |
TileCacheManager(TileCache cache)
Creates a new manager backed by the specified cache.
|
Modifier and Type | Method and Description |
---|---|
static TileCacheManager |
getInstance()
Gets the singleton instance of this class using the default cache tile
class.
|
TilingScheme.Tile |
getTile(TileSource source,
TilingScheme.TilePosition pos)
Gets a tile from the cache for the specified source and position.
|
static void |
main(java.lang.String[] argv)
Tests this class.
|
void |
removeTilesForSource(TileSource source)
Removes all the tiles in the cache from the specified source.
|
void |
requestTiles(TileSource source,
int[] start,
int[] length,
java.util.Observer observer)
Starts a delivery operation for the specified tiles.
|
public static final java.lang.String DEFAULT_MAX_CACHE_SIZE_PROP
protected TileCacheManager(TileCache cache)
cache
- the cache to use for this manager.public static TileCacheManager getInstance()
public TilingScheme.Tile getTile(TileSource source, TilingScheme.TilePosition pos) throws java.io.IOException
source
- the source for the tile data.pos
- the position of the tile in the scheme.java.io.IOException
- if there was an error reading the tile from the
source.public void requestTiles(TileSource source, int[] start, int[] length, java.util.Observer observer)
source
- the tile source.start
- the starting data coordinates as [row, column].length
- the size of the data rectangle as [rows, columns].observer
- the tile delivery observer to notify of tiles
becoming available. If some tiles are available immediately with no
delay, Observer.update (Observable, Object)
is called with
a null value for the Observable
, and the tile for the
Object
for each tile (synchronously, before this method
exits). For the remaining tiles that are only available
after a delay, Observer.update (Observable, Object)
is called
with the TileDeliveryOperation
as the Observable and the tile
for the Object
.public void removeTilesForSource(TileSource source)
source
- the tile source to remove all tiles.public static void main(java.lang.String[] argv) throws java.lang.Exception
argv
- the array of command line parameters.java.lang.Exception