adds distinction between rotaries/rounabouts

This commit is contained in:
Moritz Kobitzsch
2016-03-23 15:28:53 +01:00
committed by Patrick Niklaus
parent 278ec04f5e
commit f2443c64db
10 changed files with 270 additions and 42 deletions
+2 -1
View File
@@ -350,7 +350,8 @@ inline bool requiresNameAnnounced(const std::string &from, const std::string &to
const auto ref_begin = name.find_first_of('(');
if (ref_begin != std::string::npos)
{
out_name = name.substr(0, ref_begin);
//we might need to trim a space, if there is a reference
out_name = name.substr(0, ref_begin - (ref_begin > 0 && name[ref_begin-1] == ' '));
out_ref = name.substr(ref_begin + 1, name.find_first_of(')') - 1);
}
else
+5 -3
View File
@@ -112,7 +112,8 @@ class TurnAnalysis
// Processing of roundabouts
// Produces instructions to enter/exit a roundabout or to stay on it.
// Performs the distinction between roundabout and rotaries.
std::vector<ConnectedRoad> handleRoundabouts(const EdgeID via_edge,
std::vector<ConnectedRoad> handleRoundabouts(const bool is_rotary,
const EdgeID via_edge,
const bool on_roundabout,
const bool can_exit_roundabout,
std::vector<ConnectedRoad> intersection) const;
@@ -152,8 +153,8 @@ class TurnAnalysis
std::vector<ConnectedRoad> intersection) const;
// Any Junction containing motorways
std::vector<ConnectedRoad> handleMotorwayJunction(
const EdgeID via_edge, std::vector<ConnectedRoad> intersection) const;
std::vector<ConnectedRoad>
handleMotorwayJunction(const EdgeID via_edge, std::vector<ConnectedRoad> intersection) const;
std::vector<ConnectedRoad> handleFromMotorway(const EdgeID via_edge,
std::vector<ConnectedRoad> intersection) const;
@@ -193,6 +194,7 @@ class TurnAnalysis
std::vector<ConnectedRoad> intersection,
const std::size_t up_to) const;
bool isRotary(const NodeID nid) const;
}; // class TurnAnalysis
} // namespace guidance
@@ -89,24 +89,32 @@ struct TurnInstruction
return TurnInstruction(TurnType::NoTurn, DirectionModifier::UTurn);
}
static TurnInstruction REMAIN_ROUNDABOUT(const DirectionModifier modifier)
static TurnInstruction REMAIN_ROUNDABOUT(bool is_rotary, const DirectionModifier modifier)
{
(void)is_rotary; // staying does not require a different instruction at the moment
return TurnInstruction(TurnType::StayOnRoundabout, modifier);
}
static TurnInstruction ENTER_ROUNDABOUT(const DirectionModifier modifier)
static TurnInstruction ENTER_ROUNDABOUT(bool is_rotary, const DirectionModifier modifier)
{
return TurnInstruction(TurnType::EnterRoundabout, modifier);
return {is_rotary ? TurnType::EnterRotary : TurnType::EnterRoundabout, modifier};
}
static TurnInstruction EXIT_ROUNDABOUT(const DirectionModifier modifier)
static TurnInstruction EXIT_ROUNDABOUT(bool is_rotary, const DirectionModifier modifier)
{
return TurnInstruction(TurnType::ExitRoundabout, modifier);
return {is_rotary ? TurnType::ExitRotary : TurnType::ExitRoundabout, modifier};
}
static TurnInstruction ENTER_AND_EXIT_ROUNDABOUT(bool is_rotary,
const DirectionModifier modifier)
{
return {is_rotary ? TurnType::EnterAndExitRotary : TurnType::EnterAndExitRoundabout,
modifier};
}
static TurnInstruction SUPPRESSED(const DirectionModifier modifier)
{
return TurnInstruction{TurnType::Suppressed, modifier};
return {TurnType::Suppressed, modifier};
}
};