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

Function BuildPopularPlacesImpl

generator/popular_places_section_builder.cpp:65–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63{
64template <class RankGetterT>
65void BuildPopularPlacesImpl(std::string const & mwmFile, RankGetterT && getter)
66{
67 bool popularPlaceFound = false;
68
69 auto const & placeChecker = ftypes::IsPlaceChecker::Instance();
70 auto const & poiChecker = ftypes::IsPoiChecker::Instance();
71 auto const & streetChecker = ftypes::IsWayChecker::Instance();
72
73 std::vector<PopularityIndex> content;
74 feature::ForEachFeature(mwmFile, [&](FeatureType & ft, uint32_t featureId)
75 {
76 ASSERT_EQUAL(content.size(), featureId, ());
77 PopularityIndex rank = 0;
78
79 if (placeChecker(ft) || poiChecker(ft) || streetChecker(ft))
80 {
81 rank = getter(ft, featureId);
82 if (rank > 0)
83 popularPlaceFound = true;
84 }
85
86 content.emplace_back(rank);
87 });
88
89 if (popularPlaceFound)
90 {
91 FilesContainerW cont(mwmFile, FileWriter::OP_WRITE_EXISTING);
92 search::RankTableBuilder::Create(content, cont, POPULARITY_RANKS_FILE_TAG);
93 }
94}
95
96PopularityIndex CalcRank(std::string const & str)
97{

Calls 4

ForEachFeatureFunction · 0.85
CreateFunction · 0.85
sizeMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected