From 1c46311dfa50e3077f13290dbe935205c1edb8a1 Mon Sep 17 00:00:00 2001 From: asl Date: Mon, 27 Oct 2014 13:07:10 +0000 Subject: [PATCH] patch for clear rules method --- src/HYDROData/HYDROData_CalculationCase.cxx | 6 ------ src/HYDROData/HYDROData_CalculationCase.h | 3 +-- src/HYDROData/HYDROData_PriorityQueue.cxx | 5 ----- src/HYDROData/HYDROData_PriorityQueue.h | 1 - src/HYDROGUI/HYDROGUI_CalculationOp.cxx | 13 +++++++------ 5 files changed, 8 insertions(+), 20 deletions(-) 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, -- 2.39.2