Class TileCache
This is the base class for TileCache system.
public abstract class TileCache
- Inheritance
-
TileCache
- Derived
- Inherited Members
Remarks
TileCahce system is very efficient in improving the performance of application, especially when large data or remote server images are included.
Constructors
TileCache(string)
This is the constructor of the class.
protected TileCache(string cacheId)
Parameters
cacheId
stringThis is the cache identifier which marks its difference with other TileCache.
Properties
CacheId
Gets or sets the id of the TileCache.
public virtual string CacheId { get; set; }
Property Value
ExpirationTime
public TimeSpan ExpirationTime { get; set; }
Property Value
TileAccessMode
Gets or sets the Mode for the TileCache access the tiles. The Default value is ReadAddDelete
public TileAccessMode TileAccessMode { get; set; }
Property Value
Remarks
If you want it to take effect, you need set the Read property false.
Methods
ClearCache()
This method will clear all the tiles in the tileCache.
public void ClearCache()
Remarks
This method will not take effect when the Read is set to true.
ClearCacheCore()
This abstract method will clear all the tiles in the tileCache, for each sub TileCache class must implement this method.
protected abstract void ClearCacheCore()
Remarks
This method will not take effect when the Read is set to true.
DeleteTile(Tile)
This method will delete the target tileView passed in.
public void DeleteTile(Tile tile)
Parameters
tile
TileThe target tileView to be deleted.
Remarks
This method will not take effect when the Read is set to true.
Exceptions
- ArgumentNullException
If you pass a null as the target tileView, we will throw an ArgumentNullException.
DeleteTileCore(Tile)
This abstract method will delete the target tileView passed in, for each sub TileCache class must implement this method.
protected abstract void DeleteTileCore(Tile tile)
Parameters
tile
TileThe target tileView to be deleted.
Remarks
This method will not take effect when the Read is set to true.
GetTile(int, long, long)
This method returns the BitmapTile corresponding to passed in row and column.
public Tile GetTile(int zoom, long column, long row)
Parameters
zoom
intcolumn
longThe target column for the tileView to fetch.
row
longThe target row for the tileView to fetch.
Returns
- Tile
Returns the BitmapTile corresponding to the passed in row and column.
GetTileAsync(int, long, long, CancellationToken)
This method returns the BitmapTile corresponding to passed in row and column.
public Task<Tile> GetTileAsync(int zoom, long column, long row, CancellationToken cancellationToken)
Parameters
zoom
intcolumn
longThe target column for the tileView to fetch.
row
longThe target row for the tileView to fetch.
cancellationToken
CancellationToken
Returns
GetTileAsyncCore(int, long, long, CancellationToken)
protected virtual Task<Tile> GetTileAsyncCore(int zoom, long column, long row, CancellationToken cancellationToken)
Parameters
zoom
intcolumn
longrow
longcancellationToken
CancellationToken
Returns
GetTileCore(int, long, long)
This abstract method returns the BitmapTile corresponding to passed in row and column. Each concrete TileCache need to implement this logic to get tileView from a row and column.
protected abstract Tile GetTileCore(int zoom, long column, long row)
Parameters
zoom
intcolumn
longThe target column for the tileView to fetch.
row
longThe target row for the tileView to fetch.
Returns
- Tile
Returns the BitmapTile corresponding to the passed in row and column.
OnGettingCacheTile(GettingCacheImageBitmapTileCacheEventArgs)
protected virtual void OnGettingCacheTile(GettingCacheImageBitmapTileCacheEventArgs e)
Parameters
OnGottenCacheTile(GottenCacheImageBitmapTileCacheEventArgs)
protected virtual void OnGottenCacheTile(GottenCacheImageBitmapTileCacheEventArgs e)
Parameters
SaveTile(Tile)
This method will save the target tileView passed in.
public void SaveTile(Tile tile)
Parameters
tile
TileThe target tileView to be saved.
Remarks
This method will not take effect when the Read is set to true.
Exceptions
- ArgumentNullException
If you pass a null as the target tileView, we will throw an ArgumentNullException.
SaveTileAsync(Tile, CancellationToken)
public Task SaveTileAsync(Tile tile, CancellationToken cancellationToken)
Parameters
tile
TilecancellationToken
CancellationToken
Returns
SaveTileAsyncCore(Tile, CancellationToken)
protected virtual Task SaveTileAsyncCore(Tile tile, CancellationToken cancellationToken)
Parameters
tile
TilecancellationToken
CancellationToken
Returns
SaveTileCore(Tile)
This abstract method will save the target tileView passed in, for each sub TileCache class must implement this method.
protected abstract void SaveTileCore(Tile tile)
Parameters
tile
TileThe target tileView to be saved.
Remarks
This method will not take effect when the Read is set to true.
Events
GettingCacheTile
public event EventHandler<GettingCacheImageBitmapTileCacheEventArgs> GettingCacheTile
Event Type
GottenCacheTile
public event EventHandler<GottenCacheImageBitmapTileCacheEventArgs> GottenCacheTile