From: asl Date: Mon, 27 Oct 2014 13:07:10 +0000 (+0000) Subject: patch for clear rules method X-Git-Tag: BR_hydro_v_1_0_4~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1c46311dfa50e3077f13290dbe935205c1edb8a1;p=modules%2Fhydro.git patch for clear rules method --- diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 2def6341..4a5d2fe6 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -1157,12 +1157,6 @@ void HYDROData_CalculationCase::SetWarning( HYDROData_WarningType theType, const myLastWarning.Data = theData; } -int HYDROData_CalculationCase::GetRulesCount() const -{ - TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules ); - return HYDROData_PriorityQueue::GetRulesCount( aRulesLab ); -} - bool HYDROData_CalculationCase::GetRule( int theIndex, Handle(HYDROData_Object)& theObject1, HYDROData_PriorityType& thePriority, diff --git a/src/HYDROData/HYDROData_CalculationCase.h b/src/HYDROData/HYDROData_CalculationCase.h index 2c8c7bc9..a47afd74 100644 --- a/src/HYDROData/HYDROData_CalculationCase.h +++ b/src/HYDROData/HYDROData_CalculationCase.h @@ -292,12 +292,11 @@ public: HYDRODATA_EXPORT void SetAssignmentMode( AssignmentMode theMode ); HYDRODATA_EXPORT AssignmentMode GetAssignmentMode() const; - HYDRODATA_EXPORT void ClearRules( const bool theIsSetToUpdate ); + HYDRODATA_EXPORT void ClearRules( const bool theIsSetToUpdate = true ); HYDRODATA_EXPORT void AddRule( const Handle(HYDROData_Object)& theObject1, HYDROData_PriorityType thePriority, const Handle(HYDROData_Object)& theObject2, HYDROData_Zone::MergeAltitudesType theMergeType ); - HYDRODATA_EXPORT int GetRulesCount() const; HYDRODATA_EXPORT bool GetRule( int theIndex, Handle(HYDROData_Object)& theObject1, HYDROData_PriorityType& thePriority, diff --git a/src/HYDROData/HYDROData_PriorityQueue.cxx b/src/HYDROData/HYDROData_PriorityQueue.cxx index 76b475d1..95e167bd 100644 --- a/src/HYDROData/HYDROData_PriorityQueue.cxx +++ b/src/HYDROData/HYDROData_PriorityQueue.cxx @@ -236,11 +236,6 @@ void HYDROData_PriorityQueue::DumpRulesToPython( const TDF_Label& theRulesLab, } } -int HYDROData_PriorityQueue::GetRulesCount( const TDF_Label& theRulesLab ) -{ - return theRulesLab.NbChildren(); -} - bool HYDROData_PriorityQueue::GetRule( const TDF_Label& theRulesLab, int theIndex, Handle(HYDROData_Object)& theObject1, diff --git a/src/HYDROData/HYDROData_PriorityQueue.h b/src/HYDROData/HYDROData_PriorityQueue.h index 0864ee5a..62c8708d 100644 --- a/src/HYDROData/HYDROData_PriorityQueue.h +++ b/src/HYDROData/HYDROData_PriorityQueue.h @@ -48,7 +48,6 @@ public: static void DumpRulesToPython( const TDF_Label& theRulesLab, const QString& theCalcCaseName, QStringList& theScript ); - static int GetRulesCount( const TDF_Label& theRulesLab ); static bool GetRule( const TDF_Label& theRulesLab, int theIndex, Handle(HYDROData_Object)& theObject1, diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index 8ac82917..898a3c1e 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -155,8 +155,8 @@ void HYDROGUI_CalculationOp::startOperation() Handle(HYDROData_Object) anObject1, anObject2; HYDROData_PriorityType aPriority; HYDROData_Zone::MergeAltitudesType aMergeType; - int aRulesNb = myEditedObject->GetRulesCount(); - for ( int anIndex = 0; anIndex < aRulesNb; anIndex++ ) { + for ( int anIndex = 0; ; anIndex++ ) + { if ( myEditedObject->GetRule( anIndex, anObject1, aPriority, anObject2, aMergeType ) ) { HYDROData_CustomRule aRule; aRule.Object1 = anObject1; @@ -166,6 +166,8 @@ void HYDROGUI_CalculationOp::startOperation() aRules << aRule; } + else + break; } aPanel->setRules( aRules ); } @@ -589,8 +591,7 @@ bool HYDROGUI_CalculationOp::processApply( int& theUpdateFlags, } // For manual mode priority rules are redundant - if ( aPanel->getMode() == HYDROData_CalculationCase::MANUAL && - myEditedObject->GetRulesCount() > 0 ) { + if ( aPanel->getMode() == HYDROData_CalculationCase::MANUAL ) { myEditedObject->ClearRules( false ); } @@ -699,9 +700,9 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex ) } // Clear priority rules - if ( myEditedObject->GetRulesCount() > 0 ) { + //@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,