Salome HOME
0016756: EDF 545 GEOM : Extrusion, give the coordinates of the vector as input
[modules/geom.git] / src / ShHealOper / ShHealOper_ShapeProcess.cxx
index 56503fbb4ef8ccb122fa83e607c20e127fe4a703..07c7291febd73fca7c1e5fb3eb8e99151b8c8465 100644 (file)
@@ -1,24 +1,26 @@
-// File:      ShHealOper_ShapeProcess.cxx
-// Created:   14.04.04 10:58:04
-// Author:    Galina KULIKOVA
-//  < MODULE = KERNEL> <PACKAGE = ShHealOper> : <Shape Healing Operations>
-//  Copyright (C) 2003  CEA
+// Copyright (C) 2005  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 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 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.
+// 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
 //
-
-//  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.
+// 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
 //
+// File:      ShHealOper_ShapeProcess.cxx
+// Created:   14.04.04 10:58:04
+// Author:    Galina KULIKOVA
 
 #include <ShHealOper_ShapeProcess.hxx>
 #include <ShapeProcessAPI_ApplySequence.hxx>
 #include <TopAbs_ShapeEnum.hxx>
 #include <TopTools_DataMapOfShapeShape.hxx>
 #include <ShapeProcess_ShapeContext.hxx>
+#include <ShapeAnalysis_ShapeTolerance.hxx>
+#include <Precision.hxx>
+#include <BRep_Builder.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
+#include <TNaming_CopyShape.hxx>
+
 //=======================================================================
 //function : ShHealOper_ShapeProcess()
 //purpose  : Constructor
@@ -73,11 +82,23 @@ void ShHealOper_ShapeProcess::Perform(const TopoDS_Shape& theOldShape,
   //ShapeProcessAPI_ApplySequence aOperations(myResource,myPrefix.ToCString());
   //myDone = Standard_False;
   myOperations.ClearMap();
-  
-  theNewShape = myOperations.PrepareShape(theOldShape,mySaveHistoryMode,myLevel);
+  ShapeAnalysis_ShapeTolerance aSatol;
+  Standard_Real ainitTol = aSatol.Tolerance(theOldShape,0);
+
+  // PAL6487: san -- preserve the original shape from being modified
+  TopoDS_Shape anOldShape;
+  TColStd_IndexedDataMapOfTransientTransient aMap;
+  TNaming_CopyShape::CopyTool(theOldShape, aMap, anOldShape);
+  // PAL6487: san -- preserve the original shape from being modified
+
+  theNewShape = myOperations.PrepareShape(anOldShape,mySaveHistoryMode,myLevel);
   if(mySaveHistoryMode)
     myMapModifications = myOperations.Map();
-  myDone = !theOldShape.IsSame(theNewShape);
+  myDone = !anOldShape.IsSame(theNewShape);
+  if(!myDone) {
+    Standard_Real aendTol =aSatol.Tolerance(theNewShape,0);
+    myDone = (fabs(ainitTol - aendTol) > Precision::Confusion()); 
+  }
 }
 //=======================================================================
 //function : SetOperators