+
+ if ( aResult )
+ {
+ module()->update( anUpdateFlags );
+ commit();
+ browseObjects( aBrowseObjectsEntries );
+ }
+ else
+ {
+ abort();
+ QString aMsg = tr( "INPUT_VALID_DATA" );
+ if( !anErrorMsg.isEmpty() )
+ aMsg.prepend( anErrorMsg + "\n" );
+ SUIT_MessageBox::critical( module()->getApp()->desktop(),
+ tr( "INSUFFICIENT_INPUT_DATA" ),
+ aMsg );
+ }
+}
+
+void HYDROGUI_CalculationOp::onNext( const int theIndex )
+{
+ if( theIndex==1 )
+ {
+ setAvailableGroups();
+ }
+ else if( theIndex==2 )
+ {
+ HYDROGUI_CalculationDlg* aPanel =
+ ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
+ if ( !aPanel )
+ return;
+
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+
+ QString aNewCaseName = aPanel->getObjectName();
+ QString anOldCaseName = myEditedObject->GetName();
+
+ bool anIsToUpdateOb = myIsEdit && anOldCaseName != aNewCaseName;
+
+ // At first we must to update the case name because of
+ // automatic names generation for regions and zones
+ myEditedObject->SetName( aNewCaseName );
+
+ if ( myEditedObject->IsMustBeUpdated() )
+ {
+ myShowZones = true;
+ myEditedObject->Update();
+
+ //aPanel->setEditedObject( myEditedObject );
+ aPanel->refreshZonesBrowser();
+
+ createPreview();
+ }
+ else
+ {
+ setZonesVisible( true );
+ }
+
+ if ( anIsToUpdateOb )
+ module()->getApp()->updateObjectBrowser( false );
+
+ QApplication::restoreOverrideCursor();
+ }
+}
+
+void HYDROGUI_CalculationOp::onHideZones()
+{
+ setZonesVisible( false );
+}
+
+void HYDROGUI_CalculationOp::setZonesVisible( bool theIsVisible )
+{
+ myShowZones = theIsVisible;
+ HYDROData_SequenceOfObjects aRegions = myEditedObject->GetRegions();
+ HYDROData_SequenceOfObjects::Iterator aRegionsIter( aRegions );
+ HYDROData_SequenceOfObjects aZones;
+ Handle(HYDROData_Region) aRegion;
+ if ( myPreviewViewManager )
+ {
+ if ( OCCViewer_Viewer* aViewer = myPreviewViewManager->getOCCViewer() )
+ {
+ Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
+ if ( !aCtx.IsNull() )
+ {
+ for ( ; aRegionsIter.More(); aRegionsIter.Next() )
+ {
+ aRegion = Handle(HYDROData_Region)::DownCast( aRegionsIter.Value() );
+ if ( !aRegion.IsNull() )
+ {
+ aZones = aRegion->GetZones();
+ HYDROData_SequenceOfObjects::Iterator aZonesIter( aZones );
+ for ( ; aZonesIter.More(); aZonesIter.Next() )
+ {
+ setObjectVisibility( aZonesIter.Value(), theIsVisible );
+ }
+ }
+ }
+ }
+
+ module()->update( UF_OCCViewer );
+ }
+ }