Contains information about the edges that connect the vertices in one vertex group to the vertices in another vertex group.
The groups are assumed to be stored in some external indexed collection. This class stores the indexes of two groups, along with metrics for the edges that connect the groups.
Inheritance: Object
コード例 #1
0
    GetCombinedIntergroupEdgePenWidth
    (
        IntergroupEdgeInfo oCombinedIntergroupEdge
    )
    {
        Debug.Assert(oCombinedIntergroupEdge != null);
        AssertValid();

        return (MathUtil.TransformValueToRange(
            (Single)oCombinedIntergroupEdge.EdgeWeightSum,
            CombinedIntergroupEdgeMinimumCount,
            CombinedIntergroupEdgeMaximumCount,
            CombinedIntergroupEdgeMinimumWidth,
            CombinedIntergroupEdgeMaximumWidth
            ) );
    }
コード例 #2
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);
    }
コード例 #3
0
    TestConstructor()
    {
        const Int32 Group1Index = 0;
        const Int32 Group2Index = 12;
        const Int32 Edges = 1;
        const Double EdgeWeightSum = 1.234;

        IntergroupEdgeInfo oIntergroupEdgeInfo =
            new IntergroupEdgeInfo(Group1Index, Group2Index, Edges,
                EdgeWeightSum);

        Assert.AreEqual(Group1Index, oIntergroupEdgeInfo.Group1Index);
        Assert.AreEqual(Group2Index, oIntergroupEdgeInfo.Group2Index);
        Assert.AreEqual(Edges, oIntergroupEdgeInfo.Edges);
        Assert.AreEqual(EdgeWeightSum, oIntergroupEdgeInfo.EdgeWeightSum);

        oIntergroupEdgeInfo.Edges++;
        Assert.AreEqual(Edges + 1, oIntergroupEdgeInfo.Edges);
    }
コード例 #4
0
    CompareIntergroupEdges
    (
        IntergroupEdgeInfo oIntergroupEdge1,
        IntergroupEdgeInfo oIntergroupEdge2
    )
    {
        Debug.Assert(oIntergroupEdge1 != null);
        Debug.Assert(oIntergroupEdge2 != null);

        // Sort first by Group1Index, then Group2Index.

        Int32 iReturnValue = oIntergroupEdge1.Group1Index.CompareTo(
            oIntergroupEdge2.Group1Index);

        if (iReturnValue == 0)
        {
            iReturnValue = oIntergroupEdge1.Group2Index.CompareTo(
                oIntergroupEdge2.Group2Index);
        }

        return (iReturnValue);
    }
コード例 #5
0
    CountIncidentEdge
    (
        IEdge oIntergroupEdge,
        Int32 iGroup1Index,
        Int32 iGroup2Index,
        IList<IntergroupEdgeInfo> oIntergroupEdges,
        Dictionary<Int32, IntergroupEdgeInfo> oIntergroupEdgeIndexes
    )
    {
        Debug.Assert(oIntergroupEdge != null);
        Debug.Assert(iGroup1Index >= 0);
        Debug.Assert(iGroup2Index >= 0);
        Debug.Assert(oIntergroupEdges != null);
        Debug.Assert(oIntergroupEdgeIndexes != null);
        AssertValid();

        Double dPositiveEdgeWeight = EdgeUtil.GetPositiveEdgeWeight(
            oIntergroupEdge);

        // Does an object already exist for the iGroup1Index/iGroup2Index pair?

        IntergroupEdgeInfo oIntergroupEdgeInfo;

        if ( oIntergroupEdgeIndexes.TryGetValue(iGroup2Index,
            out oIntergroupEdgeInfo) )
        {
            // Yes.

            oIntergroupEdgeInfo.Edges++;
            oIntergroupEdgeInfo.EdgeWeightSum += dPositiveEdgeWeight;
        }
        else
        {
            // No.  Create one.

            oIntergroupEdgeInfo = new IntergroupEdgeInfo(
                iGroup1Index, iGroup2Index, 1, dPositiveEdgeWeight);

            oIntergroupEdges.Add(oIntergroupEdgeInfo);
            oIntergroupEdgeIndexes.Add(iGroup2Index, oIntergroupEdgeInfo);
        }
    }
コード例 #6
0
    TestConstructor()
    {
        // Has CombinedIntergroupEdges.

        GroupInfo [] aoGroupInfo = new GroupInfo [] {
            new GroupInfo(),
            new GroupInfo(),
            new GroupInfo()
            };

        const Double PenWidth = 1.234;

        IntergroupEdgeInfo[] aoCombinedIntergroupEdges =
            new IntergroupEdgeInfo[5];

        GroupLayoutDrawingInfo oGroupLayoutDrawingInfo =
            new GroupLayoutDrawingInfo(aoGroupInfo, PenWidth,
                aoCombinedIntergroupEdges);

        Assert.AreEqual(aoGroupInfo, oGroupLayoutDrawingInfo.GroupsToDraw);
        Assert.AreEqual(PenWidth, oGroupLayoutDrawingInfo.PenWidth);

        Assert.AreEqual(aoCombinedIntergroupEdges,
            oGroupLayoutDrawingInfo.CombinedIntergroupEdges);
    }