mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-08 16:05:50 +00:00
Added MapPolypoint base class
This commit is contained in:
parent
aeb3fd047f
commit
84890090f8
11 changed files with 357 additions and 317 deletions
|
|
@ -5,15 +5,11 @@
|
|||
using System.Collections.Generic;
|
||||
#if WPF
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
#elif UWP
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Media;
|
||||
#elif WINUI
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
#elif AVALONIA
|
||||
using Avalonia.Media;
|
||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
||||
#endif
|
||||
|
||||
|
|
@ -22,16 +18,12 @@ namespace MapControl
|
|||
/// <summary>
|
||||
/// A polygon defined by a collection of Locations.
|
||||
/// </summary>
|
||||
public class MapPolygon : MapPath
|
||||
public class MapPolygon : MapPolypoint
|
||||
{
|
||||
public static readonly DependencyProperty LocationsProperty =
|
||||
DependencyPropertyHelper.Register<MapPolygon, IEnumerable<Location>>(nameof(Locations), null,
|
||||
(polygon, oldValue, newValue) => polygon.DataCollectionPropertyChanged(oldValue, newValue));
|
||||
|
||||
public static readonly DependencyProperty FillRuleProperty =
|
||||
DependencyPropertyHelper.Register<MapPolygon, FillRule>(nameof(FillRule), FillRule.EvenOdd,
|
||||
(polygon, oldValue, newValue) => ((PathGeometry)polygon.Data).FillRule = newValue);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Locations that define the polygon points.
|
||||
/// </summary>
|
||||
|
|
@ -44,20 +36,9 @@ namespace MapControl
|
|||
set => SetValue(LocationsProperty, value);
|
||||
}
|
||||
|
||||
public FillRule FillRule
|
||||
{
|
||||
get => (FillRule)GetValue(FillRuleProperty);
|
||||
set => SetValue(FillRuleProperty, value);
|
||||
}
|
||||
|
||||
public MapPolygon()
|
||||
{
|
||||
Data = new PathGeometry();
|
||||
}
|
||||
|
||||
protected override void UpdateData()
|
||||
{
|
||||
SetPathFigures(GetPathFigures(Locations, true));
|
||||
UpdateData(Locations, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue