Prevent edge overlap


Author
Message
Aravin S
Aravin S
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
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 (270 views, 5.00 KB)
pic2.PNG (257 views, 5.00 KB)
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

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
Aravin S
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
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 (259 views, 33.00 KB)
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
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


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search