Salome HOME
Merge branch 'BR_LAND_COVER_MAP' of ssh://git.salome-platform.org/modules/hydro into...
[modules/hydro.git] / src / HYDRO_tests / test_HYDROData_LandCoverMap.cxx
index aa7f4d2b1539b330ebeeeed64d08382366a1072a..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>
 #include <TopoDS_Edge.hxx>
 #include <TopoDS_Wire.hxx>
 #include <TopoDS_Face.hxx>
-#include <TColgp_HArray1OfPnt.hxx>
-#include <GeomAPI_Interpolate.hxx>
-#include <BRepBuilderAPI_MakeEdge.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <BRepBuilderAPI_MakeWire.hxx>
 #include <TestViewer.h>
+#include <TestShape.h>
 #include <TopTools_ListOfShape.hxx>
 #include <AIS_DisplayMode.hxx>
 #include <Aspect_ColorScale.hxx>
 #include <QString>
 #include <QColor>
 #include <QMap>
+#include <QDir>
 #include <BRepTools.hxx>
 #include <BRep_Builder.hxx>
 
 const QString REF_DATA_PATH = qgetenv( "HYDRO_REFERENCE_DATA" );
-const QString DEF_STR_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/share/salome/resources/hydro/def_strickler_table.txt";
-
-TopoDS_Edge Spline( const QList<double>& theXYList, bool isClosed = false )
-{
-  int n = theXYList.size()/2;
-  Handle(TColgp_HArray1OfPnt) aPointsArray = new TColgp_HArray1OfPnt( 1, n );
-  for( int i=1; i<=n; i++ )
-  {
-    double x = theXYList[2*i-2];
-    double y = theXYList[2*i-1];
-    gp_Pnt aPnt( x, y, 0 );
-    aPointsArray->SetValue( i, aPnt );
-  }
-  GeomAPI_Interpolate anInterpolator( aPointsArray, isClosed, 1E-3 );
-  anInterpolator.Perform();
-  bool aResult = anInterpolator.IsDone() == Standard_True;
-  if( aResult )
-  {
-    Handle( Geom_BSplineCurve ) aCurve = anInterpolator.Curve();
-    return BRepBuilderAPI_MakeEdge( aCurve ).Edge();
-  }
-  else
-    return TopoDS_Edge();
-}
-
-TopoDS_Face LandCover( const QList<double>& theXYList )
-{
-  TopoDS_Edge anEdge = Spline( theXYList, true );
-  if( anEdge.IsNull() )
-    return TopoDS_Face();
-
-  TopoDS_Wire aWire = BRepBuilderAPI_MakeWire( anEdge ).Wire();
-  TopoDS_Face aFace = BRepBuilderAPI_MakeFace( aWire, Standard_True ).Face();
-  return aFace;
-}
+const QString DEF_STR_PATH = qgetenv( "HYDRO_SRC_DIR" ) + "/src/HYDROGUI/resources/def_strickler_table.txt";
 
 void test_HYDROData_LandCoverMap::test_add_2_objects()
 {
@@ -87,10 +51,10 @@ void test_HYDROData_LandCoverMap::test_add_2_objects()
 
   CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
 
-  TopoDS_Face aLC1 = LandCover( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
+  TopoDS_Face aLC1 = Face( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
 
-  TopoDS_Face aLC2 = LandCover( QList<double>() << 30 << 20 << 60 << 10 << 70 << 35 << 40 << 40 );
+  TopoDS_Face aLC2 = Face( QList<double>() << 30 << 20 << 60 << 10 << 70 << 35 << 40 << 40 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) );
 
   TestViewer::show( aMap->GetShape(), AIS_Shaded, true, "LandCoverMap_Add_2_Objects" );
@@ -117,12 +81,12 @@ void test_HYDROData_LandCoverMap::test_split()
 
   CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
 
-  TopoDS_Face aLC = LandCover( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
+  TopoDS_Face aLC = Face( 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 << 60 << 10 ) ).Wire();
+  TopoDS_Wire aWire = Wire( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10, false );
   aPolyline->SetShape( aWire );
 
   CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) );
@@ -152,12 +116,12 @@ void test_HYDROData_LandCoverMap::test_incomplete_split()
 
   CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
 
-  TopoDS_Face aLC = LandCover( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
+  TopoDS_Face aLC = Face( 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();
+  TopoDS_Wire aWire = Wire( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10, false );
   aPolyline->SetShape( aWire );
 
   CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) );
@@ -184,18 +148,18 @@ void test_HYDROData_LandCoverMap::test_merge()
 
   CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
 
-  TopoDS_Face aLC1 = LandCover( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+  TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
 
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
 
-  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 );
+  TopoDS_Face aLC2 = Face( 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, "test2" ) );
 
-  TopoDS_Face aLC3 = LandCover( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
-                                                 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
+  TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
+                                            127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) );
 
   //TestViewer::show( aMap->GetShape(), AIS_Shaded, true );
@@ -229,18 +193,18 @@ void test_HYDROData_LandCoverMap::test_remove()
 
   CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
 
-  TopoDS_Face aLC1 = LandCover( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+  TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
 
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
 
-  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 );
+  TopoDS_Face aLC2 = Face( 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, "test2" ) );
 
-  TopoDS_Face aLC3 = LandCover( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
-                                                 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
+  TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
+                                            127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) );
 
   QString aType1, aType2;
@@ -277,7 +241,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     Faces.Append(pp1);
     Faces.Append(pp2);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "cs11" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_11" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_FACE);
   }
@@ -286,7 +250,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     Faces.Append(pp1);
     Faces.Append(pp3);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "cs12" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_12" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
   }
@@ -296,7 +260,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     Faces.Append(pp2);
     Faces.Append(pp4);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "cs13" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_13" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
   }
@@ -307,7 +271,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     Faces.Append(pp4);
     Faces.Append(pp2);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "cs14" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_14" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_FACE);
   }
@@ -319,7 +283,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     Faces.Append(pp1);
     Faces.Append(pp2);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "cs21" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_21" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
   }
@@ -328,7 +292,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     Faces.Append(pp1);
     Faces.Append(pp3);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "cs22" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_22" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
   }
@@ -338,7 +302,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     Faces.Append(pp2);
     Faces.Append(pp4);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "cs23" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_23" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
   }
@@ -349,7 +313,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     Faces.Append(pp4);
     Faces.Append(pp2);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "cs24" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_24" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
   }
@@ -374,7 +338,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     Faces.Append(ff1);
     Faces.Append(ff2);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "cs11_c" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_11" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_FACE);
   }
@@ -383,7 +347,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     Faces.Append(ff1);
     Faces.Append(ff3);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "cs12_c" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_12" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
   }
@@ -393,7 +357,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     Faces.Append(ff2);
     Faces.Append(ff3);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "_cs13" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_13" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
   }
@@ -403,7 +367,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     Faces.Append(ff3);
     Faces.Append(ff2);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "cs14_c" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_14" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
   }
@@ -415,7 +379,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     Faces.Append(ff1);
     Faces.Append(ff2);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "cs21_c" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_21" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
   }
@@ -424,7 +388,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     Faces.Append(ff1);
     Faces.Append(ff3);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "cs22_c" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_22" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
   }
@@ -434,7 +398,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     Faces.Append(ff2);
     Faces.Append(ff3);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "_cs23" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_23" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
   }
@@ -444,7 +408,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     Faces.Append(ff3);
     Faces.Append(ff2);
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
-    TestViewer::show( aMergedFace, AIS_Shaded, true, "cs24_c" );
+    TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_24" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
   }
@@ -471,25 +435,21 @@ void test_HYDROData_LandCoverMap::test_import_dbf()
   // aST.size() == aDBFV.size()!!
   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 << 60 << 10 ) ).Wire();
+  TopoDS_Wire aWire = Wire( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10 );
   aPolyline->SetShape( aWire );
   for (int i = 0; i < 3; i++)
     aMap->Add(aPolyline, "");
-  TopoDS_Face aLC1 = LandCover( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
+  TopoDS_Face aLC1 = Face( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
   
   CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) );
-  QMap<int, int> Inds;
-  Inds.insert(1, 1);
-  Inds.insert(2, 2);
-  Inds.insert(3, 3);
+  QList<int> Inds = QList<int>() << 1 << 2 << 3;
   aMap->ImportDBF(aFileName, "TESTFIELD1", aDBFV, aST, Inds);
   HYDROData_LandCoverMap::Iterator anIt( aMap );
  
-  CPPUNIT_ASSERT_EQUAL(true, "water" == anIt.StricklerType());
+  CPPUNIT_ASSERT_EQUAL( QString( "forest" ), anIt.StricklerType() );
   anIt.Next();
-  CPPUNIT_ASSERT_EQUAL(true, "forest" == anIt.StricklerType());
-
+  CPPUNIT_ASSERT_EQUAL( QString( "road" ), anIt.StricklerType() );
 }
 
 void test_HYDROData_LandCoverMap::test_land_cover_prs_by_types()
@@ -503,22 +463,26 @@ void test_HYDROData_LandCoverMap::test_land_cover_prs_by_types()
   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 );
+  TopoDS_Face aLC1 = Face( 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 );
+  TopoDS_Face aLC2 = Face( 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 );
+  TopoDS_Face aLC3 = Face( 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" ) );
 
+  // build presentation object 
   Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap );
   aPrs->SetTable( aTable );
+  // show presentation in viewer
   TestViewer::show( aPrs, AIS_Shaded, 4, true, "LandCoverMap_PrsByTypes" );
+  // select one of faces (first)
+  TestViewer::select( 200, 300 );
   CPPUNIT_ASSERT_IMAGES
 
   aDoc->Close();
@@ -535,17 +499,17 @@ void test_HYDROData_LandCoverMap::test_land_cover_prs_by_coeff()
   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 );
+  TopoDS_Face aLC1 = Face( 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 );
+  TopoDS_Face aLC2 = Face( 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 );
+  TopoDS_Face aLC3 = Face( 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 );
@@ -558,3 +522,69 @@ void test_HYDROData_LandCoverMap::test_land_cover_prs_by_coeff()
   aDoc->Close();
 }
 
+void test_HYDROData_LandCoverMap::test_dump_python()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+  Handle(HYDROData_LandCoverMap) aMap =
+    Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+  aMap->SetName( "test_LCM" );
+
+  CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
+
+  TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+
+  CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
+
+  TopoDS_Face aLC2 = Face( 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, "test2" ) );
+
+  TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
+                                            127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
+  CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) );
+
+  QString aTmpPath = QDir::tempPath() + "/lc_dump.py";
+  CPPUNIT_ASSERT_EQUAL( true, aDoc->DumpToPython( aTmpPath, false ) );
+
+  //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
+}