Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagram Link Lengths (Read 2654 times)
BidMaestro
Junior Member
**
Offline


to learn is to live

Posts: 74
Location: Australia
Joined: Apr 20th, 2008
Diagram Link Lengths
May 9th, 2009 at 10:20am
Print Post  
Is it possible to lengthen diagram links after a Layout Arrange has been performed? I noticed the link length field is readonly and cannot be altered.
The purpose of this request is to push apart or contract the nodes in the diagram area without changing nodedistance values and performing another arrange. This is a situation where a user manual re-arranges nodes and wishes to automatically expand the distance bewteen the nodes

regards
Doug
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram Link Lengths
Reply #1 - May 9th, 2009 at 11:54am
Print Post  
Multiplying the node positions by the same factor should move them apart uniformly, and the result should be that the links are lengthened by the same factor.

Code
Select All
float factor = 1.5f;
foreach (DiagramNode node in diagram.Nodes)
{
	 RectangleF r = node.Bounds;
	 PointF p = new PointF(r.X, r.Y);
	 p.X *= factor;
	 p.Y *= factor;
	 node.Move(p.X, p.Y);
}
 



If using links with more than one segments, you could multiply their intermediate control points by the same factor, or enable the RetainForm property, so that they also preserve their shape.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
BidMaestro
Junior Member
**
Offline


to learn is to live

Posts: 74
Location: Australia
Joined: Apr 20th, 2008
Re: Diagram Link Lengths
Reply #2 - May 9th, 2009 at 12:01pm
Print Post  
Stoyo

You guys continually amaze me on how how quick you respond..... and with great resolutions...I will try this one shortly.

Doug
  
Back to top
WWW  
IP Logged
 
BidMaestro
Junior Member
**
Offline


to learn is to live

Posts: 74
Location: Australia
Joined: Apr 20th, 2008
Re: Diagram Link Lengths
Reply #3 - May 9th, 2009 at 1:10pm
Print Post  
Stoyo

Your code after I converted it to VB.Net worked a treat...except where I have an attachednode containing text which is moved further away from its attached base node.

I wrote two pieces of code the first with an expansion factor of 1.1 to expand the diagram by 10% and the second with a contraction factor of 0.9 to contract the diagram by 10%

Doug
  
Back to top
WWW  
IP Logged
 
BidMaestro
Junior Member
**
Offline


to learn is to live

Posts: 74
Location: Australia
Joined: Apr 20th, 2008
Re: Diagram Link Lengths
Reply #4 - May 9th, 2009 at 1:52pm
Print Post  
Stoyo

I was able to address the problem of the attachednodes being moved by excluding them as I looped through the nodes and only applying the expansion or contraction factor to nodes that were not attached...fortunately I had the means in place to readily identify the attachednodes.

Doug
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram Link Lengths
Reply #5 - May 10th, 2009 at 8:41am
Print Post  
Hi Doug,

You can always find out if a node is attached by checking its MasterGroup property.

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