link ConnectedRoad and TurnOperation via class hierarchy

and empower intersection by adding basic functionality to pod type
refactor extractor/toolkit into intersection
This commit is contained in:
Moritz Kobitzsch
2016-11-03 10:18:27 +01:00
parent 388d84a89e
commit cd03877c90
26 changed files with 665 additions and 661 deletions
+24 -25
View File
@@ -167,8 +167,8 @@ TurnLaneScenario TurnLaneHandler::deduceScenario(const NodeID at,
(intersection.size() == 2 &&
((lane_description_id != INVALID_LANE_DESCRIPTIONID &&
lane_description_id ==
node_based_graph.GetEdgeData(intersection[1].turn.eid).lane_description_id) ||
angularDeviation(intersection[1].turn.angle, STRAIGHT_ANGLE) < FUZZY_ANGLE_DIFFERENCE));
node_based_graph.GetEdgeData(intersection[1].eid).lane_description_id) ||
angularDeviation(intersection[1].angle, STRAIGHT_ANGLE) < FUZZY_ANGLE_DIFFERENCE));
if (is_going_straight_and_turns_continue)
return TurnLaneScenario::NONE;
@@ -201,9 +201,9 @@ TurnLaneScenario TurnLaneHandler::deduceScenario(const NodeID at,
const auto &road = previous_intersection[road_index];
// in case of a sliproad that is connected to road of simlar angle, we handle the
// turn as a combined turn
if (road.turn.instruction.type == TurnType::Sliproad)
if (road.instruction.type == TurnType::Sliproad)
{
if (via_edge == road.turn.eid)
if (via_edge == road.eid)
return TurnLaneScenario::SLIPROAD;
const auto &closest_road = [&]() {
@@ -217,16 +217,16 @@ TurnLaneScenario TurnLaneHandler::deduceScenario(const NodeID at,
BOOST_ASSERT(road_index + 1 < previous_intersection.size());
return previous_intersection[road_index + 1];
}
else if (angularDeviation(road.turn.angle,
previous_intersection.at(road_index - 1).turn.angle) <
angularDeviation(road.turn.angle,
previous_intersection.at(road_index + 1).turn.angle))
else if (angularDeviation(road.angle,
previous_intersection.at(road_index - 1).angle) <
angularDeviation(road.angle,
previous_intersection.at(road_index + 1).angle))
return previous_intersection[road_index - 1];
else
return previous_intersection[road_index + 1];
}();
if (via_edge == closest_road.turn.eid)
if (via_edge == closest_road.eid)
return TurnLaneScenario::SLIPROAD;
}
}
@@ -482,8 +482,8 @@ bool TurnLaneHandler::isSimpleIntersection(const LaneDataVector &lane_data,
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);
!node_based_graph.GetEdgeData(best_match->eid).reversed));
all_simple &= isValidMatch(data.tag, best_match->instruction);
}
// either all indices are matched, or we have a single none-value
@@ -527,7 +527,7 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
// Try and maitch lanes to available turns. For Turns that are not directly matchable, check
// whether we can match them at the upcoming intersection.
const auto straightmost = findClosestTurn(intersection, STRAIGHT_ANGLE);
const auto straightmost = intersection.findClosestTurn(STRAIGHT_ANGLE);
BOOST_ASSERT(straightmost < intersection.cend());
@@ -540,9 +540,9 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
// find out about the next intersection. To check for valid matches, we also need the turn
// types
auto next_intersection = turn_analysis.getIntersection(at, straightmost->turn.eid);
auto next_intersection = turn_analysis.getIntersection(at, straightmost->eid);
next_intersection =
turn_analysis.assignTurnTypes(at, straightmost->turn.eid, std::move(next_intersection));
turn_analysis.assignTurnTypes(at, straightmost->eid, std::move(next_intersection));
// check where we can match turn lanes
std::size_t straightmost_tag_index = turn_lane_data.size();
@@ -554,7 +554,7 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
const auto best_match = findBestMatch(turn_lane_data[lane].tag, intersection);
if (best_match->entry_allowed &&
isValidMatch(turn_lane_data[lane].tag, best_match->turn.instruction))
isValidMatch(turn_lane_data[lane].tag, best_match->instruction))
{
matched_at_first[lane] = true;
@@ -565,8 +565,7 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
const auto best_match_at_next_intersection =
findBestMatch(turn_lane_data[lane].tag, next_intersection);
if (best_match_at_next_intersection->entry_allowed &&
isValidMatch(turn_lane_data[lane].tag,
best_match_at_next_intersection->turn.instruction))
isValidMatch(turn_lane_data[lane].tag, best_match_at_next_intersection->instruction))
{
if (!matched_at_first[lane] || turn_lane_data[lane].tag == TurnLaneType::straight ||
getMatchingQuality(turn_lane_data[lane].tag, *best_match) >
@@ -679,7 +678,7 @@ Intersection TurnLaneHandler::handleSliproadTurn(Intersection intersection,
std::find_if(previous_intersection.begin(),
previous_intersection.end(),
[](const ConnectedRoad &road) {
return road.turn.instruction.type == TurnType::Sliproad;
return road.instruction.type == TurnType::Sliproad;
}));
BOOST_ASSERT(sliproad_index <= previous_intersection.size());
@@ -697,18 +696,18 @@ Intersection TurnLaneHandler::handleSliproadTurn(Intersection intersection,
BOOST_ASSERT(sliproad_index + 1 < previous_intersection.size());
return previous_intersection[sliproad_index + 1];
}
else if (angularDeviation(sliproad.turn.angle,
previous_intersection.at(sliproad_index - 1).turn.angle) <
angularDeviation(sliproad.turn.angle,
previous_intersection.at(sliproad_index + 1).turn.angle))
else if (angularDeviation(sliproad.angle,
previous_intersection.at(sliproad_index - 1).angle) <
angularDeviation(sliproad.angle,
previous_intersection.at(sliproad_index + 1).angle))
return previous_intersection[sliproad_index - 1];
else
return previous_intersection[sliproad_index + 1];
}();
const auto main_description_id =
node_based_graph.GetEdgeData(main_road.turn.eid).lane_description_id;
node_based_graph.GetEdgeData(main_road.eid).lane_description_id;
const auto sliproad_description_id =
node_based_graph.GetEdgeData(sliproad.turn.eid).lane_description_id;
node_based_graph.GetEdgeData(sliproad.eid).lane_description_id;
if (main_description_id == INVALID_LANE_DESCRIPTIONID ||
sliproad_description_id == INVALID_LANE_DESCRIPTIONID)
@@ -716,7 +715,7 @@ Intersection TurnLaneHandler::handleSliproadTurn(Intersection intersection,
TurnLaneDescription combined_description;
// is the sliproad going off to the right?
if (main_road.turn.angle > sliproad.turn.angle)
if (main_road.angle > sliproad.angle)
{
combined_description.insert(
combined_description.end(),