microsoft/automatic-graph-layout

MSAGL - how to set orthogonal edges with simple corners

Closed this issue · 6 comments

Hi,
I'm trying to set it up Microsoft auto graph layout to calculate edge segments with simple 90°degree corner. But layout is still calculated with a lot of curve segments. This is my configuration:

GeometryGraph graph = new GeometryGraph();
graph.Nodes!.Add(new Node(CurveFactory.CreateRectangle(80, 60, new Point(100, 100)), null));
graph.Nodes!.Add(new Node(CurveFactory.CreateRectangle(80, 60, new Point(94, 80)), null));
graph.Edges!.Add(new Edge(graph.Nodes[0], graph.Nodes[1]) {
    Weight = 1,
    UserData = null
});
        LayoutHelpers.CalculateLayout(graph,
            new FastIncrementalLayoutSettings {
                EdgeRoutingSettings = {
                    EdgeRoutingMode = EdgeRoutingMode.Rectilinear,
                    CornerRadius = 90
                },
                NodeSeparation = 50, // Minimum space between nodes
                AvoidOverlaps = true,
                
            }, null);
graph.UpdateBoundingBox();
graph.Translate(new Point(-graph.Left, -graph.Bottom));

But result look likes this:
image

I need Orthogonal Edge with 90°degree corner. Any ideas how to update my settings please?

One thing to try is to set CornerRadius to 0, or to a smaller than 90 number.

One thing to try is to set CornerRadius to 0, or to a smaller than 90 number.

A try to change CornerRadius to '0' or '50', but still I have not 90°degrees corner...Corner is still the same...

I am not seeing the call that calculates layout in your example. Can you provide a full example?

LayoutHelpers.CalculateLayout

Hi, I call calculate layout here:
'LayoutHelpers.CalculateLayout'.

I think I fixed it with the last commit.

I think I fixed it with the last commit.

Hi, i tried your new code and when I set 'CornerRadius = 0' the result is now fine :)
image