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


C# IVertex.ContainsKey方法代码示例

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


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

示例1: RunTarjanAlgorithm

        //*************************************************************************
        //  Method: RunTarjanAlgorithm()
        //
        /// <summary>
        /// Runs the Tarjan algorithm on one vertex.
        /// </summary>
        ///
        /// <param name="oVertex">
        /// The vertex to run the algorithm on.
        /// </param>
        ///
        /// <param name="oStack">
        /// Stack used by the algorithm.
        /// </param>
        ///
        /// <param name="oStronglyConnectedComponents">
        /// List to add the strongly connected components to.
        /// </param>
        ///
        /// <param name="iNextIndex">
        /// Index to assign to <paramref name="oVertex" />.  Gets incremented.
        /// </param>
        //*************************************************************************
        protected void RunTarjanAlgorithm(
            IVertex oVertex,
            Stack<IVertex> oStack,
            List< LinkedList<IVertex> > oStronglyConnectedComponents,
            ref Int32 iNextIndex
            )
        {
            Debug.Assert(oVertex != null);

            Debug.Assert( !oVertex.ContainsKey(
            ReservedMetadataKeys.ConnectedComponentCalculatorIndex) );

            Debug.Assert(oStack != null);
            Debug.Assert(oStronglyConnectedComponents != null);
            Debug.Assert(iNextIndex >= 0);

            SetIndex(oVertex, iNextIndex);
            SetLowLink(oVertex, iNextIndex);
            iNextIndex++;

            oStack.Push(oVertex);

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

            if ( !oAdjacentVertex.ContainsKey(
                ReservedMetadataKeys.ConnectedComponentCalculatorIndex) )
            {
                RunTarjanAlgorithm(oAdjacentVertex, oStack,
                    oStronglyConnectedComponents, ref iNextIndex);

                SetLowLink(oVertex,
                    Math.Min(GetLowLink(oVertex), GetLowLink(oAdjacentVertex) )
                    );
            }
            else if ( oStack.Contains(oAdjacentVertex) )
            {
                SetLowLink(oVertex,
                    Math.Min( GetLowLink(oVertex), GetIndex(oAdjacentVertex) )
                    );
            }
            }

            if ( GetLowLink(oVertex) == GetIndex(oVertex) )
            {
            LinkedList<IVertex> oStronglyConnectedComponent =
                new LinkedList<IVertex>();

            IVertex oVertexInComponent;

            do
            {
                oVertexInComponent = oStack.Pop();
                oStronglyConnectedComponent.AddLast(oVertexInComponent);

            } while (oVertexInComponent.ID != oVertex.ID);

            oStronglyConnectedComponents.Add(oStronglyConnectedComponent);
            }
        }
开发者ID:haisreekanth,项目名称:NetMap,代码行数:84,代码来源:ConnectedComponentCalculator.cs

示例2: DrawSimpleShape


//.........这里部分代码省略.........

                oDrawingContext.DrawRectangle(
                    bIsSolidSquare ? GetBrush(oColor) : Brushes.Transparent,
                    bIsSolidSquare? null : GetPen(oColor, DefaultPenThickness),
                    oVertexBounds
                    );

                oVertexDrawingHistory = bIsSolidSquare ?

                    new SolidSquareVertexDrawingHistory(oVertex,
                        oDrawingVisual, bDrawAsSelected, oVertexBounds)
                    :
                    new SquareVertexDrawingHistory(oVertex,
                        oDrawingVisual, bDrawAsSelected, oVertexBounds);

                break;

            case VertexShape.Diamond:
            case VertexShape.SolidDiamond:

                Boolean bIsSolidDiamond = (eShape == VertexShape.SolidDiamond);

                PathGeometry oDiamond =
                    WpfGraphicsUtil.DiamondFromCenterAndHalfWidth(
                        oLocation, dRadius);

                oDrawingContext.DrawGeometry(

                    bIsSolidDiamond ? GetBrush(oColor) : Brushes.Transparent,

                    bIsSolidDiamond ? null :
                        GetPen(oColor, DefaultPenThickness),

                    oDiamond
                    );

                oVertexDrawingHistory = bIsSolidDiamond ?

                    new SolidDiamondVertexDrawingHistory(
                        oVertex, oDrawingVisual, bDrawAsSelected, dRadius)
                    :
                    new DiamondVertexDrawingHistory(
                        oVertex, oDrawingVisual, bDrawAsSelected, dRadius);

                break;

            case VertexShape.Triangle:
            case VertexShape.SolidTriangle:

                Boolean bIsSolidTriangle =
                    (eShape == VertexShape.SolidTriangle);

                PathGeometry oTriangle =
                    WpfGraphicsUtil.TriangleFromCenterAndHalfWidth(
                        oLocation, dRadius);

                oDrawingContext.DrawGeometry(

                    bIsSolidTriangle ? GetBrush(oColor) : Brushes.Transparent,

                    bIsSolidTriangle ? null :
                        GetPen(oColor, DefaultPenThickness),

                    oTriangle
                    );

                oVertexDrawingHistory = bIsSolidTriangle ?

                    new SolidTriangleVertexDrawingHistory(
                        oVertex, oDrawingVisual, bDrawAsSelected, dRadius)
                    :
                    new TriangleVertexDrawingHistory(
                        oVertex, oDrawingVisual, bDrawAsSelected, dRadius);

                break;

            default:

                Debug.Assert(false);
                break;
            }

            if (sAnnotation != null)
            {
            oVertexLabelDrawer.DrawLabel( oDrawingContext,
                oGraphDrawingContext, oVertexDrawingHistory, oVertexBounds,
                CreateFormattedText(sAnnotation, oColor) );
            }

            if ( oVertex.ContainsKey(ReservedMetadataKeys.PerVertexDrawPlusSign) )
            {
            DrawPlusSign(eShape, oVertexLocation, oVertexBounds, oColor,
                oGraphDrawingContext, oDrawingContext, oVertexLabelDrawer,
                oVertexDrawingHistory);
            }

            Debug.Assert(oVertexDrawingHistory != null);

            return (oVertexDrawingHistory);
        }
开发者ID:haisreekanth,项目名称:NetMap,代码行数:101,代码来源:VertexDrawer.cs


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