From ffdceba30cee4782b7b08ec55907ca4531bfe737 Mon Sep 17 00:00:00 2001 From: asl Date: Wed, 12 Apr 2006 09:40:33 +0000 Subject: [PATCH] PAL11954 - "Point view" viewer must be activated on PostPro loading --- src/VISUGUI/VisuGUI_Module.cxx | 77 ++++++++++------------------------ src/VISUGUI/VisuGUI_Module.h | 14 ------- 2 files changed, 21 insertions(+), 70 deletions(-) diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index 2cdff7b2..647feba5 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -121,61 +121,27 @@ using namespace VISU; namespace VISU { - //--------------------------------------------------------------- - class Viewer - { - VVTK_ViewManager* myViewManager; - LightApp_VTKSelector* mySelector; - public: - - Viewer(VisuGUI_Module* theModule, TViewerMap& theViewerMap) - { - SalomeApp_Application* anApp = theModule->getApp(); - myViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() ); - VVTK_Viewer* aViewer = (VVTK_Viewer*)myViewManager->getViewModel(); - mySelector = new LightApp_VTKSelector( aViewer, anApp->selectionMgr() ); - anApp->addViewManager( myViewManager ); - - theViewerMap.insert(TViewerMap::value_type(myViewManager,PViewer(this))); - QObject::connect( myViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ), - theModule, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) ); - - //aViewer->setBackgroundColor( Qt::darkGreen ); - myViewManager->createViewWindow(); - } - - VVTK_ViewManager* getViewManager() - { - return myViewManager; - } - - virtual - ~Viewer() - { - } - }; - - //--------------------------------------------------------------- typedef void (SUIT_ViewWindow::* TViewVisibility)(); void - SetViewVisibility(const TViewerMap& theViewerMap, + SetViewVisibility(SalomeApp_Application* app, TViewVisibility theViewVisibility) { - TViewerMap::const_iterator anIter = theViewerMap.begin(); - for(; anIter != theViewerMap.end(); anIter++){ - if(SUIT_ViewManager* aViewManager = anIter->first){ + ViewManagerList l; + app->viewManagers( VVTK_Viewer::Type(), l ); + ViewManagerList::const_iterator anIt = l.begin(), aLast = l.end(); + for( ; anIt!=aLast; anIt++ ) + if( SUIT_ViewManager* aViewManager = *anIt ) + { QPtrVector aViews = aViewManager->getViews(); int aSize = aViews.size(); - for(int anId = 0; anId < aSize; anId++){ - if(SUIT_ViewWindow* aView = aViews[anId]){ + for(int anId = 0; anId < aSize; anId++) + { + if(SUIT_ViewWindow* aView = aViews[anId]) (aView->* theViewVisibility)(); - } } } - } } - } //--------------------------------------------------------------- @@ -342,7 +308,7 @@ activateModule( SUIT_Study* theStudy ) { VisuGUI::activateModule( theStudy ); - SetViewVisibility(myViewerMap,&SUIT_ViewWindow::show); + SetViewVisibility(getApp(),&SUIT_ViewWindow::show); return true; } @@ -355,7 +321,7 @@ deactivateModule( SUIT_Study* theStudy ) { VisuGUI::deactivateModule( theStudy ); - SetViewVisibility(myViewerMap,&SUIT_ViewWindow::hide); + SetViewVisibility(getApp(),&SUIT_ViewWindow::hide); return true; } @@ -366,17 +332,16 @@ SUIT_ViewManager* VisuGUI_Module:: onCreateViewManager() { - Viewer* aViewer = new Viewer( this, myViewerMap ); - return aViewer->getViewManager(); -} + SalomeApp_Application* anApp = getApp(); + VVTK_ViewManager* aViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() ); + VVTK_Viewer* aViewer = (VVTK_Viewer*)aViewManager->getViewModel(); + new LightApp_VTKSelector( aViewer, anApp->selectionMgr() ); + anApp->addViewManager( aViewManager ); + + //aViewer->setBackgroundColor( Qt::darkGreen ); + aViewManager->createViewWindow(); - -//--------------------------------------------------------------- -void -VisuGUI_Module:: -onLastViewClosed(SUIT_ViewManager* theViewManager) -{ - myViewerMap.erase(theViewManager); + return aViewer->getViewManager(); } diff --git a/src/VISUGUI/VisuGUI_Module.h b/src/VISUGUI/VisuGUI_Module.h index d0c371b4..af02c8b7 100644 --- a/src/VISUGUI/VisuGUI_Module.h +++ b/src/VISUGUI/VisuGUI_Module.h @@ -38,22 +38,12 @@ class SVTK_ViewWindow; #include "MED_SharedPtr.hxx" -namespace VISU -{ - class Viewer; - typedef MED::SharedPtr PViewer; - - typedef std::map TViewerMap; -} - //! This class inherits base VisuGUI. /*! Used to display, erase end edit presentations in the VVTK viewer. */ class VisuGUI_Module: public VisuGUI { Q_OBJECT; - friend class VISU::Viewer; - public: VisuGUI_Module(); @@ -136,9 +126,6 @@ protected slots: SUIT_ViewManager* onCreateViewManager(); - void - onLastViewClosed(SUIT_ViewManager*); - void OnCreateGaussPoints(); @@ -169,7 +156,6 @@ protected slots: OnRestoreConfiguration(); protected: - VISU::TViewerMap myViewerMap; _PTR(SObject) myConfigSObject; void setProperty( SVTK_ViewWindow*, const QString& ); // set a property (speed_increment, etc ) for SVTK ViewWindow -- 2.39.2