Salome HOME
Fix for the issue #2753 : error when dump/load script
[modules/shaper.git] / src / Model / Model_ResultBody.cpp
index 7c7171ddd198e3cf9adcb0694f05ea77244ad967..8b736b3390be79340d546aceab0e8125992e375c 100644 (file)
@@ -52,11 +52,48 @@ Model_ResultBody::~Model_ResultBody()
   delete myBuilder;
 }
 
-void Model_ResultBody::loadModifiedShapes(
-  const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
-  const GeomShapePtr& theOldShape,
-  const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
-  const std::string& theName)
+bool Model_ResultBody::generated(const GeomShapePtr& theNewShape,
+  const std::string& theName, const bool theCheckIsInResult)
+{
+  bool aResult = false;
+  if (mySubs.size()) { // consists of subs
+    for (std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
+         aSubIter != mySubs.cend();
+         ++aSubIter)
+    {
+      const ResultBodyPtr& aSub = *aSubIter;
+      if (aSub->generated(theNewShape, theName, theCheckIsInResult))
+        aResult = true;
+    }
+  } else { // do for this directly
+    if (myBuilder->generated(theNewShape, theName, theCheckIsInResult))
+      aResult = true;
+  }
+  return aResult;
+}
+
+void Model_ResultBody::loadGeneratedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+                                           const GeomShapePtr& theOldShape,
+                                           const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                           const std::string& theName)
+{
+  if (mySubs.size()) { // consists of subs
+    for (std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
+         aSubIter != mySubs.cend();
+         ++aSubIter)
+    {
+      const ResultBodyPtr& aSub = *aSubIter;
+      aSub->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
+    }
+  } else { // do for this directly
+    myBuilder->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
+  }
+}
+
+void Model_ResultBody::loadModifiedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+                                          const GeomShapePtr& theOldShape,
+                                          const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                          const std::string& theName)
 {
   if (/*theSplitInSubs &&*/ mySubs.size()) { // consists of subs
     // optimization of getting of new shapes for specific sub-result
@@ -207,6 +244,7 @@ void Model_ResultBody::updateSubs(const std::shared_ptr<GeomAPI_Shape>& theThisS
     TDF_Label aDataLab = std::dynamic_pointer_cast<Model_Data>(data())->label();
     if (!aDataLab.IsNull()) {
       TDataStd_UAttribute::Set(aDataLab, kUpdateConnectedTopology);
+      isConnectedTopology(); // to store this flag in transaction, #2630
     }
   }
   // iterate all sub-solids of compsolid to make sub-results synchronized with them