Salome HOME
Porting to OCCT development version: Standard_PI -> M_PI
[modules/geom.git] / src / GEOMAlgo / BlockFix_UnionFaces.cxx
index 8149a78199497f10c873a1752b5f7e934e9c5adc..e2f9f32fd8a2dfa7434aadb4c33163dd1e6e22e8 100644 (file)
@@ -1,30 +1,32 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011  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
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  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.
+// 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.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  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
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// 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
 //
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
 //  File:    BlockFix_UnionFaces.cxx
 //  Created: Tue Dec  7 17:15:42 2004
 //  Author:  Pavel DURANDIN
 
 #include <BlockFix_UnionFaces.ixx>
 
+#include <Basics_OCCTVersion.hxx>
+
 #include <ShapeAnalysis_WireOrder.hxx>
 #include <ShapeAnalysis_Edge.hxx>
 
 #include <ShapeFix_Wire.hxx>
 #include <ShapeFix_Edge.hxx>
 
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+#include <IntPatch_ImpImpIntersection.hxx>
+#else
 #include <IntPatch_TheIIIntOfIntersection.hxx>
+#endif
 
 #include <BRep_Tool.hxx>
 #include <BRep_Builder.hxx>
@@ -90,6 +96,9 @@
 #include <gp_XY.hxx>
 #include <gp_Pnt2d.hxx>
 
+#include <Standard_Failure.hxx>
+#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+
 //=======================================================================
 //function : BlockFix_UnionFaces
 //purpose  :
@@ -609,11 +618,24 @@ Standard_Boolean BlockFix_UnionFaces::IsSameDomain(const TopoDS_Face& aFace,
     Handle(BRepTopAdaptor_TopolTool) aTT1 = new BRepTopAdaptor_TopolTool();
     Handle(BRepTopAdaptor_TopolTool) aTT2 = new BRepTopAdaptor_TopolTool();
 
-    IntPatch_TheIIIntOfIntersection anIIInt (aGA1, aTT1, aGA2, aTT2, aPrec, aPrec);
-    if (!anIIInt.IsDone() || anIIInt.IsEmpty())
-      return false;
+    try {
+#if OCC_VERSION_LARGE > 0x06010000
+      OCC_CATCH_SIGNALS;
+#endif
 
-    return anIIInt.TangentFaces();
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+      IntPatch_ImpImpIntersection anIIInt (aGA1, aTT1, aGA2, aTT2, aPrec, aPrec);
+#else
+      IntPatch_TheIIIntOfIntersection anIIInt (aGA1, aTT1, aGA2, aTT2, aPrec, aPrec);
+#endif
+      if (!anIIInt.IsDone() || anIIInt.IsEmpty())
+        return false;
+
+      return anIIInt.TangentFaces();
+    }
+    catch (Standard_Failure) {
+      return false;
+    }
   }
 
   // case of two planar surfaces: