mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Version 7.3. Added tile and map image progress reporting.
This commit is contained in:
parent
b423cc2d36
commit
3119c0fc9b
32 changed files with 252 additions and 100 deletions
|
|
@ -25,6 +25,8 @@ namespace MapControl
|
|||
{
|
||||
public interface ITileImageLoader
|
||||
{
|
||||
IProgress<double> Progress { get; set; }
|
||||
|
||||
TileSource TileSource { get; }
|
||||
|
||||
Task LoadTiles(IEnumerable<Tile> tiles, TileSource tileSource, string cacheName);
|
||||
|
|
@ -58,13 +60,19 @@ namespace MapControl
|
|||
public static readonly DependencyProperty MapForegroundProperty = DependencyProperty.Register(
|
||||
nameof(MapForeground), typeof(Brush), typeof(MapTileLayerBase), new PropertyMetadata(null));
|
||||
|
||||
public static readonly DependencyProperty LoadingProgressProperty = DependencyProperty.Register(
|
||||
nameof(LoadingProgress), typeof(double), typeof(MapTileLayerBase), new PropertyMetadata(1d,
|
||||
(o, e) => { System.Diagnostics.Debug.WriteLine("LoadingProgress = {0:P0}", e.NewValue); }));
|
||||
|
||||
private readonly DispatcherTimer updateTimer;
|
||||
private MapBase parentMap;
|
||||
|
||||
protected MapTileLayerBase(ITileImageLoader tileImageLoader)
|
||||
{
|
||||
RenderTransform = new MatrixTransform();
|
||||
|
||||
TileImageLoader = tileImageLoader;
|
||||
TileImageLoader.Progress = new Progress<double>(p => LoadingProgress = p);
|
||||
|
||||
updateTimer = this.CreateTimer(UpdateInterval);
|
||||
updateTimer.Tick += async (s, e) => await Update();
|
||||
|
|
@ -149,6 +157,15 @@ namespace MapControl
|
|||
set { SetValue(MapForegroundProperty, value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the progress of the TileImageLoader as a double value between 0 and 1.
|
||||
/// </summary>
|
||||
public double LoadingProgress
|
||||
{
|
||||
get { return (double)GetValue(LoadingProgressProperty); }
|
||||
private set { SetValue(LoadingProgressProperty, value); }
|
||||
}
|
||||
|
||||
public MapBase ParentMap
|
||||
{
|
||||
get { return parentMap; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue