本文整理汇总了C#中IGraph.TryGetValue方法的典型用法代码示例。如果您正苦于以下问题:C# IGraph.TryGetValue方法的具体用法?C# IGraph.TryGetValue怎么用?C# IGraph.TryGetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGraph
的用法示例。
在下文中一共展示了IGraph.TryGetValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawBackground
//*************************************************************************
// Method: DrawBackground()
//
/// <summary>
/// Draws the graph's background.
/// </summary>
///
/// <param name="oGraph">
/// The graph being drawn.
/// </param>
///
/// <param name="oGraphDrawingContext">
/// Provides access to objects needed for graph-drawing operations.
/// </param>
//*************************************************************************
protected void DrawBackground(
IGraph oGraph,
GraphDrawingContext oGraphDrawingContext
)
{
Debug.Assert(oGraph != null);
Debug.Assert(oGraphDrawingContext != null);
AssertValid();
// Draw the background color, followed by the background image if one
// was specified.
Color oBackColor;
if ( !TryGetColorValue(oGraph, ReservedMetadataKeys.GraphBackColor,
out oBackColor) )
{
oBackColor = m_oBackColor;
}
DrawingVisual oBackgroundDrawingVisual = new DrawingVisual();
using ( DrawingContext oDrawingContext =
oBackgroundDrawingVisual.RenderOpen() )
{
oDrawingContext.DrawRectangle(
CreateFrozenSolidColorBrush(oBackColor), null,
oGraphDrawingContext.GraphRectangle);
Object oImageSourceAsObject;
if ( oGraph.TryGetValue(ReservedMetadataKeys.GraphBackgroundImage,
typeof(ImageSource), out oImageSourceAsObject) )
{
ImageSource oImageSource = (ImageSource)oImageSourceAsObject;
oDrawingContext.DrawImage( oImageSource,
new Rect( new Size(oImageSource.Width,
oImageSource.Height) ) );
}
}
m_oVisualCollection.Add(oBackgroundDrawingVisual);
}
示例2: AssertValid
EdgesOrVerticesHaveImportedIDs
(
IGraph oGraph,
Boolean bCheckEdges
)
{
Debug.Assert(oGraph != null);
AssertValid();
// When the workbook was read, arrays of all the edge and vertex
// metadata key names were stored on the graph. Get the relevant
// array.
Object oAllMetadataKeysAsObject;
if ( oGraph.TryGetValue(
bCheckEdges ? ReservedMetadataKeys.AllEdgeMetadataKeys :
ReservedMetadataKeys.AllVertexMetadataKeys,
typeof ( String[] ), out oAllMetadataKeysAsObject) )
{
if ( ( (String[] )oAllMetadataKeysAsObject ).Contains(
CommonTableColumnNames.ImportedID) )
{
return (true);
}
}
return (false);
}
示例3: typeof
TryGetGroupLayoutDrawingInfo
(
IGraph graph,
out GroupLayoutDrawingInfo groupLayoutDrawingInfo
)
{
Debug.Assert(graph != null);
groupLayoutDrawingInfo = null;
Object oGroupLayoutDrawingInfoAsObject;
if ( graph.TryGetValue(ReservedMetadataKeys.GroupLayoutDrawingInfo,
typeof(GroupLayoutDrawingInfo),
out oGroupLayoutDrawingInfoAsObject) )
{
groupLayoutDrawingInfo =
(GroupLayoutDrawingInfo)oGroupLayoutDrawingInfoAsObject;
return (true);
}
return (false);
}
示例4: GetGroupNamesToCollapse
//*************************************************************************
// Method: GetGroupNamesToCollapse()
//
/// <summary>
/// Gets the names of groups that should be collapsed.
/// </summary>
///
/// <param name="oGraph">
/// The graph that was read from the workbook.
/// </param>
///
/// <returns>
/// A collection of the names of groups that should be collapsed. The
/// collection can be empty but is never null.
/// </returns>
//*************************************************************************
protected ICollection<String> GetGroupNamesToCollapse(
IGraph oGraph
)
{
Debug.Assert(oGraph != null);
LinkedList<String> oGroupNamesToCollapse = new LinkedList<String>();
Object oGroupInformationAsObject;
// The WorkbookReader object may have stored group information as
// metadata on the graph.
if ( oGraph.TryGetValue(ReservedMetadataKeys.GroupInformation,
typeof( ICollection<GroupInformation> ),
out oGroupInformationAsObject) )
{
foreach (GroupInformation oGroupInformation in
( ICollection<GroupInformation> )oGroupInformationAsObject)
{
if (oGroupInformation.IsCollapsed)
{
oGroupNamesToCollapse.AddLast(oGroupInformation.Name);
}
}
}
return (oGroupNamesToCollapse);
}
示例5: AssertValid
TransformLayoutCore
(
IGraph graph,
LayoutContext originalLayoutContext,
LayoutContext newLayoutContext
)
{
Debug.Assert(graph != null);
Debug.Assert(originalLayoutContext != null);
Debug.Assert(newLayoutContext != null);
AssertValid();
// Transform the graph's vertex locations.
Matrix oTransformationMatrix = LayoutUtil.GetRectangleTransformation(
originalLayoutContext.GraphRectangle,
newLayoutContext.GraphRectangle
);
base.TransformLayoutCore(graph, originalLayoutContext,
newLayoutContext);
// Tranform the geometry metadata added by LayOutGraphCore().
Object oValue;
if ( graph.TryGetValue(
ReservedMetadataKeys.SugiyamaComputedRadius, typeof(Single),
out oValue) )
{
// Transforming the radius in the x-direction only isn't ideal, but
// doing the transform properly would involve drawing the vertex as
// an ellipse.
PointF oTransformedRadius = LayoutUtil.TransformPointF(
new PointF( (Single)oValue, 0 ), oTransformationMatrix
);
graph.SetValue(
ReservedMetadataKeys.SugiyamaComputedRadius,
oTransformedRadius.X
);
}
foreach (IEdge oEdge in graph.Edges)
{
if ( !oEdge.TryGetValue(
ReservedMetadataKeys.SugiyamaCurvePoints, typeof( PointF [] ),
out oValue
) )
{
continue;
}
PointF [] aoCurvePoints = ( PointF [] )oValue;
oTransformationMatrix.TransformPoints(aoCurvePoints);
oEdge.SetValue(ReservedMetadataKeys.SugiyamaCurvePoints,
aoCurvePoints);
PointF oEndpoint = (PointF)oEdge.GetRequiredValue(
ReservedMetadataKeys.SugiyamaEndpoint, typeof(PointF)
);
oEdge.SetValue(
ReservedMetadataKeys.SugiyamaEndpoint,
LayoutUtil.TransformPointF(oEndpoint, oTransformationMatrix)
);
}
}
示例6: GetVerticesToLayOut
//*************************************************************************
// Method: GetVerticesToLayOut()
//
/// <summary>
/// Gets the vertices to lay out.
/// </summary>
///
/// <param name="graph">
/// Graph that is being laid out.
/// </param>
///
/// <returns>
/// The vertices to lay out.
/// </returns>
//*************************************************************************
protected ICollection<IVertex> GetVerticesToLayOut(
IGraph graph
)
{
Debug.Assert(graph != null);
AssertValid();
// If the LayOutTheseVerticesOnly key is present on the graph, its
// value is an ICollection<IVertex> of vertices to lay out.
Object oVerticesToLayOut;
if ( graph.TryGetValue(ReservedMetadataKeys.LayOutTheseVerticesOnly,
typeof( ICollection<IVertex> ), out oVerticesToLayOut) )
{
return ( ( ICollection<IVertex> )oVerticesToLayOut );
}
// The key isn't present. Use the graph's entire vertex collection.
return (graph.Vertices);
}