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

Function GetRoundaboutDirectionBasic

libs/routing/car_directions.cpp:159–177  ·  view source on GitHub ↗

! * \brief Calculates a turn instruction if the ingoing edge or (and) the outgoing edge belongs to a * roundabout. * \return Returns one of the following results: * - TurnDirection::EnterRoundAbout if the ingoing edge does not belong to a roundabout * and the outgoing edge belongs to a roundabout. * - TurnDirection::StayOnRoundAbout if the ingoing edge and the outgoing edge belong to a *

Source from the content-addressed store, hash-verified

157 * but it is (they are) relevantly small.
158 */
159CarDirection GetRoundaboutDirectionBasic(bool isIngoingEdgeRoundabout, bool isOutgoingEdgeRoundabout,
160 bool isMultiTurnJunction, bool keepTurnByHighwayClass)
161{
162 if (isIngoingEdgeRoundabout && isOutgoingEdgeRoundabout)
163 {
164 if (isMultiTurnJunction)
165 return keepTurnByHighwayClass ? CarDirection::StayOnRoundAbout : CarDirection::None;
166 return CarDirection::None;
167 }
168
169 if (!isIngoingEdgeRoundabout && isOutgoingEdgeRoundabout)
170 return CarDirection::EnterRoundAbout;
171
172 if (isIngoingEdgeRoundabout && !isOutgoingEdgeRoundabout)
173 return CarDirection::LeaveRoundAbout;
174
175 ASSERT(false, ());
176 return CarDirection::None;
177}
178
179/*!
180 * \brief Returns false when other possible turns leads to service roads;

Callers 2

GetRoundaboutDirectionFunction · 0.85
UNIT_TESTFunction · 0.85

Calls 1

ASSERTFunction · 0.85

Tested by 1

UNIT_TESTFunction · 0.68