SetSelected() public method

public SetSelected ( IEnumerable vertices, IEnumerable edges ) : void
vertices IEnumerable
edges IEnumerable
return void
    SelectSubgraphs
    (
        NodeXLControl nodeXLControl,
        IEnumerable<IVertex> verticesToSelectSubgraphsFor,
        Decimal levels,
        Boolean selectConnectingEdges
    )
    {
        Debug.Assert(nodeXLControl != null);
        Debug.Assert(verticesToSelectSubgraphsFor != null);
        Debug.Assert(levels >= 0);
        Debug.Assert(Decimal.Remainder(levels, 0.5M) == 0M);

        // Create HashSets for all of the vertices and edges that will be
        // selected.  The key is the IVertex or IEdge.  HashSets are used to
        // prevent the same vertex or edge from being selected twice.

        HashSet<IVertex> oAllSelectedVertices = new HashSet<IVertex>();
        HashSet<IEdge> oAllSelectedEdges = new HashSet<IEdge>();

        foreach (IVertex oVertexToSelectSubgraphFor in
            verticesToSelectSubgraphsFor)
        {
            // These are similar collections for the vertices and edges that
            // will be selected for this subgraph only.

            Dictionary<IVertex, Int32> oThisSubgraphSelectedVertices;
            HashSet<IEdge> oThisSubgraphSelectedEdges;

            SubgraphCalculator.GetSubgraph(oVertexToSelectSubgraphFor, levels,
                selectConnectingEdges, out oThisSubgraphSelectedVertices,
                out oThisSubgraphSelectedEdges);

            // Consolidate the subgraph's selected vertices and edges into the
            // "all" dictionaries.

            foreach (IVertex oVertex in oThisSubgraphSelectedVertices.Keys)
            {
                oAllSelectedVertices.Add(oVertex);
            }

            foreach (IEdge oEdge in oThisSubgraphSelectedEdges)
            {
                oAllSelectedEdges.Add(oEdge);
            }
        }

        // Replace the selection.

        nodeXLControl.SetSelected(oAllSelectedVertices, oAllSelectedEdges);
    }