2012-11-22 21:42:29 +01:00
|
|
|
|
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
2013-05-07 18:12:25 +02:00
|
|
|
|
// Copyright © Clemens Fischer 2012-2013
|
2012-11-22 21:42:29 +01:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
2012-12-09 22:18:31 +01:00
|
|
|
|
#if NETFX_CORE
|
2012-11-22 21:42:29 +01:00
|
|
|
|
using Windows.UI.Xaml.Media.Imaging;
|
|
|
|
|
|
#else
|
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Loads map tile images by their URIs.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
internal class TileImageLoader
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly TileLayer tileLayer;
|
|
|
|
|
|
|
|
|
|
|
|
internal TileImageLoader(TileLayer tileLayer)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.tileLayer = tileLayer;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal void BeginGetTiles(IEnumerable<Tile> tiles)
|
|
|
|
|
|
{
|
2013-01-17 18:48:38 +01:00
|
|
|
|
foreach (var tile in tiles.Where(t => !t.HasImage))
|
2012-11-22 21:42:29 +01:00
|
|
|
|
{
|
2013-01-17 18:48:38 +01:00
|
|
|
|
var uri = tileLayer.TileSource.GetUri(tile.XIndex, tile.Y, tile.ZoomLevel);
|
|
|
|
|
|
|
|
|
|
|
|
tile.SetImageSource(new BitmapImage(uri), true);
|
2012-11-22 21:42:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal void CancelGetTiles()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|