mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Avalonia MapPolygon, MapPolyline
This commit is contained in:
parent
bfa70de0cd
commit
cf08a2baae
9 changed files with 40 additions and 25 deletions
|
|
@ -141,14 +141,18 @@ namespace MapControl
|
|||
return longitudeOffset;
|
||||
}
|
||||
|
||||
protected void AddPolylinePoints(PathFigureCollection pathFigures, IEnumerable<Location> locations, bool closed)
|
||||
protected PathFigureCollection GetPathFigures(IEnumerable<Location> locations, bool closed)
|
||||
{
|
||||
var pathFigures = new PathFigureCollection();
|
||||
|
||||
if (parentMap != null && locations != null)
|
||||
{
|
||||
var longitudeOffset = GetLongitudeOffset(Location ?? locations.FirstOrDefault());
|
||||
|
||||
AddPolylinePoints(pathFigures, locations, longitudeOffset, closed);
|
||||
}
|
||||
|
||||
return pathFigures;
|
||||
}
|
||||
|
||||
protected void AddMultiPolygonPoints(PathFigureCollection pathFigures, IEnumerable<IEnumerable<Location>> polygons)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ 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
|
||||
|
||||
namespace MapControl
|
||||
|
|
@ -32,7 +35,7 @@ namespace MapControl
|
|||
/// <summary>
|
||||
/// Gets or sets the Locations that define the polygon points.
|
||||
/// </summary>
|
||||
#if WPF
|
||||
#if WPF || AVALONIA
|
||||
[System.ComponentModel.TypeConverter(typeof(LocationCollectionConverter))]
|
||||
#endif
|
||||
public IEnumerable<Location> Locations
|
||||
|
|
@ -54,9 +57,10 @@ namespace MapControl
|
|||
|
||||
protected override void UpdateData()
|
||||
{
|
||||
var figures = ((PathGeometry)Data).Figures;
|
||||
figures.Clear();
|
||||
AddPolylinePoints(figures, Locations, true);
|
||||
((PathGeometry)Data).Figures = GetPathFigures(Locations, true);
|
||||
#if AVALONIA
|
||||
InvalidateGeometry();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ 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
|
||||
|
||||
namespace MapControl
|
||||
|
|
@ -32,7 +35,7 @@ namespace MapControl
|
|||
/// <summary>
|
||||
/// Gets or sets the Locations that define the polyline points.
|
||||
/// </summary>
|
||||
#if WPF
|
||||
#if WPF || AVALONIA
|
||||
[System.ComponentModel.TypeConverter(typeof(LocationCollectionConverter))]
|
||||
#endif
|
||||
public IEnumerable<Location> Locations
|
||||
|
|
@ -54,9 +57,10 @@ namespace MapControl
|
|||
|
||||
protected override void UpdateData()
|
||||
{
|
||||
var figures = ((PathGeometry)Data).Figures;
|
||||
figures.Clear();
|
||||
AddPolylinePoints(figures, Locations, false);
|
||||
((PathGeometry)Data).Figures = GetPathFigures(Locations, false);
|
||||
#if AVALONIA
|
||||
InvalidateGeometry();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue