MCPcopy Create free account
hub / github.com/comaps/comaps / Framework

Method Framework

libs/map/framework.cpp:308–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306}
307
308Framework::Framework(FrameworkParams const & params, bool loadMaps)
309 : m_enabledDiffs(params.m_enableDiffs)
310 , m_isRenderingEnabled(true)
311 , m_transitManager(m_featuresFetcher.GetDataSource(),
312 [this](FeatureCallback const & fn, vector<FeatureID> const & features)
313{ return m_featuresFetcher.ReadFeatures(fn, features); }, bind(&Framework::GetMwmsByRect, this, _1, false /* rough */))
314 , m_isolinesManager(m_featuresFetcher.GetDataSource(), bind(&Framework::GetMwmsByRect, this, _1, false /* rough */))
315 , m_routingManager(RoutingManager::Callbacks([this]() -> DataSource & { return m_featuresFetcher.GetDataSource(); },
316 [this]() -> storage::CountryInfoGetter const &
317{ return GetCountryInfoGetter(); }, [this](string const & id) -> string { return m_storage.GetParentIdFor(id); },
318 [this]() -> StringsBundle const &
319{ return m_stringsBundle; }, [this]() -> power_management::PowerManager const & { return m_powerManager; }),
320 static_cast<RoutingManager::Delegate &>(*this))
321 , m_trafficManager(bind(&Framework::GetMwmsByRect, this, _1, false /* rough */), kMaxTrafficCacheSizeBytes,
322 m_routingManager.RoutingSession())
323 , m_lastReportedCountry(kInvalidCountryId)
324 , m_popularityLoader(m_featuresFetcher.GetDataSource(), POPULARITY_RANKS_FILE_TAG)
325 , m_descriptionsLoader(std::make_unique<descriptions::Loader>(m_featuresFetcher.GetDataSource()))
326{
327 // Editor should be initialized from the main thread to set its ThreadChecker.
328 // However, search calls editor upon initialization thus setting the lazy editor's ThreadChecker
329 // to a wrong thread. So editor should be initialiazed before serach.
330 osm::Editor & editor = osm::Editor::Instance();
331
332 // Restore map style before classificator loading
333 MapStyle mapStyle = kDefaultMapStyle;
334 string mapStyleStr;
335 if (settings::Get(kMapStyleKey, mapStyleStr))
336 mapStyle = MapStyleFromSettings(mapStyleStr);
337 GetStyleReader().SetCurrentStyle(mapStyle);
338 df::LoadTransitColors();
339
340 m_connectToGpsTrack = GpsTracker::Instance().IsEnabled();
341
342 // Init strings bundle.
343 // @TODO. There are hardcoded strings below which are defined in strings.txt as well.
344 // It's better to use strings from strings.txt instead of hardcoding them here.
345 m_stringsBundle.SetDefaultString("core_entrance", "Entrance");
346 m_stringsBundle.SetDefaultString("core_exit", "Exit");
347 m_stringsBundle.SetDefaultString("core_placepage_unknown_place", "Map Point");
348 m_stringsBundle.SetDefaultString("core_my_places", "My Places");
349 m_stringsBundle.SetDefaultString("core_my_position", "My Position");
350 m_stringsBundle.SetDefaultString("postal_code", "Postal Code");
351
352 m_featuresFetcher.InitClassificator();
353 m_featuresFetcher.SetOnMapDeregisteredCallback(bind(&Framework::OnMapDeregistered, this, _1));
354 LOG(LDEBUG, ("Classificator initialized"));
355
356 m_displayedCategories = make_unique<search::DisplayedCategories>(GetDefaultCategories());
357
358 // To avoid possible races - init country info getter in constructor.
359 InitCountryInfoGetter();
360 LOG(LDEBUG, ("Country info getter initialized"));
361
362 InitSearchAPI(params.m_numSearchAPIThreads);
363 LOG(LDEBUG, ("Search API initialized, part 1"));
364
365 m_bmManager = make_unique<BookmarkManager>(BookmarkManager::Callbacks(

Callers

nothing calls this directly

Calls 15

GetFunction · 0.85
MapStyleFromSettingsFunction · 0.85
LoadTransitColorsFunction · 0.85
GetPreferredFunction · 0.85
GetDataSourceMethod · 0.80
GetParentIdForMethod · 0.80
RoutingSessionMethod · 0.80
SetCurrentStyleMethod · 0.80
SetDefaultStringMethod · 0.80
InitClassificatorMethod · 0.80
OnBookmarksAttachedMethod · 0.80

Tested by

no test coverage detected