mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 05:13:58 +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:
49
routing/router_delegate.cpp
Normal file
49
routing/router_delegate.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "routing/router_delegate.hpp"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
namespace routing
|
||||
{
|
||||
namespace
|
||||
{
|
||||
void DefaultProgressFn(float /* progress */) {}
|
||||
void DefaultPointFn(ms::LatLon const & /* point */) {}
|
||||
} // namespace
|
||||
|
||||
RouterDelegate::RouterDelegate()
|
||||
{
|
||||
m_progressCallback = DefaultProgressFn;
|
||||
m_pointCallback = DefaultPointFn;
|
||||
}
|
||||
|
||||
void RouterDelegate::OnProgress(float progress) const
|
||||
{
|
||||
if (!m_cancellable.IsCancelled())
|
||||
m_progressCallback(progress);
|
||||
}
|
||||
|
||||
void RouterDelegate::OnPointCheck(ms::LatLon const & point) const
|
||||
{
|
||||
if (!m_cancellable.IsCancelled())
|
||||
m_pointCallback(point);
|
||||
}
|
||||
|
||||
void RouterDelegate::SetProgressCallback(ProgressCallback const & progressCallback)
|
||||
{
|
||||
m_progressCallback = progressCallback ? progressCallback : DefaultProgressFn;
|
||||
}
|
||||
|
||||
void RouterDelegate::SetPointCheckCallback(PointCheckCallback const & pointCallback)
|
||||
{
|
||||
m_pointCallback = pointCallback ? pointCallback : DefaultPointFn;
|
||||
}
|
||||
|
||||
void RouterDelegate::SetTimeout(uint32_t timeoutSec)
|
||||
{
|
||||
if (timeoutSec == kNoTimeout)
|
||||
return;
|
||||
|
||||
std::chrono::steady_clock::duration const timeout = std::chrono::seconds(timeoutSec);
|
||||
m_cancellable.SetDeadline(std::chrono::steady_clock::now() + timeout);
|
||||
}
|
||||
} // namespace routing
|
||||
Reference in New Issue
Block a user