MCPcopy Create free account
hub / github.com/comaps/comaps / SaveRoutePoints

Method SaveRoutePoints

libs/map/routing_manager.cpp:1573–1596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1571}
1572
1573void RoutingManager::SaveRoutePoints()
1574{
1575 auto points = GetRoutePointsToSave();
1576 if (points.empty())
1577 {
1578 DeleteSavedRoutePoints();
1579 return;
1580 }
1581
1582 GetPlatform().RunTask(Platform::Thread::File, [points = std::move(points)]()
1583 {
1584 try
1585 {
1586 auto const fileName = GetPlatform().SettingsPathForFile(kRoutePointsFile);
1587 FileWriter writer(fileName);
1588 string const pointsData = SerializeRoutePoints(points);
1589 writer.Write(pointsData.c_str(), pointsData.length());
1590 }
1591 catch (RootException const & ex)
1592 {
1593 LOG(LWARNING, ("Saving road points failed:", ex.Msg()));
1594 }
1595 });
1596}
1597
1598vector<RouteMarkData> RoutingManager::GetRoutePointsToSave() const
1599{

Calls 6

SerializeRoutePointsFunction · 0.85
RunTaskMethod · 0.80
SettingsPathForFileMethod · 0.80
lengthMethod · 0.80
emptyMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected