<DIV id=RTEContent> <DIV id=RTEContent> <DIV>Hello everybody,</DIV> <DIV> </DIV> <DIV>The default vtk interactor styles are not convenient for many applications, atleast for a few of mine, and they need some customization.</DIV> <DIV> </DIV> <DIV> <DIV>I have had some hard time figuring this out, as i did not find any sort of documented help for this problem. I dont want others to go through the same thing again. So here is a brief startup solution guide to this problem.</DIV></DIV> <DIV> </DIV> <DIV>If you are working in C++, I would suggest you to write a custom class derived from vtkInteractorStyle ( the base class of all the interactor style classes in VTK ). You may also choose to derive any of the subclasses of vtkInteractorStyle, namely :</DIV> <DIV> </DIV> <DIV> ---- vtkInteractorStyleTrackballCamera</DIV> <DIV> ---- vtkInteractorStyleJoystickCamera </DIV> <DIV> ---- and there are a bunch of other
classes from which you can choose one.</DIV> <DIV> </DIV> <DIV>These subclasses have some interaction functionality already implemented, and you can derive your class from them and build upon the existing implementation.</DIV> <DIV> </DIV> <DIV>Once you derive on the vtk interactor style classes, it finally boils down to overriding the virtual functions for keyboard and mouse events, similar to the way you might have done in any of the GUI libraries.</DIV> <DIV> </DIV> <DIV>The virtual functions you may want to override with custom implementation are as follows:</DIV> <DIV> </DIV> <DIV> ---- OnLeftButtonDown()</DIV> <DIV> ---- OnLeftButtonUp()</DIV> <DIV> ---- OnRightButtonDown()</DIV> <DIV> ----- OnRightButtonUp()</DIV> <DIV> ----- OnMouseMove()</DIV> <DIV> ----- OnChar()</DIV> <DIV>----- and many other event callbacks are available..... you can check them in the VTK documentation and source code for the
vtkInteractorStyle.cxx</DIV> <DIV> </DIV> <DIV>If you want to know more about what is happening internally, you can go check the source code for the subclasses of vtkInteractorstyle too.</DIV> <DIV> </DIV> <DIV>You can use the above mentioned procedure, for example if you want to pick some points in your vtkRenderWindow with the mouse, rather than using the keyboard key "P".</DIV> <DIV> </DIV> <DIV>If you have anymore doubts, regarding this problem. I will be pleased to help as far as i can. </DIV> <DIV> </DIV> <DIV>Any comments on this solution are welcome, I am always in search for better solutions. If you have found a better solution, please let the community know.</DIV> <DIV> </DIV> <DIV>Bye</DIV> <DIV> </DIV> <DIV>Deepak Roy</DIV></DIV></DIV><p>
<hr size=1> <a href="http://us.lrd.yahoo.com/_ylc=X3oDMTFqODRtdXQ4BF9TAzMyOTc1MDIEX3MDOTY2ODgxNjkEcG9zAzEEc2VjA21haWwtZm9vdGVyBHNsawNmYw--/SIG=110oav78o/**http%3a//farechase.yahoo.com/">Yahoo! FareChase - Search multiple travel sites in one click.</a>