Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Finding the FlowChart's size (Read 4766 times)
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Finding the FlowChart's size
Jun 6th, 2007 at 9:22am
Print Post  
I've created a FlowChart. The I've ran an AnnealLayout on it. I want to get the Chart's diemnsions, and change them if necessary. If I use getBounds - I receive Rectangle with 0 values. I assume this is because it wasn't painted yet. Is there a way to get the Chart's dimensions?

Explanation: maybe you'll have a better idea. I want the chart to have the same aspect ration as the Overview, so that the Overview will be allways filled with the chart. If there's another way to do that (besides recalculating the chart's size - much better).

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Finding the FlowChart's size
Reply #1 - Jun 6th, 2007 at 10:05am
Print Post  
You should call getDocBounds; perhaps getBounds is defined somewhere up in the class hierarchy. Call resizeToFitItems after running a layout to make the document area big enough to fit all items. If you leave the AnnealLayout.LayoutArea empty and set the AnnealLayout.WidthHeightRatio, the control will calculate a layout area with the said ratio. Then DocBounds should have the same ratio after you call resizeToFitItems.

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



Posts: 163
Joined: May 2nd, 2007
Re: Finding the FlowChart's size
Reply #2 - Jun 6th, 2007 at 11:32am
Print Post  
I've tried using the setWidthHeightRatio - but it doesn't seem to work. Every time I run the Anneal layout, I get a different document ratio.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Finding the FlowChart's size
Reply #3 - Jun 6th, 2007 at 11:39am
Print Post  
Ok, that would work only if there are nodes placed exactly at each side of the layout area, which is not guaranteed. You could copy the formula that sets the layout area from AnnealLayout.java and use it to set the document size as well.

Stoyan
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: Finding the FlowChart's size
Reply #4 - Jun 6th, 2007 at 11:53am
Print Post  
I see that you don't take into account the node size. For example, to test if node is in drawing area, you test its center.
This means that if I have box with large width and with small height, the result may be a drawing area more wide than I intended to. Is that correct?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint