From b73442dde313d045d9acfc38b1ff099a4557c37c Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Thu, 9 Apr 2015 14:11:16 +0300 Subject: [PATCH] IsBuilding flag in the AddressInfo, so UI code can use it for different logic. --- map/address_finder.cpp | 12 +++++++++--- search/result.hpp | 3 +++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/map/address_finder.cpp b/map/address_finder.cpp index 2848880c19..2971810548 100644 --- a/map/address_finder.cpp +++ b/map/address_finder.cpp @@ -183,7 +183,7 @@ namespace public: class TypeChecker { - vector m_localities, m_streets; + vector m_localities, m_streets, m_buildings; int m_localityScale; template @@ -233,6 +233,10 @@ namespace { "highway", "service" } }; + char const * arrBuilding[][1] = { + { "building" } + }; + FillMatch(arrLocalities, m_localities); m_localityScale = 0; for (size_t i = 0; i < m_localities.size(); ++i) @@ -242,6 +246,7 @@ namespace } FillMatch(arrStreet, m_streets); + FillMatch(arrBuilding, m_buildings); } int GetLocalitySearchScale() const { return m_localityScale; } @@ -254,12 +259,11 @@ namespace { return IsMatchImpl(m_streets, types); } - /* + bool IsBuilding(feature::TypesHolder const & types) const { return IsMatchImpl(m_buildings, types); } - */ double GetLocalityDivideFactor(feature::TypesHolder const & types) const { @@ -369,6 +373,8 @@ namespace if (info.m_house.empty()) info.m_house = m_cont[i].m_house; + info.m_isBuilding = info.m_isBuilding || m_checker.IsBuilding(m_cont[i].m_types); + if (info.m_name.empty()) { /// @todo Make logic better. diff --git a/search/result.hpp b/search/result.hpp index e5cf84a202..eaaa180aea 100644 --- a/search/result.hpp +++ b/search/result.hpp @@ -147,6 +147,8 @@ struct AddressInfo { string m_country, m_city, m_street, m_house, m_name; vector m_types; + // TODO(AlexZ): It is not initialized in MakeFrom() below because we don't need it in search at the moment. + bool m_isBuilding = false; void MakeFrom(search::Result const & res); @@ -159,6 +161,7 @@ struct AddressInfo string FormatNameAndAddress() const; // Caroline, 7 vulica Frunze, Belarus char const * GetBestType() const; bool IsEmptyName() const; + bool IsBuilding() const { return m_isBuilding; } void Clear(); };