Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Rearrange Path (Read 1599 times)
khstar
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 19
Joined: Apr 23rd, 2009
Rearrange Path
Jun 9th, 2009 at 1:23am
Print Post  
How can I rearrange a path?
Is there any way to rearrange a path?
I just want to change a start point in cycle path.

3 > 4 > 5 > 1 > 2 > (3)
the above has to be changed like below
1 > 2 > 3 > 4 > 5 > (1)


And I cannot put same node twice to a path.
in my app, I need to put same item twice.
But it doesn't work by 'add' method.
Would you show me the way?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Rearrange Path
Reply #1 - Jun 9th, 2009 at 5:01am
Print Post  
Try this method:

Code
Select All
void ShiftPath(DiagramNodeCollection path, int step)
{
	List<RectangleF> boundsList = new List<RectangleF>();
	foreach (DiagramNode node in path)
		boundsList.Add(node.Bounds);
	for (int i = 0; i < path.Count; ++i)
		path[i].Bounds = boundsList[(i + step) % path.Count];

	foreach (DiagramNode node in path)
	{
		DiagramLinkCollection links = node.GetAllLinks();
		foreach (DiagramLink link in links)
			link.Route();
	}
}
 



The same node cannot be displayed at two different positions. You will have to create an additional node representing the same business object of yours.

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


I love YaBB 1G - SP1!

Posts: 19
Joined: Apr 23rd, 2009
Re: Rearrange Path
Reply #2 - Jun 9th, 2009 at 6:31am
Print Post  
pathfinder returned pathcollection, not diagramnodecollection. ???

How can I modify your code?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Rearrange Path
Reply #3 - Jun 9th, 2009 at 8:05am
Print Post  
Change the type of the "path" argument to Path, and then loop over path.Nodes:

foreach (DiagramNode node in path.Nodes)
...

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