public static void StraightenLine(int orderInJunction, ObservablePointCollection viewHelperPointCollection, DiagramController controller) { JunctionPointCommand junctionPointCommand = CreateSraightenLineCommand(orderInJunction, viewHelperPointCollection, controller); junctionPointCommand.Execute(); }
public static JunctionPointCommand CreateBreakLineCommand(Point p, int orderInJunction, ObservablePointCollection pointCollection, DiagramController controller) { JunctionPointCommand junctionPointCommand = (JunctionPointCommand)JunctionPointCommandFactory.Factory().Create(controller); junctionPointCommand.Action = JunctionPointCommand.EJunctionPointAction.AddPoint; junctionPointCommand.NewPoint = p; junctionPointCommand.PointIndex = orderInJunction; junctionPointCommand.ViewHelperPointCollection = pointCollection; return(junctionPointCommand); }
public void RemoveBreakPoint(int orderInJunction, ObservablePointCollection viewHelperPointCollection) { ViewController.StraightenLine(orderInJunction, viewHelperPointCollection, DiagramController); }
public void AddBreakPoint(Point point, int orderInJunction, ObservablePointCollection viewHelperPointCollection) { ViewController.BreakLine(point, orderInJunction, viewHelperPointCollection, DiagramController); }
public static void DeserializePointsCollection(this IExolutioSerializable component, ObservablePointCollection points, XElement parentNode, SerializationContext context) { XElement pointsElement = parentNode.Element(context.ExolutioNS + "Points"); foreach (XElement pointElement in pointsElement.Elements()) { double x = double.Parse(component.DeserializeSimpleValueFromAttribute("X", pointElement, context)); double y = double.Parse(component.DeserializeSimpleValueFromAttribute("Y", pointElement, context)); points.Add(new rPoint(x, y)); } }
/// <summary> /// News the connection. /// </summary> /// <param name="sourceElement">source element</param> /// <param name="sourceViewHelper">view helper for the association end that is related to <paramref name="sourceElement"/>, /// can be set to null if <paramref name="sourceElement"/> has not an association end for this connection.</param> /// <param name="targetElement">target element</param> /// <param name="targetViewHelper">view helper for the association end that is related to <paramref name="targetElement"/>, /// can be set to null if <paramref name="targetElement"/> has not an association end for this connection.</param> /// <param name="points">collection of points for the junction (usually part of some ViewHelper), the junction reflects /// all changes in the collection</param> public void NewConnection( IConnectable sourceElement, AssociationEndViewHelper sourceViewHelper, IConnectable targetElement, AssociationEndViewHelper targetViewHelper, ObservablePointCollection points) { foreach (JunctionPoint point in Points) { point.DeleteFromCanvas(); } Points.Clear(); if (points == null) { throw new ArgumentNullException("points"); } if (points.Count < 2) { throw new ArgumentException("There must be at last two points to set a connection.", "points"); } SourceElement = (Control)sourceElement; TargetElement = (Control)targetElement; JunctionPoint startPoint; if (sourceViewHelper != null) { startPoint = ((ICreatesAssociationEnd)sourceElement).CreateAssociationEnd(points.First(), sourceViewHelper, sourceViewHelper.AssociationEnd); ((PIM_AssociationEnd)startPoint).Association = Association; } else { startPoint = (sourceElement).CreateJunctionEnd(points.First()); } startPoint.ContextMenu = null; startPoint.Junction = this; startPoint.OrderInJunction = 0; Points.Add(startPoint); JunctionPoint endPoint; if (targetViewHelper != null) { endPoint = ((ICreatesAssociationEnd)targetElement).CreateAssociationEnd(points.Last(), targetViewHelper, targetViewHelper.AssociationEnd); ((PIM_AssociationEnd)endPoint).Association = Association; } else { endPoint = targetElement.CreateJunctionEnd(points.Last()); } endPoint.ContextMenu = null; endPoint.Junction = this; endPoint.OrderInJunction = 1; Points.Add(endPoint); if (startPoint is PIM_AssociationEnd) { ((PIM_AssociationEnd)startPoint).StartBindings(); } if (endPoint is PIM_AssociationEnd) { ((PIM_AssociationEnd)endPoint).StartBindings(); } int zindex = Math.Min(Panel.GetZIndex(SourceElement), Panel.GetZIndex(TargetElement)); zindex--; Canvas.SetZIndex(this, zindex - 1); UpdateLayout(); for (int i = 1; i < points.Count - 1; i++) { Point point = points[i]; BreakLine(point, i); } SourceElement.SizeChanged += SourceElement_SizeChanged; TargetElement.SizeChanged += TargetElement_SizeChanged; AutoPosModeOnly = AutoPosModeOnly; InvalidateGeometry(); }
/// <summary> /// Initializes a new instance of the <see cref="XCaseJunction"/> class. /// </summary> /// <param name="xCaseCanvas">canvas where the control is placed</param> /// <param name="generalization">generalization that owns the junction</param> /// <param name="viewHelperPointsCollection">Reference to a collection of points (in ViewHelper)</param> public XCaseJunction(XCaseCanvas xCaseCanvas, PIM_Generalization generalization, ObservablePointCollection viewHelperPointsCollection) : this(xCaseCanvas, viewHelperPointsCollection) { this.Generalization = generalization; this.SelectionOwner = generalization; InitializeContextMenu(); }