/// <summary> /// Previews the route wire to point. /// </summary> /// <param name="joint">The joint.</param> /// <param name="userHint">The user hint.</param> /// <param name="endDirections">The end directions.</param> /// <param name="point">The point.</param> /// <param name="isBranchingOperation">if set to <c>true</c> [is branching operation].</param> /// <param name="retainPreviousRoute">if set to <c>true</c> [retain previous route].</param> /// <param name="forceLayout">if set to <c>true</c> [force layout].</param> /// <returns>List of Diagram Points</returns> public IList <DiagramPoint> PreviewRouteWireToPoint(WireJoint joint, WireRouteHint userHint, WireRouteDirections endDirections, DiagramPoint point, bool isBranchingOperation, bool retainPreviousRoute, bool forceLayout) { SMPoint p = point.TransformTo(joint.Wire.Diagram).Point; double dx = p.X - joint.X; double dy = p.Y - joint.Y; // if the points are on top of each other do nothing if (WireJoint.JointEqual((float)dx, 0) && WireJoint.JointEqual((float)dy, 0)) { return(new List <DiagramPoint>()); } return(new List <DiagramPoint>(new[] { point })); }
/// <summary> /// Gets the near wire children. /// </summary> /// <inheritdoc /> public override IEnumerable <NearWireChild> GetNearWireChildren(DiagramPoint point, float threshold, bool considerOrthogonalSegmentsOnly) { if (Owner == null || !(Owner is Diagram)) { throw new ArgumentException("Wire must be a child of a Diagram", "wire"); } SMPoint position = point.TransformTo(Diagram).Point; foreach (var joint in Joints) { float distance = joint.GetDistance(position); if (distance <= Math.Max(threshold, WireJoint.JointPrecisionDigits)) { yield return(new NearWireChild(joint, point, distance)); } } }