X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_Stream.cxx;h=4b8e639a92708cc482e6eb376fe1e6ee6e29f3ae;hb=41550a623dca7d2de1b388c9832fe3642d2b8753;hp=91718cb223d29f341008d5dbf1e439b07c2f80ba;hpb=b5d0c5154ce4ecfa439da0a1395dbaa1e4c1e7d2;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_Stream.cxx b/src/HYDROData/HYDROData_Stream.cxx index 91718cb2..4b8e639a 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 " <& theArray ) int n = theArray.size(); Handle(TDataStd_RealArray) aParamsArray = TDataStd_RealArray::Set( aLabel, 1, n ); + aParamsArray->SetID(TDataStd_RealArray::GetID()); for ( int i = 0; i < n; ++i ) { const Standard_Real& aParam = theArray[i]; @@ -809,8 +830,7 @@ int HYDROData_Stream::insertParameter( const Standard_Real& theParam ) { aResIndex = 0; - QVector 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 +843,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 )