return ( anAnswer == QMessageBox::Yes );
}
+bool HYDROGUI_CalculationOp::confirmLandCoverRegionsChange() 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 land cover zones
+ HYDROData_SequenceOfObjects aSeq = myEditedObject->GetRegions( true );
+ if ( aSeq.Length() > 0 )
+ {
+ // If there are already defined land cover zones then ask a user to confirm land cover zones recalculation
+ isConfirmed = ( SUIT_MessageBox::question( module()->getApp()->desktop(),
+ tr( "REGIONS_CHANGED" ),
+ tr( "CONFIRM_LAND_COVER_PARTITION_RECALCULATION_REGIONS" ),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::No ) == QMessageBox::Yes );
+ }
+ else
+ {
+ isConfirmed = true; // No regions - no land cover zones - nothing to recalculate
+ }
+ }
+ return isConfirmed;
+}
+
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 not modified check if the case has already defined regions with land cover zones
+ HYDROData_SequenceOfObjects aSeq = myEditedObject->GetRegions( true );
if ( aSeq.Length() > 0 )
- {*/
- // If there are already defined zones then ask a user to confirm zones recalculation
+ {
+ // If there are already defined land cover zones then ask a user to confirm land cover 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
- }*/
+ isConfirmed = true; // No regions - no land cover zones - nothing to recalculate
+ }
}
return isConfirmed;
}
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 not modified check if the case has already defined regions with land cover zones
+ HYDROData_SequenceOfObjects aSeq = myEditedObject->GetRegions( true );
if ( aSeq.Length() > 0 )
- {*/
- // If there are already defined zones then ask a user to confirm zones recalculation
+ {
+ // If there are already defined land cover zones then ask a user to confirm land cover 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
- }*/
+ isConfirmed = true; // No regions - no land cover zones - nothing to recalculate
+ }
}
return isConfirmed;
}
}
}
aPanel->setStricklerTableNames( aList, anEntryList );
+ bool anUpdateState = myEditedObject->IsMustBeUpdated();
if ( !aList.isEmpty() )
aPanel->setStricklerTable( aList.at( 0 ), false );
+ myEditedObject->SetToUpdate( anUpdateState );
// Fill in list widget with all available land covers
aSeq = HYDROGUI_Tool::GetLandCovers( module() );
if ( anIsToUpdate )
{
myShowZones = true;
- myEditedObject->Update();
+ //myEditedObject->Update();
+ myEditedObject->SetToUpdate( false );
AssignDefaultZonesColors( true );
// Add land covers selected in the module browser to the calculation case
QStringList aSelectedList = aPanel->getSelectedAvailableLandCovers();
- if ( aSelectedList.isEmpty() || !confirmRegionsChange() )
+ if ( aSelectedList.isEmpty() || !confirmLandCoverRegionsChange() )
return;
QStringList anAddedList;
return;
QStringList aSelectedList = aPanel->getSelectedLandCovers();
- if ( aSelectedList.isEmpty() || !confirmRegionsChange() )
+ if ( aSelectedList.isEmpty() || !confirmLandCoverRegionsChange() )
return;
for (int i = 0; i < aSelectedList.length(); i++)