From 02c6b21ccb91777b0acfa821e757dbaef451d623 Mon Sep 17 00:00:00 2001 From: apo Date: Tue, 13 Sep 2005 04:08:49 +0000 Subject: [PATCH] 1. Port from QValueStack to std::stack. 2. To provide correct memory menagement --- src/SVTK/SVTK_RenderWindowInteractor.cxx | 25 ++++++++++++++++++++---- src/SVTK/SVTK_RenderWindowInteractor.h | 8 ++++---- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/SVTK/SVTK_RenderWindowInteractor.cxx b/src/SVTK/SVTK_RenderWindowInteractor.cxx index 709505d89..f371c025d 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_RenderWindowInteractor.cxx @@ -21,8 +21,8 @@ // // // -// File : VTKViewer_RenderWindowInteractor.cxx -// Author : Nicolas REJNERI +// File : +// Author : // Module : SALOME // $Header$ @@ -405,6 +405,19 @@ SVTK_RenderWindowInteractor ::~SVTK_RenderWindowInteractor() { if(MYDEBUG) INFOS("~SVTK_RenderWindowInteractor() - "<SetInteractorStyle(NULL); + while(!myInteractorStyles.empty()){ + const PInteractorStyle& aStyle = myInteractorStyles.top(); + aStyle->SetInteractor(NULL); + myInteractorStyles.pop(); + } + + SetRenderer(NULL); + + GetDevice()->SetRenderWindow(NULL); } vtkRenderWindow* @@ -439,7 +452,7 @@ SVTK_RenderWindowInteractor if(GetRenderer()){ myRenderWindow->RemoveRenderer(getRenderer()); - theRenderer->SetInteractor(NULL); + myRenderer->SetInteractor(NULL); } myRenderer = theRenderer; @@ -488,7 +501,7 @@ vtkInteractorStyle* SVTK_RenderWindowInteractor ::GetInteractorStyle() { - return myInteractorStyles.isEmpty() ? 0 : myInteractorStyles.top().GetPointer(); + return myInteractorStyles.empty() ? 0 : myInteractorStyles.top().GetPointer(); } @@ -616,6 +629,10 @@ SVTK_RenderWindowInteractor ::wheelEvent( QWheelEvent* event ) { QVTK_RenderWindowInteractor::wheelEvent(event); + if(event->delta() > 0) + GetDevice()->InvokeEvent(SVTK::ZoomInEvent,NULL); + else + GetDevice()->InvokeEvent(SVTK::ZoomOutEvent,NULL); #ifdef GENERATE_SUIT_EVENTS emit WheelMoved( event ); #endif diff --git a/src/SVTK/SVTK_RenderWindowInteractor.h b/src/SVTK/SVTK_RenderWindowInteractor.h index 146be1081..e36bfd23d 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.h +++ b/src/SVTK/SVTK_RenderWindowInteractor.h @@ -32,10 +32,9 @@ #include "SVTK.h" #include "SVTK_Selection.h" -#include -#include - #include +#include +#include class vtkGenericRenderWindowInteractor; class vtkInteractorStyle; @@ -202,7 +201,8 @@ class SVTK_EXPORT SVTK_RenderWindowInteractor: public QVTK_RenderWindowInteracto vtkSmartPointer myRenderWindow; typedef vtkSmartPointer PInteractorStyle; - QValueStack myInteractorStyles; + typedef std::stack TInteractorStyles; + TInteractorStyles myInteractorStyles; }; -- 2.39.2