forked from organicmaps/organicmaps
Added special search marks for local ads and tinkoff objects
This commit is contained in:
parent
36c2e85ebb
commit
fab109012e
6 changed files with 37 additions and 5 deletions
|
@ -362,6 +362,18 @@ IsBookingChecker const & IsBookingChecker::Instance()
|
|||
return inst;
|
||||
}
|
||||
|
||||
IsTinkoffChecker::IsTinkoffChecker()
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
m_types.push_back(c.GetTypeByPath({"sponsored", "tinkoff"}));
|
||||
}
|
||||
|
||||
IsTinkoffChecker const & IsTinkoffChecker::Instance()
|
||||
{
|
||||
static IsTinkoffChecker const inst;
|
||||
return inst;
|
||||
}
|
||||
|
||||
IsHotelChecker::IsHotelChecker()
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
|
|
|
@ -152,6 +152,13 @@ public:
|
|||
static IsBookingChecker const & Instance();
|
||||
};
|
||||
|
||||
class IsTinkoffChecker : public BaseChecker
|
||||
{
|
||||
IsTinkoffChecker();
|
||||
public:
|
||||
static IsTinkoffChecker const & Instance();
|
||||
};
|
||||
|
||||
class IsHotelChecker : public BaseChecker
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -146,7 +146,9 @@ size_t constexpr kMaxTrafficCacheSizeBytes = 64 /* Mb */ * 1024 * 1024;
|
|||
vector<string> kSearchMarks =
|
||||
{
|
||||
"search-result",
|
||||
"search-booking"
|
||||
"search-booking",
|
||||
"search-tinkoff",
|
||||
"search-adv",
|
||||
};
|
||||
|
||||
// TODO!
|
||||
|
@ -1550,10 +1552,12 @@ bool Framework::Search(search::SearchParams const & params)
|
|||
CancelQuery(intent.m_handle);
|
||||
|
||||
{
|
||||
m2::PointD const defaultMarkSize = GetSearchMarkSize(SearchMarkType::DefaultSearchMark);
|
||||
m2::PointD const bookingMarkSize = GetSearchMarkSize(SearchMarkType::BookingSearchMark);
|
||||
double const eps =
|
||||
max(max(defaultMarkSize.x, defaultMarkSize.y), max(bookingMarkSize.x, bookingMarkSize.y));
|
||||
double eps = 0.0;
|
||||
for (size_t i = 0; i < SearchMarkType::SearchMarkTypesCount; i++)
|
||||
{
|
||||
m2::PointD const markSize = GetSearchMarkSize(static_cast<SearchMarkType>(i));
|
||||
eps = max(eps, max(markSize.x, markSize.y));
|
||||
}
|
||||
intent.m_params.m_minDistanceOnMapBetweenResults = eps;
|
||||
}
|
||||
|
||||
|
@ -1747,6 +1751,10 @@ void Framework::FillSearchResultsMarks(search::Results::ConstIter begin,
|
|||
|
||||
if (r.m_metadata.m_isSponsoredHotel)
|
||||
mark->SetCustomSymbol("search-booking");
|
||||
else if (r.m_metadata.m_isSponsoredBank)
|
||||
mark->SetCustomSymbol("search-tinkoff");
|
||||
else if (m_localAdsManager.Contains(r.GetFeatureID()))
|
||||
mark->SetCustomSymbol("search-adv");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ enum SearchMarkType
|
|||
{
|
||||
DefaultSearchMark = 0,
|
||||
BookingSearchMark,
|
||||
TinkoffSearchMark,
|
||||
LocalAdsSearchMark,
|
||||
|
||||
SearchMarkTypesCount
|
||||
};
|
||||
|
|
|
@ -51,6 +51,8 @@ void ProcessMetadata(FeatureType const & ft, Result::Metadata & meta)
|
|||
else
|
||||
meta.m_stars = 0;
|
||||
|
||||
meta.m_isSponsoredBank = ftypes::IsTinkoffChecker::Instance()(ft);
|
||||
|
||||
bool const isSponsoredHotel = ftypes::IsBookingChecker::Instance()(ft);
|
||||
meta.m_isSponsoredHotel = isSponsoredHotel;
|
||||
meta.m_isHotel = ftypes::IsHotelChecker::Instance()(ft);
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
string m_hotelRating;
|
||||
int m_stars = 0;
|
||||
bool m_isSponsoredHotel = false;
|
||||
bool m_isSponsoredBank = false;
|
||||
bool m_isHotel = false;
|
||||
|
||||
osm::YesNoUnknown m_isOpenNow = osm::Unknown; // Valid for any result.
|
||||
|
|
Loading…
Add table
Reference in a new issue