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

Method FillLocalityCandidates

libs/search/geocoder.cpp:680–705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

678}
679
680void Geocoder::FillLocalityCandidates(BaseContext const & ctx, CBV const & filter, size_t const maxNumLocalities,
681 vector<Locality> & preLocalities)
682{
683 // todo(@m) "food moscow" should be a valid categorial request.
684 if (m_params.IsCategorialRequest())
685 {
686 preLocalities.clear();
687 return;
688 }
689
690 storage::CountryInfoGetter::RegionIdVec ids;
691 for (auto const & type : m_regions)
692 {
693 for (auto const & ranges : type)
694 for (auto const & regions : ranges.second)
695 ids.insert(ids.end(), regions.m_ids.begin(), regions.m_ids.end());
696 }
697 base::SortUnique(ids);
698
699 auto const belongsToMatchedRegion = [&](m2::PointD const & point)
700 { return m_infoGetter.BelongsToAnyRegion(point, ids); };
701
702 LocalityScorerDelegate delegate(*m_context, m_params, belongsToMatchedRegion, m_cancellable);
703 LocalityScorer scorer(m_params, m_params.m_pivot.Center(), delegate);
704 scorer.GetTopLocalities(m_context->GetId(), ctx, filter, maxNumLocalities, preLocalities);
705}
706
707void Geocoder::CacheWorldLocalities()
708{

Callers

nothing calls this directly

Calls 10

SortUniqueFunction · 0.85
IsCategorialRequestMethod · 0.80
BelongsToAnyRegionMethod · 0.80
clearMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
CenterMethod · 0.45
GetTopLocalitiesMethod · 0.45
GetIdMethod · 0.45

Tested by

no test coverage detected