当前位置: 首页>>代码示例>>C#>>正文


C# IGraph.RemoveKey方法代码示例

本文整理汇总了C#中IGraph.RemoveKey方法的典型用法代码示例。如果您正苦于以下问题:C# IGraph.RemoveKey方法的具体用法?C# IGraph.RemoveKey怎么用?C# IGraph.RemoveKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IGraph的用法示例。


在下文中一共展示了IGraph.RemoveKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: foreach

    OnLayoutBegin
    (
        IGraph graph
    )
    {
        Debug.Assert(graph != null);

        // Remove the group drawing information that may have been added by
        // OnLayoutUsingGroupsEnd().  Another set of group drawing information
        // will get added again by that method if they are needed.

        graph.RemoveKey(ReservedMetadataKeys.GroupLayoutDrawingInfo);

        if ( graph.RemoveKey( ReservedMetadataKeys.IntergroupEdgesHidden) )
        {
            // OnLayoutUsingGroupsComplete hid some edges.  Restore the
            // visibilities those edges had before they were hidden.

            foreach (IEdge oEdge in graph.Edges)
            {
                VisibilityKeyValue eSavedVisibility;

                if ( TryGetEdgeVisibility(oEdge,
                    ReservedMetadataKeys.SavedVisibility,
                    out eSavedVisibility) )
                {
                    if (eSavedVisibility == VisibilityKeyValue.Visible)
                    {
                        // Visible is the value assumed when there is no
                        // Visibility key, so there is no need to add a
                        // Visible value.  Just remove the Hidden value.

                        oEdge.RemoveKey(ReservedMetadataKeys.Visibility);
                    }
                    else
                    {
                        oEdge.SetValue(ReservedMetadataKeys.Visibility,
                            eSavedVisibility);
                    }

                    oEdge.RemoveKey(ReservedMetadataKeys.SavedVisibility);
                }
            }
        }
    }
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:45,代码来源:GroupMetadataManager.cs

示例2:

    MarkGraphAsNotLaidOut
    (
        IGraph graph
    )
    {
        Debug.Assert(graph != null);

        graph.RemoveKey(ReservedMetadataKeys.LayoutBaseLayoutComplete);
    }
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:9,代码来源:LayoutMetadataUtil.cs

示例3: AssertValid

    LayOutSmallerComponentsInBins
    (
        IGraph graph,
        ICollection<IVertex> verticesToLayOut,
        LayoutContext layoutContext,
        out ICollection<IVertex> remainingVertices,
        out Rectangle remainingRectangle
    )
    {
        AssertValid();

        remainingVertices = null;
        remainingRectangle = Rectangle.Empty;

        // This method modifies some of the graph's metadata.  Save the
        // original metadata.

        Boolean bOriginalGraphHasBeenLaidOut =
            LayoutMetadataUtil.GraphHasBeenLaidOut(graph);

        ICollection<IVertex> oOriginalLayOutTheseVerticesOnly =
            ( ICollection<IVertex> )graph.GetValue(
                ReservedMetadataKeys.LayOutTheseVerticesOnly,
                typeof( ICollection<IVertex> ) );

        // Split the vertices into strongly connected components, sorted in
        // increasing order of vertex count.

        ConnectedComponentCalculator oConnectedComponentCalculator =
            new ConnectedComponentCalculator();

        IList< LinkedList<IVertex> > oComponents =
            oConnectedComponentCalculator.CalculateStronglyConnectedComponents(
                verticesToLayOut, graph, true);

        Int32 iComponents = oComponents.Count;

        // This object will split the graph rectangle into bin rectangles.

        RectangleBinner oRectangleBinner = new RectangleBinner(
            layoutContext.GraphRectangle, m_iBinLength);

        Int32 iComponent = 0;

        for (iComponent = 0; iComponent < iComponents; iComponent++)
        {
            LinkedList<IVertex> oComponent = oComponents[iComponent];
            Int32 iVerticesInComponent = oComponent.Count;

            if (iVerticesInComponent> m_iMaximumVerticesPerBin)
            {
                // The vertices in the remaining components should not be
                // binned.

                break;
            }

            Rectangle oBinRectangle;

            if ( !oRectangleBinner.TryGetNextBin(out oBinRectangle) )
            {
                // There is no room for an additional bin rectangle.

                break;
            }

            // Lay out the component within the bin rectangle.

            LayOutComponentInBin(graph, oComponent, oBinRectangle);
        }

        // Restore the original metadata on the graph.

        if (bOriginalGraphHasBeenLaidOut)
        {
            LayoutMetadataUtil.MarkGraphAsLaidOut(graph);
        }
        else
        {
            LayoutMetadataUtil.MarkGraphAsNotLaidOut(graph);
        }

        if (oOriginalLayOutTheseVerticesOnly != null)
        {
            graph.SetValue(ReservedMetadataKeys.LayOutTheseVerticesOnly,
                oOriginalLayOutTheseVerticesOnly);
        }
        else
        {
            graph.RemoveKey(ReservedMetadataKeys.LayOutTheseVerticesOnly);
        }

        if ( oRectangleBinner.TryGetRemainingRectangle(
            out remainingRectangle) )
        {
            remainingVertices = GetRemainingVertices(oComponents, iComponent);

            return (remainingVertices.Count > 0);
        }

//.........这里部分代码省略.........
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:101,代码来源:GraphBinner.cs


注:本文中的IGraph.RemoveKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。