remove usage of use-lane completely

This commit is contained in:
Moritz Kobitzsch 2017-07-14 12:07:18 +02:00
parent 7b755d6f8b
commit f2f00b99e0
11 changed files with 23 additions and 36 deletions

View File

@ -174,15 +174,17 @@ module.exports = function () {
this.lanesList = (instructions) => {
return this.extractInstructionList(instructions, s => {
return s.intersections.map( i => {
if(i.lanes == undefined )
return '';
else
if(i.lanes)
{
return i.lanes.map( l => {
let indications = l.indications.join(';');
return indications + ':' + (l.valid ? 'true' : 'false');
}).join(' ');
}
else
{
return '';
}
}).join(';');
});
};

View File

@ -49,7 +49,7 @@ const constexpr Enum EnterRotary = 12; // Enter a rotary
const constexpr Enum EnterAndExitRotary = 13; // Touching a rotary
const constexpr Enum EnterRoundaboutIntersection = 14; // Entering a small Roundabout
const constexpr Enum EnterAndExitRoundaboutIntersection = 15; // Touching a roundabout
const constexpr Enum UseLane = 16; // No Turn, but you need to stay on a given lane!
// depreacted: const constexpr Enum UseLane = 16; // No Turn, but you need to stay on a given lane!
// Values below here are silent instructions
const constexpr Enum NoTurn = 17; // end of segment without turn/middle of a segment
@ -207,9 +207,7 @@ inline bool isSilent(const extractor::guidance::TurnInstruction instruction)
{
return instruction.type == extractor::guidance::TurnType::NoTurn ||
instruction.type == extractor::guidance::TurnType::Suppressed ||
instruction.type == extractor::guidance::TurnType::StayOnRoundabout ||
// it is enough to output them within the intersections array
instruction.type == extractor::guidance::TurnType::UseLane;
instruction.type == extractor::guidance::TurnType::StayOnRoundabout;
}
inline bool hasRampType(const extractor::guidance::TurnInstruction instruction)

View File

@ -24,7 +24,6 @@ struct TurnLaneData
// a temporary data entry that does not need to be assigned to an entry.
// This is the case in situations that use partition and require the entry to perform the
// one-to-one mapping.
bool suppress_assignment;
bool operator<(const TurnLaneData &other) const;
};
typedef std::vector<TurnLaneData> LaneDataVector;

View File

@ -90,9 +90,7 @@ inline void print(const extractor::guidance::lanes::LaneDataVector &turn_lane_da
std::cout << "\t" << entry.tag << "("
<< extractor::guidance::TurnLaneType::toString(entry.tag)
<< ") from: " << static_cast<int>(entry.from)
<< " to: " << static_cast<int>(entry.to)
<< " Can Be Suppresssed: " << (entry.suppress_assignment ? "true" : "false")
<< "\n";
<< " to: " << static_cast<int>(entry.to) << "\n";
std::cout << std::flush;
}

View File

@ -96,7 +96,7 @@ std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
// only prevent use lanes due to making all turns. don't make turns during curvy
// segments
if (previous_inst.type == TurnType::UseLane)
if (previous_inst.type == TurnType::Suppressed)
time_to_constrained += previous.duration;
else
time_to_constrained = 0;
@ -193,8 +193,9 @@ std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
anticipate_for_right_turn();
}
if (previous_inst.type == TurnType::UseLane && current_inst.type == TurnType::UseLane &&
previous.mode == current.mode && previous_lanes == current_lanes)
if (previous_inst.type == TurnType::Suppressed &&
current_inst.type == TurnType::Suppressed && previous.mode == current.mode &&
previous_lanes == current_lanes)
{
previous.ElongateBy(current);
current.Invalidate();

View File

@ -133,8 +133,7 @@ void closeOffRoundabout(const bool on_roundabout,
BOOST_ASSERT(leavesRoundabout(steps[1].maneuver.instruction) ||
steps[1].maneuver.instruction.type == TurnType::StayOnRoundabout ||
steps[1].maneuver.instruction.type == TurnType::Suppressed ||
steps[1].maneuver.instruction.type == TurnType::NoTurn ||
steps[1].maneuver.instruction.type == TurnType::UseLane);
steps[1].maneuver.instruction.type == TurnType::NoTurn);
steps[0].geometry_end = 1;
steps[1].geometry_begin = 0;
steps[1].AddInFront(steps[0]);
@ -608,7 +607,7 @@ std::vector<RouteStep> buildIntersections(std::vector<RouteStep> steps)
{
auto &step = steps[step_index];
const auto instruction = step.maneuver.instruction;
if (instruction.type == TurnType::Suppressed || instruction.type == TurnType::UseLane)
if (instruction.type == TurnType::Suppressed)
{
BOOST_ASSERT(steps[last_valid_instruction].mode == step.mode);
// count intersections. We cannot use exit, since intersections can follow directly

View File

@ -129,19 +129,16 @@ LaneDataVector augmentMultiple(const std::size_t none_index,
{
lane_data.push_back({tag_by_modifier[itr->instruction.direction_modifier],
lane_data[none_index].from,
lane_data[none_index].from,
false});
lane_data[none_index].from});
}
lane_data.push_back({tag_by_modifier[straight_itr->instruction.direction_modifier],
lane_data[none_index].from,
lane_data[none_index].to,
false});
lane_data[none_index].to});
for (auto itr = straight_itr + 1; itr != intersection_range_end; ++itr)
{
lane_data.push_back({tag_by_modifier[itr->instruction.direction_modifier],
lane_data[none_index].to,
lane_data[none_index].to,
false});
lane_data[none_index].to});
}
lane_data.erase(lane_data.begin() + none_index);
@ -158,8 +155,7 @@ LaneDataVector augmentMultiple(const std::size_t none_index,
lane_data.push_back({tag_by_modifier[intersection[intersection_index]
.instruction.direction_modifier],
lane_data[none_index].from,
lane_data[none_index].to,
false});
lane_data[none_index].to});
}
}
lane_data.erase(lane_data.begin() + none_index);

View File

@ -107,7 +107,7 @@ LaneDataVector laneDataFromDescription(TurnLaneDescription turn_lane_description
LaneDataVector lane_data;
lane_data.reserve(lane_map.size());
for (const auto &tag : lane_map)
lane_data.push_back({tag.first, tag.second.first, tag.second.second, false});
lane_data.push_back({tag.first, tag.second.first, tag.second.second});
std::sort(lane_data.begin(), lane_data.end());

View File

@ -279,7 +279,7 @@ TurnLaneScenario TurnLaneHandler::deduceScenario(const NodeID at,
// FIXME the lane to add depends on the side of driving/u-turn rules in the country
if (!lane_data.empty() && canMatchTrivially(intersection, lane_data) &&
is_missing_valid_u_turn && !hasTag(TurnLaneType::none, lane_data))
lane_data.push_back({TurnLaneType::uturn, lane_data.back().to, lane_data.back().to, false});
lane_data.push_back({TurnLaneType::uturn, lane_data.back().to, lane_data.back().to});
bool is_simple = isSimpleIntersection(lane_data, intersection);
@ -644,8 +644,6 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
if (lane == straightmost_tag_index)
{
augmentEntry(turn_lane_data[straightmost_tag_index]);
// disable this turn for assignment if it is a -use lane only
turn_lane_data[straightmost_tag_index].suppress_assignment = true;
}
if (matched_at_first[lane])
@ -657,7 +655,7 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
std::count(matched_at_second.begin(), matched_at_second.end(), true)) ==
getNumberOfTurns(next_intersection))
{
TurnLaneData data = {TurnLaneType::straight, 255, 0, true};
TurnLaneData data = {TurnLaneType::straight, 255, 0};
augmentEntry(data);
first.push_back(data);
std::sort(first.begin(), first.end());

View File

@ -87,7 +87,7 @@ bool isValidMatch(const TurnLaneType::Mask tag, const TurnInstruction instructio
TurnType::Continue && // Forks can be experienced, even for straight segments
(instruction.direction_modifier == DirectionModifier::SlightLeft ||
instruction.direction_modifier == DirectionModifier::SlightRight)) ||
instruction.type == TurnType::UseLane;
instruction.type == TurnType::Suppressed;
}
else if (tag == TurnLaneType::slight_left || tag == TurnLaneType::left ||
tag == TurnLaneType::sharp_left)
@ -250,10 +250,6 @@ Intersection triviallyMatchLanesToTurns(Intersection intersection,
BOOST_ASSERT(findBestMatch(lane_data[lane].tag, intersection) ==
intersection.begin() + road_index);
if (TurnType::Suppressed == intersection[road_index].instruction.type &&
!lane_data[lane].suppress_assignment)
intersection[road_index].instruction.type = TurnType::UseLane;
matchRoad(intersection[road_index], lane_data[lane]);
++lane;
}

View File

@ -176,7 +176,7 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
"enter_and_exit_roundabout_intersection",
extractor::guidance::TurnType::EnterAndExitRoundaboutIntersection,
"use_lane",
extractor::guidance::TurnType::UseLane,
extractor::guidance::TurnType::Suppressed,
"no_turn",
extractor::guidance::TurnType::NoTurn,
"suppressed",