diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2017-02-20 14:45:05 +0300 |
---|---|---|
committer | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2017-02-20 14:56:20 +0300 |
commit | 7e848c132f171617db4f903b50473b1a5f639d8b (patch) | |
tree | 4aa8c491d63fd1377181226e6b9274314854df1b /map | |
parent | 325d595022107c965fffa8276276d062a48ea0a2 (diff) |
Added simplified traffic colors
Diffstat (limited to 'map')
-rw-r--r-- | map/framework.cpp | 18 | ||||
-rw-r--r-- | map/framework.hpp | 3 | ||||
-rw-r--r-- | map/traffic_manager.cpp | 6 | ||||
-rw-r--r-- | map/traffic_manager.hpp | 2 |
4 files changed, 28 insertions, 1 deletions
diff --git a/map/framework.cpp b/map/framework.cpp index fa2fb7e4b9..09663c52b2 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -126,6 +126,7 @@ char const kAllow3dKey[] = "Allow3d"; char const kAllow3dBuildingsKey[] = "Buildings3d"; char const kAllowAutoZoom[] = "AutoZoom"; char const kTrafficEnabledKey[] = "TrafficEnabled"; +char const kTrafficSimplifiedColorsKey[] = "TrafficSimplifiedColors"; char const kLargeFontsSize[] = "LargeFontsSize"; double const kDistEqualQueryMeters = 100.0; @@ -1676,6 +1677,8 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::OGLContextFactory> contextFactory, bool const isAutozoomEnabled = LoadAutoZoom(); bool const trafficEnabled = LoadTrafficEnabled(); m_trafficManager.SetEnabled(trafficEnabled); + bool const simplifiedTrafficColors = LoadTrafficSimplifiedColors(); + m_trafficManager.SetSimplifiedColorScheme(simplifiedTrafficColors); double const fontsScaleFactor = LoadLargeFontsSize() ? kLargeFontsScaleFactor : 1.0; @@ -1687,7 +1690,8 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::OGLContextFactory> contextFactory, make_pair(params.m_initialMyPositionState, params.m_hasMyPositionState), move(myPositionModeChangedFn), allow3dBuildings, trafficEnabled, params.m_isChoosePositionMode, params.m_isChoosePositionMode, GetSelectedFeatureTriangles(), params.m_isFirstLaunch, - m_routingSession.IsActive() && m_routingSession.IsFollowing(), isAutozoomEnabled); + m_routingSession.IsActive() && m_routingSession.IsFollowing(), isAutozoomEnabled, + simplifiedTrafficColors); m_drapeEngine = make_unique_dp<df::DrapeEngine>(move(p)); m_drapeEngine->SetModelViewListener([this](ScreenBase const & screen) @@ -2769,6 +2773,18 @@ void Framework::SaveTrafficEnabled(bool trafficEnabled) settings::Set(kTrafficEnabledKey, trafficEnabled); } +bool Framework::LoadTrafficSimplifiedColors() +{ + bool simplified = true; + settings::Get(kTrafficSimplifiedColorsKey, simplified); + return simplified; +} + +void Framework::SaveTrafficSimplifiedColors(bool simplified) +{ + settings::Set(kTrafficSimplifiedColorsKey, simplified); +} + bool Framework::LoadAutoZoom() { bool allowAutoZoom = true; diff --git a/map/framework.hpp b/map/framework.hpp index 70d5e113d4..41b8f04fc7 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -786,6 +786,9 @@ public: bool LoadTrafficEnabled(); void SaveTrafficEnabled(bool trafficEnabled); + bool LoadTrafficSimplifiedColors(); + void SaveTrafficSimplifiedColors(bool simplified); + /// \returns true if altitude information along |m_route| is available and /// false otherwise. bool HasRouteAltitude() const; diff --git a/map/traffic_manager.cpp b/map/traffic_manager.cpp index b4ada5ff92..e6c93f01f6 100644 --- a/map/traffic_manager.cpp +++ b/map/traffic_manager.cpp @@ -558,6 +558,12 @@ void TrafficManager::Resume() Invalidate(); } +void TrafficManager::SetSimplifiedColorScheme(bool simplified) +{ + if (m_drapeEngine != nullptr) + m_drapeEngine->SetSimplifiedTrafficColors(simplified); +} + string DebugPrint(TrafficManager::TrafficState state) { switch (state) diff --git a/map/traffic_manager.hpp b/map/traffic_manager.hpp index b126cbabb1..d2116f70df 100644 --- a/map/traffic_manager.hpp +++ b/map/traffic_manager.hpp @@ -84,6 +84,8 @@ public: void OnEnterForeground(); void OnEnterBackground(); + void SetSimplifiedColorScheme(bool simplified); + private: struct CacheEntry { |