X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_Stream.cxx;h=4b8e639a92708cc482e6eb376fe1e6ee6e29f3ae;hb=41550a623dca7d2de1b388c9832fe3642d2b8753;hp=3ecb3e779857587c501eccf20aad1fc2705bd0ff;hpb=ad4482443835973ac9ee0ce2024f60f91adff716;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_Stream.cxx b/src/HYDROData/HYDROData_Stream.cxx index 3ecb3e77..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; @@ -215,10 +218,10 @@ bool HYDROData_Stream::CreatePresentations( const Handle(HYDROData_DTM)& theDTM, theDTM->GetPresentationShapes(Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet); - thePrs.myInlet = TopoDS::Wire(OutInlet); - thePrs.myOutlet = TopoDS::Wire(OutOutlet); - thePrs.myLeftBank = TopoDS::Wire(OutLeftB); - thePrs.myRightBank = TopoDS::Wire(OutRightB); + thePrs.myInlet = OutInlet; + thePrs.myOutlet = OutOutlet; + thePrs.myLeftBank = OutLeftB; + thePrs.myRightBank = OutRightB; thePrs.myPrs2D = Out2dPres; thePrs.myPrs3D = Out3dPres; /*std::vector profiles3d; @@ -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,9 +549,11 @@ 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 ); + + DTM()->SetProfiles( GetProfiles() ); // Indicate model of the need to update the stream presentation Changed( Geom_3d ); @@ -543,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]; @@ -807,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 ) { @@ -821,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 ) @@ -1077,8 +1100,14 @@ void HYDROData_Stream::CreatePresentations( const Handle(TColgp_HArray1OfPnt) if (!ll.IsEmpty()) { - LB = TopoDS::Wire(ll(1)); - RB = TopoDS::Wire(ll(2)); + TopAbs_ShapeEnum ll1_sht = ll(1).ShapeType(); + TopAbs_ShapeEnum ll2_sht = ll(2).ShapeType(); + if ((ll1_sht == TopAbs_WIRE || ll1_sht == TopAbs_EDGE) && + (ll2_sht == TopAbs_WIRE || ll2_sht == TopAbs_EDGE)) + { + LB = ll(1); + RB = ll(2); + } } IL = TopoDS::Wire(theArrOfProfiles->Value(theArrOfProfiles->Lower())); //TODO check that @@ -1094,12 +1123,11 @@ void HYDROData_Stream::CreatePresentations( const Handle(TColgp_HArray1OfPnt) BB.Add(newCmp, RB); thePrs.myPrs3D = newCmp; - std::set ind; - ind.insert(1); //inlet ind - ind.insert(2); //outlet ind TopTools_SequenceOfShape LS; - HYDROData_DTM::Get2dFaceFrom3dPres( newCmp, TopoDS::Face(thePrs.myPrs2D), &LS, ind ); + //HYDROData_DTM::Get2dFaceFrom3dPres( newCmp, TopoDS::Face(thePrs.myPrs2D), &LS, ind ); + + HYDROData_DTM::GetPlanarFaceFromBanks(TopoDS::Edge(LB), TopoDS::Edge(RB), TopoDS::Face(thePrs.myPrs2D), &LS); #ifndef NDEBUG TopTools_IndexedMapOfShape EE; @@ -1117,9 +1145,9 @@ void HYDROData_Stream::CreatePresentations( const Handle(TColgp_HArray1OfPnt) assert(noncontNb == 0); #endif - thePrs.myLeftBank = TopoDS::Wire(LS(1)); - thePrs.myInlet = TopoDS::Wire(LS(2)); - thePrs.myOutlet = TopoDS::Wire(LS(3)); - thePrs.myRightBank = TopoDS::Wire(LS(4)); + thePrs.myLeftBank = LS(1); + thePrs.myInlet = LS(2); + thePrs.myOutlet = LS(3); + thePrs.myRightBank = LS(4); }