<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div style="" class="">Hi all,</div><div style="" class=""><br style="" class=""></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">I noticed that getting the currently picked actor from the picker in the interactor doesn't always work.</div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">Some interactor styles and widgets (e.g. vtkInteractorstyleTrackballActor) have their own picker which is used for the picking but which is different from the one in the interactor.</div><div class="" style="color:
rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br style="" class=""></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">I wrote a class that has awareness of the interactor.</div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">I would like to use this->Interactor->GetPicker() to get access to the currently picked object. However this doesn't work with observers like vtkInteractorstyleTrackballActor. Using this->Interactor->GetInteractorStyle()->GetPicker() is also not an option because not all observers use their own picker (and
a GetPicker() function does not exist in vtkInteractorstyleTrackballActor).</div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br style="" class=""></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">The hack I made was to derive from vtkInteractorstyleTrackballActor and overload the SetInteractor() function:</div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br style="" class=""></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida
Grande,sans-serif; background-color: transparent; font-style: normal;">void MyClass::SetInteractor(vtkRenderWindowInteractor* rwi)</div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">{</div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""> this->Superclass::SetInteractor(rwi);</span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><span style="" class=""> if( this->Interactor != NULL )</span></span></div><div class=""
style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><span style="" class=""><span style="" class=""> {</span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""> <span style="" class=""> vtkCellPicker* picker = vtkCellPicker::New;</span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><span
style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""> <span style="" class=""> picker->SetTolerance(0.001);</span></span></span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""> <span style="" class=""> this->Interactor->SetPicker(picker);</span></span></span></span></span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;
background-color: transparent; font-style: normal;"><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""> <span style="" class=""> picker->Delete();</span></span></span></span></span></span></span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class="">
}</span></span></span></span></span></span></span></span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class="">}</span></span></span></span></span></span></span></span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span
style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""></span></span></span></span></span></span></span></span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class="">This works. But I'd like to use MyClass with different observers w/o having to derive from all of
them...</span></span></span></span></span></span></span></span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""></span></span></span></span></span></span></span></span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><span style="" class=""><span style="" class=""><span
style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class="">I've also looked at the PickingManager class since all observers seems to register their pickers, but firstly it is not enabled by default and secondly to get the current selection I have to call GetAssemblyPath() which performs a pick which I don't want because this invokes a PickEvent.. I use the event in MyClass but only when I pick an object, not when I want the currently picked object. Giving vtkPickingManager a public SelectedPicker() function (like </span></span></span></span></span></span></span></span></span></span></span></span><br style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style=""
class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class="">vtkPickingManager::Internal has) would do the trick here..</span></span></span></span></span></span></span></span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""></span></span></span></span></span></span></span></span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida
Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class="">I guess my question is:</span></span></span></span></span></span></span></span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class="">How would a
write code to get the currently picked object that works with various observers when I only have awareness of the interactor?</span></span></span></span></span></span></span></span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""></span></span></span></span></span></span></span></span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent;
font-style: normal;"><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class="">Maarten<br> </span></span></span></span></span></span></span></span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style=""
class=""></span></span></span></span></span></span></span></span></span></span></span></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><span style="" class=""><br style="" class=""></span></span></span></span></span></span></span></span></span></span></span></span></div></div></body></html>