X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_DataModel.cxx;h=dbe6cead511cd96d7b0dbd2f36861e88313a27c6;hb=5cae7e874afd2fc1b6f61023e8ebd33a933db3c7;hp=180b2dd861fae6d8588d44b9fadfc0099b57cc39;hpb=84f8b4a57d3cdad820bc1333a5066699cd1c8ae3;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_DataModel.cxx b/src/HYDROGUI/HYDROGUI_DataModel.cxx index 180b2dd8..dbe6cead 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@ -25,9 +25,11 @@ #include "HYDROGUI_DataObject.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_Tool.h" +#include "HYDROGUI_Zone.h" +#include "HYDROGUI_Region.h" #include -#include +#include #include #include #include @@ -271,8 +273,8 @@ void HYDROGUI_DataModel::update( const int theStudyId ) anIterator = HYDROData_Iterator( aDocument, KIND_CALCULATION ); for( ; anIterator.More(); anIterator.Next() ) { - Handle(HYDROData_Calculation) aCalculObj = - Handle(HYDROData_Calculation)::DownCast( anIterator.Current() ); + Handle(HYDROData_CalculationCase) aCalculObj = + Handle(HYDROData_CalculationCase)::DownCast( anIterator.Current() ); if( !aCalculObj.IsNull() ) createObject( aCalculRootObj, aCalculObj ); } @@ -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 ) @@ -591,8 +620,8 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, } else if ( anObjectKind == KIND_CALCULATION ) { - Handle(HYDROData_Calculation) aCaseObj = - Handle(HYDROData_Calculation)::DownCast( aDataObj ); + Handle(HYDROData_CalculationCase) aCaseObj = + Handle(HYDROData_CalculationCase)::DownCast( aDataObj ); LightApp_DataObject* aCaseRegionsSect = createObject( aGuiObj, tr( "CASE_REGIONS" ), aGuiObj->entry() ); @@ -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, aGuiObj->entry(), 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, aGuiObj->entry(), true ); + createZone( aGuiObj, aRegionZone, "", true ); } } }