#include <HYDROData_PolylineXY.h>
#include <HYDROData_Polyline3D.h>
#include <HYDROData_Profile.h>
+#include <HYDROGUI_Polyline.h>
#include <TestShape.h>
#include <TestViewer.h>
TopoDS_Edge Spline( const QList<double>& 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<double> aCoords = QList<double>() << 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<double> aCoordsPr = QList<double>() << 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 ) );
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();
}