0031047: Modeling Algorithms - BRepExtrema_DistShapeShape gives wrong result
[occt.git] / src / BRepClass / BRepClass_Edge.cxx
index c4cbc44..0774105 100644 (file)
 
 
 #include <BRepClass_Edge.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Face.hxx>
+#include <NCollection_IndexedDataMap.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopExp.hxx>
 
 //=======================================================================
 //function : BRepClass_Edge
@@ -27,6 +29,37 @@ BRepClass_Edge::BRepClass_Edge()
 {
 }
 
+//=======================================================================
+//function : SetNextEdge
+//purpose  :
+//=======================================================================
+void BRepClass_Edge::SetNextEdge(const TopTools_IndexedDataMapOfShapeListOfShape& theMapVE)
+{
+  if (theMapVE.IsEmpty() || myEdge.IsNull())
+  {
+    return;
+  }
+  TopoDS_Vertex aVF, aVL;
+  TopExp::Vertices(myEdge, aVF, aVL, Standard_True);
+
+  if (aVL.IsNull() || aVL.IsSame(aVF))
+  {
+    return;
+  }
+  const TopTools_ListOfShape* aListE = theMapVE.Seek(aVL);
+  if ((*aListE).Extent() == 2)
+  {
+    for (TopTools_ListIteratorOfListOfShape anIt(*aListE); anIt.More(); anIt.Next())
+    {
+      if ((!anIt.Value().IsNull()) && (!anIt.Value().IsSame(myEdge)))
+      {
+        myNextEdge = TopoDS::Edge(anIt.Value());
+      }
+    }
+  }
+}
+
+
 //=======================================================================
 //function : BRepClass_Edge
 //purpose  :