2012-11-22 21:42:29 +01:00
|
|
|
|
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
2016-02-23 20:07:30 +01:00
|
|
|
|
// © 2016 Clemens Fischer
|
2012-11-07 17:48:15 +01:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
2015-08-09 20:04:44 +02:00
|
|
|
|
#if NETFX_CORE
|
2013-11-12 21:14:53 +01:00
|
|
|
|
using Windows.UI.Xaml.Media;
|
|
|
|
|
|
using Windows.UI.Xaml.Media.Imaging;
|
|
|
|
|
|
#else
|
2012-11-07 17:48:15 +01:00
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
using System.Windows.Media.Imaging;
|
2013-11-12 21:14:53 +01:00
|
|
|
|
#endif
|
2012-11-07 17:48:15 +01:00
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2014-07-01 18:57:44 +02:00
|
|
|
|
/// Provides the image of a map tile. ImageTileSource bypasses image
|
|
|
|
|
|
/// downloading in TileImageLoader. By overriding the LoadImage method,
|
2012-11-07 17:48:15 +01:00
|
|
|
|
/// an application can provide tile images from an arbitrary source.
|
|
|
|
|
|
/// </summary>
|
2014-07-01 18:57:44 +02:00
|
|
|
|
public class ImageTileSource : TileSource
|
2012-11-07 17:48:15 +01:00
|
|
|
|
{
|
|
|
|
|
|
public virtual ImageSource LoadImage(int x, int y, int zoomLevel)
|
|
|
|
|
|
{
|
2013-11-12 21:14:53 +01:00
|
|
|
|
var uri = GetUri(x, y, zoomLevel);
|
|
|
|
|
|
|
|
|
|
|
|
return uri != null ? new BitmapImage(uri) : null;
|
2012-11-07 17:48:15 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|