public static void SetLastPoint(PathSegment segment, Point point) { if (PathSegmentUtilities.IsEmpty(segment)) { throw new ArgumentException(ExceptionStringTable.CannotGetLastPointFromAnEmptySegment, "segment"); } PathSegmentUtilities.SetPoint(segment, PathSegmentUtilities.GetPointCount(segment) - 1, point); }
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); } }