mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Changed ImageTileSource
This commit is contained in:
parent
2fd3f5f8f6
commit
d368c9358c
5 changed files with 13 additions and 21 deletions
|
|
@ -138,10 +138,11 @@ namespace MapControl
|
|||
private void BeginGetTilesAsync(object newTilesList)
|
||||
{
|
||||
List<Tile> newTiles = (List<Tile>)newTilesList;
|
||||
ImageTileSource imageTileSource = tileLayer.TileSource as ImageTileSource;
|
||||
|
||||
if (imageTileSource != null)
|
||||
if (tileLayer.TileSource is ImageTileSource)
|
||||
{
|
||||
ImageTileSource imageTileSource = (ImageTileSource)tileLayer.TileSource;
|
||||
|
||||
newTiles.ForEach(tile =>
|
||||
{
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action)(() => tile.Image = imageTileSource.GetImage(tile.XIndex, tile.Y, tile.ZoomLevel)));
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using System.Globalization;
|
|||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace MapControl
|
||||
{
|
||||
|
|
@ -156,12 +157,16 @@ namespace MapControl
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides the image of a map tile. ImageTileSource bypasses downloading
|
||||
/// and caching of tile images that is performed by TileImageLoader.
|
||||
/// Provides the image of a map tile. ImageTileSource bypasses download and
|
||||
/// cache processing in TileImageLoader. By overriding the GetImage method,
|
||||
/// an application can provide tile images from an arbitrary source.
|
||||
/// </summary>
|
||||
public abstract class ImageTileSource : TileSource
|
||||
public class ImageTileSource : TileSource
|
||||
{
|
||||
public abstract ImageSource GetImage(int x, int y, int zoomLevel);
|
||||
public virtual ImageSource GetImage(int x, int y, int zoomLevel)
|
||||
{
|
||||
return new BitmapImage(GetUri(x, y, zoomLevel));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue