Salome HOME
Merge branch 'master' into BR_quadtree
[modules/hydro.git] / src / HYDROData / HYDROData_PolylineXY.cxx
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.
6 //
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.
11 //
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
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #include "HYDROData_PolylineXY.h"
20
21 #include "HYDROData_BSplineOperation.h"
22 #include "HYDROData_Document.h"
23 #include "HYDROData_ShapesTool.h"
24 #include "HYDROData_Tool.h"
25
26 #include <BRep_Builder.hxx>
27 #include <BRepBuilderAPI_MakeEdge.hxx>
28 #include <BRepBuilderAPI_MakeWire.hxx>
29 #include <BRepBuilderAPI_MakePolygon.hxx>
30 #include <BRepBuilderAPI_MakeFace.hxx>
31 #include <BRepOffsetAPI_NormalProjection.hxx>
32 #include <BRepAdaptor_Curve.hxx>
33
34 #ifndef LIGHT_MODE
35 #include <GEOMBase.h>
36 #endif
37
38 #include <GeomAPI_ProjectPointOnCurve.hxx>
39 #include <GeomAdaptor_Curve.hxx>
40 #include <Geom_Line.hxx>
41 #include <Geom_BSplineCurve.hxx>
42
43 #include <GCPnts_AbscissaPoint.hxx>
44 #include <GCPnts_QuasiUniformDeflection.hxx>
45
46 #include <ImageComposer_MetaTypes.h>
47
48 #include <gp_Pnt.hxx>
49 #include <gp_XY.hxx>
50 #include <gp_Pln.hxx>
51
52 #include <NCollection_Map.hxx>
53
54 #include <TCollection_ExtendedString.hxx>
55
56 #include <TDataStd_ListIteratorOfListOfByte.hxx>
57 #include <TColStd_ListIteratorOfListOfInteger.hxx>
58 #include <TColStd_ListIteratorOfListOfReal.hxx>
59
60 #include <TColStd_Array1OfReal.hxx>
61 #include <TColgp_Array1OfPnt.hxx>
62
63 #include <TDataStd_AsciiString.hxx>
64 #include <TDataStd_BooleanList.hxx>
65 #include <TDataStd_ExtStringList.hxx>
66 #include <TDataStd_IntegerList.hxx>
67 #include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
68 #include <TDataStd_RealList.hxx>
69 #include <TDataStd_UAttribute.hxx>
70
71 #include <TopoDS_Iterator.hxx>
72 #include <TopTools_ListIteratorOfListOfShape.hxx>
73 #include <TopTools_HSequenceOfShape.hxx>
74 #include <TopExp_Explorer.hxx>
75 #include <ShapeAnalysis_FreeBounds.hxx>
76 #include <TopoDS.hxx>
77
78 #include <QColor>
79 #include <QPainterPath>
80 #include <QVariant>
81
82 static const Standard_GUID GUID_IS_UNEDITABLE("e5799736-9030-4051-91a4-2e58321fa153");
83
84 const double LOCAL_SELECTION_TOLERANCE = 0.0001;
85
86 TCollection_AsciiString getUniqueSectionName( const NCollection_Sequence<TCollection_AsciiString>& theNamesSeq )
87 {
88   NCollection_Map<TCollection_AsciiString> aNamesMap;
89
90   for ( int i = 1, n = theNamesSeq.Size(); i <= n; ++i )
91   {
92     const TCollection_AsciiString& aSectName = theNamesSeq.Value( i );
93     aNamesMap.Add( aSectName );
94   }
95
96   TCollection_AsciiString aResName;
97
98   int aPrefIdx = 1;
99   do
100   {
101     aResName = TCollection_AsciiString( "Section_" ) + aPrefIdx;
102     ++aPrefIdx;
103   }
104   while ( aNamesMap.Contains( aResName ) );
105
106   return aResName;
107 }
108
109 TCollection_AsciiString getUniqueSectionName( const Handle(TDataStd_ExtStringList)& theNamesList )
110 {
111   NCollection_Sequence<TCollection_AsciiString> aNamesSeq;
112
113   TDataStd_ListIteratorOfListOfExtendedString aNamesIter( theNamesList->List() );
114   for ( ; aNamesIter.More(); aNamesIter.Next() )
115     aNamesSeq.Append( aNamesIter.Value() );
116
117   return getUniqueSectionName( aNamesSeq );
118 }
119
120 IMPLEMENT_STANDARD_HANDLE(HYDROData_PolylineXY, HYDROData_IPolyline)
121 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_PolylineXY, HYDROData_IPolyline)
122
123 HYDROData_PolylineXY::HYDROData_PolylineXY()
124 : HYDROData_IPolyline(),
125   myIsInCustomFlag( false )
126 {
127 }
128
129 HYDROData_PolylineXY::~HYDROData_PolylineXY()
130 {
131 }
132
133 QStringList HYDROData_PolylineXY::DumpToPython( const QString&       thePyScriptPath,
134                                                 MapOfTreatedObjects& theTreatedObjects ) const
135 {
136   QStringList aResList = dumpObjectCreation( theTreatedObjects );
137   QString aPolylineName = GetObjPyName();
138
139   // Set the wire color
140   QStringList aWireColorDef;
141
142   QColor aWireColor = GetWireColor();
143   setPythonObjectColor( aWireColorDef, aWireColor, DefaultWireColor(), "SetWireColor" );
144   
145   if ( !aWireColorDef.isEmpty() )
146   {
147     aResList << aWireColorDef;
148     aResList << QString( "" );
149   }
150
151   bool anIsEditable = IsEditable();
152   if ( !anIsEditable )
153   {
154     // If polyline is not editable we try to import the shape from geom
155     TCollection_AsciiString aGeomObjectEntry = GetGeomObjectEntry();
156     if ( !aGeomObjectEntry.IsEmpty() )
157     {
158       QString aSalomeObjName = HYDROData_Tool::GenerateNameForPython( theTreatedObjects, "polyline_sobj" );
159       aResList << QString( "%1 = salome.myStudy.FindObjectID( \"%2\" )" )
160                   .arg( aSalomeObjName ).arg( aGeomObjectEntry.ToCString() );
161
162       aResList << QString( "%1.ImportFromGeomIOR( %2.GetIOR() )" )
163                   .arg( aPolylineName ).arg( aSalomeObjName );
164
165       aResList << QString( "%1.SetGeomObjectEntry( \"%2\" )" )
166                   .arg( aPolylineName ).arg( aGeomObjectEntry.ToCString() );
167     }
168   }
169   else
170   {
171     // Set polilyne data
172     NCollection_Sequence<TCollection_AsciiString>           aSectNames;
173     NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
174     NCollection_Sequence<bool>                              aSectClosures;
175     GetSections( aSectNames, aSectTypes, aSectClosures );
176
177     for ( int i = 1, n = aSectNames.Size(); i <= n; ++i )
178     {
179       const TCollection_AsciiString& aSectName = aSectNames.Value( i );
180       const SectionType& aSectType = aSectTypes.Value( i );
181       bool aSectClosure = aSectClosures.Value( i );
182
183       aResList << QString( "%1.AddSection( \"%2\", %3, %4 )" ).arg( aPolylineName )
184                   .arg( aSectName.ToCString() ).arg( aSectType ).arg( aSectClosure );
185
186       HYDROData_IPolyline::PointsList aSectPointsList = GetPoints( i - 1 );
187       for ( int k = 1, aNbPoints = aSectPointsList.Size(); k <= aNbPoints; ++k )
188       {
189         const Point& aSectPoint = aSectPointsList.Value( k );
190
191         QString anXStr = QString::number( aSectPoint.X(), 'f', 2 );
192         QString anYStr = QString::number( aSectPoint.Y(), 'f', 2 );
193         aResList << QString( "%1.AddPoint( %2, gp_XY( %3, %4 ) )" ).arg( aPolylineName )
194           .arg( i - 1 ).arg( anXStr ).arg( anYStr );
195       }
196     }
197   }
198   aResList << QString( "" );
199   aResList << QString( "%1.Update()" ).arg( aPolylineName );
200   aResList << QString( "" );
201
202   return aResList;
203 }
204
205 QVariant HYDROData_PolylineXY::GetDataVariant()
206 {
207   QPainterPath aPath = GetPainterPath();
208
209   QVariant aVarData;
210   aVarData.setValue<QPainterPath>( aPath );
211   
212   return aVarData;
213 }
214
215 QColor HYDROData_PolylineXY::DefaultWireColor()
216 {
217   return QColor( Qt::red );
218 }
219
220 bool HYDROData_PolylineXY::ImportFromGeomIOR( const TCollection_AsciiString& theIOR )
221 {
222 #ifdef LIGHT_MODE
223   return false;
224 #else
225   if ( theIOR.IsEmpty() )
226     return false;
227
228   TopoDS_Shape aShape = GEOMBase::GetShapeFromIOR( theIOR.ToCString() );
229   if ( aShape.IsNull() )
230     return false;
231
232   return ImportShape( aShape );
233 #endif
234 }
235
236 void HYDROData_PolylineXY::SetGeomObjectEntry( const TCollection_AsciiString& theEntry )
237 {
238   TDataStd_AsciiString::Set( myLab.FindChild( DataTag_GeomObjectEntry ), theEntry );
239 }
240
241 TCollection_AsciiString HYDROData_PolylineXY::GetGeomObjectEntry() const
242 {
243   TCollection_AsciiString aRes;
244
245   TDF_Label aLabel = myLab.FindChild( DataTag_GeomObjectEntry, false );
246   if ( !aLabel.IsNull() )
247   {
248     Handle(TDataStd_AsciiString) anAsciiStr;
249     if ( aLabel.FindAttribute( TDataStd_AsciiString::GetID(), anAsciiStr ) )
250       aRes = anAsciiStr->Get();
251   }
252
253   return aRes;
254 }
255
256 bool convertEdgeToSection( const TopoDS_Edge&                                       theEdge,
257                            NCollection_Sequence<TCollection_AsciiString>&           theSectNames,
258                            NCollection_Sequence<HYDROData_PolylineXY::SectionType>& theSectTypes,
259                            NCollection_Sequence<bool>&                              theSectClosures,
260                            NCollection_Sequence<HYDROData_PolylineXY::PointsList>&  theSectPoints,
261                            bool                                                     IsCanBeClosed,
262                            bool                                                     IsInterpolationAllowed,
263                            double                                                   theDeflection )
264 {
265   Standard_Real aFirst = 0.0, aLast = 0.0;
266   Handle(Geom_Curve) anEdgeGeomCurve = BRep_Tool::Curve( theEdge, aFirst, aLast );
267   if ( anEdgeGeomCurve.IsNull() )
268     return false;
269
270   TCollection_AsciiString aSectName = getUniqueSectionName( theSectNames );
271   bool anIsEdgeClosed = anEdgeGeomCurve->IsClosed();
272
273   HYDROData_PolylineXY::SectionType aSectionType = HYDROData_PolylineXY::SECTION_POLYLINE;
274   HYDROData_PolylineXY::PointsList aPointsList;
275
276   if( anEdgeGeomCurve->IsKind( STANDARD_TYPE(Geom_Line) ) )
277   {
278     Handle(Geom_Line) aGeomLine = Handle(Geom_Line)::DownCast( anEdgeGeomCurve );
279
280     gp_Pnt aFirstPoint, aLastPoint;
281     aGeomLine->D0( aFirst, aFirstPoint );
282     aGeomLine->D0( aLast, aLastPoint );
283
284     HYDROData_PolylineXY::Point aSectFirstPoint( aFirstPoint.X(), aFirstPoint.Y() );
285     aPointsList.Append( aSectFirstPoint );
286
287     HYDROData_PolylineXY::Point aSectLastPoint( aLastPoint.X(), aLastPoint.Y() );
288     aPointsList.Append( aSectLastPoint );
289   }
290   else if ( anEdgeGeomCurve->IsKind( STANDARD_TYPE(Geom_BSplineCurve) ) || IsInterpolationAllowed )
291   {
292     aSectionType = HYDROData_PolylineXY::SECTION_SPLINE;
293
294     BRepAdaptor_Curve anAdaptorCurve( theEdge );
295     GCPnts_QuasiUniformDeflection aDiscrete( anAdaptorCurve, theDeflection );
296
297     int aNbPoints = aDiscrete.NbPoints();
298
299     // Decrease the number of imported poles because of last one 
300     // pole is the closing point which are the start point
301     if ( anIsEdgeClosed ) aNbPoints--;
302
303     for ( int i = 1; i <= aNbPoints; ++i )
304     {
305       const gp_Pnt& aPoint = aDiscrete.Value( i );
306
307       HYDROData_PolylineXY::Point aSectPoint( aPoint.X(), aPoint.Y() );
308       aPointsList.Append( aSectPoint );
309     }
310   }
311   else
312   {
313     // Other curve types are not supported
314     return false;
315   }
316
317   if ( aPointsList.IsEmpty() )
318     return false;
319
320   theSectNames.Append( aSectName );
321   theSectTypes.Append( aSectionType );
322   theSectClosures.Append( anIsEdgeClosed );
323   theSectPoints.Append( aPointsList );
324
325   return true;
326 }
327
328 bool HYDROData_PolylineXY::ImportShape( const TopoDS_Shape& theShape,
329                                         bool IsInterpolationAllowed,
330                                         double theDeviation )
331 {
332   if ( theShape.IsNull() )
333     return false;
334
335   RemoveSections();
336
337   bool anIsCanBeImported = false;
338
339   NCollection_Sequence<TCollection_AsciiString> aSectNames;
340   NCollection_Sequence<SectionType>             aSectTypes;
341   NCollection_Sequence<bool>                    aSectClosures;
342   NCollection_Sequence<PointsList>              aSectPoints;
343
344   if ( theShape.ShapeType() == TopAbs_EDGE )
345   {
346     TopoDS_Edge anEdge = TopoDS::Edge( theShape );
347     anIsCanBeImported = convertEdgeToSection( anEdge, aSectNames, aSectTypes,
348       aSectClosures, aSectPoints, true, IsInterpolationAllowed, theDeviation );
349   }
350   else if ( theShape.ShapeType() == TopAbs_WIRE )
351   {
352     TopTools_SequenceOfShape anEdges;
353     HYDROData_ShapesTool::ExploreShapeToShapes( theShape, TopAbs_EDGE, anEdges );
354
355     anIsCanBeImported = !anEdges.IsEmpty();
356     for ( int i = 1, n = anEdges.Length(); i <= n && anIsCanBeImported; ++i )
357     {
358       TopoDS_Edge aWireEdge = TopoDS::Edge( anEdges.Value( i ) );
359       anIsCanBeImported = convertEdgeToSection( aWireEdge, aSectNames, aSectTypes,
360         aSectClosures, aSectPoints, false, IsInterpolationAllowed, theDeviation );
361     }
362   }
363
364   if ( anIsCanBeImported )
365   {
366     for ( int i = 1, n = aSectNames.Length(); i <= n; ++i )
367     {
368       const TCollection_AsciiString& aSectName = aSectNames.Value( i );
369       const SectionType& aSectType = aSectTypes.Value( i );
370       bool anIsSectionClosed = aSectClosures.Value( i );
371       const PointsList& aSectPointsList = aSectPoints( i );
372
373       AddSection( aSectName, aSectType, anIsSectionClosed );
374       SetPoints( i - 1, aSectPointsList );
375     }
376   }
377   else
378   {
379     TopoDS_Shape aShape = theShape;
380
381     if ( theShape.ShapeType() == TopAbs_EDGE )
382     {
383       // We make the wire from incoming edge because of other algorithms
384       // are waiting at least the wire from polyline
385       TopoDS_Edge anEdge = TopoDS::Edge( theShape );
386       BRepBuilderAPI_MakeWire aMakeWire( anEdge );
387       aMakeWire.Build();
388       if ( aMakeWire.IsDone() )
389         aShape = aMakeWire.Wire();
390     }
391
392     gp_Pln aPlane( gp_Pnt( 0, 0, 0 ), gp_Dir( 0, 0, 1 ) );
393     BRepBuilderAPI_MakeFace aMakeFace( aPlane );
394     aMakeFace.Build();
395     BRepOffsetAPI_NormalProjection aProj( aMakeFace.Face() );
396     aProj.Add( aShape );
397     aProj.Build();
398     TopoDS_Shape aResult;
399     if( aProj.IsDone() )
400       aResult = aProj.Shape();
401
402     SetShape( aResult );
403   }
404
405   setEditable( anIsCanBeImported );
406
407   return true;
408 }
409
410 TopoDS_Wire HYDROData_PolylineXY::BuildWire( const SectionType&                  theType,
411                                              const bool&                         theIsClosed,
412                                              const NCollection_Sequence<gp_XYZ>& thePoints )
413 {
414   TopoDS_Wire aWire;
415   if( theType == SECTION_POLYLINE )
416   {
417     int aNbPoints = thePoints.Length();
418     BRepBuilderAPI_MakePolygon aMakeWire;
419     for ( int i = 1, n = aNbPoints; i <= n ; ++i )
420     {
421       gp_XYZ aPoint = thePoints.Value( i );
422       gp_Pnt aPnt( aPoint.X(), aPoint.Y(), aPoint.Z() );
423       aMakeWire.Add( aPnt );
424     }
425     if( theIsClosed && ( aNbPoints > 2 ) )
426       aMakeWire.Close();
427
428     if ( aMakeWire.IsDone() )
429       aWire = aMakeWire.Wire();
430   }
431   else //if( theType == PolylineSection::SECTION_SPLINE )
432   {
433     BRepBuilderAPI_MakeWire aMakeWire;
434
435     if ( thePoints.Size() > 1 )
436     {
437       Handle(Geom_BSplineCurve) aCurve = 
438         HYDROData_BSplineOperation::ComputeCurve( thePoints, theIsClosed, LOCAL_SELECTION_TOLERANCE );
439
440       TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aCurve ).Edge();
441       aMakeWire.Add( anEdge );
442     }
443     aMakeWire.Build();
444     if ( aMakeWire.IsDone() )
445       aWire = aMakeWire;
446   }
447
448   return aWire;
449 }
450
451 void HYDROData_PolylineXY::BuildPainterPath( QPainterPath&                       thePath,
452                                              const SectionType&                  theType,
453                                              const bool&                         theIsClosed,
454                                              const NCollection_Sequence<gp_XYZ>& thePoints )
455 {
456   if ( thePoints.IsEmpty() )
457     return;
458
459   if ( theType == SECTION_POLYLINE )
460   {
461     const gp_XYZ& aFirstPoint = thePoints.Value( 1 );
462     thePath.moveTo( aFirstPoint.X(), aFirstPoint.Y() );
463
464     for( int i = 2, n = thePoints.Size(); i <= n; ++i )
465     {
466       const gp_XYZ& aSectPoint = thePoints.Value( i );
467
468       thePath.lineTo( aSectPoint.X(), aSectPoint.Y() );
469     }
470
471     if( theIsClosed )
472       thePath.closeSubpath();
473   }
474   else
475   {
476     Handle(Geom_BSplineCurve) aCurve = 
477       HYDROData_BSplineOperation::ComputeCurve( thePoints, theIsClosed, LOCAL_SELECTION_TOLERANCE );
478     HYDROData_BSplineOperation::ComputePath( aCurve, thePath );
479   }
480 }
481
482 void HYDROData_PolylineXY::Update()
483 {
484   if ( !IsEditable() )
485   {
486     // If polyline is not editable we no need to update it wire
487     ClearChanged();
488     return;
489   }
490
491   HYDROData_IPolyline::Update();
492
493   NCollection_Sequence<TCollection_AsciiString>           aSectNames;
494   NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
495   NCollection_Sequence<bool>                              aSectClosures;
496   GetSections( aSectNames, aSectTypes, aSectClosures );
497
498   //BRepBuilderAPI_MakeWire aMakeWire;
499
500   TopTools_ListOfShape aSectionWiresList;
501
502   for ( int aSectionId = 1, aNbSects = aSectNames.Size(); aSectionId <= aNbSects; aSectionId++ )
503   {
504     TCollection_AsciiString aSectName = aSectNames.Value( aSectionId );
505     SectionType aSectionType = aSectTypes.Value( aSectionId );
506     bool anIsSectionClosed = aSectClosures.Value( aSectionId );
507
508     PointsList aSectPointsList = GetPoints( aSectionId - 1 );
509     if ( aSectPointsList.IsEmpty() )
510       continue;
511     
512     NCollection_Sequence<gp_XYZ> aPoints;
513     for( int i = 1, n = aSectPointsList.Size(); i <= n; ++i )
514     {
515       const Point& aSectPoint = aSectPointsList.Value( i );
516
517       gp_XYZ aPoint( aSectPoint.X(), aSectPoint.Y(), 0.0 );
518       aPoints.Append( aPoint );
519     }
520
521     TopoDS_Wire aSectionWire = BuildWire( aSectionType, anIsSectionClosed, aPoints );
522     if ( !aSectionWire.IsNull() ) {
523       aSectionWiresList.Append( aSectionWire );
524       //aMakeWire.Add( aSectionWire );
525     }
526   }
527 // all input wires in the <aSectionWiresList>
528   Handle(TopTools_HSequenceOfShape) aSeqWires = new TopTools_HSequenceOfShape;
529   Handle(TopTools_HSequenceOfShape) aSeqEdges = new TopTools_HSequenceOfShape;
530   TopTools_ListIteratorOfListOfShape it(aSectionWiresList);
531   for(;it.More();it.Next())
532   {
533     TopExp_Explorer it2(it.Value(), TopAbs_EDGE);
534     for(;it2.More();it2.Next()) 
535       aSeqEdges->Append(it2.Current());
536   }
537
538   BRep_Builder aBB;
539   TopoDS_Compound aCmp;
540   TopoDS_Shape aResult;
541   aBB.MakeCompound(aCmp);
542   if(aSeqEdges->Length() >1)
543   {
544     ShapeAnalysis_FreeBounds::ConnectEdgesToWires( aSeqEdges, 1E-5, Standard_True, aSeqWires );
545
546     if( aSeqWires->Length()==1 )
547       aResult = aSeqWires->Value( 1 );
548     else
549     {
550       for (Standard_Integer i = 1; i <= aSeqWires->Length();i++)
551       {
552         const TopoDS_Shape& aS1 = aSeqWires->Value(i);
553         aBB.Add(aCmp, aS1);
554       }
555       aResult = aCmp;
556     }
557   }
558   else if (aSeqEdges->Length() == 1)
559   {
560     BRepBuilderAPI_MakeWire mkWire (TopoDS::Edge(aSeqEdges->Value(1)));
561     if (mkWire.IsDone())
562       aResult = mkWire.Wire();
563   }
564
565   SetShape( aResult );
566 }
567
568 bool HYDROData_PolylineXY::IsHas2dPrs() const
569 {
570   return true;
571 }
572
573 bool HYDROData_PolylineXY::IsEditable() const
574 {
575   return !myLab.IsAttribute( GUID_IS_UNEDITABLE );
576 }
577
578 void HYDROData_PolylineXY::setEditable( const bool theIsEditable )
579 {
580   if ( !theIsEditable )
581     TDataStd_UAttribute::Set( myLab, GUID_IS_UNEDITABLE );
582   else
583     myLab.ForgetAttribute( GUID_IS_UNEDITABLE );
584 }
585
586 /**
587  * Returns true if polyline is closed
588  */
589 bool HYDROData_PolylineXY::IsClosed( const bool theIsSimpleCheck ) const
590 {
591   bool anIsClosed = false;
592
593   TopoDS_Shape aShape = GetShape();
594   if ( aShape.IsNull() )
595     return anIsClosed;
596
597   TopTools_SequenceOfShape aWires;
598   HYDROData_ShapesTool::ExploreShapeToShapes( aShape, TopAbs_WIRE, aWires );
599
600   int aNbWires = aWires.Length();
601   if ( theIsSimpleCheck )
602   {
603     anIsClosed = aNbWires > 0;
604     for ( int i = 1; i <= aNbWires && anIsClosed; ++i )
605     {
606       const TopoDS_Shape& aWire = aWires.Value( i );
607       anIsClosed = BRep_Tool::IsClosed( aWire );
608     }
609   }
610   else
611   {
612     anIsClosed = aNbWires == 1 && BRep_Tool::IsClosed( aWires.First() );
613   }
614
615   return anIsClosed;
616 }
617
618 double HYDROData_PolylineXY::GetDistance( const int theSectionIndex,
619                                           const int thePointIndex ) const
620 {
621   double aResDistance = -1;
622   if ( theSectionIndex < 0 || theSectionIndex >= NbSections() )
623     return aResDistance;
624
625   if ( thePointIndex == 0 )
626     return 0.0;
627
628   SectionType aSectionType = GetSectionType( theSectionIndex );
629   bool anIsSectionClosed = IsClosedSection( theSectionIndex );
630   PointsList aSectPointsList = GetPoints( theSectionIndex );
631   if ( thePointIndex < 0 || thePointIndex >= aSectPointsList.Size()  )
632     return aResDistance;
633
634   if ( aSectionType == SECTION_POLYLINE )
635   {
636     aResDistance = 0.0;
637   
638     Point aPrevPoint = aSectPointsList.Value( 1 );
639     for ( int i = 2, aNbPoints = aSectPointsList.Size(); i <= aNbPoints; ++i )
640     {
641       const Point& aSectPoint = aSectPointsList.Value( i );
642       aResDistance += gp_Pnt2d( aPrevPoint ).Distance( aSectPoint );
643       aPrevPoint = aSectPoint;
644
645       if ( thePointIndex == i - 1 )
646         break;
647     }
648   }
649   else
650   {
651     gp_XYZ aPointToTest;
652
653     int aSectNbPoints = aSectPointsList.Size();
654     NCollection_Sequence<gp_XYZ> aPoints;
655     for( int i = 1 ; i <= aSectNbPoints; ++i )
656     {
657       const Point& aSectPoint = aSectPointsList.Value( i );
658
659       gp_XYZ aPoint( aSectPoint.X(), aSectPoint.Y(), 0.0 );
660       aPoints.Append( aPoint );
661
662       if ( thePointIndex == i - 1 )
663         aPointToTest = aPoint;
664     }
665
666     Handle(Geom_BSplineCurve) aCurve = 
667       HYDROData_BSplineOperation::ComputeCurve( aPoints, anIsSectionClosed, LOCAL_SELECTION_TOLERANCE );
668
669     Quantity_Parameter aFirstParam = aCurve->FirstParameter();
670     Quantity_Parameter aSecondParam = aCurve->LastParameter();
671
672     if ( thePointIndex != aSectNbPoints - 1 )
673     {
674       GeomAPI_ProjectPointOnCurve aProject( aPointToTest, aCurve );
675       aSecondParam = aProject.LowerDistanceParameter();
676     }
677
678     GeomAdaptor_Curve anAdap( aCurve );
679     
680     aResDistance = GCPnts_AbscissaPoint::Length( anAdap, aFirstParam, aSecondParam );
681   }
682
683   return aResDistance;
684 }
685
686 int HYDROData_PolylineXY::NbSections() const
687 {
688   Handle(TDataStd_ExtStringList) aNamesList;
689   Handle(TDataStd_IntegerList)   aTypesList;
690   Handle(TDataStd_BooleanList)   aClosuresList;
691   getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
692
693   return !aClosuresList.IsNull() ? aClosuresList->Extent() : 0;
694 }
695
696 void HYDROData_PolylineXY::AddSection( const TCollection_AsciiString& theSectName,
697                                        const SectionType              theSectionType,
698                                        const bool                     theIsClosed )
699 {
700   Handle(TDataStd_ExtStringList) aNamesList;
701   Handle(TDataStd_IntegerList)   aTypesList;
702   Handle(TDataStd_BooleanList)   aClosuresList;
703   getSectionsLists( aNamesList, aTypesList, aClosuresList );
704
705   TCollection_ExtendedString aSectName( theSectName );
706   if ( aSectName.Length() <= 0 )
707     aSectName = getUniqueSectionName( aNamesList );
708
709   aNamesList->Append( aSectName );
710   aTypesList->Append( theSectionType );
711   aClosuresList->Append( theIsClosed );
712
713   Changed( Geom_2d );
714 }
715
716 TCollection_AsciiString HYDROData_PolylineXY::GetSectionName( const int theSectionIndex ) const
717 {
718   TCollection_AsciiString aResName;
719
720   Handle(TDataStd_ExtStringList) aNamesList;
721   Handle(TDataStd_IntegerList) aTypesList;
722   Handle(TDataStd_BooleanList) aClosuresList;
723   getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
724   if ( aNamesList.IsNull() || theSectionIndex >= aNamesList->Extent() )
725     return aResName;
726
727   TDataStd_ListIteratorOfListOfExtendedString aNamesIter( aNamesList->List() );
728   for ( int i = 0; aNamesIter.More() && i != theSectionIndex; aNamesIter.Next(), ++i );
729
730   if ( aNamesIter.More() )
731     aResName = aNamesIter.Value();
732
733   return aResName;
734 }
735
736 void HYDROData_PolylineXY::SetSectionName( const int                      theSectionIndex, 
737                                            const TCollection_AsciiString& theSectionName )
738 {
739   Handle(TDataStd_ExtStringList) aNamesList;
740   Handle(TDataStd_IntegerList) aTypesList;
741   Handle(TDataStd_BooleanList) aClosuresList;
742   getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
743   if ( aNamesList.IsNull() || theSectionIndex >= aNamesList->Extent() )
744     return;
745
746   TDataStd_ListOfExtendedString anOldNamesList;
747   anOldNamesList = aNamesList->List();
748
749   // Refill the existing list
750   aNamesList->Clear();
751
752   TCollection_ExtendedString aNewSectName = theSectionName;
753
754   TDataStd_ListIteratorOfListOfExtendedString aNamesIter( anOldNamesList );
755   for ( int i = 0; aNamesIter.More(); aNamesIter.Next(), ++i )
756     aNamesList->Append( i == theSectionIndex ? aNewSectName : aNamesIter.Value() );
757 }
758
759 HYDROData_PolylineXY::SectionType HYDROData_PolylineXY::GetSectionType( const int theSectionIndex ) const
760 {
761   Handle(TDataStd_ExtStringList) aNamesList;
762   Handle(TDataStd_IntegerList) aTypesList;
763   Handle(TDataStd_BooleanList) aClosuresList;
764   getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
765   if ( aTypesList.IsNull() || theSectionIndex >= aTypesList->Extent() )
766     return SECTION_POLYLINE;
767
768   TColStd_ListIteratorOfListOfInteger aTypesIter( aTypesList->List() );
769   for ( int i = 0; aTypesIter.More() && i != theSectionIndex; aTypesIter.Next(), ++i );
770
771   return aTypesIter.More() ? (SectionType)aTypesIter.Value() : SECTION_POLYLINE;
772 }
773
774 void HYDROData_PolylineXY::SetSectionType( const int         theSectionIndex, 
775                                            const SectionType theSectionType )
776 {
777   Handle(TDataStd_ExtStringList) aNamesList;
778   Handle(TDataStd_IntegerList) aTypesList;
779   Handle(TDataStd_BooleanList) aClosuresList;
780   getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
781   if ( aTypesList.IsNull() || theSectionIndex >= aTypesList->Extent() )
782     return;
783
784   TColStd_ListOfInteger anOldTypesList;
785   anOldTypesList = aTypesList->List();
786
787   // Refill the existing list
788   aTypesList->Clear();
789
790   TColStd_ListIteratorOfListOfInteger aTypesIter( anOldTypesList );
791   for ( int i = 0; aTypesIter.More(); aTypesIter.Next(), ++i )
792     aTypesList->Append( i == theSectionIndex ? theSectionType : aTypesIter.Value() );
793
794   Changed( Geom_2d );
795 }
796
797 bool HYDROData_PolylineXY::IsClosedSection( const int theSectionIndex ) const
798 {
799   Handle(TDataStd_ExtStringList) aNamesList;
800   Handle(TDataStd_IntegerList) aTypesList;
801   Handle(TDataStd_BooleanList) aClosuresList;
802   getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
803   if ( aClosuresList.IsNull() || theSectionIndex >= aClosuresList->Extent() )
804     return false;
805
806   TDataStd_ListIteratorOfListOfByte aClosuresIter( aClosuresList->List() );
807   for ( int i = 0; aClosuresIter.More() && i != theSectionIndex; aClosuresIter.Next(), ++i );
808
809   return aClosuresIter.More() ? (bool)aClosuresIter.Value() : false;
810 }
811
812 void HYDROData_PolylineXY::SetSectionClosed( const int  theSectionIndex, 
813                                              const bool theIsClosed )
814 {
815   Handle(TDataStd_ExtStringList) aNamesList;
816   Handle(TDataStd_IntegerList) aTypesList;
817   Handle(TDataStd_BooleanList) aClosuresList;
818   getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
819   if ( aClosuresList.IsNull() || theSectionIndex >= aClosuresList->Extent() )
820     return;
821
822   TDataStd_ListOfByte anOldClosuresList;
823   anOldClosuresList = aClosuresList->List();
824
825   // Refill the existing list
826   aClosuresList->Clear();
827
828   TDataStd_ListIteratorOfListOfByte aClosuresIter( anOldClosuresList );
829   for ( int i = 0; aClosuresIter.More(); aClosuresIter.Next(), ++i )
830     aClosuresList->Append( i == theSectionIndex ? theIsClosed : (bool)aClosuresIter.Value() );
831
832   Changed( Geom_2d );
833 }
834
835 void HYDROData_PolylineXY::GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
836                                         NCollection_Sequence<SectionType>&             theSectTypes,
837                                         NCollection_Sequence<bool>&                    theSectClosures ) const
838 {
839   theSectNames.Clear();
840   theSectTypes.Clear();
841   theSectClosures.Clear();
842
843   if( IsCustom() )
844   {
845     const_cast<HYDROData_PolylineXY*>( this )->Interpolate();
846   }
847
848   Handle(TDataStd_ExtStringList) aNamesList;
849   Handle(TDataStd_IntegerList) aTypesList;
850   Handle(TDataStd_BooleanList) aClosuresList;
851   getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
852   if ( aNamesList.IsNull() || aTypesList.IsNull() || aClosuresList.IsNull() )
853     return;
854
855   TDataStd_ListIteratorOfListOfExtendedString aNamesIter( aNamesList->List() );
856   TColStd_ListIteratorOfListOfInteger aTypesIter( aTypesList->List() );
857   TDataStd_ListIteratorOfListOfByte aClosuresIter( aClosuresList->List() );
858   for ( ; aNamesIter.More() && aTypesIter.More() && aClosuresIter.More();
859           aNamesIter.Next(), aTypesIter.Next(), aClosuresIter.Next() )
860   {
861     const TCollection_ExtendedString& aSectName = aNamesIter.Value();
862     SectionType aSectType = (SectionType)aTypesIter.Value();
863     bool aSectClosures = aClosuresIter.Value();
864
865     theSectNames.Append( aSectName );
866     theSectTypes.Append( aSectType );
867     theSectClosures.Append( aSectClosures );
868   }
869 }
870
871 void HYDROData_PolylineXY::RemoveSection( const int theSectionIndex )
872 {
873   Handle(TDataStd_ExtStringList) aNamesList;
874   Handle(TDataStd_IntegerList)   aTypesList;
875   Handle(TDataStd_BooleanList)   aClosuresList;
876   getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
877   if ( aNamesList.IsNull() || theSectionIndex >= aNamesList->Extent() )
878     return;
879
880   if ( aNamesList->Extent() == 1 )
881   {
882     removeSectionsLists();
883     removePointsLists();
884   }
885   else
886   {
887     TDataStd_ListOfExtendedString anOldNamesList;
888     anOldNamesList = aNamesList->List();
889
890     TColStd_ListOfInteger anOldTypesList;
891     anOldTypesList = aTypesList->List();
892
893     TDataStd_ListOfByte anOldClosuresList;
894     anOldClosuresList = aClosuresList->List();
895
896     // Refill the existing lists
897     aNamesList->Clear();
898     aTypesList->Clear();
899     aClosuresList->Clear();
900
901     TDataStd_ListIteratorOfListOfExtendedString aNamesIter( anOldNamesList );
902     TColStd_ListIteratorOfListOfInteger aTypesIter( anOldTypesList );
903     TDataStd_ListIteratorOfListOfByte aClosuresIter( anOldClosuresList );
904     for ( int i = 0; aNamesIter.More() && aTypesIter.More() && aClosuresIter.More();
905                      aNamesIter.Next(), aTypesIter.Next(), aClosuresIter.Next(), ++i )
906     {
907       if ( i == theSectionIndex )
908         continue; // skip index to remove
909
910       aNamesList->Append( aNamesIter.Value() );
911       aTypesList->Append( aTypesIter.Value() );
912       aClosuresList->Append( (bool)aClosuresIter.Value() );
913     }
914
915     // Remove points that belongs to removed section
916     removePointsLists( theSectionIndex );
917   }
918
919   Changed( Geom_2d );
920 }
921
922 void HYDROData_PolylineXY::RemoveSections()
923 {
924   removeSectionsLists();
925   removePointsLists();
926   Changed( Geom_2d );
927 }
928
929 void HYDROData_PolylineXY::AddPoint( const int    theSectionIndex,
930                                      const Point& thePoint,
931                                      const int    thePointIndex )
932 {
933   Handle(TDataStd_RealList) aListX, aListY;
934   getPointsLists( theSectionIndex, aListX, aListY );
935
936   if ( thePointIndex < 0 || thePointIndex >= aListX->Extent() )
937   {
938     aListX->Append( thePoint.X() );
939     aListY->Append( thePoint.Y() );
940   }
941   else
942   {
943     TColStd_ListOfReal anOldListX;
944     anOldListX = aListX->List();
945
946     TColStd_ListOfReal anOldListY;
947     anOldListY = aListY->List();
948
949     // Refill the existing lists
950     aListX->Clear();
951     aListY->Clear();
952
953     TColStd_ListIteratorOfListOfReal anIterX( anOldListX );
954     TColStd_ListIteratorOfListOfReal anIterY( anOldListY );
955     for ( int i = 0; anIterX.More() && anIterY.More(); anIterX.Next(), anIterY.Next(), ++i )
956     {
957       double aCoordX = anIterX.Value();
958       double aCoordY = anIterY.Value();
959
960       if ( i == thePointIndex )
961       {
962         // Insert our new point
963         aListX->Append( thePoint.X() );
964         aListY->Append( thePoint.Y() );
965       }
966
967       aListX->Append( aCoordX );
968       aListY->Append( aCoordY );
969     }
970   }
971
972   Changed( Geom_2d );
973 }
974
975 void HYDROData_PolylineXY::SetPoint( const int    theSectionIndex,
976                                      const Point& thePoint,
977                                      const int    thePointIndex )
978 {
979   Handle(TDataStd_RealList) aListX, aListY;
980   getPointsLists( theSectionIndex, aListX, aListY );
981
982   if ( thePointIndex < 0 )
983   {
984     aListX->Prepend( thePoint.X() );
985     aListY->Prepend( thePoint.Y() );
986   }
987   else if ( thePointIndex >= aListX->Extent() )
988   {
989     aListX->Append( thePoint.X() );
990     aListY->Append( thePoint.Y() );
991   }
992   else
993   {
994     TColStd_ListOfReal anOldListX;
995     anOldListX = aListX->List();
996
997     TColStd_ListOfReal anOldListY;
998     anOldListY = aListY->List();
999
1000     // Refill the existing lists
1001     aListX->Clear();
1002     aListY->Clear();
1003
1004     TColStd_ListIteratorOfListOfReal anIterX( anOldListX );
1005     TColStd_ListIteratorOfListOfReal anIterY( anOldListY );
1006     for ( int i = 0; anIterX.More() && anIterY.More(); anIterX.Next(), anIterY.Next(), ++i )
1007     {
1008       double aCoordX = anIterX.Value();
1009       double aCoordY = anIterY.Value();
1010
1011       if ( i == thePointIndex )
1012       {
1013         // Insert our new point instead of old one
1014         aCoordX = thePoint.X();
1015         aCoordY = thePoint.Y();
1016       }
1017
1018       aListX->Append( aCoordX );
1019       aListY->Append( aCoordY );
1020     }
1021   }
1022
1023   Changed( Geom_2d );
1024 }
1025
1026 void HYDROData_PolylineXY::SetPoints( const int         theSectionIndex,
1027                                       const PointsList& thePoints )
1028 {
1029   Handle(TDataStd_RealList) aListX, aListY;
1030   getPointsLists( theSectionIndex, aListX, aListY );
1031
1032   aListX->Clear();
1033   aListY->Clear();
1034
1035   for ( int i = 1, n = thePoints.Length(); i <= n; ++i )
1036   {
1037     const Point& aPoint = thePoints.Value( i );
1038     aListX->Append( aPoint.X() );
1039     aListY->Append( aPoint.Y() );
1040   }
1041 }
1042
1043 void HYDROData_PolylineXY::RemovePoint( const int theSectionIndex,
1044                                         const int thePointIndex )
1045 {
1046   Handle(TDataStd_RealList) aListX, aListY;
1047   getPointsLists( theSectionIndex, aListX, aListY, false );
1048   if ( aListX.IsNull() || aListY.IsNull() || aListX->IsEmpty() )
1049     return;
1050
1051   if ( aListX->Extent() == 1 )
1052   {
1053     removePointsLists( theSectionIndex );
1054   }
1055   else
1056   {
1057     TColStd_ListOfReal anOldListX;
1058     anOldListX = aListX->List();
1059
1060     TColStd_ListOfReal anOldListY;
1061     anOldListY = aListY->List();
1062
1063     // Refill the existing lists
1064     aListX->Clear();
1065     aListY->Clear();
1066
1067     TColStd_ListIteratorOfListOfReal anIterX( anOldListX );
1068     TColStd_ListIteratorOfListOfReal anIterY( anOldListY );
1069     for ( int i = 0; anIterX.More() && anIterY.More(); anIterX.Next(), anIterY.Next(), ++i )
1070     {
1071       if ( i == thePointIndex )
1072         continue; // skip index to remove
1073
1074       aListX->Append( anIterX.Value() );
1075       aListY->Append( anIterY.Value() );
1076     }
1077   }
1078
1079   Changed( Geom_2d );
1080 }
1081
1082 HYDROData_PolylineXY::PointsList HYDROData_PolylineXY::GetPoints( const int theSectionIndex, bool IsConvertToGlobal ) const
1083 {
1084   PointsList aResList;
1085
1086   if( IsCustom() )
1087   {
1088     const_cast<HYDROData_PolylineXY*>( this )->Interpolate();
1089   }
1090  
1091   Handle(TDataStd_RealList) aListX, aListY;
1092   getPointsLists( theSectionIndex, aListX, aListY, false );
1093   if ( aListX.IsNull() || aListY.IsNull() || aListX->IsEmpty() )
1094     return aResList;
1095
1096   TColStd_ListIteratorOfListOfReal anIterX( aListX->List() );
1097   TColStd_ListIteratorOfListOfReal anIterY( aListY->List() );
1098   Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( myLab );
1099   for ( ; anIterX.More() && anIterY.More(); anIterX.Next(), anIterY.Next() )
1100   {
1101     Point aPoint( anIterX.Value(), anIterY.Value() );
1102     if (IsConvertToGlobal)
1103       aDoc->Transform( aPoint, false );
1104     aResList.Append( aPoint );
1105   }
1106
1107   return aResList;
1108 }
1109
1110 QPainterPath HYDROData_PolylineXY::GetPainterPath() const
1111 {
1112   QPainterPath aPath;
1113
1114   NCollection_Sequence<TCollection_AsciiString>           aSectNames;
1115   NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
1116   NCollection_Sequence<bool>                              aSectClosures;
1117   GetSections( aSectNames, aSectTypes, aSectClosures );
1118
1119   for ( int aSectionId = 1, aNbSects = aSectNames.Size(); aSectionId <= aNbSects; aSectionId++ )
1120   {
1121     TCollection_AsciiString aSectName = aSectNames.Value( aSectionId );
1122     SectionType aSectionType = aSectTypes.Value( aSectionId );
1123     bool anIsSectionClosed = aSectClosures.Value( aSectionId );
1124
1125     PointsList aSectPointsList = GetPoints( aSectionId - 1 );
1126     if ( aSectPointsList.IsEmpty() )
1127       continue;
1128
1129     NCollection_Sequence<gp_XYZ> aPoints;
1130     for( int i = 1, n = aSectPointsList.Size(); i <= n; ++i )
1131     {
1132       const Point& aSectPoint = aSectPointsList.Value( i );
1133
1134       gp_XYZ aPoint( aSectPoint.X(), aSectPoint.Y(), 0.0 );
1135       aPoints.Append( aPoint );
1136     }
1137
1138     BuildPainterPath( aPath, aSectionType, anIsSectionClosed, aPoints );
1139   }
1140
1141   return aPath;
1142 }
1143
1144 void HYDROData_PolylineXY::UpdateLocalCS( double theDx, double theDy )
1145 {
1146   NCollection_Sequence<TCollection_AsciiString>           aSectNames;
1147   NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
1148   NCollection_Sequence<bool>                              aSectClosures;
1149   GetSections( aSectNames, aSectTypes, aSectClosures );
1150
1151   gp_XY aDelta( theDx, theDy );
1152   for ( int i = 0, aNbSects = aSectNames.Size(); i < aNbSects; i++ )
1153   {
1154     PointsList aPoints = GetPoints( i );
1155     for( int j = 1, n = aPoints.Size(); j <= n; ++j )
1156     {
1157       Point& aPoint = aPoints.ChangeValue( j );
1158       aPoint += aDelta;
1159     }
1160     SetPoints( i, aPoints );
1161   }
1162   Changed( Geom_2d );
1163 }
1164
1165 void HYDROData_PolylineXY::Transform( const QTransform& theTrsf )
1166 {
1167   NCollection_Sequence<TCollection_AsciiString>           aSectNames;
1168   NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
1169   NCollection_Sequence<bool>                              aSectClosures;
1170   GetSections( aSectNames, aSectTypes, aSectClosures );
1171
1172   for ( int i = 0, aNbSects = aSectNames.Size(); i < aNbSects; i++ ) {
1173     PointsList aPoints = GetPoints( i );
1174     for( int j = 1, n = aPoints.Size(); j <= n; ++j ) {
1175       Point& aPoint = aPoints.ChangeValue( j );
1176
1177       QPointF aTrsfPoint = theTrsf.map( QPointF( aPoint.X(), aPoint.Y() ) );
1178
1179       aPoint.SetX( aTrsfPoint.x() );
1180       aPoint.SetY( aTrsfPoint.y() );
1181     }
1182     SetPoints( i, aPoints );
1183   }
1184
1185   Update();
1186 }
1187
1188 bool HYDROData_PolylineXY::IsCustom() const
1189 {
1190   if( myIsInCustomFlag )
1191     return false;
1192
1193   bool isNull = GetShape().IsNull();
1194   int aNbPoints = 0;
1195
1196   HYDROData_PolylineXY* aThat = const_cast<HYDROData_PolylineXY*>( this );
1197   aThat->myIsInCustomFlag = true;
1198   for( int i=0, n=NbSections(); i<n; i++ )
1199     aNbPoints += NbPoints( i );
1200   aThat->myIsInCustomFlag = false;
1201
1202   return !isNull && aNbPoints == 0;
1203 }
1204
1205 bool HYDROData_PolylineXY::GetIsInCustomFlag() const
1206 {
1207   return myIsInCustomFlag;
1208 }
1209
1210 void HYDROData_PolylineXY::SetIsInCustomFlag( bool theValue )
1211 {
1212   myIsInCustomFlag = theValue;
1213 }
1214
1215 void HYDROData_PolylineXY::Interpolate()
1216 {
1217   ImportShape( GetShape(), true );
1218 }