From 34a927755318fe2aea96e65236b9925d5bf47f84 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Mon, 8 May 2017 10:37:19 +0200 Subject: [PATCH] debug ordre profils stream --- src/HYDROData/HYDROData_Stream.cxx | 42 ++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/src/HYDROData/HYDROData_Stream.cxx b/src/HYDROData/HYDROData_Stream.cxx index 91718cb2..599f2281 100644 --- a/src/HYDROData/HYDROData_Stream.cxx +++ b/src/HYDROData/HYDROData_Stream.cxx @@ -92,6 +92,9 @@ #include #endif +#define _DEVDEBUG_ +#include "HYDRO_trace.hxx" + #include typedef NCollection_DataMap HYDROData_DataMapOfRealOfHDProfile; @@ -420,7 +423,10 @@ bool HYDROData_Stream::HasIntersection( const Handle(HYDROData_PolylineXY)& theH TopoDS_Wire aHydraulicWire = TopoDS::Wire( theHydAxis->GetShape() ); //guide line TopoDS_Wire aProfileWire = TopoDS::Wire( theProfile->GetTopShape() ); if ( aProfileWire.IsNull() ) - return false; + { + DEBTRACE("aProfileWire.IsNull"); + return false; + } //BRepProj_Projection aProjector (aProfileWire, thePlane, gp::OZ().Direction()); BRepAlgo_NormalProjection nproj(thePlane); @@ -428,10 +434,16 @@ bool HYDROData_Stream::HasIntersection( const Handle(HYDROData_PolylineXY)& theH nproj.SetDefaultParams(); nproj.Build(); if(!nproj.IsDone()) - return false; + { + DEBTRACE("!nproj.IsDone"); + return false; + } TopoDS_Shape aPrjProfile = nproj.Projection(); if(aPrjProfile.IsNull()) - return false; + { + DEBTRACE("aPrjProfile.IsNull"); + return false; + } TopoDS_Vertex aV1, aV2; if(aPrjProfile.ShapeType() == TopAbs_EDGE) TopExp::Vertices(TopoDS::Edge(aPrjProfile), aV1, aV2); @@ -449,14 +461,20 @@ bool HYDROData_Stream::HasIntersection( const Handle(HYDROData_PolylineXY)& theH } } if(aV1.IsNull() || aV2.IsNull()) - return false; + { + DEBTRACE("aV1.IsNull() || aV2.IsNull()"); + return false; + } gp_Pnt aPnt1 = BRep_Tool::Pnt(aV1); gp_Pnt aPnt2 = BRep_Tool::Pnt(aV2); aPnt1.SetZ(0.0); aPnt2.SetZ(0.0); BRepBuilderAPI_MakeEdge aMk(aPnt1, aPnt2); if(!aMk.IsDone()) - return false; + { + DEBTRACE("!aMk.IsDone()"); + return false; + } const TopoDS_Edge& anEdg2 = aMk.Edge();//Section edge Standard_Integer aNum(0); @@ -512,6 +530,7 @@ bool HYDROData_Stream::HasIntersection( const Handle(HYDROData_PolylineXY)& theH } if(hasInt) return true; + DEBTRACE("!hasInt " << aPnt1.X() << " " << aPnt1.Y() << " " << aPnt2.X() << " " << aPnt2.Y() << " --- " << aSqDist); return false; } @@ -530,7 +549,7 @@ bool HYDROData_Stream::AddProfile( const Handle(HYDROData_Profile)& theProfile ) Standard_Real aPar(.0); if ( HasReference( theProfile, DataTag_Profile ) || !HasIntersection( theProfile, aPlane, aPar ) ) return false; // Object is already in reference list or it has no intersection - + //DEBTRACE("AddProfile - insertParameter " << aPar); int aProfileIndex = insertParameter( aPar ); insertProfileInToOrder( theProfile, aProfileIndex ); @@ -545,6 +564,7 @@ bool HYDROData_Stream::AddProfile( const Handle(HYDROData_Profile)& theProfile ) bool HYDROData_Stream::SetProfiles( const HYDROData_SequenceOfObjects& theProfiles, const bool& theIsToOrder ) { + DEBTRACE(" --- SetProfiles " < aNewArr( anArr->Upper() ); - + QVector aNewArr( anArr->Upper() +1 ); bool isInserted = false; for ( int i = anArr->Lower(), j = i, n = anArr->Upper(); i <= n; ++i, ++j ) { @@ -823,13 +842,14 @@ int HYDROData_Stream::insertParameter( const Standard_Real& theParam ) } else { - aNewArr[j-1] = theParam; + if (j<=n+1) + aNewArr[j-1] = theParam; isInserted = true; ++j; } } - - aNewArr[j-1] = aStoredParam; + if (j<=n+1) + aNewArr[j-1] = aStoredParam; } if ( !isInserted ) -- 2.39.2