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

Function GetFullRoadName

libs/routing/routing_session.cpp:349–377  ·  view source on GitHub ↗

For next street returns "[ref] name" . For highway exits (or main roads with exit info) returns "[junction:ref]: [target:ref] > target". If no |target| - it will be replaced by |name| of next street. If no |target:ref| - it will be replaced by |ref| of next road. So if link has no info at all, "[ref] name" of next will be returned (as for next street).

Source from the content-addressed store, hash-verified

347// If no |target:ref| - it will be replaced by |ref| of next road.
348// So if link has no info at all, "[ref] name" of next will be returned (as for next street).
349void GetFullRoadName(RouteSegment::RoadNameInfo & road, std::string & name)
350{
351 if (auto const & sh = ftypes::GetRoadShields(road.m_ref); !sh.empty())
352 road.m_ref = sh[0].m_name;
353 if (auto const & sh = ftypes::GetRoadShields(road.m_destination_ref); !sh.empty())
354 road.m_destination_ref = sh[0].m_name;
355
356 name.clear();
357 if (road.HasExitInfo())
358 {
359 if (!road.m_junction_ref.empty())
360 name = "[" + road.m_junction_ref + "]";
361
362 if (!road.m_destination_ref.empty())
363 name += std::string(name.empty() ? "" : ": ") + "[" + road.m_destination_ref + "]";
364
365 if (!road.m_destination.empty())
366 name += std::string(name.empty() ? "" : " ") + "> " + road.m_destination;
367 else if (!road.m_name.empty())
368 name += (road.m_destination_ref.empty() ? std::string(name.empty() ? "" : " ") : ": ") + road.m_name;
369 }
370 else
371 {
372 if (!road.m_ref.empty())
373 name = "[" + road.m_ref + "]";
374 if (!road.m_name.empty())
375 name += (name.empty() ? "" : " ") + road.m_name;
376 }
377}
378
379double RoutingSession::GetDistanceToNextTurn() const
380{

Callers 1

GetRouteFollowingInfoMethod · 0.85

Calls 4

GetRoadShieldsFunction · 0.85
HasExitInfoMethod · 0.80
emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected