+
+ aDoc->Close();
+}
+
+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
+ {
+ //DEBTRACE("aFFileName: " << aFFileName.toStdString());
+ //DEBTRACE("aSFileName: " << aSFileName.toStdString());
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document();
+ HYDROData_ShapeFile anImporter;
+ QStringList PolygonList;
+ TopTools_SequenceOfShape PolygonFaces;
+
+ //import LCM from file (#2-4; #12-14 polygons)
+ 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;
+
+ aMapFace2ST.Add( TopoDS::Face( PolygonFaces(2) ), "" );
+ aMapFace2ST.Add( TopoDS::Face( PolygonFaces(3) ), "" );
+ aMapFace2ST.Add( TopoDS::Face( PolygonFaces(4) ), "" );
+ aMapFace2ST.Add( TopoDS::Face( PolygonFaces(12) ), "" );
+ aMapFace2ST.Add( TopoDS::Face( PolygonFaces(13) ), "" );
+ aMapFace2ST.Add( TopoDS::Face( PolygonFaces(14) ), "" );
+
+ LCM->StoreLandCovers(aMapFace2ST);
+ LCM->SetName("lcm_1");
+
+ TopoDS_Shape aSh = LCM->GetShape();
+ BRepCheck_Analyzer aBCA(aSh);
+ CPPUNIT_ASSERT(aBCA.IsValid());
+
+ //export lcm
+ HYDROData_ShapeFile anExporter;
+ QStringList aNonExpList;
+ anExporter.Export(aDoc, aSFileName, LCM, aNonExpList);
+ CPPUNIT_ASSERT (aNonExpList.empty());
+
+ aDoc->Close();
+ }
+ {
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document();
+ HYDROData_ShapeFile anImporter;
+ QStringList PolygonList;
+ TopTools_SequenceOfShape PolygonFaces;
+ //import all
+ 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);
+ for ( int i = 1; i <= PolygonFaces.Length(); i++ )
+ aMapFace2ST.Add( TopoDS::Face( PolygonFaces(i) ), "" );
+
+ LCM->StoreLandCovers(aMapFace2ST);
+ LCM->SetName("lcm_2");
+
+ TopoDS_Shape OutSh = LCM->GetShape();
+ BRepCheck_Analyzer aBCA(OutSh);
+ CPPUNIT_ASSERT(aBCA.IsValid());
+
+ TestViewer::show( OutSh, AIS_Shaded, true, "CLC06-cut_1_res" );
+ CPPUNIT_ASSERT_IMAGES
+
+ 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();
+
+ Handle(HYDROData_PolylineXY) Polyline_12 =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+ Polyline_12->SetName( "Polyline_12" );
+
+ Polyline_12->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+ Polyline_12->AddPoint( 0, gp_XY( -148.70, 145.68 ) );
+ Polyline_12->AddPoint( 0, gp_XY( -81.71, 210.97 ) );
+ Polyline_12->AddPoint( 0, gp_XY( -21.09, 122.79 ) );
+ Polyline_12->AddPoint( 0, gp_XY( -106.30, 102.44 ) );
+ Polyline_12->AddSection( "Section_2", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+ Polyline_12->AddPoint( 1, gp_XY( -7.09, 227.08 ) );
+ Polyline_12->AddPoint( 1, gp_XY( 46.32, 228.78 ) );
+ Polyline_12->AddPoint( 1, gp_XY( 69.64, 165.61 ) );
+ Polyline_12->AddPoint( 1, gp_XY( 13.68, 156.28 ) );
+
+ Polyline_12->Update();
+
+ Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+ CPPUNIT_ASSERT_EQUAL( true, LCM->Add( Polyline_12, "" ) );
+
+ TestViewer::show( LCM->GetShape(), AIS_Shaded, true, "lcm_poly_2_sections" );
+ CPPUNIT_ASSERT_IMAGES
+
+ aDoc->Close();
+}
+
+void test_HYDROData_LandCoverMap::test_split_2()
+{
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document();
+
+ Handle(HYDROData_PolylineXY) Polyline_1 =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+ Polyline_1->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+ Polyline_1->AddPoint( 0, gp_XY( -264.84, 323.44 ) );
+ Polyline_1->AddPoint( 0, gp_XY( 254.45, 301.19 ) );
+ Polyline_1->AddPoint( 0, gp_XY( -291.54, -47.48 ) );
+ Polyline_1->Update();
+
+ Handle(HYDROData_PolylineXY) Polyline_6 =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+ Polyline_6->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+ Polyline_6->AddPoint( 0, gp_XY( -155.15, 199.47 ) );
+ Polyline_6->AddPoint( 0, gp_XY( -71.19, 289.12 ) );
+ Polyline_6->AddPoint( 0, gp_XY( 22.01, 211.57 ) );
+ Polyline_6->AddPoint( 0, gp_XY( -84.00, 134.73 ) );
+ Polyline_6->Update();
+
+ Handle(HYDROData_PolylineXY) Polyline_7 =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+ Polyline_7->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+ Polyline_7->AddPoint( 0, gp_XY( -50.56, 232.20 ) );
+ Polyline_7->AddPoint( 0, gp_XY( 40.51, 286.98 ) );
+ Polyline_7->AddPoint( 0, gp_XY( 118.77, 256.39 ) );
+ Polyline_7->AddPoint( 0, gp_XY( 72.52, 114.10 ) );
+ Polyline_7->Update();
+
+ Handle(HYDROData_PolylineXY) Polyline_8 =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+ Polyline_8->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+ Polyline_8->AddPoint( 0, gp_XY( -44.16, 190.93 ) );
+ Polyline_8->AddPoint( 0, gp_XY( 9.91, 226.51 ) );
+ Polyline_8->AddPoint( 0, gp_XY( 35.53, 175.99 ) );
+ Polyline_8->AddPoint( 0, gp_XY( -9.30, 157.50 ) );
+ Polyline_8->Update();
+
+ Handle(HYDROData_PolylineXY) Polyline_9 =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+ Polyline_9->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, false );
+ Polyline_9->AddPoint( 0, gp_XY( -103.92, 288.40 ) );
+ Polyline_9->AddPoint( 0, gp_XY( -100.09, 285.22 ) );
+ Polyline_9->AddPoint( 0, gp_XY( -96.10, 281.90 ) );
+ Polyline_9->AddPoint( 0, gp_XY( -90.43, 277.19 ) );
+ Polyline_9->AddPoint( 0, gp_XY( -53.41, 246.43 ) );
+ Polyline_9->AddPoint( 0, gp_XY( 10.62, 245.01 ) );
+
+
+ Polyline_9->Update();
+
+
+ Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+ CPPUNIT_ASSERT_EQUAL( true, LCM->Add( Polyline_1, "" ) );
+ CPPUNIT_ASSERT_EQUAL( true, LCM->Add( Polyline_6, "" ) );
+ CPPUNIT_ASSERT_EQUAL( true, LCM->Add( Polyline_7, "" ) );
+
+ CPPUNIT_ASSERT_EQUAL( true, LCM->Split( Polyline_9 ) );
+
+ //Handle(HYDROGUI_LandCoverMapPrs) aPrs1 = new HYDROGUI_LandCoverMapPrs( LCM );
+ TestViewer::show( LCM->GetShape(), AIS_Shaded, /*0,*/ true, "LCM_split_2a" );
+ CPPUNIT_ASSERT_IMAGES
+
+ CPPUNIT_ASSERT_EQUAL( true, LCM->Split( Polyline_8 ) );
+
+ // Handle(HYDROGUI_LandCoverMapPrs) aPrs2 = new HYDROGUI_LandCoverMapPrs( LCM );
+ TestViewer::show( LCM->GetShape(), AIS_Shaded, /*0,*/ true, "LCM_split_2b" );
+ CPPUNIT_ASSERT_IMAGES
+
+ aDoc->Close();
+}
+
+void test_HYDROData_LandCoverMap::test_export_telemac()
+{
+ 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_LandCoverMap) aMap =
+ Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+
+ 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 aLC1 = Face2d( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+ CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, type7 ) );
+
+ TopoDS_Face aLC2 = Face2d( QList<double>() << 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, type8 ) );
+
+ TopoDS_Face aLC3 = Face2d( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
+ 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
+ CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, type9 ) );
+
+ QString aTmpFileName = "test.telemac";
+ 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();
+}
+
+void test_HYDROData_LandCoverMap::test_copy()
+{
+ 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 = Face2d( QList<double>() << 10 << 10 << 30 << 10 << 20 << 20 );
+ CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Forêts de conifères")) );
+
+ TopoDS_Face aLC2 = Face2d( QList<double>() << 110 << 10 << 130 << 10 << 120 << 20 );
+ CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, QString::fromUtf8("Forêts de feuillus")) );
+
+ Handle(HYDROData_LandCoverMap) aMap2 =
+ Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+ aMap->CopyTo( aMap2, true );
+
+ CPPUNIT_ASSERT_EQUAL( QString( "map_2" ), aMap2->GetName() );
+ HYDROData_LandCoverMap::Explorer anIt( aMap2 );
+ CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+ CPPUNIT_ASSERT_EQUAL( QString::fromUtf8("Forêts de feuillus"), anIt.StricklerType() );
+ CPPUNIT_ASSERT( anIt.Face().TShape()!=aLC1.TShape() );
+ anIt.Next();
+ CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+ CPPUNIT_ASSERT_EQUAL( QString::fromUtf8("Forêts de conifères"), anIt.StricklerType() );
+ CPPUNIT_ASSERT( anIt.Face().TShape()!=aLC2.TShape() );
+ anIt.Next();
+ CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
+
+ TopoDS_Shape aShape1 = aMap->GetShape();
+ TopoDS_Shape aShape2 = aMap2->GetShape();
+ gp_Trsf aTr;
+ aTr.SetTranslation( gp_Vec( 0, 50, 0 ) );
+ aShape2.Move( TopLoc_Location( aTr ) );
+ TestViewer::show( aShape1, AIS_Shaded, /*0,*/ true, "LCM_copied" );
+ TestViewer::show( aShape2, AIS_Shaded, /*0,*/ true, "" );
+ CPPUNIT_ASSERT_IMAGES
+
+ 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<gp_XY> 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<std::set <QString> > 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<gp_XY> 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<std::set <QString> > 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<double> 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<gp_XY> 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<double> 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);
+