Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Loopback to same shape produces odd link in Orthogonal Router layout (Read 2119 times)
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Loopback to same shape produces odd link in Orthogonal Router layout
Jun 28th, 2012 at 5:31pm
Print Post  
Hi,

See the attached screenshots.
The highlighted shape has a link to itself.
In the Topological layout, there is a nice looped connector.
The Orthogonal Router layout produces a rather strange looking link that actually crosses the shape itself.
Any suggestions on how to avoid this?

Thanks

Jim
  

LoopBack_Issue_-_Topological.png (Attachment deleted)
LoopBack_Issue_-_Orthogonal_Router.png (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Loopback to same shape produces odd link in Orthogonal Router layout
Reply #1 - Jun 29th, 2012 at 7:37am
Print Post  
Call this for links-to-self to apply the loop shape:

Code
Select All
RectangleF r = link.Origin.Bounds;
float centerx = r.Left + r.Width / 2;
float dist = 16;
SetLinkPoints(link,
	new PointF(centerx, r.Top),
	new PointF(centerx - dist, r.Top - dist),
	new PointF(centerx + dist, r.Top - dist),
	new PointF(centerx, r.Top));

}

private void SetLinkPoints(DiagramLink link, params PointF[] points)
{
	link.AutoRoute = false;
	link.Style = LinkStyle.Bezier;
	link.ControlPoints.Clear();
	link.ControlPoints.AddRange(points);
	link.UpdateFromPoints(false, true);
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Re: Loopback to same shape produces odd link in Orthogonal Router layout
Reply #2 - Jun 29th, 2012 at 3:35pm
Print Post  
Stoyan,

Your code works great!
Many thanks.

Have a good weekend.

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