From: vsv Date: Thu, 3 Jul 2014 11:56:55 +0000 (+0400) Subject: OPERATION_LAUNCHED event created. X-Git-Tag: V_0.4.4~208 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0c89bf75254d86feded0577ac60d0b8c5c4949e3;p=modules%2Fshaper.git OPERATION_LAUNCHED event created. --- diff --git a/src/ModelAPI/ModelAPI_Events.h b/src/ModelAPI/ModelAPI_Events.h index c65d717e8..215c34c71 100644 --- a/src/ModelAPI/ModelAPI_Events.h +++ b/src/ModelAPI/ModelAPI_Events.h @@ -25,6 +25,8 @@ static const char * EVENT_FEATURE_DELETED = "FeatureDeleted"; static const char * EVENT_FEATURE_MOVED = "FeaturesMoved"; /// Event ID that visualization must be redisplayed (comes with ModelAPI_FeatureUpdatedMessage) static const char * EVENT_FEATURE_TO_REDISPLAY = "FeaturesToRedisplay"; +/// Event ID that visualization must be redisplayed (comes with ModelAPI_FeatureUpdatedMessage) +static const char * EVENT_OPERATION_LAUNCHED = "OperationLaunched"; /// Message that feature was changed (used for Object Browser update): moved, updated and deleted class ModelAPI_FeatureUpdatedMessage : public Events_MessageGroup { diff --git a/src/ModuleBase/ModuleBase_WidgetPoint2dDistance.cpp b/src/ModuleBase/ModuleBase_WidgetPoint2dDistance.cpp index 92a616504..303d4508e 100644 --- a/src/ModuleBase/ModuleBase_WidgetPoint2dDistance.cpp +++ b/src/ModuleBase/ModuleBase_WidgetPoint2dDistance.cpp @@ -48,6 +48,8 @@ void ModuleBase_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature, const boo boost::shared_ptr aData = theFeature->data(); boost::shared_ptr aPoint = boost::dynamic_pointer_cast (aData->attribute(myFirstPntName)); + if (!aPoint) return; + double aRadius = thePnt->distance(aPoint->pnt()); AttributeDoublePtr aReal = aData->real(attributeID()); if (aReal && (aReal->value() != aRadius)) { diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index dd788f540..b12db997b 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -411,8 +412,7 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI void PartSet_Module::sendOperation(ModuleBase_Operation* theOperation) { - //TODO(sbh): Implement static method to extract event id [SEID] - static Events_ID aModuleEvent = Events_Loop::eventByName("PartSetModuleEvent"); + static Events_ID aModuleEvent = Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED); Config_PointerMessage aMessage(aModuleEvent, this); aMessage.setPointer(theOperation); Events_Loop::loop()->send(aMessage); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 81bb1d0a3..ed05647f4 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -120,10 +120,10 @@ void XGUI_Workshop::startApplication() Events_Loop* aLoop = Events_Loop::loop(); aLoop->registerListener(this, Events_Error::errorID()); //!< Listening application errors. //TODO(sbh): Implement static method to extract event id [SEID] - aLoop->registerListener(this, aLoop->eventByName(EVENT_FEATURE_LOADED)); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_LOADED)); // TODO Is it good to use non standard event within workshop? - aLoop->registerListener(this, aLoop->eventByName("PartSetModuleEvent")); - aLoop->registerListener(this, aLoop->eventByName(EVENT_FEATURE_UPDATED)); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED)); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_UPDATED)); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_CREATED)); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_TO_REDISPLAY)); @@ -236,16 +236,15 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage) //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. - static Events_ID aFeatureUpdatedId = Events_Loop::loop()->eventByName(EVENT_FEATURE_UPDATED); - if (theMessage->eventID() == aFeatureUpdatedId) { + if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_UPDATED)) { const Model_FeatureUpdatedMessage* anUpdateMsg = dynamic_cast(theMessage); onFeatureUpdatedMsg(anUpdateMsg); } //An operation passed by message. Start it, process and commit. - const Config_PointerMessage* aPartSetMsg = dynamic_cast(theMessage); - if (aPartSetMsg) { + if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OPERATION_LAUNCHED)) { + const Config_PointerMessage* aPartSetMsg = dynamic_cast(theMessage); myPropertyPanel->cleanContent(); ModuleBase_Operation* anOperation = (ModuleBase_Operation*)aPartSetMsg->pointer();