From: asl Date: Fri, 23 Oct 2015 06:21:11 +0000 (+0300) Subject: test on transparent land cover map presentation X-Git-Tag: v1.5~75^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ad76ee16dd4ea9a2c9fe2a1c3e441124e83b1767;p=modules%2Fhydro.git test on transparent land cover map presentation --- diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_TransparentPrs.png b/src/HYDRO_tests/reference_data/LandCoverMap_TransparentPrs.png new file mode 100644 index 00000000..f0723e17 Binary files /dev/null and b/src/HYDRO_tests/reference_data/LandCoverMap_TransparentPrs.png differ diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index 829211fa..1ae4bd40 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -550,3 +551,40 @@ void test_HYDROData_LandCoverMap::test_dump_python() //TODO: compare files } + +void test_HYDROData_LandCoverMap::test_transparent_prs() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_StricklerTable) aTable = + Handle(HYDROData_StricklerTable)::DownCast( aDoc->CreateObject( KIND_STRICKLER_TABLE ) ); + CPPUNIT_ASSERT_EQUAL( true, aTable->Import( DEF_STR_PATH ) ); + + Handle(HYDROData_PolylineXY) aPoly = + Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); + aPoly->AddSection( "", HYDROData_PolylineXY::SECTION_SPLINE, true ); + aPoly->AddPoint( 0, gp_XY( 0, 0 ) ); + aPoly->AddPoint( 0, gp_XY( 20, 0 ) ); + aPoly->AddPoint( 0, gp_XY( 10, 10 ) ); + aPoly->Update(); + + Handle(HYDROData_ImmersibleZone) aZone = + Handle(HYDROData_ImmersibleZone)::DownCast( aDoc->CreateObject( KIND_IMMERSIBLE_ZONE ) ); + aZone->SetPolyline( aPoly ); + aZone->Update(); + + Handle(HYDROData_LandCoverMap) aMap = + Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); + aMap->LocalPartition( Face( QList() << 1 << 1 << 10 << 10 << 10 << 20 ), "Zones de champs cultivé à végétation haute" ); + aMap->LocalPartition( Face( QList() << 5 << 5 << 10 << 5 << 10 << 8 << 5 << 12 << 5 << 8 ), "Zones de champs cultivé à végétation haute" ); + aMap->SetName( "test_LCM" ); + + TestViewer::show( aZone->GetTopShape(), AIS_Shaded, true, "LandCoverMap_TransparentPrs" ); + + Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap ); + aPrs->SetTable( aTable ); + aPrs->SetTransparency( 0.5 ); + TestViewer::show( aPrs, AIS_Shaded, 0, true, "" ); + + CPPUNIT_ASSERT_IMAGES +} diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h index 4d0a14d7..609a1802 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h @@ -36,6 +36,7 @@ class test_HYDROData_LandCoverMap : public CppUnit::TestFixture CPPUNIT_TEST( test_land_cover_prs_by_types ); CPPUNIT_TEST( test_land_cover_prs_by_coeff ); CPPUNIT_TEST( test_dump_python ); + CPPUNIT_TEST( test_transparent_prs ); CPPUNIT_TEST_SUITE_END(); public: @@ -50,6 +51,7 @@ public: void test_land_cover_prs_by_types(); void test_land_cover_prs_by_coeff(); void test_dump_python(); + void test_transparent_prs(); }; CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_LandCoverMap );