forked from organicmaps/organicmaps
[promo] integrate FeatureidToGeoObjectIdBimap into PromoDelegate
This commit is contained in:
parent
544911bcd1
commit
80a7e77f3d
2 changed files with 13 additions and 3 deletions
|
@ -5,9 +5,12 @@
|
|||
#include "indexer/data_source.hpp"
|
||||
#include "indexer/ftypes_sponsored.hpp"
|
||||
|
||||
#include "base/string_utils.hpp"
|
||||
|
||||
PromoDelegate::PromoDelegate(DataSource const & dataSource, search::CityFinder & cityFinder)
|
||||
: m_dataSource(dataSource), m_cityFinder(cityFinder)
|
||||
: m_dataSource(dataSource), m_cityFinder(cityFinder), m_cities(dataSource)
|
||||
{
|
||||
m_cities.Load();
|
||||
}
|
||||
|
||||
std::string PromoDelegate::GetCityId(m2::PointD const & point)
|
||||
|
@ -22,8 +25,12 @@ std::string PromoDelegate::GetCityId(m2::PointD const & point)
|
|||
if (!feature)
|
||||
return {};
|
||||
|
||||
if (ftypes::IsPromoCatalogChecker::Instance()(*feature))
|
||||
return feature->GetMetadata().Get(feature::Metadata::FMD_SPONSORED_ID);
|
||||
base::GeoObjectId id;
|
||||
if (ftypes::IsPromoCatalogChecker::Instance()(*feature) &&
|
||||
m_cities.GetGeoObjectId(feature->GetID(), id))
|
||||
{
|
||||
return strings::to_string(id);
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "partners_api/promo_api.hpp"
|
||||
|
||||
#include "indexer/feature_to_osm.hpp"
|
||||
|
||||
#include "geometry/point2d.hpp"
|
||||
|
||||
#include <string>
|
||||
|
@ -23,4 +25,5 @@ public:
|
|||
private:
|
||||
DataSource const & m_dataSource;
|
||||
search::CityFinder & m_cityFinder;
|
||||
indexer::FeatureIdToGeoObjectIdBimap m_cities;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue