Salome HOME
TShell cannot be disconnected; use TCompound of shells/faces instead
[modules/hydro.git] / src / HYDROData / HYDROData_CalculationCase.cxx
index 3de94ed066ea925ba5ef8e09aadd7f5ede07b7a5..34b413fa97e92e229ec27e6076e0ec6646ad57a5 100644 (file)
@@ -25,6 +25,7 @@
 #include "HYDROData_NaturalObject.h"
 #include "HYDROData_PolylineXY.h"
 #include "HYDROData_StricklerTable.h"
+#include "HYDROData_LandCoverMap.h"
 #include "HYDROData_SplittedShapesGroup.h"
 #include "HYDROData_Region.h"
 #include "HYDROData_Tool.h"
@@ -575,6 +576,18 @@ void HYDROData_CalculationCase::RemoveStricklerTable()
   Changed( Geom_No );
 }
 
+Handle(HYDROData_LandCoverMap) HYDROData_CalculationCase::GetLandCoverMap() const
+{
+  Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast(
+    GetReferenceObject( DataTag_LandCoverMap ) );
+  return aMap;
+}
+
+void HYDROData_CalculationCase::SetLandCoverMap( const Handle(HYDROData_LandCoverMap)& theMap )
+{
+  SetReferenceObject( theMap, DataTag_LandCoverMap );
+}
+
 Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(HYDROData_Zone)& theZone )
 {
   Changed( Geom_No );
@@ -835,8 +848,15 @@ NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
 
 double HYDROData_CalculationCase::GetStricklerCoefficientForPoint( const gp_XY& thePoint ) const
 {
-  //TODO: #652
-  return 0.0;
+  Handle( HYDROData_LandCoverMap ) aMap = GetLandCoverMap();
+  Handle( HYDROData_StricklerTable ) aTable = GetStricklerTable();
+  if( aMap.IsNull() )
+    return 0.0;
+
+  QString aType;
+  aMap->FindByPoint( thePoint, aType );
+  double aCoeff = aTable->Get( aType, 0.0 );
+  return aCoeff;
 }
 
 Handle(HYDROData_Region) HYDROData_CalculationCase::GetRegionFromPoint( const gp_XY& thePoint ) const
@@ -1300,5 +1320,3 @@ bool HYDROData_CalculationCase::GetRule( int theIndex,
   return HYDROData_PriorityQueue::GetRule( aRulesLab, theIndex,
     theObject1, thePriority, theObject2, theMergeType );
 }
-
-  Changed( Geom_No );
\ No newline at end of file