diff options
author | Alex Zolotarev <alex@maps.me> | 2016-01-02 13:31:58 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:04:15 +0300 |
commit | 3112311064f5f7e5f25545ca657991e44474d535 (patch) | |
tree | c911f663137fadad0c3da94dad4b811250bb4c6f /map/address_finder.cpp | |
parent | ed6ee4c3e6d1ed767a61067252efa0d1c3757f34 (diff) |
Framework POI getters refactoring.
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 |