/// <summary> /// Creates a point on a linear figure (ILinearFigure) /// </summary> /// <param name="drawing">Drawing to add the figure to</param> /// <param name="figure">A linear figure such as a line or a circle</param> /// <param name="parameter">A double parameter that defines the /// position of the point on the figure /// [0, 2 * PI) for circles, [0, 1] for segments, etc. </param> /// <returns>The newly created point on the figure</returns> public static PointOnFigure CreatePointOnFigure(Drawing drawing, IFigure figure, double parameter) { var result = new PointOnFigure() { Drawing = drawing, Dependencies = new [] { figure }, }; result.Parameter = parameter; return(result); }
/// <summary> /// Creates a point on a linear figure (ILinearFigure) /// </summary> /// <param name="drawing">Drawing to add the figure to</param> /// <param name="iFigure">A linear figure such as a line or a circle</param> /// <param name="point">Hint point coordinates - this point will be /// projected on to the figure if it's not already on it</param> /// <returns>The newly created point on the figure</returns> public static PointOnFigure CreatePointOnFigure(Drawing drawing, IFigure iFigure, Point point) { var result = new PointOnFigure() { Drawing = drawing, Dependencies = new [] { iFigure }, }; result.Parameter = result.LinearFigure.GetNearestParameterFromPoint(point); return(result); }
public override void MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { var coordinates = Coordinates(e); var list = Drawing.Figures.HitTestMany(coordinates); var figureList = list.Where(f => f is ILinearFigure).ToArray(); IFigure created = null; if (!figureList.IsEmpty()) { if (figureList.Length == 2 && IntersectionAlgorithms.CanIntersect(figureList[0], figureList[1])) { created = Factory.CreateIntersectionPoint( Drawing, figureList[0], figureList[1], coordinates); Actions.Add(Drawing, created); } else if (figureList.Length == 1 && PointOnFigure.CanBeOnFigure(figureList[0])) { created = Factory.CreatePointOnFigure( Drawing, figureList[0], coordinates); Actions.Add(Drawing, created); } } else { created = CreatePointAtCurrentPosition(coordinates); } if (created != null && dialog != null && dialog.Style != null) { created.Style = dialog.Style; } }
/// <summary> /// Creates a point on a linear figure (ILinearFigure) /// </summary> /// <param name="drawing">Drawing to add the figure to</param> /// <param name="figure">A linear figure such as a line or a circle</param> /// <param name="parameter">A double parameter that defines the /// position of the point on the figure /// [0, 2 * PI) for circles, [0, 1] for segments, etc. </param> /// <returns>The newly created point on the figure</returns> public static PointOnFigure CreatePointOnFigure(Drawing drawing, IFigure figure, double parameter) { var result = new PointOnFigure() { Drawing = drawing, Dependencies = new [] { figure }, }; result.Parameter = parameter; return result; }
/// <summary> /// Creates a point on a linear figure (ILinearFigure) /// </summary> /// <param name="drawing">Drawing to add the figure to</param> /// <param name="iFigure">A linear figure such as a line or a circle</param> /// <param name="point">Hint point coordinates - this point will be /// projected on to the figure if it's not already on it</param> /// <returns>The newly created point on the figure</returns> public static PointOnFigure CreatePointOnFigure(Drawing drawing, IFigure iFigure, Point point) { var result = new PointOnFigure() { Drawing = drawing, Dependencies = new [] { iFigure }, }; result.Parameter = result.LinearFigure.GetNearestParameterFromPoint(point); return result; }
List<IFigure> GetFiguresToRecalculate(PointOnFigure pointOnFigure, IPoint dependentPoint) { return DependencyAlgorithms.FindImpactedDependencyChain(pointOnFigure, dependentPoint); }
List <IFigure> GetFiguresToRecalculate(PointOnFigure pointOnFigure, IPoint dependentPoint) { return(DependencyAlgorithms.FindImpactedDependencyChain(pointOnFigure, dependentPoint)); }