Salome HOME
updated copyright message
[modules/shaper.git] / src / ModuleBase / ModuleBase_OperationFeature.cpp
index 15376639a07f6bb6ed3783a12694a2a4c77a73b5..108f1df1e7a0f774149bc27ea964b14a29c499b2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  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
@@ -209,10 +209,10 @@ bool ModuleBase_OperationFeature::hasObject(ObjectPtr theObj) const
         std::shared_ptr<ModelAPI_AttributeRefList> aCurSelList =
                                std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(*anIt);
         for (int i = 0, aNb = aCurSelList->size(); i < aNb && !aFoundObject; i++) {
-          ObjectPtr anObject = aCurSelList->object(i);
-          FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObject);
-          if (aFeature.get()) {
-            aFoundObject = anObjectFeature == aFeature;
+          ObjectPtr aCurObj = aCurSelList->object(i);
+          FeaturePtr aCurFeat = std::dynamic_pointer_cast<ModelAPI_Feature>(aCurObj);
+          if (aCurFeat.get()) {
+            aFoundObject = anObjectFeature == aCurFeat;
           }
         }
       }
@@ -278,6 +278,12 @@ void ModuleBase_OperationFeature::abort()
       new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)));
   Events_Loop::loop()->send(aMsg);
 
+  if (myFeature.get())
+  {
+    static const Events_ID anEvent = Events_Loop::eventByName(EVENT_VISUAL_ATTRIBUTES);
+    ModelAPI_EventCreator::get()->sendUpdated(myFeature, anEvent);
+  }
+
   // the widgets of property panel should not process any events come from data mode
   // after abort clicked. Some signal such as redisplay/create influence on content
   // of the object browser and viewer context. Therefore it influence to the current
@@ -393,20 +399,16 @@ ModuleBase_ModelWidget* ModuleBase_OperationFeature::activateByPreselection(
         }
       }
       else {
-        bool isSet = false;
         // 1. apply the selection to controls
         for (aWIt = aWidgets.constBegin(); aWIt != aWidgets.constEnd(); ++aWIt) {
           aWgt = (*aWIt);
           if (!aWgt->canAcceptFocus())
             continue;
           aPropertyPanel->setPreselectionWidget(aWgt);
-          if (myPreSelection.empty() || !aWgt->setSelection(myPreSelection, true)) {
-            isSet = false;
+          if (myPreSelection.empty() || !aWgt->setSelection(myPreSelection, true))
             break;
-          } else {
-            isSet = true;
+          else
             aFilledWgt = aWgt;
-          }
         }
       }
       aPropertyPanel->setPreselectionWidget(NULL);