]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
debug multiple streams in a region
authorPaul RASCLE <paul.rascle@edf.fr>
Wed, 28 Jun 2017 20:52:14 +0000 (22:52 +0200)
committerPaul RASCLE <paul.rascle@edf.fr>
Wed, 28 Jun 2017 21:57:31 +0000 (23:57 +0200)
doc/salome/examples/h011_normalCaseManualInterpolZ.py
src/HYDROData/HYDROData_Bathymetry.cxx
src/HYDROData/HYDROData_Bathymetry.h
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_ChannelAltitude.cxx
src/HYDROData/HYDROData_PolylineOperator.cxx
src/HYDROData/HYDROData_PolylineXY.cxx
src/HYDROData/HYDROData_QuadtreeNode.cxx
src/HYDROData/HYDROData_SplitToZonesTool.cxx
src/HYDROData/HYDROData_TopoCurve.cxx

index 6c80a6630aac6d34863db2a70b21855115c33046..a91bff698e70dc8286c5820ab3fcadab9d6428c8 100644 (file)
@@ -233,7 +233,7 @@ litMajeur.SetZLevel( 5 )
 
 litMajeur.SetFillingColor( QColor( 0, 170, 127, 255 ) )
 
-litMajeur.SetAltitudeObject( Cloud_02 )
+litMajeur.SetAltitudeObject( garonne_point_L93 )
 litMajeur.SetPolyline( lit_majeur )
 
 litMajeur.Update()
index 2e6ac1cc2638a741eeb9f8880fe14b1c1be83cb7..cd6c718f1f1cbffc9e0050b414a136d952b10081 100644 (file)
@@ -55,7 +55,7 @@
 #include <OSD_Timer.hxx>
 #endif
 
-#define _DEVDEBUG_
+//#define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 
 const int BLOCK_SIZE = 1000;
@@ -63,10 +63,11 @@ const int BLOCK_SIZE = 1000;
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Bathymetry, HYDROData_IAltitudeObject)
 
 //HYDROData_QuadtreeNode* HYDROData_Bathymetry::myQuadtree = 0;
-
+int HYDROData_Bathymetry::myQuadTreeNumber = 0;
 std::map<int, HYDROData_QuadtreeNode*> HYDROData_Bathymetry::myQuadtrees;
 
 #ifndef LIGHT_MODE
+int HYDROData_Bathymetry::myDelaunayNumber = 0;
 std::map<int, vtkPolyData*> HYDROData_Bathymetry::myDelaunay2D;
 #endif
 
@@ -177,18 +178,9 @@ HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints(boo
 
 HYDROData_QuadtreeNode* HYDROData_Bathymetry::GetQuadtreeNodes() const
 {
-  TDF_Label aLabel = myLab.FindChild(DataTag_AltitudePoints, false);
-  if (aLabel.IsNull())
-    return 0;
-  int labkey = myLab.Tag();
-  //int altkey = aLabel.Tag();
-  //DEBTRACE("GetQuadtreeNodes this labkey altkey "<<this<<" "<<labkey<<" "<<altkey);
-  // if (myQuadtree->isEmpty() )
-  if (myQuadtrees.find(labkey) == myQuadtrees.end())
+  TDF_Label aLabel2 = myLab.FindChild(DataTag_Quadtree, false);
+  if (aLabel2.IsNull())
     {
-      //DEBTRACE("GetQuadtreeNodes init " << this << " " << labkey);
-      HYDROData_QuadtreeNode* aQuadtree = new HYDROData_QuadtreeNode(0, 30, 5, 0.);
-      myQuadtrees[labkey] = aQuadtree;
       TDF_Label aLabel = myLab.FindChild(DataTag_AltitudePoints, false);
       if (aLabel.IsNull())
         return 0;
@@ -197,6 +189,12 @@ HYDROData_QuadtreeNode* HYDROData_Bathymetry::GetQuadtreeNodes() const
       if (!aLabel.FindAttribute(TDataStd_RealArray::GetID(), aCoordsArray))
         return 0;
 
+      myQuadTreeNumber++;
+      TDataStd_Integer::Set( myLab.FindChild( DataTag_Quadtree ), myQuadTreeNumber );
+      DEBTRACE("GetQuadtreeNodes init " << this << " " << myQuadTreeNumber);
+      HYDROData_QuadtreeNode* aQuadtree = new HYDROData_QuadtreeNode(0, 30, 5, 0.);
+      myQuadtrees[myQuadTreeNumber] = aQuadtree;
+
       Nodes_3D* aListOfNodes = new Nodes_3D();
 
       int index =0;
@@ -212,34 +210,41 @@ HYDROData_QuadtreeNode* HYDROData_Bathymetry::GetQuadtreeNodes() const
           index++;
           aListOfNodes->push_back(aPoint);
         }
-      //DEBTRACE("  GetQuadtreeNodes call setNodesAndCompute");
+      DEBTRACE("  GetQuadtreeNodes call setNodesAndCompute");
       aQuadtree->setNodesAndCompute(aListOfNodes);
       return aQuadtree;
     }
   else
-    return myQuadtrees[labkey];
+    {
+      Handle(TDataStd_Integer) aQuadtreeNum;
+      if ( aLabel2.FindAttribute( TDataStd_Integer::GetID(), aQuadtreeNum ) )
+        {
+          if (myQuadtrees.find(aQuadtreeNum->Get()) != myQuadtrees.end())
+            return myQuadtrees[aQuadtreeNum->Get()];
+          else DEBTRACE("myQuadtrees["<<aQuadtreeNum->Get()<<"] does not exists!");
+        }
+      else DEBTRACE("no attribute TDataStd_Integer");
+    }
+  return 0;
 }
 
 #ifndef LIGHT_MODE
 vtkPolyData* HYDROData_Bathymetry::GetVtkDelaunay2D() const
 {
-  TDF_Label aLabel = myLab.FindChild(DataTag_AltitudePoints, false);
-  if (aLabel.IsNull())
-    return 0;
-  int labkey = myLab.Tag();
-  //int altkey = aLabel.Tag();
-  //DEBTRACE("GetVtkDelaunay2D this labkey altkey "<<this<<" "<<labkey<<" "<<altkey);
-  if (myDelaunay2D.find(labkey) == myDelaunay2D.end())
+  TDF_Label aLabel2 = myLab.FindChild(DataTag_Delaunay, false);
+  if (aLabel2.IsNull())
     {
-      //DEBTRACE("GetVtkDelaunay2D init " << this << " " << labkey);
-
       TDF_Label aLabel = myLab.FindChild(DataTag_AltitudePoints, false);
       if (aLabel.IsNull())
         return 0;
+
       Handle(TDataStd_RealArray) aCoordsArray;
       if (!aLabel.FindAttribute(TDataStd_RealArray::GetID(), aCoordsArray))
         return 0;
 
+      myDelaunayNumber++;
+      TDataStd_Integer::Set( myLab.FindChild( DataTag_Delaunay ), myDelaunayNumber );
+      DEBTRACE("GetVtkDelaunay2D init " << this << " " << myDelaunayNumber);
       vtkPoints *points = vtkPoints::New();
       points->Allocate(aCoordsArray->Upper() +1);
       for (int i = aCoordsArray->Lower(), n = aCoordsArray->Upper(); i <= n;)
@@ -254,19 +259,28 @@ vtkPolyData* HYDROData_Bathymetry::GetVtkDelaunay2D() const
         }
       vtkPolyData* profile = vtkPolyData::New();
       profile->SetPoints(points);
-      //DEBTRACE("Number of Points: "<< points->GetNumberOfPoints());
+      DEBTRACE("Number of Points: "<< points->GetNumberOfPoints());
 
       vtkDelaunay2D* delaunay2D = vtkDelaunay2D::New();
       delaunay2D->SetInputData(profile);
       delaunay2D->Update();
       vtkPolyData* data = delaunay2D->GetOutput();
       data->BuildLinks();
-      myDelaunay2D[labkey] = data;
+      myDelaunay2D[myDelaunayNumber] = data;
       return data;
     }
   else
-    return myDelaunay2D[labkey];
-
+    {
+      Handle(TDataStd_Integer) aDelaunayNum;
+      if ( aLabel2.FindAttribute( TDataStd_Integer::GetID(), aDelaunayNum ) )
+        {
+          if (myDelaunay2D.find(aDelaunayNum->Get()) != myDelaunay2D.end())
+            return myDelaunay2D[aDelaunayNum->Get()];
+          else DEBTRACE("myDelaunay2D["<<aDelaunayNum->Get()<<"] does not exists!");
+        }
+      else DEBTRACE("no attribute TDataStd_Integer");
+    }
+  return 0;
 }
 #endif
 void HYDROData_Bathymetry::RemoveAltitudePoints()
@@ -384,7 +398,7 @@ bool interpolZtriangle(const gp_XY& point, vtkPolyData* delaunay2D, vtkIdList* t
 
 double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theMethod) const
 {
-  //DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << "), interpolation method: " << theMethod);
+  DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << "), interpolation method: " << theMethod);
   double anInvalidAltitude = GetInvalidAltitude();
   double aResAltitude = anInvalidAltitude;
 
@@ -393,7 +407,7 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM
   HYDROData_QuadtreeNode* aQuadtree = GetQuadtreeNodes();
   if (!aQuadtree)
     {
-      //DEBTRACE("  no Quadtree");
+      DEBTRACE("  no Quadtree");
       return aResAltitude;
     }
 
@@ -402,13 +416,13 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM
   while (dist2nodes.size() == 0)
     {
       aQuadtree->setPrecision(aQuadtree->getPrecision() *2);
-      //DEBTRACE("adjust precision to: " << aQuadtree->getPrecision());
+      DEBTRACE("adjust precision to: " << aQuadtree->getPrecision());
       aQuadtree->NodesAround(thePoint, dist2nodes, aQuadtree->getPrecision());
     }
   std::map<double, const gpi_XYZ*>::const_iterator it = dist2nodes.begin();
   aResAltitude = it->second->Z();
   int nodeIndex = it->second->getIndex();
-  //DEBTRACE("  number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude << " point index: " << nodeIndex);
+  DEBTRACE("  number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude << " point index: " << nodeIndex);
 
   // --- for coarse bathymetry clouds (when the TELEMAC mesh is more refined than the bathymetry cloud)
   //     interpolation is required.
@@ -430,7 +444,7 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM
       points->Allocate(64);
       aDelaunay2D->GetPointCells(nodeIndex, cells);
       vtkIdType nbCells = cells->GetNumberOfIds();
-      //DEBTRACE("  triangles on nearest point: " << nbCells);
+      DEBTRACE("  triangles on nearest point: " << nbCells);
       bool isInside = false;
       for (int i=0; i<nbCells; i++)
         {
@@ -440,13 +454,13 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM
           if (isInside)
             {
               aResAltitude = z;
-              //DEBTRACE("  interpolated z: " << z);
+              DEBTRACE("  interpolated z: " << z);
               break;
             }
         }
       if (!isInside)
       {
-      //    DEBTRACE("  point outside triangles, nearest z kept");
+          DEBTRACE("  point outside triangles, nearest z kept");
       }
     }
   #endif
index 6056847393667550a834b4af895d853ff0501cd1..5a7620e871a276472699da54815cb0d596100281 100644 (file)
@@ -62,6 +62,8 @@ protected:
     DataTag_FilePath,          ///< bathymetry imported file path
     DataTag_FilePaths,         ///< bathymetry imported file paths
     DataTag_AltitudesInverted, ///< flag to invert z values
+    DataTag_Quadtree,          ///< quadtree associated to the zone
+    DataTag_Delaunay,          ///< Delaunay 2D associated to the zone
   };
 
 public:
@@ -165,8 +167,10 @@ private:
    */
   bool                                      importFromXYZFile( QFile&          theFile,
                                                                AltitudePoints& thePoints ) const;
+  static int myQuadTreeNumber;
   static std::map<int, HYDROData_QuadtreeNode*> myQuadtrees;
 #ifndef LIGHT_MODE
+  static int myDelaunayNumber;
   static std::map<int, vtkPolyData*> myDelaunay2D;
 #endif
   bool                                      importFromASCFile( QFile&          theFile,
index 6db6d6462a27f3365c09bc1b81a1bd50e3605f39..63a816a341f9bda7ceb03c594587cef78294e38f 100644 (file)
@@ -82,7 +82,7 @@
 #include <SALOME_LifeCycleCORBA.hxx>
 #endif
 
-#define _DEVDEBUG_
+//#define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_CalculationCase, HYDROData_Entity)
@@ -746,19 +746,19 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY&
   Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint );
   if ( !aZone.IsNull() )
   {
-    //DEBTRACE("GetAltitudeForPoint Region " << theRegion->GetName().toStdString() << " Zone " << aZone->GetName().toStdString());
+    DEBTRACE("GetAltitudeForPoint Region " << theRegion->GetName().toStdString() << " Zone " << aZone->GetName().toStdString());
     Handle(HYDROData_Region) aRefRegion = Handle(HYDROData_Region)::DownCast( aZone->GetFatherObject() );
     if ( IsEqual( aRefRegion, theRegion ) )
       aResAltitude = GetAltitudeForPoint( thePoint, aZone, theMethod );
     else
       {
-        //DEBTRACE("GetAltitudeForPoint Region " << aRefRegion->GetName().toStdString() << " Zone " << aZone->GetName().toStdString() << " ---------------------------");
+        DEBTRACE("GetAltitudeForPoint Region " << aRefRegion->GetName().toStdString() << " Zone " << aZone->GetName().toStdString() << " ---------------------------");
         aResAltitude = GetAltitudeForPoint( thePoint, aZone, theMethod );
       }
   }
   else
     {
-      //DEBTRACE(" --- GetAltitudeForPoint No Zone ---");
+      DEBTRACE(" --- GetAltitudeForPoint No Zone ---");
     }
 
   return aResAltitude;
@@ -768,7 +768,7 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY&
                                                        const Handle(HYDROData_Zone)& theZone,
                                                        int theMethod) const
 {
-  //DEBTRACE("GetAltitudeForPoint Zone " << theZone->GetName().toStdString());
+  DEBTRACE("GetAltitudeForPoint Zone " << theZone->GetName().toStdString());
   double aResAltitude = HYDROData_IAltitudeObject::GetInvalidAltitude();
   if ( theZone.IsNull() )
   {
@@ -777,15 +777,15 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY&
   }
 
   HYDROData_Zone::MergeType aZoneMergeType = theZone->GetMergeType();
-  //DEBTRACE("aZoneMergeType " << aZoneMergeType);
+  DEBTRACE("aZoneMergeType " << aZoneMergeType);
   if ( !theZone->IsMergingNeed() )
   {
     aZoneMergeType = HYDROData_Zone::Merge_UNKNOWN;
-    //DEBTRACE("---");
+    DEBTRACE("---");
   }
   else if ( aZoneMergeType == HYDROData_Zone::Merge_UNKNOWN )
   {
-       //DEBTRACE("GetAltitudeForPoint Zone " << theZone->GetName().toStdString() << " Merge_UNKNOWN");
+       DEBTRACE("GetAltitudeForPoint Zone " << theZone->GetName().toStdString() << " Merge_UNKNOWN");
     return aResAltitude;
   }
 
@@ -804,14 +804,14 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY&
       }
       else
       {
-       //DEBTRACE("aZoneInterpolator == NULL");
+       DEBTRACE("aZoneInterpolator == NULL");
         aResAltitude = aMergeAltitude->GetAltitudeForPoint( thePoint );
       }
     }
   }
   else
   {
-       //DEBTRACE("aZoneMergeType != HYDROData_Zone::Merge_Object");
+       DEBTRACE("aZoneMergeType != HYDROData_Zone::Merge_Object");
     HYDROData_SequenceOfObjects aZoneObjects = theZone->GetObjects();
     HYDROData_SequenceOfObjects::Iterator anIter( aZoneObjects );
     for ( ; anIter.More(); anIter.Next() )
@@ -834,7 +834,7 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY&
       }
       else
       {
-       //DEBTRACE("aZoneInterpolator == NULL");
+       DEBTRACE("aZoneInterpolator == NULL");
         aPointAltitude = anObjAltitude->GetAltitudeForPoint( thePoint, theMethod );
       }
 
index ba2c7587b651231abc8b0c6742c4b1b1a56ebbcd..b848733c96076a02c67aeefc8b82a78905586d60 100644 (file)
@@ -27,7 +27,7 @@
 #include "HYDROData_ProfileUZ.h"
 #include "HYDROData_Profile.h"
 
-#define _DEVDEBUG_
+//#define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 #include <QString>
 
index 07387a6e9d0cf085fba22e6aca6e2ee26cee61fc..c89d189fbdb99c3de39fd93c618b26b20570e45f 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>
@@ -218,7 +218,7 @@ bool HYDROData_PolylineOperator::split( const Handle( HYDROData_Document )& theD
   for (int aPSI = 0; aPSI < aPSCount; ++aPSI)
   {
     HYDROData_TopoCurve aCurve;
-    //DEBTRACE("Initialize curve " << aPSI);
+    DEBTRACE("Initialize curve " << aPSI);
     if (!aCurve.Initialize(aCurves[aPSI]))
     {
       continue;
@@ -238,11 +238,11 @@ bool HYDROData_PolylineOperator::split( const Handle( HYDROData_Document )& theD
       aSplitCurves.end();
     for (int iw=0; aCIt != aLastCIt; ++aCIt, iw++)
     {
-      /*std::stringstream brepName;
+      std::stringstream brepName;
       brepName << "theSplitWire_";
       brepName << iw;
       brepName << ".brep";
-      BRepTools::Write(aCIt->Wire() , brepName.str().c_str() );*/
+      BRepTools::Write(aCIt->Wire() , brepName.str().c_str() );
       aResult.push_back(aCIt->Wire());
     }
   }
@@ -310,7 +310,7 @@ bool HYDROData_PolylineOperator::CreatePolylines( const Handle( HYDROData_Docume
   const QColor& theColor = theOldPolyline->GetWireColor();
 
   int n = theShapes.size();
-  //DEBTRACE("theShapes.size() "<< n);
+  DEBTRACE("theShapes.size() "<< n);
   int anIndex = 1;
   for( int i=0; i<n; i++ )
   {
index 8c7db492153042803f8bfd6114e1d84bceb0ba83..33e4090ad12b241dabb98d18f7ad2505ed4ffcc2 100644 (file)
@@ -82,7 +82,7 @@
 #include <QPainterPath>
 #include <QVariant>
 
-#define _DEVDEBUG_
+//#define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 #include <BRepTools.hxx>
 #include <sstream>
@@ -345,14 +345,14 @@ bool convertEdgesToSections( const TopoDS_Edge&
                              double                                                   theDeflection,
                              const Handle( HYDROData_PolylineXY )&                    theOldPolyline )
 {
-  //DEBTRACE("convertEdgesToSections")
+  DEBTRACE("convertEdgesToSections")
   Standard_Real aFirst = 0.0, aLast = 0.0;
   Handle(Geom_Curve) anEdgeGeomCurve = BRep_Tool::Curve( theEdge, aFirst, aLast );
   if ( anEdgeGeomCurve.IsNull() )
     return false;
 
   bool isPrevious = (theSectTypes.Size() > 0);
-  //DEBTRACE("nb sections: " << theSectTypes.Size());
+  DEBTRACE("nb sections: " << theSectTypes.Size());
   HYDROData_PolylineXY::SectionType prevSectType = HYDROData_PolylineXY::SECTION_SPLINE;;
   HYDROData_PolylineXY::PointsList prevPointList;
   bool isPrevClosed = true;
@@ -381,7 +381,7 @@ bool convertEdgesToSections( const TopoDS_Edge&
     }
 
   bool isNewSection = !isPrevious || isPrevClosed || anIsEdgeClosed || prevSectType != aSectionType;
-  //DEBTRACE(isNewSection <<": " << !isPrevious << " " << isPrevClosed << " " << anIsEdgeClosed << " " << (prevSectType != aSectionType));
+  DEBTRACE(isNewSection <<": " << !isPrevious << " " << isPrevClosed << " " << anIsEdgeClosed << " " << (prevSectType != aSectionType));
 
   HYDROData_PolylineXY::PointsList aPointsList;
   if (!isNewSection)
@@ -391,7 +391,7 @@ bool convertEdgesToSections( const TopoDS_Edge&
 
   if( aSectionType == HYDROData_PolylineXY::SECTION_POLYLINE )
     {
-      //DEBTRACE("SECTION_POLYLINE");
+      DEBTRACE("SECTION_POLYLINE");
       Handle(Geom_Line) aGeomLine = Handle(Geom_Line)::DownCast( anEdgeGeomCurve );
 
       gp_Pnt aFirstPoint, aLastPoint;
@@ -403,27 +403,27 @@ bool convertEdgesToSections( const TopoDS_Edge&
         {
           if (aSectFirstPoint == prevPointList.Last())
             {
-              //DEBTRACE("points shared: a");//aPointsList.Append( aSectFirstPoint );
+              DEBTRACE("points shared: a");//aPointsList.Append( aSectFirstPoint );
               aPointsList.Append( aSectLastPoint );
             }
           else if (aSectLastPoint == prevPointList.Last())
             {
-              //DEBTRACE("points shared: b");//aPointsList.Append( aSectLastPoint );
+              DEBTRACE("points shared: b");//aPointsList.Append( aSectLastPoint );
               aPointsList.Append( aSectFirstPoint );
             }
           else if (aSectFirstPoint == prevPointList.First())
             {
-              //DEBTRACE("points shared: c");//aPointsList.Prepend( aSectFirstPoint );
+              DEBTRACE("points shared: c");//aPointsList.Prepend( aSectFirstPoint );
               aPointsList.Prepend( aSectLastPoint );
             }
           else if (aSectLastPoint == prevPointList.First())
             {
-              //DEBTRACE("points shared: d");//aPointsList.Prepend( aSectLastPoint );
+              DEBTRACE("points shared: d");//aPointsList.Prepend( aSectLastPoint );
               aPointsList.Prepend( aSectFirstPoint );
             }
           else
             {
-              //DEBTRACE("no point shared")
+              DEBTRACE("no point shared")
               isNewSection = true; // no point shared, new section
               aPointsList.Clear();
               aPointsList.Append( aSectFirstPoint );
@@ -432,14 +432,14 @@ bool convertEdgesToSections( const TopoDS_Edge&
         }
      else
        {
-         //DEBTRACE("new section");
+         DEBTRACE("new section");
          aPointsList.Append( aSectFirstPoint );
          aPointsList.Append( aSectLastPoint );
        }
     }
   else // aSectionType == HYDROData_PolylineXY::SECTION_SPLINE
     {
-      //DEBTRACE("SECTION_SPLINE");
+      DEBTRACE("SECTION_SPLINE");
       isNewSection = true;
       aPointsList.Clear();
 
@@ -464,8 +464,8 @@ bool convertEdgesToSections( const TopoDS_Edge&
 
           gp_Pnt endPts[] = {gp_Pnt(aPointsList.First().X(),aPointsList.First().Y(), 0),
                              gp_Pnt(aPointsList.Last().X(),aPointsList.Last().Y(), 0) };
-          //DEBTRACE("curve start: "<< endPts[0].X() << " " << endPts[0].Y());
-          //DEBTRACE("curve end: "<< endPts[1].X() << " " << endPts[1].Y());
+          DEBTRACE("curve start: "<< endPts[0].X() << " " << endPts[0].Y());
+          DEBTRACE("curve end: "<< endPts[1].X() << " " << endPts[1].Y());
         }
       else // --- split of a previous polyline: try to retrieve old sets of points and add intersection points
         {
@@ -474,18 +474,18 @@ bool convertEdgesToSections( const TopoDS_Edge&
           double midPar = (anAdaptorCurve.LastParameter() + anAdaptorCurve.FirstParameter())/2;
           gp_Pnt midPnt;
           anAdaptorCurve.D0(midPar, midPnt);
-          //DEBTRACE("curve first point: " << aEndPs[0].X() << " " << aEndPs[0].Y() << " " << aEndPs[0].Z());
-          //DEBTRACE("curve last point: " << aEndPs[1].X() << " " << aEndPs[1].Y() << " " << aEndPs[1].Z());
-          //DEBTRACE("curve mid point: " << midPnt.X() << " " << midPnt.Y() << " " << midPnt.Z());
+          DEBTRACE("curve first point: " << aEndPs[0].X() << " " << aEndPs[0].Y() << " " << aEndPs[0].Z());
+          DEBTRACE("curve last point: " << aEndPs[1].X() << " " << aEndPs[1].Y() << " " << aEndPs[1].Z());
+          DEBTRACE("curve mid point: " << midPnt.X() << " " << midPnt.Y() << " " << midPnt.Z());
 
           std::vector<TopoDS_Wire> aCurves;
           HYDROData_PolylineOperator::GetWires(theOldPolyline, aCurves);
 
           int nbSections = theOldPolyline->NbSections();
-          //DEBTRACE("nbSections: "<< nbSections << ", nbCurves: " << aCurves.size() );
+          DEBTRACE("nbSections: "<< nbSections << ", nbCurves: " << aCurves.size() );
           for (int isec = 0; isec < nbSections; isec++)
             {
-              //DEBTRACE("section: "<< isec);
+              DEBTRACE("section: "<< isec);
               bool isOldSectionclosed = theOldPolyline->IsClosedSection(isec);
               TopoDS_Wire aWire = aCurves[isec]; // we suppose sections and wires are in the same order
               TopExp_Explorer anExp(aWire, TopAbs_EDGE);
@@ -493,18 +493,18 @@ bool convertEdgesToSections( const TopoDS_Edge&
               BRepAdaptor_Curve adaptorOldCurve(anEdge);
               double pfirst = adaptorOldCurve.FirstParameter();
               double plast = adaptorOldCurve.LastParameter();
-              //DEBTRACE("previous curve first last : "<< pfirst << " " << plast);
+              DEBTRACE("previous curve first last : "<< pfirst << " " << plast);
               double p[3] = {-1, -1};
               double d0= ProjectPointToCurve(aEndPs[0].XYZ(), adaptorOldCurve,p[0]);
               double d1= ProjectPointToCurve(aEndPs[1].XYZ(), adaptorOldCurve,p[1]);
               double d2= ProjectPointToCurve(midPnt.XYZ(), adaptorOldCurve, p[2]);
-              //DEBTRACE("d0: "<<d0<<" d1: "<<d1<<" d2: "<<d2<<" p0: "<<p[0]<<" p1: "<<p[1]<<" p2: "<<p[2]);
+              DEBTRACE("d0: "<<d0<<" d1: "<<d1<<" d2: "<<d2<<" p0: "<<p[0]<<" p1: "<<p[1]<<" p2: "<<p[2]);
               if ((d0 < 1.e-3) && (d1 < 1.e-3) && (d2 < 1.e-3)) // we got the good old curve (and the good section)
                 {
                   double pmin = p[0];
                   double pmax = p[1];
                   bool forward = true;
-                  //DEBTRACE("isOldSectionclosed: " << isOldSectionclosed);
+                  DEBTRACE("isOldSectionclosed: " << isOldSectionclosed);
                   if (!isOldSectionclosed) // no need to check first and last points on an open curve
                     {
                       if (pmin > pmax)
@@ -541,7 +541,7 @@ bool convertEdgesToSections( const TopoDS_Edge&
                       else if ((abs(pmax - pfirst) <1.e-3) && (p[2] > pmin)) // forward, replace pmax par plast
                         pmax = plast;
                    }
-                  //DEBTRACE("forward: "<< forward << " pmin " << pmin <<  " pmax " << pmax);
+                  DEBTRACE("forward: "<< forward << " pmin " << pmin <<  " pmax " << pmax);
                   HYDROData_PolylineXY::Point aFirstPoint, aLastPoint;
                   if (forward)
                     {
@@ -557,7 +557,7 @@ bool convertEdgesToSections( const TopoDS_Edge&
 
                   HYDROData_PolylineXY::PointsList aSectPoints = theOldPolyline->GetPoints(isec, false);
                   int nbPoints = aSectPoints.Length();
-                  //DEBTRACE("nbPoints " << nbPoints);
+                  DEBTRACE("nbPoints " << nbPoints);
                   if (forward)
                     for (int i=1; i<=nbPoints; i++)
                       {
@@ -567,7 +567,7 @@ bool convertEdgesToSections( const TopoDS_Edge&
                         double d = ProjectPointToCurve(p, adaptorOldCurve, param);
                         if ((param > pmin) && (param < pmax))
                           {
-                            //DEBTRACE("param: " << param);
+                            DEBTRACE("param: " << param);
                             aPointsList.Append(aPoint);
                           }
                       }
@@ -580,7 +580,7 @@ bool convertEdgesToSections( const TopoDS_Edge&
                         double d = ProjectPointToCurve(p, adaptorOldCurve, param);
                         if ((param > pmin) && (param < pmax))
                           {
-                            //DEBTRACE("param: " << param);
+                            DEBTRACE("param: " << param);
                             aPointsList.Append(aPoint);
                           }
                       }
@@ -598,7 +598,7 @@ bool convertEdgesToSections( const TopoDS_Edge&
   TCollection_AsciiString aSectName = getUniqueSectionName( theSectNames );
   if (isNewSection)
     {
-      //DEBTRACE("isNewSection");
+      DEBTRACE("isNewSection");
       theSectNames.Append( aSectName );
       theSectTypes.Append( aSectionType );
       theSectClosures.Append( anIsEdgeClosed );
@@ -606,7 +606,7 @@ bool convertEdgesToSections( const TopoDS_Edge&
     }
   else
     {
-      //DEBTRACE("sameSection");
+      DEBTRACE("sameSection");
       theSectPoints.SetValue(theSectPoints.Length(), aPointsList);
     }
 
@@ -619,7 +619,7 @@ bool HYDROData_PolylineXY::ImportShape( const TopoDS_Shape& theShape,
                                         bool IsClosureAllowed,
                                         double theDeviation )
 {
-  //DEBTRACE("ImportShape");
+  DEBTRACE("ImportShape");
   if ( theShape.IsNull() )
     return false;
 
@@ -638,7 +638,7 @@ bool HYDROData_PolylineXY::ImportShape( const TopoDS_Shape& theShape,
 
   if ( theShape.ShapeType() == TopAbs_EDGE )
   {
-      //DEBTRACE("TopAbs_EDGE");
+      DEBTRACE("TopAbs_EDGE");
     TopoDS_Edge anEdge = TopoDS::Edge( theShape );
 //    anIsCanBeImported = convertEdgeToSection( anEdge, aSectNames, aSectTypes,
 //      aSectClosures, aSectPoints, true, IsInterpolationAllowed, theDeviation );
@@ -648,7 +648,7 @@ bool HYDROData_PolylineXY::ImportShape( const TopoDS_Shape& theShape,
   }
   else if ( theShape.ShapeType() == TopAbs_WIRE )
   {
-      //DEBTRACE("TopAbs_WIRE");
+      DEBTRACE("TopAbs_WIRE");
     TopTools_SequenceOfShape anEdges;
     HYDROData_ShapesTool::ExploreShapeToShapes( theShape, TopAbs_EDGE, anEdges );
 
@@ -889,7 +889,7 @@ void HYDROData_PolylineXY::setEditable( const bool theIsEditable )
  */
 bool HYDROData_PolylineXY::IsClosed(const bool theIsSimpleCheck) const
 {
-  //DEBTRACE("IsClosed " << theIsSimpleCheck << " " << GetName());
+  DEBTRACE("IsClosed " << theIsSimpleCheck << " " << GetName());
   bool anIsClosed = false;
 
   TopoDS_Shape aShape = GetShape();
@@ -915,7 +915,7 @@ bool HYDROData_PolylineXY::IsClosed(const bool theIsSimpleCheck) const
         anIsClosed = BRep_Tool::IsClosed(aWires.First());
       else
         {
-          //DEBTRACE("aNbWires " << aNbWires);
+          DEBTRACE("aNbWires " << aNbWires);
           Handle(TopTools_HSequenceOfShape) aSeqWires = new TopTools_HSequenceOfShape;
           Handle(TopTools_HSequenceOfShape) aSeqEdges = new TopTools_HSequenceOfShape;
           for (int i = 1; i <= aNbWires; ++i)
@@ -927,11 +927,11 @@ bool HYDROData_PolylineXY::IsClosed(const bool theIsSimpleCheck) const
             }
           if (aSeqEdges->Length() > 1)
             {
-              //DEBTRACE(aSeqEdges->Length());
+              DEBTRACE(aSeqEdges->Length());
               ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdges, 1E-5, Standard_False, aSeqWires);
               if (aSeqWires->Length() == 1)
                 {
-                  //DEBTRACE(aSeqWires->Length());
+                  DEBTRACE(aSeqWires->Length());
                   const TopoDS_Wire& aPolylineWire = TopoDS::Wire(aSeqWires->Value(1));
                   anIsClosed = BRep_Tool::IsClosed(aPolylineWire);
                 }
@@ -958,7 +958,7 @@ int HYDROData_PolylineXY::GetNbConnectedWires(Handle(TopTools_HSequenceOfShape)&
     }
   else
     {
-      //DEBTRACE("aNbWires " << aNbWires);
+      DEBTRACE("aNbWires " << aNbWires);
       Handle(TopTools_HSequenceOfShape) aSeqWires = new TopTools_HSequenceOfShape;
       Handle(TopTools_HSequenceOfShape) aSeqEdges = new TopTools_HSequenceOfShape;
       for (int i = 1; i <= aNbWires; ++i)
@@ -970,7 +970,7 @@ int HYDROData_PolylineXY::GetNbConnectedWires(Handle(TopTools_HSequenceOfShape)&
         }
       if (aSeqEdges->Length() > 1)
         {
-          //DEBTRACE(aSeqEdges->Length());
+          DEBTRACE(aSeqEdges->Length());
           ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdges, 1E-5, Standard_False, aSeqWires);
         }
       aConnectedWires = aSeqWires;
index 11fe12cd2e51c99fa5a3a253be6d05728662b266..03e0c943fc85521297623d386beba7e6a944eb79 100644 (file)
@@ -31,7 +31,7 @@
 
 #include <gp_Pnt.hxx>
 
-#define _DEVDEBUG_
+//#define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 
 using namespace std;
@@ -88,11 +88,11 @@ void HYDROData_QuadtreeNode::setNodesAndCompute(Nodes_3D* theNodes)
   myNodes = theNodes;
   if (myNodes)
     {
-      //DEBTRACE(" --- start compute");
+      DEBTRACE(" --- start compute");
       compute();
-      //DEBTRACE(" --- end compute : children & height " << this->nbChildren() << " " << this->getHeight());
-      //DEBTRACE("Bounding box min: " << this->myBox->CornerMin().X() << " "  << this->myBox->CornerMin().Y());
-      //DEBTRACE("Bounding box max: " << this->myBox->CornerMax().X() << " "  << this->myBox->CornerMax().Y());
+      DEBTRACE(" --- end compute : children & height " << this->nbChildren() << " " << this->getHeight());
+      DEBTRACE("Bounding box min: " << this->myBox->CornerMin().X() << " "  << this->myBox->CornerMin().Y());
+      DEBTRACE("Bounding box max: " << this->myBox->CornerMax().X() << " "  << this->myBox->CornerMax().Y());
     }
 }
 
index 8784a1e5f31f9a008241221c5e86ac2e7e652b30..07a515ff296c6723f1a6d9c14a4da6bc5785204b 100644 (file)
@@ -53,7 +53,7 @@
 static TCollection_AsciiString fileNameBefore("BeforeTranslation");
 #endif
 
-#define _DEVDEBUG_
+//#define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 
 TopoDS_Face HYDROData_SplitToZonesTool::SplitData::Face() const
index ffa0361075c86d446a21d891f10633588a23ab78..2323240709a5ca436f4d7c3a041ed3de93549f0c 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>
 
@@ -283,12 +283,13 @@ static int IntersectCurve(
     if (ProjectPointToCurve(aEndPs[aPI], theCurve1, aParameter) <=
       Precision::SquareConfusion())
     {
+      DEBTRACE("aParameter " << aParameter);
       aIntCount += AddParameter(theCurve1, aParameter, theParameters);
     }
   }
 
   // Process the internal extremums.
-  Extrema_ExtCC aAlgo(theCurve1, theCurve2);
+  Extrema_ExtCC aAlgo(theCurve1, theCurve2); //, 1.e-6, 1.e-6);
   if (aAlgo.IsDone())
   {
     const int aECount = aAlgo.NbExt();
@@ -296,9 +297,11 @@ static int IntersectCurve(
     {
       Extrema_POnCurv aP1, aP2;
       aAlgo.Points(aEN, aP1, aP2);
+      DEBTRACE("SquareDistance " << aP1.Value().SquareDistance(aP2.Value()));
       if (aP1.Value().SquareDistance(aP2.Value()) <=
         Precision::SquareConfusion())
       {
+        DEBTRACE("aP1.Parameter() " << aP1.Parameter());
         aIntCount += AddParameter(theCurve1, aP1.Parameter(), theParameters);
       }
     }
@@ -373,7 +376,7 @@ bool HYDROData_TopoCurve::Initialize(const TopoDS_Wire& theWire)
   TopExp::MapShapesAndAncestors(theWire,
     TopAbs_VERTEX, TopAbs_EDGE, aVertexToEdges);
   const int aVCount = aVertexToEdges.Extent();
-  //DEBTRACE("initialize VCount= "<< aVCount);
+  DEBTRACE("initialize VCount= "<< aVCount);
   if (aVCount == 0)
   {
     return false;
@@ -502,7 +505,7 @@ bool HYDROData_TopoCurve::Cut(
     aParamI ^= 1;
   }
   const bool isClosed = IsClosed();
-  //DEBTRACE("aParamI: " << aParamI << " isClosed: "<< isClosed);
+  DEBTRACE("aParamI: " << aParamI << " isClosed: "<< isClosed);
   if (aParamI < 0)
   {
     aEdge.Orientation(TopAbs_FORWARD);
@@ -660,26 +663,29 @@ 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() );
+  std::string brepName = "theWireToIntersect";
+  brepName += ".brep";
+  BRepTools::Write( theWire, brepName.c_str() );
 
   int aIntCount = 0;
   theParameters.resize(myEdges.size());
+  DEBTRACE("myEdges.size() " << myEdges.size());
   std::list<TopoDS_Edge>::const_iterator aEIt = myEdges.begin();
   std::list<TopoDS_Edge>::const_iterator aLastEIt = myEdges.end();
   std::deque<std::list<double> >::iterator aPIt = theParameters.begin();
   for (; aEIt != aLastEIt; ++aPIt, ++aEIt)
   {
+    DEBTRACE("---");
     const TopoDS_Edge& aEdge = *aEIt;
     std::list<double>& aParams = *aPIt;
     TopExp_Explorer aEIt2(theWire, TopAbs_EDGE);
     for (; aEIt2.More(); aEIt2.Next())
     {
       aIntCount += IntersectEdge(aEdge,TopoDS::Edge(aEIt2.Current()), aParams);
+      DEBTRACE("aParams.size() " << aParams.size());
     }
   }
-  //DEBTRACE("aIntCount " << aIntCount);
+  DEBTRACE("aIntCount " << aIntCount);
   return aIntCount;
 }