#include<test_HYDROData_PolylineXY.h>
+#include <HYDROData_Channel.h>
#include <HYDROData_Document.h>
#include <HYDROData_PolylineXY.h>
+#include <HYDROData_Polyline3D.h>
#include <HYDROData_PolylineOperator.h>
+#include <HYDROData_Profile.h>
#include <HYDROData_Iterator.h>
#include <HYDROData_ImmersibleZone.h>
#include <HYDROData_Tool.h>
+#include <AIS_DisplayMode.hxx>
#include <QColor>
#include <QList>
#include <QPointF>
aDoc->Close();
}
+
+void test_HYDROData_PolylineXY::test_extraction_channel_refs_611()
+{
+Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+ Handle(HYDROData_PolylineXY) aPolyline2d =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+ aPolyline2d->SetName( "polyline2d_1" );
+ aPolyline2d->AddSection( "", HYDROData_IPolyline::SECTION_SPLINE, false );
+
+ 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 );
+
+ 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 );
+
+
+ Handle(HYDROData_Channel) aChannel =
+ Handle(HYDROData_Channel)::DownCast( aDoc->CreateObject( KIND_CHANNEL ) );
+ aChannel->SetName( "channel_1" );
+
+ aChannel->SetGuideLine( aPolyline3d );
+ aChannel->SetProfile( aProfile );
+ aChannel->Update();
+ CPPUNIT_ASSERT_EQUAL( false, (bool)aChannel->GetTopShape().IsNull() );
+ CPPUNIT_ASSERT_EQUAL( false, (bool)aChannel->GetShape3D().IsNull() );
+
+ HYDROData_PolylineOperator anOp;
+ CPPUNIT_ASSERT_EQUAL( true, anOp.Extract( aDoc, aChannel ) );
+
+ Handle(HYDROData_PolylineXY) aLeft =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->FindObjectByName( "channel_1_Left_Bank_1", KIND_POLYLINEXY ) );
+ Handle(HYDROData_PolylineXY) aRight =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->FindObjectByName( "channel_1_Right_Bank_1", KIND_POLYLINEXY ) );
+ CPPUNIT_ASSERT_EQUAL( false, (bool)aRight.IsNull() );
+
+ TestViewer::show( aChannel->GetTopShape(), 1, true, "Extraction_Channel" );
+ TestViewer::show( aLeft->GetShape(), 0, true, Qt::red );
+ TestViewer::show( aRight->GetShape(), 0, true, Qt::red );
+ CPPUNIT_ASSERT_IMAGES
+
+ aDoc->Close();
+}