Salome HOME
ImportFromFile()
[modules/hydro.git] / src / HYDROData / HYDROData_TopoCurve.cxx
index 1d69ddb2e58e1322d0781564c7e3969e8b9faf4b..c08d6bf6d84d324194718d02d6a16912092935be 100644 (file)
@@ -1,8 +1,4 @@
-// Copyright (C) 2007-2015  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
-//
+// Copyright (C) 2014-2015  EDF-R&D
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
 #include <TopTools_ListOfShape.hxx>
 
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+#include <BRepTools.hxx>
+
 //! The type is intended to traverse the container
 //! either from the begin to the end or vice versa.
 template<typename ContainerType, typename IteratorType>
@@ -134,7 +134,7 @@ static TopoDS_Edge ReplaceVertex(
 }
 
 // Projects the point to the curve.
-static double ProjectPointToCurve(
+double ProjectPointToCurve(
   const gp_XYZ& thePoint,
   const Adaptor3d_Curve& theCurve,
   double& theParameter)
@@ -367,12 +367,13 @@ static bool Interpolate(
 
 bool HYDROData_TopoCurve::Initialize(const TopoDS_Wire& theWire)
 {
-  // Check for nonemptiness.
+  // Check for non-emptiness.
   myEdges.clear();
   TopTools_IndexedDataMapOfShapeListOfShape aVertexToEdges;
   TopExp::MapShapesAndAncestors(theWire,
     TopAbs_VERTEX, TopAbs_EDGE, aVertexToEdges);
   const int aVCount = aVertexToEdges.Extent();
+  DEBTRACE("initialize VCount= "<< aVCount);
   if (aVCount == 0)
   {
     return false;
@@ -458,13 +459,13 @@ bool HYDROData_TopoCurve::Initialize(const TopoDS_Wire& theWire)
 TopoDS_Wire HYDROData_TopoCurve::Wire() const
 {
   TopoDS_Wire aWire;
-  BRep_Builder aBulder;
-  aBulder.MakeWire(aWire);
+  BRep_Builder aBuilder;
+  aBuilder.MakeWire(aWire);
   std::list<TopoDS_Edge>::const_iterator aEItLast = myEdges.end();
   std::list<TopoDS_Edge>::const_iterator aEIt = myEdges.begin();
   for (; aEIt != aEItLast; ++aEIt)
   {
-    aBulder.Add(aWire, *aEIt);
+    aBuilder.Add(aWire, *aEIt);
   }
   return aWire;
 }
@@ -501,6 +502,7 @@ bool HYDROData_TopoCurve::Cut(
     aParamI ^= 1;
   }
   const bool isClosed = IsClosed();
+  DEBTRACE("aParamI: " << aParamI << " isClosed: "<< isClosed);
   if (aParamI < 0)
   {
     aEdge.Orientation(TopAbs_FORWARD);
@@ -658,6 +660,10 @@ int HYDROData_TopoCurve::Intersect(
   const TopoDS_Wire& theWire,
   std::deque<std::list<double> >& theParameters) const
 {
+  //std::string brepName = "theWireToIntersect";
+  //brepName += ".brep";
+  //BRepTools::Write( theWire, brepName.c_str() );
+
   int aIntCount = 0;
   theParameters.resize(myEdges.size());
   std::list<TopoDS_Edge>::const_iterator aEIt = myEdges.begin();
@@ -673,6 +679,7 @@ int HYDROData_TopoCurve::Intersect(
       aIntCount += IntersectEdge(aEdge,TopoDS::Edge(aEIt2.Current()), aParams);
     }
   }
+  DEBTRACE("aIntCount " << aIntCount);
   return aIntCount;
 }