diff options
author | Vlad Mihaylenko <vxmihaylenko@gmail.com> | 2016-12-08 19:09:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-08 19:09:19 +0300 |
commit | 136f12af3adde05623008f71d07bb996fe5801a5 (patch) | |
tree | 8ecaa245997ffae2a56a349ab318cba6cdc33000 /indexer | |
parent | 3e5daed4c3b3696765132c2d0b9c2eec3544537d (diff) | |
parent | 6cc828ca8f7030f84b47e73ab190899372b25582 (diff) |
Merge pull request #4905 from milchakov/uber_place_page_core_dummy
[core] uber into place page
Diffstat (limited to 'indexer')
-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(); |