| 627 | } |
| 628 | |
| 629 | void Generator::PackIsolinesForCountries() |
| 630 | { |
| 631 | if (!GetPlatform().IsFileExistsByFullPath(m_isolinesCountriesOutDir) && |
| 632 | !GetPlatform().MkDirRecursively(m_isolinesCountriesOutDir)) |
| 633 | { |
| 634 | LOG(LERROR, ("Can't create directory", m_isolinesCountriesOutDir)); |
| 635 | return; |
| 636 | } |
| 637 | |
| 638 | base::ComputationalThreadPool threadPool(m_threadsCount); |
| 639 | size_t taskInd = 0; |
| 640 | size_t tasksCount = m_countriesToGenerate.m_countryParams.size(); |
| 641 | for (auto const & countryParams : m_countriesToGenerate.m_countryParams) |
| 642 | { |
| 643 | auto const & countryId = countryParams.first; |
| 644 | auto const & params = countryParams.second; |
| 645 | |
| 646 | threadPool.SubmitWork([this, countryId, taskInd, tasksCount, params]() |
| 647 | { |
| 648 | LOG(LINFO, ("Begin task", taskInd, "/", tasksCount, countryId)); |
| 649 | |
| 650 | auto const & packingParams = m_profileToPackingParams.at(params.m_profileName); |
| 651 | PackIsolinesForCountry(countryId, packingParams, |
| 652 | [¶ms](int lat, int lon) { return params.NeedSkipTile(lat, lon); }); |
| 653 | |
| 654 | LOG(LINFO, ("End task", taskInd, "/", tasksCount, countryId)); |
| 655 | }); |
| 656 | ++taskInd; |
| 657 | } |
| 658 | } |
| 659 | |
| 660 | void Generator::InitCountryInfoGetter(std::string const & dataDir) |
| 661 | { |
no test coverage detected