]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Adds treatment of 'S' 'P' keypressing
authorpkv <pkv@opencascade.com>
Mon, 19 Sep 2005 10:42:07 +0000 (10:42 +0000)
committerpkv <pkv@opencascade.com>
Mon, 19 Sep 2005 10:42:07 +0000 (10:42 +0000)
src/VVTK/VVTK_InteractorStyle.cxx
src/VVTK/VVTK_InteractorStyle.h

index 617f8e548e18b7f59ebf5b57d43861df9013d746..31abefa1e3c497cb7b2d96708b155a45f46504a8 100644 (file)
@@ -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);
   }
 }
 
index 9690b9c7705bc7f10a62048a5d678c2564f0a7e3..245b7f8f08c2b359531f8c636deb27d28d7e5704 100644 (file)
@@ -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