Salome HOME
Image positioning by two points.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_DataModel.cxx
index a1be099ce1118ca1e55b9c4639e954928ab23c8b..dbe6cead511cd96d7b0dbd2f36861e88313a27c6 100644 (file)
@@ -25,6 +25,8 @@
 #include "HYDROGUI_DataObject.h"
 #include "HYDROGUI_Module.h"
 #include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Zone.h"
+#include "HYDROGUI_Region.h"
 
 #include <HYDROData_Bathymetry.h>
 #include <HYDROData_CalculationCase.h>
@@ -527,8 +529,7 @@ LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject*
                                                        const QString&           theParentEntry,
                                                        const bool               theIsBuildTree )
 {
-  HYDROGUI_DataObject* aResObj = 
-    new HYDROGUI_DataObject( theParent, theModelObject, theParentEntry );
+  HYDROGUI_DataObject* aResObj = new HYDROGUI_DataObject( theParent, theModelObject, theParentEntry );
   
   if ( theIsBuildTree )
   {
@@ -538,6 +539,34 @@ LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject*
   return aResObj;
 }
 
+LightApp_DataObject* HYDROGUI_DataModel::buildObject( SUIT_DataObject*     theParent,
+                                                      HYDROGUI_DataObject* theObject,
+                                                      const QString&       theParentEntry,
+                                                      const bool           theIsBuildTree )
+{
+  if ( theIsBuildTree )
+  {
+    buildObjectTree( theParent, theObject, theParentEntry );
+  }
+  return theObject;
+}
+
+LightApp_DataObject* HYDROGUI_DataModel::createZone( SUIT_DataObject*       theParent,
+                                                     Handle(HYDROData_Zone) theModelObject,
+                                                     const QString&         theParentEntry,
+                                                     const bool             theIsBuildTree )
+{
+  return buildObject( theParent, new HYDROGUI_Zone( theParent, theModelObject, theParentEntry ), theParentEntry, theIsBuildTree );
+}
+
+LightApp_DataObject* HYDROGUI_DataModel::createRegion( SUIT_DataObject*         theParent,
+                                                       Handle(HYDROData_Region) theModelObject,
+                                                       const QString&           theParentEntry,
+                                                       const bool               theIsBuildTree )
+{
+  return buildObject( theParent, new HYDROGUI_Region( theParent, theModelObject, theParentEntry ), theParentEntry, theIsBuildTree );
+}
+
 LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject* theParent,
                                                        const QString&   theName,
                                                        const QString&   theParentEntry )
@@ -604,7 +633,7 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent,
       Handle(HYDROData_Region) aCaseRegion =
         Handle(HYDROData_Region)::DownCast( anIter.Value() );
       if( !aCaseRegion.IsNull() && !aCaseRegion->IsRemoved() )
-        createObject( aCaseRegionsSect, aCaseRegion, "", true );
+        createRegion( aCaseRegionsSect, aCaseRegion, "", true );
     }
   }
   else if ( anObjectKind == KIND_REGION )
@@ -619,7 +648,7 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent,
       Handle(HYDROData_Zone) aRegionZone =
         Handle(HYDROData_Zone)::DownCast( anIter.Value() );
       if( !aRegionZone.IsNull() && !aRegionZone->IsRemoved() )
-        createObject( aGuiObj, aRegionZone, "", true );
+        createZone( aGuiObj, aRegionZone, "", true );
     }
   }
 }