Salome HOME
refs #673: Strickler coefficient should be written for Telemac instead of Strickler...
[modules/hydro.git] / src / HYDROData / HYDROData_PriorityQueue.cxx
index 6dbb5daec91146ad68f85220ec7f615574270ed8..27427dd4c7e6f7570c254f435e9720f01125b019 100644 (file)
@@ -19,7 +19,6 @@
 #include <HYDROData_PriorityQueue.h>
 #include <HYDROData_CalculationCase.h>
 #include <HYDROData_Iterator.h>
-#include <HYDROData_LandCover.h>
 #include <TDataStd_ReferenceList.hxx>
 #include <TDataStd_Integer.hxx>
 #include <TDF_ChildIterator.hxx>
 HYDROData_PriorityQueue::HYDROData_PriorityQueue( HYDROData_CalculationCase* theCalcCase,
                                                   Standard_Integer aTag )
 {
-  myGeomObjects = theCalcCase->GetGeometryObjects();
-  for( int i=myGeomObjects.Lower(), n=myGeomObjects.Upper(); i<=n; i++ )
+  myObjects = theCalcCase->GetGeometryObjects();
+  for( int i=myObjects.Lower(), n=myObjects.Upper(); i<=n; i++ )
   {
-    Handle(HYDROData_Entity) anObj = myGeomObjects.Value( i );
+    Handle(HYDROData_Entity) anObj = myObjects.Value( i );
     if( !anObj.IsNull() )
     {
       QString anObjName = anObj->GetName();
@@ -46,12 +45,12 @@ HYDROData_PriorityQueue::~HYDROData_PriorityQueue()
 }
 
 Handle(HYDROData_Entity) HYDROData_PriorityQueue::GetMostPriorityObject( const QStringList& theZoneObjects,
-                                                                         HYDROData_Zone::MergeAltitudesType& theMergeType ) const
+                                                                         HYDROData_Zone::MergeType& theMergeType ) const
 {
   QStringList aSortedZoneObjects;
-  for( int i=myGeomObjects.Lower(), n=myGeomObjects.Upper(); i<=n; i++ )
+  for( int i=myObjects.Lower(), n=myObjects.Upper(); i<=n; i++ )
   {
-    QString aName = myGeomObjects.Value( i )->GetName();
+    QString aName = myObjects.Value( i )->GetName();
     if( theZoneObjects.contains( aName ) )
       aSortedZoneObjects.append( aName );
   }
@@ -61,7 +60,7 @@ Handle(HYDROData_Entity) HYDROData_PriorityQueue::GetMostPriorityObject( const Q
   QStringList::const_iterator anIt = aSortedZoneObjects.begin(), aLast = aSortedZoneObjects.end();
   for( ; anIt!=aLast; anIt++ )
   {
-    HYDROData_Zone::MergeAltitudesType aLocalMerge = HYDROData_Zone::Merge_UNKNOWN;
+    HYDROData_Zone::MergeType aLocalMerge = HYDROData_Zone::Merge_UNKNOWN;
     Handle(HYDROData_Entity) anObj = myNames[*anIt];
     if( !anObj.IsNull() )
     {
@@ -86,7 +85,7 @@ Handle(HYDROData_Entity) HYDROData_PriorityQueue::GetMostPriorityObject( const Q
 
 bool HYDROData_PriorityQueue::IsMorePriority( const Handle(HYDROData_Entity)& theObj1,
                                               const Handle(HYDROData_Entity)& theObj2,
-                                              HYDROData_Zone::MergeAltitudesType& theMergeType ) const
+                                              HYDROData_Zone::MergeType& theMergeType ) const
 {
   // 1. First we check custom rules
   HYDROData_ListOfRules::const_iterator anIt = myRules.begin(), aLast = myRules.end();
@@ -105,14 +104,14 @@ bool HYDROData_PriorityQueue::IsMorePriority( const Handle(HYDROData_Entity)& th
   }
 
   // 2. If no custom rule found, the standard ordering list is applied
-  for( int i=myGeomObjects.Lower(), n=myGeomObjects.Upper(); i<=n; i++ )
+  for( int i=myObjects.Lower(), n=myObjects.Upper(); i<=n; i++ )
   {
-    if( myGeomObjects.Value( i )->Label() == theObj1->Label() )
+    if( myObjects.Value( i )->Label() == theObj1->Label() )
     {
       theMergeType = HYDROData_Zone::Merge_Object;
       return true;
     }
-    if( myGeomObjects.Value( i )->Label() == theObj2->Label() )
+    if( myObjects.Value( i )->Label() == theObj2->Label() )
     {
       theMergeType = HYDROData_Zone::Merge_Object;
       return false;
@@ -134,11 +133,11 @@ enum HYDROData_PriorityQueueTag
   Merge_Tag,
 };
 
-void HYDROData_PriorityQueue::AddRule( TDF_Label&                         theRulesLabel,
-                                       const Handle(HYDROData_Entity)&    theObject1,
-                                       HYDROData_PriorityType             thePriority,
-                                       const Handle(HYDROData_Entity)&    theObject2,
-                                       HYDROData_Zone::MergeAltitudesType theMergeType )
+void HYDROData_PriorityQueue::AddRule( TDF_Label&                      theRulesLabel,
+                                       const Handle(HYDROData_Entity)& theObject1,
+                                       HYDROData_PriorityType          thePriority,
+                                       const Handle(HYDROData_Entity)& theObject2,
+                                       HYDROData_Zone::MergeType       theMergeType )
 {
   // Get the last rule index
   Standard_Integer aRuleIndex = 0;
@@ -190,7 +189,7 @@ HYDROData_ListOfRules HYDROData_PriorityQueue::GetRules( const TDF_Label& theRul
       aRule.Object1 = HYDROData_Iterator::Object( aRefs1->First() );
       aRule.Priority = ( HYDROData_PriorityType ) aPriorityAttr->Get();
       aRule.Object2 = HYDROData_Iterator::Object( aRefs2->First() );
-      aRule.MergeType = ( HYDROData_Zone::MergeAltitudesType ) aMergeAttr->Get();
+      aRule.MergeType = ( HYDROData_Zone::MergeType ) aMergeAttr->Get();
       aRules.append( aRule );
     }
   }
@@ -201,6 +200,7 @@ HYDROData_ListOfRules HYDROData_PriorityQueue::GetRules( const TDF_Label& theRul
 QString HYDROData_PriorityQueue::DumpRules( const TDF_Label& theRulesLab )
 {
   QString aDump = "Rules:\n";
+
   HYDROData_ListOfRules aRules = GetRules( theRulesLab );
   HYDROData_ListOfRules::const_iterator anIt = aRules.begin(), aLast = aRules.end();
   for( ; anIt!=aLast; anIt++ )
@@ -243,10 +243,6 @@ void HYDROData_PriorityQueue::DumpRulesToPython( const TDF_Label& theRulesLab,
     QString aMergeType;
 
     HYDROData_CalculationCase::DataTag aDataTag = HYDROData_CalculationCase::DataTag_CustomRules;
-    Handle(HYDROData_LandCover) aLandCover1 = Handle(HYDROData_LandCover)::DownCast( anIt->Object1 );
-    Handle(HYDROData_LandCover) aLandCover2 = Handle(HYDROData_LandCover)::DownCast( anIt->Object2 );
-    if ( !aLandCover1.IsNull() && !aLandCover2.IsNull() )
-      aDataTag = HYDROData_CalculationCase::DataTag_CustomLandCoverRules;
 
     switch( anIt->MergeType )
     {
@@ -273,10 +269,10 @@ void HYDROData_PriorityQueue::DumpRulesToPython( const TDF_Label& theRulesLab,
 
 bool HYDROData_PriorityQueue::GetRule( const TDF_Label& theRulesLab,
                                        int theIndex, 
-                                       Handle(HYDROData_Entity)&           theObject1,
-                                       HYDROData_PriorityType&             thePriority,
-                                       Handle(HYDROData_Entity)&           theObject2,
-                                       HYDROData_Zone::MergeAltitudesType& theMergeType )
+                                       Handle(HYDROData_Entity)&  theObject1,
+                                       HYDROData_PriorityType&    thePriority,
+                                       Handle(HYDROData_Entity)&  theObject2,
+                                       HYDROData_Zone::MergeType& theMergeType )
 {
   TDF_Label aRuleLabel = theRulesLab.FindChild( theIndex );
 
@@ -294,7 +290,7 @@ bool HYDROData_PriorityQueue::GetRule( const TDF_Label& theRulesLab,
     theObject1   = HYDROData_Iterator::Object( aRefs1->First() );
     thePriority  = ( HYDROData_PriorityType ) aPriorityAttr->Get();
     theObject2   = HYDROData_Iterator::Object( aRefs2->First() );
-    theMergeType = ( HYDROData_Zone::MergeAltitudesType ) aMergeAttr->Get();
+    theMergeType = ( HYDROData_Zone::MergeType ) aMergeAttr->Get();
   }
   return isOK;
 }