]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/BlockFix/BlockFix_UnionFaces.cxx
Salome HOME
0023451: EDF - Remove Extra edges
[modules/geom.git] / src / BlockFix / BlockFix_UnionFaces.cxx
index 838b8a8ee946efd99707e6e76139c8769c667a43..02765bfb42dab81abeb5a745b8f7088ede52f8ea 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 #include <ShapeFix_Wire.hxx>
 #include <ShapeFix_Edge.hxx>
 
-#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
 #include <IntPatch_ImpImpIntersection.hxx>
-#else
-#include <IntPatch_TheIIIntOfIntersection.hxx>
-#endif
 
 #include <BRep_Tool.hxx>
 #include <BRep_Builder.hxx>
@@ -142,8 +138,9 @@ static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges,
 {
   //map of edges
   TopTools_MapOfShape aNewEdges;
+  TopExp_Explorer exp(aShape,TopAbs_EDGE);
   //add edges without seams
-  for(TopExp_Explorer exp(aShape,TopAbs_EDGE); exp.More(); exp.Next()) {
+  for(; exp.More(); exp.Next()) {
     TopoDS_Shape edge = exp.Current();
     if(aNewEdges.Contains(edge))
       aNewEdges.Remove(edge);
@@ -168,9 +165,14 @@ static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges,
     }
   }
 
-  //add edges to the sequemce
-  for(TopTools_MapIteratorOfMapOfShape anIter(aNewEdges); anIter.More(); anIter.Next())
-    edges.Append(anIter.Key());
+  //add edges to the sequence
+  for(exp.ReInit(); exp.More(); exp.Next()) {
+    const TopoDS_Shape &anEdge = exp.Current();
+
+    if (aNewEdges.Contains(anEdge)) {
+      edges.Append(anEdge);
+    }
+  }
 
   return isDropped;
 }
@@ -244,6 +246,9 @@ static Standard_Boolean IsEdgeValidToMerge(const TopoDS_Edge &theEdge,
   Standard_Boolean isValid = Standard_True;
 
   if (BRep_Tool::IsClosed(theEdge, theFace)) {
+    // Mantis issue 0023451, now code corresponds to the comment to this method
+    isValid = Standard_False;
+
     // This is a seam edge. Check if there are another seam edges on the face.
     TopExp_Explorer anExp(theFace, TopAbs_EDGE);
 
@@ -259,7 +264,9 @@ static Standard_Boolean IsEdgeValidToMerge(const TopoDS_Edge &theEdge,
       TopoDS_Edge anEdge = TopoDS::Edge(aShEdge);
 
       if (BRep_Tool::IsClosed(anEdge, theFace)) {
-        isValid = Standard_False;
+        // Mantis issue 0023451, now code corresponds to the comment to this method
+        //isValid = Standard_False;
+        isValid = Standard_True;
         break;
       }
     }
@@ -703,15 +710,10 @@ Standard_Boolean BlockFix_UnionFaces::IsSameDomain(const TopoDS_Face& aFace,
     Handle(BRepTopAdaptor_TopolTool) aTT2 = new BRepTopAdaptor_TopolTool();
 
     try {
-#if OCC_VERSION_LARGE > 0x06010000
       OCC_CATCH_SIGNALS;
-#endif
 
-#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
       IntPatch_ImpImpIntersection anIIInt (aGA1, aTT1, aGA2, aTT2, aPrec, aPrec);
-#else
-      IntPatch_TheIIIntOfIntersection anIIInt (aGA1, aTT1, aGA2, aTT2, aPrec, aPrec);
-#endif
+
       if (!anIIInt.IsDone() || anIIInt.IsEmpty())
         return false;