blob: d6fffa6555661a0771c172a4e363a4c0e3c3f603 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include "map/promo_delegate.hpp"
#include "search/city_finder.hpp"
#include "indexer/data_source.hpp"
#include "indexer/ftypes_sponsored.hpp"
PromoDelegate::PromoDelegate(DataSource const & dataSource, search::CityFinder & cityFinder)
: m_dataSource(dataSource), m_cityFinder(cityFinder)
{
}
std::string PromoDelegate::GetCityId(m2::PointD const & point)
{
auto const featureId = m_cityFinder.GetCityFeatureID(point);
if (!featureId.IsValid())
return {};
FeaturesLoaderGuard guard(m_dataSource, featureId.m_mwmId);
auto feature = guard.GetOriginalFeatureByIndex(featureId.m_index);
if (!feature)
return {};
if (ftypes::IsPromoCatalogChecker::Instance()(*feature))
return feature->GetMetadata().Get(feature::Metadata::FMD_SPONSORED_ID);
return {};
}
|