mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Version 4.12.2 Reverted to previous ITileImageLoader
This commit is contained in:
parent
5a7e93f577
commit
014f57ee1a
|
|
@ -38,8 +38,8 @@ namespace MapControl
|
|||
public static TimeSpan DefaultCacheExpiration { get; set; } = TimeSpan.FromDays(1);
|
||||
|
||||
/// <summary>
|
||||
/// Format string for creating cache keys from the SourceName property and the
|
||||
/// ZoomLevel, XIndex, and Y properties of a Tile and the image file extension.
|
||||
/// Format string for creating cache keys from the sourceName argument passed to LoadTilesAsync,
|
||||
/// the ZoomLevel, XIndex, and Y properties of a Tile, and the image file extension.
|
||||
/// The default value is "{0}/{1}/{2}/{3}{4}".
|
||||
/// </summary>
|
||||
public static string CacheKeyFormat { get; set; } = "{0}/{1}/{2}/{3}{4}";
|
||||
|
|
@ -50,7 +50,7 @@ namespace MapControl
|
|||
|
||||
/// <summary>
|
||||
/// Loads all pending tiles from the tiles collection in up to MaxLoadTasks parallel Tasks.
|
||||
/// If the UriFormat of the TileSource starts with "http" and sourceName is a non-empty string,
|
||||
/// If tileSource.UriFormat starts with "http" and sourceName is a non-empty string,
|
||||
/// tile images will be cached in the TileImageLoader's Cache.
|
||||
/// </summary>
|
||||
public void LoadTilesAsync(IEnumerable<Tile> tiles, TileSource tileSource, string sourceName)
|
||||
|
|
@ -94,7 +94,7 @@ namespace MapControl
|
|||
Interlocked.Decrement(ref taskCount);
|
||||
}
|
||||
|
||||
private async Task LoadTileImageAsync(Tile tile, TileSource tileSource, string sourceName)
|
||||
private static async Task LoadTileImageAsync(Tile tile, TileSource tileSource, string sourceName)
|
||||
{
|
||||
if (Cache != null &&
|
||||
tileSource.UriFormat != null &&
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace MapControl
|
|||
public static Caching.IImageCache Cache { get; set; }
|
||||
|
||||
|
||||
private async Task LoadCachedTileImageAsync(Tile tile, Uri uri, string cacheKey)
|
||||
private static async Task LoadCachedTileImageAsync(Tile tile, Uri uri, string cacheKey)
|
||||
{
|
||||
var cacheItem = await Cache.GetAsync(cacheKey).ConfigureAwait(false);
|
||||
var cacheBuffer = cacheItem?.Buffer;
|
||||
|
|
@ -55,7 +55,7 @@ namespace MapControl
|
|||
}
|
||||
}
|
||||
|
||||
private async Task LoadTileImageAsync(Tile tile, IBuffer buffer)
|
||||
private static async Task LoadTileImageAsync(Tile tile, IBuffer buffer)
|
||||
{
|
||||
using (var stream = new InMemoryRandomAccessStream())
|
||||
{
|
||||
|
|
@ -66,12 +66,12 @@ namespace MapControl
|
|||
}
|
||||
}
|
||||
|
||||
private Task LoadTileImageAsync(Tile tile, TileSource tileSource)
|
||||
private static Task LoadTileImageAsync(Tile tile, TileSource tileSource)
|
||||
{
|
||||
return SetTileImageAsync(tile, () => tileSource.LoadImageAsync(tile.XIndex, tile.Y, tile.ZoomLevel));
|
||||
}
|
||||
|
||||
private async Task SetTileImageAsync(Tile tile, Func<Task<ImageSource>> loadImageFunc)
|
||||
private static async Task SetTileImageAsync(Tile tile, Func<Task<ImageSource>> loadImageFunc)
|
||||
{
|
||||
var tcs = new TaskCompletionSource<object>();
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace MapControl
|
|||
public static ObjectCache Cache { get; set; } = MemoryCache.Default;
|
||||
|
||||
|
||||
private async Task LoadCachedTileImageAsync(Tile tile, Uri uri, string cacheKey)
|
||||
private static async Task LoadCachedTileImageAsync(Tile tile, Uri uri, string cacheKey)
|
||||
{
|
||||
ImageSource image = null;
|
||||
DateTime expiration;
|
||||
|
|
@ -64,7 +64,7 @@ namespace MapControl
|
|||
}
|
||||
}
|
||||
|
||||
private async Task LoadTileImageAsync(Tile tile, TileSource tileSource)
|
||||
private static async Task LoadTileImageAsync(Tile tile, TileSource tileSource)
|
||||
{
|
||||
var image = await tileSource.LoadImageAsync(tile.XIndex, tile.Y, tile.ZoomLevel).ConfigureAwait(false);
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ namespace MapControl
|
|||
}
|
||||
}
|
||||
|
||||
private void SetTileImage(Tile tile, ImageSource image)
|
||||
private static void SetTileImage(Tile tile, ImageSource image)
|
||||
{
|
||||
tile.Image.Dispatcher.InvokeAsync(() => tile.SetImage(image));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue