diff options
Diffstat (limited to 'map/address_finder.cpp')
-rw-r--r-- | map/address_finder.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/map/address_finder.cpp b/map/address_finder.cpp index 01e844ebd9..58d2d81794 100644 --- a/map/address_finder.cpp +++ b/map/address_finder.cpp @@ -474,19 +474,32 @@ void Framework::GetAddressInfoForGlobalPoint(m2::PointD const & pt, search::Addr //GetLocality(pt, info); } -void Framework::GetAddressInfo(FeatureType const & ft, m2::PointD const & pt, search::AddressInfo & info) const +search::AddressInfo Framework::GetPOIAddressInfo(FeatureType const & ft) const { - info.Clear(); + search::AddressInfo info; + + ASSERT_NOT_EQUAL(ft.GetFeatureType(), feature::GEOM_LINE, ()); + m2::PointD const center = feature::GetCenter(ft); + + info.m_country = GetCountryName(center); + if (info.m_country.empty()) + { + LOG(LINFO, ("Can't find region for point ", center)); + return info; + } double const inf = numeric_limits<double>::max(); double addressR[] = { inf, inf, inf }; // FeatureType::WORST_GEOMETRY - no need to check on visibility - DoGetAddressInfo getAddress(pt, FeatureType::WORST_GEOMETRY, GetChecker(), addressR); + DoGetAddressInfo getAddress(center, FeatureType::WORST_GEOMETRY, GetChecker(), addressR); getAddress(ft); getAddress.FillAddress(m_searchEngine.get(), info); - GetAddressInfoForGlobalPoint(pt, info); + /// @todo Temporarily commented - it's slow and not used in UI + //GetLocality(pt, info); + + return info; } void Framework::GetLocality(m2::PointD const & pt, search::AddressInfo & info) const |