Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Link routing problems (Read 2403 times)
stefski
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 31
Location: Norway
Joined: Jul 17th, 2009
Link routing problems
Mar 19th, 2015 at 1:54pm
Print Post  
Hi,

working with version 5.7 we are having an issue with how a "free-floating" DiagramLink is "routed" when its Style is LinkStyle.Cascading and the auto route option is enabled.
The DiagramLink gets 3 segments, and the first and last segments are vertical. This results in a layout resembling the geometry of a football goal rather than the straight line we were expecting.
We would like to keep the LinkCascadingOrientation as Orientation.Auto, in order to support scenarios where end nodes are placed to the left and right of each other, as well as above and below each other.
Is there any setting, besides LinkCascadingOrientation, that can be applied in order to get a behaviour where new, unconnected, DiagramLinks will show as straight lines and not football goals?

  

Kind regards

Steffen Skov
OLGA Application Architect
Schlumberger Information Solutions AS
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link routing problems
Reply #1 - Mar 19th, 2015 at 7:29pm
Print Post  
Hi,

You could enable AutoRoute only for connected links if you want unconnected ones to remain with default cascading shape.

If you still need unconnected links to route around nodes in their way, you could create your own ILinkRouter implementation. E.g. this checks if current link's path would intersect any node; if it doesn't, the method returns without changing the current path, otherwise it delegates to the standard router:

Code
Select All
diagramView.Behavior = Behavior.DrawLinks;
diagram.AllowUnconnectedLinks = true;
diagram.RouteLinks = true;
diagram.LinkShape = LinkShape.Cascading;
diagram.LinkSegments = 3;
diagram.LinkRouter = new MyRouter(diagram);

class MyRouter : ILinkRouter
{
	public MyRouter(Diagram diagram)
	{
		qr = new QuickRouter(diagram);
	}

	QuickRouter qr;

	public bool RouteLink(DiagramLink link)
	{
		if (link.IsConnected || Diagram.Nodes.Any(link.Intersects))
			return qr.RouteLink(link);
		return true;
	}

	public void RouteLinks(DiagramLinkCollection links)
	{
		var newList = new DiagramLinkCollection();
		foreach (var link in links)
			if (link.IsConnected || Diagram.Nodes.Any(link.Intersects))
				newList.Add(link);
		qr.RouteLinks(newList);
	}

	public void Suspend()
	{
		qr.Suspend();
	}

	public void Resume(bool routeDeferredLinks)
	{
		qr.Resume(routeDeferredLinks);
	}

	public Diagram Diagram
	{
		get { return qr.Diagram; }
		set { qr.Diagram = value; }
	}
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint