Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortatiana-yan <tatiana.kondakova@gmail.com>2018-11-08 11:24:15 +0300
committermpimenov <mpimenov@users.noreply.github.com>2018-11-14 16:57:10 +0300
commit198ebaaf4c7701436df77cf464fcaedcbb3266fa (patch)
tree8599983252cf3264f5b932e662cf975bc0dee9e3 /indexer
parentb739e306b85e285c7474573f1f4a4232d4239ff7 (diff)
[search][map] Use custom icons for cafe/bar/restaurant/.. in search.
Diffstat (limited to 'indexer')
-rw-r--r--indexer/ftypes_matcher.cpp38
-rw-r--r--indexer/ftypes_matcher.hpp20
2 files changed, 45 insertions, 13 deletions
diff --git a/indexer/ftypes_matcher.cpp b/indexer/ftypes_matcher.cpp
index 4a82b7eb86..cc3206b5df 100644
--- a/indexer/ftypes_matcher.cpp
+++ b/indexer/ftypes_matcher.cpp
@@ -379,20 +379,34 @@ IsWifiChecker::IsWifiChecker()
m_types.push_back(classif().GetTypeByPath({"internet_access", "wlan"}));
}
-IsEatChecker:: IsEatChecker()
+IsEatChecker::IsEatChecker()
{
Classificator const & c = classif();
- char const * const paths[][2] = {
- {"amenity", "cafe"},
- {"amenity", "bar"},
- {"amenity", "biergarden"},
- {"amenity", "pub"},
- {"amenity", "fast_food"},
- {"amenity", "restaurant"},
- {"shop", "bakery"}
- };
- for (auto const & path : paths)
- m_types.push_back(c.GetTypeByPath({path[0], path[1]}));
+ map<Type, vector<string>> const descriptions = {{Type::Cafe, {"amenity", "cafe"}},
+ {Type::Bakery, {"shop", "bakery"}},
+ {Type::FastFood, {"amenity", "fast_food"}},
+ {Type::Restaurant, {"amenity", "restaurant"}},
+ {Type::Bar, {"amenity", "bar"}},
+ {Type::Pub, {"amenity", "pub"}},
+ {Type::Biergarten, {"amenity", "biergarten"}}};
+
+ for (auto const & desc : descriptions)
+ {
+ auto const type = c.GetTypeByPath(desc.second);
+ m_types.push_back(type);
+ m_sortedTypes[static_cast<size_t>(desc.first)] = {type, desc.first};
+ }
+}
+
+IsEatChecker::Type IsEatChecker::GetType(uint32_t t) const
+{
+ for (auto type : m_sortedTypes)
+ {
+ if (type.first == t)
+ return type.second;
+ }
+
+ return IsEatChecker::Type::Count;
}
IsCuisineChecker::IsCuisineChecker() : BaseChecker(1 /* level */)
diff --git a/indexer/ftypes_matcher.hpp b/indexer/ftypes_matcher.hpp
index 745abb9072..1f237eeaaa 100644
--- a/indexer/ftypes_matcher.hpp
+++ b/indexer/ftypes_matcher.hpp
@@ -216,11 +216,29 @@ public:
class IsEatChecker : public BaseChecker
{
- IsEatChecker();
public:
+ enum class Type
+ {
+ Cafe,
+ Bakery,
+ FastFood,
+ Restaurant,
+ Bar,
+ Pub,
+ Biergarten,
+
+ Count
+ };
+
DECLARE_CHECKER_INSTANCE(IsEatChecker);
std::vector<uint32_t> const & GetTypes() const { return m_types; }
+ Type GetType(uint32_t t) const;
+
+private:
+ IsEatChecker();
+
+ std::array<std::pair<uint32_t, Type>, base::Key(Type::Count)> m_sortedTypes;
};
class IsCuisineChecker : public BaseChecker