Version 4.4.1: MapPolygon for UWP in progress

This commit is contained in:
ClemensF 2018-02-12 23:28:32 +01:00
parent 6b024e2195
commit 946713b8eb
5 changed files with 8 additions and 14 deletions

View file

@ -32,7 +32,7 @@ namespace MapControl
var figures = ((PathGeometry)Data).Figures; var figures = ((PathGeometry)Data).Figures;
figures.Clear(); figures.Clear();
if (ParentMap != null && Locations != null) if (ParentMap != null && Locations != null && Locations.Count() >= 2)
{ {
var locations = Locations; var locations = Locations;
var offset = GetLongitudeOffset(); var offset = GetLongitudeOffset();
@ -43,12 +43,9 @@ namespace MapControl
} }
var points = locations.Select(loc => ParentMap.MapProjection.LocationToViewportPoint(loc)).ToList(); var points = locations.Select(loc => ParentMap.MapProjection.LocationToViewportPoint(loc)).ToList();
points.Add(points[0]);
if (points.Count >= 2) CreatePolylineFigures(points);
{
points.Add(points[0]);
CreatePolylineFigures(points);
}
} }
} }
} }

View file

@ -31,7 +31,7 @@ namespace MapControl
{ {
((PathGeometry)Data).Figures.Clear(); ((PathGeometry)Data).Figures.Clear();
if (ParentMap != null && Locations != null) if (ParentMap != null && Locations != null && Locations.Count() >= 2)
{ {
var locations = Locations; var locations = Locations;
var offset = GetLongitudeOffset(); var offset = GetLongitudeOffset();
@ -43,10 +43,7 @@ namespace MapControl
var points = locations.Select(loc => ParentMap.MapProjection.LocationToViewportPoint(loc)).ToList(); var points = locations.Select(loc => ParentMap.MapProjection.LocationToViewportPoint(loc)).ToList();
if (points.Count >= 2) CreatePolylineFigures(points);
{
CreatePolylineFigures(points);
}
} }
} }
} }

View file

@ -38,7 +38,7 @@ namespace MapControl
if (ParentMap != null && Polygons != null) if (ParentMap != null && Polygons != null)
{ {
foreach (var polygon in Polygons.Where(p => p.Any())) foreach (var polygon in Polygons.Where(p => p.Count() >= 2))
{ {
var points = polygon.Select(loc => LocationToPoint(loc)); var points = polygon.Select(loc => LocationToPoint(loc));
var polyline = new PolyLineSegment(points.Skip(1), true); var polyline = new PolyLineSegment(points.Skip(1), true);

View file

@ -33,7 +33,7 @@ namespace MapControl
{ {
Data.Figures.Clear(); Data.Figures.Clear();
if (ParentMap != null && Locations != null && Locations.Any()) if (ParentMap != null && Locations != null && Locations.Count() >= 2)
{ {
var points = Locations.Select(loc => LocationToPoint(loc)); var points = Locations.Select(loc => LocationToPoint(loc));
var polyline = new PolyLineSegment(points.Skip(1), true); var polyline = new PolyLineSegment(points.Skip(1), true);

View file

@ -33,7 +33,7 @@ namespace MapControl
{ {
Data.Figures.Clear(); Data.Figures.Clear();
if (ParentMap != null && Locations != null && Locations.Any()) if (ParentMap != null && Locations != null && Locations.Count() >= 2)
{ {
var points = Locations.Select(loc => LocationToPoint(loc)); var points = Locations.Select(loc => LocationToPoint(loc));
var polyline = new PolyLineSegment(points.Skip(1), true); var polyline = new PolyLineSegment(points.Skip(1), true);