mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-07 13:03:54 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
42
map/gps_tracker.hpp
Normal file
42
map/gps_tracker.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#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;
|
||||
};
|
||||
Reference in New Issue
Block a user