}
}
+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 )
{
}
return NULL; // not found
}
+
+bool HYDROGUI_DataModel::createNewRegion( Handle(HYDROData_CalculationCase) theCase,
+ const QList<HYDROGUI_Zone*>& 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;
+}