#include <HYDROData_PolylineXY.h>
#include <HYDROData_PolylineOperator.h>
#include <HYDROData_Iterator.h>
+#include <HYDROData_ImmersibleZone.h>
#include <HYDROData_Tool.h>
#include <QColor>
aDoc->Close();
}
+void test_HYDROData_PolylineXY::test_extraction_immersible_zone()
+{
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
+
+ Handle(HYDROData_PolylineXY) aPolyline =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+ aPolyline->SetName( "test" );
+
+ QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
+ TopoDS_Wire aWire = Wire( aCoords, true );
+ aPolyline->SetShape( aWire );
+
+ Handle(HYDROData_ImmersibleZone) aZone =
+ Handle(HYDROData_ImmersibleZone)::DownCast( aDoc->CreateObject( KIND_IMMERSIBLE_ZONE ) );
+ aZone->SetName( "zone" );
+ aZone->SetPolyline( aPolyline );
+ aZone->Update();
+
+ CPPUNIT_ASSERT_EQUAL( false, (bool)aZone->GetTopShape().IsNull() );
+
+ HYDROData_PolylineOperator anOp;
+ CPPUNIT_ASSERT_EQUAL( true, anOp.Extract( aDoc, aZone ) );
+
+ Handle(HYDROData_PolylineXY) anOuter =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->FindObjectByName( "zone_Outer_1", KIND_POLYLINEXY ) );
+ CPPUNIT_ASSERT_EQUAL( false, (bool)anOuter.IsNull() );
+
+ TestViewer::show( aZone->GetTopShape(), 1, true, "Extraction_ImmZone" );
+ TestViewer::show( anOuter->GetShape(), 0, true, Qt::red );
+ CPPUNIT_ASSERT_IMAGES
+
+ aDoc->Close();
+}
CPPUNIT_TEST( testPolyline );
CPPUNIT_TEST( testCopy );
CPPUNIT_TEST( testSplit_refs_624 );
+ CPPUNIT_TEST( test_extraction_immersible_zone );
CPPUNIT_TEST_SUITE_END();
private:
void testCopy();
void testSplit_refs_624();
+
+ void test_extraction_immersible_zone();
};
CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_PolylineXY);