Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic getNodesIn(Rectangle2D.Float) anyone? (Read 4604 times)
koosala
Full Member
***
Offline


Java Happens

Posts: 136
Joined: May 13th, 2007
getNodesIn(Rectangle2D.Float) anyone?
Jul 11th, 2007 at 8:40am
Print Post  
Hi,

There is a function FlowChart.getBoxes() which gets all the boxes on the flowchart. Now, in very interactive diagramming, where we write logic on mouse moves/drags using this function turns into a lot of processing, especially if there are like 1000 boxes spread over the canvas.

Can a similar function be provided where the search scope could be reduced to a specified rectangle so that we deal with fewer objects?

I know there is getNodesAt(Point), I was thinking maybe getNodesIn(Rectangle2D.Float)

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: getNodesIn(Rectangle2D.Float) anyone?
Reply #1 - Jul 11th, 2007 at 9:04am
Print Post  
Hi,

You could call Rectangle2D.contains(aBox.getBounds()) to determine which boxes are inside the rectangle, and then process only them.

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


Java Happens

Posts: 136
Joined: May 13th, 2007
Re: getNodesIn(Rectangle2D.Float) anyone?
Reply #2 - Jul 11th, 2007 at 9:18am
Print Post  
Hi Stoyan,

The Rectangle2D.Contains method would return a true or a false.

So, I will have a Rectangle2D object with me. Then I will have to pass each of the box's bounds to that guy to check if the rectangle contains it.

So, I will have to loop through each of these boxes on the flowchart.

I hope I didn't understand your explanation wrong.

I was just wondering having a trimmed down function that was something like Flowchart.getNodesIn(Rectangle 2D.Float)

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: getNodesIn(Rectangle2D.Float) anyone?
Reply #3 - Jul 11th, 2007 at 10:31am
Print Post  
Hi Praveen,

That's correct. We can add a function as well, but not before we release version 1.0.1 of the control.

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


Java Happens

Posts: 136
Joined: May 13th, 2007
Re: getNodesIn(Rectangle2D.Float) anyone?
Reply #4 - Jul 12th, 2007 at 2:50am
Print Post  
Hi,

That's alright. I was wondering if you'd internally use a more optimized method than searching through all the boxes. If that is how your API would be doing it anyway, I will include that code myself right now.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: getNodesIn(Rectangle2D.Float) anyone?
Reply #5 - Jul 12th, 2007 at 5:04am
Print Post  
Hi,

At this time we can only implement it using a linear search. Our developers are working on R*-tree implementation for storing diagram items that will improve performance for large diagrams, but it won't be available for at least a couple of months.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint