]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Hide selected object on using it in extrusion
authorvsv <vitaly.smetannikov@opencascade.com>
Mon, 22 Sep 2014 07:29:17 +0000 (11:29 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Mon, 22 Sep 2014 07:29:17 +0000 (11:29 +0400)
src/ModelAPI/ModelAPI_Events.h
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
src/XGUI/XGUI_Workshop.cpp

index 7345815e22a1079a3eceacdecf47a4e3c5c0e7a5..380a6658292c59c79934abdd2847292e30345cfa 100644 (file)
@@ -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
index 3fe721135cce046f132df3a5058f1db4335f12f8..6bf697b14b923b7e6bbd887d1d67c111e339b8c6 100644 (file)
@@ -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("");
     }
index 2d5c5d60da98526a05a2167ceec030ac0ae3753c..51a66d026d2f96a973a92e281760ce8295834128 100644 (file)
@@ -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<Events_Message>& theMes
       QApplication::restoreOverrideCursor();
   }
 
+  else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TOSHOW)) {
+    boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
+        boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+    const std::set<ObjectPtr>& aObjList = anUpdateMsg->objects();
+    QList<ObjectPtr> aList;
+    std::set<ObjectPtr>::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<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
+        boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+    const std::set<ObjectPtr>& aObjList = anUpdateMsg->objects();
+    QList<ObjectPtr> aList;
+    std::set<ObjectPtr>::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<Config_PointerMessage> aPartSetMsg =