diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2018-11-08 11:24:15 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2018-11-14 16:57:10 +0300 |
commit | 198ebaaf4c7701436df77cf464fcaedcbb3266fa (patch) | |
tree | 8599983252cf3264f5b932e662cf975bc0dee9e3 | |
parent | b739e306b85e285c7474573f1f4a4232d4239ff7 (diff) |
[search][map] Use custom icons for cafe/bar/restaurant/.. in search.
17 files changed, 161 insertions, 15 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 diff --git a/iphone/Maps/Images.xcassets/Spotlight/ic_children_spotlight.imageset/Contents.json b/iphone/Maps/Images.xcassets/Spotlight/ic_children_spotlight.imageset/Contents.json new file mode 100644 index 0000000000..da9b31bea9 --- /dev/null +++ b/iphone/Maps/Images.xcassets/Spotlight/ic_children_spotlight.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ic_children_spotlight.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_children_spotlight@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ic_children_spotlight@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/iphone/Maps/Images.xcassets/Spotlight/ic_children_spotlight.imageset/ic_children_spotlight.png b/iphone/Maps/Images.xcassets/Spotlight/ic_children_spotlight.imageset/ic_children_spotlight.png Binary files differnew file mode 100644 index 0000000000..0fc08caca7 --- /dev/null +++ b/iphone/Maps/Images.xcassets/Spotlight/ic_children_spotlight.imageset/ic_children_spotlight.png diff --git a/iphone/Maps/Images.xcassets/Spotlight/ic_children_spotlight.imageset/ic_children_spotlight@2x.png b/iphone/Maps/Images.xcassets/Spotlight/ic_children_spotlight.imageset/ic_children_spotlight@2x.png Binary files differnew file mode 100644 index 0000000000..08ed61d28e --- /dev/null +++ b/iphone/Maps/Images.xcassets/Spotlight/ic_children_spotlight.imageset/ic_children_spotlight@2x.png diff --git a/iphone/Maps/Images.xcassets/Spotlight/ic_children_spotlight.imageset/ic_children_spotlight@3x.png b/iphone/Maps/Images.xcassets/Spotlight/ic_children_spotlight.imageset/ic_children_spotlight@3x.png Binary files differnew file mode 100644 index 0000000000..c82b63db07 --- /dev/null +++ b/iphone/Maps/Images.xcassets/Spotlight/ic_children_spotlight.imageset/ic_children_spotlight@3x.png diff --git a/iphone/Maps/Images.xcassets/Spotlight/ic_nightlife_spotlight.imageset/Contents.json b/iphone/Maps/Images.xcassets/Spotlight/ic_nightlife_spotlight.imageset/Contents.json new file mode 100644 index 0000000000..802c0d5826 --- /dev/null +++ b/iphone/Maps/Images.xcassets/Spotlight/ic_nightlife_spotlight.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ic_nightlife_spotlight.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_nightlife_spotlight@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ic_nightlife_spotlight@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/iphone/Maps/Images.xcassets/Spotlight/ic_nightlife_spotlight.imageset/ic_nightlife_spotlight.png b/iphone/Maps/Images.xcassets/Spotlight/ic_nightlife_spotlight.imageset/ic_nightlife_spotlight.png Binary files differnew file mode 100644 index 0000000000..81c155f55a --- /dev/null +++ b/iphone/Maps/Images.xcassets/Spotlight/ic_nightlife_spotlight.imageset/ic_nightlife_spotlight.png diff --git a/iphone/Maps/Images.xcassets/Spotlight/ic_nightlife_spotlight.imageset/ic_nightlife_spotlight@2x.png b/iphone/Maps/Images.xcassets/Spotlight/ic_nightlife_spotlight.imageset/ic_nightlife_spotlight@2x.png Binary files differnew file mode 100644 index 0000000000..fb5a3a189c --- /dev/null +++ b/iphone/Maps/Images.xcassets/Spotlight/ic_nightlife_spotlight.imageset/ic_nightlife_spotlight@2x.png diff --git a/iphone/Maps/Images.xcassets/Spotlight/ic_nightlife_spotlight.imageset/ic_nightlife_spotlight@3x.png b/iphone/Maps/Images.xcassets/Spotlight/ic_nightlife_spotlight.imageset/ic_nightlife_spotlight@3x.png Binary files differnew file mode 100644 index 0000000000..0552d721b9 --- /dev/null +++ b/iphone/Maps/Images.xcassets/Spotlight/ic_nightlife_spotlight.imageset/ic_nightlife_spotlight@3x.png diff --git a/iphone/Maps/Images.xcassets/Spotlight/ic_shopping_spotlight.imageset/Contents.json b/iphone/Maps/Images.xcassets/Spotlight/ic_shopping_spotlight.imageset/Contents.json new file mode 100644 index 0000000000..3fd7d260eb --- /dev/null +++ b/iphone/Maps/Images.xcassets/Spotlight/ic_shopping_spotlight.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ic_shopping_spotlight.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_shopping_spotlight@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ic_shopping_spotlight@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/iphone/Maps/Images.xcassets/Spotlight/ic_shopping_spotlight.imageset/ic_shopping_spotlight.png b/iphone/Maps/Images.xcassets/Spotlight/ic_shopping_spotlight.imageset/ic_shopping_spotlight.png Binary files differnew file mode 100644 index 0000000000..8e7a08d9ac --- /dev/null +++ b/iphone/Maps/Images.xcassets/Spotlight/ic_shopping_spotlight.imageset/ic_shopping_spotlight.png diff --git a/iphone/Maps/Images.xcassets/Spotlight/ic_shopping_spotlight.imageset/ic_shopping_spotlight@2x.png b/iphone/Maps/Images.xcassets/Spotlight/ic_shopping_spotlight.imageset/ic_shopping_spotlight@2x.png Binary files differnew file mode 100644 index 0000000000..42e5e283aa --- /dev/null +++ b/iphone/Maps/Images.xcassets/Spotlight/ic_shopping_spotlight.imageset/ic_shopping_spotlight@2x.png diff --git a/iphone/Maps/Images.xcassets/Spotlight/ic_shopping_spotlight.imageset/ic_shopping_spotlight@3x.png b/iphone/Maps/Images.xcassets/Spotlight/ic_shopping_spotlight.imageset/ic_shopping_spotlight@3x.png Binary files differnew file mode 100644 index 0000000000..38b8be8ff9 --- /dev/null +++ b/iphone/Maps/Images.xcassets/Spotlight/ic_shopping_spotlight.imageset/ic_shopping_spotlight@3x.png diff --git a/map/framework.cpp b/map/framework.cpp index c9d5c9245d..184a8a4b25 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1670,11 +1670,40 @@ void Framework::FillSearchResultsMarks(search::Results::ConstIter begin, else if (isFeature) { auto product = GetProductInfo(r); + auto const type = r.GetFeatureType(); if (product.m_ugcRating != search::ProductInfo::kInvalidRating) { mark->SetMarkType(SearchMarkType::UGC); mark->SetRating(product.m_ugcRating); } + else + { + auto const cafeType = ftypes::IsEatChecker::Instance().GetType(type); + switch (cafeType) + { + case ftypes::IsEatChecker::Type::Cafe: + mark->SetMarkType(SearchMarkType::Cafe); + break; + case ftypes::IsEatChecker::Type::Bakery: + mark->SetMarkType(SearchMarkType::Bakery); + break; + case ftypes::IsEatChecker::Type::FastFood: + mark->SetMarkType(SearchMarkType::FastFood); + break; + case ftypes::IsEatChecker::Type::Restaurant: + mark->SetMarkType(SearchMarkType::Restaurant); + break; + case ftypes::IsEatChecker::Type::Bar: + mark->SetMarkType(SearchMarkType::Bar); + break; + case ftypes::IsEatChecker::Type::Pub: + case ftypes::IsEatChecker::Type::Biergarten: + mark->SetMarkType(SearchMarkType::Pub); + break; + case ftypes::IsEatChecker::Type::Count: + break; + } + } } if (isFeature && m_localAdsManager.Contains(r.GetFeatureID())) diff --git a/map/search_mark.cpp b/map/search_mark.cpp index 920b521bca..5b7eb0fffb 100644 --- a/map/search_mark.cpp +++ b/map/search_mark.cpp @@ -18,7 +18,12 @@ std::vector<std::string> const kSymbols = "search-adv", // Local Ads. "searchbookingadv-default-l", // Local Ads + Booking. "coloredmark-default-l", // UGC. - "search-football", // FC 2018. + "search-result-cafe", // Cafe. + "search-result-bakery", // Bakery. + "search-result-bar", // Bar. + "search-result-pub", // Pub. + "search-result-restaurant", // Restaurant. + "search-result-fastfood", // FastFood. "non-found-search-result", // NotFound. }; @@ -30,7 +35,12 @@ std::vector<std::string> const kPreparingSymbols = "search-adv", // Local Ads. "searchbookingadv-default-l", // Local Ads + Booking. "coloredmark-inactive", // UGC. - "search-football", // FC 2018. + "search-result-cafe", // Cafe. + "search-result-bakery", // Bakery. + "search-result-bar", // Bar. + "search-result-pub", // Pub. + "search-result-restaurant", // Restaurant. + "search-result-fastfood", // FastFood. "non-found-search-result", // NotFound. }; diff --git a/map/search_mark.hpp b/map/search_mark.hpp index bb6e0f9dce..06b2ad0a0f 100644 --- a/map/search_mark.hpp +++ b/map/search_mark.hpp @@ -23,6 +23,12 @@ enum class SearchMarkType LocalAds, LocalAdsBooking, UGC, + Cafe, + Bakery, + Bar, + Pub, + Restaurant, + FastFood, NotFound, // Service value used in developer tools. Count }; |