XAML-Map-Control/MapControl/Tile.cs

42 lines
982 B
C#
Raw Normal View History

// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// © 2017 Clemens Fischer
2012-05-04 12:52:20 +02:00
// Licensed under the Microsoft Public License (Ms-PL)
using System;
#if NETFX_CORE
using Windows.UI.Xaml.Controls;
#else
using System.Windows.Controls;
#endif
2012-04-25 22:02:53 +02:00
namespace MapControl
{
public partial class Tile
2012-04-25 22:02:53 +02:00
{
2017-07-17 21:31:09 +02:00
public static TimeSpan FadeDuration { get; set; } = TimeSpan.FromSeconds(0.1);
2012-04-25 22:02:53 +02:00
public readonly int ZoomLevel;
public readonly int X;
public readonly int Y;
public readonly Image Image = new Image { Opacity = 0d };
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
{
var numTiles = 1 << ZoomLevel;
2012-04-25 22:02:53 +02:00
return ((X % numTiles) + numTiles) % numTiles;
}
}
}
}