From: mzn Date: Mon, 27 Oct 2014 12:58:53 +0000 (+0000) Subject: Bug #478: unresolved conflicts appear again when Edit calculation case in Manual... X-Git-Tag: BR_hydro_v_1_0_4~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aef25fd825d5add8a8cc2cdf43db3f24e5d4a90f;p=modules%2Fhydro.git Bug #478: unresolved conflicts appear again when Edit calculation case in Manual Mode. --- diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index b8e0d9f0..2def6341 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -1091,13 +1091,15 @@ GEOM::GEOM_Object_ptr HYDROData_CalculationCase::publishShapeInGEOM( return aGeomObj._retn(); } -void HYDROData_CalculationCase::ClearRules() +void HYDROData_CalculationCase::ClearRules( const bool theIsSetToUpdate ) { TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules ); HYDROData_PriorityQueue::ClearRules( aRulesLab ); // Indicate model of the need to update splitting - SetToUpdate( true ); + if ( theIsSetToUpdate ) { + SetToUpdate( true ); + } } void HYDROData_CalculationCase::AddRule( const Handle(HYDROData_Object)& theObject1, diff --git a/src/HYDROData/HYDROData_CalculationCase.h b/src/HYDROData/HYDROData_CalculationCase.h index e0b07892..2c8c7bc9 100644 --- a/src/HYDROData/HYDROData_CalculationCase.h +++ b/src/HYDROData/HYDROData_CalculationCase.h @@ -292,7 +292,7 @@ public: HYDRODATA_EXPORT void SetAssignmentMode( AssignmentMode theMode ); HYDRODATA_EXPORT AssignmentMode GetAssignmentMode() const; - HYDRODATA_EXPORT void ClearRules(); + HYDRODATA_EXPORT void ClearRules( const bool theIsSetToUpdate ); HYDRODATA_EXPORT void AddRule( const Handle(HYDROData_Object)& theObject1, HYDROData_PriorityType thePriority, const Handle(HYDROData_Object)& theObject2, diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index 9d78d3cc..8ac82917 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -155,7 +155,8 @@ void HYDROGUI_CalculationOp::startOperation() Handle(HYDROData_Object) anObject1, anObject2; HYDROData_PriorityType aPriority; HYDROData_Zone::MergeAltitudesType aMergeType; - for ( int anIndex = 0; anIndex < myEditedObject->GetRulesCount(); anIndex++ ) { + int aRulesNb = myEditedObject->GetRulesCount(); + for ( int anIndex = 0; anIndex < aRulesNb; anIndex++ ) { if ( myEditedObject->GetRule( anIndex, anObject1, aPriority, anObject2, aMergeType ) ) { HYDROData_CustomRule aRule; aRule.Object1 = anObject1; @@ -587,6 +588,12 @@ bool HYDROGUI_CalculationOp::processApply( int& theUpdateFlags, theBrowseObjectsEntries.append( anEntry ); } + // For manual mode priority rules are redundant + if ( aPanel->getMode() == HYDROData_CalculationCase::MANUAL && + myEditedObject->GetRulesCount() > 0 ) { + myEditedObject->ClearRules( false ); + } + theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init; return true; @@ -675,12 +682,7 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex ) // At first we must to update the case name because of // automatic names generation for regions and zones myEditedObject->SetName( aNewCaseName ); - - // Clear rules - if ( myEditedObject->GetRulesCount() > 0 ) { - myEditedObject->ClearRules(); - } - + // Set parameters for automatic mode int aMode = aPanel->getMode(); if ( aMode == HYDROData_CalculationCase::AUTOMATIC ) { @@ -696,6 +698,10 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex ) myEditedObject->AddGeometryObject( anObject ); } + // Clear priority rules + if ( myEditedObject->GetRulesCount() > 0 ) { + myEditedObject->ClearRules( true ); + } // Set priority rules foreach ( const HYDROData_CustomRule& aRule, aPanel->getRules() ) { myEditedObject->AddRule( aRule.Object1, aRule.Priority,