]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/GEOMImpl/GEOMImpl_HealingDriver.cxx
Salome HOME
Merge remote branch 'origin/gdd/translations'
[modules/geom.git] / src / GEOMImpl / GEOMImpl_HealingDriver.cxx
index 51154eb638b116c43c4ae70a04c6a7b3169ade0f..3c519465c76fad30fb043e9b86e5deaf8b9fe45c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015  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
@@ -20,8 +20,6 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-#include <Standard_Stream.hxx>
-
 #include <GEOMImpl_HealingDriver.hxx>
 #include <GEOMImpl_Types.hxx>
 #include <GEOMImpl_IHealing.hxx>
 
 #include <TNaming_CopyShape.hxx>
 
-#include <ShapeFix_ShapeTolerance.hxx>
-#include <ShapeFix_Shape.hxx>
-
 #include <BRep_Builder.hxx>
 #include <BRepAdaptor_Curve.hxx>
-#include <BRepCheck_Analyzer.hxx>
 #include <BRepTools_WireExplorer.hxx>
 
 #include <TopExp.hxx>
@@ -456,26 +450,19 @@ Standard_Boolean GEOMImpl_HealingDriver::Sew (GEOMImpl_IHealing*  theHI,
 {
   Standard_Real aTol = theHI->GetTolerance();
 
-  TopoDS_Compound faceCompound;
+  TopoDS_Compound aCompound;
   BRep_Builder builder;
-  builder.MakeCompound( faceCompound );
+  builder.MakeCompound( aCompound );
 
-  TopExp_Explorer faceExp( theOriginalShape, TopAbs_FACE );
-  for ( ; faceExp.More(); faceExp.Next() )
-    builder.Add( faceCompound, faceExp.Current() );
-  
+  builder.Add( aCompound, theOriginalShape );
   Handle(TColStd_HSequenceOfTransient) otherObjs = theHI->GetShapes();
   for ( int ind = 1; ind <= otherObjs->Length(); ind++)
   {
     Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(otherObjs->Value(ind));
-    TopoDS_Shape aShape = aRefShape->GetValue();
-    if (aShape.IsNull())
-      Standard_NullObject::Raise("Null object given");
-    for ( faceExp.Init( aShape, TopAbs_FACE ); faceExp.More(); faceExp.Next() )
-      builder.Add( faceCompound, faceExp.Current() );
+    builder.Add( aCompound, aRefShape->GetValue() );
   }
 
-  ShHealOper_Sewing aHealer (faceCompound, aTol);
+  ShHealOper_Sewing aHealer (aCompound, aTol);
 
   // Set non-manifold mode.
   aHealer.SetNonManifoldMode(isAllowNonManifold);
@@ -650,6 +637,8 @@ void GEOMImpl_HealingDriver::LimitTolerance (GEOMImpl_IHealing* theHI,
                                              TopoDS_Shape& theOutShape) const
 {
   Standard_Real aTol = theHI->GetTolerance();
+  TopAbs_ShapeEnum aType = theHI->GetType();
+
   if (aTol < Precision::Confusion())
     aTol = Precision::Confusion();
 
@@ -659,19 +648,14 @@ void GEOMImpl_HealingDriver::LimitTolerance (GEOMImpl_IHealing* theHI,
     TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
     TNaming_CopyShape::CopyTool(theOriginalShape, aMapTShapes, aShapeCopy);
   }
-  // 2. Limit tolerance.
-  ShapeFix_ShapeTolerance aSFT;
-  aSFT.LimitTolerance(aShapeCopy, aTol, aTol, TopAbs_SHAPE);
-
-  // 3. Fix obtained shape.
-  Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape (aShapeCopy);
-  aSfs->Perform();
-  theOutShape = aSfs->Shape();
 
-  BRepCheck_Analyzer ana (theOutShape, Standard_True);
-  if (!ana.IsValid())
+  // 2. Limit tolerance.
+  if (!GEOMUtils::FixShapeTolerance(aShapeCopy, aType, aTol))
     StdFail_NotDone::Raise("Non valid shape result");
 
+  // 3. Set the result
+  theOutShape = aShapeCopy;
+
   // 4. Collect statistics
   {
     ShHealOper_Tool tool;
@@ -907,8 +891,7 @@ void GEOMImpl_HealingDriver::FuseCollinearEdges (const TopoDS_Shape& theOriginal
   }
   theOutShape = aFinalWire;
 
-  BRepCheck_Analyzer ana (theOutShape, Standard_True);
-  if (!ana.IsValid())
+  if (!GEOMUtils::CheckShape(theOutShape, true))
     StdFail_NotDone::Raise("Non valid shape result");
 }
 
@@ -1082,6 +1065,7 @@ GetCreationInformation(std::string&             theOperationName,
     theOperationName = "LIMIT_TOLERANCE";
     AddParam( theParams, "Selected shape", aCI.GetOriginal() );
     AddParam( theParams, "Tolerance", aCI.GetTolerance() );
+    AddParam( theParams, "Type", aCI.GetType() );
     break;
   case FUSE_COLLINEAR_EDGES:
     theOperationName = "FUSE_EDGES";