Salome HOME
Merge branch 'BR_HYDRO_IMPS_2016' into pre/IMPS_2016
[modules/hydro.git] / src / HYDRO_tests / test_HYDROData_DTM.cxx
index 6659e93013f59edfb658ac6bff5ce3beb9dc30b7..3a84e0bc8f86ad9f8e83cc288ad24c15f38dcea1 100644 (file)
@@ -243,8 +243,9 @@ void test_HYDROData_DTM::test_profile_conversion_to_2d()
          aUMax1 = -aUMin1,
          aUMin2 = aUMin1,
          aUMax2 = aUMax1;
-  std::vector<Handle_Geom2d_Curve> curves1 = HYDROData_DTM::ProfileToParametric( aProfile1, aUMin1, aUMax1 );
-  std::vector<Handle_Geom2d_Curve> curves2 = HYDROData_DTM::ProfileToParametric( aProfile2, aUMin2, aUMax2 );
+  gp_Vec2d aProfileDir;
+  std::vector<Handle_Geom2d_Curve> curves1 = HYDROData_DTM::ProfileToParametric( aProfile1, aUMin1, aUMax1, aProfileDir );
+  std::vector<Handle_Geom2d_Curve> curves2 = HYDROData_DTM::ProfileToParametric( aProfile2, aUMin2, aUMax2, aProfileDir );
 
   gp_Pnt2d aFirst, aLast;
   CPPUNIT_ASSERT_EQUAL( 3, (int)curves1.size() );
@@ -337,8 +338,9 @@ void test_HYDROData_DTM::test_profile_discretization_polyline()
   aProfile->SetLeftPoint( gp_XY( 10, 10 ) );
   aProfile->SetRightPoint( gp_XY( 20, 20 ) );
 
-  HYDROData_DTM::CurveUZ aMid( 0.0 ), aWid( 0.0 );
-  HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 0.5, aMid, aWid );
+  HYDROData_DTM::CurveUZ aMid( 0.0, gp_Vec2d(), 0 ), aWid( 0.0, gp_Vec2d(), 0 );
+  int dummy = 0;
+  HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 0.5, aMid, aWid, dummy );
   CPPUNIT_ASSERT_EQUAL( 11, (int)aMid.size() );
   CPPUNIT_ASSERT_DOUBLES_EQUAL(  0.0,   aMid[0].U, EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL(  0.0,   aMid[0].Z, EPS );
@@ -346,7 +348,7 @@ void test_HYDROData_DTM::test_profile_discretization_polyline()
   CPPUNIT_ASSERT_DOUBLES_EQUAL(  0.5,   aMid[1].Z, EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL(  1.215, aMid[5].U, EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL(  2.5,   aMid[5].Z, EPS );
-  CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.589, aMid[10].U, EPS );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(  1.768, aMid[10].U, EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL(  5.0,   aMid[10].Z, EPS );
 
   CPPUNIT_ASSERT_EQUAL( 11, (int)aWid.size() );
@@ -374,8 +376,9 @@ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
   aProfile->SetLeftPoint( gp_XY( 10, 10 ) );
   aProfile->SetRightPoint( gp_XY( 20, 20 ) );
 
-  HYDROData_DTM::CurveUZ aMid( 0.0 ), aWid( 0.0 );
-  HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 0.5, aMid, aWid );
+  HYDROData_DTM::CurveUZ aMid( 0.0, gp_Vec2d(), 0 ), aWid( 0.0, gp_Vec2d(), 0 );
+  int dummy = 0 ;
+  HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 0.5, aMid, aWid, dummy );
   CPPUNIT_ASSERT_EQUAL( 11, (int)aMid.size() );
   CPPUNIT_ASSERT_DOUBLES_EQUAL(  0.242, aMid[0].U, EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL(  0.0,   aMid[0].Z, EPS );
@@ -383,7 +386,7 @@ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(  0.5,   aMid[1].Z, EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL(  1.473, aMid[5].U, EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL(  2.5,   aMid[5].Z, EPS );
-  CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.589, aMid[10].U, EPS );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(  1.768, aMid[10].U, EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL(  5.0,   aMid[10].Z, EPS );
 
   CPPUNIT_ASSERT_EQUAL( 11, (int)aWid.size() );
@@ -428,7 +431,7 @@ void operator << ( std::ostream& s, const HYDROData_DTM::CurveUZ& c )
 
 void test_HYDROData_DTM::test_curves_interpolation()
 {
-  HYDROData_DTM::CurveUZ A(1.0), B(2.0);
+  HYDROData_DTM::CurveUZ A(1.0, gp_Vec2d(), 0), B(2.0, gp_Vec2d(), 0);
   A.push_back( HYDROData_DTM::PointUZ( 0, 0 ) );
   A.push_back( HYDROData_DTM::PointUZ( 1, 1 ) );
   A.push_back( HYDROData_DTM::PointUZ( 2, 2 ) );
@@ -495,19 +498,19 @@ void test_HYDROData_DTM::test_curve_to_3d()
 
   Handle_Geom2d_BSplineCurve HA = HYDROData_DTM::CreateHydraulicAxis( profiles, distances );
   HYDROData_DTM::AltitudePoints points;
-  HYDROData_DTM::CurveUZ mid( 5.0 );
+  HYDROData_DTM::CurveUZ mid( 5.0, gp_Vec2d(-10,10), 0 );
   mid.push_back( HYDROData_DTM::PointUZ( 0, 5 ) );
   mid.push_back( HYDROData_DTM::PointUZ( 1, 6 ) );
-  HYDROData_DTM::CurveUZ wid( 5.0 );
+  HYDROData_DTM::CurveUZ wid( 5.0, gp_Vec2d(-10,10), 0 );
   wid.push_back( HYDROData_DTM::PointUZ( 2, 5 ) );
   wid.push_back( HYDROData_DTM::PointUZ( 6, 6 ) );
   HYDROData_DTM::CurveTo3D( HA, mid, wid, points );
 
   CPPUNIT_ASSERT_EQUAL( 4, (int)points.size() );
-  CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 15.434, -0.598, 5.0 ), points[0] );
-  CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 14.497, -0.947, 5.0 ), points[1] );
-  CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 15.903, -0.423, 6.0 ), points[2] );
-  CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 13.092, -1.471, 6.0 ), points[3] );
+  CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 16.380, -2.186, 6.0 ), points[0] );
+  CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 15.673, -1.479, 5.0 ), points[1] );
+  CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 14.259, -0.065, 5.0 ), points[2] );
+  CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 12.137,  2.056, 6.0 ), points[3] );
 
   aDoc->Close();
 }
@@ -544,7 +547,7 @@ void test_HYDROData_DTM::test_presentation()
   CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, DTM->GetSpatialStep(), EPS );
   DTM->Update();
   
-  CPPUNIT_ASSERT_EQUAL( 10200, (int)DTM->GetAltitudePoints().size() ); 
+  CPPUNIT_ASSERT_EQUAL( 9177, (int)DTM->GetAltitudePoints().size() ); 
 
   Handle_AIS_InteractiveContext aContext = TestViewer::context();
   HYDROGUI_ShapeBathymetry* aBathPrs = new HYDROGUI_ShapeBathymetry( 0, aContext, DTM );
@@ -585,7 +588,7 @@ void test_HYDROData_DTM::test_garonne()
       profiles.Append( Handle(HYDROData_Profile)::DownCast( it.Current() ) );
   }
 
-  //CPPUNIT_ASSERT_EQUAL( 46, (int)profiles.Size() );
+  CPPUNIT_ASSERT_EQUAL( 11, (int)profiles.Size() );
 
 
 
@@ -597,7 +600,7 @@ void test_HYDROData_DTM::test_garonne()
   CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, DTM->GetSpatialStep(), EPS );
   DTM->Update();
   
-  CPPUNIT_ASSERT_EQUAL( 282336, (int)DTM->GetAltitudePoints().size() ); 
+  CPPUNIT_ASSERT_EQUAL( 282338, (int)DTM->GetAltitudePoints().size() ); 
 
   Handle_AIS_InteractiveContext aContext = TestViewer::context();
   HYDROGUI_ShapeBathymetry* aBathPrs = new HYDROGUI_ShapeBathymetry( 0, aContext, DTM );