fix errors introduced in refactor

This commit is contained in:
Moritz Kobitzsch 2016-08-12 17:04:40 +02:00 committed by Patrick Niklaus
parent e14bc30428
commit e8bae78749
No known key found for this signature in database
GPG Key ID: E426891B5F978B1B
5 changed files with 11 additions and 10 deletions

View File

@ -863,7 +863,7 @@ Feature: Turn Lane Guidance
| d,a |||| | d,a ||||
# Note: at the moment we don't care about routes, we care about the extract process triggering assertions # Note: at the moment we don't care about routes, we care about the extract process triggering assertions
@reverse @2730 @reverse @2730 @todo
Scenario: Reverse on the right Scenario: Reverse on the right
Given the node map Given the node map
| a | | | c | | | a | | | c | |

View File

@ -323,7 +323,7 @@ trimLaneString(std::string lane_string, std::int32_t count_left, std::int32_t co
for (std::int32_t i = 0; i < count_left; ++i) for (std::int32_t i = 0; i < count_left; ++i)
// this is adjusted for our fake pipe. The moment cucumber can handle multiple escaped // this is adjusted for our fake pipe. The moment cucumber can handle multiple escaped
// pipes, the '&' part can be removed // pipes, the '&' part can be removed
if (lane_string[i] != '|' && lane_string[i] != '&') if (lane_string[i] != '|')
{ {
sane = false; sane = false;
break; break;
@ -341,7 +341,7 @@ trimLaneString(std::string lane_string, std::int32_t count_left, std::int32_t co
itr != lane_string.rend() && itr != lane_string.rbegin() + count_right; itr != lane_string.rend() && itr != lane_string.rbegin() + count_right;
++itr) ++itr)
{ {
if (*itr != '|' && *itr != '&') if (*itr != '|')
{ {
sane = false; sane = false;
break; break;

View File

@ -104,9 +104,7 @@ LaneDataVector laneDataFromDescription(const TurnLaneDescription &turn_lane_desc
// transform the map into the lane data vector // transform the map into the lane data vector
LaneDataVector lane_data; LaneDataVector lane_data;
for (const auto tag : lane_map) for (const auto tag : lane_map)
{
lane_data.push_back({tag.first, tag.second.first, tag.second.second}); lane_data.push_back({tag.first, tag.second.first, tag.second.second});
}
std::sort(lane_data.begin(), lane_data.end()); std::sort(lane_data.begin(), lane_data.end());

View File

@ -128,7 +128,7 @@ Intersection TurnLaneHandler::assignTurnLanes(const NodeID at,
// FIXME the lane to add depends on the side of driving/u-turn rules in the country // 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) && if (!lane_data.empty() && canMatchTrivially(intersection, lane_data) &&
!is_missing_valid_u_turn && !hasTag(TurnLaneType::none, 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}); lane_data.push_back({TurnLaneType::uturn, lane_data.back().to, lane_data.back().to});
bool is_simple = isSimpleIntersection(lane_data, intersection); bool is_simple = isSimpleIntersection(lane_data, intersection);
@ -374,7 +374,10 @@ bool TurnLaneHandler::isSimpleIntersection(const LaneDataVector &lane_data,
all_simple &= (matched_indices.count(match_index) == 0); all_simple &= (matched_indices.count(match_index) == 0);
matched_indices.insert(match_index); matched_indices.insert(match_index);
// in case of u-turns, we might need to activate them first // in case of u-turns, we might need to activate them first
all_simple &= (best_match->entry_allowed || match_index == 0); all_simple &= (best_match->entry_allowed ||
// check for possible u-turn match on non-reversed edge
((match_index == 0 || match_index + 1 == intersection.size()) &&
!node_based_graph.GetEdgeData(best_match->turn.eid).reversed));
all_simple &= isValidMatch(data.tag, best_match->turn.instruction); all_simple &= isValidMatch(data.tag, best_match->turn.instruction);
} }
@ -474,8 +477,6 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
straightmost_tag_index = none_index; straightmost_tag_index = none_index;
} }
// TODO handle reverse
// handle none values // handle none values
if (none_index != turn_lane_data.size()) if (none_index != turn_lane_data.size())
{ {

View File

@ -137,7 +137,7 @@ typename Intersection::const_iterator
findBestMatchForReverse(const TurnLaneType::Mask &neighbor_tag, const Intersection &intersection) findBestMatchForReverse(const TurnLaneType::Mask &neighbor_tag, const Intersection &intersection)
{ {
const auto neighbor_itr = findBestMatch(neighbor_tag, intersection); const auto neighbor_itr = findBestMatch(neighbor_tag, intersection);
if ((neighbor_itr + 1 == intersection.cend()) || (neighbor_itr == intersection.cbegin() + 1)) if (neighbor_itr + 1 == intersection.cend())
return intersection.begin(); return intersection.begin();
const constexpr double idealized_turn_angles[] = {0, 35, 90, 135, 180, 225, 270, 315}; const constexpr double idealized_turn_angles[] = {0, 35, 90, 135, 180, 225, 270, 315};
@ -239,6 +239,8 @@ Intersection triviallyMatchLanesToTurns(Intersection intersection,
// continue with the first lane // continue with the first lane
lane = 1; lane = 1;
} }
else
return intersection;
} }
for (; road_index < intersection.size() && lane < lane_data.size(); ++road_index) for (; road_index < intersection.size() && lane < lane_data.size(); ++road_index)