2025-02-27 18:46:32 +01:00
|
|
|
|
using System.Collections.Generic;
|
2024-05-22 11:25:32 +02:00
|
|
|
|
#if WPF
|
|
|
|
|
|
using System.Windows;
|
2021-11-17 23:17:11 +01:00
|
|
|
|
#elif UWP
|
2018-04-10 22:34:34 +02:00
|
|
|
|
using Windows.UI.Xaml;
|
2024-05-22 11:25:32 +02:00
|
|
|
|
#elif WINUI
|
|
|
|
|
|
using Microsoft.UI.Xaml;
|
2018-04-10 22:34:34 +02:00
|
|
|
|
#endif
|
2018-02-09 17:43:47 +01:00
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// A polygon defined by a collection of Locations.
|
|
|
|
|
|
/// </summary>
|
2024-05-26 09:49:00 +02:00
|
|
|
|
public class MapPolygon : MapPolypoint
|
2018-02-09 17:43:47 +01:00
|
|
|
|
{
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty LocationsProperty =
|
2024-05-23 18:22:52 +02:00
|
|
|
|
DependencyPropertyHelper.Register<MapPolygon, IEnumerable<Location>>(nameof(Locations), null,
|
2024-05-23 18:08:14 +02:00
|
|
|
|
(polygon, oldValue, newValue) => polygon.DataCollectionPropertyChanged(oldValue, newValue));
|
2018-02-09 17:43:47 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets or sets the Locations that define the polygon points.
|
|
|
|
|
|
/// </summary>
|
2024-05-27 16:35:02 +02:00
|
|
|
|
#if WPF
|
2021-06-14 21:41:37 +02:00
|
|
|
|
[System.ComponentModel.TypeConverter(typeof(LocationCollectionConverter))]
|
2018-04-10 22:34:34 +02:00
|
|
|
|
#endif
|
2018-02-09 17:43:47 +01:00
|
|
|
|
public IEnumerable<Location> Locations
|
|
|
|
|
|
{
|
2022-08-06 10:40:59 +02:00
|
|
|
|
get => (IEnumerable<Location>)GetValue(LocationsProperty);
|
|
|
|
|
|
set => SetValue(LocationsProperty, value);
|
2018-02-09 17:43:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void UpdateData()
|
|
|
|
|
|
{
|
2024-05-26 09:49:00 +02:00
|
|
|
|
UpdateData(Locations, true);
|
2018-02-09 17:43:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|