Salome HOME
updated copyright message
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_VersionedBoolean.cpp
index 2cf25d034fc5b231d39d3dcfd9b2fc4f57809141..73a7a4b645075aab2710440200517786ed216c11 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #include <algorithm>
 #include <map>
 
+
+//=================================================================================================
 static void performBoolean(const GeomAlgoAPI_Tools::BOPType theBooleanType,
                            GeomMakeShapePtr& theBooleanAlgo,
                            const ListOfShape& theObjects,
-                           const ListOfShape& theTools)
+                           const ListOfShape& theTools,
+                           const double theFuzzy)
 {
   if (theBooleanType == GeomAlgoAPI_Tools::BOOL_PARTITION)
     theBooleanAlgo.reset(new GeomAlgoAPI_Partition(theObjects, theTools));
@@ -62,11 +65,11 @@ static void performBoolean(const GeomAlgoAPI_Tools::BOPType theBooleanType,
         ListOfShape anObjects = theObjects;
         ListOfShape aTools;
         aTools.splice(aTools.begin(), anObjects, anObjects.begin());
-        theBooleanAlgo.reset(new GeomAlgoAPI_Boolean(anObjects, aTools, theBooleanType));
+        theBooleanAlgo.reset(new GeomAlgoAPI_Boolean(anObjects, aTools, theBooleanType, theFuzzy));
       }
     }
     else
-      theBooleanAlgo.reset(new GeomAlgoAPI_Boolean(theObjects, theTools, theBooleanType));
+      theBooleanAlgo.reset(new GeomAlgoAPI_Boolean(theObjects, theTools, theBooleanType, theFuzzy));
   }
 }
 
@@ -122,8 +125,9 @@ bool FeaturesPlugin_VersionedBoolean::processObject(
     const GeomShapePtr& theObject,
     const ListOfShape& theTools,
     const ListOfShape& thePlanes,
+    const double theFuzzy,
     int& theResultIndex,
-    std::vector<FeaturesPlugin_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
+    std::vector<ModelAPI_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
     ListOfShape& theResultShapesList,
     GeomShapePtr theResultCompound)
 {
@@ -140,11 +144,12 @@ bool FeaturesPlugin_VersionedBoolean::processObject(
   aToolsWithPlanes.insert(aToolsWithPlanes.end(), aPlanesCopy.begin(), aPlanesCopy.end());
 
   if (theBooleanType == GeomAlgoAPI_Tools::BOOL_PARTITION)
-    aBoolAlgo.reset(new GeomAlgoAPI_Partition(aListWithObject, aToolsWithPlanes));
+    aBoolAlgo.reset(new GeomAlgoAPI_Partition(aListWithObject, aToolsWithPlanes, theFuzzy));
   else
     aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aListWithObject,
                                             aToolsWithPlanes,
-                                            theBooleanType));
+                                            theBooleanType,
+                                            theFuzzy));
 
   // Checking that the algorithm worked properly.
   std::string anError;
@@ -187,7 +192,7 @@ bool FeaturesPlugin_VersionedBoolean::processObject(
       ListOfShape aUsedTools = theTools;
       aUsedTools.insert(aUsedTools.end(), thePlanes.begin(), thePlanes.end());
 
-      FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+      ModelAPI_Tools::loadModifiedShapes(aResultBody,
                                                aListWithObject,
                                                aUsedTools,
                                                aMakeShapeList,
@@ -197,7 +202,7 @@ bool FeaturesPlugin_VersionedBoolean::processObject(
     }
 
 
-    FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+    ModelAPI_Tools::ResultBaseAlgo aRBA;
     aRBA.resultBody = aResultBody;
     aRBA.baseShape = theObject;
     aRBA.makeShape = aMakeShapeList;
@@ -214,8 +219,9 @@ bool FeaturesPlugin_VersionedBoolean::processCompsolid(
     const GeomShapePtr& theCompsolid,
     const ListOfShape& theTools,
     const ListOfShape& thePlanes,
+    const double theFuzzy,
     int& theResultIndex,
-    std::vector<FeaturesPlugin_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
+    std::vector<ModelAPI_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
     ListOfShape& theResultShapesList,
     GeomShapePtr theResultCompound)
 {
@@ -232,7 +238,7 @@ bool FeaturesPlugin_VersionedBoolean::processCompsolid(
   aToolsWithPlanes.insert(aToolsWithPlanes.end(), aPlanesCopy.begin(), aPlanesCopy.end());
 
   std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
-  performBoolean(theBooleanType, aBoolAlgo, aUsedInOperationSolids, aToolsWithPlanes);
+  performBoolean(theBooleanType, aBoolAlgo, aUsedInOperationSolids, aToolsWithPlanes, theFuzzy);
 
   // Checking that the algorithm worked properly.
   std::string anError;
@@ -251,7 +257,7 @@ bool FeaturesPlugin_VersionedBoolean::processCompsolid(
     ListOfShape aShapesToAdd = aNotUsedSolids;
     aShapesToAdd.push_back(aBoolAlgo->shape());
     std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(
-        new GeomAlgoAPI_PaveFiller(aShapesToAdd, true));
+        new GeomAlgoAPI_PaveFiller(aShapesToAdd, true, theFuzzy));
     if (!aFillerAlgo->isDone()) {
       std::string aFeatureError = "Error: PaveFiller algorithm failed.";
       setError(aFeatureError);
@@ -283,7 +289,7 @@ bool FeaturesPlugin_VersionedBoolean::processCompsolid(
       ListOfShape aUsedTools = theTools;
       aUsedTools.insert(aUsedTools.end(), thePlanes.begin(), thePlanes.end());
 
-      FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+      ModelAPI_Tools::loadModifiedShapes(aResultBody,
                                                aCompSolidList,
                                                aUsedTools,
                                                aMakeShapeList,
@@ -292,7 +298,7 @@ bool FeaturesPlugin_VersionedBoolean::processCompsolid(
       ++theResultIndex;
     }
 
-    FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+    ModelAPI_Tools::ResultBaseAlgo aRBA;
     aRBA.resultBody = aResultBody;
     aRBA.baseShape = theCompsolid;
     aRBA.makeShape = aMakeShapeList;
@@ -308,8 +314,9 @@ bool FeaturesPlugin_VersionedBoolean::processCompound(
     GeomAPI_ShapeHierarchy& theCompoundHierarchy,
     const GeomShapePtr& theCompound,
     const ListOfShape& theTools,
+    const double theFuzzy,
     int& theResultIndex,
-    std::vector<FeaturesPlugin_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
+    std::vector<ModelAPI_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
     ListOfShape& theResultShapesList,
     GeomShapePtr theResultCompound)
 {
@@ -324,7 +331,7 @@ bool FeaturesPlugin_VersionedBoolean::processCompound(
 
   std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
   std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
-  performBoolean(theBooleanType, aBoolAlgo, aUsedInOperationShapes, theTools);
+  performBoolean(theBooleanType, aBoolAlgo, aUsedInOperationShapes, theTools, theFuzzy);
 
   // Checking that the algorithm worked properly.
   std::string anError;
@@ -372,7 +379,7 @@ bool FeaturesPlugin_VersionedBoolean::processCompound(
 
       ListOfShape aCompoundList;
       aCompoundList.push_back(theCompound);
-      FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+      ModelAPI_Tools::loadModifiedShapes(aResultBody,
                                                aCompoundList,
                                                theTools,
                                                aMakeShapeList,
@@ -381,7 +388,7 @@ bool FeaturesPlugin_VersionedBoolean::processCompound(
       ++theResultIndex;
     }
 
-    FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+    ModelAPI_Tools::ResultBaseAlgo aRBA;
     aRBA.resultBody = aResultBody;
     aRBA.baseShape = theCompound;
     aRBA.makeShape = aMakeShapeList;