Salome HOME
[bos #29471] [EDF] (2022-T1) Advanced geometry features: iterate through holes of...
[modules/geom.git] / src / GEOMImpl / GEOMImpl_IBooleanOperations.cxx
index 644422c4c710d7584a272f43a67c5039fb6008f7..1e4f794c6d5173293d4452510fb60d931073b500 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -35,8 +35,6 @@
 #include <GEOMImpl_PartitionDriver.hxx>
 #include <GEOMImpl_IPartition.hxx>
 
-#include <Basics_OCCTVersion.hxx>
-
 #include <TDF_Tool.hxx>
 
 #include "utilities.h"
@@ -49,8 +47,8 @@
  *   constructor:
  */
 //=============================================================================
-GEOMImpl_IBooleanOperations::GEOMImpl_IBooleanOperations (GEOM_Engine* theEngine, int theDocID)
-: GEOM_IOperations(theEngine, theDocID)
+GEOMImpl_IBooleanOperations::GEOMImpl_IBooleanOperations (GEOM_Engine* theEngine)
+: GEOM_IOperations(theEngine)
 {
   MESSAGE("GEOMImpl_IBooleanOperations::GEOMImpl_IBooleanOperations");
 }
@@ -82,7 +80,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean
   if (theShape1.IsNull() || theShape2.IsNull()) return NULL;
 
   //Add a new Boolean object
-  Handle(GEOM_Object) aBool = GetEngine()->AddObject(GetDocID(), GEOM_BOOLEAN);
+  Handle(GEOM_Object) aBool = GetEngine()->AddObject(GEOM_BOOLEAN);
 
   //Add a new Boolean function
   Handle(GEOM_Function) aFunction;
@@ -114,17 +112,14 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean
 
   //Compute the Boolean value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     OCC_CATCH_SIGNALS;
-#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Boolean driver failed");
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -164,7 +159,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuse
   if (theShape1.IsNull() || theShape2.IsNull()) return NULL;
 
   //Add a new Boolean object
-  Handle(GEOM_Object) aBool = GetEngine()->AddObject(GetDocID(), GEOM_BOOLEAN);
+  Handle(GEOM_Object) aBool = GetEngine()->AddObject(GEOM_BOOLEAN);
 
   //Add a new Boolean function
   Handle(GEOM_Function) aFunction =
@@ -189,17 +184,14 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuse
 
   //Compute the Boolean value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     OCC_CATCH_SIGNALS;
-#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Boolean driver failed");
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -229,7 +221,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList
   if (theShapes.IsNull()) return NULL;
 
   //Add a new Boolean object
-  Handle(GEOM_Object) aBool = GetEngine()->AddObject(GetDocID(), GEOM_BOOLEAN);
+  Handle(GEOM_Object) aBool = GetEngine()->AddObject(GEOM_BOOLEAN);
 
   //Add a new Boolean function
   Handle(GEOM_Function) aFunction =
@@ -254,17 +246,14 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList
 
   //Compute the Boolean value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     OCC_CATCH_SIGNALS;
-#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Boolean driver failed");
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -292,7 +281,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCommonList
   if (theShapes.IsNull()) return NULL;
 
   //Add a new Boolean object
-  Handle(GEOM_Object) aBool = GetEngine()->AddObject(GetDocID(), GEOM_BOOLEAN);
+  Handle(GEOM_Object) aBool = GetEngine()->AddObject(GEOM_BOOLEAN);
 
   //Add a new Boolean function
   Handle(GEOM_Function) aFunction =
@@ -316,17 +305,14 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCommonList
 
   //Compute the Boolean value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     OCC_CATCH_SIGNALS;
-#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Boolean driver failed");
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -361,7 +347,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCutList
   if (theShapes.IsNull()) return NULL;
 
   //Add a new Boolean object
-  Handle(GEOM_Object) aBool = GetEngine()->AddObject(GetDocID(), GEOM_BOOLEAN);
+  Handle(GEOM_Object) aBool = GetEngine()->AddObject(GEOM_BOOLEAN);
 
   //Add a new Boolean function
   Handle(GEOM_Function) aFunction =
@@ -389,17 +375,14 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCutList
 
   //Compute the Boolean value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     OCC_CATCH_SIGNALS;
-#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Boolean driver failed");
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -439,7 +422,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
   SetErrorCode(KO);
 
   //Add a new Partition object
-  Handle(GEOM_Object) aPartition = GetEngine()->AddObject(GetDocID(), GEOM_PARTITION);
+  Handle(GEOM_Object) aPartition = GetEngine()->AddObject(GEOM_PARTITION);
 
   //Add a new Partition function
   Handle(GEOM_Function) aFunction;
@@ -516,17 +499,14 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
 
   //Compute the Partition
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     OCC_CATCH_SIGNALS;
-#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Partition driver failed");
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -577,7 +557,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition
   if (theShape.IsNull() || thePlane.IsNull()) return NULL;
 
   //Add a new Boolean object
-  Handle(GEOM_Object) aPart = GetEngine()->AddObject(GetDocID(), GEOM_PARTITION);
+  Handle(GEOM_Object) aPart = GetEngine()->AddObject(GEOM_PARTITION);
 
   //Add a new Partition function
   Handle(GEOM_Function) aFunction =
@@ -599,17 +579,14 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition
 
   //Compute the Partition value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     OCC_CATCH_SIGNALS;
-#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Partition driver failed");
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }