MCPcopy Create free account
hub / github.com/comaps/comaps / Process

Method Process

generator/final_processor_cities.cpp:19–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17{}
18
19void 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

Callers

nothing calls this directly

Calls 12

ForEachMwmTmpFunction · 0.85
ForEachFeatureRawFormatFunction · 0.85
AppendToMwmTmpFunction · 0.85
SerializeBoundariesTableFunction · 0.85
ProcessPlacesMethod · 0.80
HasCountryByNameMethod · 0.45
GetTypeMethod · 0.45
GetTypesMethod · 0.45
WriteMethod · 0.45
emplace_backMethod · 0.45
AddMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected