X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_DataModel.cxx;h=dbe6cead511cd96d7b0dbd2f36861e88313a27c6;hb=5cae7e874afd2fc1b6f61023e8ebd33a933db3c7;hp=6ea2d54aeab8160a183de0f6eccdffaf4a790359;hpb=6d6c4ec18ead5730c1d14090e33dc9667c5a5841;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_DataModel.cxx b/src/HYDROGUI/HYDROGUI_DataModel.cxx index 6ea2d54a..dbe6cead 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@ -26,6 +26,7 @@ #include "HYDROGUI_Module.h" #include "HYDROGUI_Tool.h" #include "HYDROGUI_Zone.h" +#include "HYDROGUI_Region.h" #include #include @@ -528,17 +529,7 @@ LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject* const QString& theParentEntry, const bool theIsBuildTree ) { - HYDROGUI_DataObject* aResObj; - Handle(HYDROData_Zone) aRegionZone = - Handle(HYDROData_Zone)::DownCast( theModelObject ); - if( !aRegionZone.IsNull() ) - { - aResObj = new HYDROGUI_Zone( theParent, aRegionZone, theParentEntry ); - } - else - { - aResObj = new HYDROGUI_DataObject( theParent, theModelObject, theParentEntry ); - } + HYDROGUI_DataObject* aResObj = new HYDROGUI_DataObject( theParent, theModelObject, theParentEntry ); if ( theIsBuildTree ) { @@ -548,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 ) @@ -614,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 ) @@ -629,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 ); } } }