Package com.massifmaps.datasources
Class MemoryCacheTileDataSource
java.lang.Object
com.massifmaps.datasources.TileDataSource
com.massifmaps.datasources.CacheTileDataSource
com.massifmaps.datasources.MemoryCacheTileDataSource
A tile data source that loads tiles from another tile data source
and caches them in memory. This cache is not persistent, tiles
will be cleared once the application closes. Default cache capacity is 6MB.
and caches them in memory. This cache is not persistent, tiles
will be cleared once the application closes. Default cache capacity is 6MB.
-
Constructor Summary
ConstructorsConstructorDescriptionMemoryCacheTileDataSource(TileDataSource dataSource) Constructs a MemoryCacheTileDataSource object from tile data source. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear the cache.longReturns the tile cache capacity.Loads the specified tile.
Note: the tile coordinate system used here is vertically flipped relative to layer tile coordinate system.voidsetCapacity(long capacityInBytes) Sets the cache capacity.Methods inherited from class com.massifmaps.datasources.CacheTileDataSource
getContainerMetaData, getDataExtent, getDataSource, getMaxZoom, getMinZoom, notifyTilesChangedMethods inherited from class com.massifmaps.datasources.TileDataSource
buildTagValues, containsMetaDataKey, getMaxOverzoomLevel, getMaxZoomWithOverzoom, getMetaData, getMetaDataElement, getProjection, isMaxOverzoomLevelSet, setMaxOverzoomLevel, setMetaData, setMetaDataElement
-
Constructor Details
-
MemoryCacheTileDataSource
Constructs a MemoryCacheTileDataSource object from tile data source.- Parameters:
dataSource- The datasource to be cached.
-
-
Method Details
-
loadTile
Description copied from class:TileDataSourceLoads the specified tile.
Note: the tile coordinate system used here is vertically flipped relative to layer tile coordinate system.- Overrides:
loadTilein classTileDataSource- Parameters:
mapTile- The tile to load.- Returns:
- The tile data. If the tile is not available, null may be returned.
-
clear
public void clear()Description copied from class:CacheTileDataSourceClear the cache.- Overrides:
clearin classCacheTileDataSource
-
getCapacity
public long getCapacity()Description copied from class:CacheTileDataSourceReturns the tile cache capacity.- Overrides:
getCapacityin classCacheTileDataSource- Returns:
- The tile cache capacity in bytes.
-
setCapacity
public void setCapacity(long capacityInBytes) Description copied from class:CacheTileDataSourceSets the cache capacity.- Overrides:
setCapacityin classCacheTileDataSource- Parameters:
capacityInBytes- The new tile cache capacity in bytes.
-