Salome HOME
Tests fix
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Union.cpp
index 66bef610ccf6784882a93a7291050995f306fa57..e9cbaee7de9a13a1aaa3a2d56001da00a5becfaf 100644 (file)
@@ -29,7 +29,7 @@
 #include <GeomAPI_ShapeIterator.h>
 
 #include <ModelAPI_AttributeSelectionList.h>
-#include <ModelAPI_ResultCompSolid.h>
+#include <ModelAPI_ResultBody.h>
 #include <ModelAPI_Tools.h>
 
 //=================================================================================================
@@ -59,7 +59,7 @@ void FeaturesPlugin_Union::execute()
       return;
     }
     ResultPtr aContext = anObjectAttr->context();
-    ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
+    ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
     if(aResCompSolidPtr.get()) {
       std::shared_ptr<GeomAPI_Shape> aContextShape = aResCompSolidPtr->shape();
       std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
@@ -121,7 +121,7 @@ void FeaturesPlugin_Union::execute()
   }
 
   // Checking that the algorithm worked properly.
-  GeomAlgoAPI_MakeShapeList aMakeShapeList;
+  std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
   GeomAPI_DataMapOfShapeShape aMapOfShapes;
   if(!anAlgo->isDone()) {
     setError("Error: Boolean algorithm failed.");
@@ -137,7 +137,7 @@ void FeaturesPlugin_Union::execute()
   }
 
   GeomShapePtr aShape = anAlgo->shape();
-  aMakeShapeList.appendAlgo(anAlgo);
+  aMakeShapeList->appendAlgo(anAlgo);
   aMapOfShapes.merge(anAlgo->mapOfSubShapes());
 
   // Store original shapes for naming.
@@ -163,27 +163,20 @@ void FeaturesPlugin_Union::execute()
     }
 
     aShape = aFillerAlgo->shape();
-    aMakeShapeList.appendAlgo(aFillerAlgo);
+    aMakeShapeList->appendAlgo(aFillerAlgo);
     aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
   }
+  // workaround: make copy to name edges correctly
 
   // Store result and naming.
-  const int aModifyEdgeTag = 1;
-  const int aModifyFaceTag = 2;
-  const int aDeletedTag = 3;
-  /// sub solids will be placed at labels 4, 5 etc. if result is compound of solids
-  const int aSubsolidsTag = 4;
-  const std::string aModName = "Modified";
 
   std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data());
-  aResultBody->storeModified(anObjects.front(), aShape, aSubsolidsTag);
+  aResultBody->storeModified(anObjects.front(), aShape);
 
   for(ListOfShape::const_iterator anIter = anObjects.begin(); anIter != anObjects.end(); ++anIter) {
-    aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, *anIter, GeomAPI_Shape::EDGE,
-                                             aModifyEdgeTag, aModName, aMapOfShapes);
-    aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, *anIter, GeomAPI_Shape::FACE,
-                                             aModifyFaceTag, aModName, aMapOfShapes);
-    aResultBody->loadDeletedShapes(&aMakeShapeList, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
+    aResultBody->loadModifiedShapes(aMakeShapeList, *anIter, GeomAPI_Shape::EDGE);
+    aResultBody->loadModifiedShapes(aMakeShapeList, *anIter, GeomAPI_Shape::FACE);
+    //aResultBody->loadDeletedShapes(&aMakeShapeList, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
   }
 
   setResult(aResultBody);