+ while ( aNamesMap.Contains( aResName ) );
+
+ return aResName;
+}
+
+void HYDROData_PolylineXY::AddSection( const TCollection_AsciiString& theSectName,
+ const SectionType theSectionType,
+ const bool theIsClosed )
+{
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList );
+
+ TCollection_ExtendedString aSectName( theSectName );
+ if ( aSectName.Length() <= 0 )
+ aSectName = getUniqueSectionName( aNamesList );
+
+ aNamesList->Append( aSectName );
+ aTypesList->Append( theSectionType );
+ aClosuresList->Append( theIsClosed );
+}
+
+TCollection_AsciiString HYDROData_PolylineXY::GetSectionName( const int theSectionIndex ) const
+{
+ TCollection_AsciiString aResName;
+
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aNamesList.IsNull() || theSectionIndex >= aNamesList->Extent() )
+ return aResName;
+
+ TDataStd_ListIteratorOfListOfExtendedString aNamesIter( aNamesList->List() );
+ for ( int i = 0; aNamesIter.More() && i != theSectionIndex; aNamesIter.Next(), ++i );
+
+ if ( aNamesIter.More() )
+ aResName = aNamesIter.Value();
+
+ return aResName;
+}
+
+void HYDROData_PolylineXY::SetSectionName( const int theSectionIndex,
+ const TCollection_AsciiString& theSectionName )
+{
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aNamesList.IsNull() || theSectionIndex >= aNamesList->Extent() )
+ return;
+
+ TDataStd_ListOfExtendedString anOldNamesList;
+ anOldNamesList = aNamesList->List();
+
+ // Refill the existing list
+ aNamesList->Clear();
+
+ TDataStd_ListIteratorOfListOfExtendedString aNamesIter( aNamesList->List() );
+ for ( int i = 0; aNamesIter.More(); aNamesIter.Next(), ++i )
+ aNamesList->Append( i == theSectionIndex ? theSectionName : aNamesIter.Value() );
+}
+
+HYDROData_PolylineXY::SectionType HYDROData_PolylineXY::GetSectionType( const int theSectionIndex ) const
+{
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aTypesList.IsNull() || theSectionIndex >= aTypesList->Extent() )
+ return SECTION_POLYLINE;
+
+ TColStd_ListIteratorOfListOfInteger aTypesIter( aTypesList->List() );
+ for ( int i = 0; aTypesIter.More() && i != theSectionIndex; aTypesIter.Next(), ++i );
+
+ return aTypesIter.More() ? (SectionType)aTypesIter.Value() : SECTION_POLYLINE;
+}
+
+void HYDROData_PolylineXY::SetSectionType( const int theSectionIndex,
+ const SectionType theSectionType )
+{
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aTypesList.IsNull() || theSectionIndex >= aTypesList->Extent() )
+ return;
+
+ TColStd_ListOfInteger anOldTypesList;
+ anOldTypesList = aTypesList->List();
+
+ // Refill the existing list
+ aTypesList->Clear();
+
+ TColStd_ListIteratorOfListOfInteger aTypesIter( anOldTypesList );
+ for ( int i = 0; aTypesIter.More(); aTypesIter.Next(), ++i )
+ aTypesList->Append( i == theSectionIndex ? theSectionType : aTypesIter.Value() );
+}
+
+bool HYDROData_PolylineXY::IsClosedSection( const int theSectionIndex ) const
+{
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aClosuresList.IsNull() || theSectionIndex >= aClosuresList->Extent() )
+ return false;
+
+ TDataStd_ListIteratorOfListOfByte aClosuresIter( aClosuresList->List() );
+ for ( int i = 0; aClosuresIter.More() && i != theSectionIndex; aClosuresIter.Next(), ++i );
+
+ return aClosuresIter.More() ? (bool)aClosuresIter.Value() : false;
+}
+
+void HYDROData_PolylineXY::SetSectionClosed( const int theSectionIndex,
+ const bool theIsClosed )
+{
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aClosuresList.IsNull() || theSectionIndex >= aClosuresList->Extent() )
+ return;
+
+ TDataStd_ListOfByte anOldClosuresList;
+ anOldClosuresList = aClosuresList->List();
+
+ // Refill the existing list
+ aClosuresList->Clear();
+
+ TDataStd_ListIteratorOfListOfByte aClosuresIter( anOldClosuresList );
+ for ( int i = 0; aClosuresIter.More(); aClosuresIter.Next(), ++i )
+ aClosuresList->Append( i == theSectionIndex ? theIsClosed : (bool)aClosuresIter.Value() );
+}
+
+void HYDROData_PolylineXY::GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
+ NCollection_Sequence<SectionType>& theSectTypes,
+ NCollection_Sequence<bool>& theSectClosures ) const
+{
+ theSectNames.Clear();
+ theSectTypes.Clear();
+ theSectClosures.Clear();
+
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aNamesList.IsNull() || aTypesList.IsNull() || aClosuresList.IsNull() )
+ return;
+
+ TDataStd_ListIteratorOfListOfExtendedString aNamesIter( aNamesList->List() );
+ TColStd_ListIteratorOfListOfInteger aTypesIter( aTypesList->List() );
+ TDataStd_ListIteratorOfListOfByte aClosuresIter( aClosuresList->List() );
+ for ( ; aNamesIter.More() && aTypesIter.More() && aClosuresIter.More();
+ aNamesIter.Next(), aTypesIter.Next(), aClosuresIter.Next() )