| 931 | |
| 932 | template <class FnT> |
| 933 | void Processor::EmitResultsFromMwms(std::vector<std::shared_ptr<MwmInfo>> const & infos, FnT const & fn) |
| 934 | { |
| 935 | // Don't pay attention on possible overhead here, this function is used for debug purpose only. |
| 936 | std::vector<std::tuple<double, std::string, std::unique_ptr<FeatureType>>> results; |
| 937 | std::vector<std::unique_ptr<FeaturesLoaderGuard>> guards; |
| 938 | |
| 939 | for (auto const & info : infos) |
| 940 | { |
| 941 | auto guard = std::make_unique<FeaturesLoaderGuard>(m_dataSource, MwmSet::MwmId(info)); |
| 942 | |
| 943 | fn(*guard, [&](std::unique_ptr<FeatureType> ft) |
| 944 | { |
| 945 | // Distance needed for sorting. |
| 946 | auto const center = feature::GetCenter(*ft, FeatureType::WORST_GEOMETRY); |
| 947 | double const dist = center.SquaredLength(m_viewport.Center()); |
| 948 | results.emplace_back(dist, guard->GetCountryFileName(), std::move(ft)); |
| 949 | }); |
| 950 | |
| 951 | guards.push_back(std::move(guard)); |
| 952 | } |
| 953 | |
| 954 | std::sort(results.begin(), results.end()); |
| 955 | |
| 956 | for (auto const & [_, country, ft] : results) |
| 957 | { |
| 958 | m_emitter.AddResultNoChecks( |
| 959 | m_ranker.MakeResult(RankerResult(*ft, country), true /* needAddress */, true /* needHighlighting */)); |
| 960 | } |
| 961 | |
| 962 | m_emitter.Emit(); |
| 963 | } |
| 964 | } // namespace search |
nothing calls this directly
no test coverage detected