fix issues with roundabouts and intersections and sliproads
This commit is contained in:
committed by
Patrick Niklaus
parent
ec4dcee8bd
commit
2868f702a5
@@ -120,7 +120,7 @@ RouteStep forwardInto(RouteStep destination, const RouteStep &source)
|
||||
// Overwrites turn instruction and increases exit NR
|
||||
destination.duration += source.duration;
|
||||
destination.distance += source.distance;
|
||||
|
||||
destination.maneuver.exit = source.maneuver.exit;
|
||||
if (destination.geometry_begin < source.geometry_begin)
|
||||
{
|
||||
destination.intersections.insert(destination.intersections.end(),
|
||||
@@ -136,8 +136,6 @@ RouteStep forwardInto(RouteStep destination, const RouteStep &source)
|
||||
|
||||
destination.geometry_begin = std::min(destination.geometry_begin, source.geometry_begin);
|
||||
destination.geometry_end = std::max(destination.geometry_end, source.geometry_end);
|
||||
destination.maneuver.exit = destination.intersections.size() - 1;
|
||||
|
||||
return destination;
|
||||
}
|
||||
|
||||
@@ -150,7 +148,6 @@ void fixFinalRoundabout(std::vector<RouteStep> &steps)
|
||||
if (entersRoundabout(propagation_step.maneuver.instruction))
|
||||
{
|
||||
propagation_step.maneuver.exit = 0;
|
||||
propagation_step.geometry_end = steps.back().geometry_begin;
|
||||
|
||||
// remember the current name as rotary name in tha case we end in a rotary
|
||||
if (propagation_step.maneuver.instruction.type == TurnType::EnterRotary ||
|
||||
@@ -235,7 +232,12 @@ void closeOffRoundabout(const bool on_roundabout,
|
||||
steps[1].maneuver.instruction.type == TurnType::Suppressed ||
|
||||
steps[1].maneuver.instruction.type == TurnType::NoTurn);
|
||||
steps[0].geometry_end = 1;
|
||||
steps[1].geometry_begin = 0;
|
||||
steps[1] = forwardInto(steps[1], steps[0]);
|
||||
steps[1].intersections.erase(steps[1].intersections.begin()); // otherwise we copy the
|
||||
// source
|
||||
if (leavesRoundabout(steps[1].maneuver.instruction))
|
||||
steps[1].maneuver.exit = 1;
|
||||
steps[0].duration = 0;
|
||||
steps[0].distance = 0;
|
||||
const auto exitToEnter = [](const TurnType::Enum type) {
|
||||
@@ -273,7 +275,6 @@ void closeOffRoundabout(const bool on_roundabout,
|
||||
if (entersRoundabout(propagation_step.maneuver.instruction))
|
||||
{
|
||||
propagation_step.maneuver.exit = step.maneuver.exit;
|
||||
propagation_step.geometry_end = step.geometry_end;
|
||||
const auto entry_intersection = propagation_step.intersections.front();
|
||||
|
||||
// remember rotary name
|
||||
@@ -303,8 +304,10 @@ void closeOffRoundabout(const bool on_roundabout,
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_ASSERT(propagation_step.maneuver.instruction.type =
|
||||
TurnType::StayOnRoundabout);
|
||||
BOOST_ASSERT(propagation_step.maneuver.instruction.type ==
|
||||
TurnType::StayOnRoundabout ||
|
||||
propagation_step.maneuver.instruction.type == TurnType::Suppressed ||
|
||||
propagation_step.maneuver.instruction.type == TurnType::NoTurn);
|
||||
propagation_step.maneuver.instruction =
|
||||
TurnInstruction::NO_TURN(); // mark intermediate instructions invalid
|
||||
}
|
||||
@@ -441,7 +444,6 @@ void collapseTurnAt(std::vector<RouteStep> &steps,
|
||||
current_step.intersections.front()
|
||||
.bearings[current_step.intersections.front().out]) &&
|
||||
compatible(one_back_step, current_step))
|
||||
|
||||
{
|
||||
BOOST_ASSERT(two_back_index < steps.size());
|
||||
// the simple case is a u-turn that changes directly into the in-name again
|
||||
@@ -552,12 +554,10 @@ std::vector<RouteStep> postProcess(std::vector<RouteStep> steps)
|
||||
}
|
||||
else if (leavesRoundabout(instruction))
|
||||
{
|
||||
if (!has_entered_roundabout)
|
||||
{
|
||||
// in case the we are not on a roundabout, the very first instruction
|
||||
// after the depart will be transformed into a roundabout and become
|
||||
// the first valid instruction
|
||||
}
|
||||
// if (!has_entered_roundabout)
|
||||
// in case the we are not on a roundabout, the very first instruction
|
||||
// after the depart will be transformed into a roundabout and become
|
||||
// the first valid instruction
|
||||
closeOffRoundabout(has_entered_roundabout, steps, step_index);
|
||||
has_entered_roundabout = false;
|
||||
on_roundabout = false;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "extractor/guidance/classification_data.hpp"
|
||||
#include "extractor/guidance/constants.hpp"
|
||||
#include "extractor/guidance/turn_analysis.hpp"
|
||||
#include "extractor/guidance/classification_data.hpp"
|
||||
|
||||
#include "util/coordinate.hpp"
|
||||
#include "util/coordinate_calculation.hpp"
|
||||
@@ -133,14 +133,12 @@ TurnAnalysis::setTurnTypes(const NodeID from_nid, const EdgeID, Intersection int
|
||||
Intersection TurnAnalysis::handleSliproads(const EdgeID source_edge_id,
|
||||
Intersection intersection) const
|
||||
{
|
||||
|
||||
auto intersection_node_id = node_based_graph.GetTarget(source_edge_id);
|
||||
|
||||
const auto linkTest = [this](const ConnectedRoad &road) {
|
||||
return // isLinkClass(
|
||||
// node_based_graph.GetEdgeData(road.turn.eid).road_classification.road_class) &&
|
||||
!node_based_graph.GetEdgeData(road.turn.eid).roundabout && road.entry_allowed &&
|
||||
angularDeviation(road.turn.angle, STRAIGHT_ANGLE) <= 2 * NARROW_TURN_ANGLE;
|
||||
return !node_based_graph.GetEdgeData(road.turn.eid).roundabout && road.entry_allowed &&
|
||||
angularDeviation(road.turn.angle, STRAIGHT_ANGLE) <= 2 * NARROW_TURN_ANGLE &&
|
||||
!hasRoundaboutType(road.turn.instruction);
|
||||
};
|
||||
|
||||
bool hasNarrow =
|
||||
|
||||
Reference in New Issue
Block a user