-
Notifications
You must be signed in to change notification settings - Fork 1
/
RankingLayoutCalculator.cs
29 lines (28 loc) · 1.17 KB
/
RankingLayoutCalculator.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using Microsoft.Msagl.Core.Layout;
using Microsoft.Msagl.Core.Routing;
using Microsoft.Msagl.Miscellaneous;
using Microsoft.Msagl.Prototype.Ranking;
namespace MsaglHelpers {
public class RankingLayoutCalculator : ILayoutCalculator {
public LayoutAlgorithmSettings LayoutAlgorithmSettings {
get {
return new RankingLayoutSettings() {
NodeSeparation = 30,
EdgeRoutingSettings = { EdgeRoutingMode = EdgeRoutingMode.Rectilinear }
};
}
}
public void CalculateLayout(GeometryGraph geometryGraph) {
var geomGraphComponents = GraphConnectedComponents.CreateComponents(geometryGraph.Nodes, geometryGraph.Edges);
var settings = LayoutAlgorithmSettings as RankingLayoutSettings;
foreach(var components in geomGraphComponents) {
var layout = new RankingLayout(settings, components);
components.Margins = 30;
layout.Run();
}
Microsoft.Msagl.Layout.MDS.MdsGraphLayout.PackGraphs(geomGraphComponents, settings);
geometryGraph.UpdateBoundingBox();
}
}
}