private void CalculateLineNoSpot(DiagramShape fromObj, DiagramPort from, DiagramShape toObj, DiagramPort to) { this.ClearPoints(); PointF tf1 = fromObj.Center; PointF tf2 = toObj.Center; if (from == null) { if (!fromObj.GetNearestIntersectionPoint(tf2, tf1, out tf1)) { tf1 = fromObj.Center; } } else { tf1 = from.GetFromLinkPoint(this.AbstractLink); } if (to == null) { if (!toObj.GetNearestIntersectionPoint(tf1, tf2, out tf2)) { tf2 = toObj.Center; } } else { tf2 = to.GetToLinkPoint(this.AbstractLink); } this.AddPoint(tf1); this.AddPoint(tf2); }
private void CalculateBezierNoSpot(DiagramShape fromObj, DiagramPort from, DiagramShape toObj, DiagramPort to) { this.ClearPoints(); PointF tf1 = fromObj.Center; PointF tf2 = toObj.Center; if (from == null) { if (!fromObj.GetNearestIntersectionPoint(tf2, tf1, out tf1)) { tf1 = fromObj.Center; } } else { tf1 = from.GetFromLinkPoint(this.AbstractLink); } if (to == null) { if (!toObj.GetNearestIntersectionPoint(tf1, tf2, out tf2)) { tf2 = toObj.Center; } } else { tf2 = to.GetToLinkPoint(this.AbstractLink); } float single1 = tf2.X - tf1.X; float single2 = tf2.Y - tf1.Y; System.Math.Sqrt((double)((single1 * single1) + (single2 * single2))); float single3 = this.Curviness; float single4 = System.Math.Abs(single3); if (single3 < 0f) { single4 = -single4; } float single5 = 0f; float single6 = 0f; float single7 = tf1.X + (single1 / 3f); float single8 = tf1.Y + (single2 / 3f); float single9 = single7; float single10 = single8; if (base.IsApprox(single2, (float)0f)) { if (single1 > 0f) { single10 -= single4; } else { single10 += single4; } } else { single5 = -single1 / single2; single6 = (float)System.Math.Sqrt((double)((single4 * single4) / ((single5 * single5) + 1f))); if (single3 < 0f) { single6 = -single6; } single9 = (((single2 < 0f) ? ((float)(-1)) : ((float)1)) * single6) + single7; single10 = (single5 * (single9 - single7)) + single8; } single7 = tf1.X + ((2f * single1) / 3f); single8 = tf1.Y + ((2f * single2) / 3f); float single11 = single7; float single12 = single8; if (base.IsApprox(single2, (float)0f)) { if (single1 > 0f) { single12 -= single4; } else { single12 += single4; } } else { single11 = (((single2 < 0f) ? ((float)(-1)) : ((float)1)) * single6) + single7; single12 = (single5 * (single11 - single7)) + single8; } this.AddPoint(tf1); base.AddPoint(single9, single10); base.AddPoint(single11, single12); this.AddPoint(tf2); this.SetPoint(0, from.GetFromLinkPoint(this.AbstractLink)); this.SetPoint(3, to.GetToLinkPoint(this.AbstractLink)); }