[vtkusers] Picker + Interactor Style Problems
Lachlan Blackhall
lachlan at chryatech.com.au
Tue Jan 25 06:21:33 EST 2005
Gday,
I want to be able to do picking with my mouse so i have created a new
function derived from vtkCommand that i get to respond to a
leftbuttonpressevent.
Once im in this event i want to generate an endpick event so that my
picking script gets called.
I dont really know how to do this. I tried
vtkInteractorStyle *style=vtkInteractorStyle::New();
vtkRenderWindowInteractor *iren =
reinterpret_cast<vtkRenderWindowInteractor*>(caller);
iren->SetInteractorStyle(style);
iren->SetKeyCode(int ('p'));
style->OnChar();
which works fine but this destroys all the original mouse interaction
capabilities (zoom, rotate etc..). If i do the following the program
crashes after i click an actor
vtkInteractorStyle *style=vtkInteractorStyle::New();
vtkRenderWindowInteractor *iren =
reinterpret_cast<vtkRenderWindowInteractor*>(caller);
vtkInteractorStyle *style_orig = (vtkInteractorStyle *)
iren->GetInteractorStyle();
iren->SetInteractorStyle(style);
iren->SetKeyCode(int ('p'));
style->OnChar();
iren->SetInteractorStyle(style_orig);
I have set up another function and callback to respond to the pick
event and using gdb i know that this callback occurs with both blocks
of code just the second one (which i need so it zooms and such) wont
work.
If i try
vtkRenderWindowInteractor *iren =
reinterpret_cast<vtkRenderWindowInteractor*>(caller);
vtkInteractorStyle *style = (vtkInteractorStyle *)
iren->GetInteractorStyle();
iren->SetKeyCode(int ('p'));
style->OnChar();
then the pick event is no longer generated. ????????????????
any help would be appreciated
thanks
Lachlan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2339 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050125/fa333648/attachment.bin>
More information about the vtkusers
mailing list