mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Moved method from TileImageLoader to TileSource
This commit is contained in:
parent
fa160ff138
commit
7cb7d81f15
|
|
@ -119,9 +119,7 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual Task<ImageSource> LoadImageAsync(byte[] buffer) => ImageLoader.LoadImageAsync(buffer);
|
private static async Task LoadTileAsync(Tile tile, TileSource tileSource, string cacheName)
|
||||||
|
|
||||||
private async Task LoadTileAsync(Tile tile, TileSource tileSource, string cacheName)
|
|
||||||
{
|
{
|
||||||
Func<Task<ImageSource>> loadImageFunc;
|
Func<Task<ImageSource>> loadImageFunc;
|
||||||
|
|
||||||
|
|
@ -139,7 +137,7 @@ namespace MapControl
|
||||||
|
|
||||||
if (buffer == null || buffer.Length == 0) return;
|
if (buffer == null || buffer.Length == 0) return;
|
||||||
|
|
||||||
loadImageFunc = () => LoadImageAsync(buffer);
|
loadImageFunc = () => tileSource.LoadImageAsync(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
await LoadTileAsync(tile, loadImageFunc).ConfigureAwait(false); // loadImageFunc runs in UI thread in WinUI/UWP
|
await LoadTileAsync(tile, loadImageFunc).ConfigureAwait(false); // loadImageFunc runs in UI thread in WinUI/UWP
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ namespace MapControl
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads a tile ImageSource asynchronously from GetUri(column, row, zoomLevel).
|
/// Loads a tile ImageSource asynchronously from GetUri(column, row, zoomLevel).
|
||||||
/// This method is called by TileImageLoader for TileSources without caching.
|
/// This method is called by TileImageLoader when caching is disabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual Task<ImageSource> LoadImageAsync(int column, int row, int zoomLevel)
|
public virtual Task<ImageSource> LoadImageAsync(int column, int row, int zoomLevel)
|
||||||
{
|
{
|
||||||
|
|
@ -84,6 +84,12 @@ namespace MapControl
|
||||||
return uri != null ? ImageLoader.LoadImageAsync(uri) : Task.FromResult((ImageSource)null);
|
return uri != null ? ImageLoader.LoadImageAsync(uri) : Task.FromResult((ImageSource)null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loads a tile ImageSource asynchronously from an encoded frame buffer in a byte array.
|
||||||
|
/// This method is called by TileImageLoader when caching is enabled.
|
||||||
|
/// </summary>
|
||||||
|
public virtual Task<ImageSource> LoadImageAsync(byte[] buffer) => ImageLoader.LoadImageAsync(buffer);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a TileSource instance from an Uri template string.
|
/// Creates a TileSource instance from an Uri template string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue