public class TLcdEarthMemoryCachingTileSet extends ALcdEarthTileSetWrapper
Constructor and Description |
---|
TLcdEarthMemoryCachingTileSet(ILcdEarthTileSet aDelegate,
int aNumCachedTiles)
Creates a new memory caching tileset with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelTile(int aLevel,
long aTileX,
long aTileY,
ILcdEarthTileSetCoverage aCoverage,
ILcdGeoReference aGeoReference,
TLcdEarthTileFormat aFormat,
ILcdEarthTileSetCallback aCallback,
Object aContext)
This method should be overridden if the
produceTile and/or updateTile is overridden and the new implementation calls the implementation of this
class using different parameters than passed to it. |
void |
clearCache()
Clears the tile cache.
|
boolean |
containsTile(ILcdEarthTileSetCoverage aCoverage,
int aLevel,
long aX,
long aY,
Object aContext)
Returns true if the repository contains the specified tile.
|
void |
dispose()
This method releases all resources held by the
repository, such as file locks, threads or server connections.
|
int |
getCacheSize()
Returns the maximum number of the cached tiles.
|
ALcdEarthTile |
getTileFromCache(ILcdEarthTileSetCoverage aCoverage,
int aLevel,
long aTileX,
long aTileY,
ILcdGeoReference aGeoReference,
TLcdEarthTileFormat aFormat,
Object aContext)
Retrieves a tile from the cache.
|
protected boolean |
isCacheable(ALcdEarthTile aTile,
Object aContext)
Returns whether the tile should be cached or not.
|
ALcdEarthTile |
produceTile(ILcdEarthTileSetCoverage aCoverage,
int aLevel,
long aX,
long aY,
ILcdGeoReference aGeoReference,
TLcdEarthTileFormat aFormat,
Object aContext)
Gets a tile from the repository.
|
void |
produceTile(ILcdEarthTileSetCoverage aCoverage,
int aLevel,
long aTileX,
long aTileY,
ILcdGeoReference aGeoReference,
TLcdEarthTileFormat aFormat,
TLcdEarthTileOperationMode aMode,
ILcdEarthTileSetCallback aCallback,
Object aContext)
Produces the requested tile, and invoke the supplied callback when done.
|
void |
setCacheSize(int aSize)
Sets the maximum number of cached tiles.
|
ALcdEarthTile |
updateTile(ALcdEarthTile aEarthTile,
Object aContext)
Updates the tile and the version cached in memory.
|
void |
updateTile(ALcdEarthTile aTile,
TLcdEarthTileOperationMode aMode,
ILcdEarthTileSetCallback aCallback,
Object aContext)
Updates the tile and the version cached in memory.
|
containsTileSetCoverage, getBounds, getDelegateTileSet, getLevelCount, getTileColumnCount, getTileRowCount, getTileSetCoverage, getTileSetCoverage, getTileSetCoverageCount, isFormatSupported, isGeoReferenceSupported
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
public TLcdEarthMemoryCachingTileSet(ILcdEarthTileSet aDelegate, int aNumCachedTiles)
aDelegate
- the delegate that produces the tiles.aNumCachedTiles
- the maximum number of cached tiles.public void produceTile(ILcdEarthTileSetCoverage aCoverage, int aLevel, long aTileX, long aTileY, ILcdGeoReference aGeoReference, TLcdEarthTileFormat aFormat, TLcdEarthTileOperationMode aMode, ILcdEarthTileSetCallback aCallback, Object aContext)
ILcdEarthTileSet
tileAvailable()
method. If the tile cannot be produced for some reason, the method tileNotAvailable()
should be called instead.
If the tileset supports it and aMode
is TLcdEarthTileOperationMode.PREFER_ASYNCHRONOUS
,
the tile request may be executed asynchronously. However, the callback
must be invoked at some point in time, unless the
cancelTile()
method is used to cancel the tile request before it is executed. If
aMode
is TLcdEarthTileOperationMode.FORCE_SYNCHRONOUS
,
the request must be executed synchronously and the callback must be
invoked before produceTile()
returns.
Tiles may be requested in reference systems other than the native
geo reference of the underlying data, provided that the isGeoReferenceSupported()
method returns true for the requested reference. If this is not the case,
the tileset should call tileNotAvailable()
. If the tileset
calls tileAvailable()
, the geo reference of the resulting tile
must be equal to aGeoReference
, and the tile's bounds
must likewise be expressed in this reference.
Similarly, tiles may be requested in different data formats, as described
by TLcdEarthTileFormat
. The format
determines the type of the data object that will be contained in the
requested tile. To check if a format is supported, use isFormatSupported()
.
If the specified format is not supported, the tileset should call
tileNotAvailable()
.
The context parameter may be used to pass application-specific data into
the tileset. If it is not needed, its value may be null
.
produceTile
in interface ILcdEarthTileSet
produceTile
in class ALcdEarthTileSetWrapper
aCoverage
- the coverage from which the tile is requestedaLevel
- the level from which the tile is requestedaTileX
- the column index of the requested tileaTileY
- the row index of the requested tileaGeoReference
- the reference system in which the tile should be returnedaFormat
- the desired format of the tile's dataaMode
- controls the synchronous or asynchronous behaviour of the tilesetaCallback
- will be invoked when the tile is available to be usedaContext
- application-specific data to be used by the tileset, if anypublic ALcdEarthTile produceTile(ILcdEarthTileSetCoverage aCoverage, int aLevel, long aX, long aY, ILcdGeoReference aGeoReference, TLcdEarthTileFormat aFormat, Object aContext) throws IOException
ILcdEarthTileSet
produceTile
in interface ILcdEarthTileSet
produceTile
in class ALcdEarthTileSetWrapper
aCoverage
- the coverage from which to query a tileaLevel
- the detail level for which to query a tileaX
- the column index at which to query a tileaY
- the row index at which to query a tileaGeoReference
- the georeference of the requested tileaFormat
- the format of the requested tileaContext
- application-specific data to be used by the tileset, if anyIOException
- if the tile cannot be producedpublic ALcdEarthTile getTileFromCache(ILcdEarthTileSetCoverage aCoverage, int aLevel, long aTileX, long aTileY, ILcdGeoReference aGeoReference, TLcdEarthTileFormat aFormat, Object aContext)
aCoverage
- the coverageaLevel
- the tile levelaTileX
- the tile x coordinateaTileY
- the tile y coordinateaGeoReference
- the tile referenceaFormat
- the tile formataContext
- the contextpublic boolean containsTile(ILcdEarthTileSetCoverage aCoverage, int aLevel, long aX, long aY, Object aContext)
ILcdEarthTileSet
containsTile
in interface ILcdEarthTileSet
containsTile
in class ALcdEarthTileSetWrapper
aCoverage
- the coverage from which to query a tileaLevel
- the detail level for which to query a tileaX
- the column index at which to query a tileaY
- the row index at which to query a tileaContext
- application-specific data to be used by the tileset, if anypublic void updateTile(ALcdEarthTile aTile, TLcdEarthTileOperationMode aMode, ILcdEarthTileSetCallback aCallback, Object aContext)
updateTile
in interface ILcdEarthTileSet
updateTile
in class ALcdEarthTileSetWrapper
aTile
- tile to checkaMode
- controls the synchronous or asynchronous behaviour of the tilesetaCallback
- will be invoked when the tile is available to be usedaContext
- application-specific data to be used by the tileset, if anypublic ALcdEarthTile updateTile(ALcdEarthTile aEarthTile, Object aContext) throws IOException
updateTile
in interface ILcdEarthTileSet
updateTile
in class ALcdEarthTileSetWrapper
aEarthTile
- the tile to checkaContext
- application-specific data to be used by the tileset, if anyIOException
- if the tile cannot be updatedprotected boolean isCacheable(ALcdEarthTile aTile, Object aContext)
true
.aTile
- the tileaContext
- the context of the tile productionpublic void cancelTile(int aLevel, long aTileX, long aTileY, ILcdEarthTileSetCoverage aCoverage, ILcdGeoReference aGeoReference, TLcdEarthTileFormat aFormat, ILcdEarthTileSetCallback aCallback, Object aContext)
ALcdEarthTileSetWrapper
produceTile
and/or updateTile
is overridden and the new implementation calls the implementation of this
class using different parameters than passed to it.
If the produceTile is overridden as
super.produceTile( myCoverage, aLevel, aTileX, aTileY, aGeoReference, aFormat, aMode, new MyTileSetCallback( aCallback ), aContext );this method should be overridden as
super.cancelTile( aLevel, aTileX, aTileY, myCoverage, aGeoReference, aFormat, new MyTileSetCallback( aCallback ), aContext );where
MyTileSetCallback
instances with the same delegate callback are equal.cancelTile
in interface ILcdEarthTileSet
cancelTile
in class ALcdEarthTileSetWrapper
aLevel
- the level from which the tile is requestedaTileX
- the column index of the requested tileaTileY
- the row index of the requested tileaCoverage
- the coverage from which the tile is requestedaGeoReference
- the reference system in which the tile is requestedaFormat
- the format in which the tile is requestedaCallback
- would be invoked when the tile would have been available to be usedaContext
- application-specific data to be used by the tileset, if anypublic void dispose()
ILcdEarthTileSet
dispose
in interface ILcdEarthTileSet
dispose
in interface ILcdDisposable
dispose
in class ALcdEarthTileSetWrapper
public void clearCache()
public int getCacheSize()
public void setCacheSize(int aSize)
aSize
- the new cache size.