[vtk-developers] How to rotate and scale a vtkWidget

darkcminor darkcminor at gmail.com
Sun Dec 8 13:15:03 EST 2013


What would be the best approach to scale and rotate a widget


for instance vtkDistanceWidget has an internal representation: the visible
part which
is a subclass of vtkProp.  This is not directly pickable, but it
has an internal actor which is. In this case, its a vtkAxisActor2D which
is a subclass of vtkActor2D.

So to be able to rotate a widget I guess the way would be to instantiate and
maintain a vtkPropPicker and add a callback to listen for pick events. then
add specific actors for it to pick:

picker->PickFromListOn();
picker->AddPickList(vtkDistanceRepresentation2D::SafeDownCast(widget->GetRepresentation())->GetAxis(
picker->AddObserver( vtkCommand::PickEvent, mycallback );

where mycallback would be a subclass of vtkCommand in which then we can
traverse the list of props in the picker, see which one was picked by mouse
click then remove it and its associated parent widget from your
renderwindow. 

Then apply rotation or scale to prop

What do you think about it, is this even possible?

Or, you could add an observer to the renderwindow's interactor
and listen for keypress events.  In that observer/callback, you could
retrieve the mouse coordinates, and fire a pick into the renderer, and
then see which prop was picked and delete it.




--
View this message in context: http://vtk.1045678.n5.nabble.com/How-to-rotate-and-scale-a-vtkWidget-tp5724909.html
Sent from the VTK - Dev mailing list archive at Nabble.com.



More information about the vtk-developers mailing list