2017-06-25 23:05:48 +02:00
|
|
|
|
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
|
|
|
|
|
// © 2017 Clemens Fischer
|
2013-11-12 21:14:53 +01:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
2014-07-01 18:57:44 +02:00
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
|
2013-11-12 21:14:53 +01:00
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
2014-07-01 18:57:44 +02:00
|
|
|
|
/// <summary>
|
2017-07-17 21:31:09 +02:00
|
|
|
|
/// Provides the image of a map tile.
|
|
|
|
|
|
/// ImageTileSource bypasses image downloading and optional caching in TileImageLoader.
|
|
|
|
|
|
/// By overriding the LoadImage method, an application can provide tile images from an arbitrary source.
|
|
|
|
|
|
/// LoadImage will be called from a non-UI thread and must therefore return a frozen ImageSource.
|
2014-07-01 18:57:44 +02:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class ImageTileSource : TileSource
|
2013-11-12 21:14:53 +01:00
|
|
|
|
{
|
2014-07-01 18:57:44 +02:00
|
|
|
|
public virtual ImageSource LoadImage(int x, int y, int zoomLevel)
|
2013-11-12 21:14:53 +01:00
|
|
|
|
{
|
2014-07-01 18:57:44 +02:00
|
|
|
|
var uri = GetUri(x, y, zoomLevel);
|
|
|
|
|
|
|
2017-07-17 21:31:09 +02:00
|
|
|
|
return uri != null ? BitmapSourceHelper.FromUri(uri) : null;
|
2013-11-12 21:14:53 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|