X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_DataModel.cxx;h=97ec16079ae1c5b00aca7e54d2057fdf79135634;hb=de7cf9bb0a7a41d6487013c87f4a54d0664cd303;hp=dbe6cead511cd96d7b0dbd2f36861e88313a27c6;hpb=bfe9d3ccf8d5347b917d4c9e5e89413cebe51cc6;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_DataModel.cxx b/src/HYDROGUI/HYDROGUI_DataModel.cxx index dbe6cead..97ec1607 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@ -224,7 +224,7 @@ void HYDROGUI_DataModel::update( const int theStudyId ) if( aDocument.IsNull() ) return; - LightApp_DataObject* anImageRootObj = createObject( aRootObj, partitionName( KIND_IMAGE ) ); + LightApp_DataObject* anImageRootObj = createObject( aRootObj, tr( partitionName( KIND_IMAGE ).toAscii() ) ); HYDROData_Iterator anIterator( aDocument, KIND_IMAGE ); for( ; anIterator.More(); anIterator.Next() ) @@ -235,7 +235,7 @@ void HYDROGUI_DataModel::update( const int theStudyId ) createObject( anImageRootObj, anImageObj ); } - LightApp_DataObject* aBathymetryRootObj = createObject( aRootObj, partitionName( KIND_BATHYMETRY ) ); + LightApp_DataObject* aBathymetryRootObj = createObject( aRootObj, tr( partitionName( KIND_BATHYMETRY ).toAscii() ) ); anIterator = HYDROData_Iterator( aDocument, KIND_BATHYMETRY ); for( ; anIterator.More(); anIterator.Next() ) @@ -246,7 +246,7 @@ void HYDROGUI_DataModel::update( const int theStudyId ) createObject( aBathymetryRootObj, aBathymetryObj ); } - LightApp_DataObject* aPolylineRootObj = createObject( aRootObj, partitionName( KIND_POLYLINE ) ); + LightApp_DataObject* aPolylineRootObj = createObject( aRootObj, tr( partitionName( KIND_POLYLINE ).toAscii() ) ); anIterator = HYDROData_Iterator( aDocument, KIND_POLYLINE ); for( ; anIterator.More(); anIterator.Next() ) @@ -257,7 +257,7 @@ void HYDROGUI_DataModel::update( const int theStudyId ) createObject( aPolylineRootObj, aPolylineObj ); } - LightApp_DataObject* aZonesRootObj = createObject( aRootObj, partitionName( KIND_IMMERSIBLE_ZONE ) ); + LightApp_DataObject* aZonesRootObj = createObject( aRootObj, tr( partitionName( KIND_IMMERSIBLE_ZONE ).toAscii() ) ); anIterator = HYDROData_Iterator( aDocument, KIND_IMMERSIBLE_ZONE ); for( ; anIterator.More(); anIterator.Next() ) @@ -268,7 +268,7 @@ void HYDROGUI_DataModel::update( const int theStudyId ) createObject( aZonesRootObj, aZoneObj ); } - LightApp_DataObject* aCalculRootObj = createObject( aRootObj, partitionName( KIND_CALCULATION ) ); + LightApp_DataObject* aCalculRootObj = createObject( aRootObj, tr( partitionName( KIND_CALCULATION ).toAscii() ) ); anIterator = HYDROData_Iterator( aDocument, KIND_CALCULATION ); for( ; anIterator.More(); anIterator.Next() ) @@ -279,7 +279,7 @@ void HYDROGUI_DataModel::update( const int theStudyId ) createObject( aCalculRootObj, aCalculObj ); } - LightApp_DataObject* aVisualStateRootObj = createObject( aRootObj, partitionName( KIND_VISUAL_STATE ) ); + LightApp_DataObject* aVisualStateRootObj = createObject( aRootObj, tr( partitionName( KIND_VISUAL_STATE ).toAscii() ) ); anIterator = HYDROData_Iterator( aDocument, KIND_VISUAL_STATE ); for( ; anIterator.More(); anIterator.Next() ) @@ -653,6 +653,24 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, } } +void HYDROGUI_DataModel::buildCaseTree( SUIT_DataObject* theParent, Handle(HYDROData_CalculationCase) theCase ) +{ + if ( !theCase.IsNull() ) + { + new HYDROGUI_DropTargetObject( theParent, tr( "NEW_REGION" ), "" ); + + HYDROData_SequenceOfObjects aCaseRegions = theCase->GetRegions(); + HYDROData_SequenceOfObjects::Iterator anIter( aCaseRegions ); + for ( ; anIter.More(); anIter.Next() ) + { + Handle(HYDROData_Region) aCaseRegion = + Handle(HYDROData_Region)::DownCast( anIter.Value() ); + if( !aCaseRegion.IsNull() && !aCaseRegion->IsRemoved() ) + createRegion( theParent, aCaseRegion, "", true ); + } + } +} + void HYDROGUI_DataModel::removeChild( SUIT_DataObject* theParent, SUIT_DataObject* theChild ) { @@ -674,3 +692,34 @@ SUIT_DataObject* HYDROGUI_DataModel::findChildByName( const SUIT_DataObject* the } return NULL; // not found } + +bool HYDROGUI_DataModel::createNewRegion( Handle(HYDROData_CalculationCase) theCase, + const QList& theZonesList ) +{ + bool isOk = !theCase.IsNull(); + if ( isOk ) + { + Handle(HYDROData_Region) aRegion; + Handle(HYDROData_Zone) aZone; + for (int i = 0; i < theZonesList.length(); i++ ) + { + aZone = Handle(HYDROData_Zone)::DownCast( theZonesList.at(i)->modelObject() ); + if ( !aZone.IsNull() ) + { + if ( aRegion.IsNull() ) + { + aRegion = theCase->AddNewRegion( aZone ); + isOk = !aRegion.IsNull(); + } + else + { + if ( !( aRegion->AddZone( aZone ) ) ) + { + isOk = false; + } + } + } + } + } + return isOk; +}