From 33409c22c4bbf50560cfd82a99fd5fcd4b540cf5 Mon Sep 17 00:00:00 2001 From: pkv Date: Tue, 22 Nov 2005 08:32:55 +0000 Subject: [PATCH] fix for GVIEW10589 --- src/VVTK/VVTK_InteractorStyle.cxx | 26 ++++++++++++++++++++++++++ src/VVTK/VVTK_InteractorStyle.h | 27 +++++++++++++++++++++++++++ src/VVTK/VVTK_MainWindow.cxx | 12 ++++++++++-- src/VVTK/VVTK_MainWindow.h | 2 ++ 4 files changed, 65 insertions(+), 2 deletions(-) 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; }; -- 2.39.2