mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Fixed MBTileSource
This commit is contained in:
parent
4912fa1e40
commit
76f920a053
|
|
@ -57,7 +57,7 @@ namespace MapControl.MBTiles
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<ImageSource> LoadImageAsync(int x, int y, int zoomLevel)
|
public override async Task<ImageSource> LoadImageAsync(int zoomLevel, int column, int row)
|
||||||
{
|
{
|
||||||
ImageSource image = null;
|
ImageSource image = null;
|
||||||
|
|
||||||
|
|
@ -66,8 +66,8 @@ namespace MapControl.MBTiles
|
||||||
using var command = new SQLiteCommand("select tile_data from tiles where zoom_level=@z and tile_column=@x and tile_row=@y", connection);
|
using var command = new SQLiteCommand("select tile_data from tiles where zoom_level=@z and tile_column=@x and tile_row=@y", connection);
|
||||||
|
|
||||||
command.Parameters.AddWithValue("@z", zoomLevel);
|
command.Parameters.AddWithValue("@z", zoomLevel);
|
||||||
command.Parameters.AddWithValue("@x", x);
|
command.Parameters.AddWithValue("@x", column);
|
||||||
command.Parameters.AddWithValue("@y", (1 << zoomLevel) - y - 1);
|
command.Parameters.AddWithValue("@y", (1 << zoomLevel) - row - 1);
|
||||||
|
|
||||||
var buffer = (byte[])await command.ExecuteScalarAsync();
|
var buffer = (byte[])await command.ExecuteScalarAsync();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
var buffer = await LoadCachedBuffer(tile, uri, cacheName).ConfigureAwait(false);
|
var buffer = await LoadCachedBuffer(tile, uri, cacheName).ConfigureAwait(false);
|
||||||
|
|
||||||
if (buffer?.Length > 0)
|
if (buffer != null)
|
||||||
{
|
{
|
||||||
await tile.LoadImageAsync(() => ImageLoader.LoadImageAsync(buffer)).ConfigureAwait(false);
|
await tile.LoadImageAsync(() => ImageLoader.LoadImageAsync(buffer)).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue