mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
MapTileLayerBase.TileImageLoader property
This commit is contained in:
parent
ebdbc012f2
commit
b32755e29e
|
|
@ -30,12 +30,6 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
|
|
||||||
public BingMapsTileLayer()
|
public BingMapsTileLayer()
|
||||||
: this(new TileImageLoader())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public BingMapsTileLayer(ITileImageLoader tileImageLoader)
|
|
||||||
: base(tileImageLoader)
|
|
||||||
{
|
{
|
||||||
MinZoomLevel = 1;
|
MinZoomLevel = 1;
|
||||||
MaxZoomLevel = 21;
|
MaxZoomLevel = 21;
|
||||||
|
|
|
||||||
|
|
@ -48,16 +48,6 @@ namespace MapControl
|
||||||
public static readonly DependencyProperty ZoomLevelOffsetProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty ZoomLevelOffsetProperty = DependencyProperty.Register(
|
||||||
nameof(ZoomLevelOffset), typeof(double), typeof(MapTileLayer), new PropertyMetadata(0d));
|
nameof(ZoomLevelOffset), typeof(double), typeof(MapTileLayer), new PropertyMetadata(0d));
|
||||||
|
|
||||||
public MapTileLayer()
|
|
||||||
: this(new TileImageLoader())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public MapTileLayer(ITileImageLoader tileImageLoader)
|
|
||||||
: base(tileImageLoader)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public TileMatrix TileMatrix { get; private set; }
|
public TileMatrix TileMatrix { get; private set; }
|
||||||
|
|
||||||
public TileCollection Tiles { get; private set; } = new TileCollection();
|
public TileCollection Tiles { get; private set; } = new TileCollection();
|
||||||
|
|
|
||||||
|
|
@ -61,14 +61,13 @@ namespace MapControl
|
||||||
|
|
||||||
private readonly Progress<double> loadingProgress;
|
private readonly Progress<double> loadingProgress;
|
||||||
private readonly DispatcherTimer updateTimer;
|
private readonly DispatcherTimer updateTimer;
|
||||||
|
private ITileImageLoader tileImageLoader;
|
||||||
private MapBase parentMap;
|
private MapBase parentMap;
|
||||||
|
|
||||||
protected MapTileLayerBase(ITileImageLoader tileImageLoader)
|
protected MapTileLayerBase()
|
||||||
{
|
{
|
||||||
RenderTransform = new MatrixTransform();
|
RenderTransform = new MatrixTransform();
|
||||||
|
|
||||||
TileImageLoader = tileImageLoader;
|
|
||||||
|
|
||||||
loadingProgress = new Progress<double>(p => LoadingProgress = p);
|
loadingProgress = new Progress<double>(p => LoadingProgress = p);
|
||||||
|
|
||||||
updateTimer = this.CreateTimer(UpdateInterval);
|
updateTimer = this.CreateTimer(UpdateInterval);
|
||||||
|
|
@ -79,7 +78,11 @@ namespace MapControl
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITileImageLoader TileImageLoader { get; }
|
public ITileImageLoader TileImageLoader
|
||||||
|
{
|
||||||
|
get => tileImageLoader ?? (tileImageLoader = new TileImageLoader());
|
||||||
|
set => tileImageLoader = value;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides map tile URIs or images.
|
/// Provides map tile URIs or images.
|
||||||
|
|
|
||||||
|
|
@ -49,13 +49,12 @@ namespace MapControl
|
||||||
public void SetImageSource(ImageSource image)
|
public void SetImageSource(ImageSource image)
|
||||||
{
|
{
|
||||||
IsPending = false;
|
IsPending = false;
|
||||||
|
Image.Source = image;
|
||||||
|
|
||||||
if (image != null && MapBase.ImageFadeDuration > TimeSpan.Zero)
|
if (image != null && MapBase.ImageFadeDuration > TimeSpan.Zero)
|
||||||
{
|
{
|
||||||
AnimateImageOpacity(image);
|
AnimateImageOpacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
Image.Source = image;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BeginOpacityAnimation()
|
private void BeginOpacityAnimation()
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,6 @@ namespace MapControl
|
||||||
nameof(PreferredTileMatrixSets), typeof(string[]), typeof(WmtsTileLayer), new PropertyMetadata(null));
|
nameof(PreferredTileMatrixSets), typeof(string[]), typeof(WmtsTileLayer), new PropertyMetadata(null));
|
||||||
|
|
||||||
public WmtsTileLayer()
|
public WmtsTileLayer()
|
||||||
: this(new TileImageLoader())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public WmtsTileLayer(ITileImageLoader tileImageLoader)
|
|
||||||
: base(tileImageLoader)
|
|
||||||
{
|
{
|
||||||
Loaded += OnLoaded;
|
Loaded += OnLoaded;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
public partial class Tile
|
public partial class Tile
|
||||||
{
|
{
|
||||||
private void AnimateImageOpacity(ImageSource image)
|
private void AnimateImageOpacity()
|
||||||
{
|
{
|
||||||
if (image is BitmapSource bitmap && !bitmap.IsFrozen && bitmap.IsDownloading)
|
if (Image.Source is BitmapSource bitmap && bitmap.IsDownloading && !bitmap.IsFrozen)
|
||||||
{
|
{
|
||||||
bitmap.DownloadCompleted += BitmapDownloadCompleted;
|
bitmap.DownloadCompleted += BitmapDownloadCompleted;
|
||||||
bitmap.DownloadFailed += BitmapDownloadFailed;
|
bitmap.DownloadFailed += BitmapDownloadFailed;
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
public partial class Tile
|
public partial class Tile
|
||||||
{
|
{
|
||||||
private void AnimateImageOpacity(ImageSource image)
|
private void AnimateImageOpacity()
|
||||||
{
|
{
|
||||||
if (image is BitmapImage bitmap && bitmap.UriSource != null)
|
if (Image.Source is BitmapImage bitmap && bitmap.UriSource != null)
|
||||||
{
|
{
|
||||||
bitmap.ImageOpened += BitmapImageOpened;
|
bitmap.ImageOpened += BitmapImageOpened;
|
||||||
bitmap.ImageFailed += BitmapImageFailed;
|
bitmap.ImageFailed += BitmapImageFailed;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue