Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Adding shape Nodes to lanes (Read 2429 times)
SSI
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Dec 1st, 2009
Adding shape Nodes to lanes
Dec 1st, 2009 at 10:41pm
Print Post  
Hi,

I am creating a new lane diagram . Is there a method to add shapenodes to specific lanes?
for example, if i have 5 lanes in my diagram , is there a specific method to add a shapenode to lane 3?

Thanks,
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Adding shape Nodes to lanes
Reply #1 - Dec 2nd, 2009 at 8:01am
Print Post  
Hi,

You could proceed like this:

Code
Select All
ShapeNode AddNode(int lane)
{
	RectangleF laneBounds = GetLaneBounds(lane);
	RectangleF nodeBounds = new RectangleF(
	laneBounds.X + 15, laneBounds.Y + 15, 40, 30);
	foreach (DiagramNode node in GetLaneNodes(lane))
	{
		if (node.Bounds.Right > nodeBounds.X)
			nodeBounds.X = node.Bounds.Right + 20;
	}
	ShapeNode newNode = diagram.Factory.CreateShapeNode(nodeBounds);
	newNode.LayoutTraits["lane"] = lane;
	return newNode;
}

RectangleF GetLaneBounds(int lane)
{
	return new RectangleF(
		0, lane * 60, diagram.Bounds.Width, 60);
}

List<DiagramNode> GetLaneNodes(int lane)
{
	List<DiagramNode> laneNodes = new List<DiagramNode>();
	foreach (DiagramNode node in diagram.Nodes)
		if (node.LayoutTraits.Contains("lane") && lane.Equals(node.LayoutTraits["lane"]))
			laneNodes.Add(node);
	return laneNodes;
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
SSI
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Dec 1st, 2009
Re: Adding shape Nodes to lanes
Reply #2 - Dec 2nd, 2009 at 10:19pm
Print Post  
Hi, Thanks, this did help a lot.

I have one more question, when  i add links joining nodes, the seem to overlap a lot(the links arent clear). Is there a setting I can turn on on the links which will not allow this overlapping so that they are clearer.

Thanks,
Gauri
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Adding shape Nodes to lanes
Reply #3 - Dec 3rd, 2009 at 8:41am
Print Post  
Hi,

Call Diagram.RouteAllLinks() after adding the nodes, or create an OrthogonalRouter instance and call its Arrange method.

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