class QtxActionToolMgr;
class QMenu;
+class SUIT_ViewModel;
/*!
An interface which can be used as a module dedicated extension for Viewer
*/
//! Creates a New toolbar containing extending actions. Returns New Toolbar Id
virtual int createToolbar(QtxActionToolMgr* ) = 0;
virtual void contextMenuPopup(QMenu* ) = 0;
- virtual void activate() = 0;
- virtual void deactivate() = 0;
+ virtual void activate(SUIT_ViewModel*) = 0;
+ virtual void deactivate(SUIT_ViewModel*) = 0;
};
#endif
aViewWindow->setBackgroundColor( backgroundColor() );
aViewWindow->SetTrihedronSize( trihedronSize(), trihedronRelative() );
-
+
+ connect(aViewWindow, SIGNAL( actorAdded(VTKViewer_Actor*) ),
+ this, SLOT(onActorAdded(VTKViewer_Actor*)));
+ connect(aViewWindow, SIGNAL( actorRemoved(VTKViewer_Actor*) ),
+ this, SLOT(onActorRemoved(VTKViewer_Actor*)));
+
if (myActiveModule) {
CAM_ViewExtender* aExtender = myActiveModule->getViewExtender();
if (aExtender) {
void SVTK_Viewer::connectToApplication( CAM_Application* theApp )
{
onModuleActivated(theApp->activeModule());
-// CAM_Module* aModule = dynamic_cast<CAM_Module*>(theApp->activeModule());
-// if (aModule) {
-// if (myActiveModule != aModule) {
-// CAM_ViewExtender* aExtender = (myActiveModule)? myActiveModule->getViewExtender() : 0;
-// if (aExtender)
-// aExtender->deactivate();
-
-// myActiveModule = aModule;
-// aExtender = myActiveModule->getViewExtender();
-// if (aExtender)
-// aExtender->activate();
-
-// updateToolBars();
-// }
-// }
connect(theApp, SIGNAL(moduleActivated(CAM_Module*)),
this, SLOT(onModuleActivated(CAM_Module*)));
}
if (myActiveModule != aModule) {
CAM_ViewExtender* aExtender = (myActiveModule)? myActiveModule->getViewExtender() : 0;
if (aExtender)
- aExtender->deactivate();
+ aExtender->deactivate(this);
myActiveModule = aModule;
aExtender = myActiveModule->getViewExtender();
if (aExtender)
- aExtender->activate();
+ aExtender->activate(this);
updateToolBars();
}
}
myExtToolBarId = aNewId;
}
+
+void SVTK_Viewer::onActorAdded(VTKViewer_Actor* theActor)
+{
+ emit actorAdded((SVTK_ViewWindow*)sender(), theActor);
+}
+
+void SVTK_Viewer::onActorRemoved(VTKViewer_Actor* theActor)
+{
+ emit actorRemoved((SVTK_ViewWindow*)sender(), theActor);
+}
class CAM_Module;
class CAM_Application;
class CAM_Module;
+class VTKViewer_Actor;
//! Extends two interfaces #SVTK_ViewModelBase and #SALOME_View
class SVTK_EXPORT SVTK_Viewer : public SVTK_ViewModelBase, public SALOME_View
virtual void connectToApplication(CAM_Application* theApp);
+ signals:
+ void actorAdded(SVTK_ViewWindow*, VTKViewer_Actor*);
+ void actorRemoved(SVTK_ViewWindow*, VTKViewer_Actor*);
protected slots:
void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
void onChangeBgColor();
void onModuleActivated( CAM_Module* mod );
+ void onActorAdded(VTKViewer_Actor*);
+ void onActorRemoved(VTKViewer_Actor*);
private:
void updateToolBars();
/*!
Redirect the request to #SVTK_Renderer::AddActor
*/
-void
-SVTK_ViewWindow
-::AddActor( VTKViewer_Actor* theActor,
+void SVTK_ViewWindow::AddActor( VTKViewer_Actor* theActor,
bool theUpdate )
{
myMainWindow->AddActor( theActor, theUpdate );
+ emit actorAdded(theActor);
}
/*!
bool theUpdate )
{
myMainWindow->RemoveActor( theActor, theUpdate );
+ emit actorRemoved(theActor);
}
/*!