Smrf.NodeXL.Visualization.Wpf.CollapsedGroupDrawingManager.SetCollapsedDConnectorMotifEdgeAttributes C# (CSharp) Method

SetCollapsedDConnectorMotifEdgeAttributes() protected method

protected SetCollapsedDConnectorMotifEdgeAttributes ( Int32 iAnchorVertices ) : void
iAnchorVertices System.Int32
return void
    SetCollapsedDConnectorMotifEdgeAttributes
    (
        Int32 iAnchorVertices
    )
    {
        Debug.Assert(iAnchorVertices >= 0);
        Debug.Assert(m_oCollapsedGroup != null);
        Debug.Assert(m_oCollapsedGroupVertex != null);
        Debug.Assert(m_oCollapsedGroupAttributes != null);
        AssertValid();

        // The key is the name of an anchor vertex and the value is the anchor
        // vertex's zero-based index.

        Dictionary<String, Int32> oAnchorVertexIndexes =
            GetAnchorVertexIndexes(iAnchorVertices);

        // Each of the collapsed group vertex's incident edges is connected to
        // one of the D-connector motif's anchor vertices.

        foreach (IEdge oIncidentEdge in m_oCollapsedGroupVertex.IncidentEdges)
        {
            // Determine which anchor vertex is on the other end of this edge.

            String sAdjacentVertexName = oIncidentEdge.GetAdjacentVertex(
                m_oCollapsedGroupVertex).Name;

            Int32 iAnchorVertexIndex;

            if (
                sAdjacentVertexName != null
                &&
                oAnchorVertexIndexes.TryGetValue(sAdjacentVertexName,
                    out iAnchorVertexIndex)
                )
            {
                // Retrieve the color that was calculated for the edges
                // connected to this anchor vertex, then assign the color to
                // the edge.

                System.Drawing.Color oAnchorVertexEdgeColor;

                if ( TryGetColor(

                    CollapsedGroupAttributeKeys.GetAnchorVertexEdgeColorKey(
                        iAnchorVertexIndex),

                    out oAnchorVertexEdgeColor) )
                {
                    SetCollapsedDConnectorMotifEdgeColor(oIncidentEdge,
                        oAnchorVertexEdgeColor);
                }

                // Ditto for the edge width.

                Double dAnchorVertexEdgeWidth;

                if ( m_oCollapsedGroupAttributes.TryGetValue(

                    CollapsedGroupAttributeKeys.GetAnchorVertexEdgeWidthKey(
                        iAnchorVertexIndex),

                    out dAnchorVertexEdgeWidth) )
                {
                    SetCollapsedDConnectorMotifEdgeWidth(oIncidentEdge,
                        dAnchorVertexEdgeWidth);
                }
            }
        }
    }