#include "VVTK_InteractorStyle.h"
#include <vtkObjectFactory.h>
+#include <vtkRenderWindowInteractor.h>
#include <vtkCommand.h>
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
VVTK_InteractorStyle
-::VVTK_InteractorStyle()
+::VVTK_InteractorStyle()
+ : myPickingKey( 'P' ),
+ myIsMidButtonDown( false ),
+ myIsLeftButtonDown( false )
{
- printf ( "\n--- VVTK_InteractorStyle created ---\n" );
}
//----------------------------------------------------------------------------
if ( myIsLeftButtonDown )
OnLeftButtonDown( ctrl, shift, x, y );
}
+
+//----------------------------------------------------------------------------
+void
+VVTK_InteractorStyle
+::OnKeyDown()
+{
+ char key = Interactor->GetKeyCode();
+ if ( key == myPickingKey ) {
+ int x, y;
+ Interactor->GetEventPosition( x, y ); // current mouse position (from last mouse move event or any other event)
+ FindPokedRenderer( x, y ); // calls SetCurrentRenderer
+
+ myOtherPoint = myPoint = QPoint(x, y);
+ //printf ( "--- myPoint[ %d, %d ], myOtherPoint[ %d, %d ] ---\n", myPoint.x(), myPoint.y(), myOtherPoint.x(), myOtherPoint.y() );
+
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_SELECT);
+ onFinishOperation();
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ }
+}
static VVTK_InteractorStyle *New();
vtkTypeMacro(VVTK_InteractorStyle, vtkInteractorStyle);
+ void setPickingKey( char key ) { myPickingKey = key; }
+
protected:
VVTK_InteractorStyle();
~VVTK_InteractorStyle();
virtual void OnMiddleButtonDown(int ctrl, int shift, int x, int y);
virtual void OnLeftButtonUp(int ctrl, int shift, int x, int y);
virtual void OnMiddleButtonUp(int ctrl, int shift, int x, int y);
+ virtual void OnKeyDown();
private:
bool myIsMidButtonDown;
bool myIsLeftButtonDown;
+
+ char myPickingKey;
};
#endif