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_DTM.h>
20 #include <HYDROData_Document.h>
21 #include <HYDROData_Profile.h>
22 #include <HYDROData_DTM.h>
23 #include <Geom2d_Curve.hxx>
24 #include <Geom2d_BSplineCurve.hxx>
26 #include <gp_Pnt2d.hxx>
27 #include <TColgp_Array1OfPnt2d.hxx>
28 #include <TestViewer.h>
29 #include <AIS_InteractiveContext.hxx>
30 #include <AIS_PointCloud.hxx>
31 #include <HYDROGUI_ShapeBathymetry.h>
32 #include <Aspect_ColorScale.hxx>
35 const double EPS = 1E-3;
37 NCollection_Sequence<HYDROData_IPolyline::Point> points;
39 void test_HYDROData_DTM::setUp()
42 points.Append( gp_XY( 0.0, 5.0 ) );
43 points.Append( gp_XY( 1.0, 1.0 ) );
44 points.Append( gp_XY( 1.5, 0.0 ) );
45 points.Append( gp_XY( 4.0, 4.0 ) );
48 void test_HYDROData_DTM::test_creation()
50 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
52 Handle(HYDROData_DTM) DTM =
53 Handle(HYDROData_DTM)::DownCast( aDoc->CreateObject( KIND_DTM ) );
55 CPPUNIT_ASSERT_EQUAL( false, (bool)DTM.IsNull() );
60 void test_HYDROData_DTM::test_hydraulic_axis()
62 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
64 Handle(HYDROData_Profile) aProfile1 =
65 Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
67 Handle(HYDROData_Profile) aProfile2 =
68 Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
70 Handle(HYDROData_Profile) aProfile3 =
71 Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
73 aProfile1->SetParametricPoints( points );
74 aProfile1->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE );
75 aProfile1->SetLeftPoint( gp_XY( 10, 10 ) );
76 aProfile1->SetRightPoint( gp_XY( 20, 0 ) );
78 aProfile2->SetParametricPoints( points );
79 aProfile2->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE );
80 aProfile2->SetLeftPoint( gp_XY( 50, 0 ) );
81 aProfile2->SetRightPoint( gp_XY( 60, 10 ) );
83 aProfile3->SetParametricPoints( points );
84 aProfile3->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE );
85 aProfile3->SetLeftPoint( gp_XY( 200, 50 ) );
86 aProfile3->SetRightPoint( gp_XY( 210, 40 ) );
88 std::vector<double> distances;
89 std::vector<Handle(HYDROData_Profile)> profiles;
90 profiles.push_back( aProfile1 );
91 profiles.push_back( aProfile2 );
92 profiles.push_back( aProfile3 );
94 Handle_Geom2d_BSplineCurve HA = HYDROData_DTM::CreateHydraulicAxis( profiles, distances );
95 CPPUNIT_ASSERT_EQUAL( false, (bool)HA.IsNull() );
96 CPPUNIT_ASSERT_EQUAL( 3, (int)distances.size() );
98 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, distances[0], EPS );
99 CPPUNIT_ASSERT_DOUBLES_EQUAL( 43.499, distances[1], EPS );
100 CPPUNIT_ASSERT_DOUBLES_EQUAL( 211.474, distances[2], EPS );
105 void test_HYDROData_DTM::test_profile_conversion_to_2d()
107 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
109 Handle(HYDROData_Profile) aProfile1 =
110 Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
112 Handle(HYDROData_Profile) aProfile2 =
113 Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
115 aProfile1->SetParametricPoints( points );
116 aProfile1->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE );
117 aProfile1->SetLeftPoint( gp_XY( 10, 10 ) );
118 aProfile1->SetRightPoint( gp_XY( 20, 20 ) );
120 aProfile2->SetParametricPoints( points );
121 aProfile2->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_SPLINE );
122 aProfile2->SetLeftPoint( gp_XY( 10, 10 ) );
123 aProfile2->SetRightPoint( gp_XY( 20, 20 ) );
125 double aUMin1 = std::numeric_limits<double>::max(),
129 std::vector<Handle_Geom2d_Curve> curves1 = HYDROData_DTM::ProfileToParametric( aProfile1, aUMin1, aUMax1 );
130 std::vector<Handle_Geom2d_Curve> curves2 = HYDROData_DTM::ProfileToParametric( aProfile2, aUMin2, aUMax2 );
132 gp_Pnt2d aFirst, aLast;
133 CPPUNIT_ASSERT_EQUAL( 3, (int)curves1.size() );
134 CPPUNIT_ASSERT_DOUBLES_EQUAL( -5.303, aUMin1, EPS );
135 CPPUNIT_ASSERT_DOUBLES_EQUAL( 8.839, aUMax1, EPS );
136 curves1[0]->D0( curves1[0]->FirstParameter(), aFirst );
137 curves1[0]->D0( curves1[0]->LastParameter(), aLast );
138 CPPUNIT_ASSERT_DOUBLES_EQUAL( -5.303, aFirst.X(), EPS );
139 CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, aFirst.Y(), EPS );
140 CPPUNIT_ASSERT_DOUBLES_EQUAL( -1.768, aLast.X(), EPS );
141 CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, aLast.Y(), EPS );
142 curves1[1]->D0( curves1[1]->FirstParameter(), aFirst );
143 curves1[1]->D0( curves1[1]->LastParameter(), aLast );
144 CPPUNIT_ASSERT_DOUBLES_EQUAL( -1.768, aFirst.X(), EPS );
145 CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, aFirst.Y(), EPS );
146 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aLast.X(), EPS );
147 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aLast.Y(), EPS );
148 curves1[2]->D0( curves1[2]->FirstParameter(), aFirst );
149 curves1[2]->D0( curves1[2]->LastParameter(), aLast );
150 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aFirst.X(), EPS );
151 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aFirst.Y(), EPS );
152 CPPUNIT_ASSERT_DOUBLES_EQUAL( 8.839, aLast.X(), EPS );
153 CPPUNIT_ASSERT_DOUBLES_EQUAL( 4.0, aLast.Y(), EPS );
155 CPPUNIT_ASSERT_EQUAL( 1, (int)curves2.size() );
156 CPPUNIT_ASSERT_DOUBLES_EQUAL( -5.303, aUMin2, EPS );
157 CPPUNIT_ASSERT_DOUBLES_EQUAL( 8.839, aUMax2, EPS );
158 Handle(Geom2d_BSplineCurve) aBSpline = Handle(Geom2d_BSplineCurve)::DownCast( curves2[0] );
159 CPPUNIT_ASSERT_EQUAL( false, (bool)aBSpline.IsNull() );
160 const TColgp_Array1OfPnt2d& poles = aBSpline->Poles();
161 CPPUNIT_ASSERT_EQUAL( 1, (int)poles.Lower() );
162 CPPUNIT_ASSERT_EQUAL( 8, (int)poles.Upper() );
163 CPPUNIT_ASSERT_DOUBLES_EQUAL( -5.303, poles.Value( 1 ).X(), EPS );
164 CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, poles.Value( 1 ).Y(), EPS );
165 CPPUNIT_ASSERT_DOUBLES_EQUAL( -4.125, poles.Value( 2 ).X(), EPS );
166 CPPUNIT_ASSERT_DOUBLES_EQUAL( 3.667, poles.Value( 2 ).Y(), EPS );
167 CPPUNIT_ASSERT_DOUBLES_EQUAL( -3.150, poles.Value( 3 ).X(), EPS );
168 CPPUNIT_ASSERT_DOUBLES_EQUAL( 2.120, poles.Value( 3 ).Y(), EPS );
169 CPPUNIT_ASSERT_DOUBLES_EQUAL( -1.242, poles.Value( 4 ).X(), EPS );
170 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.574, poles.Value( 4 ).Y(), EPS );
175 void test_HYDROData_DTM::test_profile_properties()
177 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
179 Handle(HYDROData_Profile) aProfile =
180 Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
182 aProfile->SetParametricPoints( points );
183 aProfile->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE );
184 aProfile->SetLeftPoint( gp_XY( 10, 10 ) );
185 aProfile->SetRightPoint( gp_XY( 20, 25 ) );
190 HYDROData_DTM::GetProperties( aProfile, lp, dd, false, zmin, zmax );
191 CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.75, lp.X(), EPS );
192 CPPUNIT_ASSERT_DOUBLES_EQUAL( 15.625, lp.Y(), EPS );
193 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, lp.Z(), EPS );
194 CPPUNIT_ASSERT_DOUBLES_EQUAL( 10, dd.X(), EPS );
195 CPPUNIT_ASSERT_DOUBLES_EQUAL( 15, dd.Y(), EPS );
196 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, zmin, EPS );
197 CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, zmax, EPS );
199 HYDROData_DTM::GetProperties( aProfile, lp, dd, true, zmin, zmax );
200 CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.75, lp.X(), EPS );
201 CPPUNIT_ASSERT_DOUBLES_EQUAL( 15.625, lp.Y(), EPS );
202 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, lp.Z(), EPS );
203 CPPUNIT_ASSERT_DOUBLES_EQUAL( -15, dd.X(), EPS );
204 CPPUNIT_ASSERT_DOUBLES_EQUAL( 10, dd.Y(), EPS );
205 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, zmin, EPS );
206 CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, zmax, EPS );
211 void test_HYDROData_DTM::test_profile_discretization_polyline()
213 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
215 Handle(HYDROData_Profile) aProfile =
216 Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
218 aProfile->SetParametricPoints( points );
219 aProfile->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE );
220 aProfile->SetLeftPoint( gp_XY( 10, 10 ) );
221 aProfile->SetRightPoint( gp_XY( 20, 20 ) );
223 HYDROData_DTM::CurveUZ aMid( 0.0 ), aWid( 0.0 );
224 HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 0.5, aMid, aWid );
225 CPPUNIT_ASSERT_EQUAL( 11, (int)aMid.size() );
226 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aMid[0].U, EPS );
227 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aMid[0].Z, EPS );
228 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.11, aMid[1].U, EPS );
229 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.5, aMid[1].Z, EPS );
230 CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.215, aMid[5].U, EPS );
231 CPPUNIT_ASSERT_DOUBLES_EQUAL( 2.5, aMid[5].Z, EPS );
232 CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.589, aMid[10].U, EPS );
233 CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, aMid[10].Z, EPS );
235 CPPUNIT_ASSERT_EQUAL( 11, (int)aWid.size() );
236 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aWid[0].U, EPS );
237 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aWid[0].Z, EPS );
238 CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.989, aWid[1].U, EPS );
239 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.5, aWid[1].Z, EPS );
240 CPPUNIT_ASSERT_DOUBLES_EQUAL( 8.618, aWid[5].U, EPS );
241 CPPUNIT_ASSERT_DOUBLES_EQUAL( 2.5, aWid[5].Z, EPS );
242 CPPUNIT_ASSERT_DOUBLES_EQUAL( 14.142, aWid[10].U, EPS );
243 CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, aWid[10].Z, EPS );
248 void test_HYDROData_DTM::test_profile_discretization_spline()
250 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
252 Handle(HYDROData_Profile) aProfile =
253 Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
255 aProfile->SetParametricPoints( points );
256 aProfile->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_SPLINE );
257 aProfile->SetLeftPoint( gp_XY( 10, 10 ) );
258 aProfile->SetRightPoint( gp_XY( 20, 20 ) );
260 HYDROData_DTM::CurveUZ aMid( 0.0 ), aWid( 0.0 );
261 HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 0.5, aMid, aWid );
262 CPPUNIT_ASSERT_EQUAL( 11, (int)aMid.size() );
263 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.242, aMid[0].U, EPS );
264 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aMid[0].Z, EPS );
265 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.755, aMid[1].U, EPS );
266 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.5, aMid[1].Z, EPS );
267 CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.473, aMid[5].U, EPS );
268 CPPUNIT_ASSERT_DOUBLES_EQUAL( 2.5, aMid[5].Z, EPS );
269 CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.589, aMid[10].U, EPS );
270 CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, aMid[10].Z, EPS );
272 CPPUNIT_ASSERT_EQUAL( 11, (int)aWid.size() );
273 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.484, aWid[0].U, EPS );
274 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aWid[0].Z, EPS );
275 CPPUNIT_ASSERT_DOUBLES_EQUAL( 3.809, aWid[1].U, EPS );
276 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.5, aWid[1].Z, EPS );
277 CPPUNIT_ASSERT_DOUBLES_EQUAL( 9.472, aWid[5].U, EPS );
278 CPPUNIT_ASSERT_DOUBLES_EQUAL( 2.5, aWid[5].Z, EPS );
279 CPPUNIT_ASSERT_DOUBLES_EQUAL( 14.142, aWid[10].U, EPS );
280 CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, aWid[10].Z, EPS );
285 void operator << ( std::ostream& s, const HYDROData_DTM::PointUZ& p )
287 s << "(" << p.U << "; " << p.Z << ") ";
290 void operator << ( std::ostream& s, const HYDROData_DTM::AltitudePoint& p )
292 s << "(" << p.X << "; " << p.Y << "; " << p.Z << ") ";
295 bool operator == ( const HYDROData_DTM::PointUZ& p1, const HYDROData_DTM::PointUZ& p2 )
297 return fabs(p1.U-p2.U)<EPS && fabs(p1.Z-p2.Z)<EPS;
300 bool operator == ( const HYDROData_DTM::AltitudePoint& p1, const HYDROData_DTM::AltitudePoint& p2 )
302 return fabs(p1.X-p2.X)<EPS && fabs(p1.Y-p2.Y)<EPS && fabs(p1.Z-p2.Z)<EPS;
305 void operator << ( std::ostream& s, const HYDROData_DTM::CurveUZ& c )
308 for( size_t i=0; i<n; i++ )
312 void test_HYDROData_DTM::test_curves_interpolation()
314 HYDROData_DTM::CurveUZ A(1.0), B(2.0);
315 A.push_back( HYDROData_DTM::PointUZ( 0, 0 ) );
316 A.push_back( HYDROData_DTM::PointUZ( 1, 1 ) );
317 A.push_back( HYDROData_DTM::PointUZ( 2, 2 ) );
318 B.push_back( HYDROData_DTM::PointUZ( 10, 0 ) );
319 B.push_back( HYDROData_DTM::PointUZ( 15, 1 ) );
320 B.push_back( HYDROData_DTM::PointUZ( 20, 2 ) );
322 std::vector<HYDROData_DTM::CurveUZ> i1;
323 HYDROData_DTM::Interpolate( A, B, 1, i1, false );
325 CPPUNIT_ASSERT_EQUAL( 2, (int)i1.size() );
326 CPPUNIT_ASSERT_EQUAL( A, i1[0] );
327 CPPUNIT_ASSERT_EQUAL( 3, (int)i1[1].size() );
328 CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 5, 0 ), i1[1][0] );
329 CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 8, 1 ), i1[1][1] );
330 CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 11, 2 ), i1[1][2] );
332 std::vector<HYDROData_DTM::CurveUZ> i2;
333 HYDROData_DTM::Interpolate( A, B, 1, i2, true );
335 CPPUNIT_ASSERT_EQUAL( 3, (int)i2.size() );
336 CPPUNIT_ASSERT_EQUAL( A, i2[0] );
337 CPPUNIT_ASSERT_EQUAL( 3, (int)i2[1].size() );
338 CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 5, 0 ), i2[1][0] );
339 CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 8, 1 ), i2[1][1] );
340 CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 11, 2 ), i2[1][2] );
341 CPPUNIT_ASSERT_EQUAL( B, i2[2] );
343 std::vector<HYDROData_DTM::CurveUZ> i3;
344 HYDROData_DTM::Interpolate( A, B, 3, i3, false );
346 CPPUNIT_ASSERT_EQUAL( 4, (int)i3.size() );
347 CPPUNIT_ASSERT_EQUAL( A, i3[0] );
348 CPPUNIT_ASSERT_EQUAL( 3, (int)i3[1].size() );
349 CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 2.5, 0 ), i3[1][0] );
350 CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 4.5, 1 ), i3[1][1] );
351 CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 6.5, 2 ), i3[1][2] );
354 void test_HYDROData_DTM::test_curve_to_3d()
356 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
358 Handle(HYDROData_Profile) aProfile1 =
359 Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
361 Handle(HYDROData_Profile) aProfile2 =
362 Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
364 aProfile1->SetParametricPoints( points );
365 aProfile1->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE );
366 aProfile1->SetLeftPoint( gp_XY( 20, 0 ) );
367 aProfile1->SetRightPoint( gp_XY( 10, 10 ) );
369 aProfile2->SetParametricPoints( points );
370 aProfile2->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE );
371 aProfile2->SetLeftPoint( gp_XY( 100, 0 ) );
372 aProfile2->SetRightPoint( gp_XY( 110, 0 ) );
374 std::vector<double> distances;
375 std::vector<Handle(HYDROData_Profile)> profiles;
376 profiles.push_back( aProfile1 );
377 profiles.push_back( aProfile2 );
379 Handle_Geom2d_BSplineCurve HA = HYDROData_DTM::CreateHydraulicAxis( profiles, distances );
380 HYDROData_DTM::AltitudePoints points;
381 HYDROData_DTM::CurveUZ mid( 5.0 );
382 mid.push_back( HYDROData_DTM::PointUZ( 0, 5 ) );
383 mid.push_back( HYDROData_DTM::PointUZ( 1, 6 ) );
384 HYDROData_DTM::CurveUZ wid( 5.0 );
385 wid.push_back( HYDROData_DTM::PointUZ( 2, 5 ) );
386 wid.push_back( HYDROData_DTM::PointUZ( 6, 6 ) );
387 HYDROData_DTM::CurveTo3D( HA, mid, wid, points );
389 CPPUNIT_ASSERT_EQUAL( 4, (int)points.size() );
390 CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 15.434, -0.598, 5.0 ), points[0] );
391 CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 14.497, -0.947, 5.0 ), points[1] );
392 CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 15.903, -0.423, 6.0 ), points[2] );
393 CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 13.092, -1.471, 6.0 ), points[3] );
398 void test_HYDROData_DTM::test_presentation()
400 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
402 Handle(HYDROData_DTM) DTM = Handle(HYDROData_DTM)::DownCast( aDoc->CreateObject( KIND_DTM ) );
404 Handle(HYDROData_Profile) aProfile1 =
405 Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
407 Handle(HYDROData_Profile) aProfile2 =
408 Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
410 aProfile1->SetParametricPoints( points );
411 aProfile1->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_SPLINE );
412 aProfile1->SetLeftPoint( gp_XY( 20, 0 ) );
413 aProfile1->SetRightPoint( gp_XY( 10, 10 ) );
415 aProfile2->SetParametricPoints( points );
416 aProfile2->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_SPLINE );
417 aProfile2->SetLeftPoint( gp_XY( 100, 0 ) );
418 aProfile2->SetRightPoint( gp_XY( 110, 0 ) );
420 HYDROData_SequenceOfObjects seq;
421 seq.Append( aProfile1 );
422 seq.Append( aProfile2 );
423 DTM->SetProfiles( seq );
425 CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.1, DTM->GetDDZ(), EPS );
426 DTM->SetSpatialStep( 1.0 );
427 CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, DTM->GetSpatialStep(), EPS );
430 CPPUNIT_ASSERT_EQUAL( 10404, (int)DTM->GetAltitudePoints().size() );
432 Handle_AIS_InteractiveContext aContext = TestViewer::context();
433 HYDROGUI_ShapeBathymetry* aBathPrs = new HYDROGUI_ShapeBathymetry( 0, aContext, DTM );
434 aBathPrs->update( true, false );
436 TestViewer::showColorScale( true );
437 Handle_Aspect_ColorScale aCS = TestViewer::colorScale();
440 aCS->SetNumberOfIntervals( 10 );
441 aBathPrs->UpdateWithColorScale( aCS );
443 TestViewer::show( aBathPrs->getAISObject(), AIS_PointCloud::DM_Points, 0, true, "DTM_1" );
444 CPPUNIT_ASSERT_IMAGES
450 void test_HYDROData_DTM::test_garonne()