From e8d04707748cf853f78492aba72adb6b6789d8ba Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Wed, 28 Jun 2017 22:52:14 +0200 Subject: [PATCH] debug multiple streams in a region --- .../h011_normalCaseManualInterpolZ.py | 2 +- src/HYDROData/HYDROData_Bathymetry.cxx | 84 +++++++++++-------- src/HYDROData/HYDROData_Bathymetry.h | 4 + src/HYDROData/HYDROData_CalculationCase.cxx | 22 ++--- src/HYDROData/HYDROData_ChannelAltitude.cxx | 2 +- src/HYDROData/HYDROData_PolylineOperator.cxx | 10 +-- src/HYDROData/HYDROData_PolylineXY.cxx | 74 ++++++++-------- src/HYDROData/HYDROData_QuadtreeNode.cxx | 10 +-- src/HYDROData/HYDROData_SplitToZonesTool.cxx | 2 +- src/HYDROData/HYDROData_TopoCurve.cxx | 22 +++-- 10 files changed, 128 insertions(+), 104 deletions(-) diff --git a/doc/salome/examples/h011_normalCaseManualInterpolZ.py b/doc/salome/examples/h011_normalCaseManualInterpolZ.py index 6c80a663..a91bff69 100644 --- a/doc/salome/examples/h011_normalCaseManualInterpolZ.py +++ b/doc/salome/examples/h011_normalCaseManualInterpolZ.py @@ -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() diff --git a/src/HYDROData/HYDROData_Bathymetry.cxx b/src/HYDROData/HYDROData_Bathymetry.cxx index 2e6ac1cc..cd6c718f 100644 --- a/src/HYDROData/HYDROData_Bathymetry.cxx +++ b/src/HYDROData/HYDROData_Bathymetry.cxx @@ -55,7 +55,7 @@ #include #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 HYDROData_Bathymetry::myQuadtrees; #ifndef LIGHT_MODE +int HYDROData_Bathymetry::myDelaunayNumber = 0; std::map 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 "<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["<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 "<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["<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::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 myQuadtrees; #ifndef LIGHT_MODE + static int myDelaunayNumber; static std::map myDelaunay2D; #endif bool importFromASCFile( QFile& theFile, diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 6db6d646..63a816a3 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -82,7 +82,7 @@ #include #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 ); } diff --git a/src/HYDROData/HYDROData_ChannelAltitude.cxx b/src/HYDROData/HYDROData_ChannelAltitude.cxx index ba2c7587..b848733c 100644 --- a/src/HYDROData/HYDROData_ChannelAltitude.cxx +++ b/src/HYDROData/HYDROData_ChannelAltitude.cxx @@ -27,7 +27,7 @@ #include "HYDROData_ProfileUZ.h" #include "HYDROData_Profile.h" -#define _DEVDEBUG_ +//#define _DEVDEBUG_ #include "HYDRO_trace.hxx" #include diff --git a/src/HYDROData/HYDROData_PolylineOperator.cxx b/src/HYDROData/HYDROData_PolylineOperator.cxx index 07387a6e..c89d189f 100644 --- a/src/HYDROData/HYDROData_PolylineOperator.cxx +++ b/src/HYDROData/HYDROData_PolylineOperator.cxx @@ -53,7 +53,7 @@ #include #include -#define _DEVDEBUG_ +//#define _DEVDEBUG_ #include "HYDRO_trace.hxx" #include #include @@ -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 #include -#define _DEVDEBUG_ +//#define _DEVDEBUG_ #include "HYDRO_trace.hxx" #include #include @@ -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 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: "< 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; diff --git a/src/HYDROData/HYDROData_QuadtreeNode.cxx b/src/HYDROData/HYDROData_QuadtreeNode.cxx index 11fe12cd..03e0c943 100644 --- a/src/HYDROData/HYDROData_QuadtreeNode.cxx +++ b/src/HYDROData/HYDROData_QuadtreeNode.cxx @@ -31,7 +31,7 @@ #include -#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()); } } diff --git a/src/HYDROData/HYDROData_SplitToZonesTool.cxx b/src/HYDROData/HYDROData_SplitToZonesTool.cxx index 8784a1e5..07a515ff 100644 --- a/src/HYDROData/HYDROData_SplitToZonesTool.cxx +++ b/src/HYDROData/HYDROData_SplitToZonesTool.cxx @@ -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 diff --git a/src/HYDROData/HYDROData_TopoCurve.cxx b/src/HYDROData/HYDROData_TopoCurve.cxx index ffa03610..23232407 100644 --- a/src/HYDROData/HYDROData_TopoCurve.cxx +++ b/src/HYDROData/HYDROData_TopoCurve.cxx @@ -39,7 +39,7 @@ #include #include -#define _DEVDEBUG_ +//#define _DEVDEBUG_ #include "HYDRO_trace.hxx" #include @@ -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 >& 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::const_iterator aEIt = myEdges.begin(); std::list::const_iterator aLastEIt = myEdges.end(); std::deque >::iterator aPIt = theParameters.begin(); for (; aEIt != aLastEIt; ++aPIt, ++aEIt) { + DEBTRACE("---"); const TopoDS_Edge& aEdge = *aEIt; std::list& 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; } -- 2.39.2