X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDRO_tests%2Ftest_HYDROData_Channel.cxx;h=c80b0da3c356626d86e999e08668d5589480a4ea;hb=a3aee81ee52b523b2c318dba1e0cc36d5d79f8bd;hp=82ca4336beaabee7002007650ee25737fbe47d5e;hpb=6527cd5d3063b2724b60b3f87ed1105244b74cb3;p=modules%2Fhydro.git diff --git a/src/HYDRO_tests/test_HYDROData_Channel.cxx b/src/HYDRO_tests/test_HYDROData_Channel.cxx index 82ca4336..c80b0da3 100644 --- a/src/HYDRO_tests/test_HYDROData_Channel.cxx +++ b/src/HYDRO_tests/test_HYDROData_Channel.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -34,35 +35,55 @@ TopoDS_Edge Spline( const QList& theXYList, bool isClosed = false ); -void test_HYDROData_Channel::test_2d_prs() +void test_HYDROData_Channel::test_channel_prs_refs_751() { Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); - Handle(HYDROData_PolylineXY) aPolyline2d = + Handle(HYDROData_PolylineXY) Polyline_2 = Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); - aPolyline2d->SetName( "polyline2d_1" ); - aPolyline2d->AddSection( "", HYDROData_IPolyline::SECTION_SPLINE, false ); + Polyline_2->SetName( "polyline2d_1" ); + Polyline_2->AddSection( "", HYDROData_IPolyline::SECTION_SPLINE, false ); + Polyline_2->AddPoint( 0, gp_XY( -192.40, 397.86 ) ); + Polyline_2->AddPoint( 0, gp_XY( -53.44, 293.35 ) ); + Polyline_2->AddPoint( 0, gp_XY( 102.14, 225.65 ) ); + Polyline_2->AddPoint( 0, gp_XY( 251.78, 108.08 ) ); + Polyline_2->Update(); + + CPPUNIT_ASSERT_EQUAL( false, (bool)Polyline_2->GetShape().IsNull() ); + + Handle(HYDROData_Profile) aProfile0 = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + aProfile0->SetName( "profile_0" ); + + HYDROData_IPolyline::PointsList aPoints; + aPoints.Append( gp_XY( 0.0, 0.0 ) ); + aPoints.Append( gp_XY( 1.0, 0.0 ) ); + aProfile0->GetProfileUZ( true ); + aProfile0->SetParametricPoints( aPoints ); + aProfile0->Update(); Handle(HYDROData_Polyline3D) aPolyline3d = Handle(HYDROData_Polyline3D)::DownCast( aDoc->CreateObject( KIND_POLYLINE ) ); aPolyline3d->SetName( "polyline3d_1" ); - aPolyline3d->SetPolylineXY( aPolyline2d ); - - QList aCoords = QList() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20; - TopoDS_Wire aWire = Wire( aCoords, false ); - aPolyline2d->SetShape( aWire ); - aPolyline3d->SetTopShape( aWire ); - aPolyline3d->SetShape3D( aWire ); + aPolyline3d->SetPolylineXY( Polyline_2 ); + aPolyline3d->SetProfileUZ( aProfile0->GetProfileUZ() ); + aPolyline3d->Update(); Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); aProfile->SetName( "profile_1" ); - QList aCoordsPr = QList() << 0.0 << 0.1 << 0.5 << 0.0 << 1.0 << 0.1; - TopoDS_Wire aWirePr = Wire( aCoordsPr, false ); - aProfile->SetTopShape( aWirePr ); - aProfile->SetShape3D( aWirePr ); + aPoints.Clear(); + aPoints.Append( gp_XY( 0.0, 0.1 ) ); + aPoints.Append( gp_XY( 12.5, 0.0 ) ); + aPoints.Append( gp_XY( 25.0, 0.1 ) ); + aProfile->GetProfileUZ( true ); + aProfile->SetParametricPoints( aPoints ); + aProfile->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_SPLINE ); + aProfile->Update(); + CPPUNIT_ASSERT_EQUAL( false, (bool)aProfile->GetShape3D().IsNull() ); + CPPUNIT_ASSERT_EQUAL( false, (bool)aPolyline3d->GetShape3D().IsNull() ); Handle(HYDROData_Channel) aChannel = Handle(HYDROData_Channel)::DownCast( aDoc->CreateObject( KIND_CHANNEL ) ); @@ -77,8 +98,10 @@ void test_HYDROData_Channel::test_2d_prs() TestViewer::show( aChannel->GetTopShape(), AIS_Shaded, true, "Channel" ); TestViewer::show( aChannel->GetLeftShape(), AIS_WireFrame, true, Qt::red ); TestViewer::show( aChannel->GetRightShape(), AIS_WireFrame, true, Qt::red ); - //TestViewer::show( aWire, AIS_Shaded, true, "Channel" ); + Handle(HYDROGUI_Polyline) Polyline_Prs = new HYDROGUI_Polyline( aPolyline3d->GetShape3D() ); + Polyline_Prs->SetColor( Quantity_NOC_WHITE ); + TestViewer::show( Polyline_Prs, AIS_WireFrame, 0, true, "" ); CPPUNIT_ASSERT_IMAGES - + aDoc->Close(); }