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_PolylineXY.h>
21 #include <HYDROData_Channel.h>
22 #include <HYDROData_Document.h>
23 #include <HYDROData_PolylineXY.h>
24 #include <HYDROData_Polyline3D.h>
25 #include <HYDROData_PolylineOperator.h>
26 #include <HYDROData_Profile.h>
27 #include <HYDROData_Iterator.h>
28 #include <HYDROData_ImmersibleZone.h>
29 #include <HYDROData_Tool.h>
30 #include <HYDROGUI_Polyline.h>
32 #include <AIS_DisplayMode.hxx>
33 #include <AIS_PointCloud.hxx>
34 #include <Prs3d_LineAspect.hxx>
35 #include <Prs3d_PointAspect.hxx>
36 #include <TColgp_HArray1OfPnt.hxx>
41 #include <TestShape.h>
42 #include <TestViewer.h>
43 #include <TopoDS_Edge.hxx>
44 #include <TopoDS_Vertex.hxx>
45 #include <TopoDS_Wire.hxx>
48 void test_HYDROData_PolylineXY::test_polyline()
50 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
52 Handle(HYDROData_PolylineXY) aPolyline =
53 Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
55 aPolyline->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, false );
56 aPolyline->AddSection( "Section_2", HYDROData_PolylineXY::SECTION_SPLINE, true );
58 int aNbSections = aPolyline->NbSections();
59 CPPUNIT_ASSERT( aNbSections == 2 );
61 NCollection_Sequence<TCollection_AsciiString> aSectNames;
62 NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
63 NCollection_Sequence<bool> aSectClosures;
64 aPolyline->GetSections( aSectNames, aSectTypes, aSectClosures );
66 CPPUNIT_ASSERT_EQUAL( 2, aSectNames.Size() );
67 CPPUNIT_ASSERT( aSectNames.Value( 1 ) == "Section_1" );
68 CPPUNIT_ASSERT( aSectTypes.Value( 1 ) == HYDROData_PolylineXY::SECTION_POLYLINE );
69 CPPUNIT_ASSERT( aSectClosures.Value( 1 ) == false );
71 CPPUNIT_ASSERT( aSectNames.Value( 2 ) == "Section_2" );
72 CPPUNIT_ASSERT( aSectTypes.Value( 2 ) == HYDROData_PolylineXY::SECTION_SPLINE );
73 CPPUNIT_ASSERT( aSectClosures.Value( 2 ) == true );
78 void test_HYDROData_PolylineXY::test_copy()
80 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
81 Handle(HYDROData_PolylineXY) aPolyline1 =
82 Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
85 // aPolyline1->setPoints(aPoints);
87 Handle(HYDROData_PolylineXY) aPolyline2 =
88 Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
90 aPolyline1->CopyTo(aPolyline2, true);
96 void test_HYDROData_PolylineXY::test_split_refs_624()
98 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
100 Handle(HYDROData_PolylineXY) aPolyline =
101 Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
102 aPolyline->SetName( "test" );
104 QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
105 TopoDS_Wire aWire = Wire2d( aCoords, true );
106 aPolyline->SetShape( aWire );
108 gp_Pnt2d aPnt( 20, 20 );
110 TestViewer::show( aPolyline->GetShape(), 0, true, "LandCoverMap_Split_Polyline" );
111 //TestViewer::show( BRepBuilderAPI_MakeVertex( aPnt ).Vertex(), 1, true, Qt::green );
112 CPPUNIT_ASSERT_IMAGES
114 HYDROData_PolylineOperator anOp;
115 CPPUNIT_ASSERT_EQUAL( true, anOp.Split( aDoc, aPolyline, aPnt, 1E-3 ) );
117 HYDROData_Iterator anIt( aDoc, KIND_POLYLINEXY );
118 CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
119 CPPUNIT_ASSERT_EQUAL( QString( "test" ), anIt.Current()->GetName() );
121 CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
122 CPPUNIT_ASSERT_EQUAL( QString( "test_1" ), anIt.Current()->GetName() );
124 CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
129 void test_HYDROData_PolylineXY::test_extraction_immersible_zone()
131 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
133 Handle(HYDROData_PolylineXY) aPolyline =
134 Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
135 aPolyline->SetName( "test" );
137 QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
138 TopoDS_Wire aWire = Wire2d( aCoords, true );
139 aPolyline->SetShape( aWire );
141 Handle(HYDROData_ImmersibleZone) aZone =
142 Handle(HYDROData_ImmersibleZone)::DownCast( aDoc->CreateObject( KIND_IMMERSIBLE_ZONE ) );
143 aZone->SetName( "zone" );
144 aZone->SetPolyline( aPolyline );
147 CPPUNIT_ASSERT_EQUAL( false, (bool)aZone->GetTopShape().IsNull() );
149 HYDROData_PolylineOperator anOp;
150 CPPUNIT_ASSERT_EQUAL( true, anOp.Extract( aDoc, aZone ) );
152 Handle(HYDROData_PolylineXY) anOuter =
153 Handle(HYDROData_PolylineXY)::DownCast( aDoc->FindObjectByName( "zone_Outer_1", KIND_POLYLINEXY ) );
154 CPPUNIT_ASSERT_EQUAL( false, (bool)anOuter.IsNull() );
156 TestViewer::show( aZone->GetTopShape(), 1, true, "Extraction_ImmZone" );
157 TestViewer::show( anOuter->GetShape(), 0, true, Qt::red );
158 CPPUNIT_ASSERT_IMAGES
163 void test_HYDROData_PolylineXY::test_extraction_channel_refs_611()
165 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
167 Handle(HYDROData_PolylineXY) aPolyline2d =
168 Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
169 aPolyline2d->SetName( "polyline2d_1" );
170 aPolyline2d->AddSection( "", HYDROData_IPolyline::SECTION_SPLINE, false );
172 Handle(HYDROData_Polyline3D) aPolyline3d =
173 Handle(HYDROData_Polyline3D)::DownCast( aDoc->CreateObject( KIND_POLYLINE ) );
174 aPolyline3d->SetName( "polyline3d_1" );
175 aPolyline3d->SetPolylineXY( aPolyline2d );
177 QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
178 TopoDS_Wire aWire = Wire2d( aCoords, false );
179 aPolyline2d->SetShape( aWire );
180 aPolyline3d->SetTopShape( aWire );
181 aPolyline3d->SetShape3D( aWire );
183 Handle(HYDROData_Profile) aProfile =
184 Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
185 aProfile->SetName( "profile_1" );
187 QList<double> aCoordsPr = QList<double>() << 0.0 << 0.1 << 0.0 << 0.0 << 1.0 << 0.0;
188 TopoDS_Wire aWirePr = Wire3d( aCoordsPr, false );
189 aProfile->SetTopShape( aWirePr );
190 aProfile->SetShape3D( aWirePr );
193 Handle(HYDROData_Channel) aChannel =
194 Handle(HYDROData_Channel)::DownCast( aDoc->CreateObject( KIND_CHANNEL ) );
195 aChannel->SetName( "channel_1" );
197 aChannel->SetGuideLine( aPolyline3d );
198 aChannel->SetProfile( aProfile );
200 CPPUNIT_ASSERT_EQUAL( false, (bool)aChannel->GetTopShape().IsNull() );
201 CPPUNIT_ASSERT_EQUAL( false, (bool)aChannel->GetShape3D().IsNull() );
203 HYDROData_PolylineOperator anOp;
204 CPPUNIT_ASSERT_EQUAL( true, anOp.Extract( aDoc, aChannel ) );
206 Handle(HYDROData_PolylineXY) aLeft =
207 Handle(HYDROData_PolylineXY)::DownCast( aDoc->FindObjectByName( "channel_1_Left_Bank_1", KIND_POLYLINEXY ) );
208 Handle(HYDROData_PolylineXY) aRight =
209 Handle(HYDROData_PolylineXY)::DownCast( aDoc->FindObjectByName( "channel_1_Right_Bank_1", KIND_POLYLINEXY ) );
210 CPPUNIT_ASSERT_EQUAL( false, (bool)aRight.IsNull() );
212 TestViewer::show( aChannel->GetTopShape(), 1, true, "Extraction_Channel" );
213 TestViewer::show( aLeft->GetShape(), 0, true, Qt::red );
214 TestViewer::show( aRight->GetShape(), 0, true, Qt::red );
215 CPPUNIT_ASSERT_IMAGES
220 void test_HYDROData_PolylineXY::test_presentation()
222 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
224 Handle(HYDROData_PolylineXY) aPolyline2d =
225 Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
226 aPolyline2d->SetName( "polyline2d_1" );
227 aPolyline2d->AddSection( "", HYDROData_IPolyline::SECTION_SPLINE, false );
229 QList<gp_XY> aPoints = QList<gp_XY>() << gp_XY( 0, 0 )
239 Handle(TColgp_HArray1OfPnt) aPnts = new TColgp_HArray1OfPnt( 1, aPoints.size() );
241 foreach( gp_XY aPoint, aPoints )
243 aPolyline2d->AddPoint( 0, aPoint );
244 aPnts->SetValue( i, gp_Pnt( aPoint.X(), aPoint.Y(), 0 ) );
247 aPolyline2d->Update();
249 CPPUNIT_ASSERT_EQUAL( false, (bool)aPolyline2d->GetShape().IsNull() );
251 Handle(AIS_PointCloud) aPointsPrs = new AIS_PointCloud();
252 aPointsPrs->SetPoints( aPnts );
253 aPointsPrs->SetColor( Quantity_NOC_BLUE1 );
254 aPointsPrs->Attributes()->PointAspect()->SetTypeOfMarker( Aspect_TOM_O );
256 Handle(HYDROGUI_Polyline) aNewPolylinePrs = new HYDROGUI_Polyline( aPolyline2d->GetShape() );
257 aNewPolylinePrs->SetColor( Quantity_NOC_DARKGREEN );
259 TestViewer::show( aPointsPrs, AIS_PointCloud::DM_Points, 0, true, "Polyline_Presentation" );
260 TestViewer::show( aPolyline2d->GetShape(), 0, true, Qt::red );
261 TestViewer::show( aNewPolylinePrs, AIS_PointCloud::DM_Points, 0, true, "" );
262 CPPUNIT_ASSERT_IMAGES
267 void test_HYDROData_PolylineXY::test_split_refs_627()
269 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
271 Handle(HYDROData_PolylineXY) aPolyline =
272 Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
273 aPolyline->SetName( "test" );
275 QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
276 TopoDS_Wire aWire = Wire2d( aCoords, false );
277 aPolyline->SetShape( aWire );
278 aPolyline->SetWireColor( Qt::red );
280 gp_Pnt2d aPnt( 20, 20 );
282 HYDROData_PolylineOperator anOp;
283 CPPUNIT_ASSERT_EQUAL( true, anOp.Split( aDoc, aPolyline, aPnt, 1E-3 ) );
285 TestViewer::show( TopoDS_Shape(), 0, true, "Split_Polylines_Colors" );
286 HYDROData_Iterator anIt( aDoc, KIND_POLYLINEXY );
287 for( ; anIt.More(); anIt.Next() )
289 Handle(HYDROData_PolylineXY) anObj = Handle(HYDROData_PolylineXY)::DownCast( anIt.Current() );
290 if( aPolyline->Label() != anObj->Label() )
291 TestViewer::show( anObj->GetShape(), 0, true, anObj->GetWireColor() );
293 CPPUNIT_ASSERT_IMAGES
295 HYDROData_Iterator anIt2( aDoc, KIND_POLYLINEXY );
296 CPPUNIT_ASSERT_EQUAL( true, anIt2.More() );
297 CPPUNIT_ASSERT_EQUAL( QString( "test" ), anIt2.Current()->GetName() );
298 CPPUNIT_ASSERT_EQUAL( QColor( Qt::red ),
299 Handle(HYDROData_PolylineXY)::DownCast( anIt2.Current() )->GetWireColor() );
301 CPPUNIT_ASSERT_EQUAL( true, anIt2.More() );
302 CPPUNIT_ASSERT_EQUAL( QString( "test_1" ), anIt2.Current()->GetName() );
303 CPPUNIT_ASSERT_EQUAL( QColor( Qt::red ),
304 Handle(HYDROData_PolylineXY)::DownCast( anIt2.Current() )->GetWireColor() );
306 CPPUNIT_ASSERT_EQUAL( true, anIt2.More() );
307 CPPUNIT_ASSERT_EQUAL( QString( "test_2" ), anIt2.Current()->GetName() );
308 CPPUNIT_ASSERT_EQUAL( QColor( Qt::red ),
309 Handle(HYDROData_PolylineXY)::DownCast( anIt2.Current() )->GetWireColor() );
311 CPPUNIT_ASSERT_EQUAL( false, anIt2.More() );
317 void test_HYDROData_PolylineXY::test_custom_polylines()
319 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
321 Handle(HYDROData_PolylineXY) aPolyline1 =
322 Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
323 Handle(HYDROData_PolylineXY) aPolyline2 =
324 Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
325 Handle(HYDROData_PolylineXY) aPolyline3 =
326 Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
328 aPolyline1->SetName( "test1" );
329 aPolyline2->SetName( "test2" );
330 aPolyline3->SetName( "test3" );
332 CPPUNIT_ASSERT_EQUAL( false, aPolyline1->IsCustom() );
333 aPolyline1->AddSection( "", HYDROData_IPolyline::SECTION_SPLINE, false );
334 aPolyline1->Update();
335 CPPUNIT_ASSERT_EQUAL( false, aPolyline1->IsCustom() );
336 aPolyline1->AddPoint( 0, gp_XY( 0, 0 ) );
337 aPolyline1->Update();
338 CPPUNIT_ASSERT_EQUAL( false, aPolyline1->IsCustom() );
340 CPPUNIT_ASSERT_EQUAL( false, aPolyline2->IsCustom() );
341 aPolyline2->SetShape( Wire2d( QList<double>() << 0 << 0 << 10 << 10 << 20 << 0 ) );
342 CPPUNIT_ASSERT_EQUAL( true, aPolyline2->IsCustom() );
343 HYDROData_PolylineXY::PointsList aPointsList = aPolyline2->GetPoints( 0 );
345 CPPUNIT_ASSERT_EQUAL( false, aPolyline2->IsCustom() );
346 CPPUNIT_ASSERT_EQUAL( 5, aPointsList.Size() );
347 CPPUNIT_ASSERT_EQUAL( gp_XY( 0, 0 ), aPointsList.Value( 1 ) );
348 CPPUNIT_ASSERT_EQUAL( gp_XY( 5, 7.5 ), aPointsList.Value( 2 ) );
349 CPPUNIT_ASSERT_EQUAL( gp_XY( 10, 10 ), aPointsList.Value( 3 ) );
350 CPPUNIT_ASSERT_EQUAL( gp_XY( 15, 7.5 ), aPointsList.Value( 4 ) );
351 CPPUNIT_ASSERT_EQUAL( gp_XY( 20, 0 ), aPointsList.Value( 5 ) );
354 CPPUNIT_ASSERT_EQUAL( false, aPolyline3->IsCustom() );
355 aPolyline3->SetShape( WireCirc( gp_Pnt(), 10.0 ) );
356 CPPUNIT_ASSERT_EQUAL( true, aPolyline3->IsCustom() );
357 aPointsList = aPolyline3->GetPoints( 0 );
359 CPPUNIT_ASSERT_EQUAL( HYDROData_PolylineXY::SECTION_SPLINE, aPolyline3->GetSectionType( 0 ) );
360 CPPUNIT_ASSERT_EQUAL( true, aPolyline3->IsClosedSection( 0 ) );
361 CPPUNIT_ASSERT_EQUAL( 7, aPointsList.Size() );
362 CPPUNIT_ASSERT_EQUAL( gp_XY( 10, 0 ), aPointsList.Value( 1 ) );
363 CPPUNIT_ASSERT_EQUAL( gp_XY( 6.2349, 7.81831 ), aPointsList.Value( 2 ) );
364 CPPUNIT_ASSERT_EQUAL( gp_XY( -2.225, 9.749 ), aPointsList.Value( 3 ) );
365 CPPUNIT_ASSERT_EQUAL( gp_XY( -9.01, 4.339 ), aPointsList.Value( 4 ) );
366 CPPUNIT_ASSERT_EQUAL( gp_XY( -9.01, -4.339 ), aPointsList.Value( 5 ) );
367 CPPUNIT_ASSERT_EQUAL( gp_XY( -2.225, -9.749 ), aPointsList.Value( 6 ) );
368 CPPUNIT_ASSERT_EQUAL( gp_XY( 6.2349, -7.81831 ), aPointsList.Value( 7 ) );
373 void test_HYDROData_PolylineXY::test_merge_refs_630()
375 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
377 Handle(HYDROData_PolylineXY) aPolyline1 =
378 Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
379 Handle(HYDROData_PolylineXY) aPolyline2 =
380 Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
382 aPolyline1->SetName( "test1" );
383 aPolyline1->AddSection( "", HYDROData_PolylineXY::SECTION_SPLINE, false );
384 aPolyline1->AddPoint( 0, gp_XY( 0, 0 ) );
385 aPolyline1->AddPoint( 0, gp_XY( 10, 0 ) );
386 aPolyline1->AddPoint( 0, gp_XY( 10, 10 ) );
387 aPolyline1->Update();
389 aPolyline2->SetName( "test2" );
390 aPolyline2->AddSection( "", HYDROData_PolylineXY::SECTION_SPLINE, false );
391 aPolyline2->AddPoint( 0, gp_XY( 20, 20 ) );
392 aPolyline2->AddPoint( 0, gp_XY( 30, 20 ) );
393 aPolyline2->AddPoint( 0, gp_XY( 30, 0 ) );
394 aPolyline2->Update();
396 HYDROData_PolylineOperator anOp;
397 HYDROData_SequenceOfObjects aPolylines;
398 aPolylines.Append( aPolyline1 );
399 aPolylines.Append( aPolyline2 );
400 CPPUNIT_ASSERT_EQUAL( true, anOp.Merge( aDoc, "", aPolylines, true, 1E-3 ) );
401 //TODO: check false in merge
403 HYDROData_Iterator anIt( aDoc, KIND_POLYLINEXY );
404 CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
405 CPPUNIT_ASSERT_EQUAL( QString( "test1" ), anIt.Current()->GetName() );
407 CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
408 CPPUNIT_ASSERT_EQUAL( QString( "test2" ), anIt.Current()->GetName() );
410 CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
411 CPPUNIT_ASSERT_EQUAL( QString( "merged_1" ), anIt.Current()->GetName() );
412 Handle(HYDROData_PolylineXY) aMerged =
413 Handle(HYDROData_PolylineXY)::DownCast( anIt.Current() );
415 CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
417 TestViewer::show( aMerged->GetShape(), 0, true, "Merge_Polylines" );
418 CPPUNIT_ASSERT_IMAGES
423 void test_HYDROData_PolylineXY::test_split_straight_refs_634()
425 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
427 Handle(HYDROData_PolylineXY) aPolyline1 =
428 Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
429 Handle(HYDROData_PolylineXY) aPolyline2 =
430 Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
432 aPolyline1->SetName( "test1" );
433 aPolyline1->AddSection( "", HYDROData_PolylineXY::SECTION_POLYLINE, false );
434 aPolyline1->AddPoint( 0, gp_XY( 0, 0 ) );
435 aPolyline1->AddPoint( 0, gp_XY( 10, 20 ) );
436 aPolyline1->AddPoint( 0, gp_XY( 30, 10 ) );
437 aPolyline1->Update();
439 aPolyline2->SetName( "test2" );
440 aPolyline2->AddSection( "", HYDROData_PolylineXY::SECTION_SPLINE, false );
441 aPolyline2->AddPoint( 0, gp_XY( 0, 30 ) );
442 aPolyline2->AddPoint( 0, gp_XY( 10, 10 ) );
443 aPolyline2->AddPoint( 0, gp_XY( 30, 20 ) );
444 aPolyline2->Update();
446 HYDROData_PolylineOperator anOp;
447 HYDROData_SequenceOfObjects aPolylines;
448 aPolylines.Append( aPolyline1 );
449 aPolylines.Append( aPolyline2 );
451 CPPUNIT_ASSERT_EQUAL( true, anOp.Split( aDoc, aPolyline1, aPolyline2, 1E-3, isIntersected ) );
452 CPPUNIT_ASSERT_EQUAL( true, isIntersected );
454 HYDROData_Iterator anIt( aDoc, KIND_POLYLINEXY );
455 CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
456 CPPUNIT_ASSERT_EQUAL( QString( "test1" ), anIt.Current()->GetName() );
458 CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
459 CPPUNIT_ASSERT_EQUAL( QString( "test2" ), anIt.Current()->GetName() );
462 CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
463 CPPUNIT_ASSERT_EQUAL( QString( "test1_1" ), anIt.Current()->GetName() );
464 Handle(HYDROData_PolylineXY) aPart1 =
465 Handle(HYDROData_PolylineXY)::DownCast( anIt.Current() );
466 CPPUNIT_ASSERT_EQUAL( HYDROData_PolylineXY::SECTION_POLYLINE, aPart1->GetSectionType( 0 ) );
469 CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
470 CPPUNIT_ASSERT_EQUAL( QString( "test1_2" ), anIt.Current()->GetName() );
471 Handle(HYDROData_PolylineXY) aPart2 =
472 Handle(HYDROData_PolylineXY)::DownCast( anIt.Current() );
473 CPPUNIT_ASSERT_EQUAL( HYDROData_PolylineXY::SECTION_POLYLINE, aPart2->GetSectionType( 0 ) );
476 CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
477 CPPUNIT_ASSERT_EQUAL( QString( "test1_3" ), anIt.Current()->GetName() );
478 Handle(HYDROData_PolylineXY) aPart3 =
479 Handle(HYDROData_PolylineXY)::DownCast( anIt.Current() );
480 CPPUNIT_ASSERT_EQUAL( HYDROData_PolylineXY::SECTION_POLYLINE, aPart3->GetSectionType( 0 ) );
483 CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
485 TestViewer::show( aPart1->GetShape(), 0, true, "Split_Straight" );
486 TestViewer::show( aPart2->GetShape(), 0, true, Qt::red );
487 TestViewer::show( aPart3->GetShape(), 0, true, Qt::green );
488 TestViewer::show( aPolyline2->GetShape(), 0, true, Qt::darkGreen );
489 CPPUNIT_ASSERT_IMAGES