static List <ConnectionPoint> GetAllConnectionPoints(UIElement shape) { List <ConnectionPoint> allConnectionPoints = new List <ConnectionPoint>(6); allConnectionPoints.AddRange(FlowchartDesigner.GetConnectionPoints(shape)); allConnectionPoints.Add(FlowchartDesigner.GetTrueConnectionPoint(shape)); allConnectionPoints.Add(FlowchartDesigner.GetFalseConnectionPoint(shape)); return(allConnectionPoints); }
ConnectionPoint ConnectionPointHitTest(UIElement element, Point hitPoint) { List <ConnectionPoint> connectionPoints = new List <ConnectionPoint>(); List <ConnectionPoint> defaultConnectionPoints = FlowchartDesigner.GetConnectionPoints(element); connectionPoints.InsertRange(0, defaultConnectionPoints); connectionPoints.Add(FlowchartDesigner.GetTrueConnectionPoint(element)); connectionPoints.Add(FlowchartDesigner.GetFalseConnectionPoint(element)); return(FreeFormPanel.ConnectionPointHitTest(hitPoint, connectionPoints, this.panel)); }
/// <summary> /// for connection: /// 1. return all free connection points are available on the object /// 2. return any existing points that are already connected on the object, excluding the unmatched type. /// Fallback: return all connection points of the given object /// </summary> /// <param name="sourceConnectionPoint"></param> /// <param name="dest"></param> /// <param name="errorMessage"></param> /// <returns></returns> ConnectionPoint FindBestMatchDestConnectionPoint(ConnectionPoint sourceConnectionPoint, UIElement dest, out string errorMessage) { List <ConnectionPoint> destConnPoints = FlowchartDesigner.GetConnectionPoints(dest); Fx.Assert(null != destConnPoints && destConnPoints.Any(), "A flownode designer object should have one connection point."); errorMessage = string.Empty; if (sourceConnectionPoint.PointType == ConnectionPointKind.Incoming) { errorMessage = SR.FCInvalidLink; return(null); } ConnectionPoint destConnectionPoint; double minDist; List <ConnectionPoint> candidateDestConnPoints = FindCandidatePointsForLink(destConnPoints, ConnectionPointKind.Outgoing); destConnectionPoint = FindClosestConnectionPoint(sourceConnectionPoint, candidateDestConnPoints, out minDist); return(destConnectionPoint); }
internal bool CreateLinkGesture(UIElement source, ConnectionPoint destConnectionPoint, Point mouseLocation, out string errorMessage, bool isLinkValidDueToLinkMove, IFlowSwitchLink caseKey) { bool linkCreated = false; double minDist; errorMessage = string.Empty; ConnectionPoint sourceConnectionPoint = FindClosestConnectionPoint( mouseLocation, FlowchartDesigner.GetConnectionPoints(source).Where(p => p.PointType != ConnectionPointKind.Incoming).ToList(), out minDist); if (sourceConnectionPoint != null) { linkCreated = CreateLinkGesture(sourceConnectionPoint, destConnectionPoint, out errorMessage, isLinkValidDueToLinkMove, caseKey); } else { errorMessage = SR.FCInvalidLink; } return(linkCreated); }