Salome HOME
updated copyright message
[modules/shaper.git] / src / ModelAPI / ModelAPI_ResultField.cpp
index 15f8bba963bff391a695ee70a96309779458d1f2..d0a5c88b71a80cc1135cbc6301e4f130dab40b52 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -31,11 +31,34 @@ std::string ModelAPI_ResultField::groupName()
   return group();
 }
 
+// LCOV_EXCL_START
 void ModelAPI_ResultField::ModelAPI_FieldStep::setDisplayed(const bool theDisplay)
 {
-  myIsDisplayed = theDisplay;
-  //static Events_Loop* aLoop = Events_Loop::loop();
-  //static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
-  //static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
-  //aECreator->sendUpdated(FieldStepPtr(this), EVENT_DISP);
+  if (myIsDisplayed != theDisplay) {
+    myIsDisplayed = theDisplay;
+    static Events_Loop* aLoop = Events_Loop::loop();
+    static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+    static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
+    ModelAPI_ResultField* aField = field();
+    if (aField) {
+      aECreator->sendUpdated(aField->step(id()), EVENT_DISP); // updated pointer to this
+      if (myIsDisplayed) {
+        for (int i = 0; i < aField->stepsSize(); i++)
+          if (i != id())
+            aField->step(i)->setDisplayed(false);
+        aField->setDisplayed(false);
+      }
+    }
+  }
 }
+
+
+void ModelAPI_ResultField::setDisplayed(const bool theDisplay)
+{
+  ModelAPI_Result::setDisplayed(theDisplay);
+  if (isDisplayed()) {
+    for (int i = 0; i < stepsSize(); i++)
+      step(i)->setDisplayed(false);
+  }
+}
+// LCOV_EXCL_STOP