X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_LandCoverMap.cxx;h=4b816d8db04ae6591be44cf590584287e59350b3;hb=39b1848f103d89cfb544a1651b3fbf221fc2c401;hp=7afb3132cdb25b1224543faf1a4c08cd5adc8872;hpb=591a7ad01db542058bd2cb75be3617bb9c3dfa29;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_LandCoverMap.cxx b/src/HYDROData/HYDROData_LandCoverMap.cxx index 7afb3132..4b816d8d 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.cxx +++ b/src/HYDROData/HYDROData_LandCoverMap.cxx @@ -1259,8 +1259,37 @@ void HYDROData_LandCoverMap::UpdateLocalCS( double theDx, double theDy ) SetShape( aLocatedShape ); } -void HYDROData_LandCoverMap::ClassifyPoints( const std::vector& thePoints, std::vector >& theTypes ) const +void HYDROData_LandCoverMap::ClassifyPoints( const std::vector& thePoints, std::vector >& theTypes ) const { HYDROData_LCM_FaceClassifier FC(this); FC.Classify(thePoints, theTypes, NULL); } + +void HYDROData_LandCoverMap::ClassifyPoints( const std::vector& thePoints, + Handle(HYDROData_StricklerTable) theTable, + std::vector& theCoeffs, double DefValue, bool UseMax ) const +{ + std::vector > 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& SStr = Types[i]; + if (SStr.empty()) + theCoeffs[i] = DefValue; + else + { + std::set::const_iterator it; + std::vector 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(std::begin(C1), std::end(C1))); + else + Val = *(std::min_element(std::begin(C1), std::end(C1))); + theCoeffs[i] = Val; + } + } +}