本文整理汇总了C#中Microsoft.Msagl.Core.Layout.GeometryGraph.Translate方法的典型用法代码示例。如果您正苦于以下问题:C# GeometryGraph.Translate方法的具体用法?C# GeometryGraph.Translate怎么用?C# GeometryGraph.Translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Msagl.Core.Layout.GeometryGraph
的用法示例。
在下文中一共展示了GeometryGraph.Translate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FixBoundingBox
internal static void FixBoundingBox(GeometryGraph component, LayoutAlgorithmSettings settings)
{
// Pad the graph with margins so the packing will be spaced out.
component.Margins = settings.ClusterMargin;
component.UpdateBoundingBox();
// Zero the graph
component.Translate(-component.BoundingBox.LeftBottom);
}
示例2: LayoutComponent
private void LayoutComponent(GeometryGraph component)
{
if (component.Nodes.Count > 1 || component.RootCluster.Clusters.Any())
{
// for small graphs (below 100 nodes) do extra iterations
settings.MaxIterations = LayoutAlgorithmHelpers.NegativeLinearInterpolation(
component.Nodes.Count,
/*lowerThreshold:*/ 50, /*upperThreshold:*/ 500, /*minIterations:*/ 5, /*maxIterations:*/ 10);
settings.MinorIterations = LayoutAlgorithmHelpers.NegativeLinearInterpolation(component.Nodes.Count,
/*lowerThreshold:*/ 50, /*upperThreshold:*/ 500, /*minIterations:*/ 3, /*maxIterations:*/ 20);
if (settings.MinConstraintLevel == 0)
{
// run PivotMDS with a largish Scale so that the layout comes back oversized.
// subsequent incremental iterations do a better job of untangling when they're pulling it in
// rather than pushing it apart.
PivotMDS pivotMDS = new PivotMDS(component) { Scale = 2 };
this.RunChildAlgorithm(pivotMDS, 0.5 / componentCount);
}
FastIncrementalLayout fil = new FastIncrementalLayout(component, settings, settings.MinConstraintLevel, anyCluster => settings);
Debug.Assert(settings.Iterations == 0);
foreach (var level in GetConstraintLevels(component))
{
if (level > settings.MaxConstraintLevel)
{
break;
}
if (level > settings.MinConstraintLevel)
{
fil.CurrentConstraintLevel = level;
}
do
{
fil.Run();
} while (!settings.IsDone);
}
}
// Pad the graph with margins so the packing will be spaced out.
component.Margins = settings.NodeSeparation;
component.UpdateBoundingBox();
// Zero the graph
component.Translate(-component.BoundingBox.LeftBottom);
}