mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 13:23:59 +00:00
[traffic] Initialize TrafficManager with a DataSource
Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
@@ -295,7 +295,8 @@ Framework::Framework(FrameworkParams const & params, bool loadMaps)
|
|||||||
[this]() -> StringsBundle const & { return m_stringsBundle; },
|
[this]() -> StringsBundle const & { return m_stringsBundle; },
|
||||||
[this]() -> power_management::PowerManager const & { return m_powerManager; }),
|
[this]() -> power_management::PowerManager const & { return m_powerManager; }),
|
||||||
static_cast<RoutingManager::Delegate &>(*this))
|
static_cast<RoutingManager::Delegate &>(*this))
|
||||||
, m_trafficManager([this](string const & id) -> string { return m_storage.GetParentIdFor(id); },
|
, m_trafficManager(m_featuresFetcher.GetDataSource(),
|
||||||
|
[this](string const & id) -> string { return m_storage.GetParentIdFor(id); },
|
||||||
bind(&Framework::GetMwmsByRect, this, _1, false /* rough */),
|
bind(&Framework::GetMwmsByRect, this, _1, false /* rough */),
|
||||||
kMaxTrafficCacheSizeBytes, m_routingManager.RoutingSession())
|
kMaxTrafficCacheSizeBytes, m_routingManager.RoutingSession())
|
||||||
, m_lastReportedCountry(kInvalidCountryId)
|
, m_lastReportedCountry(kInvalidCountryId)
|
||||||
|
|||||||
@@ -51,10 +51,12 @@ TrafficManager::CacheEntry::CacheEntry(time_point<steady_clock> const & requestT
|
|||||||
, m_lastAvailability(traffic::TrafficInfo::Availability::Unknown)
|
, m_lastAvailability(traffic::TrafficInfo::Availability::Unknown)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
TrafficManager::TrafficManager(const CountryParentNameGetterFn &countryParentNameGetter,
|
TrafficManager::TrafficManager(DataSource & dataSource,
|
||||||
|
const CountryParentNameGetterFn &countryParentNameGetter,
|
||||||
GetMwmsByRectFn const & getMwmsByRectFn, size_t maxCacheSizeBytes,
|
GetMwmsByRectFn const & getMwmsByRectFn, size_t maxCacheSizeBytes,
|
||||||
traffic::TrafficObserver & observer)
|
traffic::TrafficObserver & observer)
|
||||||
: m_countryParentNameGetterFn(countryParentNameGetter)
|
: m_dataSource(dataSource)
|
||||||
|
, m_countryParentNameGetterFn(countryParentNameGetter)
|
||||||
, m_getMwmsByRectFn(getMwmsByRectFn)
|
, m_getMwmsByRectFn(getMwmsByRectFn)
|
||||||
, m_observer(observer)
|
, m_observer(observer)
|
||||||
, m_currentDataVersion(0)
|
, m_currentDataVersion(0)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "drape/pointers.hpp"
|
#include "drape/pointers.hpp"
|
||||||
|
|
||||||
|
#include "indexer/data_source.hpp"
|
||||||
#include "indexer/mwm_set.hpp"
|
#include "indexer/mwm_set.hpp"
|
||||||
|
|
||||||
#include "openlr/openlr_decoder.hpp"
|
#include "openlr/openlr_decoder.hpp"
|
||||||
@@ -75,7 +76,8 @@ public:
|
|||||||
using TrafficStateChangedFn = std::function<void(TrafficState)>;
|
using TrafficStateChangedFn = std::function<void(TrafficState)>;
|
||||||
using GetMwmsByRectFn = std::function<std::vector<MwmSet::MwmId>(m2::RectD const &)>;
|
using GetMwmsByRectFn = std::function<std::vector<MwmSet::MwmId>(m2::RectD const &)>;
|
||||||
|
|
||||||
TrafficManager(CountryParentNameGetterFn const & countryParentNameGetter,
|
TrafficManager(DataSource & dataSource,
|
||||||
|
CountryParentNameGetterFn const & countryParentNameGetter,
|
||||||
GetMwmsByRectFn const & getMwmsByRectFn, size_t maxCacheSizeBytes,
|
GetMwmsByRectFn const & getMwmsByRectFn, size_t maxCacheSizeBytes,
|
||||||
traffic::TrafficObserver & observer);
|
traffic::TrafficObserver & observer);
|
||||||
~TrafficManager();
|
~TrafficManager();
|
||||||
@@ -402,6 +404,7 @@ private:
|
|||||||
std::for_each(activeMwms.begin(), activeMwms.end(), std::forward<F>(f));
|
std::for_each(activeMwms.begin(), activeMwms.end(), std::forward<F>(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataSource & m_dataSource;
|
||||||
CountryParentNameGetterFn m_countryParentNameGetterFn;
|
CountryParentNameGetterFn m_countryParentNameGetterFn;
|
||||||
GetMwmsByRectFn m_getMwmsByRectFn;
|
GetMwmsByRectFn m_getMwmsByRectFn;
|
||||||
traffic::TrafficObserver & m_observer;
|
traffic::TrafficObserver & m_observer;
|
||||||
|
|||||||
Reference in New Issue
Block a user