Smrf.NodeXL.ExcelTemplate.CollapsedGroupAttributeAdder.GetRowIDsToAverageForEdges C# (CSharp) Method

GetRowIDsToAverageForEdges() private static method

private static GetRowIDsToAverageForEdges ( GroupInfo oGroup, CollapsedGroupAttributes oCollapsedGroupAttributes, Int32 iAnchorVertexIndex ) : IEnumerable
oGroup Smrf.NodeXL.Core.GroupInfo
oCollapsedGroupAttributes Smrf.NodeXL.Core.CollapsedGroupAttributes
iAnchorVertexIndex System.Int32
return IEnumerable
    GetRowIDsToAverageForEdges
    (
        GroupInfo oGroup,
        CollapsedGroupAttributes oCollapsedGroupAttributes,
        Int32 iAnchorVertexIndex
    )
    {
        Debug.Assert(oGroup != null);
        Debug.Assert(oCollapsedGroupAttributes != null);
        Debug.Assert(iAnchorVertexIndex >= 0);

        List<Int32> oRowIDsOfRowsToAverage = new List<Int32>();

        String sAnchorVertexName;

        if ( oCollapsedGroupAttributes.TryGetValue(

                CollapsedGroupAttributeKeys.GetAnchorVertexNameKey(
                    iAnchorVertexIndex),

                out sAnchorVertexName) )
        {
            // The group's vertices are the span vertices.  Loop through them.

            foreach (IVertex oVertex in oGroup.Vertices)
            {
                // We need to find the edge that is incident to the specified
                // anchor vertex.

                foreach (IEdge oIncidentEdge in oVertex.IncidentEdges)
                {
                    IVertex oAdjacentVertex =
                        oIncidentEdge.GetAdjacentVertex(oVertex);

                    if (oAdjacentVertex.Name == sAnchorVertexName)
                    {
                        // The row ID is stored in the edge's Tag, as long as
                        // the edge row isn't hidden.

                        if (oIncidentEdge.Tag is Int32)
                        {
                            oRowIDsOfRowsToAverage.Add(
                                (Int32)oIncidentEdge.Tag);
                        }

                        break;
                    }
                }
            }
        }

        return (oRowIDsOfRowsToAverage);
    }
}