aDoc->Close();
}
-void test_HYDROData_LandCoverMap::test_split_by_polyline()
+void test_HYDROData_LandCoverMap::test_split()
{
Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
aDoc->Close();
}
+void test_HYDROData_LandCoverMap::test_incomplete_split()
+{
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+ Handle(HYDROData_LandCoverMap) aMap =
+ Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+
+ CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
+
+ TopoDS_Face aLC = LandCover( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
+ CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC, "test1" ) );
+
+ Handle(HYDROData_PolylineXY) aPolyline =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+ TopoDS_Wire aWire = BRepBuilderAPI_MakeWire( Spline( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10 ) ).Wire();
+ aPolyline->SetShape( aWire );
+
+ CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) );
+
+ TestViewer::show( aMap->GetShape(), AIS_Shaded, true );
+ TestViewer::show( aWire, QColor(), 0 );
+ TestViewer::AssertEqual( "LandCoverMap_Split_2" );
+
+ HYDROData_LandCoverMap::Iterator anIt( aMap );
+ CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+ CPPUNIT_ASSERT_EQUAL( QString( "test1" ), anIt.StricklerType() );
+ anIt.Next();
+ CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
+
+ aDoc->Close();
+}
+
void test_HYDROData_LandCoverMap::test_merge()
{
Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
{
CPPUNIT_TEST_SUITE( test_HYDROData_LandCoverMap );
CPPUNIT_TEST( test_add_2_objects );
- CPPUNIT_TEST( test_split_by_polyline );
+ CPPUNIT_TEST( test_split );
+ CPPUNIT_TEST( test_incomplete_split );
CPPUNIT_TEST( test_merge );
CPPUNIT_TEST( test_remove );
CPPUNIT_TEST_SUITE_END();
public:
void test_add_2_objects();
- void test_split_by_polyline();
+ void test_split();
+ void test_incomplete_split();
void test_merge();
void test_remove();
};