public void BuildPolylineApproximation(Point startPoint) { if (PolylineApproximation == null) { PolylineApproximation = new Polyline(GetPiecewiseLinearApproximation(startPoint)); } }
public static IEnumerable<Path> CreatePaths(Polyline data) { var start = data.Points[0].ToPoint(); var isPolygon = data is Polygon; var geometry = new PathGeometry(new[] { new PathFigure(start, new[] { new PolyLineSegment(data.Points.Skip(1).Select(ToPoint), true) }, isPolygon) }); if (isPolygon) { yield return Visualizer.CreateFillPath(geometry); } var group = new GeometryGroup(); group.Children.Add(geometry); group.Children.Add(new EllipseGeometry(start, 1, 1)); yield return new Path { Data = group, Stroke = new SolidColorBrush(Colors.Black), StrokeThickness = 1 }; }