]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
fix for GVIEW10589
authorpkv <pkv@opencascade.com>
Tue, 22 Nov 2005 08:32:55 +0000 (08:32 +0000)
committerpkv <pkv@opencascade.com>
Tue, 22 Nov 2005 08:32:55 +0000 (08:32 +0000)
src/VVTK/VVTK_InteractorStyle.cxx
src/VVTK/VVTK_InteractorStyle.h
src/VVTK/VVTK_MainWindow.cxx
src/VVTK/VVTK_MainWindow.h

index e95debe766d5bc7e42ea71237ca64428ac6e9fc8..9386a162733e182be428cfaf50640a172b5f2031 100644 (file)
@@ -269,3 +269,29 @@ VVTK_InteractorStyle
 {
   Interactor->InvokeEvent(VISU::SetSMIncreaseMagnificationEvent,NULL);
 }
+
+vtkStandardNewMacro(VVTK_InteractorStyleController);
+//----------------------------------------------------------------------------
+VVTK_InteractorStyleController::VVTK_InteractorStyleController()
+{
+  myIncrement=10;
+}
+//----------------------------------------------------------------------------
+VVTK_InteractorStyleController::~VVTK_InteractorStyleController()
+{
+}
+//----------------------------------------------------------------------------
+int VVTK_InteractorStyleController::IncrementIncrease()
+{
+  myIncrement*=2;
+  return myIncrement;
+}
+//----------------------------------------------------------------------------
+int VVTK_InteractorStyleController::IncrementDecrease()
+{
+  myIncrement/=2;
+  if (!myIncrement){
+    myIncrement=1;
+  }
+  return myIncrement;
+}
index 5eaf23e92f558ef416f1396dccbd29e357cd5056..8f06666e0226626efed57c7d8d70cd0114d9e88a 100644 (file)
 #ifndef __VVTK_InteractorStyle_h
 #define __VVTK_InteractorStyle_h
 
+
 #include "VVTK.h"
 
 #include "SVTK_InteractorStyle.h"
+//
+//! Control the value of increment in new style of interaction.
+/*!
+  This class controls of value of increment,
+  for pan/rotate/zoom operations in new style 
+  of interaction
+*/
+class VVTK_InteractorStyleController : public SVTK_InteractorStyleController {
+ public:
+  vtkTypeMacro(VVTK_InteractorStyleController,SVTK_InteractorStyleController);
+  static VVTK_InteractorStyleController* New();
+  
+  //! Increace the increment value by multiplying on 2
+  virtual int IncrementIncrease();
+
+  //! Decreace the increment value by division on 2
+  virtual int IncrementDecrease();
+  
+ protected:
+  VVTK_InteractorStyleController();
+  virtual ~VVTK_InteractorStyleController();
+  //
+ private:
+  VVTK_InteractorStyleController(const VVTK_InteractorStyleController&);  //Not implemented
+  void operator=(const VVTK_InteractorStyleController&);  //Not implemented
+};
 
 class VISU_PickingSettings;
 
index ac1d5aa8f0c7527c4eeb8d24744008d00a568507..b7c2e2298d07354516895530e1021712efd492db 100644 (file)
@@ -50,8 +50,11 @@ VVTK_MainWindow
                  const char* theName,
                  SUIT_ResourceMgr* theResourceMgr):
   SVTK_MainWindow(theParent,theName,theResourceMgr),
-  myInteractorStyle(VVTK_InteractorStyle::New())
+  myInteractorStyle(VVTK_InteractorStyle::New()),
+  myInteractorStyleController(VVTK_InteractorStyleController::New())
 {
+  myInteractorStyle->SetController(myInteractorStyleController.GetPointer());
+  myInteractorStyleController->Delete();
   myInteractorStyle->Delete();
 
   moveDockWindow(myToolBar,Qt::DockLeft);
@@ -61,7 +64,12 @@ VVTK_MainWindow
 void
 VVTK_MainWindow
 ::Initialize(SVTK_RenderWindowInteractor* theInteractor)
-{
+{ 
+  vtkInteractorStyle* pVIS=theInteractor->GetInteractorStyle();
+  SVTK_InteractorStyle *pInteractorStyle=dynamic_cast<SVTK_InteractorStyle*>(pVIS);
+  if (pInteractorStyle){
+    pInteractorStyle->SetController(myInteractorStyleController.GetPointer());
+  }
   SVTK_MainWindow::Initialize(theInteractor);
 }
 
index 718bd29611b9036c6958a0a9025a2dc58e257ae1..edeb8dea5d513fb78aa5955aada202a2e5ef73f4 100644 (file)
@@ -15,6 +15,7 @@ class VVTK_SegmentationCursorDlg;
 class VISU_OutsideCursorSettings;
 class VISU_PickingSettings;
 class VVTK_InteractorStyle;
+class VVTK_InteractorStyleController;
 class VVTK_PickingDlg;
 class VVTK_MainWindow2;
 class VVTK_Renderer1;
@@ -58,6 +59,7 @@ public:
 
  protected:
   vtkSmartPointer<VVTK_InteractorStyle> myInteractorStyle;
+  vtkSmartPointer<VVTK_InteractorStyleController> myInteractorStyleController;
 };