public static int PointCount(PathFigure figure) { int num = 1; foreach (PathSegment segment in figure.Segments) { num += PathSegmentUtilities.GetPointCount(segment); } if (PathFigureUtilities.IsClosed(figure) && PathFigureUtilities.IsCloseSegmentDegenerate(figure)) { --num; } return(num); }
public static bool IsOpen(PathFigure figure) { return(!PathFigureUtilities.IsClosed(figure)); }
public static void SetPoint(PathFigure pathFigure, int pointIndex, Point point) { if (pointIndex == 0 || pointIndex == PathFigureUtilities.PointCount(pathFigure) && PathFigureUtilities.IsClosed(pathFigure) && !PathFigureUtilities.IsCloseSegmentDegenerate(pathFigure)) { pathFigure.StartPoint = point; } else { PathSegmentCollection segments = pathFigure.Segments; int segmentIndex; int segmentPointIndex; PathFigureUtilities.GetSegmentFromPointIndex(pathFigure, pointIndex, out segmentIndex, out segmentPointIndex); PathSegmentUtilities.SetPoint(segments[segmentIndex], segmentPointIndex, point); } }