IsBuilding flag in the AddressInfo, so UI code can use it for different logic.

This commit is contained in:
Alex Zolotarev 2015-04-09 14:11:16 +03:00
parent dcad9ef26b
commit b73442dde3
2 changed files with 12 additions and 3 deletions

View file

@ -183,7 +183,7 @@ namespace
public:
class TypeChecker
{
vector<uint32_t> m_localities, m_streets;
vector<uint32_t> m_localities, m_streets, m_buildings;
int m_localityScale;
template <size_t count, size_t ind>
@ -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.

View file

@ -147,6 +147,8 @@ struct AddressInfo
{
string m_country, m_city, m_street, m_house, m_name;
vector<string> 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();
};