]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
patch for clear rules method
authorasl <asl@opencascade.com>
Mon, 27 Oct 2014 13:07:10 +0000 (13:07 +0000)
committerasl <asl@opencascade.com>
Mon, 27 Oct 2014 13:07:10 +0000 (13:07 +0000)
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_CalculationCase.h
src/HYDROData/HYDROData_PriorityQueue.cxx
src/HYDROData/HYDROData_PriorityQueue.h
src/HYDROGUI/HYDROGUI_CalculationOp.cxx

index 2def6341fea3e25e97106aaa636ea80f21feb606..4a5d2fe67cf589a1656f4842ffef72f39565bf47 100644 (file)
@@ -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,
index 2c8c7bc972ef4b94318c8eb063bb4452dd712cbd..a47afd74d100f78ea8c460052d5e754fd6f9c5c5 100644 (file)
@@ -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,
index 76b475d1d421225a7f8bfdba221b9528316b4a56..95e167bd2c7fa8440230efd9d7b8f9c2c4c1c126 100644 (file)
@@ -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,
index 0864ee5a175ec58c0ec69b21e1c0d94cde364f9f..62c8708d15d993ec5e2598a3560bcbb13a0f4e9f 100644 (file)
@@ -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,
index 8ac82917eff6034f7497ad77a7240f32ad18270b..898a3c1e64232536e08b267a9ff9379c20ea8d1f 100644 (file)
@@ -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,