Salome HOME
Update copyrights
[modules/shaper.git] / src / Model / Model_Update.cpp
old mode 100755 (executable)
new mode 100644 (file)
index db6fc41..98d13b0
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include <Model_Update.h>
@@ -301,16 +300,19 @@ void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessag
         std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
     const std::set<ObjectPtr>& anObjs = aMsg->objects();
     std::set<ObjectPtr>::const_iterator anObjIter = anObjs.cbegin();
+    std::list<ObjectPtr> aFeatures, aResults;
     for(; anObjIter != anObjs.cend(); anObjIter++) {
       if (std::dynamic_pointer_cast<Model_Document>((*anObjIter)->document())->executeFeatures()) {
         if ((*anObjIter)->groupName() == ModelAPI_Feature::group()) {
           // results creation means enabling, not update
-          ModelAPI_EventCreator::get()->sendUpdated(*anObjIter, kUpdatedEvent);
+          aFeatures.push_back(*anObjIter);
         } else {
-          ModelAPI_EventCreator::get()->sendUpdated(*anObjIter, kRedisplayEvent);
+          aResults.push_back(*anObjIter);
         }
       }
     }
+    ModelAPI_EventCreator::get()->sendUpdated(aFeatures, kUpdatedEvent);
+    ModelAPI_EventCreator::get()->sendUpdated(aResults, kRedisplayEvent);
     return;
   }
   if (theMessage->eventID() == kUpdatedEvent) {
@@ -589,7 +591,7 @@ bool Model_Update::processFeature(FeaturePtr theFeature)
           double aNX = aNorm->x(), aNY = aNorm->y(), aNZ = aNorm->z();
           // update sketch plane
           updateArguments(theFeature);
-          //theFeature->attributeChanged("External"); // to recompute origin, direction and normal
+          theFeature->attributeChanged("External"); // to recompute origin, direction and normal
           // check it is updated, so all must be changed
           if (anOrigin->x() != anOX || anOrigin->y() != anOY || anOrigin->z() != anOZ ||
               aDir->x() != aDX || aDir->y() != aDY || aDir->z() != aDZ ||
@@ -912,7 +914,7 @@ void Model_Update::updateArguments(FeaturePtr theFeature) {
       if (aSelAttr) {
         ObjectPtr aContext = aSelAttr->context();
         // update argument only if the referenced object is ready to use
-        if (aContext.get() && !aContext->isDisabled() && !aSelAttr->isInvalid()) {
+        if (aContext.get() && !aContext->isDisabled()) {
           if (isReason(theFeature, aContext)) {
             if (!aSelAttr->update()) {
               bool isObligatory = !aFactory->isNotObligatory(
@@ -922,7 +924,7 @@ void Model_Update::updateArguments(FeaturePtr theFeature) {
                 aState = ModelAPI_StateInvalidArgument;
             }
           }
-        } else if (aContext.get() || aSelAttr->isInvalid()) {
+        } else if (aContext.get()) {
           // here it may be not obligatory, but if the reference is wrong, it should not be correct
           bool isObligatory = aFactory->isCase(theFeature, theFeature->data()->id(aSel));
           if (isObligatory)