connect( aPanel, SIGNAL( removeObjects() ), SLOT( onRemoveObjects() ) );
connect( aPanel, SIGNAL( addGroups() ), SLOT( onAddGroups() ) );
connect( aPanel, SIGNAL( removeGroups() ), SLOT( onRemoveGroups() ) );
+ connect( aPanel, SIGNAL( orderChanged( bool& ) ), SLOT( onOrderChanged( bool& ) ) );
connect( aPanel, SIGNAL( Next( const int ) ), SLOT( onNext( const int ) ) );
connect( aPanel, SIGNAL( Back( const int ) ), SLOT( onHideZones() ) );
//connect( aPanel, SIGNAL( clicked( SUIT_DataObject* ) ), SLOT( onSelected( SUIT_DataObject* ) ) );
return isConfirmed;
}
+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
// Set parameters for automatic mode
int aMode = aPanel->getMode();
- if ( aMode == HYDROData_CalculationCase::AUTOMATIC ) {
+ if ( aMode == HYDROData_CalculationCase::AUTOMATIC )
+ {
// Set objects in the specified order
- myEditedObject->RemoveGeometryObjects();
- foreach ( const QString& aName, aPanel->getAllGeomObjects() ) {
- Handle(HYDROData_Object) anObject = Handle(HYDROData_Object)::DownCast(
- HYDROGUI_Tool::FindObjectByName( module(), aName ) );
- if ( anObject.IsNull() ) {
- continue;
+ if( myEditedObject->IsMustBeUpdated() )
+ {
+ myEditedObject->RemoveGeometryObjects();
+ foreach ( const QString& aName, aPanel->getAllGeomObjects() )
+ {
+ Handle(HYDROData_Object) anObject = Handle(HYDROData_Object)::DownCast(
+ HYDROGUI_Tool::FindObjectByName( module(), aName ) );
+ if ( anObject.IsNull() )
+ {
+ continue;
+ }
+ myEditedObject->AddGeometryObject( anObject );
}
- myEditedObject->AddGeometryObject( anObject );
- }
-
- // Clear priority rules
- //@ASL if ( myEditedObject->GetRulesCount() > 0 ) {
- myEditedObject->ClearRules( true );
- //@ASL }
- // Set priority rules
- foreach ( const HYDROData_CustomRule& aRule, aPanel->getRules() ) {
- myEditedObject->AddRule( aRule.Object1, aRule.Priority,
- aRule.Object2, aRule.MergeType );
+ // Clear priority rules
+ //@ASL if ( myEditedObject->GetRulesCount() > 0 ) {
+ myEditedObject->ClearRules( true );
+ //@ASL }
+ // Set priority rules
+ foreach ( const HYDROData_CustomRule& aRule, aPanel->getRules() ) {
+ myEditedObject->AddRule( aRule.Object1, aRule.Priority,
+ aRule.Object2, aRule.MergeType );
+ }
}
}
aPanel->setEditZonesEnabled( aMode == HYDROData_CalculationCase::MANUAL );
myEditedObject->SetAssignmentMode( (HYDROData_CalculationCase::AssignmentMode)theMode );
aPanel->setMode( theMode );
}
+
+void HYDROGUI_CalculationOp::onOrderChanged( bool& isConfirmed )
+{
+ HYDROGUI_CalculationDlg* aPanel =
+ ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
+ if ( !aPanel )
+ return;
+
+ isConfirmed = confirmOrderChange();
+ if( isConfirmed )
+ myEditedObject->SetToUpdate( true );
+}
*/
void onBoundarySelected ( const QString & theObjName );
+ void onOrderChanged( bool& isConfirmed );
+
private:
void createPreview();
void closePreview();
float theSaturation = 0.5,
float theValue = 0.95 ) const;
- /**
- * Ask user to confirm splitting zones recalculation after regions list modification.
- * \return true if confirmed
- */
- bool confirmRegionsChange() const;
-
- /**
- * Ask user to confirm splitting zones recalculation after mode change.
- * \return true if confirmed
- */
- bool confirmModeChange() const;
-
- /**
- * Ask user to confirm the operation continuation with warning.
- * @param theWarning the warning
- * \return true if confirmed
- */
- bool confirmContinueWithWarning( const HYDROData_Warning& theWarning ) const;
+ bool confirmRegionsChange() const;
+ bool confirmModeChange() const;
+ bool confirmOrderChange() const;
+ bool confirmContinueWithWarning( const HYDROData_Warning& theWarning ) const;
private:
bool myIsEdit;