]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
comments and debug traces on split polylines
authorPaul RASCLE <paul.rascle@openfields.fr>
Fri, 27 Nov 2020 17:19:39 +0000 (18:19 +0100)
committerYOANN AUDOUIN <B61570@dsp0919998.atlas.edf.fr>
Fri, 11 Dec 2020 14:53:30 +0000 (15:53 +0100)
src/HYDROData/HYDROData_PolylineOperator.cxx
src/HYDROData/HYDROData_TopoCurve.cxx

index c506dcf890df83ba532a7f6675ab084d09a63ec4..01537030037778b25b120f97755d41ffb34c6119 100644 (file)
@@ -53,7 +53,7 @@
 #include <TopTools_IndexedMapOfShape.hxx>
 #include <BRepLib_MakeWire.hxx>
 
-//#define _DEVDEBUG_
+#define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 #include <BRepTools.hxx>
 #include <sstream>
@@ -247,8 +247,6 @@ bool HYDROData_PolylineOperator::split( const Handle( HYDROData_Document )& theD
   std::vector<QColor> aSectColors;
   int nbSec = thePolyline->NbSections();
 
-
-
   const int aPSCount = aCurves.size();
   const int aTSCount = aToolCurves.size();
   std::vector<TopoDS_Shape> aResult;
@@ -269,8 +267,9 @@ bool HYDROData_PolylineOperator::split( const Handle( HYDROData_Document )& theD
   {
     HYDROData_TopoCurve aCurve;
     DEBTRACE("Initialize curve " << aPSI);
-    if (!aCurve.Initialize(aCurves[aPSI]))
+    if (!aCurve.Initialize(aCurves[aPSI]))    // empty, non manifold (or internal bug!)
     {
+      DEBTRACE("discarded curve (empty or non manifold)!");
       continue;
     }
 
index 2323240709a5ca436f4d7c3a041ed3de93549f0c..54888d1c532d6d60b2f30e7a69e0a17933b14f72 100644 (file)
@@ -39,7 +39,7 @@
 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
 #include <TopTools_ListOfShape.hxx>
 
-//#define _DEVDEBUG_
+#define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 #include <BRepTools.hxx>
 
@@ -375,7 +375,7 @@ bool HYDROData_TopoCurve::Initialize(const TopoDS_Wire& theWire)
   TopTools_IndexedDataMapOfShapeListOfShape aVertexToEdges;
   TopExp::MapShapesAndAncestors(theWire,
     TopAbs_VERTEX, TopAbs_EDGE, aVertexToEdges);
-  const int aVCount = aVertexToEdges.Extent();
+  const int aVCount = aVertexToEdges.Extent();   // number of edges (an edge can be a spline with intermediate vertices)
   DEBTRACE("initialize VCount= "<< aVCount);
   if (aVCount == 0)
   {
@@ -404,8 +404,11 @@ bool HYDROData_TopoCurve::Initialize(const TopoDS_Wire& theWire)
       return false;
     }
   }
+  std::string brepName = "theWireToSplit";
+  brepName += ".brep";
+  BRepTools::Write( theWire, brepName.c_str() );
 
-  // Find the start.
+  // Find the start, i.e. the end which is the first vertex (or just the first vertex when closed) ==> aVN
   int aVN = 1;
   if (!isClosed)
   {
@@ -428,19 +431,19 @@ bool HYDROData_TopoCurve::Initialize(const TopoDS_Wire& theWire)
     }
   }
 
-  // Calculate the edge order.
-  TopTools_ListOfShape* aEdges = &aVertexToEdges.ChangeFromIndex(aVN);
+  // Calculate the edge order ==> list in myEdges
+  TopTools_ListOfShape* aEdges = &aVertexToEdges.ChangeFromIndex(aVN); // 1 or 2 edges from first vertex
   while (!aEdges->IsEmpty())
   {
     const TopoDS_Edge aEdge = TopoDS::Edge(aEdges->First());
     aEdges->RemoveFirst();
-    myEdges.push_back(aEdge);
+    myEdges.push_back(aEdge);                                          // add an edge in the list
     int aVN2 = aVertexToEdges.FindIndex(TopExp::FirstVertex(aEdge));
     if (aVN2 == aVN)
     {
       aVN2 = aVertexToEdges.FindIndex(TopExp::LastVertex(aEdge));
     }
-    aVN = aVN2;
+    aVN = aVN2;                                                        // next vertex
 
     aEdges = &aVertexToEdges.ChangeFromIndex(aVN2);
     const TopoDS_Edge aEdge2 = TopoDS::Edge(aEdges->First());
@@ -451,12 +454,12 @@ bool HYDROData_TopoCurve::Initialize(const TopoDS_Wire& theWire)
     else
     {
       aEdges->Clear();
-      aEdges->Append(aEdge2);
+      aEdges->Append(aEdge2);                                          // next edge
     }
   }
 
   // Check for connectedness and free vertex.
-  return aVCount - myEdges.size() == (isClosed ? 0 : 1);
+  return (aVCount - myEdges.size()) == (isClosed ? 0 : 1);
 }
 
 TopoDS_Wire HYDROData_TopoCurve::Wire() const
@@ -663,7 +666,7 @@ int HYDROData_TopoCurve::Intersect(
   const TopoDS_Wire& theWire,
   std::deque<std::list<double> >& theParameters) const
 {
-  std::string brepName = "theWireToIntersect";
+  std::string brepName = "theWireTool";
   brepName += ".brep";
   BRepTools::Write( theWire, brepName.c_str() );