2017-06-25 23:05:48 +02:00
|
|
|
|
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
2020-01-09 19:40:10 +01:00
|
|
|
|
// © 2020 Clemens Fischer
|
2012-05-04 12:52:20 +02:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
2017-08-04 21:38:58 +02:00
|
|
|
|
#if WINDOWS_UWP
|
2018-08-15 23:29:03 +02:00
|
|
|
|
using Windows.UI.Xaml;
|
2014-07-01 18:57:44 +02:00
|
|
|
|
using Windows.UI.Xaml.Controls;
|
2018-12-02 20:22:59 +01:00
|
|
|
|
using Windows.UI.Xaml.Media;
|
2018-08-15 23:29:03 +02:00
|
|
|
|
using Windows.UI.Xaml.Media.Animation;
|
2014-07-01 18:57:44 +02:00
|
|
|
|
#else
|
2018-08-15 23:29:03 +02:00
|
|
|
|
using System.Windows;
|
2014-07-01 18:57:44 +02:00
|
|
|
|
using System.Windows.Controls;
|
2018-12-02 20:22:59 +01:00
|
|
|
|
using System.Windows.Media;
|
2018-08-15 23:29:03 +02:00
|
|
|
|
using System.Windows.Media.Animation;
|
2014-07-01 18:57:44 +02:00
|
|
|
|
#endif
|
2012-04-25 22:02:53 +02:00
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
2013-01-03 15:33:46 +01:00
|
|
|
|
public partial class Tile
|
2012-04-25 22:02:53 +02:00
|
|
|
|
{
|
|
|
|
|
|
public readonly int ZoomLevel;
|
|
|
|
|
|
public readonly int X;
|
|
|
|
|
|
public readonly int Y;
|
2018-12-02 20:22:59 +01:00
|
|
|
|
public readonly Image Image = new Image { Opacity = 0d, Stretch = Stretch.Fill };
|
2012-04-25 22:02:53 +02:00
|
|
|
|
|
2012-06-18 20:12:35 +02:00
|
|
|
|
public Tile(int zoomLevel, int x, int y)
|
2012-04-25 22:02:53 +02:00
|
|
|
|
{
|
|
|
|
|
|
ZoomLevel = zoomLevel;
|
|
|
|
|
|
X = x;
|
|
|
|
|
|
Y = y;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-07-17 21:31:09 +02:00
|
|
|
|
public bool Pending { get; set; } = true;
|
2012-04-25 22:02:53 +02:00
|
|
|
|
|
|
|
|
|
|
public int XIndex
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2012-11-22 21:42:29 +01:00
|
|
|
|
var numTiles = 1 << ZoomLevel;
|
2012-04-25 22:02:53 +02:00
|
|
|
|
return ((X % numTiles) + numTiles) % numTiles;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-15 23:29:03 +02:00
|
|
|
|
|
|
|
|
|
|
private void FadeIn()
|
|
|
|
|
|
{
|
2020-04-19 10:53:25 +02:00
|
|
|
|
Image.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation
|
|
|
|
|
|
{
|
|
|
|
|
|
From = 0d,
|
|
|
|
|
|
To = 1d,
|
|
|
|
|
|
Duration = MapBase.TileFadeDuration,
|
|
|
|
|
|
FillBehavior = FillBehavior.Stop
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2018-08-15 23:29:03 +02:00
|
|
|
|
Image.Opacity = 1d;
|
|
|
|
|
|
}
|
2012-04-25 22:02:53 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|