FileVectorTileCache¶
Namespace: ThinkGeo.Core
Represents a disk-backed cache for vector tiles.
public class FileVectorTileCache : TileCache
Inheritance object → TileCache → FileVectorTileCache
Remarks:
This cache stores each tile as a file under FileVectorTileCache.CacheDirectory and TileCache.CacheId.
Note: This class is legacy (used by the legacy ThinkGeo Cloud layer) and is planned to be obsoleted.
Properties¶
CacheDirectory¶
Gets or sets the root directory where tile files will be stored.
public string CacheDirectory { get; set; }
Property Value¶
FileExtension¶
Gets or sets the file extension used for tile files (for example, "pbf").
public string FileExtension { 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.
CacheId¶
Gets or sets the id of the TileCache.
public string CacheId { get; set; }
Property Value¶
ExpirationTime¶
Gets or sets the ExpirationTime.
public TimeSpan ExpirationTime { get; set; }
Property Value¶
Constructors¶
FileVectorTileCache()¶
Initializes a new instance of the FileVectorTileCache class using a temporary directory.
public FileVectorTileCache()
FileVectorTileCache(string)¶
Initializes a new instance of the FileVectorTileCache class.
public FileVectorTileCache(string cacheDirectory)
Parameters¶
cacheDirectory string
The root directory where tile files will be stored.
FileVectorTileCache(string, string)¶
Initializes a new instance of the FileVectorTileCache class.
public FileVectorTileCache(string cacheDirectory, string cacheId)
Parameters¶
cacheDirectory string
The root directory where tile files will be stored.
cacheId string
A subdirectory name used to isolate this cache instance from others.
FileVectorTileCache(string, string, string)¶
Initializes a new instance of the FileVectorTileCache class.
public FileVectorTileCache(string cacheDirectory, string cacheId, string fileExtension)
Parameters¶
cacheDirectory string
The root directory where tile files will be stored.
cacheId string
A subdirectory name used to isolate this cache instance from others.
fileExtension string
The file extension used for tile files (for example, "pbf").
Methods¶
ClearCacheCore()¶
Removes all cached tiles for this cache instance from disk.
protected void ClearCacheCore()
Returns¶
DeleteTileCore(Tile)¶
Deletes the file for the specified tile (if it exists).
protected void DeleteTileCore(Tile tile)
Parameters¶
tile Tile
The tile to delete.
Returns¶
GetTileCore(int, long, long)¶
Gets the cached tile for the specified coordinates if it exists; otherwise returns null.
protected Tile GetTileCore(int zoom, long x, long y)
Parameters¶
zoom int
The zoom level.
x long
The tile x (column).
y long
The tile y (row).
Returns¶
Tile
The cached instance, or null if not found.
GetTileAsyncCore(int, long, long, CancellationToken)¶
Asynchronously gets the cached tile for the specified coordinates if it exists; otherwise returns null.
protected Task<Tile> GetTileAsyncCore(int zoom, long x, long y, CancellationToken cancellationToken)
Parameters¶
zoom int
The zoom level.
x long
The tile x (column).
y long
The tile y (row).
cancellationToken CancellationToken
A cancellation token.
Returns¶
Task<Tile>
A task that returns the cached instance, or null if not found.
SaveTileCore(Tile)¶
Saves the specified tile to disk if it does not already exist.
protected void SaveTileCore(Tile tile)
Parameters¶
tile Tile
The tile to save.
Returns¶
SaveTileAsyncCore(Tile, CancellationToken)¶
Asynchronously saves the specified tile to disk if it does not already exist.
protected Task SaveTileAsyncCore(Tile tile, CancellationToken cancellationToken)
Parameters¶
tile Tile
The tile to save.
cancellationToken CancellationToken
A cancellation token.
Returns¶
Task
A task representing the asynchronous operation.
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;