Salome HOME
Copyright update 2022
[modules/geom.git] / src / GEOM_I / GEOM_IBooleanOperations_i.cc
index 2cad84b5dbafc9eb51e5c4fe4f1aa46e5d0e7cac..c9f659dad9dc0559c8a025962dc096169a217e13 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  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
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -62,9 +62,10 @@ GEOM_IBooleanOperations_i::~GEOM_IBooleanOperations_i()
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean
-                                                 (GEOM::GEOM_Object_ptr theShape1,
-                                                  GEOM::GEOM_Object_ptr theShape2,
-                                                  CORBA::Long           theOp)
+                                    (GEOM::GEOM_Object_ptr theShape1,
+                                     GEOM::GEOM_Object_ptr theShape2,
+                                     CORBA::Long           theOp,
+                                     CORBA::Boolean        IsCheckSelfInte)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -72,13 +73,46 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean
   GetOperations()->SetNotDone();
 
   //Get the reference shapes
-  Handle(GEOM_Object) aSh1 = GetObjectImpl(theShape1);
-  Handle(GEOM_Object) aSh2 = GetObjectImpl(theShape2);
+  Handle(::GEOM_Object) aSh1 = GetObjectImpl(theShape1);
+  Handle(::GEOM_Object) aSh2 = GetObjectImpl(theShape2);
 
   if (aSh1.IsNull() || aSh2.IsNull()) return aGEOMObject._retn();
 
   // Make Boolean
-  Handle(GEOM_Object) anObject = GetOperations()->MakeBoolean(aSh1, aSh2, theOp);
+  Handle(::GEOM_Object) anObject =
+    GetOperations()->MakeBoolean(aSh1, aSh2, theOp, IsCheckSelfInte);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ *  MakeFuse
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuse
+                                    (GEOM::GEOM_Object_ptr theShape1,
+                                     GEOM::GEOM_Object_ptr theShape2,
+                                     CORBA::Boolean        IsCheckSelfInte,
+                                     CORBA::Boolean        IsRmExtraEdges)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference shapes
+  Handle(::GEOM_Object) aSh1 = GetObjectImpl(theShape1);
+  Handle(::GEOM_Object) aSh2 = GetObjectImpl(theShape2);
+
+  if (aSh1.IsNull() || aSh2.IsNull()) return aGEOMObject._retn();
+
+  // Make Boolean
+  Handle(::GEOM_Object) anObject = GetOperations()->MakeFuse
+    (aSh1, aSh2, IsCheckSelfInte, IsRmExtraEdges);
+
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -91,7 +125,9 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList
-                                    (const GEOM::ListOfGO& theShapes)
+                                    (const GEOM::ListOfGO& theShapes,
+                                     CORBA::Boolean        IsCheckSelfInte,
+                                     CORBA::Boolean        IsRmExtraEdges)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -106,7 +142,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList
   }
 
   // Make fusion
-  Handle(GEOM_Object) anObject = GetOperations()->MakeFuseList(aShapes);
+  Handle(::GEOM_Object) anObject =
+    GetOperations()->MakeFuseList(aShapes, IsCheckSelfInte, IsRmExtraEdges);
 
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -120,7 +157,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCommonList
-                                    (const GEOM::ListOfGO& theShapes)
+                                    (const GEOM::ListOfGO& theShapes,
+                                     CORBA::Boolean        IsCheckSelfInte)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -135,7 +173,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCommonList
   }
 
   // Make fusion
-  Handle(GEOM_Object) anObject = GetOperations()->MakeCommonList(aShapes);
+  Handle(::GEOM_Object) anObject =
+    GetOperations()->MakeCommonList(aShapes, IsCheckSelfInte);
 
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -150,14 +189,15 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCommonList
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCutList
                                     (GEOM::GEOM_Object_ptr theMainShape,
-                                     const GEOM::ListOfGO& theShapes)
+                                     const GEOM::ListOfGO& theShapes,
+                                     CORBA::Boolean        IsCheckSelfInte)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  Handle(GEOM_Object) aMainShape = GetObjectImpl(theMainShape);
+  Handle(::GEOM_Object) aMainShape = GetObjectImpl(theMainShape);
 
   if (aMainShape.IsNull()) {
     return aGEOMObject._retn();
@@ -171,7 +211,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCutList
   }
 
   // Make fusion
-  Handle(GEOM_Object) anObject = GetOperations()->MakeCutList(aMainShape, aShapes);
+  Handle(::GEOM_Object) anObject =
+    GetOperations()->MakeCutList(aMainShape, aShapes, IsCheckSelfInte);
 
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -221,11 +262,12 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition
   }
 
   // Make Partition
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns,
                                    theLimit, theRemoveWebs, aMaterials,
                                    theKeepNonlimitShapes,
-                                   /*PerformSelfIntersections*/Standard_True);
+                                   /*PerformSelfIntersections*/Standard_True,
+                                   /*IsCheckSelfInte*/Standard_False);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -245,7 +287,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected
                                        CORBA::Short            theLimit,
                                        CORBA::Boolean          theRemoveWebs,
                                        const GEOM::ListOfLong& theMaterials,
-                                       CORBA::Short theKeepNonlimitShapes)
+                                       CORBA::Short theKeepNonlimitShapes,
+                                       CORBA::Boolean          IsCheckSelfInte)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -274,11 +317,12 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected
   }
 
   // Make Partition
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns,
                                    theLimit, theRemoveWebs, aMaterials,
                                    theKeepNonlimitShapes,
-                                   /*PerformSelfIntersections*/Standard_False);
+                                   /*PerformSelfIntersections*/Standard_False,
+                                   IsCheckSelfInte);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -300,13 +344,14 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeHalfPartition
   GetOperations()->SetNotDone();
 
   //Get the reference shapes
-  Handle(GEOM_Object) aSh = GetObjectImpl(theShape);
-  Handle(GEOM_Object) aPl = GetObjectImpl(thePlane);
+  Handle(::GEOM_Object) aSh = GetObjectImpl(theShape);
+  Handle(::GEOM_Object) aPl = GetObjectImpl(thePlane);
 
   if (aSh.IsNull() || aPl.IsNull()) return aGEOMObject._retn();
 
   // Make Half Partition
-  Handle(GEOM_Object) anObject = GetOperations()->MakeHalfPartition(aSh, aPl);
+  Handle(::GEOM_Object) anObject =
+    GetOperations()->MakeHalfPartition(aSh, aPl);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();