From: vsr Date: Mon, 22 Aug 2005 06:59:43 +0000 (+0000) Subject: Fix a bug of SalomePy library with improper VTK viewer operations (the classes from... X-Git-Tag: T_3_0_2a1~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f2da78c77dc8e9666365db30e2cc5138b80587a2;p=modules%2Fgui.git Fix a bug of SalomePy library with improper VTK viewer operations (the classes from SVTK package should be used instead of VTKViewer). --- diff --git a/src/SALOME_PY/SalomePy.cxx b/src/SALOME_PY/SalomePy.cxx index 9df186b63..1013f34cc 100755 --- a/src/SALOME_PY/SalomePy.cxx +++ b/src/SALOME_PY/SalomePy.cxx @@ -40,10 +40,10 @@ #include "SalomeApp_Application.h" #include "SalomeApp_Study.h" -#include "VTKViewer_ViewManager.h" -#include "VTKViewer_ViewWindow.h" -#include "VTKViewer_RenderWindow.h" -#include "VTKViewer_RenderWindowInteractor.h" +#include "SVTK_ViewManager.h" +#include "SVTK_ViewWindow.h" +#include "SVTK_RenderWindow.h" +#include "SVTK_RenderWindowInteractor.h" using namespace std; @@ -76,7 +76,8 @@ static PyObject* GetPyClass(const char* theClassName){ return aPyClass; } -static VTKViewer_ViewWindow* GetVTKViewWindow() { +static SVTK_ViewWindow* GetVTKViewWindow() { + SVTK_ViewWindow* aVW = NULL; if ( SUIT_Session::session() ) { // get application SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); @@ -85,18 +86,18 @@ static VTKViewer_ViewWindow* GetVTKViewWindow() { SalomeApp_Study* aStudy = dynamic_cast( anApp->activeStudy() ); if ( aStudy ) { // find or create VTK view manager - VTKViewer_ViewManager* aVM = dynamic_cast( anApp->getViewManager( "VTKViewer", true ) ); + SVTK_ViewManager* aVM = dynamic_cast( anApp->getViewManager( "VTKViewer", true ) ); if ( aVM ) { - VTKViewer_ViewWindow* aVW = dynamic_cast( aVM->getActiveView() ); + aVW = dynamic_cast( aVM->getActiveView() ); // VSR : When new view window is created it can be not active yet at this moment, // so the following is a some workaround if ( !aVW && !aVM->getViews().isEmpty() ) - return dynamic_cast( aVM->getViews()[ 0 ] ); + aVW = dynamic_cast( aVM->getViews()[ 0 ] ); } } } } - return NULL; + return aVW; } /*! @@ -108,7 +109,7 @@ public: TResult myResult; TGetRendererEvent() : myResult( Py_None ) {} virtual void Execute() { - if( VTKViewer_ViewWindow* aVTKViewWindow = GetVTKViewWindow() ) { + if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow() ) { PyObject* aPyClass = GetPyClass("vtkRenderer"); vtkRenderer* aVTKObject = aVTKViewWindow->getRenderer(); myResult = PyVTKObject_New(aPyClass,aVTKObject); @@ -129,7 +130,7 @@ public: TResult myResult; TGetRenderWindowEvent() : myResult( Py_None ) {} virtual void Execute() { - if( VTKViewer_ViewWindow* aVTKViewWindow = GetVTKViewWindow() ) { + if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow() ) { PyObject* aPyClass = GetPyClass("vtkRenderWindow"); vtkRenderWindow* aVTKObject = aVTKViewWindow->getRenderWindow()->getRenderWindow(); myResult = PyVTKObject_New(aPyClass,aVTKObject); @@ -150,7 +151,7 @@ public: TResult myResult; TGetRenderWindowInteractorEvent() : myResult( Py_None ) {} virtual void Execute() { - if( VTKViewer_ViewWindow* aVTKViewWindow = GetVTKViewWindow() ) { + if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow() ) { PyObject* aPyClass = GetPyClass("vtkRenderWindowInteractor"); vtkRenderWindowInteractor* aVTKObject = aVTKViewWindow->getRWInteractor(); myResult = PyVTKObject_New(aPyClass,aVTKObject);