2012-11-22 21:42:29 +01:00
|
|
|
|
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
2013-01-17 18:48:38 +01:00
|
|
|
|
// Copyright © 2013 Clemens Fischer
|
2012-11-07 17:48:15 +01:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Provides the image of a map tile. ImageTileSource bypasses download and
|
|
|
|
|
|
/// cache processing in TileImageLoader. By overriding the LoadImage method,
|
|
|
|
|
|
/// an application can provide tile images from an arbitrary source.
|
|
|
|
|
|
/// If the CanLoadAsync property is true, the LoadImage method will be called
|
|
|
|
|
|
/// from a separate non-UI thread and must hence return a frozen ImageSource.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class ImageTileSource : TileSource
|
|
|
|
|
|
{
|
|
|
|
|
|
public virtual bool CanLoadAsync
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return false; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public virtual ImageSource LoadImage(int x, int y, int zoomLevel)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new BitmapImage(GetUri(x, y, zoomLevel));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|