diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2016-12-08 19:06:48 +0300 |
---|---|---|
committer | Arsentiy Milchakov <milcars@mapswithme.com> | 2016-12-08 19:06:48 +0300 |
commit | 6cc828ca8f7030f84b47e73ab190899372b25582 (patch) | |
tree | 155aa3d7bd1336d88dc23b5b9f3030012d860e6f /indexer/ftypes_matcher.cpp | |
parent | 4dd483374d43059e60ea7c24f4abb0e391215e47 (diff) |
[core] uber into place page
Diffstat (limited to 'indexer/ftypes_matcher.cpp')
-rw-r--r-- | indexer/ftypes_matcher.cpp | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/indexer/ftypes_matcher.cpp b/indexer/ftypes_matcher.cpp index 59bac21c1c..d8bd57b50b 100644 --- a/indexer/ftypes_matcher.cpp +++ b/indexer/ftypes_matcher.cpp @@ -321,24 +321,6 @@ IsBuildingChecker const & IsBuildingChecker::Instance() return inst; } -IsLocalityChecker::IsLocalityChecker() -{ - Classificator const & c = classif(); - - // Note! The order should be equal with constants in Type enum (add other villages to the end). - char const * arr[][2] = { - { "place", "country" }, - { "place", "state" }, - { "place", "city" }, - { "place", "town" }, - { "place", "village" }, - { "place", "hamlet" } - }; - - for (size_t i = 0; i < ARRAY_SIZE(arr); ++i) - m_types.push_back(c.GetTypeByPath(vector<string>(arr[i], arr[i] + 2))); -} - IsBuildingPartChecker::IsBuildingPartChecker() : BaseChecker(1 /* level */) { m_types.push_back(classif().GetTypeByPath({"building:part"})); @@ -374,45 +356,6 @@ bool IsTunnelChecker::IsMatched(uint32_t type) const return IsTypeConformed(type, {"highway", "*", "tunnel"}); } -Type IsLocalityChecker::GetType(uint32_t t) const -{ - ftype::TruncValue(t, 2); - - size_t j = COUNTRY; - for (; j < LOCALITY_COUNT; ++j) - if (t == m_types[j]) - return static_cast<Type>(j); - - for (; j < m_types.size(); ++j) - if (t == m_types[j]) - return VILLAGE; - - return NONE; -} - -Type IsLocalityChecker::GetType(feature::TypesHolder const & types) const -{ - for (uint32_t t : types) - { - Type const type = GetType(t); - if (type != NONE) - return type; - } - return NONE; -} - -Type IsLocalityChecker::GetType(FeatureType const & f) const -{ - feature::TypesHolder types(f); - return GetType(types); -} - -IsLocalityChecker const & IsLocalityChecker::Instance() -{ - static IsLocalityChecker const inst; - return inst; -} - IsBookingChecker::IsBookingChecker() { Classificator const & c = classif(); @@ -488,6 +431,63 @@ IsOpentableChecker const & IsOpentableChecker::Instance() return inst; } +IsLocalityChecker::IsLocalityChecker() +{ + Classificator const & c = classif(); + + // Note! The order should be equal with constants in Type enum (add other villages to the end). + char const * arr[][2] = { + { "place", "country" }, + { "place", "state" }, + { "place", "city" }, + { "place", "town" }, + { "place", "village" }, + { "place", "hamlet" } + }; + + for (size_t i = 0; i < ARRAY_SIZE(arr); ++i) + m_types.push_back(c.GetTypeByPath(vector<string>(arr[i], arr[i] + 2))); +} + +Type IsLocalityChecker::GetType(uint32_t t) const +{ + ftype::TruncValue(t, 2); + + size_t j = COUNTRY; + for (; j < LOCALITY_COUNT; ++j) + if (t == m_types[j]) + return static_cast<Type>(j); + + for (; j < m_types.size(); ++j) + if (t == m_types[j]) + return VILLAGE; + + return NONE; +} + +Type IsLocalityChecker::GetType(feature::TypesHolder const & types) const +{ + for (uint32_t t : types) + { + Type const type = GetType(t); + if (type != NONE) + return type; + } + return NONE; +} + +Type IsLocalityChecker::GetType(FeatureType const & f) const +{ + feature::TypesHolder types(f); + return GetType(types); +} + +IsLocalityChecker const & IsLocalityChecker::Instance() +{ + static IsLocalityChecker const inst; + return inst; +} + uint32_t GetPopulation(FeatureType const & ft) { uint32_t population = ft.GetPopulation(); |