Salome HOME
Modify creation of curves: 1) using QDockWidget instead of QDialog; 2) selection...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_DataModel.cxx
index c7b0cedf601912503409c9fac4586f03d84a0a79..ef136fff2abb773ad85c7f2b61fa748dfcc680d1 100644 (file)
@@ -522,17 +522,23 @@ Handle(HYDROData_Document) HYDROGUI_DataModel::getDocument() const
 
 LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject*         theParent,
                                                        Handle(HYDROData_Object) theModelObject,
-                                                       const QString&           theParentEntry )
+                                                       const QString&           theParentEntry,
+                                                       const bool               theIsBuildTree )
 {
   HYDROGUI_DataObject* aResObj = 
     new HYDROGUI_DataObject( theParent, theModelObject, theParentEntry );
-  buildObjectTree( theParent, aResObj, theParentEntry );
+  
+  if ( theIsBuildTree )
+  {
+    buildObjectTree( theParent, aResObj, theParentEntry );
+  }
+
   return aResObj;
 }
 
 LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject* theParent,
                                                        const QString&   theName,
-                                                       const QString&   theParentEntry  )
+                                                       const QString&   theParentEntry )
 {
   return new HYDROGUI_NamedObject( theParent, theName, theParentEntry );
 }
@@ -559,7 +565,7 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent,
     {
       Handle(HYDROData_Object) aRefObj = anImageObj->Reference( anIndex );
       if ( !aRefObj.IsNull() && !aRefObj->IsRemoved() )
-        createObject( aGuiObj, aRefObj, aGuiObj->entry() );
+        createObject( aGuiObj, aRefObj, aGuiObj->entry(), false );
     }
   }
   else if ( anObjectKind == KIND_ZONE )
@@ -567,13 +573,15 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent,
     Handle(HYDROData_Zone) aZoneObj =
       Handle(HYDROData_Zone)::DownCast( aDataObj );
 
-    LightApp_DataObject* aPolylineSect = createObject( aGuiObj, tr( "ZONE_POLYLINE" ), aGuiObj->entry() );
+    LightApp_DataObject* aPolylineSect = 
+      createObject( aGuiObj, tr( "ZONE_POLYLINE" ), aGuiObj->entry() );
 
     Handle(HYDROData_Polyline) aPolyline = aZoneObj->GetPolyline();
     if ( !aPolyline.IsNull() && !aPolyline->IsRemoved() )
-      createObject( aPolylineSect, aPolyline, aGuiObj->entry() );
+      createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false );
 
-    LightApp_DataObject* aBathsSect = createObject( aGuiObj, tr( "ZONE_BATHYMETRIES" ), aGuiObj->entry() );
+    LightApp_DataObject* aBathsSect = 
+      createObject( aGuiObj, tr( "ZONE_BATHYMETRIES" ), aGuiObj->entry() );
 
     HYDROData_SequenceOfObjects aZoneBaths = aZoneObj->GetBathymetries();
     HYDROData_SequenceOfObjects::Iterator aBathsIter( aZoneBaths );
@@ -582,7 +590,45 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent,
       Handle(HYDROData_Bathymetry) aRefBath =
         Handle(HYDROData_Bathymetry)::DownCast( aBathsIter.Value() );
       if( !aRefBath.IsNull() && !aRefBath->IsRemoved() )
-        createObject( aBathsSect, aRefBath, aGuiObj->entry() );
+        createObject( aBathsSect, aRefBath, aGuiObj->entry(), false );
+    }
+  }
+  else if ( anObjectKind == KIND_CALCULATION )
+  {
+    Handle(HYDROData_Calculation) aCaseObj =
+      Handle(HYDROData_Calculation)::DownCast( aDataObj );
+
+    LightApp_DataObject* aPolylineSect = 
+      createObject( aGuiObj, tr( "CASE_BND_POLYLINE" ), aGuiObj->entry() );
+
+    Handle(HYDROData_Polyline) aPolyline = aCaseObj->GetBoundaryPolyline();
+    if ( !aPolyline.IsNull() && !aPolyline->IsRemoved() )
+      createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false );
+
+    LightApp_DataObject* aRefZonesSect = 
+      createObject( aGuiObj, tr( "CASE_REFERENCE_ZONES" ), aGuiObj->entry() );
+
+    HYDROData_SequenceOfObjects aRefZones = aCaseObj->GetZones();
+    HYDROData_SequenceOfObjects::Iterator anIter( aRefZones );
+    for ( ; anIter.More(); anIter.Next() )
+    {
+      Handle(HYDROData_Zone) aRefZone =
+        Handle(HYDROData_Zone)::DownCast( anIter.Value() );
+      if( !aRefZone.IsNull() && !aRefZone->IsRemoved() )
+        createObject( aRefZonesSect, aRefZone, aGuiObj->entry(), false );
+    }
+
+    LightApp_DataObject* aSplittedZonesSect = 
+      createObject( aGuiObj, tr( "CASE_SPLITTED_ZONES" ), aGuiObj->entry() );
+
+    HYDROData_SequenceOfObjects aSplittedZones = aCaseObj->GetSplittedZones();
+    anIter.Init( aSplittedZones );
+    for ( ; anIter.More(); anIter.Next() )
+    {
+      Handle(HYDROData_Zone) aSplittedZone =
+        Handle(HYDROData_Zone)::DownCast( anIter.Value() );
+      if( !aSplittedZone.IsNull() && !aSplittedZone->IsRemoved() )
+        createObject( aSplittedZonesSect, aSplittedZone, aGuiObj->entry(), false );
     }
   }
 }