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=1423827be9b2817ff34e009dc9a28992e3d0015b;hpb=f03c1085ac43b0c7c3df58a6feb1d2b1b4b2fb3f;p=modules%2Fhydro.git diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index 1423827b..972596d3 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -45,7 +45,7 @@ #include #include -#define _DEVDEBUG_ +//#define _DEVDEBUG_ #include "HYDRO_trace.hxx" extern QString REF_DATA_PATH; @@ -251,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() ); @@ -419,6 +419,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces_boxes() BRepCheck_Analyzer aBCA(aMergedFace); CPPUNIT_ASSERT(aBCA.IsValid()); } + } @@ -435,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); @@ -558,7 +559,7 @@ void test_HYDROData_LandCoverMap::test_import_dbf() aMap->Add(aPolyline, ""); 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); @@ -569,7 +570,9 @@ 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(); @@ -594,31 +597,30 @@ void test_HYDROData_LandCoverMap::test_land_cover_prs_by_types() 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 ); + TestViewer::select( 40, 20 ); QTest::qWait(1000); - TestViewer::select( 220, 300 ); + TestViewer::select( 40, 60 ); QTest::qWait(1000); - TestViewer::select( 250, 300 ); + TestViewer::select( 80, 60 ); QTest::qWait(1000); - TestViewer::select( 300, 300 ); + TestViewer::select( 80, 100 ); QTest::qWait(1000); - TestViewer::select( 200, 350 ); + TestViewer::select( 130, 40 ); QTest::qWait(1000); - TestViewer::select( 200, 500 ); + TestViewer::select( 130, 60 ); QTest::qWait(1000); - TestViewer::select( 250, 400 ); + TestViewer::select( 80, 20 ); QTest::qWait(1000); - TestViewer::select( 300, 99 ); + TestViewer::select( 40, 80 ); QTest::qWait(1000); CPPUNIT_ASSERT_IMAGES - TestViewer::eraseAll(true, true); aDoc->Close(); } @@ -737,6 +739,7 @@ void test_HYDROData_LandCoverMap::test_transparent_prs() TestViewer::show( aPrs, AIS_Shaded, 0, true, "" ); CPPUNIT_ASSERT_IMAGES + aDoc->Close(); } @@ -841,14 +844,14 @@ void test_HYDROData_LandCoverMap::test_shp_import_cyp() 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 <= 20; i++ ) { TopoDS_Shape aShape = PolygonFaces(i); - if ( aShape.IsNull() ) + if ( aShape.IsNull() ) continue; aMapFace2ST.Add( TopoDS::Face( aShape ), "" ); } @@ -856,6 +859,7 @@ 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(); } @@ -872,14 +876,14 @@ void test_HYDROData_LandCoverMap::test_shp_import_clc_dec() 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 <= 160; i++ ) { TopoDS_Shape aShape = PolygonFaces(i); - if ( aShape.IsNull() ) + if ( aShape.IsNull() ) continue; aMapFace2ST.Add( TopoDS::Face( aShape ), "" ); } @@ -887,6 +891,7 @@ 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(); } @@ -902,14 +907,14 @@ void test_HYDROData_LandCoverMap::test_shp_import_nld_areas() 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 ), "" ); } @@ -917,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(); } @@ -925,7 +931,7 @@ 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()); @@ -987,6 +993,8 @@ 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() @@ -1187,7 +1195,7 @@ void test_HYDROData_LandCoverMap::test_shp_clc_classification_perf() 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; @@ -1202,7 +1210,7 @@ void test_HYDROData_LandCoverMap::test_shp_clc_classification_perf() for ( int i = SI; i <= EI; i++ ) { TopoDS_Shape aShape = PolygonFaces(i); - if ( aShape.IsNull() ) + if ( aShape.IsNull() ) continue; aMapFace2ST.Add( TopoDS::Face( aShape ), "ST_" + QString::number(i) ); } @@ -1231,7 +1239,7 @@ void test_HYDROData_LandCoverMap::test_shp_clc_classification_perf() } } OSD_Timer aTimer; - std::vector > TRes; + std::vector > TRes; aTimer.Start(); LCM->ClassifyPoints(pnts, TRes); aTimer.Stop(); @@ -1260,7 +1268,7 @@ void test_HYDROData_LandCoverMap::test_shp_clc_classification_check() 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(); @@ -1275,7 +1283,7 @@ void test_HYDROData_LandCoverMap::test_shp_clc_classification_check() pnts.push_back(gp_XY(470350, 6384700)); pnts.push_back(gp_XY(469279.642874048, 6385132.45048612 )); - std::vector > TRes; + std::vector > TRes; LCM->ClassifyPoints(pnts, TRes); CPPUNIT_ASSERT (TRes[0].empty()); @@ -1331,7 +1339,7 @@ void test_HYDROData_LandCoverMap::test_lcm_classification() 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->AddPoint( 0, gp_XY( 141.67, 378.89 ) ); Poly_Sens_TrigoP->Update(); Handle(HYDROData_PolylineXY) Polyline_Sens_HoraireP =