From 911148145667bc907380ba3482b0c2036708866c Mon Sep 17 00:00:00 2001 From: Sergey Yershov Date: Wed, 20 Apr 2016 13:04:58 +0300 Subject: [PATCH] [downloader] Add countryId in place page --- map/framework.cpp | 12 ++++++++++++ map/place_page_info.hpp | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/map/framework.cpp b/map/framework.cpp index c5a5cdeadb..d9d960d472 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -679,6 +679,18 @@ void Framework::FillFeatureInfo(FeatureID const & fid, place_page::Info & info) FeatureType ft; guard.GetFeatureByIndex(fid.m_index, ft); FillInfoFromFeatureType(ft, info); + + // Fill countryId for place page info + info.m_countryId = m_infoGetter->GetRegionCountryId(info.GetMercator()); + + uint32_t placeCountryType = classif().GetTypeByPath({"place", "country"}); + if (info.GetTypes().Has(placeCountryType)) + { + TCountriesVec countries; + Storage().GetTopmostNodesFor(info.m_countryId, countries); + if (countries.size() == 1) + info.m_countryId = countries.front(); + } } void Framework::FillPointInfo(m2::PointD const & mercator, string const & customTitle, place_page::Info & info) const diff --git a/map/place_page_info.hpp b/map/place_page_info.hpp index 19c2b6b7cc..313e7c3721 100644 --- a/map/place_page_info.hpp +++ b/map/place_page_info.hpp @@ -62,6 +62,10 @@ public: /// Formatted feature address. string m_address; + /// Which country this MapObject is in. + /// For a country point it will be set to topmost node for country. + storage::TCountryId m_countryId = storage::kInvalidCountryId; + bool m_isMyPosition = false; bool m_isEditable = false;