diff --git a/libs/map/gps_track.cpp b/libs/map/gps_track.cpp index 5ecbb5e5d..b39577d89 100644 --- a/libs/map/gps_track.cpp +++ b/libs/map/gps_track.cpp @@ -50,20 +50,15 @@ void GpsTrack::AddPoints(vector const & points) ScheduleTask(); } -/// @note These functions are called during recording, so should be synchronized with Collection writer thread. -/// @{ -TrackStatistics GpsTrack::GetTrackStatistics() +TrackStatistics GpsTrack::GetTrackStatistics() const { - lock_guard lg(m_threadGuard); return m_collection ? m_collection->GetTrackStatistics() : TrackStatistics(); } -ElevationInfo const & GpsTrack::GetElevationInfo() +ElevationInfo const & GpsTrack::GetElevationInfo() const { - lock_guard lg(m_threadGuard); return m_collection->UpdateAndGetElevationInfo(); } -/// @} void GpsTrack::Clear() { diff --git a/libs/map/gps_track.hpp b/libs/map/gps_track.hpp index edfaa5790..493ee0c14 100644 --- a/libs/map/gps_track.hpp +++ b/libs/map/gps_track.hpp @@ -31,8 +31,8 @@ public: void AddPoints(std::vector const & points); /// Returns track statistics - TrackStatistics GetTrackStatistics(); - ElevationInfo const & GetElevationInfo(); + TrackStatistics GetTrackStatistics() const; + ElevationInfo const & GetElevationInfo() const; /// Clears any previous tracking info /// @note Callback is called with 'toRemove' points, if some points were removed. diff --git a/libs/map/gps_tracker.cpp b/libs/map/gps_tracker.cpp index f1feeb03d..da29ebfdd 100644 --- a/libs/map/gps_tracker.cpp +++ b/libs/map/gps_tracker.cpp @@ -68,12 +68,12 @@ bool GpsTracker::IsEmpty() const return m_track.IsEmpty(); } -TrackStatistics GpsTracker::GetTrackStatistics() +TrackStatistics GpsTracker::GetTrackStatistics() const { return m_track.GetTrackStatistics(); } -ElevationInfo const & GpsTracker::GetElevationInfo() +ElevationInfo const & GpsTracker::GetElevationInfo() const { return m_track.GetElevationInfo(); } diff --git a/libs/map/gps_tracker.hpp b/libs/map/gps_tracker.hpp index a72d2bd3d..f0b5cdf36 100644 --- a/libs/map/gps_tracker.hpp +++ b/libs/map/gps_tracker.hpp @@ -17,8 +17,8 @@ public: bool IsEmpty() const; - TrackStatistics GetTrackStatistics(); - ElevationInfo const & GetElevationInfo(); + TrackStatistics GetTrackStatistics() const; + ElevationInfo const & GetElevationInfo() const; using TGpsTrackDiffCallback = std::function> && toAdd,