mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-03-31 18:45:41 +02:00
Version 4.12.2 Added TileQueue.
This commit is contained in:
parent
c6e2766d60
commit
9bfb663120
|
|
@ -60,7 +60,7 @@ namespace MapControl
|
||||||
tileSource.UriFormat.StartsWith("http") &&
|
tileSource.UriFormat.StartsWith("http") &&
|
||||||
!string.IsNullOrEmpty(sourceName))
|
!string.IsNullOrEmpty(sourceName))
|
||||||
{
|
{
|
||||||
tileQueue.RunDequeueTasks(MaxLoadTasks, tile => LoadTileImageAsync(tile, tileSource, sourceName));
|
tileQueue.RunDequeueTasks(MaxLoadTasks, tile => LoadCachedTileImageAsync(tile, tileSource, sourceName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -69,7 +69,7 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task LoadTileImageAsync(Tile tile, TileSource tileSource, string sourceName)
|
private async Task LoadCachedTileImageAsync(Tile tile, TileSource tileSource, string sourceName)
|
||||||
{
|
{
|
||||||
var uri = tileSource.GetUri(tile.XIndex, tile.Y, tile.ZoomLevel);
|
var uri = tileSource.GetUri(tile.XIndex, tile.Y, tile.ZoomLevel);
|
||||||
|
|
||||||
|
|
@ -84,7 +84,7 @@ namespace MapControl
|
||||||
|
|
||||||
var cacheKey = string.Format(CacheKeyFormat, sourceName, tile.ZoomLevel, tile.XIndex, tile.Y, extension);
|
var cacheKey = string.Format(CacheKeyFormat, sourceName, tile.ZoomLevel, tile.XIndex, tile.Y, extension);
|
||||||
|
|
||||||
await LoadTileImageAsync(tile, uri, cacheKey);
|
await LoadCachedTileImageAsync(tile, uri, cacheKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ namespace MapControl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Caching.IImageCache Cache { get; set; }
|
public static Caching.IImageCache Cache { get; set; }
|
||||||
|
|
||||||
private async Task LoadTileImageAsync(Tile tile, Uri uri, string cacheKey)
|
private async Task LoadCachedTileImageAsync(Tile tile, Uri uri, string cacheKey)
|
||||||
{
|
{
|
||||||
var cacheItem = await Cache.GetAsync(cacheKey);
|
var cacheItem = await Cache.GetAsync(cacheKey);
|
||||||
var cacheBuffer = cacheItem?.Buffer;
|
var cacheBuffer = cacheItem?.Buffer;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ namespace MapControl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static ObjectCache Cache { get; set; } = MemoryCache.Default;
|
public static ObjectCache Cache { get; set; } = MemoryCache.Default;
|
||||||
|
|
||||||
private async Task LoadTileImageAsync(Tile tile, Uri uri, string cacheKey)
|
private async Task LoadCachedTileImageAsync(Tile tile, Uri uri, string cacheKey)
|
||||||
{
|
{
|
||||||
DateTime expiration;
|
DateTime expiration;
|
||||||
var cacheBuffer = GetCachedImage(cacheKey, out expiration);
|
var cacheBuffer = GetCachedImage(cacheKey, out expiration);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue