+//=======================================================================
+//function : ChangeOrientation
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMImpl_HealingDriver::ChangeOrientation (GEOMImpl_IHealing* theHI,
+ const TopoDS_Shape& theOriginalShape,
+ TopoDS_Shape& theOutShape) const
+{
+ ShHealOper_ChangeOrientation aHealer (theOriginalShape);
+
+ Standard_Boolean aResult = aHealer.Perform();
+
+ if (aResult)
+ theOutShape = aHealer.GetResultShape();
+ else
+ raiseNotDoneExeption( aHealer.GetErrorStatus() );
+
+ return aResult;
+}
+
+//=======================================================================
+//function : LimitTolerance
+//purpose :
+//=======================================================================
+void GEOMImpl_HealingDriver::LimitTolerance (GEOMImpl_IHealing* theHI,
+ const TopoDS_Shape& theOriginalShape,
+ TopoDS_Shape& theOutShape) const
+{
+ Standard_Real aTol = theHI->GetTolerance();
+ if (aTol < Precision::Confusion())
+ aTol = Precision::Confusion();
+
+ // 1. Make a copy to prevent the original shape changes.
+ TopoDS_Shape aShapeCopy;
+ 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())
+ StdFail_NotDone::Raise("Non valid shape result");
+}
+