From: asl Date: Mon, 30 Dec 2013 04:17:00 +0000 (+0000) Subject: debug of the channel presentation X-Git-Tag: BR_hydro_v_0_7~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=36c42f28acb34ccfd20745d10a272263bc387e0d;p=modules%2Fhydro.git debug of the channel presentation --- diff --git a/src/HYDROData/HYDROData_Channel.cxx b/src/HYDROData/HYDROData_Channel.cxx index e011807b..2c76702a 100644 --- a/src/HYDROData/HYDROData_Channel.cxx +++ b/src/HYDROData/HYDROData_Channel.cxx @@ -109,8 +109,6 @@ void HYDROData_Channel::Update() if(aProfileWire.IsNull()) return; - //BRepTools::Write( aPathWire, "guideline.brep" ); - //BRepTools::Write( aProfileWire, "profile.brep" ); HYDROData_Canal3dAnd2d aChannelConstructor( aProfileWire, aPathWire ); aChannelConstructor.Create3dPresentation(); @@ -118,10 +116,12 @@ void HYDROData_Channel::Update() SetShape3D( aChannelConstructor.Get3dPresentation() ); SetTopShape( aChannelConstructor.Get2dPresentation() ); - //BRepTools::Write( aPathWire, "guideline.brep" ); - //BRepTools::Write( aProfileWire, "profile.brep" ); - //BRepTools::Write( aChannelConstructor.Get2dPresentation(), "channel2d.brep" ); - //BRepTools::Write( aChannelConstructor.Get3dPresentation(), "channel3d.brep" ); + BRepTools::Write( aPathWire, "guideline.brep" ); + BRepTools::Write( aProfileWire, "profile.brep" ); + BRepTools::Write( aChannelConstructor.Get2dPresentation(), "channel2d.brep" ); + BRepTools::Write( aChannelConstructor.Get3dPresentation(), "channel3d.brep" ); + + TopAbs_ShapeEnum aType = GetTopShape().ShapeType(); // Create groups for channel TopoDS_Wire aLeftBank = aChannelConstructor.GetLeftBank(); diff --git a/src/HYDROData/HYDROData_Pipes.cxx b/src/HYDROData/HYDROData_Pipes.cxx index 90d7b088..5147d01e 100644 --- a/src/HYDROData/HYDROData_Pipes.cxx +++ b/src/HYDROData/HYDROData_Pipes.cxx @@ -44,6 +44,7 @@ #include #include #include +#include /** * GEOMImpl_Fillet1dPoint is an internal class for 1D fillet algorithm @@ -964,7 +965,7 @@ HYDROData_Canal3dAnd2d::HYDROData_Canal3dAnd2d(const TopoDS_Wire& Profile, TopExp::Vertices(myProfile, myLeftVertex, myRightVertex); gp_Pnt LeftPoint = BRep_Tool::Pnt(myLeftVertex); gp_Pnt RightPoint = BRep_Tool::Pnt(myRightVertex); - myFilletRadius = (LeftPoint.Distance(RightPoint))/2.; + myFilletRadius = (LeftPoint.Distance(RightPoint))/2. * 1.5; myTolAngular = 0.01; MakeSharpVertexList(); @@ -1239,11 +1240,17 @@ Standard_Boolean HYDROData_Canal3dAnd2d::Create2dPresentation() return Standard_False; myPipe2d = mySweep2d->Shape(); - myInlet = TopoDS::Wire(mySweep2d->FirstShape()); - myOutlet = TopoDS::Wire(mySweep2d->LastShape()); + myUnifier.Initialize(myPipe2d); + myUnifier.Build(); + myUnifiedPipe2d = myUnifier.Shape(); + + TopoDS_Wire OriginalInlet = TopoDS::Wire(mySweep2d->FirstShape()); + TopoDS_Wire OriginalOutlet = TopoDS::Wire(mySweep2d->LastShape()); + myInlet = CreateWireOnUnifiedPipe2d(OriginalInlet); + myOutlet = CreateWireOnUnifiedPipe2d(OriginalOutlet); TopoDS_Vertex V1, V2, V3, V4; TopExp::Vertices(myTransformedProfile2d, V1, V2); - TopExp::Vertices(myInlet, V3, V4); + TopExp::Vertices(OriginalInlet, V3, V4); gp_Pnt P1 = BRep_Tool::Pnt(V1); gp_Pnt P3 = BRep_Tool::Pnt(V3); if (P1.IsEqual(P3, Precision::Confusion())) @@ -1264,7 +1271,23 @@ TopoDS_Wire HYDROData_Canal3dAnd2d::GetBank(const TopoDS_Vertex& aFreeVertex) MW.Add(GeneratedShapes); aBank = MW.Wire(); - return aBank; + TopoDS_Wire aBankOnUnifiedPipe2d = CreateWireOnUnifiedPipe2d(aBank); + + return aBankOnUnifiedPipe2d; +} + +TopoDS_Wire Canal3dAnd2d::CreateWireOnUnifiedPipe2d(const TopoDS_Wire& aWireOnPipe2d) +{ + BRepLib_MakeWire MW; + BRepTools_WireExplorer wexp(aWireOnPipe2d); + for (; wexp.More(); wexp.Next()) + { + TopoDS_Shape anEdge = wexp.Current(); + TopoDS_Shape NewEdge = myUnifier.Generated(anEdge); + if (!NewEdge.IsNull()) + MW.Add(TopoDS::Edge(NewEdge)); + } + return MW.Wire(); } TopoDS_Shape HYDROData_Canal3dAnd2d::Get3dPresentation() @@ -1272,9 +1295,10 @@ TopoDS_Shape HYDROData_Canal3dAnd2d::Get3dPresentation() return myPipe3d; } -TopoDS_Shape HYDROData_Canal3dAnd2d::Get2dPresentation() +TopoDS_Face HYDROData_Canal3dAnd2d::Get2dPresentation() { - return myPipe2d; + TopoDS_Iterator iter(myUnifiedPipe2d); + return TopoDS::Face(iter.Value()); } TopoDS_Wire HYDROData_Canal3dAnd2d::GetInlet() @@ -1306,4 +1330,4 @@ TopoDS_Wire HYDROData_Canal3dAnd2d::GetProjectedRoundedGuideline() { return myProjectedGuideline; } -*/ \ No newline at end of file +*/ diff --git a/src/HYDROData/HYDROData_Pipes.h b/src/HYDROData/HYDROData_Pipes.h index 4d681bee..3541d297 100644 --- a/src/HYDROData/HYDROData_Pipes.h +++ b/src/HYDROData/HYDROData_Pipes.h @@ -34,11 +34,13 @@ public: const TopoDS_Wire& aGuideline, const gp_Pnt& aMiddlePoint); + TopoDS_Wire CreateWireOnUnifiedPipe2d(const TopoDS_Wire& aWireOnPipe2d); + TopoDS_Wire GetBank(const TopoDS_Vertex& aFreeVertex); //Queries TopoDS_Shape Get3dPresentation(); - TopoDS_Shape Get2dPresentation(); + TopoDS_Face Get2dPresentation(); TopoDS_Wire GetLeftBank(); TopoDS_Wire GetRightBank(); TopoDS_Wire GetInlet(); @@ -68,6 +70,8 @@ private: TopoDS_Shape myPipe3d; TopoDS_Shape myPipe2d; + TopoDS_Shape myUnifiedPipe2d; + ShapeUpgrade_UnifySameDomain myUnifier; TopoDS_Wire myInlet; TopoDS_Wire myOutlet; //TopoDS_Shape myLeftBank; diff --git a/src/HYDROGUI/HYDROGUI_Shape.cxx b/src/HYDROGUI/HYDROGUI_Shape.cxx index 4afa67d3..7739a90e 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.cxx +++ b/src/HYDROGUI/HYDROGUI_Shape.cxx @@ -579,7 +579,7 @@ void HYDROGUI_Shape::buildShape() myShape = new AIS_Shape( myTopoShape ); } - myShape->SetHLRAngleAndDeviation( 0.0001 ); + myShape->SetHLRAngleAndDeviation( 0.001 ); if ( !myObject.IsNull() ) myShape->SetOwner( myObject );