Salome HOME
Correction for hydro_test
[modules/hydro.git] / src / HYDRO_tests / test_HYDROData_LandCoverMap.cxx
index e2a01d9e27dc4b39526012a58235d9a01838339e..972596d30a85e068bb423ce8e011136d41563f5f 100644 (file)
@@ -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<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
-  
+
   CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) );
   QList<int> Inds = QList<int>() << 1 << 2 << 3;
   aMap->ImportDBF(aFileName, "TESTFIELD1", aDBFV, aST, Inds);
@@ -569,7 +570,9 @@ void test_HYDROData_LandCoverMap::test_import_dbf()
 
   aDoc->Close();
 }
+
 #include <QTest>
+
 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<std::set <QString> > TRes;  
+  std::vector<std::set <QString> > 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<std::set <QString> > TRes;  
+  std::vector<std::set <QString> > 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 =