]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
test on transparent land cover map presentation
authorasl <asl@opencascade.com>
Fri, 23 Oct 2015 06:21:11 +0000 (09:21 +0300)
committerasl <asl@opencascade.com>
Fri, 23 Oct 2015 06:21:11 +0000 (09:21 +0300)
src/HYDRO_tests/reference_data/LandCoverMap_TransparentPrs.png [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx
src/HYDRO_tests/test_HYDROData_LandCoverMap.h

diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_TransparentPrs.png b/src/HYDRO_tests/reference_data/LandCoverMap_TransparentPrs.png
new file mode 100644 (file)
index 0000000..f0723e1
Binary files /dev/null and b/src/HYDRO_tests/reference_data/LandCoverMap_TransparentPrs.png differ
index 829211fac81cc8677f267bab061f2a43100e5e74..1ae4bd40d0eb23d0ee5dcc620fec4370bbda463a 100644 (file)
@@ -19,6 +19,7 @@
 #include <test_HYDROData_LandCoverMap.h>
 #include <HYDROData_Document.h>
 #include <HYDROData_LandCoverMap.h>
+#include <HYDROData_ImmersibleZone.h>
 #include <HYDROData_PolylineXY.h>
 #include <HYDROData_StricklerTable.h>
 #include <HYDROData_Tool.h>
@@ -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<double>() << 1 << 1 << 10 << 10 << 10 << 20 ), "Zones de champs cultivé à végétation haute" );
+  aMap->LocalPartition( Face( QList<double>() << 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
+}
index 4d0a14d780768bad285969b2195ef6727af2ada4..609a1802e23f52050a097a6c517077accb8befda 100644 (file)
@@ -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 );