Get Selected nodes

4 views
Skip to first unread message

Jeroen Van hove

unread,
Mar 9, 2010, 5:09:04 PM3/9/10
to guess-discuss
hi, i'm visualizing an MPLS network using Guess. can anybody point me
in the right direction how i can get the nodes who are currently
viewed on the screen?
For example when you press shift an draw a rectange to zoom in. Have
tried about anything now but obvieusly still not the correct one.
(i'm guessing it would have to do something with piccolo?)

Thanks

Eytan Adar

unread,
Mar 10, 2010, 8:46:17 AM3/10/10
to guess-...@googlegroups.com
It's a pretty gross violation of abstraction barriers, but if you're
using the piccolo interface (this is default), you can do:

cambounds = v.getGCamera().getViewBounds()

which asks the camera what it's looking at, and then this selects the
nodes in that region:

(x >= cambounds.x) & (x <= (cambounds.x + cambounds.width)) & (y >=
cambounds.y) & (y <= (cambounds.y + cambounds.height))

you might need to play a little with the widths and heights of nodes,
but it mostly works.

-Eytan

> --
> You received this message because you are subscribed to the Google Groups "guess-discuss" group.
> To post to this group, send email to guess-...@googlegroups.com.
> To unsubscribe from this group, send email to guess-discus...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/guess-discuss?hl=en.
>
>

Jeroen Van hove

unread,
Mar 13, 2010, 9:55:42 AM3/13/10
to guess-discuss
The problem in fact is that i don't know how to access the piccolo
object from guess.
I was already thinking about your solution before, but in order to do
this i need the piccolo object.

On 10 mrt, 14:46, Eytan Adar <eytana...@gmail.com> wrote:
> It's a pretty gross violation of abstraction barriers, but if you're
> using the piccolo interface (this is default),  you can do:
>
> cambounds = v.getGCamera().getViewBounds()
>
> which asks the camera what it's looking at, and then this selects the
> nodes in that region:
>
> (x >= cambounds.x) & (x <= (cambounds.x + cambounds.width)) & (y >=
> cambounds.y) & (y <= (cambounds.y + cambounds.height))
>
> you might need to play a little with the widths and heights of nodes,
> but it mostly works.
>
> -Eytan
>

Jeroen Van hove

unread,
Mar 15, 2010, 5:48:07 PM3/15/10
to guess-discuss
Just for the next persons who would encounter this issue.

found out that Guess.getFrame() equally returns a GFrame. than it is
only a mather of making a minar adjustment to the Guess source.
In GFrame.java add:
public MySelectionHandler getSelectionHandler(){
return pseh;
}

when using Guess.getFrame() just cast it to GFrame. and than you will
have everything you need.

Reply all
Reply to author
Forward
0 new messages