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<SUIT_ViewWindow> 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)();
- }
}
}
- }
}
-
}
//---------------------------------------------------------------
{
VisuGUI::activateModule( theStudy );
- SetViewVisibility(myViewerMap,&SUIT_ViewWindow::show);
+ SetViewVisibility(getApp(),&SUIT_ViewWindow::show);
return true;
}
{
VisuGUI::deactivateModule( theStudy );
- SetViewVisibility(myViewerMap,&SUIT_ViewWindow::hide);
+ SetViewVisibility(getApp(),&SUIT_ViewWindow::hide);
return true;
}
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();
}
#include "MED_SharedPtr.hxx"
-namespace VISU
-{
- class Viewer;
- typedef MED::SharedPtr<Viewer> PViewer;
-
- typedef std::map<SUIT_ViewManager*,PViewer> 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();
SUIT_ViewManager*
onCreateViewManager();
- void
- onLastViewClosed(SUIT_ViewManager*);
-
void
OnCreateGaussPoints();
OnRestoreConfiguration();
protected:
- VISU::TViewerMap myViewerMap;
_PTR(SObject) myConfigSObject;
void setProperty( SVTK_ViewWindow*, const QString& ); // set a property (speed_increment, etc ) for SVTK ViewWindow