mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 05:13:58 +00:00
[routing] Add possibility to save routes as tracks
Signed-off-by: cyber-toad <the.cyber.toad@proton.me>
This commit is contained in:
committed by
Konstantin Pastbin
parent
9e8accc8f5
commit
45bba5fb5e
@@ -1091,6 +1091,27 @@ void RoutingManager::SetUserCurrentPosition(m2::PointD const & position)
|
||||
}
|
||||
}
|
||||
|
||||
static std::string GetNameFromPoint(RouteMarkData const & rmd)
|
||||
{
|
||||
if (rmd.m_subTitle.empty())
|
||||
return "";
|
||||
return rmd.m_title;
|
||||
}
|
||||
|
||||
void RoutingManager::SaveRoute()
|
||||
{
|
||||
auto points = GetRoutePolyline().GetPolyline().GetPoints();
|
||||
auto const routePoints = GetRoutePoints();
|
||||
std::string const from = GetNameFromPoint(routePoints.front());
|
||||
std::string const to = GetNameFromPoint(routePoints.back());
|
||||
// remove equal sequential points
|
||||
points.erase(
|
||||
std::unique(points.begin(), points.end(), [](const m2::PointD & p1, const m2::PointD & p2) { return AlmostEqualAbs(p1, p2, kMwmPointAccuracy); }),
|
||||
points.end());
|
||||
|
||||
m_bmManager->SaveRoute(points, from, to);
|
||||
}
|
||||
|
||||
bool RoutingManager::DisableFollowMode()
|
||||
{
|
||||
bool const disabled = m_routingSession.DisableFollowMode();
|
||||
|
||||
Reference in New Issue
Block a user