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

Method InitBaseContext

libs/search/geocoder.cpp:643–668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641}
642
643void Geocoder::InitBaseContext(BaseContext & ctx)
644{
645 Retrieval retrieval(*m_context, m_cancellable);
646
647 size_t const numTokens = m_params.GetNumTokens();
648 ctx.m_tokens.assign(numTokens, BaseContext::TOKEN_TYPE_COUNT);
649 ctx.m_features.resize(numTokens);
650 for (size_t i = 0; i < numTokens; ++i)
651 {
652 if (m_params.IsCategorialRequest())
653 {
654 // Implementation-wise, the simplest way to match a feature by
655 // its category bypassing the matching by name is by using a CategoriesCache.
656 CategoriesCache cache(m_params.m_preferredTypes, m_cancellable);
657 ctx.m_features[i] = Retrieval::ExtendedFeatures(cache.Get(*m_context));
658 }
659 else if (m_params.IsPrefixToken(i))
660 {
661 ctx.m_features[i] = retrieval.RetrieveAddressFeatures(m_prefixTokenRequest);
662 }
663 else
664 {
665 ctx.m_features[i] = retrieval.RetrieveAddressFeatures(m_tokenRequests[i]);
666 }
667 }
668}
669
670void Geocoder::InitLayer(Model::Type type, TokenRange const & tokenRange, FeaturesLayer & layer)
671{

Callers

nothing calls this directly

Calls 8

ExtendedFeaturesClass · 0.85
IsCategorialRequestMethod · 0.80
IsPrefixTokenMethod · 0.80
GetNumTokensMethod · 0.45
assignMethod · 0.45
resizeMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected