]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp
Salome HOME
Merge branch 'jfa/40620_ExportXAO_separate_BREP'
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Intersection.cpp
index 5793dbf0bd49a6e4bbd8330cf0276551403e7f40..46c3e51c1861f93984cf0e265a7fe490739c7477 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "GeomAlgoAPI_Intersection.h"
 #include <BOPAlgo_PaveFiller.hxx>
 #include <BOPAlgo_Section.hxx>
 
+
 //==================================================================================================
-GeomAlgoAPI_Intersection::GeomAlgoAPI_Intersection(const ListOfShape& theObjects)
+GeomAlgoAPI_Intersection::GeomAlgoAPI_Intersection(const ListOfShape& theObjects, const double theFuzzy)
+  : myFiller(0)
 {
-  build(theObjects);
+  build(theObjects, theFuzzy);
+}
+
+//==================================================================================================
+GeomAlgoAPI_Intersection::~GeomAlgoAPI_Intersection() {
+  if (myFiller)
+    delete (BOPAlgo_PaveFiller*)myFiller;
 }
 
 //==================================================================================================
-void GeomAlgoAPI_Intersection::build(const ListOfShape& theObjects)
+void GeomAlgoAPI_Intersection::build(const ListOfShape& theObjects, const double theFuzzy)
 {
   if (theObjects.empty()) {
     return;
@@ -53,29 +60,33 @@ void GeomAlgoAPI_Intersection::build(const ListOfShape& theObjects)
     }
   }
 
-  BOPAlgo_PaveFiller aDSFiller;
-  aDSFiller.SetArguments(anObjects);
+  BOPAlgo_PaveFiller* aDSFiller = new BOPAlgo_PaveFiller;
+  myFiller = aDSFiller;
+  aDSFiller->SetArguments(anObjects);
 
-  aDSFiller.SetRunParallel(false);
-  aDSFiller.SetNonDestructive(false);
-  aDSFiller.SetGlue(BOPAlgo_GlueOff);
+  aDSFiller->SetRunParallel(false);
+  aDSFiller->SetNonDestructive(false);
+  aDSFiller->SetGlue(BOPAlgo_GlueOff);
+  if (theFuzzy > 0) aDSFiller->SetFuzzyValue(theFuzzy);
 
   // optimization for the issue #2399
   BOPAlgo_SectionAttribute theSecAttr(Standard_True,
                                       Standard_True,
                                       Standard_True);
-  aDSFiller.SetSectionAttribute(theSecAttr);
+  aDSFiller->SetSectionAttribute(theSecAttr);
 
-  aDSFiller.Perform();
-  if (aDSFiller.HasErrors()) {
+  aDSFiller->Perform();
+  if (aDSFiller->HasErrors()) {
     return;
   }
 
   anOperation->SetArguments(anObjects);
   anOperation->SetRunParallel(false);
   anOperation->SetCheckInverted(true);
+  if (theFuzzy > 0) anOperation->SetFuzzyValue(theFuzzy);
 
-  anOperation->PerformWithFiller(aDSFiller);
+  anOperation->PerformWithFiller(*aDSFiller); // it references a filler fields, so keep the filler
+  myFiller = 0;
   if(anOperation->HasErrors()) {
     return;
   }