From 9d5777dee6e551143fe636f37bb27803a4d931b9 Mon Sep 17 00:00:00 2001 From: vng Date: Wed, 17 Oct 2012 02:13:56 +0300 Subject: [PATCH] Show fixes compass only when it's declared in settings.ini --- map/framework.cpp | 13 ++++++++----- map/framework.hpp | 2 ++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/map/framework.cpp b/map/framework.cpp index b4ee237535..790546f274 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -103,11 +103,14 @@ void Framework::OnLocationUpdate(location::GpsInfo const & info) // pretend like GPS position rInfo.m_horizontalAccuracy = 5.0; - // pass compass value (for devices without compass) - location::CompassInfo compass; - compass.m_magneticHeading = compass.m_trueHeading = 0.0; - compass.m_timestamp = rInfo.m_timestamp; - OnCompassUpdate(compass); + if (m_fixedPos.HasNorth()) + { + // pass compass value (for devices without compass) + location::CompassInfo compass; + compass.m_magneticHeading = compass.m_trueHeading = 0.0; + compass.m_timestamp = rInfo.m_timestamp; + OnCompassUpdate(compass); + } #else location::GpsInfo const & rInfo = info; diff --git a/map/framework.hpp b/map/framework.hpp index 29edecc8b1..8db087969b 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -61,7 +61,9 @@ class Framework void GetLat(double & l) const { if (m_fixedLatLon) l = m_latlon.first; } void GetLon(double & l) const { if (m_fixedLatLon) l = m_latlon.second; } + void GetNorth(double & n) const { if (m_fixedDir) n = m_dirFromNorth; } + bool HasNorth() const { return m_fixedDir; } } m_fixedPos; #endif