Profile Picture

Prevent edge overlap

Posted By Aravin S 11 Years Ago
Author
Message
Aravin S
Posted 11 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 2, Visits: 1
Hi,

I am trying to create a directed graph with 2 links between a source and a target. I am using a NDynamic port with DynamicPortGlueMode.GlueToRotatedBounds. However, the edges are overlapping each other (pic1). Is there a way to show both edges with a slight separation so that it is easy to see both of the edges (pic2)?

Attachments
pic1.PNG (235 views, 5.00 KB)
pic2.PNG (229 views, 5.00 KB)
Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,053, Visits: 3,949

Hi,

To prevent the connectors from overlapping, you should modify the offset of their start and end plugs. Take a look at the following example and especially on the lines in bold:

NBasicShapesFactory factory = new NBasicShapesFactory();

factory.DefaultSize = new NSizeF(100, 100);

 

NShape shape1 = factory.CreateShape(BasicShapes.Rectangle);

shape1.Text = "Shape 1";

shape1.Location = new NPointF(100, 100);

document.ActiveLayer.AddChild(shape1);

 

NShape shape2 = factory.CreateShape(BasicShapes.Rectangle);

shape2.Text = "Shape 2";

shape2.Location = new NPointF(300, 100);

document.ActiveLayer.AddChild(shape2);

 

NLineShape line1 = new NLineShape();

line1.StyleSheetName = "Connectors";

line1.StartPlug.Offset = new NSizeF(0, -10);

line1.EndPlug.Offset = new NSizeF(0, -10);

document.ActiveLayer.AddChild(line1);

line1.FromShape = shape1;

line1.ToShape = shape2;

 

NLineShape line2 = new NLineShape();

line2.StyleSheetName = "Connectors";

line2.StartPlug.Offset = new NSizeF(0, 10);

line2.EndPlug.Offset = new NSizeF(0, 10);

document.ActiveLayer.AddChild(line2);

line2.FromShape = shape2;

line2.ToShape = shape1;

This piece of code will result in the following diagram (which exactly fulfils your requirements):

Nevron Diagram Offsetted Connectors



Best Regards,
Nevron Support Team



Aravin S
Posted 11 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 2, Visits: 1
Hi,

Thank you for the response. I tried this approach. However, when I move the nodes around, the link separation is not uniform (pic). Some even overlap at certain angles. Is there a way to have a uniform separation among the links (e.g. say 2 px)? There is only 1 DynamicPorts on each vertex. Should I add more ports? I need the links to point to the center. Or should I manually set the separation on some event?

Thanks.

Attachments
pic.PNG (229 views, 33.00 KB)
Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)Supreme Being (4,434 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,053, Visits: 3,949
Hello Aravin,
You should submit a support ticket. Take a look at the technical support options here: http://www.nevron.com/Support.Overview.aspx

Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic