[vtkusers] How to identify picked objects in a scene?

Steffen Oeltze stoeltze at isg.cs.uni-magdeburg.de
Mon Mar 10 05:11:51 EDT 2008


Hi Corry,

I have between 40-100 actors. I will consider your idea regarding a hash 
table. However, this seems to me like a quite complicated solution for a 
very simple problem. Even in plain OpenGL one can assign names to the 
rendered objects (glPushName(...)) which are returned during picking. I 
wonder if there is a more simple solution to my problem. However, thank 
you very much for your reply!

Steffen




Cory Quammen schrieb:
> Steffen,
> 
> Can you just use the pointer as the ID of the vtkPolyData? If you have
> just a few actors, then a set of if statements like you give might
> satisfy your needs. If you have a bunch of actors and a bunch of
> different actions, you could set up a hash table with actors as keys
> and function pointers -- which represent actions to be taken -- as
> values. When you get the vtkPolyData from the picked actor, you can
> just look up the appropriate function in this hash table and execute
> it. Alternatively, you could create a hash table again with the
> vtkPolyData pointers as keys, but this time with integer IDs as values
> and switch the action based on the ID returned from a lookup to that
> hash table.
> 
> Hope that helps,
> Cory
> 
> On Sun, Mar 9, 2008 at 6:36 PM,  <stoeltze at isg.cs.uni-magdeburg.de> wrote:
>> Sorry that I could not make myself clear. I do exactly what you describe :
>>  getting the mapper, getting its inputs and casting it with vtkPolyData. My
>>  problem is, that I have several actors in the scene, each of them with an
>>  associated vtkPolyData. How do I know which one I picked? I want to to
>>  something like that:
>>
>>  IF Actor (vtkPolyData) x was picked DO action A
>>  IF Actor (vtkPolyData) y was picked DO action B
>>  ...
>>
>>  For that purpose, I need to assign an ID to the actor, or in my case it
>>  would be even better to have an ID associated to the vtkPolyData.
>>
>>  Hope, that clarifies things.
>>
>>  Steffen
>>
>>
>>
>>
> 
> 
> 





More information about the vtkusers mailing list