mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-21 13:53:37 +00:00
[traffic] Initialize TrafficManager with CountryParentNameGetterFn
Signed-off-by: mvglasow <michael -at- vonglasow.com> # Conflicts: # map/framework.cpp # map/traffic_manager.cpp # map/traffic_manager.hpp
This commit is contained in:
@@ -295,7 +295,8 @@ Framework::Framework(FrameworkParams const & params, bool loadMaps)
|
||||
[this]() -> StringsBundle const & { return m_stringsBundle; },
|
||||
[this]() -> power_management::PowerManager const & { return m_powerManager; }),
|
||||
static_cast<RoutingManager::Delegate &>(*this))
|
||||
, m_trafficManager(bind(&Framework::GetMwmsByRect, this, _1, false /* rough */),
|
||||
, m_trafficManager([this](string const & id) -> string { return m_storage.GetParentIdFor(id); },
|
||||
bind(&Framework::GetMwmsByRect, this, _1, false /* rough */),
|
||||
kMaxTrafficCacheSizeBytes, m_routingManager.RoutingSession())
|
||||
, m_lastReportedCountry(kInvalidCountryId)
|
||||
, m_popularityLoader(m_featuresFetcher.GetDataSource(), POPULARITY_RANKS_FILE_TAG)
|
||||
|
||||
@@ -41,9 +41,11 @@ TrafficManager::CacheEntry::CacheEntry(time_point<steady_clock> const & requestT
|
||||
, m_lastAvailability(traffic::TrafficInfo::Availability::Unknown)
|
||||
{}
|
||||
|
||||
TrafficManager::TrafficManager(GetMwmsByRectFn const & getMwmsByRectFn, size_t maxCacheSizeBytes,
|
||||
TrafficManager::TrafficManager(const CountryParentNameGetterFn &countryParentNameGetter,
|
||||
GetMwmsByRectFn const & getMwmsByRectFn, size_t maxCacheSizeBytes,
|
||||
traffic::TrafficObserver & observer)
|
||||
: m_getMwmsByRectFn(getMwmsByRectFn)
|
||||
: m_countryParentNameGetterFn(countryParentNameGetter)
|
||||
, m_getMwmsByRectFn(getMwmsByRectFn)
|
||||
, m_observer(observer)
|
||||
, m_currentDataVersion(0)
|
||||
, m_state(TrafficState::Disabled)
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "indexer/mwm_set.hpp"
|
||||
|
||||
#include "openlr/openlr_decoder.hpp"
|
||||
|
||||
#include "geometry/point2d.hpp"
|
||||
#include "geometry/polyline2d.hpp"
|
||||
#include "geometry/screenbase.hpp"
|
||||
@@ -31,6 +33,8 @@
|
||||
class TrafficManager final
|
||||
{
|
||||
public:
|
||||
using CountryParentNameGetterFn = std::function<std::string(std::string const &)>;
|
||||
|
||||
enum class TrafficState
|
||||
{
|
||||
Disabled,
|
||||
@@ -58,7 +62,8 @@ public:
|
||||
using TrafficStateChangedFn = std::function<void(TrafficState)>;
|
||||
using GetMwmsByRectFn = std::function<std::vector<MwmSet::MwmId>(m2::RectD const &)>;
|
||||
|
||||
TrafficManager(GetMwmsByRectFn const & getMwmsByRectFn, size_t maxCacheSizeBytes,
|
||||
TrafficManager(CountryParentNameGetterFn const & countryParentNameGetter,
|
||||
GetMwmsByRectFn const & getMwmsByRectFn, size_t maxCacheSizeBytes,
|
||||
traffic::TrafficObserver & observer);
|
||||
~TrafficManager();
|
||||
|
||||
@@ -165,6 +170,7 @@ private:
|
||||
std::for_each(activeMwms.begin(), activeMwms.end(), std::forward<F>(f));
|
||||
}
|
||||
|
||||
CountryParentNameGetterFn m_countryParentNameGetterFn;
|
||||
GetMwmsByRectFn m_getMwmsByRectFn;
|
||||
traffic::TrafficObserver & m_observer;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user