Salome HOME
refs #662: the tests for land cover presentations
[modules/hydro.git] / src / HYDRO_tests / test_HYDROData_LandCoverMap.cxx
index fa0952cf4544f3af53dc4af86ce0144e3b85679e..e05a4cd2ccbd0d1f75f047110af8bf9504de40cf 100644 (file)
@@ -34,6 +34,7 @@
 #include <TestViewer.h>
 #include <TopTools_ListOfShape.hxx>
 #include <AIS_DisplayMode.hxx>
+#include <Aspect_ColorScale.hxx>
 #include <QString>
 #include <QColor>
 
@@ -449,7 +450,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
   }
 }
 
-void test_HYDROData_LandCoverMap::test_land_cover_prs()
+void test_HYDROData_LandCoverMap::test_land_cover_prs_by_types()
 {
   Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
 
@@ -475,7 +476,41 @@ void test_HYDROData_LandCoverMap::test_land_cover_prs()
 
   Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap );
   aPrs->SetTable( aTable );
-  TestViewer::show( aPrs, AIS_Shaded, 1, true );
+  TestViewer::show( aPrs, AIS_Shaded, 1, true, "LandCoverMap_PrsByTypes" );
+  CPPUNIT_ASSERT_IMAGES
+
+  aDoc->Close();
+}
+
+void test_HYDROData_LandCoverMap::test_land_cover_prs_by_coeff()
+{
+  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_LandCoverMap) aMap =
+    Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+
+  TopoDS_Face aLC1 = LandCover( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+  CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "Zones de champs cultivé à végétation basse" ) );
+
+  TopoDS_Face aLC2 = LandCover( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
+                                                   44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
+                                                  128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
+                                                  31 << 114 );
+  CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "Zones de champs cultivé à végétation haute" ) );
+
+  TopoDS_Face aLC3 = LandCover( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
+                                                 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
+  CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "Zones de champs, prairies, sans cultures" ) );
+
+  Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap );
+  aPrs->SetTable( aTable );
+  aPrs->SetColorScale( TestViewer::showColorScale() );
+  TestViewer::show( aPrs, AIS_Shaded, 1, true, "LandCoverMap_PrsByCoeff" );
+  CPPUNIT_ASSERT_IMAGES
 
   aDoc->Close();
 }