Skip to content

FileRasterTileCache

Namespace: ThinkGeo.Core

This class is a concrete class inherits from BitmapTileCache. In this class, the tiles will be saved in disk and can be viewed very conveniently.

public class FileRasterTileCache : RasterTileCache

Inheritance ObjectTileCacheRasterTileCacheFileRasterTileCache

Properties

CacheDirectory

Gets or sets the cache direcory.

public string CacheDirectory { get; set; }

Property Value

String

NoDataTileImage

This property returns back a preset image showing the tileView data is missing.

public GeoImage NoDataTileImage { get; }

Property Value

GeoImage

LoadingTileImage

This property returns back a preset image showing the Tile is loading.

public GeoImage LoadingTileImage { get; }

Property Value

GeoImage

ImageFormat

Gets or sets the tileView image format.

public GeoImageFormat ImageFormat { get; set; }

Property Value

GeoImageFormat

JpegQuality

Gets or sets the Jpeg quality , this property only take effects when setting the ImageFormat to Jpeg.

public short JpegQuality { get; set; }

Property Value

Int16

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

public TimeSpan ExpirationTime { get; set; }

Property Value

TimeSpan

Constructors

FileRasterTileCache()

This is the default constructor.

public FileRasterTileCache()

Remarks:

If you use this constructor, you have to set the properties manually.

FileRasterTileCache(String)

This is the overloads constructor.

public FileRasterTileCache(string cacheDirectory)

Parameters

cacheDirectory String
This parameter specifies the cache directory of the tileView cache.

Remarks:

If you use this constructor, the other properties are set with default values.

FileRasterTileCache(String, String)

This is the overloads constructor.

public FileRasterTileCache(string cacheDirectory, string cacheId)

Parameters

cacheDirectory String
This parameter specifies the cache directory of the tileView cache.

cacheId String
This parameter specifies the cache id of the tileView cache.

Remarks:

If you use this constructor, the other properties are set with default values.

FileRasterTileCache(String, String, GeoImageFormat)

This is the constructor with all the parameters needed passed in.

public FileRasterTileCache(string cacheDirectory, string cacheId, GeoImageFormat imageFormat)

Parameters

cacheDirectory String
This parameter specifies the cache directory of the tileView cache.

cacheId String
This parameter specifies the cache id of the tileView cache.

imageFormat GeoImageFormat
This parameter specifies the image format of the tileView cahce.

Methods

GetTileCore(Int32, Int64, Int64)

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

protected Tile GetTileCore(int zoom, long column, long row)

Parameters

zoom Int32

column Int64
The target column for the tileView to fetch.

row Int64
The target row for the tileView to fetch.

Returns

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

GetTileAsyncCore(Int32, Int64, Int64, CancellationToken)

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

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

Parameters

zoom Int32

column Int64
The target column for the tileView to fetch.

row Int64
The target row for the tileView to fetch.

cancellationToken CancellationToken

Returns

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

SaveTileCore(Tile)

This method will save the target tileView passed in, you could override this API to create your own logic.

protected void SaveTileCore(Tile tile)

Parameters

tile Tile
The target tileView to be saved.

SaveTileAsyncCore(Tile, CancellationToken)

protected Task SaveTileAsyncCore(Tile tile, CancellationToken cancellationToken)

Parameters

tile Tile

cancellationToken CancellationToken

Returns

Task

DeleteTileCore(Tile)

This method will delete the target tileView passed in.

protected void DeleteTileCore(Tile tile)

Parameters

tile Tile
The target tileView to be deleted.

CheckExpiration(String)

internal bool CheckExpiration(string tileImageFileName)

Parameters

tileImageFileName String

Returns

Boolean

ClearCache(TimeSpan)

public void ClearCache(TimeSpan tileExpiration)

Parameters

tileExpiration TimeSpan

ClearCache(Double)

public void ClearCache(double maxSizeInMegabytes)

Parameters

maxSizeInMegabytes Double

ClearCache(TimeSpan, Double)

public void ClearCache(TimeSpan tileExpiration, double maxSizeInMegabytes)

Parameters

tileExpiration TimeSpan

maxSizeInMegabytes Double

ToString()

public string ToString()

Returns

String

ClearCacheCore()

This method will clear all the tiles in the tileCache.

protected void ClearCacheCore()

Events

GottenCacheTile

public event EventHandler<GottenCacheImageBitmapTileCacheEventArgs> GottenCacheTile;

GettingCacheTile

public event EventHandler<GettingCacheImageBitmapTileCacheEventArgs> GettingCacheTile;