Page Index Toggle Pages: 1 [2]  Send TopicPrint
Hot Topic (More than 10 Replies) Attach to link (Read 14608 times)
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Attach to link
Reply #15 - Oct 7th, 2015 at 4:19pm
Print Post  
Hi,

Call nodes' getCenter() methods, find horizontal and vertical offsets and compare them:

Code
Select All
float dx = nodeCenter.x - decisionCenter.x;
float dy = nodeCenter.y - decisionCenter.y;
if (dx > dy)
{
  if (dx > 0) { /* decision on left of node */ }
  if (dx < 0) { /* decision on right of node */ }
}
else
{
  if (dy > 0) { /* decision above node */ }
  if (dy < 0) { /* decision below node */ }
} 



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


I Love MindFusion!

Posts: 121
Joined: Aug 31st, 2015
Re: Attach to link
Reply #16 - Oct 7th, 2015 at 4:55pm
Print Post  
Ok, thank you very much, but then in the first two cases I use Orientation.vertical while in the other two orientation.horizontal, right?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Attach to link
Reply #17 - Oct 7th, 2015 at 6:43pm
Print Post  
This corresponds to the orientation of first segment, I cannot tell it from the picture.
  
Back to top
 
IP Logged
 
Silvia88
Full Member
***
Offline


I Love MindFusion!

Posts: 121
Joined: Aug 31st, 2015
Re: Attach to link
Reply #18 - Oct 24th, 2015 at 4:23pm
Print Post  
Hi, is it possible to determine which is the link to which a node is attached? I mean I have a node which is attached to a link and I want to get that link
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Attach to link
Reply #19 - Oct 26th, 2015 at 6:17am
Print Post  
Hi,

You can find it from the Group object created for attachments:

Code
Select All
DiagramLink masterLink = null;
if (node.getMasterGroup() != null &&
	node.getMasterGroup().getMainItem() instanceof DiagramLink)
{
	masterLink = (DiagramLink)node.getMasterGroup().getMainItem();
} 



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