From: pkv Date: Tue, 22 Nov 2005 08:32:55 +0000 (+0000) Subject: fix for GVIEW10589 X-Git-Tag: BR-D5-38-2003_D2005-24-11~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=33409c22c4bbf50560cfd82a99fd5fcd4b540cf5;p=modules%2Fvisu.git fix for GVIEW10589 --- diff --git a/src/VVTK/VVTK_InteractorStyle.cxx b/src/VVTK/VVTK_InteractorStyle.cxx index e95debe7..9386a162 100644 --- a/src/VVTK/VVTK_InteractorStyle.cxx +++ b/src/VVTK/VVTK_InteractorStyle.cxx @@ -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; +} diff --git a/src/VVTK/VVTK_InteractorStyle.h b/src/VVTK/VVTK_InteractorStyle.h index 5eaf23e9..8f06666e 100644 --- a/src/VVTK/VVTK_InteractorStyle.h +++ b/src/VVTK/VVTK_InteractorStyle.h @@ -29,9 +29,36 @@ #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; diff --git a/src/VVTK/VVTK_MainWindow.cxx b/src/VVTK/VVTK_MainWindow.cxx index ac1d5aa8..b7c2e229 100644 --- a/src/VVTK/VVTK_MainWindow.cxx +++ b/src/VVTK/VVTK_MainWindow.cxx @@ -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(pVIS); + if (pInteractorStyle){ + pInteractorStyle->SetController(myInteractorStyleController.GetPointer()); + } SVTK_MainWindow::Initialize(theInteractor); } diff --git a/src/VVTK/VVTK_MainWindow.h b/src/VVTK/VVTK_MainWindow.h index 718bd296..edeb8dea 100644 --- a/src/VVTK/VVTK_MainWindow.h +++ b/src/VVTK/VVTK_MainWindow.h @@ -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 myInteractorStyle; + vtkSmartPointer myInteractorStyleController; };