diff options
author | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2016-07-11 12:12:12 +0300 |
---|---|---|
committer | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2016-07-18 12:33:44 +0300 |
commit | 4c87755023e2b7ede757e5b46c43e013f202b346 (patch) | |
tree | 961e28753ca0830c28b36f416ff7369cc0a37b66 /map | |
parent | 4f92d16e455033198642452d7d7a6a0eafc7fe34 (diff) |
Autozoom in routing in follow-and-rotate mode.
Diffstat (limited to 'map')
-rw-r--r-- | map/framework.cpp | 31 | ||||
-rw-r--r-- | map/framework.hpp | 4 |
2 files changed, 30 insertions, 5 deletions
diff --git a/map/framework.cpp b/map/framework.cpp index e93a57d3ba..30644554cd 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -108,6 +108,7 @@ char const kRouterTypeKey[] = "router"; char const kMapStyleKey[] = "MapStyleKeyV1"; char const kAllow3dKey[] = "Allow3d"; char const kAllow3dBuildingsKey[] = "Buildings3d"; +char const kAllowAutoZoom[] = "AutoZoom"; double const kDistEqualQuery = 100.0; @@ -2287,11 +2288,14 @@ void Framework::FollowRoute() if (!m_routingSession.EnableFollowMode()) return; - int const scale = (m_currentRouterType == RouterType::Pedestrian) ? scales::GetPedestrianNavigationScale() - : scales::GetNavigationScale(); - int const scale3d = (m_currentRouterType == RouterType::Pedestrian) ? scales::GetPedestrianNavigation3dScale() - : scales::GetNavigation3dScale(); - m_drapeEngine->FollowRoute(scale, scale3d); + bool const isPedestrianRoute = m_currentRouterType == RouterType::Pedestrian; + int const scale = isPedestrianRoute ? scales::GetPedestrianNavigationScale() + : scales::GetNavigationScale(); + int const scale3d = isPedestrianRoute ? scales::GetPedestrianNavigation3dScale() + : scales::GetNavigation3dScale(); + bool const enableAutoZoom = isPedestrianRoute ? false : LoadAutoZoom(); + + m_drapeEngine->FollowRoute(scale, scale3d, enableAutoZoom); m_drapeEngine->SetRoutePoint(m2::PointD(), true /* isStart */, false /* isValid */); } @@ -2552,6 +2556,23 @@ void Framework::Load3dMode(bool & allow3d, bool & allow3dBuildings) allow3dBuildings = true; } +bool Framework::LoadAutoZoom() +{ + bool allowAutoZoom = false; + settings::Get(kAllowAutoZoom, allowAutoZoom); + return allowAutoZoom; +} + +void Framework::AllowAutoZoom(bool allowAutoZoom) +{ + CallDrapeFunction(bind(&df::DrapeEngine::AllowAutoZoom, _1, allowAutoZoom)); +} + +void Framework::SaveAutoZoom(bool allowAutoZoom) +{ + settings::Set(kAllowAutoZoom, allowAutoZoom); +} + void Framework::EnableChoosePositionMode(bool enable, bool enableBounds, bool applyPosition, m2::PointD const & position) { if (m_drapeEngine != nullptr) diff --git a/map/framework.hpp b/map/framework.hpp index c411734a1b..4bdf0902e8 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -656,6 +656,10 @@ public: void Save3dMode(bool allow3d, bool allow3dBuildings); void Load3dMode(bool & allow3d, bool & allow3dBuildings); + bool LoadAutoZoom(); + void AllowAutoZoom(bool allowAutoZoom); + void SaveAutoZoom(bool allowAutoZoom); + public: /// @name Editor interface. //@{ |