Salome HOME
Fix for the issue #2528 : No more results after parameters edition canceled
authormpv <mpv@opencascade.com>
Mon, 27 Aug 2018 12:18:17 +0000 (15:18 +0300)
committermpv <mpv@opencascade.com>
Mon, 27 Aug 2018 12:18:17 +0000 (15:18 +0300)
src/GeomData/GeomData_Point.cpp
src/Model/Model_Objects.cpp
src/Model/Model_ResultBody.cpp
src/Model/Model_ResultField.cpp
src/ModelAPI/ModelAPI_ResultBody.h

index cb6b8d47df05f5fe8cae9e3d482dee6c104a8c84..47d6c70ba5cb062a95567c4f453f597e612660b9 100644 (file)
@@ -86,6 +86,7 @@ void GeomData_Point::setX(const double theX)
     setCalculatedValue(theX, 0, 0);
   } else if (x() != theX) {
     myExpression[0]->setValue(theX);
+    myExpression[0]->setText(""); // uninitialize the text
     owner()->data()->sendAttributeUpdated(this);
   }
 }
@@ -96,6 +97,7 @@ void GeomData_Point::setY(const double theY)
     setCalculatedValue(0, theY, 0);
   } else if (y() != theY) {
     myExpression[1]->setValue(theY);
+    myExpression[1]->setText(""); // uninitialize the text
     owner()->data()->sendAttributeUpdated(this);
   }
 }
@@ -107,6 +109,7 @@ void GeomData_Point::setZ(const double theZ)
   }
   else if (z() != theZ) {
     myExpression[2]->setValue(theZ);
+    myExpression[2]->setText(""); // uninitialize the text
     owner()->data()->sendAttributeUpdated(this);
   }
 }
index 21120233efc24c06231694386b37440745599082..b3b21793043789b434d0c4b7a51e2f4123786290 100644 (file)
@@ -1891,6 +1891,15 @@ void Model_Objects::updateResults(FeaturePtr theFeature, std::set<FeaturePtr>& t
       }
     }
   }
+  if (aResSize > 0) { // check there exist a body that must be updated
+    std::list<ResultPtr>::const_iterator aRes = theFeature->results().cbegin();
+    for (; aResSize && aRes != theFeature->results().cend(); aRes++, aResSize++) {
+      if ((*aRes)->data()->isValid() && (*aRes)->groupName() == ModelAPI_ResultBody::group()) {
+        ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRes);
+        aBody->updateSubs(aBody->shape());
+      }
+    }
+  }
 }
 
 ResultPtr Model_Objects::findByName(const std::string theName)
index e168c6c1a0f96cb09234afe9bc6fa4aeeb2848b5..7b7ae0780771916b7b1376d9dce9a845d221461d 100644 (file)
@@ -159,6 +159,8 @@ void Model_ResultBody::updateConcealment()
   if (myLastConcealed != ModelAPI_ResultBody::isConcealed()) {
     // check the whole tree of results: if one is concealed, everybody are concealed
     ResultBodyPtr anOwner = std::dynamic_pointer_cast<ModelAPI_ResultBody>(data()->owner());
+    if (!anOwner.get())
+      return; // "this" is invalid
     ResultBodyPtr aParent = ModelAPI_Tools::bodyOwner(anOwner);
     while(aParent.get()) {
       anOwner = aParent;
index 985b66f2fccf03f200335e8af2073ea8cf48559f..40f7aa5a48ce26ca99e6ff8c6dd73ee3189eb488 100644 (file)
@@ -109,7 +109,7 @@ void Model_ResultField::updateSteps()
       mySteps.pop_back();
     }
     while(mySteps.size() < aNbSteps) {
-      mySteps.push_back(new Model_ResultField::Model_FieldStep(this, mySteps.size()));
+      mySteps.push_back(new Model_ResultField::Model_FieldStep(this, int(mySteps.size())));
     }
   }
 }
index 0ffb2422a3e9c67f7c68e462ec679f1fde22466d..049e821753affd06603fb426f2ccfcb1a61cd424 100644 (file)
@@ -178,12 +178,13 @@ public:
   /// \param theDisplay a boolean value
   MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay);
 
+  /// Updates the sub-bodies if shape of this object is compsolid or compound
+  MODELAPI_EXPORT virtual void updateSubs(const std::shared_ptr<GeomAPI_Shape>& theThisShape) = 0;
+
 protected:
   /// Default constructor accessible only from Model_Objects
   MODELAPI_EXPORT ModelAPI_ResultBody();
 
-  /// Updates the sub-bodies if shape of this object is compsolid or compound
-  virtual void updateSubs(const std::shared_ptr<GeomAPI_Shape>& theThisShape) = 0;
 };
 
 //! Pointer on feature object