Salome HOME
Fix for the bug #45: check and warning when the same image is used in 2 arguments.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_DataModel.cxx
index 3ea41225aff48ccc2907b573c1ed533f165d7e52..2369f1f52e58533dd3f44eff1453c7b70e8056a2 100644 (file)
@@ -44,6 +44,7 @@
 #include <HYDROData_Channel.h>
 #include <HYDROData_Digue.h>
 #include <HYDROData_River.h>
+#include <HYDROData_Stream.h>
 
 #include <CAM_Application.h>
 #include <CAM_DataObject.h>
@@ -329,6 +330,16 @@ void HYDROGUI_DataModel::update( const int theStudyId )
 
           break;
         }
+        case KIND_STREAM:
+        {
+          Handle(HYDROData_Stream) aStreamObj =
+            Handle(HYDROData_Stream)::DownCast( anObj );
+          if( !aStreamObj.IsNull() ) {
+            createObject( aNaturalObjectsRootObj, aStreamObj );
+          }
+
+          break;
+        }
         case KIND_OBSTACLE:
         {
           Handle(HYDROData_Obstacle) anObstacleObj =
@@ -427,7 +438,8 @@ void HYDROGUI_DataModel::update( LightApp_DataObject* theObject,
 
 CAM_DataObject* HYDROGUI_DataModel::createRootModuleObject( SUIT_DataObject* theParent )
 {
-  CAM_DataObject* aRootObj = createModuleObject( theParent );
+  CAM_ModuleObject* aRootObj = createModuleObject( theParent );
+  aRootObj->setDataModel( this );
   setRoot( aRootObj );
   return aRootObj;
 }
@@ -838,3 +850,24 @@ bool HYDROGUI_DataModel::createNewRegion( Handle(HYDROData_CalculationCase) theC
   }
   return isOk;
 }
+
+bool HYDROGUI_DataModel::rename( Handle(HYDROData_Entity) theEntity, const QString& theName )
+{
+  if ( theName.isEmpty() )
+    return false;
+
+  try 
+  {
+    getDocument()->StartOperation();
+    theEntity->SetName( theName );
+    getDocument()->CommitOperation( HYDROGUI_Tool::ToExtString( tr("RENAME_TO").arg( theName ) ) );
+    module()->application()->activeStudy()->Modified();
+  }
+  catch ( Standard_Failure )
+  {
+    getDocument()->AbortOperation();
+    return false;
+  }
+  return true;
+}
+