| 17 | {} |
| 18 | |
| 19 | void FinalProcessorCities::Process() |
| 20 | { |
| 21 | using namespace feature; |
| 22 | |
| 23 | LOG(LINFO, ("Processing cities...")); |
| 24 | |
| 25 | std::mutex mutex; |
| 26 | auto const & localityChecker = ftypes::IsLocalityChecker::Instance(); |
| 27 | |
| 28 | PlaceProcessor processor(m_boundariesCollectorFile); |
| 29 | ForEachMwmTmp(m_temporaryMwmPath, [&](auto const & country, auto const & path) |
| 30 | { |
| 31 | if (!m_affiliation->HasCountryByName(country)) |
| 32 | return; |
| 33 | |
| 34 | std::vector<FeatureBuilder> cities; |
| 35 | FeatureBuilderWriter writer(path, true /* mangleName */); |
| 36 | ForEachFeatureRawFormat(path, [&](FeatureBuilder && fb, uint64_t) |
| 37 | { |
| 38 | if (localityChecker.GetType(fb.GetTypes()) < ftypes::LocalityType::City) |
| 39 | writer.Write(fb); |
| 40 | else |
| 41 | cities.emplace_back(std::move(fb)); |
| 42 | }); |
| 43 | |
| 44 | std::lock_guard<std::mutex> lock(mutex); |
| 45 | for (auto & city : cities) |
| 46 | processor.Add(std::move(city)); |
| 47 | }, m_threadsCount); |
| 48 | |
| 49 | auto const & result = processor.ProcessPlaces(); |
| 50 | AppendToMwmTmp(result, *m_affiliation, m_temporaryMwmPath, m_threadsCount); |
| 51 | |
| 52 | { |
| 53 | FeatureBuilderWriter writer(base::JoinPath(m_temporaryMwmPath, WORLD_FILE_NAME DATA_FILE_EXTENSION_TMP), |
| 54 | FileWriter::Op::OP_APPEND); |
| 55 | for (auto const & fb : result) |
| 56 | if (FilterWorld::IsGoodScale(fb)) |
| 57 | writer.Write(fb); |
| 58 | } |
| 59 | |
| 60 | if (!m_boundariesOutFile.empty()) |
| 61 | { |
| 62 | LOG(LINFO, ("Dumping cities boundaries to", m_boundariesOutFile)); |
| 63 | SerializeBoundariesTable(m_boundariesOutFile, processor.GetTable()); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | } // namespace generator |
nothing calls this directly
no test coverage detected