Salome HOME
Sorting alphabetically.
[modules/hydro.git] / src / HYDROData / HYDROData_Object.cxx
index 062be0df68c1cdad67fe579dd4bd62ec48ac13a7..2ee9bd7ec4788fab611f7367eaebf3bf9173df72 100644 (file)
@@ -175,6 +175,18 @@ void HYDROData_Object::SetReferenceObject( const Handle_HYDROData_Object& theObj
   }
 }
 
+void HYDROData_Object::SetReferenceObjects( const HYDROData_SequenceOfObjects& theObjects,
+                                            const int                          theTag )
+{
+  ClearReferenceObjects( theTag );
+  if ( theObjects.IsEmpty() )
+    return;
+
+  HYDROData_SequenceOfObjects::Iterator anIter( theObjects );
+  for ( ; anIter.More(); anIter.Next() )
+    AddReferenceObject( anIter.Value(), theTag );
+}
+
 Handle(HYDROData_Object) HYDROData_Object::GetReferenceObject( const int theTag,
                                                                const int theIndex ) const
 {
@@ -291,4 +303,44 @@ QColor HYDROData_Object::GetColor( const QColor& theDefColor,
   }
 
   return aResColor;
-}
\ No newline at end of file
+}
+
+void HYDROData_Object::setPythonReferenceObject( MapOfTreatedObjects&            theTreatedObjects,
+                                                 QStringList&                    theScript,
+                                                 const Handle(HYDROData_Object)& theRefObject,
+                                                 const QString&                  theMethod ) const
+{
+  if ( theRefObject.IsNull() )
+    return;
+
+  QString aRefObjName = theRefObject->GetName();
+  if ( aRefObjName.isEmpty() )
+    return;
+
+  bool anIsToSetObject = true;
+
+  // The definition of reference polyline must be dumped before this
+  if ( !theTreatedObjects.contains( aRefObjName ) )
+  {
+    // Write definition of reference polyline
+    QStringList aRefObjDump = theRefObject->DumpToPython( theTreatedObjects );
+    if ( ( anIsToSetObject = !aRefObjDump.isEmpty() ) )
+    {
+      QStringList aTmpList = theScript;
+      theScript = aRefObjDump;
+
+      theScript << QString( "" );
+      theScript << aTmpList;
+
+      theTreatedObjects.insert( aRefObjName, theRefObject );
+    }
+  }
+
+  if ( anIsToSetObject )
+  {
+    theScript << QString( "%1.%2( %3 );" )
+                 .arg( GetName() ).arg( theMethod ).arg( aRefObjName );
+  }
+}
+
+