X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDRO_tests%2Ftest_HYDROData_LandCoverMap.cxx;h=972596d30a85e068bb423ce8e011136d41563f5f;hb=3bece499e83cc9ca95536228c7f6740030e9d5d8;hp=698ea3193fcf465b12081692f8bde642301b5687;hpb=52aef304ea03952de1b815a431b6eca307bc7207;p=modules%2Fhydro.git diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index 698ea319..972596d3 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -43,27 +42,30 @@ #include #include #include +#include +#include -#define _DEVDEBUG_ +//#define _DEVDEBUG_ #include "HYDRO_trace.hxx" -const QString REF_DATA_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO"; -const QString DEF_STR_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/share/salome/resources/hydro/def_strickler_table.txt"; +extern QString REF_DATA_PATH; +const QString DEF_STR_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/share/salome/resources/hydro/def_strickler_table_06.txt"; +extern QString TMP_DIR; void test_HYDROData_LandCoverMap::test_add_2_objects() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() ); - TopoDS_Face aLC1 = Face( QList() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 ); + TopoDS_Face aLC1 = Face2d( QList() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 ); //DEBTRACE("--- ajout test1 " << aLC1); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) ); - TopoDS_Face aLC2 = Face( QList() << 30 << 20 << 60 << 10 << 70 << 35 << 40 << 40 ); + TopoDS_Face aLC2 = Face2d( QList() << 30 << 20 << 60 << 10 << 70 << 35 << 40 << 40 ); //DEBTRACE("--- ajout test2 " << aLC2); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) ); @@ -98,19 +100,19 @@ void test_HYDROData_LandCoverMap::test_add_2_objects() void test_HYDROData_LandCoverMap::test_split() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() ); - TopoDS_Face aLC = Face( QList() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 ); + TopoDS_Face aLC = Face2d( QList() << 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 = Wire( QList() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10, false ); + TopoDS_Wire aWire = Wire2d( QList() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10, false ); aPolyline->SetShape( aWire ); CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) ); @@ -133,19 +135,19 @@ void test_HYDROData_LandCoverMap::test_split() void test_HYDROData_LandCoverMap::test_incomplete_split() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() ); - TopoDS_Face aLC = Face( QList() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 ); + TopoDS_Face aLC = Face2d( QList() << 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 = Wire( QList() << 10 << 40 << 30 << 10 << 40 << 10, false ); + TopoDS_Wire aWire = Wire2d( QList() << 10 << 40 << 30 << 10 << 40 << 10, false ); aPolyline->SetShape( aWire ); CPPUNIT_ASSERT_EQUAL( false, aMap->Split( aPolyline ) ); @@ -165,24 +167,24 @@ void test_HYDROData_LandCoverMap::test_incomplete_split() void test_HYDROData_LandCoverMap::test_merge() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() ); - TopoDS_Face aLC1 = Face( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); + TopoDS_Face aLC1 = Face2d( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) ); - TopoDS_Face aLC2 = Face( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << + TopoDS_Face aLC2 = Face2d( QList() << 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() << 4 << 54 << 1 << 47 << 51 << 45 << + TopoDS_Face aLC3 = Face2d( QList() << 4 << 54 << 1 << 47 << 51 << 45 << 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) ); @@ -210,7 +212,7 @@ void test_HYDROData_LandCoverMap::test_merge() void test_HYDROData_LandCoverMap::test_merge_refs_691() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_PolylineXY) Polyline_4 = Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); @@ -249,7 +251,7 @@ void test_HYDROData_LandCoverMap::test_merge_refs_691() 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() ); @@ -270,24 +272,24 @@ void test_HYDROData_LandCoverMap::test_merge_refs_691() void test_HYDROData_LandCoverMap::test_remove() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() ); - TopoDS_Face aLC1 = Face( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); + TopoDS_Face aLC1 = Face2d( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) ); - TopoDS_Face aLC2 = Face( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << + TopoDS_Face aLC2 = Face2d( QList() << 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() << 4 << 54 << 1 << 47 << 51 << 45 << + TopoDS_Face aLC3 = Face2d( QList() << 4 << 54 << 1 << 47 << 51 << 45 << 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) ); @@ -417,6 +419,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes() BRepCheck_Analyzer aBCA(aMergedFace); CPPUNIT_ASSERT(aBCA.IsValid()); } + } @@ -433,7 +436,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles() CPPUNIT_ASSERT(!ff3.IsNull()); //Test mergeFaces() func // circles // USD == true - { + { TopTools_ListOfShape Faces; Faces.Append(ff1); Faces.Append(ff2); @@ -532,7 +535,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles() void test_HYDROData_LandCoverMap::test_import_dbf() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); @@ -550,13 +553,13 @@ 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 = Wire( QList() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10 ); + TopoDS_Wire aWire = Wire2d( QList() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10 ); aPolyline->SetShape( aWire ); for (int i = 0; i < 3; i++) aMap->Add(aPolyline, ""); - TopoDS_Face aLC1 = Face( QList() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 ); + TopoDS_Face aLC1 = Face2d( QList() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) ); - + CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) ); QList Inds = QList() << 1 << 2 << 3; aMap->ImportDBF(aFileName, "TESTFIELD1", aDBFV, aST, Inds); @@ -568,9 +571,11 @@ void test_HYDROData_LandCoverMap::test_import_dbf() aDoc->Close(); } +#include + void test_HYDROData_LandCoverMap::test_land_cover_prs_by_types() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_StricklerTable) aTable = Handle(HYDROData_StricklerTable)::DownCast( aDoc->CreateObject( KIND_STRICKLER_TABLE ) ); @@ -579,34 +584,49 @@ 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 = Face( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); + TopoDS_Face aLC1 = Face2d( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Zones de champs cultivé à végétation basse")) ); - TopoDS_Face aLC2 = Face( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << + TopoDS_Face aLC2 = Face2d( QList() << 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, QString::fromUtf8("Zones de champs cultivé à végétation haute")) ); - TopoDS_Face aLC3 = Face( QList() << 4 << 54 << 1 << 47 << 51 << 45 << + TopoDS_Face aLC3 = Face2d( QList() << 4 << 54 << 1 << 47 << 51 << 45 << 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, QString::fromUtf8("Zones de champs, prairies, sans cultures")) ); - // build presentation object + // 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 + TestViewer::select( 40, 20 ); + QTest::qWait(1000); + TestViewer::select( 40, 60 ); + QTest::qWait(1000); + TestViewer::select( 80, 60 ); + QTest::qWait(1000); + TestViewer::select( 80, 100 ); + QTest::qWait(1000); + TestViewer::select( 130, 40 ); + QTest::qWait(1000); + TestViewer::select( 130, 60 ); + QTest::qWait(1000); + TestViewer::select( 80, 20 ); + QTest::qWait(1000); + TestViewer::select( 40, 80 ); + QTest::qWait(1000); + 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_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_StricklerTable) aTable = Handle(HYDROData_StricklerTable)::DownCast( aDoc->CreateObject( KIND_STRICKLER_TABLE ) ); @@ -615,16 +635,16 @@ 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 = Face( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); + TopoDS_Face aLC1 = Face2d( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Zones de champs cultivé à végétation basse")) ); - TopoDS_Face aLC2 = Face( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << + TopoDS_Face aLC2 = Face2d( QList() << 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, QString::fromUtf8("Zones de champs cultivé à végétation haute")) ); - TopoDS_Face aLC3 = Face( QList() << 4 << 54 << 1 << 47 << 51 << 45 << + TopoDS_Face aLC3 = Face2d( QList() << 4 << 54 << 1 << 47 << 51 << 45 << 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, QString::fromUtf8("Zones de champs, prairies, sans cultures")) ); @@ -633,6 +653,7 @@ void test_HYDROData_LandCoverMap::test_land_cover_prs_by_coeff() TestViewer::showColorScale( true ); aPrs->SetColorScale( TestViewer::colorScale() ); TestViewer::show( aPrs, AIS_Shaded, 4, true, "LandCoverMap_PrsByCoeff" ); + CPPUNIT_ASSERT_IMAGES TestViewer::showColorScale( false ); @@ -641,7 +662,7 @@ void test_HYDROData_LandCoverMap::test_land_cover_prs_by_coeff() void test_HYDROData_LandCoverMap::test_dump_python() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_StricklerTable) aTable = Handle(HYDROData_StricklerTable)::DownCast( aDoc->CreateObject( KIND_STRICKLER_TABLE ) ); @@ -654,24 +675,24 @@ void test_HYDROData_LandCoverMap::test_dump_python() CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() ); - TopoDS_Face aLC1 = Face( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); + TopoDS_Face aLC1 = Face2d( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) ); - TopoDS_Face aLC2 = Face( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << + TopoDS_Face aLC2 = Face2d( QList() << 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() << 4 << 54 << 1 << 47 << 51 << 45 << + TopoDS_Face aLC3 = Face2d( QList() << 4 << 54 << 1 << 47 << 51 << 45 << 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) ); QString aBaseName = "lc_dump.py"; QString aBaseShp = "lc_dump.shp"; QString aBaseDbf = "lc_dump.dbf"; - QString aTmpPath = QDir::tempPath() + "/" + aBaseName; + QString aTmpPath = TMP_DIR + "/" + aBaseName; CPPUNIT_ASSERT_EQUAL( true, aDoc->DumpToPython( aTmpPath, false ) ); //TODO: CPPUNIT_ASSERT_SCRIPTS_EQUAL( aBaseName, true, false, 20 ); @@ -683,7 +704,7 @@ void test_HYDROData_LandCoverMap::test_dump_python() void test_HYDROData_LandCoverMap::test_transparent_prs() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_StricklerTable) aTable = Handle(HYDROData_StricklerTable)::DownCast( aDoc->CreateObject( KIND_STRICKLER_TABLE ) ); @@ -704,8 +725,8 @@ void test_HYDROData_LandCoverMap::test_transparent_prs() Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); - aMap->LocalPartition( Face( QList() << 1 << 1 << 10 << 10 << 10 << 20 ), QString::fromUtf8("Zones de champs cultivé à végétation haute")); - aMap->LocalPartition( Face( QList() << 5 << 5 << 10 << 5 << 10 << 8 << 5 << 12 << 5 << 8 ), QString::fromUtf8("Zones de champs cultivé à végétation haute")); + aMap->LocalPartition( Face2d( QList() << 1 << 1 << 10 << 10 << 10 << 20 ), QString::fromUtf8("Zones de champs cultivé à végétation haute")); + aMap->LocalPartition( Face2d( QList() << 5 << 5 << 10 << 5 << 10 << 8 << 5 << 12 << 5 << 8 ), QString::fromUtf8("Zones de champs cultivé à végétation haute")); aMap->SetName( "test_LCM" ); TestViewer::show( aZone->GetTopShape(), AIS_Shaded, true, "LandCoverMap_TransparentPrs" ); @@ -718,12 +739,13 @@ void test_HYDROData_LandCoverMap::test_transparent_prs() TestViewer::show( aPrs, AIS_Shaded, 0, true, "" ); CPPUNIT_ASSERT_IMAGES + aDoc->Close(); } void test_HYDROData_LandCoverMap::test_add_triangles() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_PolylineXY) Polyline_1 = Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); @@ -794,7 +816,7 @@ void test_HYDROData_LandCoverMap::test_add_triangles() void test_HYDROData_LandCoverMap::test_assign_to_calc_case() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); @@ -809,24 +831,27 @@ void test_HYDROData_LandCoverMap::test_assign_to_calc_case() void test_HYDROData_LandCoverMap::test_shp_import_cyp() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + //TestViewer::eraseAll(true); + + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); QString aFileName = REF_DATA_PATH + "/cyprus_natural.shp"; HYDROData_ShapeFile anImporter; QStringList PolygonList; TopTools_SequenceOfShape PolygonFaces; - int Type = -1; - int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces, Type); + + int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces); + int Type = anImporter.GetShapeType(); CPPUNIT_ASSERT(aStat == 1); CPPUNIT_ASSERT_EQUAL(5, Type); CPPUNIT_ASSERT_EQUAL(268, PolygonFaces.Length()); - + Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); HYDROData_MapOfFaceToStricklerType aMapFace2ST; - for ( int i = 1; i <= PolygonFaces.Length(); i++ ) + for ( int i = 1; i <= 20; i++ ) { TopoDS_Shape aShape = PolygonFaces(i); - if ( aShape.IsNull() ) + if ( aShape.IsNull() ) continue; aMapFace2ST.Add( TopoDS::Face( aShape ), "" ); } @@ -834,29 +859,31 @@ void test_HYDROData_LandCoverMap::test_shp_import_cyp() LCM->StoreLandCovers(aMapFace2ST); TestViewer::show( LCM->GetShape(), AIS_Shaded, true, "cyprus_natural_all" ); CPPUNIT_ASSERT_IMAGES + aDoc->Close(); } void test_HYDROData_LandCoverMap::test_shp_import_clc_dec() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); QString aFileName = REF_DATA_PATH + "/CLC_decoupe.shp"; HYDROData_ShapeFile anImporter; QStringList PolygonList; TopTools_SequenceOfShape PolygonFaces; - int Type = -1; - int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces, Type); + int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces); + int Type = anImporter.GetShapeType(); + CPPUNIT_ASSERT(aStat == 1); CPPUNIT_ASSERT_EQUAL(5, Type); CPPUNIT_ASSERT_EQUAL(625, PolygonFaces.Length()); - + Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); HYDROData_MapOfFaceToStricklerType aMapFace2ST; - for ( int i = 150; i <= 350; i++ ) + for ( int i = 150; i <= 160; i++ ) { TopoDS_Shape aShape = PolygonFaces(i); - if ( aShape.IsNull() ) + if ( aShape.IsNull() ) continue; aMapFace2ST.Add( TopoDS::Face( aShape ), "" ); } @@ -864,29 +891,30 @@ void test_HYDROData_LandCoverMap::test_shp_import_clc_dec() LCM->StoreLandCovers(aMapFace2ST); TestViewer::show( LCM->GetShape(), AIS_Shaded, true, "clc_dec_150_350" ); CPPUNIT_ASSERT_IMAGES + aDoc->Close(); } void test_HYDROData_LandCoverMap::test_shp_import_nld_areas() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); QString aFileName = REF_DATA_PATH + "/NLD_water_areas_dcw.shp"; HYDROData_ShapeFile anImporter; QStringList PolygonList; TopTools_SequenceOfShape PolygonFaces; - int Type = -1; - int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces, Type); + int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces); + int Type = anImporter.GetShapeType(); CPPUNIT_ASSERT(aStat == 1); CPPUNIT_ASSERT_EQUAL(5, Type); CPPUNIT_ASSERT_EQUAL(127, PolygonFaces.Length()); - + Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); HYDROData_MapOfFaceToStricklerType aMapFace2ST; for ( int i = 1; i <= PolygonFaces.Length(); i++ ) { TopoDS_Shape aShape = PolygonFaces(i); - if ( aShape.IsNull() ) + if ( aShape.IsNull() ) continue; aMapFace2ST.Add( TopoDS::Face( aShape ), "" ); } @@ -894,6 +922,7 @@ void test_HYDROData_LandCoverMap::test_shp_import_nld_areas() LCM->StoreLandCovers(aMapFace2ST); TestViewer::show( LCM->GetShape(), AIS_Shaded, true, "NLD_water_areas_dcw" ); CPPUNIT_ASSERT_IMAGES + aDoc->Close(); } @@ -902,18 +931,17 @@ void test_HYDROData_LandCoverMap::test_shp_loop_back() QString aFFileName = REF_DATA_PATH + "/CLC06-cut_1.shp"; QString aSFileName = REF_DATA_PATH + "/CLC06-cut_1_res.shp"; - //This test verify only some geom data (shp+shx) without any dbf reading/writing + //This test verify only some geom data (shp+shx) without any dbf reading/writing { //DEBTRACE("aFFileName: " << aFFileName.toStdString()); //DEBTRACE("aSFileName: " << aSFileName.toStdString()); - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); HYDROData_ShapeFile anImporter; QStringList PolygonList; TopTools_SequenceOfShape PolygonFaces; - int Type = -1; //import LCM from file (#2-4; #12-14 polygons) - CPPUNIT_ASSERT( anImporter.ImportPolygons(aDoc, aFFileName, PolygonList, PolygonFaces, Type)); + CPPUNIT_ASSERT( anImporter.ImportPolygons(aDoc, aFFileName, PolygonList, PolygonFaces)); Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); HYDROData_MapOfFaceToStricklerType aMapFace2ST; @@ -934,20 +962,18 @@ void test_HYDROData_LandCoverMap::test_shp_loop_back() //export lcm HYDROData_ShapeFile anExporter; QStringList aNonExpList; - anExporter.Export(aSFileName, LCM, aNonExpList); + anExporter.Export(aDoc, aSFileName, LCM, aNonExpList); CPPUNIT_ASSERT (aNonExpList.empty()); aDoc->Close(); } { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); HYDROData_ShapeFile anImporter; QStringList PolygonList; TopTools_SequenceOfShape PolygonFaces; - int Type = -1; - //import all - CPPUNIT_ASSERT( anImporter.ImportPolygons(aDoc, aSFileName, PolygonList, PolygonFaces, Type)); + CPPUNIT_ASSERT( anImporter.ImportPolygons(aDoc, aSFileName, PolygonList, PolygonFaces)); Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); HYDROData_MapOfFaceToStricklerType aMapFace2ST; CPPUNIT_ASSERT_EQUAL(PolygonFaces.Length(), 6); @@ -967,11 +993,13 @@ void test_HYDROData_LandCoverMap::test_shp_loop_back() aDoc->Close(); } CPPUNIT_ASSERT_EQUAL(0, remove(aSFileName.toStdString().c_str())); + TestViewer::eraseAll(true, true); + } void test_HYDROData_LandCoverMap::test_add_2_section_poly() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 ); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_PolylineXY) Polyline_12 = Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); @@ -1001,7 +1029,7 @@ void test_HYDROData_LandCoverMap::test_add_2_section_poly() void test_HYDROData_LandCoverMap::test_split_2() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 ); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_PolylineXY) Polyline_1 = Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); @@ -1074,7 +1102,7 @@ void test_HYDROData_LandCoverMap::test_split_2() void test_HYDROData_LandCoverMap::test_export_telemac() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_StricklerTable) aTable = Handle(HYDROData_StricklerTable)::DownCast( aDoc->CreateObject( KIND_STRICKLER_TABLE ) ); @@ -1083,22 +1111,31 @@ void test_HYDROData_LandCoverMap::test_export_telemac() Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); - TopoDS_Face aLC1 = Face( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); - CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Forêt et végétation arbustive en mutation")) ); + QStringList types = aTable->GetTypes(); + //foreach( QString type, types ) + // std::cout << type.toStdString() << std::endl; + + QString type7 = types[7]; + QString type8 = types[8]; + QString type9 = types[9]; - TopoDS_Face aLC2 = Face( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << + TopoDS_Face aLC1 = Face2d( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); + CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, type7 ) ); + + TopoDS_Face aLC2 = Face2d( QList() << 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, QString::fromUtf8("Forêts de conifères")) ); + CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, type8 ) ); - TopoDS_Face aLC3 = Face( QList() << 4 << 54 << 1 << 47 << 51 << 45 << + TopoDS_Face aLC3 = Face2d( QList() << 4 << 54 << 1 << 47 << 51 << 45 << 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 ); - CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, QString::fromUtf8("Forêts de feuillus")) ); + CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, type9 ) ); QString aTmpFileName = "test.telemac"; - QString aTmpPath = QDir::tempPath() + "/" + aTmpFileName; - CPPUNIT_ASSERT_EQUAL( true, aMap->ExportTelemac( aTmpPath, 1E-4, aTable ) ); + QString aTmpPath = TMP_DIR + "/" + aTmpFileName; + QString messStat; + CPPUNIT_ASSERT_EQUAL( true, aMap->ExportTelemac( aTmpPath, 1E-4, aTable, messStat ) ); CPPUNIT_ASSERT_SCRIPTS_EQUAL( aTmpFileName, true, true, 0 ); aDoc->Close(); @@ -1106,16 +1143,16 @@ void test_HYDROData_LandCoverMap::test_export_telemac() void test_HYDROData_LandCoverMap::test_copy() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); aMap->SetName( "map_1" ); - TopoDS_Face aLC1 = Face( QList() << 10 << 10 << 30 << 10 << 20 << 20 ); + TopoDS_Face aLC1 = Face2d( QList() << 10 << 10 << 30 << 10 << 20 << 20 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Forêts de conifères")) ); - TopoDS_Face aLC2 = Face( QList() << 110 << 10 << 130 << 10 << 120 << 20 ); + TopoDS_Face aLC2 = Face2d( QList() << 110 << 10 << 130 << 10 << 120 << 20 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, QString::fromUtf8("Forêts de feuillus")) ); Handle(HYDROData_LandCoverMap) aMap2 = @@ -1145,3 +1182,203 @@ void test_HYDROData_LandCoverMap::test_copy() aDoc->Close(); } + +void test_HYDROData_LandCoverMap::test_shp_clc_classification_perf() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); + QString aFileName = REF_DATA_PATH + "/CLC_decoupe.shp"; + HYDROData_ShapeFile anImporter; + QStringList PolygonList; + TopTools_SequenceOfShape PolygonFaces; + int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces); + int Type = anImporter.GetShapeType(); + CPPUNIT_ASSERT(aStat == 1); + CPPUNIT_ASSERT_EQUAL(5, Type); + CPPUNIT_ASSERT_EQUAL(625, PolygonFaces.Length()); + + Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); + HYDROData_MapOfFaceToStricklerType aMapFace2ST; + +#ifdef NDEBUG + int SI = 100; + int EI = 110; +#else + int SI = 100; + int EI = 110; +#endif + + for ( int i = SI; i <= EI; i++ ) + { + TopoDS_Shape aShape = PolygonFaces(i); + if ( aShape.IsNull() ) + continue; + aMapFace2ST.Add( TopoDS::Face( aShape ), "ST_" + QString::number(i) ); + } + + LCM->StoreLandCovers(aMapFace2ST); + + std::vector pnts; +#ifdef NDEBUG + int N = 1000; //1000*1000 points; uniform distribution for release mode +#else + int N = 100; +#endif + + pnts.reserve(N); + double x0 = 448646.91897505691; + double x1 = 487420.3990381231; + double y0 = 6373566.5122489957; + double y1 = 6392203.4117361344; + for (size_t i=0; i < N; i++) + { + for (size_t j=0; j < N; j++) + { + double px = x0 + (x1-x0)*((double)i/(double)N); + double py = y0 + (y1-y0)*((double)j/(double)N); + pnts.push_back(gp_XY(px,py)); + } + } + OSD_Timer aTimer; + std::vector > TRes; + aTimer.Start(); + LCM->ClassifyPoints(pnts, TRes); + aTimer.Stop(); +#ifdef NDEBUG + std::cout << "Time: " << aTimer.ElapsedTime() << std::endl; + CPPUNIT_ASSERT( aTimer.ElapsedTime() < 6.0); + aTimer.Show(); +#endif +} + +void test_HYDROData_LandCoverMap::test_shp_clc_classification_check() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); + QString aFileName = REF_DATA_PATH + "/CLC_decoupe.shp"; + HYDROData_ShapeFile anImporter; + QStringList PolygonList; + TopTools_SequenceOfShape PolygonFaces; + int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces); + CPPUNIT_ASSERT(aStat == 1); + Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); + HYDROData_MapOfFaceToStricklerType aMapFace2ST; + + aMapFace2ST.Add( TopoDS::Face( PolygonFaces(172) ), "Tissu urbain continu" ); + aMapFace2ST.Add( TopoDS::Face( PolygonFaces(179) ), "Aéroports" ); + aMapFace2ST.Add( TopoDS::Face( PolygonFaces(185) ), "Rizières" ); + aMapFace2ST.Add( TopoDS::Face( PolygonFaces(187) ), "Vignobles" ); + aMapFace2ST.Add( TopoDS::Face( PolygonFaces(190) ), "Oliveraies" ); + aMapFace2ST.Add( TopoDS::Face( PolygonFaces(196) ), "Estuaires" ); + + LCM->StoreLandCovers(aMapFace2ST); + + TopoDS_Shape Sh = LCM->GetShape(); + + std::vector pnts; + pnts.push_back(gp_XY(0,0)); + + pnts.push_back(gp_XY(468380, 6382300)); + pnts.push_back(gp_XY(468380, 6382900)); + pnts.push_back(gp_XY(468380, 6383200)); + pnts.push_back(gp_XY(468250, 6384700)); + pnts.push_back(gp_XY(470350, 6384700)); + pnts.push_back(gp_XY(469279.642874048, 6385132.45048612 )); + + std::vector > TRes; + LCM->ClassifyPoints(pnts, TRes); + + CPPUNIT_ASSERT (TRes[0].empty()); + CPPUNIT_ASSERT (TRes[1].empty()); + CPPUNIT_ASSERT (TRes[2].empty()); + CPPUNIT_ASSERT_EQUAL (*TRes[3].begin(), QString("Estuaires")); + CPPUNIT_ASSERT_EQUAL (*TRes[4].begin(), QString("Oliveraies")); + CPPUNIT_ASSERT_EQUAL (*TRes[5].begin(), QString("Vignobles")); + + //std::less comparator; so compare first and second elem safely + CPPUNIT_ASSERT_EQUAL (*TRes[6].begin(), QString("Estuaires")); + CPPUNIT_ASSERT_EQUAL (*(++TRes[6].begin()), QString("Tissu urbain continu")); + + /// + Handle(HYDROData_StricklerTable) aTable = Handle(HYDROData_StricklerTable)::DownCast( aDoc->CreateObject( KIND_STRICKLER_TABLE ) ); + CPPUNIT_ASSERT_EQUAL( true, aTable->Import( DEF_STR_PATH ) ); + std::vector coeffs; + LCM->ClassifyPoints(pnts, aTable, coeffs, 0.0, true); + + CPPUNIT_ASSERT_EQUAL (coeffs[0], 0.0); + CPPUNIT_ASSERT_EQUAL (coeffs[1], 0.0); + CPPUNIT_ASSERT_EQUAL (coeffs[2], 0.0); + CPPUNIT_ASSERT_EQUAL (coeffs[3], 98.0); + CPPUNIT_ASSERT_EQUAL (coeffs[4], 26.0); + CPPUNIT_ASSERT_EQUAL (coeffs[5], 24.0); + CPPUNIT_ASSERT_EQUAL (coeffs[6], 98.0); + +} + +void test_HYDROData_LandCoverMap::test_lcm_classification() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); + + 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) ContourP = Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); + ContourP->SetName( "Contour" ); + ContourP->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true ); + ContourP->AddPoint( 0, gp_XY( 89.57, 81.63 ) ); + ContourP->AddPoint( 0, gp_XY( 479.59, 81.63 ) ); + ContourP->AddPoint( 0, gp_XY( 472.79, 671.20 ) ); + ContourP->AddPoint( 0, gp_XY( 69.16, 696.15 ) ); + ContourP->Update(); + + Handle(HYDROData_PolylineXY) Poly_Sens_TrigoP = + Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); + Poly_Sens_TrigoP->SetName( "Poly_Sens_Trigo" ); + Poly_Sens_TrigoP->SetZLevel( 3 ); + Poly_Sens_TrigoP->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, 1 ); + Poly_Sens_TrigoP->AddPoint( 0, gp_XY( 130.46, 223.57 ) ); + Poly_Sens_TrigoP->AddPoint( 0, gp_XY( 252.16, 239.58 ) ); + Poly_Sens_TrigoP->AddPoint( 0, gp_XY( 240.95, 498.99 ) ); + Poly_Sens_TrigoP->AddPoint( 0, gp_XY( 119.26, 510.20 ) ); + Poly_Sens_TrigoP->AddPoint( 0, gp_XY( 141.67, 378.89 ) ); + Poly_Sens_TrigoP->Update(); + + Handle(HYDROData_PolylineXY) Polyline_Sens_HoraireP = + Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); + Polyline_Sens_HoraireP->SetName( "Polyline_Sens_Horaire" ); + Polyline_Sens_HoraireP->SetZLevel( 4 ); + Polyline_Sens_HoraireP->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, 1 ); + Polyline_Sens_HoraireP->AddPoint( 0, gp_XY( 313.01, 470.16 ) ); + Polyline_Sens_HoraireP->AddPoint( 0, gp_XY( 313.01, 627.09 ) ); + Polyline_Sens_HoraireP->AddPoint( 0, gp_XY( 426.70, 633.49 ) ); + Polyline_Sens_HoraireP->AddPoint( 0, gp_XY( 442.71, 398.11 ) ); + Polyline_Sens_HoraireP->Update(); + + + Handle(HYDROData_LandCoverMap) Land_cover_map_1 = + Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); + Land_cover_map_1->SetName( "Land cover map_1" ); + Land_cover_map_1->SetZLevel( 2 ); + CPPUNIT_ASSERT_EQUAL( true, Land_cover_map_1->Add( ContourP, "Vignobles" ) ); + CPPUNIT_ASSERT_EQUAL( true, Land_cover_map_1->Add( Poly_Sens_TrigoP, "Oliveraies" ) ); + CPPUNIT_ASSERT_EQUAL( true, Land_cover_map_1->Add( Polyline_Sens_HoraireP, "Estuaires" ) ); + + Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( Land_cover_map_1 ); + TopoDS_Shape aSh = Land_cover_map_1->GetShape(); + TestViewer::show( aPrs, AIS_Shaded, 0, true, "Land_cover_map_1" ); + + std::vector pnts; + pnts.push_back(gp_XY(90, 90)); + pnts.push_back(gp_XY(300, 90)); + pnts.push_back(gp_XY(200, 350)); + pnts.push_back(gp_XY(400, 500)); + std::vector theCoeffs; + Land_cover_map_1->ClassifyPoints(pnts, aTable, theCoeffs, -1, true ); + CPPUNIT_ASSERT_EQUAL((int)theCoeffs.size(), 4); + CPPUNIT_ASSERT_DOUBLES_EQUAL(theCoeffs[0], 24, 0.0001); + CPPUNIT_ASSERT_DOUBLES_EQUAL(theCoeffs[1], 24, 0.0001); + CPPUNIT_ASSERT_DOUBLES_EQUAL(theCoeffs[2], 26, 0.0001); + CPPUNIT_ASSERT_DOUBLES_EQUAL(theCoeffs[3], 98, 0.0001); + + aDoc->Close(); +} +