Picking multiple annotations

classic Classic list List threaded Threaded
2 messages Options
David David
Reply | Threaded
Open this post in threaded view
|

Picking multiple annotations

I'm trying to get mouse picking working on my scene.  For features like lines and polygons, I'm just using an IntersectionPicker which is working fine, but I've noticed this doesn't work for annotations, such as when I use a PlaceNode to display an icon in the scene.  I read in another thread to try using an RTTPicker::Callback, such as the one used in the picking example, and that works great...for single items, specifically the ones closest to the camera.  I need a way to get all of the annotations under the cursor.

The main use case for this is right-clicking.  When the user right-clicks in the scene, I want to get everything (of interest) under the cursor.  Understandably, the RTTPicker only returns hits on the object that is rendered "on top", and not on any objects under it.  But since annotations like this are rendered in screen space, I don't know how else to get to them.

The way my scene graph is structured at a very high level is more or less like this


Note that "Feature Node" here just means the nodes where I'm adding all of my dynamic features, whereas the Map Node is what's loaded from the .earth file.  I'm adding the Feature Node to the RTTPicker so that only my objects are picked.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Picking multiple annotations

David,
Your observation is correct: the RTTPicker will only be able to pick the top-most annotation. The bad news is that osgEarth does not have any built-in alternative that would let you pick multiple overlapping screen-space objects. Time to roll up the sleeves :)
Glenn Waldron / Pelican Mapping