+ createZone( aGuiObj, aRegionZone, "", true, theIsInOperation );
+ }
+ }
+ else if ( anObjectKind == KIND_PROFILE )
+ {
+ Handle(HYDROData_Profile) aProfileObj =
+ Handle(HYDROData_Profile)::DownCast( aDataObj );
+
+ aGuiObj->setIsValid( aProfileObj->IsValid() );
+ }
+ else if ( anObjectKind == KIND_CHANNEL || anObjectKind == KIND_DIGUE )
+ {
+ Handle(HYDROData_Channel) aChannelObj =
+ Handle(HYDROData_Channel)::DownCast( aDataObj );
+
+ LightApp_DataObject* aGuideLineSect =
+ createObject( aGuiObj, tr( "CHANNEL_GUIDE_LINE" ), aGuiObj->entry() );
+ Handle(HYDROData_Polyline3D) aGuideLine = aChannelObj->GetGuideLine();
+ if ( !aGuideLine.IsNull() && !aGuideLine->IsRemoved() ) {
+ createObject( aGuideLineSect, aGuideLine, aGuiObj->entry(), false );
+ }
+
+ LightApp_DataObject* aProfileSect =
+ createObject( aGuiObj, tr( "CHANNEL_PROFILE" ), aGuiObj->entry() );
+ Handle(HYDROData_Profile) aProfile = aChannelObj->GetProfile();
+ if ( !aProfile.IsNull() && !aProfile->IsRemoved() ) {
+ createObject( aProfileSect, aProfile, aGuiObj->entry(), false );
+ }
+ }
+ else if ( anObjectKind == KIND_STREAM )
+ {
+ Handle(HYDROData_Stream) aStreamObj =
+ Handle(HYDROData_Stream)::DownCast( aDataObj );
+
+ LightApp_DataObject* aHydraulicAxisSect =
+ createObject( aGuiObj, tr( "STREAM_HYDRAULIC_AXIS" ), aGuiObj->entry() );
+ Handle(HYDROData_PolylineXY) aHydraulicAxis = aStreamObj->GetHydraulicAxis();
+ if ( !aHydraulicAxis.IsNull() && !aHydraulicAxis->IsRemoved() ) {
+ createObject( aHydraulicAxisSect, aHydraulicAxis, aGuiObj->entry(), false );
+ }
+
+ HYDROData_SequenceOfObjects aProfiles = aStreamObj->GetProfiles();
+ buildObjectPartition( aGuiObj, aProfiles, tr( "STREAM_PROFILES" ), true );
+
+ Handle(HYDROData_Polyline3D) aBottomPolyline = aStreamObj->GetBottomPolyline();
+ if ( !aBottomPolyline.IsNull() && !aBottomPolyline->IsRemoved() ) {
+ createObject( aGuiObj, aBottomPolyline, aGuiObj->entry(), false );
+ }
+ }
+ else if ( anObjectKind == KIND_LAND_COVER_MAP )
+ {
+ Handle(HYDROData_LandCoverMap) aLandCoverMapObj =
+ Handle(HYDROData_LandCoverMap)::DownCast( aDataObj );
+
+ /*TODO: reference objects of the land cover map
+ HYDROData_SequenceOfObjects aPolylines = aLandCoverMapObj->GetPolylines();
+ buildObjectPartition( aGuiObj, aPolylines, tr( "LAND_COVER_POLYLINES" ), true );*/
+ }
+
+ HYDROGUI_Module* aModule = dynamic_cast<HYDROGUI_Module*>( module() );
+ if( aModule )
+ aModule->enableLCMActions();
+
+}
+
+void HYDROGUI_DataModel::buildCaseTree( SUIT_DataObject* theParent, Handle(HYDROData_CalculationCase) theCase )
+{
+ if ( !theCase.IsNull() )
+ {
+ if ( theParent )
+ {
+ // Remove previous objects tree
+ DataObjectList aList;
+ theParent->children( aList );
+ QListIterator<SUIT_DataObject*> anIter( aList );
+ while( anIter.hasNext() )
+ removeChild( theParent, anIter.next() );
+ }
+
+ new HYDROGUI_DropTargetObject( theParent, tr( "NEW_REGION" ), "", true );
+
+ 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, true );
+ }
+ }
+}
+
+void HYDROGUI_DataModel::updateObjectTree( Handle(HYDROData_Entity)& theObj )
+{
+ if ( !theObj.IsNull() )
+ {
+ HYDROGUI_DataObject* aGuiObj = dynamic_cast<HYDROGUI_DataObject*>(
+ findObject( HYDROGUI_DataObject::dataObjectEntry( theObj ) ) );
+ if ( aGuiObj )
+ {
+ // Remove previous objects tree
+ DataObjectList aList;
+ aGuiObj->children( aList );
+ QListIterator<SUIT_DataObject*> anIter( aList );
+ while( anIter.hasNext() )
+ removeChild( aGuiObj, anIter.next() );
+
+ // Rebuild the subtree
+ QString aParentEntry;
+ HYDROGUI_DataObject* aParent = dynamic_cast<HYDROGUI_DataObject*>( aGuiObj->parent() );
+ if ( aParent )
+ {
+ aParentEntry = aParent->entry();
+ }
+ buildObjectTree( aParent, aGuiObj, aParentEntry, aGuiObj->isInOperation() );
+ }
+ else
+ {
+ // workaround for the bug in SalomeApp_Study::findObjectByEntry - it can't find LightApp_DataObjects
+ HYDROGUI_Module* aModule = dynamic_cast<HYDROGUI_Module*>( module() );
+ if( aModule )
+ {
+ aModule->getApp()->updateObjectBrowser();
+ }