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


C# IVertex.TryGetValue方法代码示例

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


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

示例1: AssertValid

    PreDrawVertex
    (
        IVertex vertex
    )
    {
        Debug.Assert(vertex != null);
        AssertValid();

        // Check whether the vertex represents a collapsed group.

        Object oCollapsedGroupAsObject;

        if ( vertex.TryGetValue(ReservedMetadataKeys.CollapsedGroupInfo,
            typeof(GroupInfo), out oCollapsedGroupAsObject) )
        {
            // Yes.  Get the group information.

            m_oCollapsedGroupVertex = vertex;
            m_oCollapsedGroup = (GroupInfo)oCollapsedGroupAsObject;

            if ( String.IsNullOrEmpty(m_oCollapsedGroup.CollapsedAttributes) )
            {
                // No attributes were specified for the collapsed group.  Set
                // attributes on the collapsed group vertex that will cause it
                // to be drawn in a default manner.

                m_oCollapsedGroupAttributes = new CollapsedGroupAttributes();
                SetDefaultAttributesOnCollapsedGroup();
            }
            else
            {
                m_oCollapsedGroupAttributes =
                    CollapsedGroupAttributes.FromString(
                        m_oCollapsedGroup.CollapsedAttributes);

                SetSpecifiedAttributesOnCollapsedGroup();
            }
        }
        else
        {
            m_oCollapsedGroupVertex = null;
            m_oCollapsedGroup = null;
            m_oCollapsedGroupAttributes = null;
        }
    }
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:45,代码来源:CollapsedGroupDrawingManager.cs

示例2: TryDrawVertex

        //*************************************************************************
        //  Method: TryDrawVertex()
        //
        /// <summary>
        /// Draws a vertex after moving it if necessary.
        /// </summary>
        ///
        /// <param name="vertex">
        /// The vertex to draw.
        /// </param>
        ///
        /// <param name="graphDrawingContext">
        /// Provides access to objects needed for graph-drawing operations.
        /// </param>
        ///
        /// <param name="vertexDrawingHistory">
        /// Where a <see cref="VertexDrawingHistory" /> object that retains
        /// information about how the vertex was drawn gets stored if true is
        /// returned.
        /// </param>
        ///
        /// <returns>
        /// true if the vertex was drawn, false if the vertex is hidden.
        /// </returns>
        ///
        /// <remarks>
        /// This method should be called repeatedly while a graph is being drawn,
        /// once for each of the graph's vertices.  The <see
        /// cref="IVertex.Location" /> property on all of the graph's vertices must
        /// be set by ILayout.LayOutGraph before this method is called.
        ///
        /// <para>
        /// If the vertex falls outside the graph rectangle, it gets moved before
        /// being drawn.
        /// </para>
        ///
        /// </remarks>
        //*************************************************************************
        public Boolean TryDrawVertex(
            IVertex vertex,
            GraphDrawingContext graphDrawingContext,
            out VertexDrawingHistory vertexDrawingHistory
            )
        {
            AssertValid();

            vertexDrawingHistory = null;

            CheckDrawVertexArguments(vertex, graphDrawingContext);

            // If the vertex is hidden, do nothing.

            VisibilityKeyValue eVisibility = GetVisibility(vertex);

            if (eVisibility == VisibilityKeyValue.Hidden)
            {
            return (false);
            }

            // Check for a per-vertex label.

            Object oLabelAsObject;
            String sLabel = null;

            if ( vertex.TryGetValue(ReservedMetadataKeys.PerVertexLabel,
            typeof(String), out oLabelAsObject) )
            {
            sLabel = (String)oLabelAsObject;

            if ( String.IsNullOrEmpty(sLabel) )
            {
                sLabel = null;
            }
            else
            {
                sLabel = TruncateLabel(sLabel);
            }
            }

            Boolean bDrawAsSelected = GetDrawAsSelected(vertex);
            Point oLocation = WpfGraphicsUtil.PointFToWpfPoint(vertex.Location);
            DrawingVisual oDrawingVisual = new DrawingVisual();
            VertexShape eShape = GetShape(vertex);

            VertexLabelDrawer oVertexLabelDrawer =
            new VertexLabelDrawer(m_eLabelPosition);

            using ( DrawingContext oDrawingContext = oDrawingVisual.RenderOpen() )
            {
            if (eShape == VertexShape.Label)
            {
                if (sLabel != null)
                {
                    // Draw the vertex as a label.

                    vertexDrawingHistory = DrawLabelShape(vertex,
                        graphDrawingContext, oDrawingContext, oDrawingVisual,
                        eVisibility, bDrawAsSelected, sLabel);

                    return (true);
//.........这里部分代码省略.........
开发者ID:haisreekanth,项目名称:NetMap,代码行数:101,代码来源:VertexDrawer.cs

示例3: GetRadius

        //*************************************************************************
        //  Method: GetRadius()
        //
        /// <summary>
        /// Gets the radius of a vertex.
        /// </summary>
        ///
        /// <param name="oVertex">
        /// The vertex to get the radius for.
        /// </param>
        ///
        /// <returns>
        /// The radius of the vertex.
        /// </returns>
        //*************************************************************************
        protected Double GetRadius(
            IVertex oVertex
            )
        {
            Debug.Assert(oVertex != null);
            AssertValid();

            // Start with the default radius.

            Double dRadius = m_dRadius;

            Object oPerVertexRadiusAsObject;

            // Check for a per-vertex radius.  Note that the radius is stored as a
            // Single in the vertex's metadata to reduce memory usage.

            if ( oVertex.TryGetValue(ReservedMetadataKeys.PerVertexRadius,
            typeof(Single), out oPerVertexRadiusAsObject) )
            {
            dRadius = (Double)(Single)oPerVertexRadiusAsObject;

            if (dRadius < MinimumRadius || dRadius > MaximumRadius)
            {
                throw new FormatException( String.Format(

                    "{0}: The vertex with the ID {1} has an out-of-range"
                    + " ReservedMetadataKeys.PerVertexRadius value.  Valid"
                    + " values are between {2} and {3}."
                    ,
                    this.ClassName,
                    oVertex.ID,
                    MinimumRadius,
                    MaximumRadius
                    ) );
            }
            }

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

示例4: GetShape

        //*************************************************************************
        //  Method: GetShape()
        //
        /// <summary>
        /// Gets the shape of a vertex.
        /// </summary>
        ///
        /// <param name="oVertex">
        /// The vertex to get the shape for.
        /// </param>
        ///
        /// <returns>
        /// The shape of the vertex.
        /// </returns>
        //*************************************************************************
        protected VertexShape GetShape(
            IVertex oVertex
            )
        {
            Debug.Assert(oVertex != null);
            AssertValid();

            // Start with the default shape.

            VertexShape eShape = m_eShape;

            Object oPerVertexShapeAsObject;

            // Check for a per-vertex shape.

            if ( oVertex.TryGetValue(ReservedMetadataKeys.PerVertexShape,
            typeof(VertexShape), out oPerVertexShapeAsObject) )
            {
            eShape = (VertexShape)oPerVertexShapeAsObject;
            }

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

示例5: GetLabelFontSize

        //*************************************************************************
        //  Method: GetLabelFontSize()
        //
        /// <summary>
        /// Gets the font size to use for a vertex with the shape Label.
        /// </summary>
        ///
        /// <param name="oVertex">
        /// The vertex to get the label font size for.
        /// </param>
        ///
        /// <returns>
        /// The label font size to use, in WPF units.
        /// </returns>
        //*************************************************************************
        protected Double GetLabelFontSize(
            IVertex oVertex
            )
        {
            Debug.Assert(oVertex != null);
            AssertValid();

            // Start with the default font size.

            Double dLabelFontSize = m_dFontSize;

            Object oPerVertexLabelFontSizeAsObject;

            // Check for a per-vertex font size.  Note that the font size is stored
            // as a Single in the vertex's metadata to reduce memory usage.

            if ( oVertex.TryGetValue(ReservedMetadataKeys.PerVertexLabelFontSize,
            typeof(Single), out oPerVertexLabelFontSizeAsObject) )
            {
            dLabelFontSize = (Double)(Single)oPerVertexLabelFontSizeAsObject;

            if (dLabelFontSize <= 0)
            {
                throw new FormatException( String.Format(

                    "{0}: The vertex with the ID {1} has a non-positive"
                    + " ReservedMetadataKeys.PerVertexLabelFontSize value."
                    ,
                    this.ClassName,
                    oVertex.ID
                    ) );
            }
            }

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

示例6: typeof

    TryGetVertexDrawingHistory
    (
        IVertex oVertex,
        out VertexDrawingHistory oVertexDrawingHistory
    )
    {
        Debug.Assert(oVertex != null);

        oVertexDrawingHistory = null;
        Object oVertexDrawingHistoryAsObject;

        if ( !oVertex.TryGetValue(ReservedMetadataKeys.VertexDrawingHistory,
            typeof(VertexDrawingHistory), out oVertexDrawingHistoryAsObject) )
        {
            return (false);
        }

        oVertexDrawingHistory =
            (VertexDrawingHistory)oVertexDrawingHistoryAsObject;

        return (true);
    }
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:22,代码来源:DrawerBase.cs

示例7: VertexIsLocked

        //*************************************************************************
        //  Method: VertexIsLocked()
        //
        /// <summary>
        /// Returns a flag indicating whether the vertex is locked.
        /// </summary>
        ///
        /// <param name="oVertex">
        /// The vertex to check.
        /// </param>
        ///
        /// <returns>
        /// true if the vertex is locked.
        /// </returns>
        ///
        /// <remarks>
        /// A locked vertex's location should not be modified by the layout,
        /// although the vertex may be included in layout calculations.
        /// </remarks>
        //*************************************************************************
        protected Boolean VertexIsLocked(
            IVertex oVertex
            )
        {
            Debug.Assert(oVertex != null);
            AssertValid();

            Object oLockVertexLocation;

            return (oVertex.TryGetValue(ReservedMetadataKeys.LockVertexLocation,
            typeof(Boolean), out oLockVertexLocation) &&
            (Boolean)oLockVertexLocation);
        }
开发者ID:haisreekanth,项目名称:NetMap,代码行数:33,代码来源:LayoutBase.cs

示例8: AssertValid

    GetLabelPosition
    (
        IVertex oVertex
    )
    {
        Debug.Assert(oVertex != null);
        AssertValid();

        // Start with the default position.

        VertexLabelPosition eLabelPosition = m_eLabelPosition;

        // Check for a per-vertex label position.

        Object oPerVertexLabelPositionAsObject;

        if ( oVertex.TryGetValue(ReservedMetadataKeys.PerVertexLabelPosition,
            typeof(VertexLabelPosition), out oPerVertexLabelPositionAsObject) )
        {
            eLabelPosition =
                (VertexLabelPosition)oPerVertexLabelPositionAsObject;
        }

        return (eLabelPosition);
    }
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:25,代码来源:VertexLabelDrawer.cs

示例9: AssertValid

    TryDrawVertex
    (
        IVertex vertex,
        GraphDrawingContext graphDrawingContext,
        out VertexDrawingHistory vertexDrawingHistory
    )
    {
        AssertValid();

        vertexDrawingHistory = null;

        CheckDrawVertexArguments(vertex, graphDrawingContext);

        if (graphDrawingContext.GraphRectangleMinusMarginIsEmpty)
        {
            return (false);
        }

        // If the vertex is hidden, do nothing.

        VisibilityKeyValue eVisibility = GetVisibility(vertex);

        if (eVisibility == VisibilityKeyValue.Hidden)
        {
            return (false);
        }

        // Check whether the vertex represents a collapsed group and perform
        // collapsed group tasks if necessary.

        CollapsedGroupDrawingManager oCollapsedGroupDrawingManager =
            new CollapsedGroupDrawingManager();

        oCollapsedGroupDrawingManager.PreDrawVertex(vertex);

        // Check for a per-vertex label.

        Object oLabelAsObject;
        String sLabel = null;

        if ( vertex.TryGetValue(ReservedMetadataKeys.PerVertexLabel,
            typeof(String), out oLabelAsObject) )
        {
            sLabel = (String)oLabelAsObject;

            if ( String.IsNullOrEmpty(sLabel) )
            {
                sLabel = null;
            }
            else
            {
                sLabel = TruncateLabel(sLabel);
            }
        }

        Boolean bDrawAsSelected = GetDrawAsSelected(vertex);
        Point oLocation = WpfGraphicsUtil.PointFToWpfPoint(vertex.Location);
        DrawingVisualPlus oDrawingVisual = new DrawingVisualPlus();
        VertexShape eShape = GetShape(vertex);

        VertexLabelDrawer oVertexLabelDrawer =
            new VertexLabelDrawer(m_eLabelPosition, m_btBackgroundAlpha);

        using ( DrawingContext oDrawingContext = oDrawingVisual.RenderOpen() )
        {
            if (eShape == VertexShape.Label)
            {
                if (sLabel != null)
                {
                    // Draw the vertex as a label.

                    vertexDrawingHistory = DrawLabelShape(vertex,
                        graphDrawingContext, oDrawingContext, oDrawingVisual,
                        eVisibility, bDrawAsSelected, sLabel,
                        oCollapsedGroupDrawingManager);
                }
                else
                {
                    // Default to something usable.

                    eShape = VertexShape.Disk;
                }
            }
            else if (eShape == VertexShape.Image)
            {
                Object oImageSourceAsObject;

                if (vertex.TryGetValue(ReservedMetadataKeys.PerVertexImage,
                    typeof(ImageSource), out oImageSourceAsObject)
                    )
                {
                    // Draw the vertex as an image.

                    vertexDrawingHistory = DrawImageShape(vertex,
                        graphDrawingContext, oDrawingContext, oDrawingVisual,
                        eVisibility, bDrawAsSelected, sLabel,
                        (ImageSource)oImageSourceAsObject, oVertexLabelDrawer,
                        oCollapsedGroupDrawingManager);
                }
                else
//.........这里部分代码省略.........
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:101,代码来源:VertexDrawer.cs


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