mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
MapPolypoint implementation
This commit is contained in:
parent
fa508f51e7
commit
b573bafb48
2 changed files with 46 additions and 21 deletions
|
|
@ -80,36 +80,34 @@ namespace MapControl
|
|||
if (points.Any())
|
||||
{
|
||||
var startPoint = points.First();
|
||||
var polylineSegment = new PolyLineSegment();
|
||||
var minX = startPoint.X;
|
||||
var maxX = startPoint.X;
|
||||
var minY = startPoint.Y;
|
||||
var maxY = startPoint.Y;
|
||||
|
||||
var figure = new PathFigure
|
||||
{
|
||||
StartPoint = startPoint,
|
||||
IsClosed = closed,
|
||||
IsFilled = true
|
||||
};
|
||||
|
||||
var polyline = new PolyLineSegment();
|
||||
|
||||
foreach (var point in points.Skip(1))
|
||||
{
|
||||
polylineSegment.Points.Add(point);
|
||||
minX = Math.Min(minX, point.X);
|
||||
maxX = Math.Max(maxX, point.X);
|
||||
minY = Math.Min(minY, point.Y);
|
||||
maxY = Math.Max(maxY, point.Y);
|
||||
polyline.Points.Add(point);
|
||||
}
|
||||
|
||||
if (maxX >= 0 && minX <= ParentMap.ActualWidth &&
|
||||
maxY >= 0 && minY <= ParentMap.ActualHeight)
|
||||
{
|
||||
figure.Segments.Add(polyline);
|
||||
}
|
||||
var pathFigure = new PathFigure
|
||||
{
|
||||
StartPoint = startPoint,
|
||||
IsClosed = closed,
|
||||
IsFilled = true
|
||||
};
|
||||
|
||||
pathFigures.Add(figure);
|
||||
pathFigure.Segments.Add(polylineSegment);
|
||||
pathFigures.Add(pathFigure);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue