This repository has been archived on 2025-03-22. You can view files and clone it, but cannot push or open issues or pull requests.
organicmaps-tmp/map/gps_tracker.hpp
Kiryl Kaveryn c96d873fa8 [map] return the ElevationInfo for the current track recording
Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
2025-02-28 13:56:03 +00:00

42 lines
1 KiB
C++

#pragma once
#include "map/gps_track.hpp"
#include <atomic>
#include <functional>
#include <utility>
#include <vector>
class GpsTracker
{
public:
static GpsTracker & Instance();
bool IsEnabled() const;
void SetEnabled(bool enabled);
void Clear();
bool IsEmpty() const;
size_t GetTrackSize() const;
TrackStatistics GetTrackStatistics() const;
const ElevationInfo & GetElevationInfo() const;
using TGpsTrackDiffCallback =
std::function<void(std::vector<std::pair<size_t, location::GpsInfo>> && toAdd,
std::pair<size_t, size_t> const & toRemove,
TrackStatistics const & trackStatistics)>;
void Connect(TGpsTrackDiffCallback const & fn);
void Disconnect();
void OnLocationUpdated(location::GpsInfo const & info);
using GpsTrackCallback = std::function<bool(location::GpsInfo const &, size_t)>;
void ForEachTrackPoint(GpsTrackCallback const & callback) const;
private:
GpsTracker();
std::atomic<bool> m_enabled;
GpsTrack m_track;
};