DrawBezierCurve
(
IEdge oEdge,
GraphDrawingContext oGraphDrawingContext,
DrawingContext oDrawingContext,
Point oEdgeEndpoint1,
Point oEdgeEndpoint2,
Boolean bDrawAsSelected,
Boolean bDrawArrow,
Pen oPen,
Color oColor,
Double dWidth,
VisibilityKeyValue eVisibility,
String sLabel
)
{
Debug.Assert(oEdge != null);
Debug.Assert(oGraphDrawingContext != null);
Debug.Assert(oDrawingContext != null);
Debug.Assert(oPen != null);
AssertValid();
Point oBezierControlPoint = GetBezierControlPoint(oGraphDrawingContext,
oEdgeEndpoint1, oEdgeEndpoint2, m_dBezierDisplacementFactor);
if (bDrawArrow)
{
// When the edge is a Bezier curve, the arrow should be aligned
// along the tangent of the curve at the second endpoint. The
// tangent runs from the second endpoint to the Bezier control
// point.
Double dArrowAngle = WpfGraphicsUtil.GetAngleBetweenPointsRadians(
oBezierControlPoint, oEdgeEndpoint2);
// Draw the arrow and set the second endpoint to the center of the
// flat end of the arrow. Note that in the Bezier case, moving the
// second endpoint causes a small distortion of the Bezier curve.
oEdgeEndpoint2 = DrawArrow(oDrawingContext, oEdgeEndpoint2,
dArrowAngle, oColor, dWidth);
}
PathGeometry oBezierCurve =
WpfPathGeometryUtil.GetQuadraticBezierCurve(oEdgeEndpoint1,
oEdgeEndpoint2, oBezierControlPoint);
oDrawingContext.DrawGeometry(null, oPen, oBezierCurve);
if ( !String.IsNullOrEmpty(sLabel) )
{
DrawLabel(oEdge, oDrawingContext, oGraphDrawingContext,
bDrawAsSelected, oColor, eVisibility, oEdgeEndpoint1,
oEdgeEndpoint2, oBezierCurve, oBezierControlPoint, sLabel);
}
}