From: vsv Date: Mon, 22 Sep 2014 07:29:17 +0000 (+0400) Subject: Hide selected object on using it in extrusion X-Git-Tag: V_0.4.4~35^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bc93c738033ea98e2238266c91a477c9ce0654df;p=modules%2Fshaper.git Hide selected object on using it in extrusion --- diff --git a/src/ModelAPI/ModelAPI_Events.h b/src/ModelAPI/ModelAPI_Events.h index 7345815e2..380a66582 100644 --- a/src/ModelAPI/ModelAPI_Events.h +++ b/src/ModelAPI/ModelAPI_Events.h @@ -29,6 +29,10 @@ static const char * EVENT_OBJECT_TO_REDISPLAY = "ObjectsToRedisplay"; static const char * EVENT_OPERATION_LAUNCHED = "OperationLaunched"; /// Event ID that plugin is loaded (comes with ModelAPI_ObjectUpdatedMessage) static const char * EVENT_PLUGIN_LOADED = "PliginLoaded"; +/// Event ID that data of feature has to be shown (comes with ModelAPI_ObjectUpdatedMessage) +static const char * EVENT_OBJECT_TOSHOW = "ObjectShow"; +/// Event ID that data of feature has to be shown (comes with ModelAPI_ObjectUpdatedMessage) +static const char * EVENT_OBJECT_TOHIDE = "ObjectHide"; /// Message that feature was changed (used for Object Browser update): moved, updated and deleted class ModelAPI_ObjectUpdatedMessage : public Events_MessageGroup diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index 3fe721135..6bf697b14 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -161,6 +161,9 @@ void ModuleBase_WidgetShapeSelector::onSelectionChanged() updateSelectionName(); myActivateBtn->setChecked(false); raisePanel(); + static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_TOHIDE); + ModelAPI_EventCreator::get()->sendUpdated(mySelectedObject, anEvent); + Events_Loop::loop()->flush(anEvent); } else { myTextLine->setText(""); } diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 2d5c5d60d..51a66d026 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -147,6 +147,8 @@ void XGUI_Workshop::startApplication() aLoop->registerListener(this, Events_Loop::eventByName("LongOperation")); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_PLUGIN_LOADED)); aLoop->registerListener(this, Events_Loop::eventByName("CurrentDocumentChanged")); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOSHOW)); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOHIDE)); registerValidators(); activateModule(); @@ -299,6 +301,28 @@ void XGUI_Workshop::processEvent(const boost::shared_ptr& theMes QApplication::restoreOverrideCursor(); } + else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TOSHOW)) { + boost::shared_ptr anUpdateMsg = + boost::dynamic_pointer_cast(theMessage); + const std::set& aObjList = anUpdateMsg->objects(); + QList aList; + std::set::const_iterator aIt; + for (aIt = aObjList.cbegin(); aIt != aObjList.cend(); ++aIt) + aList.append(*aIt); + showObjects(aList, true); + } + + else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TOHIDE)) { + boost::shared_ptr anUpdateMsg = + boost::dynamic_pointer_cast(theMessage); + const std::set& aObjList = anUpdateMsg->objects(); + QList aList; + std::set::const_iterator aIt; + for (aIt = aObjList.cbegin(); aIt != aObjList.cend(); ++aIt) + aList.append(*aIt); + showObjects(aList, false); + } + //An operation passed by message. Start it, process and commit. else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OPERATION_LAUNCHED)) { boost::shared_ptr aPartSetMsg =