+bool HYDROGUI_CalculationOp::confirmOrderChange() const
+{
+ // Check if the case is already modified or not
+ bool isConfirmed = myEditedObject->IsMustBeUpdated();
+ if ( !isConfirmed )
+ {
+ // If not modified check if the case has already defined regions with zones
+ HYDROData_SequenceOfObjects aSeq = myEditedObject->GetRegions();
+ if ( aSeq.Length() > 0 )
+ {
+ // If there are already defined zones then ask a user to confirm zones recalculation
+ isConfirmed = ( SUIT_MessageBox::question( module()->getApp()->desktop(),
+ tr( "ORDER_CHANGED" ),
+ tr( "CONFIRM_SPLITTING_ZONES_RECALCULATION_REGIONS" ),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::No ) == QMessageBox::Yes );
+ }
+ else
+ {
+ isConfirmed = true; // No regions - no zones - nothing to recalculate
+ }
+ }
+ return isConfirmed;
+}
+
+bool HYDROGUI_CalculationOp::confirmModeChange() const
+{
+ // Check if the case is already modified or not
+ bool isConfirmed = myEditedObject->IsMustBeUpdated();
+ if ( !isConfirmed )
+ {
+ // If not modified check if the case has already defined regions with zones
+ HYDROData_SequenceOfObjects aSeq = myEditedObject->GetRegions();
+ if ( aSeq.Length() > 0 )
+ {
+ // If there are already defined zones then ask a user to confirm zones recalculation
+ isConfirmed = ( SUIT_MessageBox::question( module()->getApp()->desktop(),
+ tr( "MODE_CHANGED" ),
+ tr( "CONFIRM_SPLITTING_ZONES_RECALCULATION_MODE" ),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::No ) == QMessageBox::Yes );
+ }
+ else
+ {
+ isConfirmed = true; // No regions - no zones - nothing to recalculate
+ }
+ }
+ return isConfirmed;
+}
+
+bool HYDROGUI_CalculationOp::confirmContinueWithWarning( const HYDROData_Warning& theWarning ) const
+{
+ HYDROData_WarningType aType = theWarning.Type;
+ if ( aType == WARN_OK ) {
+ return true;
+ }
+
+ QString aTitle;
+ QString aMsg;
+ switch ( aType )
+ {
+ case WARN_EMPTY_REGIONS:
+ aTitle = tr( "EMPTY_REGIONS" );
+ aMsg = tr( "CONFIRM_CONTINUE_WITH_OBJECTS_NOT_INCLUDED_TO_REGION" ).arg( theWarning.Data );
+ break;
+ default:
+ aTitle = tr( "WARNING" );
+ aMsg = theWarning.Data;
+ }
+
+
+ int anAnswer = SUIT_MessageBox::warning( module()->getApp()->desktop(),
+ aTitle, aMsg,
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::No );
+
+ return ( anAnswer == QMessageBox::Yes );
+}
+
+bool HYDROGUI_CalculationOp::confirmLandCoverModeChange() const
+{
+ // Check if the case is already modified or not
+ bool isConfirmed = myEditedObject->IsMustBeUpdated();
+ if ( !isConfirmed )
+ {
+ // If not modified check if the case has already defined regions with zones
+ // TODO: adapt HYDROData_CalculationCase class to process regions constructed for land covers
+ /*HYDROData_SequenceOfObjects aSeq = myEditedObject->GetLandCoverRegions();
+ if ( aSeq.Length() > 0 )
+ {*/
+ // If there are already defined zones then ask a user to confirm zones recalculation
+ isConfirmed = ( SUIT_MessageBox::question( module()->getApp()->desktop(),
+ tr( "MODE_CHANGED" ),
+ tr( "CONFIRM_LAND_COVER_PARTITION_RECALCULATION_MODE" ),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::No ) == QMessageBox::Yes );
+ /*}
+ else
+ {
+ isConfirmed = true; // No regions - no zones - nothing to recalculate
+ }*/
+ }
+ return isConfirmed;
+}
+
+bool HYDROGUI_CalculationOp::confirmLandCoverOrderChange() const
+{
+ // Check if the case is already modified or not
+ bool isConfirmed = myEditedObject->IsMustBeUpdated();
+ if ( !isConfirmed )
+ {
+ // If not modified check if the case has already defined regions with zones
+ // TODO: adapt HYDROData_CalculationCase class to process regions constructed for land covers
+ /*HYDROData_SequenceOfObjects aSeq = myEditedObject->GetLandCoverRegions();
+ if ( aSeq.Length() > 0 )
+ {*/
+ // If there are already defined zones then ask a user to confirm zones recalculation
+ isConfirmed = ( SUIT_MessageBox::question( module()->getApp()->desktop(),
+ tr( "ORDER_CHANGED" ),
+ tr( "CONFIRM_LAND_COVER_PARTITION_RECALCULATION_REGIONS" ),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::No ) == QMessageBox::Yes );
+ /*}
+ else
+ {
+ isConfirmed = true; // No regions - no zones - nothing to recalculate
+ }*/
+ }
+ return isConfirmed;
+}
+