Table of Contents

Class TileCache

Namespace
ThinkGeo.Core
Assembly
ThinkGeo.Core.dll

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 string

This 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

string

ExpirationTime

public TimeSpan ExpirationTime { get; set; }

Property Value

TimeSpan

TileAccessMode

Gets or sets the Mode for the TileCache access the tiles. The Default value is ReadAddDelete

public TileAccessMode TileAccessMode { get; set; }

Property Value

TileAccessMode

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 Tile

The 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 Tile

The 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 int
column long

The target column for the tileView to fetch.

row long

The 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 int
column long

The target column for the tileView to fetch.

row long

The target row for the tileView to fetch.

cancellationToken CancellationToken

Returns

Task<Tile>

Returns the BitmapTile corresponding to the passed in row and column.

GetTileAsyncCore(int, long, long, CancellationToken)

protected virtual Task<Tile> GetTileAsyncCore(int zoom, long column, long row, CancellationToken cancellationToken)

Parameters

zoom int
column long
row long
cancellationToken CancellationToken

Returns

Task<Tile>

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 int
column long

The target column for the tileView to fetch.

row long

The 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

e GettingCacheImageBitmapTileCacheEventArgs

OnGottenCacheTile(GottenCacheImageBitmapTileCacheEventArgs)

protected virtual void OnGottenCacheTile(GottenCacheImageBitmapTileCacheEventArgs e)

Parameters

e GottenCacheImageBitmapTileCacheEventArgs

SaveTile(Tile)

This method will save the target tileView passed in.

public void SaveTile(Tile tile)

Parameters

tile Tile

The 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 Tile
cancellationToken CancellationToken

Returns

Task

SaveTileAsyncCore(Tile, CancellationToken)

protected virtual Task SaveTileAsyncCore(Tile tile, CancellationToken cancellationToken)

Parameters

tile Tile
cancellationToken CancellationToken

Returns

Task

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 Tile

The 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

EventHandler<GettingCacheImageBitmapTileCacheEventArgs>

GottenCacheTile

public event EventHandler<GottenCacheImageBitmapTileCacheEventArgs> GottenCacheTile

Event Type

EventHandler<GottenCacheImageBitmapTileCacheEventArgs>