+bool HYDROData_Stream::SetProfiles( const HYDROData_SequenceOfObjects& theProfiles,
+ const bool& theIsToOrder )
+{
+ if ( theIsToOrder )
+ {
+ for ( int i = 1; i <= theProfiles.Length(); ++i )
+ {
+ Handle(HYDROData_Profile) aProfile =
+ Handle(HYDROData_Profile)::DownCast( theProfiles.Value( i ) );
+ if ( aProfile.IsNull() )
+ continue;
+
+ if ( !AddProfile( aProfile ) )
+ return false;
+ }
+ }
+ else // Just store the sequence of objects as is
+ {
+ bool anIsToUpdate = true;
+
+ HYDROData_SequenceOfObjects anOldProfiles = GetProfiles();
+ if ( anOldProfiles.Length() == theProfiles.Length() )
+ {
+ anIsToUpdate = false;
+
+ for ( int i = 1; i <= theProfiles.Length(); ++i )
+ {
+ Handle(HYDROData_Entity) anOldProfile = anOldProfiles.Value( i );
+ Handle(HYDROData_Entity) aNewProfile = theProfiles.Value( i );
+ if ( !IsEqual( anOldProfile, aNewProfile ) )
+ {
+ anIsToUpdate = true;
+ break;
+ }
+ }
+ }
+
+ SetReferenceObjects( theProfiles, DataTag_Profile );
+
+ if ( anIsToUpdate )
+ SetToUpdate( true );
+ }
+
+ return true;
+}
+