1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include <test_HYDROData_LandCoverMap.h>
20 #include <HYDROData_Document.h>
21 #include <HYDROData_LandCoverMap.h>
22 #include <HYDROData_PolylineXY.h>
23 #include <HYDROData_StricklerTable.h>
24 #include <HYDROData_Tool.h>
25 #include <HYDROGUI_LandCoverMapPrs.h>
26 #include <TopoDS_Edge.hxx>
27 #include <TopoDS_Wire.hxx>
28 #include <TopoDS_Face.hxx>
29 #include <TestViewer.h>
30 #include <TestShape.h>
31 #include <TopTools_ListOfShape.hxx>
32 #include <AIS_DisplayMode.hxx>
33 #include <Aspect_ColorScale.hxx>
37 #include <BRepTools.hxx>
38 #include <BRep_Builder.hxx>
40 const QString REF_DATA_PATH = qgetenv( "HYDRO_REFERENCE_DATA" );
41 const QString DEF_STR_PATH = qgetenv( "HYDRO_SRC_DIR" ) + "/src/HYDROGUI/resources/def_strickler_table.txt";
43 void test_HYDROData_LandCoverMap::test_add_2_objects()
45 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
47 Handle(HYDROData_LandCoverMap) aMap =
48 Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
50 CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
52 TopoDS_Face aLC1 = Face( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
53 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
55 TopoDS_Face aLC2 = Face( QList<double>() << 30 << 20 << 60 << 10 << 70 << 35 << 40 << 40 );
56 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) );
58 TestViewer::show( aMap->GetShape(), AIS_Shaded, true, "LandCoverMap_Add_2_Objects" );
61 HYDROData_LandCoverMap::Iterator anIt( aMap );
62 CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
63 CPPUNIT_ASSERT_EQUAL( QString( "test1" ), anIt.StricklerType() );
65 CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
66 CPPUNIT_ASSERT_EQUAL( QString( "test2" ), anIt.StricklerType() );
68 CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
73 void test_HYDROData_LandCoverMap::test_split()
75 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
77 Handle(HYDROData_LandCoverMap) aMap =
78 Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
80 CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
82 TopoDS_Face aLC = Face( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
83 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC, "test1" ) );
85 Handle(HYDROData_PolylineXY) aPolyline =
86 Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
87 TopoDS_Wire aWire = Wire( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10, false );
88 aPolyline->SetShape( aWire );
90 CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) );
92 TestViewer::show( aMap->GetShape(), AIS_Shaded, true, "LandCoverMap_Split_1" );
93 TestViewer::show( aWire, 0, true, Qt::blue );
96 HYDROData_LandCoverMap::Iterator anIt( aMap );
97 CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
98 CPPUNIT_ASSERT_EQUAL( QString( "test1" ), anIt.StricklerType() );
100 CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
101 CPPUNIT_ASSERT_EQUAL( QString( "test1" ), anIt.StricklerType() );
103 CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
108 void test_HYDROData_LandCoverMap::test_incomplete_split()
110 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
112 Handle(HYDROData_LandCoverMap) aMap =
113 Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
115 CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
117 TopoDS_Face aLC = Face( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
118 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC, "test1" ) );
120 Handle(HYDROData_PolylineXY) aPolyline =
121 Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
122 TopoDS_Wire aWire = Wire( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10, false );
123 aPolyline->SetShape( aWire );
125 CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) );
127 TestViewer::show( aMap->GetShape(), AIS_Shaded, true, "LandCoverMap_Split_2" );
128 TestViewer::show( aWire, 0, true, Qt::green );
129 CPPUNIT_ASSERT_IMAGES
131 HYDROData_LandCoverMap::Iterator anIt( aMap );
132 CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
133 CPPUNIT_ASSERT_EQUAL( QString( "test1" ), anIt.StricklerType() );
135 CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
140 void test_HYDROData_LandCoverMap::test_merge()
142 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
144 Handle(HYDROData_LandCoverMap) aMap =
145 Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
147 CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
149 TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
151 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
153 TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
154 44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
155 128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
157 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) );
159 TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
160 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
161 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) );
163 //TestViewer::show( aMap->GetShape(), AIS_Shaded, true );
164 //TestViewer::AssertEqual( "LandCoverMap_Before_Merge" );
166 //BRepTools::Write( aMap->GetShape(), "c:\\map.brep" );
168 QString aType1, aType2;
169 gp_Pnt2d aPnt1( 25, 35 );
170 gp_Pnt2d aPnt2( 45, 55 );
171 //gp_Pnt2d aPnt3( 45, 10 );
172 //gp_Pnt2d aPnt4( 45, 80 );
173 TopTools_ListOfShape aList;
174 aList.Append( aMap->FindByPoint( aPnt1, aType1 ) );
175 aList.Append( aMap->FindByPoint( aPnt2, aType2 ) );
176 CPPUNIT_ASSERT_EQUAL( true, aMap->Merge( aList, "new" ) );
178 TestViewer::show( aMap->GetShape(), AIS_Shaded, true, "LandCoverMap_Merge_1" );
179 //TestViewer::show( BRepBuilderAPI_MakeEdge( gp_Pnt(aPnt1.X(), aPnt1.Y(), 0), gp_Pnt(aPnt2.X(), aPnt2.Y(), 0) ).Edge(), QColor( Qt::blue ), AIS_Shaded );
180 CPPUNIT_ASSERT_IMAGES
185 void test_HYDROData_LandCoverMap::test_remove()
187 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
189 Handle(HYDROData_LandCoverMap) aMap =
190 Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
192 CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
194 TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
196 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
198 TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
199 44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
200 128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
202 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) );
204 TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
205 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
206 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) );
208 QString aType1, aType2;
209 gp_Pnt2d aPnt1( 25, 35 );
210 gp_Pnt2d aPnt2( 45, 55 );
211 TopTools_ListOfShape aList;
212 aList.Append( aMap->FindByPoint( aPnt1, aType1 ) );
213 aList.Append( aMap->FindByPoint( aPnt2, aType2 ) );
214 CPPUNIT_ASSERT_EQUAL( true, aMap->Remove( aList ) );
216 TestViewer::show( aMap->GetShape(), AIS_Shaded, true, "LandCoverMap_Remove_1" );
217 CPPUNIT_ASSERT_IMAGES
222 void test_HYDROData_LandCoverMap::test_merge_faces_boxes()
224 TopoDS_Shape pp1, pp2, pp3, pp4;
226 BRepTools::Read(pp1, (REF_DATA_PATH + "/pp1.brep").toStdString().c_str(), BB);
227 BRepTools::Read(pp2, (REF_DATA_PATH + "/pp2.brep").toStdString().c_str(), BB);
228 BRepTools::Read(pp3, (REF_DATA_PATH + "/pp3.brep").toStdString().c_str(), BB);
229 BRepTools::Read(pp4, (REF_DATA_PATH + "/pp4.brep").toStdString().c_str(), BB);
231 CPPUNIT_ASSERT(!pp1.IsNull());
232 CPPUNIT_ASSERT(!pp2.IsNull());
233 CPPUNIT_ASSERT(!pp3.IsNull());
234 CPPUNIT_ASSERT(!pp4.IsNull());
236 //Test mergeFaces() func // boxes // USD == true
238 TopTools_ListOfShape Faces;
241 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
242 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_11" );
243 CPPUNIT_ASSERT_IMAGES
244 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_FACE);
247 TopTools_ListOfShape Faces;
250 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
251 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_12" );
252 CPPUNIT_ASSERT_IMAGES
253 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
256 TopTools_ListOfShape Faces;
260 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
261 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_13" );
262 CPPUNIT_ASSERT_IMAGES
263 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
266 TopTools_ListOfShape Faces;
271 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
272 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_14" );
273 CPPUNIT_ASSERT_IMAGES
274 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_FACE);
278 //Test mergeFaces() func // boxes // USD == false
280 TopTools_ListOfShape Faces;
283 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
284 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_21" );
285 CPPUNIT_ASSERT_IMAGES
286 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
289 TopTools_ListOfShape Faces;
292 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
293 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_22" );
294 CPPUNIT_ASSERT_IMAGES
295 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
298 TopTools_ListOfShape Faces;
302 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
303 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_23" );
304 CPPUNIT_ASSERT_IMAGES
305 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
308 TopTools_ListOfShape Faces;
313 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
314 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_boxes_24" );
315 CPPUNIT_ASSERT_IMAGES
316 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
321 void test_HYDROData_LandCoverMap::test_merge_faces_circles()
323 TopoDS_Shape ff1, ff2, ff3;
325 BRepTools::Read(ff1, (REF_DATA_PATH + "/ff1.brep").toStdString().c_str(), BB);
326 BRepTools::Read(ff2, (REF_DATA_PATH + "/ff2.brep").toStdString().c_str(), BB);
327 BRepTools::Read(ff3, (REF_DATA_PATH + "/ff3.brep").toStdString().c_str(), BB);
329 CPPUNIT_ASSERT(!ff1.IsNull());
330 CPPUNIT_ASSERT(!ff2.IsNull());
331 CPPUNIT_ASSERT(!ff3.IsNull());
333 //Test mergeFaces() func // circles // USD == true
335 TopTools_ListOfShape Faces;
338 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
339 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_11" );
340 CPPUNIT_ASSERT_IMAGES
341 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_FACE);
344 TopTools_ListOfShape Faces;
347 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
348 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_12" );
349 CPPUNIT_ASSERT_IMAGES
350 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
353 TopTools_ListOfShape Faces;
357 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
358 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_13" );
359 CPPUNIT_ASSERT_IMAGES
360 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
363 TopTools_ListOfShape Faces;
367 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true );
368 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_14" );
369 CPPUNIT_ASSERT_IMAGES
370 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
374 //Test mergeFaces() func // circles // USD == false
376 TopTools_ListOfShape Faces;
379 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
380 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_21" );
381 CPPUNIT_ASSERT_IMAGES
382 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
385 TopTools_ListOfShape Faces;
388 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
389 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_22" );
390 CPPUNIT_ASSERT_IMAGES
391 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
394 TopTools_ListOfShape Faces;
398 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
399 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_23" );
400 CPPUNIT_ASSERT_IMAGES
401 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
404 TopTools_ListOfShape Faces;
408 TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false );
409 TestViewer::show( aMergedFace, AIS_Shaded, true, "merge_faces_circles_24" );
410 CPPUNIT_ASSERT_IMAGES
411 CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
416 void test_HYDROData_LandCoverMap::test_import_dbf()
418 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
420 Handle(HYDROData_LandCoverMap) aMap =
421 Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
423 CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
424 QString aFileName = REF_DATA_PATH + "/t1.dbf";
431 aST.append("forest");
433 // aST.size() == aDBFV.size()!!
434 Handle(HYDROData_PolylineXY) aPolyline =
435 Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
436 TopoDS_Wire aWire = Wire( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10 );
437 aPolyline->SetShape( aWire );
438 for (int i = 0; i < 3; i++)
439 aMap->Add(aPolyline, "");
440 TopoDS_Face aLC1 = Face( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
441 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
443 CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) );
448 aMap->ImportDBF(aFileName, "TESTFIELD1", aDBFV, aST, Inds);
449 HYDROData_LandCoverMap::Iterator anIt( aMap );
451 CPPUNIT_ASSERT_EQUAL(true, "water" == anIt.StricklerType());
453 CPPUNIT_ASSERT_EQUAL(true, "forest" == anIt.StricklerType());
457 void test_HYDROData_LandCoverMap::test_land_cover_prs_by_types()
459 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
461 Handle(HYDROData_StricklerTable) aTable =
462 Handle(HYDROData_StricklerTable)::DownCast( aDoc->CreateObject( KIND_STRICKLER_TABLE ) );
463 CPPUNIT_ASSERT_EQUAL( true, aTable->Import( DEF_STR_PATH ) );
465 Handle(HYDROData_LandCoverMap) aMap =
466 Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
468 TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
469 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "Zones de champs cultivé à végétation basse" ) );
471 TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
472 44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
473 128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
475 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "Zones de champs cultivé à végétation haute" ) );
477 TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
478 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
479 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "Zones de champs, prairies, sans cultures" ) );
481 // build presentation object
482 Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap );
483 aPrs->SetTable( aTable );
484 // show presentation in viewer
485 TestViewer::show( aPrs, AIS_Shaded, 4, true, "LandCoverMap_PrsByTypes" );
486 // select one of faces (first)
487 TestViewer::select( 200, 300 );
488 CPPUNIT_ASSERT_IMAGES
493 void test_HYDROData_LandCoverMap::test_land_cover_prs_by_coeff()
495 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
497 Handle(HYDROData_StricklerTable) aTable =
498 Handle(HYDROData_StricklerTable)::DownCast( aDoc->CreateObject( KIND_STRICKLER_TABLE ) );
499 CPPUNIT_ASSERT_EQUAL( true, aTable->Import( DEF_STR_PATH ) );
501 Handle(HYDROData_LandCoverMap) aMap =
502 Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
504 TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
505 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "Zones de champs cultivé à végétation basse" ) );
507 TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
508 44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
509 128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
511 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "Zones de champs cultivé à végétation haute" ) );
513 TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
514 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
515 CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "Zones de champs, prairies, sans cultures" ) );
517 Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap );
518 aPrs->SetTable( aTable );
519 aPrs->SetColorScale( TestViewer::showColorScale( true ) );
520 TestViewer::show( aPrs, AIS_Shaded, 4, true, "LandCoverMap_PrsByCoeff" );
521 CPPUNIT_ASSERT_IMAGES
523 TestViewer::showColorScale( false );