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

Method GetLocalizedRegionAddress

libs/search/reverse_geocoder.cpp:302–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302string ReverseGeocoder::GetLocalizedRegionAddress(RegionAddress const & addr, RegionInfoGetter const & nameGetter) const
303{
304 if (!addr.IsValid())
305 return {};
306
307 string addrStr;
308 if (addr.m_featureId.IsValid())
309 {
310 m_dataSource.ReadFeature([&addrStr](FeatureType & ft) { addrStr = ft.GetTranslatedName().m_primary.value(); }, addr.m_featureId);
311
312 auto const countryName = addr.GetCountryName();
313 if (!countryName.empty())
314 {
315 RegionInfoGetter::NameBufferT nameParts;
316 nameGetter.GetLocalizedFullName(countryName, nameParts);
317 nameParts.insert(nameParts.begin(), std::move(addrStr));
318 nameParts.erase(unique(nameParts.begin(), nameParts.end()), nameParts.end());
319 addrStr = strings::JoinStrings(nameParts, ", ");
320 }
321 }
322 else
323 {
324 ASSERT(storage::IsCountryIdValid(addr.m_countryId), ());
325 addrStr = nameGetter.GetLocalizedFullName(addr.m_countryId);
326 }
327
328 return addrStr;
329}
330
331// static
332ReverseGeocoder::Building ReverseGeocoder::FromFeature(FeatureType & ft, double distMeters)

Callers

nothing calls this directly

Calls 15

uniqueFunction · 0.85
JoinStringsFunction · 0.85
ASSERTFunction · 0.85
IsCountryIdValidFunction · 0.85
ReadFeatureMethod · 0.80
GetTranslatedNameMethod · 0.80
IsValidMethod · 0.45
valueMethod · 0.45
GetCountryNameMethod · 0.45
emptyMethod · 0.45
GetLocalizedFullNameMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected