X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMImpl%2FGEOMImpl_HealingDriver.cxx;h=b196c1928d79377b7363774e4ebad64bcc9c4263;hb=e067674b75266d9f67a2c474d8dc901d9f65fe48;hp=0678df2c7c1b676b10349456fe74a35cb88cc7c9;hpb=db4ad95d8e04bf23ba8f65833ae13e7f7d10b675;p=modules%2Fgeom.git diff --git a/src/GEOMImpl/GEOMImpl_HealingDriver.cxx b/src/GEOMImpl/GEOMImpl_HealingDriver.cxx index 0678df2c7..b196c1928 100644 --- a/src/GEOMImpl/GEOMImpl_HealingDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_HealingDriver.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, 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 - #include #include #include @@ -44,12 +42,9 @@ #include -#include -#include - #include #include -#include +#include #include #include @@ -69,16 +64,16 @@ //======================================================================= //function : raiseNotDoneExeption -//purpose : global function: forms error message and raises exeption +//purpose : global function: forms error message and raises exception //======================================================================= void raiseNotDoneExeption( const int theErrorStatus ) { switch ( theErrorStatus ) { - case ShHealOper_NotError: StdFail_NotDone::Raise( "ShHealOper_NotError_msg" ); - case ShHealOper_InvalidParameters: StdFail_NotDone::Raise( "ShHealOper_InvalidParameters_msg" ); + case ShHealOper_NotError: StdFail_NotDone::Raise( "ShHealOper_NotError_msg" ); break; + case ShHealOper_InvalidParameters: StdFail_NotDone::Raise( "ShHealOper_InvalidParameters_msg" ); break; case ShHealOper_ErrorExecution: - default: StdFail_NotDone::Raise( "ShHealOper_ErrorExecution_msg" ); + default: StdFail_NotDone::Raise( "ShHealOper_ErrorExecution_msg" ); break; } } @@ -104,7 +99,7 @@ GEOMImpl_HealingDriver::GEOMImpl_HealingDriver() //function : Execute //purpose : //======================================================================= -Standard_Integer GEOMImpl_HealingDriver::Execute(TFunction_Logbook& log) const +Standard_Integer GEOMImpl_HealingDriver::Execute(Handle(TFunction_Logbook)& log) const { if (Label().IsNull()) return 0; Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); @@ -142,9 +137,10 @@ Standard_Integer GEOMImpl_HealingDriver::Execute(TFunction_Logbook& log) const Sew(&HI, anOriginalShape, aShape, true); break; case REMOVE_INTERNAL_FACES: - RemoveInternalFaces(anOriginalShape, aShape); + RemoveInternalFaces(&HI, anOriginalShape, aShape); break; case DIVIDE_EDGE: + case DIVIDE_EDGE_BY_POINT: AddPointOnEdge(&HI, anOriginalShape, aShape); break; case CHANGE_ORIENTATION: @@ -168,7 +164,7 @@ Standard_Integer GEOMImpl_HealingDriver::Execute(TFunction_Logbook& log) const aFunction->SetValue(aShape); - log.SetTouched(Label()); + log->SetTouched(Label()); return 1; } @@ -215,6 +211,8 @@ Standard_Boolean GEOMImpl_HealingDriver::ShapeProcess (GEOMImpl_IHealing* theHI, if (!aHealer.isDone()) raiseNotDoneExeption( ShHealOper_NotError ); + SaveStatistics( aHealer ); + return Standard_True; } @@ -222,9 +220,9 @@ Standard_Boolean GEOMImpl_HealingDriver::ShapeProcess (GEOMImpl_IHealing* theHI, //function : SupressFaces //purpose : //======================================================================= -void SuppressFacesRec (const TopTools_SequenceOfShape& theShapesFaces, - const TopoDS_Shape& theOriginalShape, - TopoDS_Shape& theOutShape) +void GEOMImpl_HealingDriver::SuppressFacesRec (const TopTools_SequenceOfShape& theShapesFaces, + const TopoDS_Shape& theOriginalShape, + TopoDS_Shape& theOutShape) const { if ((theOriginalShape.ShapeType() != TopAbs_COMPOUND && theOriginalShape.ShapeType() != TopAbs_COMPSOLID)) @@ -306,6 +304,21 @@ Standard_Boolean GEOMImpl_HealingDriver::SuppressFaces (GEOMImpl_IHealing* theHI theOutShape = GEOMImpl_GlueDriver::GlueFaces(aSh, Precision::Confusion(), Standard_True); } } + // count removed faces + TopTools_IndexedMapOfShape faces; + TopExp::MapShapes(theOriginalShape, TopAbs_FACE, faces); + int nbBefore = faces.Extent(); + faces.Clear(); + TopExp::MapShapes(theOutShape, TopAbs_FACE, faces); + int nbAfter = faces.Extent(); + + if ( nbAfter < nbBefore ) + { + ShHealOper_Tool tool; + ShHealOper_ModifStats& stats = tool.GetStatistics(); + stats.AddModif( "Face removed", nbBefore - nbAfter ); + SaveStatistics( tool ); + } return Standard_True; } @@ -346,6 +359,8 @@ Standard_Boolean GEOMImpl_HealingDriver::CloseContour (GEOMImpl_IHealing* theHI, else raiseNotDoneExeption( aHealer.GetErrorStatus() ); + SaveStatistics( aHealer ); + return aResult; } @@ -382,6 +397,8 @@ Standard_Boolean GEOMImpl_HealingDriver::RemoveIntWires (GEOMImpl_IHealing* theH else raiseNotDoneExeption( aHealer.GetErrorStatus() ); + SaveStatistics( aHealer ); + return aResult; } @@ -418,6 +435,8 @@ Standard_Boolean GEOMImpl_HealingDriver::RemoveHoles (GEOMImpl_IHealing* theHI, else raiseNotDoneExeption( aHealer.GetErrorStatus() ); + SaveStatistics( aHealer ); + return aResult; } @@ -432,26 +451,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); @@ -463,6 +475,8 @@ Standard_Boolean GEOMImpl_HealingDriver::Sew (GEOMImpl_IHealing* theHI, else raiseNotDoneExeption( aHealer.GetErrorStatus() ); + SaveStatistics( aHealer ); + return aResult; } @@ -470,11 +484,44 @@ Standard_Boolean GEOMImpl_HealingDriver::Sew (GEOMImpl_IHealing* theHI, //function : RemoveInternalFaces //purpose : //======================================================================= -Standard_Boolean GEOMImpl_HealingDriver::RemoveInternalFaces (const TopoDS_Shape& theOriginalShape, - TopoDS_Shape& theOutShape) const +Standard_Boolean +GEOMImpl_HealingDriver::RemoveInternalFaces (GEOMImpl_IHealing* theHI, + const TopoDS_Shape& theOriginalShape, + TopoDS_Shape& theOutShape) const { + // get all input shapes + TopTools_SequenceOfShape shapeSeq; + shapeSeq.Append( theOriginalShape ); + Handle(TColStd_HSequenceOfTransient) otherObjs = theHI->GetShapes(); + if ( !otherObjs.IsNull() ) + 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"); + shapeSeq.Append( aShape ); + } + + // pass input shapes to the algorithm GEOMAlgo_RemoverWebs aTool; - aTool.SetShape(theOriginalShape); + if ( shapeSeq.Length() == 1 ) + { + aTool.SetShape( shapeSeq.First() ); + } + else + { + TopoDS_Compound solidCompound; + BRep_Builder builder; + builder.MakeCompound( solidCompound ); + for ( int ind = 1; ind <= shapeSeq.Length(); ++ind ) + for ( TopExp_Explorer so( shapeSeq( ind ), TopAbs_SOLID ); so.More(); so.Next() ) + builder.Add( solidCompound, so.Current() ); + + aTool.SetShape( solidCompound ); + } + + // run the algorithm aTool.Perform(); if (aTool.ErrorStatus() == 0) { // OK @@ -500,26 +547,53 @@ Standard_Boolean GEOMImpl_HealingDriver::RemoveInternalFaces (const TopoDS_Shape //function : AddPointOnEdge //purpose : //======================================================================= -Standard_Boolean GEOMImpl_HealingDriver::AddPointOnEdge (GEOMImpl_IHealing* theHI, +Standard_Boolean GEOMImpl_HealingDriver::AddPointOnEdge (GEOMImpl_IHealing* theHI, const TopoDS_Shape& theOriginalShape, - TopoDS_Shape& theOutShape) const + TopoDS_Shape& theOutShape) const { Standard_Boolean isByParameter = theHI->GetIsByParameter(); - Standard_Integer anIndex = theHI->GetIndex(); - Standard_Real aValue = theHI->GetDevideEdgeValue(); + Standard_Integer anIndex = theHI->GetIndex(); + Standard_Real aValue = theHI->GetDevideEdgeValue(); + + TopoDS_Shape pointToProject; + { + Handle(TColStd_HSequenceOfTransient) funs = theHI->GetShapes(); + if ( !funs.IsNull() && funs->Length() > 0 ) { + TopoDS_Compound vCompound; + BRep_Builder builder; + builder.MakeCompound( vCompound ); + pointToProject = vCompound; + for ( int ind = 1; ind <= funs->Length(); ind++) + { + Handle(GEOM_Function) vFun = Handle(GEOM_Function)::DownCast(funs->Value(ind)); + TopoDS_Shape vertex = vFun->GetValue(); + if ( vertex.IsNull() ) + Standard_NullObject::Raise("Null vertex given"); + builder.Add( vCompound, vertex ); + } + } + } ShHealOper_EdgeDivide aHealer (theOriginalShape); Standard_Boolean aResult = Standard_False; - if (anIndex == -1) { // apply algorythm for the whole shape which is EDGE - if (theOriginalShape.ShapeType() == TopAbs_EDGE) - aResult = aHealer.Perform(TopoDS::Edge(theOriginalShape), aValue, isByParameter); + if (anIndex == -1) { // apply algorithm for the whole shape which is EDGE + if (theOriginalShape.ShapeType() == TopAbs_EDGE) { + if ( pointToProject.IsNull() ) + aResult = aHealer.Perform(TopoDS::Edge(theOriginalShape), aValue, isByParameter); + else + aResult = aHealer.Perform(TopoDS::Edge(theOriginalShape), pointToProject); + } } else { TopTools_IndexedMapOfShape aShapes; TopExp::MapShapes(theOriginalShape, aShapes); TopoDS_Shape aEdgeShape = aShapes.FindKey(anIndex); - if (aEdgeShape.ShapeType() == TopAbs_EDGE) - aResult = aHealer.Perform(TopoDS::Edge(aEdgeShape), aValue, isByParameter); + if (aEdgeShape.ShapeType() == TopAbs_EDGE) { + if ( pointToProject.IsNull() ) + aResult = aHealer.Perform(TopoDS::Edge(aEdgeShape), aValue, isByParameter); + else + aResult = aHealer.Perform(TopoDS::Edge(aEdgeShape), pointToProject); + } } if (aResult) @@ -527,6 +601,8 @@ Standard_Boolean GEOMImpl_HealingDriver::AddPointOnEdge (GEOMImpl_IHealing* theH else raiseNotDoneExeption( aHealer.GetErrorStatus() ); + SaveStatistics( aHealer ); + return aResult; } @@ -535,7 +611,7 @@ Standard_Boolean GEOMImpl_HealingDriver::AddPointOnEdge (GEOMImpl_IHealing* theH //function : ChangeOrientation //purpose : //======================================================================= -Standard_Boolean GEOMImpl_HealingDriver::ChangeOrientation (GEOMImpl_IHealing* theHI, +Standard_Boolean GEOMImpl_HealingDriver::ChangeOrientation (GEOMImpl_IHealing* /*theHI*/, const TopoDS_Shape& theOriginalShape, TopoDS_Shape& theOutShape) const { @@ -548,6 +624,8 @@ Standard_Boolean GEOMImpl_HealingDriver::ChangeOrientation (GEOMImpl_IHealing* t else raiseNotDoneExeption( aHealer.GetErrorStatus() ); + SaveStatistics( aHealer ); + return aResult; } @@ -560,26 +638,92 @@ 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(); // 1. Make a copy to prevent the original shape changes. TopoDS_Shape aShapeCopy; - TColStd_IndexedDataMapOfTransientTransient aMapTShapes; - TNaming_CopyShape::CopyTool(theOriginalShape, aMapTShapes, aShapeCopy); + { + BRepBuilderAPI_Copy aMC (theOriginalShape); + if (aMC.IsDone()) { + aShapeCopy = aMC.Shape(); + } + else { + TColStd_IndexedDataMapOfTransientTransient aMapTShapes; + TNaming_CopyShape::CopyTool(theOriginalShape, aMapTShapes, aShapeCopy); + } + } // 2. Limit tolerance. - ShapeFix_ShapeTolerance aSFT; - aSFT.LimitTolerance(aShapeCopy, aTol, aTol, TopAbs_SHAPE); + if (!GEOMUtils::FixShapeTolerance(aShapeCopy, aType, aTol)) + StdFail_NotDone::Raise("Non valid shape result"); - // 3. Fix obtained shape. - Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape (aShapeCopy); - aSfs->Perform(); - theOutShape = aSfs->Shape(); + // 3. Set the result + theOutShape = aShapeCopy; - BRepCheck_Analyzer ana (theOutShape, Standard_True); - if (!ana.IsValid()) - StdFail_NotDone::Raise("Non valid shape result"); + // 4. Collect statistics + { + ShHealOper_Tool tool; + ShHealOper_ModifStats& stats = tool.GetStatistics(); + + int nb[3] = { 0,0,0 }; + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( theOutShape, TopAbs_VERTEX, aShapes); + for ( int i = 1; i <= aShapes.Extent(); ++i ) + { + const TopoDS_Vertex& v = TopoDS::Vertex( aShapes( i )); + double tol = BRep_Tool::Tolerance( v ); + if ( tol < aTol ) nb[0]++; + else if ( tol > aTol ) nb[2]++; + else nb[1]++; + } + if ( nb[0] > 0 ) + stats.AddModif( "Tolerance of vertex decreased for shape validity", nb[0] ); + if ( nb[1] > 0 ) + stats.AddModif( "Tolerance of vertex limited as requested", nb[1] ); + if ( nb[2] > 0 ) + stats.AddModif( "Tolerance of vertex increased for shape validity", nb[2] ); + + nb[0] = nb[1] = nb[2] = 0; + aShapes.Clear(); + TopExp::MapShapes( theOutShape, TopAbs_EDGE, aShapes); + for ( int i = 1; i <= aShapes.Extent(); ++i ) + { + const TopoDS_Edge& e = TopoDS::Edge( aShapes( i )); + double tol = BRep_Tool::Tolerance( e ); + if ( tol < aTol ) nb[0]++; + else if ( tol > aTol ) nb[2]++; + else nb[1]++; + } + if ( nb[0] > 0 ) + stats.AddModif( "Tolerance of edge decreased for shape validity", nb[0] ); + if ( nb[1] > 0 ) + stats.AddModif( "Tolerance of edge limited as requested", nb[1] ); + if ( nb[2] > 0 ) + stats.AddModif( "Tolerance of edge increased for shape validity", nb[2] ); + + nb[0] = nb[1] = nb[2] = 0; + aShapes.Clear(); + TopExp::MapShapes( theOutShape, TopAbs_FACE, aShapes); + for ( int i = 1; i <= aShapes.Extent(); ++i ) + { + const TopoDS_Face& f = TopoDS::Face( aShapes( i )); + double tol = BRep_Tool::Tolerance( f ); + if ( tol < aTol ) nb[0]++; + else if ( tol > aTol ) nb[2]++; + else nb[1]++; + } + if ( nb[0] > 0 ) + stats.AddModif( "Tolerance of face decreased for shape validity", nb[0] ); + if ( nb[1] > 0 ) + stats.AddModif( "Tolerance of face limited as requested", nb[1] ); + if ( nb[2] > 0 ) + stats.AddModif( "Tolerance of face increased for shape validity", nb[2] ); + + SaveStatistics( tool ); + } } //======================================================================= @@ -667,25 +811,73 @@ void GEOMImpl_HealingDriver::FuseCollinearEdges (const TopoDS_Shape& theOriginal theWire = TopoDS::Wire(Fixer->Shape()); */ - TopoDS_Edge prevEdge; - TopTools_ListOfShape finalList, currChain; + // Get the ordered list of edges. + TopTools_ListOfShape anEdges; + TopTools_ListOfShape aCurVertices; + BRepTools_WireExplorer aWExp (theWire); - BRepTools_WireExplorer wexp (theWire); - if (wexp.More()) { - prevEdge = wexp.Current(); - currChain.Append(prevEdge); - wexp.Next(); + for (; aWExp.More(); aWExp.Next()) { + anEdges.Append(aWExp.Current()); + aCurVertices.Append(aWExp.CurrentVertex()); } - else { + + if (anEdges.IsEmpty()) { Standard_NullObject::Raise("Empty wire given"); } - for (; wexp.More(); wexp.Next()) { - TopoDS_Edge anEdge = wexp.Current(); - TopoDS_Vertex CurVertex = wexp.CurrentVertex(); + // Treat the case if the wire is closed and first and last edges are C1. + Standard_Boolean isShift = Standard_False; + + if (BRep_Tool::IsClosed(theWire)) { + // Wire is closed. Check if there are more than 2 edges in the wire. + if (!anEdges.First().IsSame(anEdges.Last())) { + isShift = Standard_True; + } + } + + if (isShift) { + // Put first edge to the end of the list while the chain break is reached. + TopoDS_Shape aFirstEdge = anEdges.First(); + + while (isShift) { + isShift = Standard_False; + + // Check if the first vertex should be kept + if (aMapToRemove.Contains(aCurVertices.First()) || removeAll) { + // Check if first and last edges are C1. + TopoDS_Edge anEdge1 = TopoDS::Edge(anEdges.Last()); + TopoDS_Edge anEdge2 = TopoDS::Edge(anEdges.First()); + + if (AreEdgesC1(anEdge1, anEdge2)) { + // Make the first edge last. + anEdges.Append(anEdge2); + anEdges.RemoveFirst(); + aCurVertices.Append(aCurVertices.First()); + aCurVertices.RemoveFirst(); + + // Check if we reached the first edge again. + // Break the loop in this case. + isShift = !aFirstEdge.IsSame(anEdges.First()); + } + } + } + } + + TopTools_ListOfShape finalList, currChain; + TopTools_ListIteratorOfListOfShape anEIter(anEdges); + TopTools_ListIteratorOfListOfShape aVIter(aCurVertices); + TopoDS_Edge prevEdge = TopoDS::Edge(anEIter.Value()); + + currChain.Append(prevEdge); + anEIter.Next(); + aVIter.Next(); + + for (; anEIter.More(); anEIter.Next(), aVIter.Next()) { + TopoDS_Edge anEdge = TopoDS::Edge(anEIter.Value()); + const TopoDS_Shape &aCurVertex = aVIter.Value(); bool continueChain = false; - if (aMapToRemove.Contains(CurVertex) || removeAll) { + if (aMapToRemove.Contains(aCurVertex) || removeAll) { // if C1 -> continue chain if (AreEdgesC1(prevEdge, anEdge)) { continueChain = true; @@ -754,8 +946,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"); } @@ -864,7 +1055,7 @@ GetCreationInformation(std::string& theOperationName, AddParam( theParams, "Operation", op ); for ( int iP = aParams->Lower(), nbP = aParams->Upper(); iP <= nbP; ++iP ) { - const TCollection_ExtendedString& par = aParams->Value(i); + const TCollection_ExtendedString& par = aParams->Value(iP); TCollection_AsciiString parAscii( par ); if ( par.Search( op ) == 1 && parAscii.Value( op.Length() + 1 ) == '.' ) { @@ -913,6 +1104,14 @@ GetCreationInformation(std::string& theOperationName, AddParam( theParams, "By parameter", aCI.GetIsByParameter() ); AddParam( theParams, "Value", aCI.GetDevideEdgeValue() ); break; + case DIVIDE_EDGE_BY_POINT: + theOperationName = "POINT_ON_EDGE"; + if ( aCI.GetIndex() > 0 ) + AddParam( theParams, "Edge", "#" ) << aCI.GetIndex() << " of " << aCI.GetOriginal(); + else + AddParam( theParams, "Edge", aCI.GetOriginal() ); + AddParam( theParams, "Points", aCI.GetShapes() ); + break; case CHANGE_ORIENTATION: theOperationName = "CHANGE_ORIENTATION"; AddParam( theParams, "Selected shape", aCI.GetOriginal() ); @@ -921,6 +1120,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"; @@ -929,7 +1129,7 @@ GetCreationInformation(std::string& theOperationName, break; case REMOVE_INTERNAL_FACES: theOperationName = "REMOVE_WEBS"; - AddParam( theParams, "Selected shape", aCI.GetOriginal() ); + AddParam( theParams, "Selected shapes", aCI.GetOriginalAndShapes() ); break; default: return false; @@ -937,6 +1137,31 @@ GetCreationInformation(std::string& theOperationName, return true; } -IMPLEMENT_STANDARD_HANDLE (GEOMImpl_HealingDriver,GEOM_BaseDriver); -IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_HealingDriver,GEOM_BaseDriver); +//================================================================================ +/*! + * \brief Pass a record of what is done to the operation + */ +//================================================================================ + +void GEOMImpl_HealingDriver::SaveStatistics( const ShHealOper_Tool& healer, bool add ) const +{ + if ( healer.GetStatistics().GetData().empty() ) + return; + + if (Label().IsNull()) return; + + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + if (aFunction.IsNull()) return; + + GEOMImpl_IHealing HI (aFunction); + ShHealOper_ModifStats * stats = HI.GetStatistics(); + if ( !stats ) return; + + if ( add ) + stats->Add( healer.GetStatistics() ); + else + *stats = healer.GetStatistics(); +} + +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_HealingDriver,GEOM_BaseDriver)