- }
- else if( theIndex==4 )
- {
- // Partition of Land covers panel
- HYDROGUI_CalculationDlg* aPanel =
- ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
- if ( !aPanel )
- return;
-
- QApplication::setOverrideCursor( Qt::WaitCursor );
-
- // Set parameters for automatic mode
- int aMode = aPanel->getLandCoverMode();
- if ( aMode == HYDROData_CalculationCase::AUTOMATIC )
- {
- // Set objects in the specified order
- if( myEditedObject->IsMustBeUpdated() )
- {
- myEditedObject->RemoveLandCovers();
- foreach ( const QString& aName, aPanel->getAllLandCovers() )
- {
- Handle(HYDROData_LandCover) aLandCover = Handle(HYDROData_LandCover)::DownCast(
- HYDROGUI_Tool::FindObjectByName( module(), aName ) );
- if ( aLandCover.IsNull() )
- {
- continue;
- }
- myEditedObject->AddLandCover( aLandCover );
- }
-
- // Clear priority rules
- myEditedObject->ClearRules( HYDROData_CalculationCase::DataTag_CustomLandCoverRules, true );
- // Set priority rules
- foreach ( const HYDROData_CustomRule& aRule, aPanel->getLandCoverRules() ) {
- myEditedObject->AddRule( aRule.Object1, aRule.Priority,
- aRule.Object2, HYDROData_Zone::Merge_Object,
- HYDROData_CalculationCase::DataTag_CustomLandCoverRules );
- }
- }
- }
- aPanel->setEditLandCoversEnabled( aMode == HYDROData_CalculationCase::MANUAL );
-
- bool anIsToUpdateOb = false;
- if ( myEditedObject->IsMustBeUpdated() )
- {
- myShowZones = true;
- myEditedObject->Update();
-
- AssignDefaultZonesColors( true );
-
- aPanel->refreshLandCoverZonesBrowser();
-
- closePreview();
- createPreview( true );
-
- anIsToUpdateOb = true;
-
- myEditedObject->SetToUpdate( true );
- }
- else
- {
- // Hide zones
- setZonesVisible( false, false );
- // Show land cover zones
- setZonesVisible( true, true );
- }
-
- if ( anIsToUpdateOb ) {
- SUIT_DataBrowser* anObjBrowser = ((LightApp_Application*)module()->application())->objectBrowser();
- if ( anObjBrowser ) {
- anObjBrowser->updateTree( module()->getDataModel()->getDataObject( myEditedObject ), false );
- }
- }
-
- QApplication::restoreOverrideCursor();
- }