-// File: ShHealOper_Sewing.cxx
-// Created: 29.04.04 15:07:10
-// Author: Galina KULIKOVA
-// < MODULE = KERNEL> <PACKAGE = ShHealOper> : <Shape Healing Operations>
-// Copyright (C) 2003 CEA
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// 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.
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-
-// 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, or (at your option) any later version.
//
-// 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.
+//
+// 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: ShHealOper_Sewing.cxx
+// Created: 29.04.04 15:07:10
+// Author: Galina KULIKOVA
+//
#include <ShHealOper_Sewing.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_MapOfShape.hxx>
+
+namespace
+{
+ bool cmpNbSubShapes( const TopoDS_Shape& s1, const TopoDS_Shape& s2, TopAbs_ShapeEnum t)
+ {
+ int nbNew = 0, nbOld = 0;
+ TopExp_Explorer exp;
+ TopTools_MapOfShape shMap;
+ for ( exp.Init( s1, t ); exp.More(); exp.Next() ) if ( shMap.Add( exp.Current() ) ) ++nbNew;
+ shMap.Clear();
+ for ( exp.Init( s2, t ); exp.More(); exp.Next() ) if ( shMap.Add( exp.Current() ) ) ++nbOld;
+ return nbNew != nbOld;
+ }
+}
+
//=======================================================================
//function : ShHealOper_Sewing()
//purpose : Constructor
//=======================================================================
-
ShHealOper_Sewing::ShHealOper_Sewing (const TopoDS_Shape& theShape,
const Standard_Real theTolerance)
{
return myDone;
}
//sewing shape
- Handle(BRepAlgo_Sewing) aSewing = new BRepAlgo_Sewing;
+ Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing;
aSewing->Load(myInitShape);
aSewing->SetTolerance(myTolerance);
aSewing->SetFaceMode(myFacesMode);
//analysis either sewing was made by changing number of shells
myDone = isSewed(aSewShape);
- //keep modification of the subshapes in the Context.
+ //keep modification of the sub-shapes in the Context.
TopExp_Explorer aExp(myInitShape,TopAbs_FACE);
for( ; aExp.More(); aExp.Next())
myDone = (getModifications( aExp.Current(),aSewing) || myDone);
//=======================================================================
Standard_Boolean ShHealOper_Sewing::getModifications(const TopoDS_Shape& theShape,
- const Handle(BRepAlgo_Sewing)& theSewing) const
+ const Handle(BRepBuilderAPI_Sewing)& theSewing) const
{
if((Standard_Integer)theShape.ShapeType() > (Standard_Integer)myHistoryLevel)
return Standard_False;
Standard_Boolean ShHealOper_Sewing::isSewed(const TopoDS_Shape& theShape) const
{
- Standard_Integer nbNewShells =0;
- Standard_Integer nbOldShells =0;
- TopExp_Explorer aExpShells(theShape,TopAbs_SHELL);
- for( ; aExpShells.More(); aExpShells.Next())
- nbNewShells++;
- for( aExpShells.Init(myInitShape,TopAbs_SHELL); aExpShells.More(); aExpShells.Next())
- nbOldShells++;
- return (nbNewShells != nbOldShells);
+ return cmpNbSubShapes( theShape, myInitShape, TopAbs_SHELL ) ||
+ cmpNbSubShapes( theShape, myInitShape, TopAbs_EDGE ) ||
+ cmpNbSubShapes( theShape, myInitShape, TopAbs_VERTEX );
}
+
//=======================================================================
//function : deleteFreeEdges
//purpose :