Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic AttachTo, arrow routing and MeasureUnit (Read 3309 times)
koosala
Full Member
***
Offline


Java Happens

Posts: 136
Joined: May 13th, 2007
AttachTo, arrow routing and MeasureUnit
May 27th, 2007 at 8:44am
Print Post  
1. There is function to attach an node to another node - attachto, but I could not see any function down the line that would tell me what node my node was attached to. Something like 

Node.getNodeAttached() which would give back the node this node was attached to. Is there some way of finding this out?

2. Is there a way that the arrow routing could be done using a custom routing algorithm altogether? I can see that there are some ways that the internal routing algorithm can be tuned. But is there a way the whole algorithm be replaced if needed?

3. Flowchart mouse events can be handled - for example mouseClick, but the MouseEvent class gives back the mouse location in Pixels, but the Flowchart can have its MeasureUnit set to millimeters. So, point provided by the mouse event cannot be directly used by the application, for example
..
MouseEvent me
..
flowchart.getItemAt(new Point2D(me.getX(), me.getY())
without first converting the me.getX() and me.getY() to millimeters.

With lot of classes being built around the flowchart, with inheritance, containment and the works, it gets hard to track if everyone is religiously following the conversion before using it.

Or is there an easier way to solve this problem?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: AttachTo, arrow routing and MeasureUnit
Reply #1 - May 27th, 2007 at 4:13pm
Print Post  
Hi,

1. attachTo() implicitly creates a Group object. You can use the following methods to get access to the node that another node is attached to:

mainNode = node.getMasterGroup().getMainItem();

2. The only way to do that is to disable the built-in routing and then use Arrow.setSegmentCount and Arrow.getControlPoints to set the number and coordinates of the control points.

3. There is a DocClicked event that gives you the mouse position in document coordinates. Otherwise you can use flowChart.devicetoDoc to convert from pixels to millimeters.

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