1 // File: XGUI_ModuleConnector.cpp
2 // Created: 3 June 2014
3 // Author: Vitaly Smetannikov
5 #include "XGUI_ModuleConnector.h"
6 #include "XGUI_Workshop.h"
7 #include "XGUI_ViewerProxy.h"
8 #include "XGUI_SelectionMgr.h"
9 #include "XGUI_Selection.h"
10 #include "XGUI_OperationMgr.h"
12 XGUI_ModuleConnector::XGUI_ModuleConnector(XGUI_Workshop* theWorkshop)
13 : ModuleBase_IWorkshop(theWorkshop),
14 myWorkshop(theWorkshop)
16 XGUI_SelectionMgr* aSelector = myWorkshop->selector();
17 connect(aSelector, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
19 XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr();
21 connect(anOperationMgr, SIGNAL(operationStarted(ModuleBase_Operation*)),
22 this, SIGNAL(operationStarted(ModuleBase_Operation*)));
23 connect(anOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)),
24 this, SIGNAL(operationStopped(ModuleBase_Operation*)));
27 XGUI_ModuleConnector::~XGUI_ModuleConnector()
31 ModuleBase_ISelection* XGUI_ModuleConnector::selection() const
33 return myWorkshop->selector()->selection();
36 ModuleBase_IModule* XGUI_ModuleConnector::module() const
38 return myWorkshop->module();
41 ModuleBase_IViewer* XGUI_ModuleConnector::viewer() const
43 return myWorkshop->viewer();
46 ModuleBase_Operation* XGUI_ModuleConnector::currentOperation() const
48 return myWorkshop->operationMgr()->currentOperation();
52 void XGUI_ModuleConnector::activateSubShapesSelection(const QIntList& theTypes)
54 Handle(AIS_InteractiveContext) aAIS = myWorkshop->viewer()->AISContext();
55 if (!aAIS->HasOpenedContext())
56 aAIS->OpenLocalContext();
57 foreach(int aType, theTypes)
58 aAIS->ActivateStandardMode((TopAbs_ShapeEnum)aType);
61 void XGUI_ModuleConnector::deactivateSubShapesSelection()
63 Handle(AIS_InteractiveContext) aAIS = myWorkshop->viewer()->AISContext();
64 aAIS->CloseAllContexts();