From: isn Date: Wed, 31 Aug 2016 14:17:19 +0000 (+0300) Subject: correct test refs; new test (draft!) for pnts classification. X-Git-Tag: v1.6~75^2~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7c7ba3cac8a7177a01cd37a883e4d4a0641b4a7c;p=modules%2Fhydro.git correct test refs; new test (draft!) for pnts classification. --- diff --git a/src/HYDRO_tests/TestViewer.cxx b/src/HYDRO_tests/TestViewer.cxx index 196df1f0..a8599d34 100644 --- a/src/HYDRO_tests/TestViewer.cxx +++ b/src/HYDRO_tests/TestViewer.cxx @@ -261,7 +261,7 @@ bool TestViewer::AssertImages( QString& theMessage ) { QImage anActualImage = viewWindow()->dumpView(); - QString anExpectedRefFilePath = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO"; + QString anExpectedRefFilePath = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test"; anExpectedRefFilePath += "/" + myKey + ".png"; QImage anExpectedRefImage; anExpectedRefImage.load( anExpectedRefFilePath ); @@ -286,6 +286,8 @@ bool TestViewer::AssertImages( QString& theMessage ) QString aDiffFilePath = QDir::tempPath() + "/" + myKey + "_diff.png"; aDiff.save( aDiffFilePath ); + anExpectedRefImage.save( QDir::tempPath() + "/" + myKey + "_1.png"); + return false; } diff --git a/src/HYDRO_tests/reference_data/CLC06-cut_1_res.png b/src/HYDRO_tests/reference_data/CLC06-cut_1_res.png index db50aef8..d58c9fb8 100644 Binary files a/src/HYDRO_tests/reference_data/CLC06-cut_1_res.png and b/src/HYDRO_tests/reference_data/CLC06-cut_1_res.png differ diff --git a/src/HYDRO_tests/reference_data/Channel.png b/src/HYDRO_tests/reference_data/Channel.png index 4f8b7d18..de597b40 100644 Binary files a/src/HYDRO_tests/reference_data/Channel.png and b/src/HYDRO_tests/reference_data/Channel.png differ diff --git a/src/HYDRO_tests/reference_data/Extraction_Channel.png b/src/HYDRO_tests/reference_data/Extraction_Channel.png index 67cc84e4..09ce9a9e 100644 Binary files a/src/HYDRO_tests/reference_data/Extraction_Channel.png and b/src/HYDRO_tests/reference_data/Extraction_Channel.png differ diff --git a/src/HYDRO_tests/reference_data/Extraction_ImmZone.png b/src/HYDRO_tests/reference_data/Extraction_ImmZone.png index d0e58c01..9e919787 100644 Binary files a/src/HYDRO_tests/reference_data/Extraction_ImmZone.png and b/src/HYDRO_tests/reference_data/Extraction_ImmZone.png differ diff --git a/src/HYDRO_tests/reference_data/LCM_copied.png b/src/HYDRO_tests/reference_data/LCM_copied.png index 4494edf5..f02db52f 100644 Binary files a/src/HYDRO_tests/reference_data/LCM_copied.png and b/src/HYDRO_tests/reference_data/LCM_copied.png differ diff --git a/src/HYDRO_tests/reference_data/LCM_split_2a.png b/src/HYDRO_tests/reference_data/LCM_split_2a.png index b725e864..4a7e4419 100644 Binary files a/src/HYDRO_tests/reference_data/LCM_split_2a.png and b/src/HYDRO_tests/reference_data/LCM_split_2a.png differ diff --git a/src/HYDRO_tests/reference_data/LCM_split_2b.png b/src/HYDRO_tests/reference_data/LCM_split_2b.png index bdcd3ad9..e85c19ac 100644 Binary files a/src/HYDRO_tests/reference_data/LCM_split_2b.png and b/src/HYDRO_tests/reference_data/LCM_split_2b.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Add_2_Objects.png b/src/HYDRO_tests/reference_data/LandCoverMap_Add_2_Objects.png index 462d62c4..fa0e260c 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Add_2_Objects.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Add_2_Objects.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Merge_1.png b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_1.png index 565bbef1..7288a5f8 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Merge_1.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_1.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png index 6028686b..4f6daf9a 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_PrsByCoeff.png b/src/HYDRO_tests/reference_data/LandCoverMap_PrsByCoeff.png index 434e98ea..03b73fbe 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_PrsByCoeff.png and b/src/HYDRO_tests/reference_data/LandCoverMap_PrsByCoeff.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_PrsByTypes.png b/src/HYDRO_tests/reference_data/LandCoverMap_PrsByTypes.png index 28b79a46..f940570f 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_PrsByTypes.png and b/src/HYDRO_tests/reference_data/LandCoverMap_PrsByTypes.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png b/src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png index ee5f9f94..dce48726 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png b/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png index 95b07bef..877688be 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png b/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png index f955b137..b34f6477 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Split_Polyline.png b/src/HYDRO_tests/reference_data/LandCoverMap_Split_Polyline.png index a5b80362..98c5e924 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Split_Polyline.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Split_Polyline.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_TransparentPrs.png b/src/HYDRO_tests/reference_data/LandCoverMap_TransparentPrs.png index 69335a2e..e9ac5eec 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_TransparentPrs.png and b/src/HYDRO_tests/reference_data/LandCoverMap_TransparentPrs.png differ diff --git a/src/HYDRO_tests/reference_data/LandCover_Triangles.png b/src/HYDRO_tests/reference_data/LandCover_Triangles.png index a8fa3c1f..b015ee5d 100644 Binary files a/src/HYDRO_tests/reference_data/LandCover_Triangles.png and b/src/HYDRO_tests/reference_data/LandCover_Triangles.png differ diff --git a/src/HYDRO_tests/reference_data/LandCover_Triangles_Split.png b/src/HYDRO_tests/reference_data/LandCover_Triangles_Split.png index bb59e232..175785eb 100644 Binary files a/src/HYDRO_tests/reference_data/LandCover_Triangles_Split.png and b/src/HYDRO_tests/reference_data/LandCover_Triangles_Split.png differ diff --git a/src/HYDRO_tests/reference_data/Merge_Polylines.png b/src/HYDRO_tests/reference_data/Merge_Polylines.png index baed02ce..46e68bed 100644 Binary files a/src/HYDRO_tests/reference_data/Merge_Polylines.png and b/src/HYDRO_tests/reference_data/Merge_Polylines.png differ diff --git a/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.png b/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.png index 519f94a1..34154fd5 100644 Binary files a/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.png and b/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.png differ diff --git a/src/HYDRO_tests/reference_data/Polyline_Presentation.png b/src/HYDRO_tests/reference_data/Polyline_Presentation.png index 938f6f62..1a4f14fd 100644 Binary files a/src/HYDRO_tests/reference_data/Polyline_Presentation.png and b/src/HYDRO_tests/reference_data/Polyline_Presentation.png differ diff --git a/src/HYDRO_tests/reference_data/Shape_preview_im_zone.png b/src/HYDRO_tests/reference_data/Shape_preview_im_zone.png index 9aba0e4a..fd1d1233 100644 Binary files a/src/HYDRO_tests/reference_data/Shape_preview_im_zone.png and b/src/HYDRO_tests/reference_data/Shape_preview_im_zone.png differ diff --git a/src/HYDRO_tests/reference_data/Split_Polylines_Colors.png b/src/HYDRO_tests/reference_data/Split_Polylines_Colors.png index 67aca119..1915908f 100644 Binary files a/src/HYDRO_tests/reference_data/Split_Polylines_Colors.png and b/src/HYDRO_tests/reference_data/Split_Polylines_Colors.png differ diff --git a/src/HYDRO_tests/reference_data/Split_Straight.png b/src/HYDRO_tests/reference_data/Split_Straight.png index 8e109a55..c93ac469 100644 Binary files a/src/HYDRO_tests/reference_data/Split_Straight.png and b/src/HYDRO_tests/reference_data/Split_Straight.png differ diff --git a/src/HYDRO_tests/reference_data/clc_dec_150_350.png b/src/HYDRO_tests/reference_data/clc_dec_150_350.png index 2e143f82..cca57191 100644 Binary files a/src/HYDRO_tests/reference_data/clc_dec_150_350.png and b/src/HYDRO_tests/reference_data/clc_dec_150_350.png differ diff --git a/src/HYDRO_tests/reference_data/cyprus_natural_all.png b/src/HYDRO_tests/reference_data/cyprus_natural_all.png index 4edc22e9..edd084aa 100644 Binary files a/src/HYDRO_tests/reference_data/cyprus_natural_all.png and b/src/HYDRO_tests/reference_data/cyprus_natural_all.png differ diff --git a/src/HYDRO_tests/reference_data/lcm_poly_2_sections.png b/src/HYDRO_tests/reference_data/lcm_poly_2_sections.png index a98e002e..7b7d7fcb 100644 Binary files a/src/HYDRO_tests/reference_data/lcm_poly_2_sections.png and b/src/HYDRO_tests/reference_data/lcm_poly_2_sections.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_11.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_11.png index 1ae7be53..437fd504 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_11.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_11.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_12.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_12.png index e2d0747f..ee6ecb05 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_12.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_12.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_13.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_13.png index b7d0a3f1..341f77fa 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_13.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_13.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_14.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_14.png index 99d05dfc..96d4902e 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_14.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_14.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_21.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_21.png index 8c8d74d2..20a858ea 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_21.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_21.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_22.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_22.png index e2d0747f..ee6ecb05 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_22.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_22.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_23.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_23.png index 09788d1e..10a0acda 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_23.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_23.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_24.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_24.png index a2889ae7..21de11a3 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_24.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_24.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_11.png b/src/HYDRO_tests/reference_data/merge_faces_circles_11.png index 81257c87..2ac1f68b 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_11.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_11.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_12.png b/src/HYDRO_tests/reference_data/merge_faces_circles_12.png index dd7a7c20..9fcbd304 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_12.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_12.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_13.png b/src/HYDRO_tests/reference_data/merge_faces_circles_13.png index 417ef34b..e9c116f9 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_13.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_13.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_14.png b/src/HYDRO_tests/reference_data/merge_faces_circles_14.png index 417ef34b..e9c116f9 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_14.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_14.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_21.png b/src/HYDRO_tests/reference_data/merge_faces_circles_21.png index 86a8172c..d1be8809 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_21.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_21.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_22.png b/src/HYDRO_tests/reference_data/merge_faces_circles_22.png index dd7a7c20..9fcbd304 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_22.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_22.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_23.png b/src/HYDRO_tests/reference_data/merge_faces_circles_23.png index f9d0686d..d0f68c44 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_23.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_23.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_24.png b/src/HYDRO_tests/reference_data/merge_faces_circles_24.png index f9d0686d..d0f68c44 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_24.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_24.png differ diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index 895a52b6..1b71f652 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -47,7 +47,7 @@ #define _DEVDEBUG_ #include "HYDRO_trace.hxx" -const QString REF_DATA_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO"; +const QString REF_DATA_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test"; const QString DEF_STR_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/share/salome/resources/hydro/def_strickler_table.txt"; void test_HYDROData_LandCoverMap::test_add_2_objects() @@ -1145,3 +1145,47 @@ void test_HYDROData_LandCoverMap::test_copy() aDoc->Close(); } + +void test_HYDROData_LandCoverMap::test_shp_clc_classification() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + 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); + 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 = 100; i <= 300; i++ ) + { + TopoDS_Shape aShape = PolygonFaces(i); + if ( aShape.IsNull() ) + continue; + aMapFace2ST.Add( TopoDS::Face( aShape ), "ST_" + QString::number(i) ); + } + + LCM->StoreLandCovers(aMapFace2ST); + //TopoDS_Shape aSh = LCM->GetShape(); + + std::vector pnts; + int N = 100000; + 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++) + { + double px = x0 + (x1-x0)/(double)N; + double py = y0 + (y1-y0)/(double)N; + pnts.push_back(gp_Pnt2d(px,py)); + } + std::vector > TRes; + LCM->ClassifyPoints(pnts, TRes); +} diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h index 85d34bc7..d03ead1b 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h @@ -50,6 +50,7 @@ class test_HYDROData_LandCoverMap : public CppUnit::TestFixture CPPUNIT_TEST( test_shp_import_clc_dec ); CPPUNIT_TEST( test_shp_import_nld_areas ); CPPUNIT_TEST( test_shp_loop_back ); + CPPUNIT_TEST( test_shp_clc_classification ); #endif CPPUNIT_TEST_SUITE_END(); @@ -77,6 +78,7 @@ public: void test_shp_loop_back(); void test_export_telemac(); void test_copy(); + void test_shp_clc_classification(); }; CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_LandCoverMap ); diff --git a/src/HYDRO_tests/test_HYDROData_Main.cxx b/src/HYDRO_tests/test_HYDROData_Main.cxx index c6a979d0..d50bdcf7 100644 --- a/src/HYDRO_tests/test_HYDROData_Main.cxx +++ b/src/HYDRO_tests/test_HYDROData_Main.cxx @@ -68,8 +68,8 @@ int main( int argc, char* argv[] ) CppUnit::TestFactoryRegistry::getRegistry(); // Add the top suite to the test runner TestLib_Runner runner; - //QString aPath = qgetenv( "HYDRO_SRC_DIR" ) + "/src/tests.cfg"; - //runner.Load( aPath.toStdString() ); + QString aPath = qgetenv( "HYDRO_SRC_DIR" ) + "/src/tests.cfg"; + runner.Load( aPath.toStdString() ); runner.addTest( registry.makeTest() ); try { diff --git a/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx b/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx index b4007cea..75281194 100644 --- a/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx +++ b/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx @@ -21,7 +21,7 @@ #include #include -const QString REF_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO"; +const QString REF_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test"; bool test_HYDROData_ShapeFile::compare_two_files(const QString& File1, const QString& File2) {