]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModuleBase/ModuleBase_IModule.cpp
Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[modules/shaper.git] / src / ModuleBase / ModuleBase_IModule.cpp
1
2 #include "ModuleBase_IModule.h"
3 #include "ModuleBase_ViewerPrs.h"
4 #include "ModuleBase_Operation.h"
5 #include "ModuleBase_ISelection.h"
6
7 #include <Events_Loop.h>
8
9 #include <ModelAPI_Events.h>
10
11 #include <Config_PointerMessage.h>
12
13
14 void ModuleBase_IModule::launchOperation(const QString& theCmdId)
15 {
16   ModuleBase_Operation* anOperation = createOperation(theCmdId.toStdString());
17   ModuleBase_ISelection* aSelection = myWorkshop->selection();
18   // Initialise operation with preliminary selection
19   std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
20   std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
21   anOperation->initSelection(aSelected, aHighlighted);
22   sendOperation(anOperation);
23 }
24
25
26 void ModuleBase_IModule::sendOperation(ModuleBase_Operation* theOperation)
27 {
28   static Events_ID aModuleEvent = Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED);
29   boost::shared_ptr<Config_PointerMessage> aMessage =
30       boost::shared_ptr<Config_PointerMessage>(new Config_PointerMessage(aModuleEvent, this));
31   aMessage->setPointer(theOperation);
32   Events_Loop::loop()->send(aMessage);
33 }