XAML-Map-Control/MapControl/Shared/Tile.cs

31 lines
824 B
C#
Raw Normal View History

2025-11-13 15:32:01 +01:00
using System;
using System.Threading.Tasks;
#if WPF
2024-05-22 11:25:32 +02:00
using System.Windows.Media;
2021-11-17 23:17:11 +01:00
#elif UWP
2018-12-02 20:22:59 +01:00
using Windows.UI.Xaml.Media;
2024-05-22 11:25:32 +02:00
#elif WINUI
using Microsoft.UI.Xaml.Media;
2025-08-19 19:43:02 +02:00
#elif AVALONIA
2025-11-13 15:32:01 +01:00
using ImageSource = Avalonia.Media.IImage;
#endif
2012-04-25 22:02:53 +02:00
namespace MapControl
{
2025-11-13 15:32:01 +01:00
public abstract class Tile(int zoomLevel, int x, int y, int columnCount)
2012-04-25 22:02:53 +02:00
{
2025-11-26 23:34:22 +01:00
public int ZoomLevel => zoomLevel;
public int X => x;
public int Y => y;
public int Row => y;
2025-09-15 17:46:31 +02:00
public int Column { get; } = ((x % columnCount) + columnCount) % columnCount;
2025-11-13 19:25:11 +01:00
2023-08-12 17:36:37 +02:00
public bool IsPending { get; set; } = true;
2025-11-13 15:32:01 +01:00
/// <summary>
2025-11-13 19:25:11 +01:00
/// Runs a tile image download Task and passes the result to the UI thread.
2025-11-13 15:32:01 +01:00
/// </summary>
public abstract Task LoadImageAsync(Func<Task<ImageSource>> loadImageFunc);
2012-04-25 22:02:53 +02:00
}
}