]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Fix pb with 'make test' (complex_objs_ex06.py script): a regression has been introduc...
authorvsr <vsr@opencascade.com>
Thu, 5 Feb 2015 10:57:09 +0000 (13:57 +0300)
committervsr <vsr@opencascade.com>
Thu, 5 Feb 2015 10:57:09 +0000 (13:57 +0300)
src/GEOMImpl/GEOMImpl_HealingDriver.cxx
src/ShHealOper/ShHealOper_Sewing.cxx

index edce49658cdb93a9dcece06a8ca2831fc0fcda1f..bc60c781a56bdc7b883122a9361b73a847ad3771 100644 (file)
@@ -450,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);
index 156808c1522be363be36dd5af667de4a39410ba5..0c2aad55f99167cbc9acd66461e66782fc059a44 100644 (file)
 #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)
 {
@@ -248,29 +262,9 @@ Standard_Boolean ShHealOper_Sewing::getModifications(const TopoDS_Shape& theShap
 
 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);
-
-  // EAP, 22745: [EDF] Improvement of Sewing operation
-  // now myInitShape is ALWAYS a compound of faces -> no shells
-  int nbNew = 0, nbOld = 0;
-  TopExp_Explorer exp;
-  for ( exp.Init( theShape,    TopAbs_VERTEX ); exp.More(); exp.Next() ) ++nbNew;
-  for ( exp.Init( myInitShape, TopAbs_VERTEX ); exp.More(); exp.Next() ) ++nbOld;
-  if ( nbNew != nbOld )
-    return true;
-  for ( exp.Init( theShape,    TopAbs_EDGE ); exp.More(); exp.Next() ) ++nbNew;
-  for ( exp.Init( myInitShape, TopAbs_EDGE ); exp.More(); exp.Next() ) ++nbOld;
-  if ( nbNew != nbOld )
-    return true;
-
-  return false;
+  return cmpNbSubShapes( theShape, myInitShape, TopAbs_SHELL ) ||
+         cmpNbSubShapes( theShape, myInitShape, TopAbs_EDGE )  ||
+         cmpNbSubShapes( theShape, myInitShape, TopAbs_VERTEX );
 }
 
 //=======================================================================