{
// Set the selected boundary polyline to the calculation case
Handle(HYDROData_Polyline) anObject;
- HYDROGUI_Shape* aShape;
Handle(AIS_InteractiveContext) aCtx;
if ( myPreviewViewManager )
{
if ( aPanel )
{
// Add geometry objects selected in the module browser to the calculation case
- Handle(HYDROData_Object) anObject;
- Handle(HYDROData_Entity) anEntity;
- QStringList aList;
QStringList aSelectedList = aPanel->getSelectedAvailableGeomObjects();
- for (int i = 0; i < aSelectedList.length(); i++)
+ if ( ( !aSelectedList.isEmpty() ) && ( confirmRegionsChange() ) )
{
- anEntity = HYDROGUI_Tool::FindObjectByName( module(), aSelectedList.at(i) );
- if ( !anEntity.IsNull() )
+ Handle(HYDROData_Object) anObject;
+ Handle(HYDROData_Entity) anEntity;
+ QStringList aList;
+ for (int i = 0; i < aSelectedList.length(); i++)
{
- anObject = Handle(HYDROData_Object)::DownCast( anEntity );
- if ( !anObject.IsNull() )
+ anEntity = HYDROGUI_Tool::FindObjectByName( module(), aSelectedList.at(i) );
+ if ( !anEntity.IsNull() )
{
- if (myEditedObject->AddGeometryObject( anObject ))
+ anObject = Handle(HYDROData_Object)::DownCast( anEntity );
+ if ( !anObject.IsNull() )
{
- aList.append( anObject->GetName() );
+ if (myEditedObject->AddGeometryObject( anObject ))
+ {
+ aList.append( anObject->GetName() );
+ }
}
}
}
- }
- if ( !aList.isEmpty() )
- {
- aPanel->includeGeomObjects( aList );
- createPreview();
+ if ( !aList.isEmpty() )
+ {
+ aPanel->includeGeomObjects( aList );
+ createPreview();
+ }
}
}
}
if ( aPanel )
{
QStringList aList = aPanel->getSelectedGeomObjects();
- Handle(HYDROData_Object) anObject;
- Handle(HYDROData_Entity) anEntity;
- for (int i = 0; i < aList.length(); i++)
+ if ( ( !aList.isEmpty() ) && ( confirmRegionsChange() ) )
{
- anEntity = HYDROGUI_Tool::FindObjectByName( module(), aList.at(i) );
- if ( !anEntity.IsNull() )
+ Handle(HYDROData_Object) anObject;
+ Handle(HYDROData_Entity) anEntity;
+ for (int i = 0; i < aList.length(); i++)
{
- anObject = Handle(HYDROData_Object)::DownCast( anEntity );
- if ( !anObject.IsNull() )
+ anEntity = HYDROGUI_Tool::FindObjectByName( module(), aList.at(i) );
+ if ( !anEntity.IsNull() )
{
- module()->removeObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, anObject );
- myEditedObject->RemoveGeometryObject( anObject );
+ anObject = Handle(HYDROData_Object)::DownCast( anEntity );
+ if ( !anObject.IsNull() )
+ {
+ module()->removeObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, anObject );
+ myEditedObject->RemoveGeometryObject( anObject );
+ }
}
}
+ if ( !aList.isEmpty() )
+ {
+ aPanel->excludeGeomObjects( aList );
+ }
}
- if ( !aList.isEmpty() )
+ }
+}
+
+bool HYDROGUI_CalculationOp::confirmRegionsChange() 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 )
{
- aPanel->excludeGeomObjects( aList );
+ // If there are already defined zones then ask a user to confirm zones recalculation
+ isConfirmed = ( SUIT_MessageBox::question( module()->getApp()->desktop(),
+ tr( "REGIONS_CHANGED" ),
+ tr( "CONFIRM_SPLITTING_ZONES_RECALCULATION" ),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::No ) == QMessageBox::Yes );
}
}
+ return isConfirmed;
}
bool HYDROGUI_CalculationOp::processApply( int& theUpdateFlags,