Exemplo n.º 1
0
        DrawCombinedIntergroupEdge
        (
            DrawingContext oDrawingContext,
            GraphDrawingContext oGraphDrawingContext,
            IntergroupEdgeInfo oCombinedIntergroupEdge,
            GroupLayoutDrawingInfo oGroupLayoutDrawingInfo
        )
        {
            Debug.Assert(oDrawingContext != null);
            Debug.Assert(oGraphDrawingContext != null);
            Debug.Assert(oCombinedIntergroupEdge != null);
            Debug.Assert(oGroupLayoutDrawingInfo != null);
            AssertValid();

            Rect oGroupRectangle1, oGroupRectangle2;

            if (
                !TryGetGroupRectangle(

                    oGroupLayoutDrawingInfo.GroupsToDraw[
                        oCombinedIntergroupEdge.Group1Index],

                    out oGroupRectangle1)
                ||
                !TryGetGroupRectangle(

                    oGroupLayoutDrawingInfo.GroupsToDraw[
                        oCombinedIntergroupEdge.Group2Index],

                    out oGroupRectangle2)
                )
            {
                return;
            }

            Point oGroupRectangle1Center =
                WpfGraphicsUtil.GetRectCenter(oGroupRectangle1);

            Point oGroupRectangle2Center =
                WpfGraphicsUtil.GetRectCenter(oGroupRectangle2);

            Point oBezierControlPoint = GetBezierControlPoint(oGraphDrawingContext,
                                                              oGroupRectangle1Center, oGroupRectangle2Center,
                                                              CombinedIntergroupEdgeBezierDisplacementFactor
                                                              );

            PathGeometry oBezierCurve =
                WpfPathGeometryUtil.GetQuadraticBezierCurve(oGroupRectangle1Center,
                                                            oGroupRectangle2Center, oBezierControlPoint);

            Color oColor = GetContrastingColor(
                oGraphDrawingContext, CombinedIntergroupEdgeAlpha, true);

            Pen oPen = CreateFrozenPen(CreateFrozenSolidColorBrush(oColor),

                                       GetCombinedIntergroupEdgePenWidth(oCombinedIntergroupEdge) *
                                       this.GraphScale,

                                       DashStyles.Solid, PenLineCap.Round);

            oDrawingContext.DrawGeometry(null, oPen, oBezierCurve);
        }