Salome HOME
porting on linux
[modules/hydro.git] / src / HYDROData / HYDROData_LandCoverMap.cxx
index 7afb3132cdb25b1224543faf1a4c08cd5adc8872..c582b16fcc4143a2842f97b97fa89f57f3de270b 100644 (file)
@@ -1259,8 +1259,37 @@ void HYDROData_LandCoverMap::UpdateLocalCS( double theDx, double theDy )
   SetShape( aLocatedShape );
 }
 
-void HYDROData_LandCoverMap::ClassifyPoints( const std::vector<gp_Pnt2d>& thePoints, std::vector<std::set <QString> >& theTypes ) const
+void HYDROData_LandCoverMap::ClassifyPoints( const std::vector<gp_XY>& thePoints, std::vector<std::set <QString> >& theTypes ) const
 {
   HYDROData_LCM_FaceClassifier FC(this);
   FC.Classify(thePoints, theTypes, NULL);
 }
+
+void HYDROData_LandCoverMap::ClassifyPoints( const std::vector<gp_XY>& thePoints,  
+  Handle(HYDROData_StricklerTable) theTable, 
+  std::vector<double>& theCoeffs, double DefValue, bool UseMax ) const
+{
+  std::vector<std::set <QString> > Types;
+  HYDROData_LCM_FaceClassifier FC(this);
+  FC.Classify(thePoints, Types, NULL);
+  theCoeffs.resize(thePoints.size());
+  for (size_t i = 0; i < Types.size(); i++)
+  {
+    const std::set<QString>& SStr = Types[i];
+    if (SStr.empty())
+      theCoeffs[i] = DefValue;
+    else
+    {
+      std::set<QString>::const_iterator it;
+      std::vector<double> C1(SStr.size());
+      for (it = SStr.begin(); it != SStr.end(); ++it)
+        C1.push_back(theTable->Get( *it, DefValue ));
+      double Val;
+      if (UseMax)
+        Val = *(std::max_element( C1.begin(), C1.end() ) );
+      else
+        Val = *(std::min_element( C1.begin(), C1.end() ) );
+      theCoeffs[i] = Val;
+    }
+  }
+}