From 8cbf6cec1a77166956cd778fd30a508aea946e0e Mon Sep 17 00:00:00 2001 From: pkv Date: Mon, 19 Sep 2005 10:42:07 +0000 Subject: [PATCH] Adds treatment of 'S' 'P' keypressing --- src/VVTK/VVTK_InteractorStyle.cxx | 32 ++++++++++++++++++++++--------- src/VVTK/VVTK_InteractorStyle.h | 2 -- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/VVTK/VVTK_InteractorStyle.cxx b/src/VVTK/VVTK_InteractorStyle.cxx index 617f8e54..31abefa1 100644 --- a/src/VVTK/VVTK_InteractorStyle.cxx +++ b/src/VVTK/VVTK_InteractorStyle.cxx @@ -41,10 +41,9 @@ vtkStandardNewMacro(VVTK_InteractorStyle); //---------------------------------------------------------------------------- VVTK_InteractorStyle -::VVTK_InteractorStyle() - : myPickingKey( 'P' ), - myIsMidButtonDown( false ), - myIsLeftButtonDown( false ) +::VVTK_InteractorStyle(): + myIsMidButtonDown( false ), + myIsLeftButtonDown( false ) { } @@ -158,18 +157,33 @@ 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) + + if ( key == 'S' || key == 'P') { + int aSMWas, x, y; + SVTK_Selector* pSelector; + // + pSelector=GetSelector(); + aSMWas=pSelector->SelectionMode(); + // + pSelector->SetSelectionMode(NodeSelection); + if (key == 'P'){ + pSelector->SetSelectionMode(CellSelection); + } + // current mouse position (from last mouse move event or any other event) + Interactor->GetEventPosition( x, y ); 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() ); - + //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); + // + pSelector->SetSelectionMode(aSMWas); } } diff --git a/src/VVTK/VVTK_InteractorStyle.h b/src/VVTK/VVTK_InteractorStyle.h index 9690b9c7..245b7f8f 100644 --- a/src/VVTK/VVTK_InteractorStyle.h +++ b/src/VVTK/VVTK_InteractorStyle.h @@ -43,7 +43,6 @@ class VVTK_EXPORT VVTK_InteractorStyle : public SVTK_InteractorStyle static VVTK_InteractorStyle *New(); vtkTypeMacro(VVTK_InteractorStyle, vtkInteractorStyle); - void setPickingKey( char key ) { myPickingKey = key; } protected: VVTK_InteractorStyle(); @@ -63,7 +62,6 @@ class VVTK_EXPORT VVTK_InteractorStyle : public SVTK_InteractorStyle bool myIsMidButtonDown; bool myIsLeftButtonDown; - char myPickingKey; }; #endif -- 2.39.2