Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic LayeredLayout routing links issue (Read 2063 times)
Erwin Lackner
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Dec 10th, 2018
LayeredLayout routing links issue
Jan 10th, 2022 at 12:19pm
Print Post  
Hi,
we are using Diagramming.WinForms (6.6.0.451) and LayeredLayout now for a while and the implicit routing of the links via LayeredLayout.Arrange(diagram) works fine.

But now we have a scenario where the links doesn’t fit well and we can’t figure out other/better settings to get the expected results. Because of the many involved setting options i've provided/attached a testbed solution for reproduction of the problem.

Clicking TestGraph2 (180/120) shows the arrangement of the graph with node dimensions we use. Normally the nodes would show content, therefore this dimensions. The red marked links are not routed as we would like to have.

We figured out, that drawing the graph with small node dimensions (width 18px, height 12px) would route the links as expected (Click button TestGraph1 (18/12)), but we need the node dimensions as of TestGraph2.

We also figured out that calling Diagram.RouteAllLinks() after LayeredLayout.Arrange would shows the expected result, but using this strategy has drawbacks because it routes links different/suboptimal in other scenarios.

Any ideas how we could get the routing of the links as expected?

Thanks
Erwin
  

RoutingTestBed.zip ( 32 KB | 171 Downloads )
TestGraph2.png ( 74 KB | 110 Downloads )
TestGraph2.png
TestGraph1.png ( 14 KB | 111 Downloads )
TestGraph1.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3342
Joined: Oct 19th, 2005
Re: LayeredLayout routing links issue
Reply #1 - Jan 11th, 2022 at 7:39am
Print Post  
Hi,

LayeredLayoutLinkType.Cascading reuses points of default Straight type and just inserts bends halfway between layers, which happens to be exactly on node borders for your 120 node height and 60 layer distance values. You could pull links' first and last horizontal segments towards origin / destination nodes:

Code
Select All
m_layout.Arrange(Diagram);

foreach (var link in Diagram.Links)
{
    var cp = link.ControlPoints;
    if (cp.Count > 4)
    {
        int l = cp.Count - 1;
        cp[1] = new PointF(cp[1].X, cp[1].Y - m_layout.LayerDistance / 2);
        cp[2] = new PointF(cp[2].X, cp[2].Y - m_layout.LayerDistance / 2);
        cp[l-1] = new PointF(cp[l-1].X, cp[l-1].Y + m_layout.LayerDistance / 2);
        cp[l-2] = new PointF(cp[l-2].X, cp[l - 2].Y + m_layout.LayerDistance / 2);
    }
}

Diagram.RoundedLinks = true;
Diagram.RoundedLinksRadius = 20; 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Erwin Lackner
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Dec 10th, 2018
Re: LayeredLayout routing links issue
Reply #2 - Jan 14th, 2022 at 10:05am
Print Post  
Hi Slavcho,

thanks for your solution, looks great now Smiley

Your great support and quick response times helps a lot Smiley Smiley Smiley

Regards Erwin
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint