mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Private async method names
This commit is contained in:
parent
4335457c54
commit
caf47209a3
|
|
@ -9,7 +9,7 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
public static partial class GeoImage
|
public static partial class GeoImage
|
||||||
{
|
{
|
||||||
private static Task<GeoBitmap> LoadGeoTiffAsync(string sourcePath)
|
private static Task<GeoBitmap> LoadGeoTiff(string sourcePath)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("GeoTIFF is not supported.");
|
throw new InvalidOperationException("GeoTIFF is not supported.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
public partial class TileImageLoader
|
public partial class TileImageLoader
|
||||||
{
|
{
|
||||||
private static async Task LoadTileAsync(Tile tile, Func<Task<IImage>> loadImageFunc)
|
private static async Task LoadTileImage(Tile tile, Func<Task<IImage>> loadImageFunc)
|
||||||
{
|
{
|
||||||
var image = await loadImageFunc().ConfigureAwait(false);
|
var image = await loadImageFunc().ConfigureAwait(false);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var geoBitmap = await LoadGeoBitmapAsync(sourcePath);
|
var geoBitmap = await LoadGeoBitmap(sourcePath);
|
||||||
|
|
||||||
if (element is Image image)
|
if (element is Image image)
|
||||||
{
|
{
|
||||||
|
|
@ -122,7 +122,7 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<GeoBitmap> LoadGeoBitmapAsync(string sourcePath)
|
private static async Task<GeoBitmap> LoadGeoBitmap(string sourcePath)
|
||||||
{
|
{
|
||||||
var ext = Path.GetExtension(sourcePath);
|
var ext = Path.GetExtension(sourcePath);
|
||||||
|
|
||||||
|
|
@ -136,15 +136,15 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
return new GeoBitmap(
|
return new GeoBitmap(
|
||||||
(BitmapSource)await ImageLoader.LoadImageAsync(sourcePath),
|
(BitmapSource)await ImageLoader.LoadImageAsync(sourcePath),
|
||||||
await ReadWorldFileMatrixAsync(worldFilePath),
|
await ReadWorldFileMatrix(worldFilePath),
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return await LoadGeoTiffAsync(sourcePath);
|
return await LoadGeoTiff(sourcePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<Matrix> ReadWorldFileMatrixAsync(string worldFilePath)
|
private static async Task<Matrix> ReadWorldFileMatrix(string worldFilePath)
|
||||||
{
|
{
|
||||||
using (var fileStream = File.OpenRead(worldFilePath))
|
using (var fileStream = File.OpenRead(worldFilePath))
|
||||||
using (var streamReader = new StreamReader(fileStream))
|
using (var streamReader = new StreamReader(fileStream))
|
||||||
|
|
|
||||||
|
|
@ -75,11 +75,11 @@ namespace MapControl
|
||||||
|
|
||||||
if (ext == ".kmz")
|
if (ext == ".kmz")
|
||||||
{
|
{
|
||||||
imageOverlays = await LoadGroundOverlaysFromArchiveAsync(sourcePath);
|
imageOverlays = await LoadGroundOverlaysFromArchive(sourcePath);
|
||||||
}
|
}
|
||||||
else if (ext == ".kml")
|
else if (ext == ".kml")
|
||||||
{
|
{
|
||||||
imageOverlays = await LoadGroundOverlaysFromFileAsync(sourcePath);
|
imageOverlays = await LoadGroundOverlaysFromFile(sourcePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
@ -107,7 +107,7 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<IEnumerable<ImageOverlay>> LoadGroundOverlaysFromArchiveAsync(string archiveFilePath)
|
private static async Task<IEnumerable<ImageOverlay>> LoadGroundOverlaysFromArchive(string archiveFilePath)
|
||||||
{
|
{
|
||||||
using (var archive = ZipFile.OpenRead(archiveFilePath))
|
using (var archive = ZipFile.OpenRead(archiveFilePath))
|
||||||
{
|
{
|
||||||
|
|
@ -150,7 +150,7 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<IEnumerable<ImageOverlay>> LoadGroundOverlaysFromFileAsync(string docFilePath)
|
private static async Task<IEnumerable<ImageOverlay>> LoadGroundOverlaysFromFile(string docFilePath)
|
||||||
{
|
{
|
||||||
docFilePath = FilePath.GetFullPath(docFilePath);
|
docFilePath = FilePath.GetFullPath(docFilePath);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ namespace MapControl
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await LoadTileAsync(tile, tileSource, cacheName).ConfigureAwait(false);
|
await LoadTileImage(tile, tileSource, cacheName).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -112,14 +112,14 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task LoadTileAsync(Tile tile, TileSource tileSource, string cacheName)
|
private static async Task LoadTileImage(Tile tile, TileSource tileSource, string cacheName)
|
||||||
{
|
{
|
||||||
// Pass tileSource.LoadImageAsync calls to platform-specific method
|
// Pass tileSource.LoadImageAsync calls to platform-specific method
|
||||||
// LoadTileAsync(Tile, Func<Task<ImageSource>>) for execution on the UI thread in WinUI/UWP.
|
// LoadTileImage(Tile, Func<Task<ImageSource>>) for execution on the UI thread in WinUI and UWP.
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(cacheName))
|
if (string.IsNullOrEmpty(cacheName))
|
||||||
{
|
{
|
||||||
await LoadTileAsync(tile, () => tileSource.LoadImageAsync(tile.Column, tile.Row, tile.ZoomLevel)).ConfigureAwait(false);
|
await LoadTileImage(tile, () => tileSource.LoadImageAsync(tile.Column, tile.Row, tile.ZoomLevel)).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -127,17 +127,17 @@ namespace MapControl
|
||||||
|
|
||||||
if (uri != null)
|
if (uri != null)
|
||||||
{
|
{
|
||||||
var buffer = await LoadCachedBufferAsync(tile, uri, cacheName).ConfigureAwait(false);
|
var buffer = await LoadCachedBuffer(tile, uri, cacheName).ConfigureAwait(false);
|
||||||
|
|
||||||
if (buffer != null && buffer.Length > 0)
|
if (buffer != null && buffer.Length > 0)
|
||||||
{
|
{
|
||||||
await LoadTileAsync(tile, () => tileSource.LoadImageAsync(buffer)).ConfigureAwait(false);
|
await LoadTileImage(tile, () => tileSource.LoadImageAsync(buffer)).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<byte[]> LoadCachedBufferAsync(Tile tile, Uri uri, string cacheName)
|
private static async Task<byte[]> LoadCachedBuffer(Tile tile, Uri uri, string cacheName)
|
||||||
{
|
{
|
||||||
byte[] buffer = null;
|
byte[] buffer = null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
public partial class TileImageLoader
|
public partial class TileImageLoader
|
||||||
{
|
{
|
||||||
private static async Task LoadTileAsync(Tile tile, Func<Task<ImageSource>> loadImageFunc)
|
private static async Task LoadTileImage(Tile tile, Func<Task<ImageSource>> loadImageFunc)
|
||||||
{
|
{
|
||||||
var tcs = new TaskCompletionSource<object>();
|
var tcs = new TaskCompletionSource<object>();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
public static partial class GeoImage
|
public static partial class GeoImage
|
||||||
{
|
{
|
||||||
private static Task<GeoBitmap> LoadGeoTiffAsync(string sourcePath)
|
private static Task<GeoBitmap> LoadGeoTiff(string sourcePath)
|
||||||
{
|
{
|
||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
public partial class TileImageLoader
|
public partial class TileImageLoader
|
||||||
{
|
{
|
||||||
private static async Task LoadTileAsync(Tile tile, Func<Task<ImageSource>> loadImageFunc)
|
private static async Task LoadTileImage(Tile tile, Func<Task<ImageSource>> loadImageFunc)
|
||||||
{
|
{
|
||||||
var image = await loadImageFunc().ConfigureAwait(false);
|
var image = await loadImageFunc().ConfigureAwait(false);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
public static partial class GeoImage
|
public static partial class GeoImage
|
||||||
{
|
{
|
||||||
private static async Task<GeoBitmap> LoadGeoTiffAsync(string sourcePath)
|
private static async Task<GeoBitmap> LoadGeoTiff(string sourcePath)
|
||||||
{
|
{
|
||||||
BitmapSource bitmap;
|
BitmapSource bitmap;
|
||||||
Matrix transform;
|
Matrix transform;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
public partial class TileImageLoader
|
public partial class TileImageLoader
|
||||||
{
|
{
|
||||||
private static Task LoadTileAsync(Tile tile, Func<Task<ImageSource>> loadImageFunc)
|
private static Task LoadTileImage(Tile tile, Func<Task<ImageSource>> loadImageFunc)
|
||||||
{
|
{
|
||||||
var tcs = new TaskCompletionSource();
|
var tcs = new TaskCompletionSource();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue