Salome HOME
Fix for the issue #2753 : error when dump/load script
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_CompositeBoolean.cpp
index f1b693c5bd005bce3f87cf806297fac7453d82dc..6e3e8796b16493de7e94cbdb991ef587f26db77d 100644 (file)
@@ -29,7 +29,7 @@
 #include <GeomAlgoAPI_PaveFiller.h>
 #include <GeomAlgoAPI_ShapeTools.h>
 
-#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
 
 #include <map>
 
@@ -77,8 +77,6 @@ void FeaturesPlugin_CompositeBoolean::executeCompositeBoolean()
   for(; aBoolObjIt != aBooleanObjects.cend() && aBoolMSIt != aBooleanMakeShapes.cend();
       ++aBoolObjIt, ++aBoolMSIt) {
 
-    int aTag = 1;
-
     ResultBodyPtr aResultBody = myFeature->document()->createBody(myFeature->data(), aResultIndex);
 
     if((*aBoolObjIt)->isEqual((*aBoolMSIt)->shape())) {
@@ -88,14 +86,15 @@ void FeaturesPlugin_CompositeBoolean::executeCompositeBoolean()
     {
       aResultBody->storeModified(*aBoolObjIt, (*aBoolMSIt)->shape());
 
-      aTag += 5000;
-
       // Store generation history.
       ListOfShape::const_iterator aGenBaseIt = aGenBaseShapes.cbegin();
       ListOfMakeShape::const_iterator aGenMSIt = aGenMakeShapes.cbegin();
       for(; aGenBaseIt != aGenBaseShapes.cend() && aGenMSIt != aGenMakeShapes.cend();
           ++aGenBaseIt, ++aGenMSIt) {
-        storeGenerationHistory(aResultBody, *aGenBaseIt, *aGenMSIt);
+        std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMSList(new GeomAlgoAPI_MakeShapeList());
+        aMSList->appendAlgo(*aGenMSIt);
+        aMSList->appendAlgo(*aBoolMSIt);
+        storeGenerationHistory(aResultBody, *aGenBaseIt, aMSList);
       }
 
       storeModificationHistory(aResultBody, *aBoolObjIt, aTools, *aBoolMSIt);
@@ -197,9 +196,11 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools,
 
         // Collecting solids from compsolids which will not be modified in boolean operation.
         ListOfShape aShapesToAdd;
-        for(GeomAPI_ShapeExplorer
-            anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
-          GeomShapePtr aSolidInCompSolid = anExp.current();
+        for (GeomAPI_ShapeIterator aCompSolidIt(aCompSolid);
+             aCompSolidIt.more();
+             aCompSolidIt.next())
+        {
+          GeomShapePtr aSolidInCompSolid = aCompSolidIt.current();
           ListOfShape::const_iterator aUsedShapesIt = aUsedShapes.cbegin();
           for(; aUsedShapesIt != aUsedShapes.cend(); ++aUsedShapesIt) {
             if(aSolidInCompSolid->isEqual(*aUsedShapesIt)) {
@@ -280,9 +281,11 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools,
         aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedShapes.begin(), aUsedShapes.end());
 
         // Collect solids from compsolid which will not be modified in boolean operation.
-        for(GeomAPI_ShapeExplorer
-            anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
-          GeomShapePtr aSolidInCompSolid = anExp.current();
+        for (GeomAPI_ShapeIterator aCompSolidIt(aCompSolid);
+             aCompSolidIt.more();
+             aCompSolidIt.next())
+        {
+          GeomShapePtr aSolidInCompSolid = aCompSolidIt.current();
           ListOfShape::iterator anIt = aUsedShapes.begin();
           for(; anIt != aUsedShapes.end(); anIt++) {
             if(aSolidInCompSolid->isEqual(*anIt)) {
@@ -383,7 +386,6 @@ void FeaturesPlugin_CompositeBoolean::storeModificationHistory(ResultBodyPtr the
   ListOfShape aTools = theTools;
   aTools.push_back(theObject);
 
-  std::string aName;
   for(ListOfShape::const_iterator anIt = aTools.begin(); anIt != aTools.end(); anIt++) {
     theResultBody->loadModifiedShapes(theMakeShape, *anIt,
                                       (*anIt)->shapeType() == GeomAPI_Shape::EDGE ?