Salome HOME
Merge branch 'BR_LAND_COVER_MAP' into BR_quadtree
[modules/hydro.git] / src / HYDRO_tests / test_HYDROData_LandCoverMap.cxx
index a64ed48016064057184f6a3e132cee902b065586..83345f84f23a6bc5c5116caba53b76c7e9b8bae6 100644 (file)
@@ -35,6 +35,7 @@
 #include <TopTools_ListOfShape.hxx>
 #include <AIS_DisplayMode.hxx>
 #include <Aspect_ColorScale.hxx>
+#include <BRepMesh_IncrementalMesh.hxx>
 #include <QString>
 #include <QColor>
 #include <QMap>
@@ -64,7 +65,7 @@ void test_HYDROData_LandCoverMap::test_add_2_objects()
   TestViewer::show( aMap->GetShape(), AIS_Shaded, true, "LandCoverMap_Add_2_Objects" );
   CPPUNIT_ASSERT_IMAGES
 
-  HYDROData_LandCoverMap::Iterator anIt( aMap );
+  HYDROData_LandCoverMap::Explorer anIt( aMap );
   CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
   CPPUNIT_ASSERT_EQUAL( QString( "test1" ), anIt.StricklerType() );
   anIt.Next();
@@ -99,7 +100,7 @@ void test_HYDROData_LandCoverMap::test_split()
   TestViewer::show( aWire, 0, true, Qt::blue );
   CPPUNIT_ASSERT_IMAGES
 
-  HYDROData_LandCoverMap::Iterator anIt( aMap );
+  HYDROData_LandCoverMap::Explorer anIt( aMap );
   CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
   CPPUNIT_ASSERT_EQUAL( QString( "test1" ), anIt.StricklerType() );
   anIt.Next();
@@ -134,7 +135,7 @@ void test_HYDROData_LandCoverMap::test_incomplete_split()
   TestViewer::show( aWire, 0, true, Qt::green );
   CPPUNIT_ASSERT_IMAGES
 
-  HYDROData_LandCoverMap::Iterator anIt( aMap );
+  HYDROData_LandCoverMap::Explorer anIt( aMap );
   CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
   CPPUNIT_ASSERT_EQUAL( QString( "test1" ), anIt.StricklerType() );
   anIt.Next();
@@ -188,6 +189,66 @@ void test_HYDROData_LandCoverMap::test_merge()
   aDoc->Close();
 }
 
+void test_HYDROData_LandCoverMap::test_merge_refs_691()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+  Handle(HYDROData_PolylineXY) Polyline_4 =
+    Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+  Polyline_4->SetName( "test_Polyline_4" );
+  Polyline_4->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+  Polyline_4->AddPoint( 0, gp_XY( -242.741935, -16.129032 ) );
+  Polyline_4->AddPoint( 0, gp_XY( -339.516129, -95.161290 ) );
+  Polyline_4->AddPoint( 0, gp_XY( -204.032258, -167.740000 ) );
+  Polyline_4->AddPoint( 0, gp_XY( -86.290000, -158.060000 ) );
+  Polyline_4->AddPoint( 0, gp_XY( -83.064516, -37.096774 ) );
+  Polyline_4->AddPoint( 0, gp_XY( -116.935484, 17.741935 ) );
+  Polyline_4->AddSection( "Section_2", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+  Polyline_4->AddPoint( 1, gp_XY( -239.516129, -295.161290 ) );
+  Polyline_4->AddPoint( 1, gp_XY( -204.030000, -167.740000 ) );
+  Polyline_4->AddPoint( 1, gp_XY( -86.290000, -158.060000 ) );
+  Polyline_4->AddPoint( 1, gp_XY( -2.419355, -288.709677 ) );
+  Polyline_4->AddPoint( 1, gp_XY( -165.322581, -351.612903 ) );
+  Polyline_4->Update();
+
+  Handle(HYDROData_LandCoverMap) aMap =
+    Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+
+  CPPUNIT_ASSERT_EQUAL( true, aMap->Add( Polyline_4, "test" ) );
+
+  TopTools_ListOfShape aList;
+  HYDROData_LandCoverMap::Explorer anIt( aMap );
+  CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+  CPPUNIT_ASSERT_EQUAL( QString( "test" ), anIt.StricklerType() );
+  aList.Append( anIt.Face() );
+  anIt.Next();
+  CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+  CPPUNIT_ASSERT_EQUAL( QString( "test" ), anIt.StricklerType() );
+  aList.Append( anIt.Face() );
+  anIt.Next();
+  CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
+
+  BRepCheck_Analyzer aCheck1( aMap->GetShape() );
+  CPPUNIT_ASSERT_EQUAL( true, (bool)aCheck1.IsValid() );
+  
+  CPPUNIT_ASSERT_EQUAL( true, aMap->Merge( aList, "test" ) );
+
+  BRepCheck_Analyzer aCheck2( aMap->GetShape() );
+  CPPUNIT_ASSERT_EQUAL( true, (bool)aCheck2.IsValid() );
+
+  // we try construct the triangulation to check that it is correct
+  BRepMesh_IncrementalMesh anIncMesh( aMap->GetShape(), 0.01 );
+  CPPUNIT_ASSERT_EQUAL( true, (bool)anIncMesh.IsDone() );
+  BRepCheck_Analyzer aCheck3( aMap->GetShape() );
+  CPPUNIT_ASSERT_EQUAL( true, (bool)aCheck3.IsValid() );
+
+  Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap );
+  TestViewer::show( aPrs, AIS_Shaded, 0, true, "LandCoverMap_Merge_2" );
+  CPPUNIT_ASSERT_IMAGES
+
+  aDoc->Close();
+}
+
 void test_HYDROData_LandCoverMap::test_remove()
 {
   Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
@@ -248,6 +309,8 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_11" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_FACE);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
   {
     TopTools_ListOfShape Faces;
@@ -256,7 +319,9 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_12" );
     CPPUNIT_ASSERT_IMAGES
-    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
+    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_COMPOUND);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
   {
     TopTools_ListOfShape Faces;
@@ -266,7 +331,9 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_13" );
     CPPUNIT_ASSERT_IMAGES
-    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
+    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_COMPOUND);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
   {
     TopTools_ListOfShape Faces;
@@ -278,6 +345,8 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_14" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_FACE);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
   //
 
@@ -290,6 +359,8 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_21" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
   {
     TopTools_ListOfShape Faces;
@@ -298,7 +369,9 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_22" );
     CPPUNIT_ASSERT_IMAGES
-    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
+    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_COMPOUND);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
   {
     TopTools_ListOfShape Faces;
@@ -308,7 +381,9 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_23" );
     CPPUNIT_ASSERT_IMAGES
-    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
+    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_COMPOUND);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
   {
     TopTools_ListOfShape Faces;
@@ -320,6 +395,8 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_24" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
 }
 
@@ -345,6 +422,8 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_11" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_FACE);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
   {
     TopTools_ListOfShape Faces;
@@ -353,7 +432,9 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_12" );
     CPPUNIT_ASSERT_IMAGES
-    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
+    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_COMPOUND);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
   {
     TopTools_ListOfShape Faces;
@@ -363,7 +444,9 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_13" );
     CPPUNIT_ASSERT_IMAGES
-    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
+    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_COMPOUND);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
   {
     TopTools_ListOfShape Faces;
@@ -373,7 +456,9 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_14" );
     CPPUNIT_ASSERT_IMAGES
-    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
+    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_COMPOUND);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
   //
 
@@ -386,6 +471,8 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_21" );
     CPPUNIT_ASSERT_IMAGES
     CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
   {
     TopTools_ListOfShape Faces;
@@ -394,7 +481,9 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_22" );
     CPPUNIT_ASSERT_IMAGES
-    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
+    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_COMPOUND);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
   {
     TopTools_ListOfShape Faces;
@@ -404,7 +493,9 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_23" );
     CPPUNIT_ASSERT_IMAGES
-    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
+    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_COMPOUND);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
   {
     TopTools_ListOfShape Faces;
@@ -414,7 +505,9 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles()
     TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
     TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_24" );
     CPPUNIT_ASSERT_IMAGES
-    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
+    CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_COMPOUND);
+    BRepCheck_Analyzer aBCA(aMergedFace);
+    CPPUNIT_ASSERT(aBCA.IsValid());
   }
 }
 
@@ -448,8 +541,7 @@ void test_HYDROData_LandCoverMap::test_import_dbf()
   CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) );
   QList<int> Inds = QList<int>() << 1 << 2 << 3;
   aMap->ImportDBF(aFileName, "TESTFIELD1", aDBFV, aST, Inds);
-  HYDROData_LandCoverMap::Iterator anIt( aMap );
+  HYDROData_LandCoverMap::Explorer anIt( aMap );
   CPPUNIT_ASSERT_EQUAL( QString( "forest" ), anIt.StricklerType() );
   anIt.Next();
   CPPUNIT_ASSERT_EQUAL( QString( "road" ), anIt.StricklerType() );
@@ -519,7 +611,8 @@ void test_HYDROData_LandCoverMap::test_land_cover_prs_by_coeff()
 
   Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap );
   aPrs->SetTable( aTable );
-  aPrs->SetColorScale( TestViewer::showColorScale( true ) );
+  TestViewer::showColorScale( true );
+  aPrs->SetColorScale( TestViewer::colorScale() );
   TestViewer::show( aPrs, AIS_Shaded, 4, true, "LandCoverMap_PrsByCoeff" );
   CPPUNIT_ASSERT_IMAGES
 
@@ -531,6 +624,11 @@ void test_HYDROData_LandCoverMap::test_dump_python()
 {
   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 ) );
+  aTable->SetName( "DefStr" );
+
   Handle(HYDROData_LandCoverMap) aMap =
     Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
   aMap->SetName( "test_LCM" );
@@ -551,10 +649,15 @@ void test_HYDROData_LandCoverMap::test_dump_python()
                                             127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) );
 
-  QString aTmpPath = QDir::tempPath() + "/lc_dump.py";
+  QString aBaseName = "lc_dump.py";
+  QString aBaseShp = "lc_dump.shp";
+  QString aBaseDbf = "lc_dump.dbf";
+  QString aTmpPath = QDir::tempPath() + "/" + aBaseName;
   CPPUNIT_ASSERT_EQUAL( true, aDoc->DumpToPython( aTmpPath, false ) );
 
-  //TODO: compare files
+  //TODO: CPPUNIT_ASSERT_SCRIPTS_EQUAL( aBaseName, true, false, 20 );
+  //TODO: CPPUNIT_ASSERT_FILES_EQUAL( aBaseShp );
+  //TODO: CPPUNIT_ASSERT_FILES_EQUAL( aBaseDbf );
 
   aDoc->Close();
 }
@@ -588,9 +691,11 @@ void test_HYDROData_LandCoverMap::test_transparent_prs()
 
   TestViewer::show( aZone->GetTopShape(), AIS_Shaded, true, "LandCoverMap_TransparentPrs" );
 
+  aMap->SetTransparency( 0.5 );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.5, aMap->GetTransparency(), 1E-6 );
+
   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
@@ -656,6 +761,7 @@ void test_HYDROData_LandCoverMap::test_add_triangles()
   CPPUNIT_ASSERT_EQUAL( true, aMap->Add( Polyline_4, "" ) );
 
   Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap );
+  TopoDS_Shape aSh = aMap->GetShape();
   TestViewer::show( aPrs, AIS_Shaded, 0, true, "LandCover_Triangles" );
   CPPUNIT_ASSERT_IMAGES
 
@@ -841,3 +947,179 @@ void test_HYDROData_LandCoverMap::test_shp_loop_back()
   CPPUNIT_ASSERT_EQUAL(0, remove(aSFileName.toStdString().c_str()));
 }
 
+void test_HYDROData_LandCoverMap::test_add_2_section_poly()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
+
+  Handle(HYDROData_PolylineXY) Polyline_12 =
+    Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+  Polyline_12->SetName( "Polyline_12" );
+
+  Polyline_12->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+  Polyline_12->AddPoint( 0, gp_XY( -148.70, 145.68 ) );
+  Polyline_12->AddPoint( 0, gp_XY( -81.71, 210.97 ) );
+  Polyline_12->AddPoint( 0, gp_XY( -21.09, 122.79 ) );
+  Polyline_12->AddPoint( 0, gp_XY( -106.30, 102.44 ) );
+  Polyline_12->AddSection( "Section_2", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+  Polyline_12->AddPoint( 1, gp_XY( -7.09, 227.08 ) );
+  Polyline_12->AddPoint( 1, gp_XY( 46.32, 228.78 ) );
+  Polyline_12->AddPoint( 1, gp_XY( 69.64, 165.61 ) );
+  Polyline_12->AddPoint( 1, gp_XY( 13.68, 156.28 ) );
+
+  Polyline_12->Update();
+
+  Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+  CPPUNIT_ASSERT_EQUAL( true, LCM->Add( Polyline_12, "" ) );
+
+  TestViewer::show( LCM->GetShape(), AIS_Shaded, true, "lcm_poly_2_sections" );
+  CPPUNIT_ASSERT_IMAGES
+
+  aDoc->Close();
+}
+
+void test_HYDROData_LandCoverMap::test_split_2()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
+
+  Handle(HYDROData_PolylineXY) Polyline_1 =
+    Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+  Polyline_1->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+  Polyline_1->AddPoint( 0, gp_XY( -264.84, 323.44 ) );
+  Polyline_1->AddPoint( 0, gp_XY( 254.45, 301.19 ) );
+  Polyline_1->AddPoint( 0, gp_XY( -291.54, -47.48 ) );
+  Polyline_1->Update();
+
+  Handle(HYDROData_PolylineXY) Polyline_6 =
+    Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+  Polyline_6->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+  Polyline_6->AddPoint( 0, gp_XY( -155.15, 199.47 ) );
+  Polyline_6->AddPoint( 0, gp_XY( -71.19, 289.12 ) );
+  Polyline_6->AddPoint( 0, gp_XY( 22.01, 211.57 ) );
+  Polyline_6->AddPoint( 0, gp_XY( -84.00, 134.73 ) );
+  Polyline_6->Update();
+
+  Handle(HYDROData_PolylineXY) Polyline_7 =
+    Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+  Polyline_7->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+  Polyline_7->AddPoint( 0, gp_XY( -50.56, 232.20 ) );
+  Polyline_7->AddPoint( 0, gp_XY( 40.51, 286.98 ) );
+  Polyline_7->AddPoint( 0, gp_XY( 118.77, 256.39 ) );
+  Polyline_7->AddPoint( 0, gp_XY( 72.52, 114.10 ) );
+  Polyline_7->Update();
+
+  Handle(HYDROData_PolylineXY) Polyline_8 =
+    Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+  Polyline_8->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+  Polyline_8->AddPoint( 0, gp_XY( -44.16, 190.93 ) );
+  Polyline_8->AddPoint( 0, gp_XY( 9.91, 226.51 ) );
+  Polyline_8->AddPoint( 0, gp_XY( 35.53, 175.99 ) );
+  Polyline_8->AddPoint( 0, gp_XY( -9.30, 157.50 ) );
+  Polyline_8->Update();
+
+  Handle(HYDROData_PolylineXY) Polyline_9 =
+    Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+  Polyline_9->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, false );
+  Polyline_9->AddPoint( 0, gp_XY( -103.92, 288.40 ) );
+  Polyline_9->AddPoint( 0, gp_XY( -100.09, 285.22 ) );
+  Polyline_9->AddPoint( 0, gp_XY( -96.10, 281.90 ) );
+  Polyline_9->AddPoint( 0, gp_XY( -90.43, 277.19 ) );
+  Polyline_9->AddPoint( 0, gp_XY( -53.41, 246.43 ) );
+  Polyline_9->AddPoint( 0, gp_XY( 10.62, 245.01 ) );
+
+
+  Polyline_9->Update();
+
+
+  Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+  CPPUNIT_ASSERT_EQUAL( true, LCM->Add( Polyline_1, "" ) );
+  CPPUNIT_ASSERT_EQUAL( true, LCM->Add( Polyline_6, "" ) );
+  CPPUNIT_ASSERT_EQUAL( true, LCM->Add( Polyline_7, "" ) );
+
+  CPPUNIT_ASSERT_EQUAL( true, LCM->Split( Polyline_9 ) );
+
+  //Handle(HYDROGUI_LandCoverMapPrs) aPrs1 = new HYDROGUI_LandCoverMapPrs( LCM );
+  TestViewer::show( LCM->GetShape(), AIS_Shaded, /*0,*/ true, "LCM_split_2a" );
+  CPPUNIT_ASSERT_IMAGES
+
+  CPPUNIT_ASSERT_EQUAL( true, LCM->Split( Polyline_8 ) );
+
+  // Handle(HYDROGUI_LandCoverMapPrs) aPrs2 = new HYDROGUI_LandCoverMapPrs( LCM );
+  TestViewer::show( LCM->GetShape(), AIS_Shaded, /*0,*/ true, "LCM_split_2b" );
+  CPPUNIT_ASSERT_IMAGES
+
+  aDoc->Close();
+}
+
+void test_HYDROData_LandCoverMap::test_export_telemac()
+{
+  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 = 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 = 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 = 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" ) );
+
+  QString aTmpFileName = "test.telemac";
+  QString aTmpPath = QDir::tempPath() + "/" + aTmpFileName;
+  CPPUNIT_ASSERT_EQUAL( true, aMap->ExportTelemac( aTmpPath, 1E-4, aTable ) );
+  CPPUNIT_ASSERT_SCRIPTS_EQUAL( aTmpFileName, true, true, 0 );
+
+  aDoc->Close();
+}
+
+void test_HYDROData_LandCoverMap::test_copy()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+  Handle(HYDROData_LandCoverMap) aMap =
+    Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+  aMap->SetName( "map_1" );
+
+  TopoDS_Face aLC1 = Face( QList<double>() << 10 << 10 << 30 << 10 << 20 << 20 );
+  CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "Zones de champs cultivé à végétation basse" ) );
+
+  TopoDS_Face aLC2 = Face( QList<double>() << 110 << 10 << 130 << 10 << 120 << 20 );
+  CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "Zones de champs cultivé à végétation haute" ) );
+
+  Handle(HYDROData_LandCoverMap) aMap2 =
+    Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+  aMap->CopyTo( aMap2, true );
+
+  CPPUNIT_ASSERT_EQUAL( QString( "map_2" ), aMap2->GetName() );
+  HYDROData_LandCoverMap::Explorer anIt( aMap2 );
+  CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+  CPPUNIT_ASSERT_EQUAL( QString( "Zones de champs cultivé à végétation basse" ), anIt.StricklerType() );
+  CPPUNIT_ASSERT( anIt.Face().TShape()!=aLC1.TShape() );
+  anIt.Next();
+  CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+  CPPUNIT_ASSERT_EQUAL( QString( "Zones de champs cultivé à végétation haute" ), anIt.StricklerType() );
+  CPPUNIT_ASSERT( anIt.Face().TShape()!=aLC2.TShape() );
+  anIt.Next();
+  CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
+
+  TopoDS_Shape aShape1 = aMap->GetShape();
+  TopoDS_Shape aShape2 = aMap2->GetShape();
+  gp_Trsf aTr;
+  aTr.SetTranslation( gp_Vec( 0, 50, 0 ) );
+  aShape2.Move( TopLoc_Location( aTr ) );
+  TestViewer::show( aShape1, AIS_Shaded, /*0,*/ true, "LCM_copied" );
+  TestViewer::show( aShape2, AIS_Shaded, /*0,*/ true, "" );
+  CPPUNIT_ASSERT_IMAGES
+
+  aDoc->Close();
+}