Skip to content

TileCache

Namespace: ThinkGeo.Core

This is the base class for TileCache system.

public abstract class TileCache

Inheritance objectTileCache

Remarks:

TileCache system is very efficient in improving the performance of application, especially when large data or remote server images are included.

Properties

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.

CacheId

Gets or sets the id of the TileCache.

public string CacheId { get; set; }

Property Value

string

ExpirationTime

Gets or sets the ExpirationTime.

public TimeSpan ExpirationTime { get; set; }

Property Value

TimeSpan

Methods

OnGottenCacheTile(GottenCacheImageBitmapTileCacheEventArgs)

Performs on gotten cache tile.

protected void OnGottenCacheTile(GottenCacheImageBitmapTileCacheEventArgs e)

Parameters

e GottenCacheImageBitmapTileCacheEventArgs
The e.

Returns

void

OnGottenTile(GottenTileTileCacheEventArgs)

Performs on gotten tile.

protected void OnGottenTile(GottenTileTileCacheEventArgs e)

Parameters

e GottenTileTileCacheEventArgs
The e.

Returns

void

OnGettingCacheTile(GettingCacheImageBitmapTileCacheEventArgs)

Performs on getting cache tile.

protected void OnGettingCacheTile(GettingCacheImageBitmapTileCacheEventArgs e)

Parameters

e GettingCacheImageBitmapTileCacheEventArgs
The e.

Returns

void

OnGettingTile(GettingTileTileCacheEventArgs)

Performs on getting tile.

protected void OnGettingTile(GettingTileTileCacheEventArgs e)

Parameters

e GettingTileTileCacheEventArgs
The e.

Returns

void

GetTile(int, long, long)

This method returns the BitmapTile corresponding to passed in row and column.

public Tile GetTile(int zoom, long x, long y)

Parameters

zoom int
Specifies the zoom.

x long
The target column for the tileView to fetch.

y 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 x, long y, CancellationToken cancellationToken)

Parameters

zoom int
Specifies the zoom.

x long
Specifies the x.

y long
Specifies the y.

cancellationToken CancellationToken
Specifies the cancellationToken.

Returns

Task<Tile>
Returns the BitmapTile corresponding to the passed in row and column.

OnSavingTile(SavingTileTileCacheEventArgs)

Performs on saving tile.

protected void OnSavingTile(SavingTileTileCacheEventArgs e)

Parameters

e SavingTileTileCacheEventArgs
The e.

Returns

void

OnSavedTile(SavedTileTileCacheEventArgs)

Performs on saved tile.

protected void OnSavedTile(SavedTileTileCacheEventArgs e)

Parameters

e SavedTileTileCacheEventArgs
The e.

Returns

void

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.

Returns

void

Exceptions

ArgumentNullException
If you pass a null as the target tileView, we will throw an ArgumentNullException.

SaveTileAsync(Tile, CancellationToken)

Saves the current object to the specified destination.

public Task SaveTileAsync(Tile tile, CancellationToken cancellationToken)

Parameters

tile Tile
The tile.

cancellationToken CancellationToken
A cancellation or authentication token, depending on context.

Returns

Task
A task that represents the asynchronous operation.

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.

Returns

void

Exceptions

ArgumentNullException
If you pass a null as the target tileView, we will throw an ArgumentNullException.

ClearCache()

This method will clear all the tiles in the tileCache.

public void ClearCache()

Returns

void

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()

Returns

void

SaveTileCore(Tile)

This abstract method will save the target tileView passed in, for each sub TileCache class must implement this method.

protected void SaveTileCore(Tile tile)

Parameters

tile Tile
The target tileView to be saved.

Returns

void

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.

Returns

void

SaveTileAsyncCore(Tile, CancellationToken)

Provides the overridable implementation that saves the current object to the specified destination.

protected Task SaveTileAsyncCore(Tile tile, CancellationToken cancellationToken)

Parameters

tile Tile
The tile.

cancellationToken CancellationToken
A cancellation or authentication token, depending on context.

Returns

Task
A task that represents the asynchronous operation.

GetTileAsyncCore(int, long, long, CancellationToken)

Provides the overridable implementation that returns tile async for the specified parameters.

protected Task<Tile> GetTileAsyncCore(int zoom, long x, long y, CancellationToken cancellationToken)

Parameters

zoom int
The zoom.

x long
The x-coordinate, in pixels.

y long
The y-coordinate, in pixels.

cancellationToken CancellationToken
A cancellation or authentication token, depending on context.

Returns

Task<Tile>
A task that represents the asynchronous operation and provides the result.

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 Tile GetTileCore(int zoom, long x, long y)

Parameters

zoom int

x long
The target column for the tileView to fetch.

y long
The target row for the tileView to fetch.

Returns

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

Events

GottenCacheTile

Occurs when the GottenCacheTile event is raised.

public event EventHandler<GottenCacheImageBitmapTileCacheEventArgs> GottenCacheTile;

GettingCacheTile

Occurs when the GettingCacheTile event is raised.

public event EventHandler<GettingCacheImageBitmapTileCacheEventArgs> GettingCacheTile;

GottenTile

Occurs when the GottenTile event is raised.

public event EventHandler<GottenTileTileCacheEventArgs> GottenTile;

GettingTile

Occurs when the GettingTile event is raised.

public event EventHandler<GettingTileTileCacheEventArgs> GettingTile;

SavingTile

Occurs when the SavingTile event is raised.

public event EventHandler<SavingTileTileCacheEventArgs> SavingTile;

SavedTile

Occurs when the SavedTile event is raised.

public event EventHandler<SavedTileTileCacheEventArgs> SavedTile;