Package com.massifmaps.datasources
Class CacheTileDataSource
java.lang.Object
com.massifmaps.datasources.TileDataSource
com.massifmaps.datasources.CacheTileDataSource
- Direct Known Subclasses:
MemoryCacheTileDataSource,PersistentCacheTileDataSource
A tile data source that loads tiles from another tile data source and caches them.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear the cache.longReturns the tile cache capacity.Reads one entry of the source's own metadata, when it has any - the MBTiles or PMTiles
metadata table, for instance.Returns the extent of the tiles in this data source.
The bounds are in coordinate system of the projection of the data source.Returns the original data source that the cache uses.intReturns the maximum zoom level supported by this data source.intReturns the minimum zoom level supported by this data source.voidnotifyTilesChanged(boolean removeTiles) Notifies listeners that the tiles have changed.voidsetCapacity(long capacityInBytes) Sets the cache capacity.Methods inherited from class com.massifmaps.datasources.TileDataSource
buildTagValues, containsMetaDataKey, getMaxOverzoomLevel, getMaxZoomWithOverzoom, getMetaData, getMetaDataElement, getProjection, isMaxOverzoomLevelSet, loadTile, setMaxOverzoomLevel, setMetaData, setMetaDataElement
-
Constructor Details
-
CacheTileDataSource
-
-
Method Details
-
getMinZoom
public int getMinZoom()Description copied from class:TileDataSourceReturns the minimum zoom level supported by this data source.- Overrides:
getMinZoomin classTileDataSource- Returns:
- The minimum zoom level supported (inclusive).
-
getMaxZoom
public int getMaxZoom()Description copied from class:TileDataSourceReturns the maximum zoom level supported by this data source.- Overrides:
getMaxZoomin classTileDataSource- Returns:
- The maximum zoom level supported (exclusive).
-
getDataExtent
Description copied from class:TileDataSourceReturns the extent of the tiles in this data source.
The bounds are in coordinate system of the projection of the data source.- Overrides:
getDataExtentin classTileDataSource- Returns:
- The extent of the data source.
-
getContainerMetaData
Description copied from class:TileDataSourceReads one entry of the source's own metadata, when it has any - the MBTiles or PMTiles
metadata table, for instance. Sources that carry none return an empty string, as do keys
they do not define. Unlike the meta data map above this is read-only and is NOT attached
to the loaded tiles: a container's metadata can be tens of kilobytes.- Overrides:
getContainerMetaDatain classTileDataSource- Parameters:
key- The metadata key, as named by the container's specification.- Returns:
- The value, or empty string if the source does not provide it.
-
notifyTilesChanged
public void notifyTilesChanged(boolean removeTiles) Description copied from class:TileDataSourceNotifies listeners that the tiles have changed. Action taken depends on the implementation of the
listeners, but generally all cached tiles will be reloaded. If the removeTiles flag is set all caches will be cleared
prior to reloading, if it's not set then the reloaded tiles will replace the old tiles in caches as they finish loading.- Overrides:
notifyTilesChangedin classTileDataSource- Parameters:
removeTiles- The remove tiles flag.
-
getDataSource
Returns the original data source that the cache uses.- Returns:
- The original data source.
-
clear
public void clear()Clear the cache. -
getCapacity
public long getCapacity()Returns the tile cache capacity.- Returns:
- The tile cache capacity in bytes.
-
setCapacity
public void setCapacity(long capacityInBytes) Sets the cache capacity.- Parameters:
capacityInBytes- The new tile cache capacity in bytes.
-