}
//******************************************************
-void PartSet_Listener::processEvent(const Events_Message* theMessage)
+void PartSet_Listener::processEvent(const boost::shared_ptr<Events_Message>& theMessage)
{
ModuleBase_Operation* anOperation = myModule->workshop()->operationMgr()->currentOperation();
PartSet_OperationSketchBase* aSketchOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
XGUI_Displayer* aDisplayer = myModule->workshop()->displayer();
QString aType = QString(theMessage->eventID().eventText());
if (aType == EVENT_OBJECT_CREATED) {
- const ModelAPI_ObjectUpdatedMessage* aUpdMsg =
- dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
+ boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
+ boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
std::set<ObjectPtr> aFeatures = aUpdMsg->objects();
std::set<ObjectPtr>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
for (; anIt != aLast; anIt++) {
}
} else if (aType == EVENT_OBJECT_DELETED) {
- const ModelAPI_ObjectDeletedMessage* aDelMsg =
- dynamic_cast<const ModelAPI_ObjectDeletedMessage*>(theMessage);
+ boost::shared_ptr<ModelAPI_ObjectDeletedMessage> aDelMsg =
+ boost::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
boost::shared_ptr<ModelAPI_Document> aDoc = aDelMsg->document();
std::set<std::string> aGroups = aDelMsg->groups();
virtual ~PartSet_Listener();
/// This method is called by loop when the event is started to process.
- virtual void processEvent(const Events_Message* theMessage);
+ virtual void processEvent(const boost::shared_ptr<Events_Message>& theMessage);
private:
PartSet_Module* myModule; ///< the current module
void PartSet_Module::sendOperation(ModuleBase_Operation* theOperation)
{
static Events_ID aModuleEvent = Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED);
- Config_PointerMessage aMessage(aModuleEvent, this);
- aMessage.setPointer(theOperation);
+ boost::shared_ptr<Config_PointerMessage> aMessage =
+ boost::shared_ptr<Config_PointerMessage>(new Config_PointerMessage(aModuleEvent, this));
+ aMessage->setPointer(theOperation);
Events_Loop::loop()->send(aMessage);
}
clearModelIndexes();
}
-void XGUI_DocumentDataModel::processEvent(const Events_Message* theMessage)
+void XGUI_DocumentDataModel::processEvent(const boost::shared_ptr<Events_Message>& theMessage)
{
DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
// Created object event *******************
if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) {
- const ModelAPI_ObjectUpdatedMessage* aUpdMsg =
- dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
+ boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
+ boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
std::set<ObjectPtr> aObjects = aUpdMsg->objects();
std::set<ObjectPtr>::const_iterator aIt;
}
// Deleted object event ***********************
} else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
- const ModelAPI_ObjectDeletedMessage* aUpdMsg =
- dynamic_cast<const ModelAPI_ObjectDeletedMessage*>(theMessage);
+ boost::shared_ptr<ModelAPI_ObjectDeletedMessage> aUpdMsg =
+ boost::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
DocumentPtr aDoc = aUpdMsg->document();
std::set<std::string> aGroups = aUpdMsg->groups();
}
// Deleted object event ***********************
} else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) {
- //const ModelAPI_ObjectUpdatedMessage* aUpdMsg = dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
+ //boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg = boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
//ObjectPtr aFeature = aUpdMsg->feature();
//DocumentPtr aDoc = aFeature->document();
virtual ~XGUI_DocumentDataModel();
// Event Listener method
- virtual void processEvent(const Events_Message* theMessage);
+ virtual void processEvent(const boost::shared_ptr<Events_Message>& theMessage);
virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
virtual QVariant headerData(int theSection, Qt::Orientation theOrient, int theRole =
}
//***************************************************
-void XGUI_ObjectsBrowser::processEvent(const Events_Message* theMessage)
+void XGUI_ObjectsBrowser::processEvent(const boost::shared_ptr<Events_Message>& theMessage)
{
myDocModel->processEvent(theMessage);
}
void rebuildDataTree();
- void processEvent(const Events_Message* theMessage);
+ void processEvent(const boost::shared_ptr<Events_Message>& theMessage);
signals:
//! Emited when selection is changed
}
//******************************************************
-void XGUI_Workshop::processEvent(const Events_Message* theMessage)
+void XGUI_Workshop::processEvent(const boost::shared_ptr<Events_Message>& theMessage)
{
if (QApplication::instance()->thread() != QThread::currentThread()) {
#ifdef _DEBUG
//A message to start feature creation received.
if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_LOADED)) {
- const Config_FeatureMessage* aFeatureMsg =
- dynamic_cast<const Config_FeatureMessage*>(theMessage);
+ boost::shared_ptr<Config_FeatureMessage> aFeatureMsg =
+ boost::dynamic_pointer_cast<Config_FeatureMessage>(theMessage);
if (!aFeatureMsg->isInternal()) {
addFeature(aFeatureMsg);
}
// Process creation of Part
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) {
- const ModelAPI_ObjectUpdatedMessage* aUpdMsg =
- dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
+ boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
+ boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
onFeatureCreatedMsg(aUpdMsg);
if (myUpdatePrefs) {
if (mySalomeConnector)
// Redisplay feature
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) {
- const ModelAPI_ObjectUpdatedMessage* aUpdMsg =
- dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
+ boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
+ boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
onFeatureRedisplayMsg(aUpdMsg);
}
//Update property panel on corresponding message. If there is no current operation (no
//property panel), or received message has different feature to the current - do nothing.
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) {
- const ModelAPI_ObjectUpdatedMessage* anUpdateMsg =
- dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
+ boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
+ boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
onFeatureUpdatedMsg(anUpdateMsg);
}
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
- const ModelAPI_ObjectDeletedMessage* aDelMsg =
- dynamic_cast<const ModelAPI_ObjectDeletedMessage*>(theMessage);
+ boost::shared_ptr<ModelAPI_ObjectDeletedMessage> aDelMsg =
+ boost::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
onObjectDeletedMsg(aDelMsg);
}
//An operation passed by message. Start it, process and commit.
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OPERATION_LAUNCHED)) {
- const Config_PointerMessage* aPartSetMsg =
- dynamic_cast<const Config_PointerMessage*>(theMessage);
+ boost::shared_ptr<Config_PointerMessage> aPartSetMsg =
+ boost::dynamic_pointer_cast<Config_PointerMessage>(theMessage);
//myPropertyPanel->cleanContent();
ModuleBase_Operation* anOperation = (ModuleBase_Operation*) aPartSetMsg->pointer();
} else {
//Show error dialog if error message received.
- const Events_Error* anAppError = dynamic_cast<const Events_Error*>(theMessage);
+ boost::shared_ptr<Events_Error> anAppError = boost::dynamic_pointer_cast<Events_Error>(theMessage);
if (anAppError) {
emit errorOccurred(QString::fromLatin1(anAppError->description()));
}
}
//******************************************************
-void XGUI_Workshop::onFeatureUpdatedMsg(const ModelAPI_ObjectUpdatedMessage* theMsg)
+void XGUI_Workshop::onFeatureUpdatedMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
{
std::set<ObjectPtr> aFeatures = theMsg->objects();
if (myOperationMgr->hasOperation()) {
}
//******************************************************
-void XGUI_Workshop::onFeatureRedisplayMsg(const ModelAPI_ObjectUpdatedMessage* theMsg)
+void XGUI_Workshop::onFeatureRedisplayMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
{
std::set<ObjectPtr> aObjects = theMsg->objects();
std::set<ObjectPtr>::const_iterator aIt;
}
//******************************************************
-void XGUI_Workshop::onFeatureCreatedMsg(const ModelAPI_ObjectUpdatedMessage* theMsg)
+void XGUI_Workshop::onFeatureCreatedMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
{
std::set<ObjectPtr> aObjects = theMsg->objects();
}
//******************************************************
-void XGUI_Workshop::onObjectDeletedMsg(const ModelAPI_ObjectDeletedMessage* theMsg)
+void XGUI_Workshop::onObjectDeletedMsg(const boost::shared_ptr<ModelAPI_ObjectDeletedMessage>& theMsg)
{
if (myObjectBrowser)
myObjectBrowser->processEvent(theMsg);
/*
*
*/
-void XGUI_Workshop::addFeature(const Config_FeatureMessage* theMessage)
+void XGUI_Workshop::addFeature(const boost::shared_ptr<Config_FeatureMessage>& theMessage)
{
if (!theMessage) {
#ifdef _DEBUG
XGUI_Workbench* addWorkbench(const QString& theName);
//! Redefinition of Events_Listener method
- virtual void processEvent(const Events_Message* theMessage);
+ virtual void processEvent(const boost::shared_ptr<Events_Message>& theMessage);
//! Returns an object which provides interface to Salome Module (LightApp_Module)
XGUI_SalomeConnector* salomeConnector() const
protected:
bool event(QEvent * theEvent);
//Event-loop processing methods:
- void addFeature(const Config_FeatureMessage*);
+ void addFeature(const boost::shared_ptr<Config_FeatureMessage>&);
void connectWithOperation(ModuleBase_Operation* theOperation);
- void onFeatureUpdatedMsg(const ModelAPI_ObjectUpdatedMessage* theMsg);
- void onFeatureCreatedMsg(const ModelAPI_ObjectUpdatedMessage* theMsg);
- void onFeatureRedisplayMsg(const ModelAPI_ObjectUpdatedMessage* theMsg);
- void onObjectDeletedMsg(const ModelAPI_ObjectDeletedMessage* theMsg);
+ void onFeatureUpdatedMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
+ void onFeatureCreatedMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
+ void onFeatureRedisplayMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
+ void onObjectDeletedMsg(const boost::shared_ptr<ModelAPI_ObjectDeletedMessage>& theMsg);
void validateOperation(const QString& theOperationId);