Version 4.4.1: MapPolygon for UWP in progress

This commit is contained in:
ClemensF 2018-02-13 20:11:16 +01:00
parent 946713b8eb
commit 2f828fbe2d
7 changed files with 64 additions and 30 deletions

View file

@ -18,6 +18,11 @@ namespace MapControl
nameof(Locations), typeof(IEnumerable<Location>), typeof(MapPolygon),
new PropertyMetadata(null, (o, e) => ((MapPolygon)o).LocationsPropertyChanged(e)));
public MapPolygon()
: base(new PathGeometry())
{
}
/// <summary>
/// Gets or sets the Locations that define the polyline points.
/// </summary>
@ -29,8 +34,7 @@ namespace MapControl
protected override void UpdateData()
{
var figures = ((PathGeometry)Data).Figures;
figures.Clear();
((PathGeometry)Data).Figures.Clear();
if (ParentMap != null && Locations != null && Locations.Count() >= 2)
{
@ -42,7 +46,7 @@ namespace MapControl
locations = locations.Select(loc => new Location(loc.Latitude, loc.Longitude + offset));
}
var points = locations.Select(loc => ParentMap.MapProjection.LocationToViewportPoint(loc)).ToList();
var points = locations.Select(loc => LocationToViewportPoint(loc)).ToList();
points.Add(points[0]);
CreatePolylineFigures(points);

View file

@ -18,6 +18,11 @@ namespace MapControl
nameof(Locations), typeof(IEnumerable<Location>), typeof(MapPolyline),
new PropertyMetadata(null, (o, e) => ((MapPolyline)o).LocationsPropertyChanged(e)));
public MapPolyline()
: base(new PathGeometry())
{
}
/// <summary>
/// Gets or sets the Locations that define the polyline points.
/// </summary>
@ -41,7 +46,7 @@ namespace MapControl
locations = locations.Select(loc => new Location(loc.Latitude, loc.Longitude + offset));
}
var points = locations.Select(loc => ParentMap.MapProjection.LocationToViewportPoint(loc)).ToList();
var points = locations.Select(loc => LocationToViewportPoint(loc)).ToList();
CreatePolylineFigures(points);
}