#include <TopoDS_Wire.hxx>
#include <gp_XY.hxx>
-void test_HYDROData_PolylineXY::testPolyline()
+void test_HYDROData_PolylineXY::test_polyline()
{
Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
aDoc->Close();
}
-
-void test_HYDROData_PolylineXY::testCopy()
+void test_HYDROData_PolylineXY::test_copy()
{
Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
Handle(HYDROData_PolylineXY) aPolyline1 =
aDoc->Close();
}
-void test_HYDROData_PolylineXY::testSplit_refs_624()
+void test_HYDROData_PolylineXY::test_split_refs_624()
{
Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
aDoc->Close();
}
-void test_HYDROData_PolylineXY::testSplit_refs_627()
+void test_HYDROData_PolylineXY::test_split_refs_627()
{
Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
aDoc->Close();
}
+
+void test_HYDROData_PolylineXY::test_merge_refs_630()
+{
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
+
+ Handle(HYDROData_PolylineXY) aPolyline1 =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+ Handle(HYDROData_PolylineXY) aPolyline2 =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+
+ aPolyline1->SetName( "test1" );
+ aPolyline1->AddSection( "", HYDROData_PolylineXY::SECTION_SPLINE, false );
+ aPolyline1->AddPoint( 0, gp_XY( 0, 0 ) );
+ aPolyline1->AddPoint( 0, gp_XY( 10, 0 ) );
+ aPolyline1->AddPoint( 0, gp_XY( 10, 10 ) );
+ aPolyline1->Update();
+
+ aPolyline2->SetName( "test2" );
+ aPolyline2->AddSection( "", HYDROData_PolylineXY::SECTION_SPLINE, false );
+ aPolyline2->AddPoint( 0, gp_XY( 20, 20 ) );
+ aPolyline2->AddPoint( 0, gp_XY( 30, 20 ) );
+ aPolyline2->AddPoint( 0, gp_XY( 30, 0 ) );
+ aPolyline2->Update();
+
+ HYDROData_PolylineOperator anOp;
+ HYDROData_SequenceOfObjects aPolylines;
+ aPolylines.Append( aPolyline1 );
+ aPolylines.Append( aPolyline2 );
+ CPPUNIT_ASSERT_EQUAL( true, anOp.Merge( aDoc, "", aPolylines, true, 1E-3 ) );
+ //TODO: check false in merge
+
+ HYDROData_Iterator anIt( aDoc, KIND_POLYLINEXY );
+ CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+ CPPUNIT_ASSERT_EQUAL( QString( "test1" ), anIt.Current()->GetName() );
+ anIt.Next();
+ CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+ CPPUNIT_ASSERT_EQUAL( QString( "test2" ), anIt.Current()->GetName() );
+ anIt.Next();
+ CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+ CPPUNIT_ASSERT_EQUAL( QString( "merged_1" ), anIt.Current()->GetName() );
+ Handle(HYDROData_PolylineXY) aMerged =
+ Handle(HYDROData_PolylineXY)::DownCast( anIt.Current() );
+ anIt.Next();
+ CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
+
+ TestViewer::show( aMerged->GetShape(), 0, true, "Merge_Polylines" );
+ CPPUNIT_ASSERT_IMAGES
+
+ aDoc->Close();
+}
class test_HYDROData_PolylineXY : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE( test_HYDROData_PolylineXY );
- CPPUNIT_TEST( testPolyline );
- CPPUNIT_TEST( testCopy );
- CPPUNIT_TEST( testSplit_refs_624 );
- CPPUNIT_TEST( testSplit_refs_627 );
+ CPPUNIT_TEST( test_polyline );
+ CPPUNIT_TEST( test_copy );
+ CPPUNIT_TEST( test_split_refs_624 );
+ CPPUNIT_TEST( test_split_refs_627 );
CPPUNIT_TEST( test_presentation );
CPPUNIT_TEST( test_extraction_immersible_zone );
CPPUNIT_TEST( test_extraction_channel_refs_611 );
CPPUNIT_TEST( test_custom_polylines );
+ CPPUNIT_TEST( test_merge_refs_630 );
CPPUNIT_TEST_SUITE_END();
private:
void tearDown() {}
// checks save/restore QImages information
- void testPolyline();
+ void test_polyline();
// checks the image properties copy/paste
- void testCopy();
+ void test_copy();
- void testSplit_refs_624();
- void testSplit_refs_627();
+ void test_split_refs_624();
+ void test_split_refs_627();
void test_extraction_immersible_zone();
void test_extraction_channel_refs_611();
void test_presentation();
void test_custom_polylines();
+ void test_merge_refs_630();
};
CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_PolylineXY);