]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Bug #478: unresolved conflicts appear again when Edit calculation case in Manual...
authormzn <mzn@opencascade.com>
Mon, 27 Oct 2014 12:58:53 +0000 (12:58 +0000)
committermzn <mzn@opencascade.com>
Mon, 27 Oct 2014 12:58:53 +0000 (12:58 +0000)
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_CalculationCase.h
src/HYDROGUI/HYDROGUI_CalculationOp.cxx

index b8e0d9f0a266f96d360469bd07d86591a4c0cf91..2def6341fea3e25e97106aaa636ea80f21feb606 100644 (file)
@@ -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,
index e0b0789239962dedd53d4fe709cda706c8180e69..2c8c7bc972ef4b94318c8eb063bb4452dd712cbd 100644 (file)
@@ -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,
index 9d78d3cc4db6990fc98bbaa1c79e360aca362d4c..8ac82917eff6034f7497ad77a7240f32ad18270b 100644 (file)
@@ -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,