2025-02-27 18:46:32 +01:00
|
|
|
|
using System.Collections.Generic;
|
2024-07-16 21:29:25 +02:00
|
|
|
|
#if WPF
|
2018-02-09 17:43:47 +01:00
|
|
|
|
using System.Windows;
|
2024-07-16 21:29:25 +02:00
|
|
|
|
#elif UWP
|
|
|
|
|
|
using Windows.UI.Xaml;
|
|
|
|
|
|
#elif WINUI
|
|
|
|
|
|
using Microsoft.UI.Xaml;
|
|
|
|
|
|
#endif
|
2018-02-09 17:43:47 +01:00
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// A multi-polygon defined by a collection of collections of Locations.
|
2024-05-26 09:49:00 +02:00
|
|
|
|
/// Allows to draw filled polygons with holes.
|
2018-02-09 17:43:47 +01:00
|
|
|
|
///
|
|
|
|
|
|
/// A PolygonCollection (with ObservableCollection of Location elements) may be used
|
|
|
|
|
|
/// for the Polygons property if collection changes of the property itself and its
|
2023-01-24 16:22:02 +01:00
|
|
|
|
/// elements are both supposed to trigger UI updates.
|
2018-02-09 17:43:47 +01:00
|
|
|
|
/// </summary>
|
2025-09-15 17:46:31 +02:00
|
|
|
|
public partial class MapMultiPolygon : MapPolypoint
|
2018-02-09 17:43:47 +01:00
|
|
|
|
{
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty PolygonsProperty =
|
2024-05-23 18:22:52 +02:00
|
|
|
|
DependencyPropertyHelper.Register<MapMultiPolygon, IEnumerable<IEnumerable<Location>>>(nameof(Polygons), 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 multi-polygon points.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public IEnumerable<IEnumerable<Location>> Polygons
|
|
|
|
|
|
{
|
2022-08-06 10:40:59 +02:00
|
|
|
|
get => (IEnumerable<IEnumerable<Location>>)GetValue(PolygonsProperty);
|
|
|
|
|
|
set => SetValue(PolygonsProperty, value);
|
2018-02-09 17:43:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void UpdateData()
|
|
|
|
|
|
{
|
2024-05-26 09:49:00 +02:00
|
|
|
|
UpdateData(Polygons);
|
2018-02-09 17:43:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|