#include <TopTools_IndexedMapOfShape.hxx>
#include <BRepLib_MakeWire.hxx>
-//#define _DEVDEBUG_
+#define _DEVDEBUG_
#include "HYDRO_trace.hxx"
#include <BRepTools.hxx>
#include <sstream>
std::vector<QColor> aSectColors;
int nbSec = thePolyline->NbSections();
-
-
const int aPSCount = aCurves.size();
const int aTSCount = aToolCurves.size();
std::vector<TopoDS_Shape> aResult;
{
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;
}
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
-//#define _DEVDEBUG_
+#define _DEVDEBUG_
#include "HYDRO_trace.hxx"
#include <BRepTools.hxx>
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)
{
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)
{
}
}
- // 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());
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
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() );