add assert for untested sliproad cases, removed redundant empty_nameid checks
This commit is contained in:
parent
4166b1ebbf
commit
9a8ed30e95
@ -1,6 +1,5 @@
|
|||||||
#ifndef OSRM_ENGINE_GUIDANCE_COLLAPSE_HPP
|
#ifndef OSRM_ENGINE_GUIDANCE_COLLAPSE_HPP
|
||||||
|
|
||||||
#include "engine/datafacade/datafacade_base.hpp"
|
|
||||||
#include "engine/guidance/route_step.hpp"
|
#include "engine/guidance/route_step.hpp"
|
||||||
#include "util/attributes.hpp"
|
#include "util/attributes.hpp"
|
||||||
|
|
||||||
|
@ -490,8 +490,8 @@ bool IntersectionHandler::isSameName(const EdgeID source_edge_id, const EdgeID t
|
|||||||
const auto &target_edge_data = node_data_container.GetAnnotation(
|
const auto &target_edge_data = node_data_container.GetAnnotation(
|
||||||
node_based_graph.GetEdgeData(target_edge_id).annotation_data);
|
node_based_graph.GetEdgeData(target_edge_id).annotation_data);
|
||||||
|
|
||||||
return source_edge_data.name_id != EMPTY_NAMEID && //
|
return !name_table.GetNameForID(source_edge_data.name_id).empty() && //
|
||||||
target_edge_data.name_id != EMPTY_NAMEID && //
|
!name_table.GetNameForID(target_edge_data.name_id).empty() && //
|
||||||
!util::guidance::requiresNameAnnounced(source_edge_data.name_id,
|
!util::guidance::requiresNameAnnounced(source_edge_data.name_id,
|
||||||
target_edge_data.name_id,
|
target_edge_data.name_id,
|
||||||
name_table,
|
name_table,
|
||||||
|
@ -38,8 +38,6 @@ inline auto makeCheckRoadForName(const NameID name_id,
|
|||||||
node_data_container
|
node_data_container
|
||||||
.GetAnnotation(node_based_graph.GetEdgeData(road.eid).annotation_data)
|
.GetAnnotation(node_based_graph.GetEdgeData(road.eid).annotation_data)
|
||||||
.name_id;
|
.name_id;
|
||||||
if (name_id == EMPTY_NAMEID || road_name_id == EMPTY_NAMEID)
|
|
||||||
return true;
|
|
||||||
const auto road_name_empty = name_table.GetNameForID(road_name_id).empty();
|
const auto road_name_empty = name_table.GetNameForID(road_name_id).empty();
|
||||||
const auto in_name_empty = name_table.GetNameForID(name_id).empty();
|
const auto in_name_empty = name_table.GetNameForID(name_id).empty();
|
||||||
if (in_name_empty || road_name_empty)
|
if (in_name_empty || road_name_empty)
|
||||||
@ -470,16 +468,12 @@ bool MergableRoadDetector::IsTrafficIsland(const NodeID intersection_node,
|
|||||||
node_data_container
|
node_data_container
|
||||||
.GetAnnotation(node_based_graph.GetEdgeData(range.front()).annotation_data)
|
.GetAnnotation(node_based_graph.GetEdgeData(range.front()).annotation_data)
|
||||||
.name_id;
|
.name_id;
|
||||||
if (required_name_id == EMPTY_NAMEID)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const auto has_required_name = [this, required_name_id](const auto edge_id) {
|
const auto has_required_name = [this, required_name_id](const auto edge_id) {
|
||||||
const auto road_name_id =
|
const auto road_name_id =
|
||||||
node_data_container
|
node_data_container
|
||||||
.GetAnnotation(node_based_graph.GetEdgeData(edge_id).annotation_data)
|
.GetAnnotation(node_based_graph.GetEdgeData(edge_id).annotation_data)
|
||||||
.name_id;
|
.name_id;
|
||||||
if (road_name_id == EMPTY_NAMEID)
|
|
||||||
return false;
|
|
||||||
const auto &road_name_empty = name_table.GetNameForID(road_name_id).empty();
|
const auto &road_name_empty = name_table.GetNameForID(road_name_id).empty();
|
||||||
const auto &required_name_empty = name_table.GetNameForID(required_name_id).empty();
|
const auto &required_name_empty = name_table.GetNameForID(required_name_id).empty();
|
||||||
if (required_name_empty && road_name_empty)
|
if (required_name_empty && road_name_empty)
|
||||||
|
@ -361,120 +361,111 @@ Intersection MotorwayHandler::fromRamp(const EdgeID via_eid, Intersection inters
|
|||||||
node_based_graph.GetEdgeData(intersection[2].eid).annotation_data);
|
node_based_graph.GetEdgeData(intersection[2].eid).annotation_data);
|
||||||
const auto &first_intersection_data = node_data_container.GetAnnotation(
|
const auto &first_intersection_data = node_data_container.GetAnnotation(
|
||||||
node_based_graph.GetEdgeData(intersection[1].eid).annotation_data);
|
node_based_graph.GetEdgeData(intersection[1].eid).annotation_data);
|
||||||
if (first_intersection_data.name_id == EMPTY_NAMEID ||
|
const auto first_second_same_name =
|
||||||
second_intersection_data.name_id == EMPTY_NAMEID)
|
!util::guidance::requiresNameAnnounced(second_intersection_data.name_id,
|
||||||
{
|
first_intersection_data.name_id,
|
||||||
return fallback(std::move(intersection));
|
name_table,
|
||||||
}
|
street_name_suffix_table);
|
||||||
else
|
|
||||||
{
|
|
||||||
const auto first_second_same_name =
|
|
||||||
!util::guidance::requiresNameAnnounced(second_intersection_data.name_id,
|
|
||||||
first_intersection_data.name_id,
|
|
||||||
name_table,
|
|
||||||
street_name_suffix_table);
|
|
||||||
|
|
||||||
// merging onto a passing highway / or two ramps merging onto the same highway
|
// merging onto a passing highway / or two ramps merging onto the same highway
|
||||||
if (num_valid_turns == 1)
|
if (num_valid_turns == 1)
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(!intersection[0].entry_allowed);
|
||||||
|
// check order of highways
|
||||||
|
// 4
|
||||||
|
// 5 3
|
||||||
|
//
|
||||||
|
// 6 2
|
||||||
|
//
|
||||||
|
// 7 1
|
||||||
|
// 0
|
||||||
|
const auto &first_intersection_name_empty =
|
||||||
|
name_table.GetNameForID(first_intersection_data.name_id).empty();
|
||||||
|
const auto &second_intersection_name_empty =
|
||||||
|
name_table.GetNameForID(second_intersection_data.name_id).empty();
|
||||||
|
if (intersection[1].entry_allowed)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(!intersection[0].entry_allowed);
|
if (isMotorwayClass(intersection[1].eid, node_based_graph) &&
|
||||||
// check order of highways
|
!second_intersection_name_empty && !first_intersection_name_empty &&
|
||||||
// 4
|
first_second_same_name)
|
||||||
// 5 3
|
|
||||||
//
|
|
||||||
// 6 2
|
|
||||||
//
|
|
||||||
// 7 1
|
|
||||||
// 0
|
|
||||||
const auto &first_intersection_name_empty =
|
|
||||||
name_table.GetNameForID(first_intersection_data.name_id).empty();
|
|
||||||
const auto &second_intersection_name_empty =
|
|
||||||
name_table.GetNameForID(second_intersection_data.name_id).empty();
|
|
||||||
if (intersection[1].entry_allowed)
|
|
||||||
{
|
{
|
||||||
if (isMotorwayClass(intersection[1].eid, node_based_graph) &&
|
// circular order indicates a merge to the left (0-3 onto 4
|
||||||
!second_intersection_name_empty && !first_intersection_name_empty &&
|
if (angularDeviation(intersection[1].angle, STRAIGHT_ANGLE) <
|
||||||
first_second_same_name)
|
2 * NARROW_TURN_ANGLE)
|
||||||
{
|
intersection[1].instruction = {TurnType::Merge,
|
||||||
// circular order indicates a merge to the left (0-3 onto 4
|
DirectionModifier::SlightLeft};
|
||||||
if (angularDeviation(intersection[1].angle, STRAIGHT_ANGLE) <
|
else // fallback
|
||||||
2 * NARROW_TURN_ANGLE)
|
intersection[1].instruction = {TurnType::Merge,
|
||||||
intersection[1].instruction = {TurnType::Merge,
|
getTurnDirection(intersection[1].angle)};
|
||||||
DirectionModifier::SlightLeft};
|
|
||||||
else // fallback
|
|
||||||
intersection[1].instruction = {TurnType::Merge,
|
|
||||||
getTurnDirection(intersection[1].angle)};
|
|
||||||
}
|
|
||||||
else // passing by the end of a motorway
|
|
||||||
{
|
|
||||||
intersection[1].instruction =
|
|
||||||
getInstructionForObvious(intersection.size(),
|
|
||||||
via_eid,
|
|
||||||
isThroughStreet(1, intersection),
|
|
||||||
intersection[1]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else // passing by the end of a motorway
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(intersection[2].entry_allowed);
|
intersection[1].instruction =
|
||||||
if (isMotorwayClass(intersection[2].eid, node_based_graph) &&
|
getInstructionForObvious(intersection.size(),
|
||||||
!second_intersection_name_empty && !first_intersection_name_empty &&
|
via_eid,
|
||||||
first_second_same_name)
|
isThroughStreet(1, intersection),
|
||||||
{
|
intersection[1]);
|
||||||
// circular order (5-0) onto 4
|
|
||||||
if (angularDeviation(intersection[2].angle, STRAIGHT_ANGLE) <
|
|
||||||
2 * NARROW_TURN_ANGLE)
|
|
||||||
intersection[2].instruction = {TurnType::Merge,
|
|
||||||
DirectionModifier::SlightRight};
|
|
||||||
else // fallback
|
|
||||||
intersection[2].instruction = {TurnType::Merge,
|
|
||||||
getTurnDirection(intersection[2].angle)};
|
|
||||||
}
|
|
||||||
else // passing the end of a highway
|
|
||||||
{
|
|
||||||
intersection[2].instruction =
|
|
||||||
getInstructionForObvious(intersection.size(),
|
|
||||||
via_eid,
|
|
||||||
isThroughStreet(2, intersection),
|
|
||||||
intersection[2]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(num_valid_turns == 2);
|
|
||||||
// UTurn on ramps is not possible
|
|
||||||
BOOST_ASSERT(!intersection[0].entry_allowed);
|
|
||||||
BOOST_ASSERT(intersection[1].entry_allowed);
|
|
||||||
BOOST_ASSERT(intersection[2].entry_allowed);
|
BOOST_ASSERT(intersection[2].entry_allowed);
|
||||||
// two motorways starting at end of ramp (fork)
|
if (isMotorwayClass(intersection[2].eid, node_based_graph) &&
|
||||||
// M M
|
!second_intersection_name_empty && !first_intersection_name_empty &&
|
||||||
// \ /
|
first_second_same_name)
|
||||||
// |
|
|
||||||
// R
|
|
||||||
if (isMotorwayClass(intersection[1].eid, node_based_graph) &&
|
|
||||||
isMotorwayClass(intersection[2].eid, node_based_graph))
|
|
||||||
{
|
{
|
||||||
assignFork(via_eid, intersection[2], intersection[1]);
|
// circular order (5-0) onto 4
|
||||||
|
if (angularDeviation(intersection[2].angle, STRAIGHT_ANGLE) <
|
||||||
|
2 * NARROW_TURN_ANGLE)
|
||||||
|
intersection[2].instruction = {TurnType::Merge,
|
||||||
|
DirectionModifier::SlightRight};
|
||||||
|
else // fallback
|
||||||
|
intersection[2].instruction = {TurnType::Merge,
|
||||||
|
getTurnDirection(intersection[2].angle)};
|
||||||
|
}
|
||||||
|
else // passing the end of a highway
|
||||||
|
{
|
||||||
|
intersection[2].instruction =
|
||||||
|
getInstructionForObvious(intersection.size(),
|
||||||
|
via_eid,
|
||||||
|
isThroughStreet(2, intersection),
|
||||||
|
intersection[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(num_valid_turns == 2);
|
||||||
|
// UTurn on ramps is not possible
|
||||||
|
BOOST_ASSERT(!intersection[0].entry_allowed);
|
||||||
|
BOOST_ASSERT(intersection[1].entry_allowed);
|
||||||
|
BOOST_ASSERT(intersection[2].entry_allowed);
|
||||||
|
// two motorways starting at end of ramp (fork)
|
||||||
|
// M M
|
||||||
|
// \ /
|
||||||
|
// |
|
||||||
|
// R
|
||||||
|
if (isMotorwayClass(intersection[1].eid, node_based_graph) &&
|
||||||
|
isMotorwayClass(intersection[2].eid, node_based_graph))
|
||||||
|
{
|
||||||
|
assignFork(via_eid, intersection[2], intersection[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// continued ramp passing motorway entry
|
||||||
|
// M R
|
||||||
|
// M R
|
||||||
|
// | /
|
||||||
|
// R
|
||||||
|
if (isMotorwayClass(intersection[1].eid, node_based_graph))
|
||||||
|
{
|
||||||
|
intersection[1].instruction = {TurnType::Turn, DirectionModifier::SlightRight};
|
||||||
|
intersection[2].instruction = {TurnType::Continue,
|
||||||
|
DirectionModifier::SlightLeft};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// continued ramp passing motorway entry
|
assignFork(via_eid, intersection[2], intersection[1]);
|
||||||
// M R
|
|
||||||
// M R
|
|
||||||
// | /
|
|
||||||
// R
|
|
||||||
if (isMotorwayClass(intersection[1].eid, node_based_graph))
|
|
||||||
{
|
|
||||||
intersection[1].instruction = {TurnType::Turn,
|
|
||||||
DirectionModifier::SlightRight};
|
|
||||||
intersection[2].instruction = {TurnType::Continue,
|
|
||||||
DirectionModifier::SlightLeft};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
assignFork(via_eid, intersection[2], intersection[1]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,22 +295,17 @@ RoundaboutType RoundaboutHandler::getRoundaboutType(const NodeID nid) const
|
|||||||
return SPECIAL_EDGEID;
|
return SPECIAL_EDGEID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (edge_data.name_id != EMPTY_NAMEID)
|
const auto &edge_name_empty = name_table.GetNameForID(edge_data.name_id).empty();
|
||||||
|
if (!edge_name_empty)
|
||||||
{
|
{
|
||||||
const auto &edge_name_empty =
|
|
||||||
name_table.GetNameForID(edge_data.name_id).empty();
|
|
||||||
if (!edge_name_empty)
|
|
||||||
{
|
|
||||||
|
|
||||||
const auto announce = [&](unsigned id) {
|
const auto announce = [&](unsigned id) {
|
||||||
return util::guidance::requiresNameAnnounced(
|
return util::guidance::requiresNameAnnounced(
|
||||||
id, edge_data.name_id, name_table, street_name_suffix_table);
|
id, edge_data.name_id, name_table, street_name_suffix_table);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (std::all_of(
|
if (std::all_of(begin(roundabout_name_ids), end(roundabout_name_ids), announce))
|
||||||
begin(roundabout_name_ids), end(roundabout_name_ids), announce))
|
roundabout_name_ids.insert(edge_data.name_id);
|
||||||
roundabout_name_ids.insert(edge_data.name_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
continue_edge = edge_id;
|
continue_edge = edge_id;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "extractor/guidance/sliproad_handler.hpp"
|
#include "extractor/guidance/sliproad_handler.hpp"
|
||||||
#include "extractor/guidance/constants.hpp"
|
#include "extractor/guidance/constants.hpp"
|
||||||
|
#include "util/assert.hpp"
|
||||||
#include "util/bearing.hpp"
|
#include "util/bearing.hpp"
|
||||||
#include "util/coordinate_calculation.hpp"
|
#include "util/coordinate_calculation.hpp"
|
||||||
#include "util/guidance/name_announcements.hpp"
|
#include "util/guidance/name_announcements.hpp"
|
||||||
@ -474,8 +475,7 @@ operator()(const NodeID /*nid*/, const EdgeID source_edge_id, Intersection inter
|
|||||||
|
|
||||||
// Name mismatch: check roads at `c` and `d` for same name
|
// Name mismatch: check roads at `c` and `d` for same name
|
||||||
const auto name_mismatch = [&](const NameID road_name_id) {
|
const auto name_mismatch = [&](const NameID road_name_id) {
|
||||||
const auto unnamed =
|
const auto unnamed = name_table.GetNameForID(road_name_id).empty();
|
||||||
road_name_id == EMPTY_NAMEID || name_table.GetNameForID(road_name_id).empty();
|
|
||||||
|
|
||||||
return unnamed ||
|
return unnamed ||
|
||||||
util::guidance::requiresNameAnnounced(road_name_id, //
|
util::guidance::requiresNameAnnounced(road_name_id, //
|
||||||
@ -500,15 +500,12 @@ operator()(const NodeID /*nid*/, const EdgeID source_edge_id, Intersection inter
|
|||||||
node_data_container
|
node_data_container
|
||||||
.GetAnnotation(node_based_graph.GetEdgeData(main_road.eid).annotation_data)
|
.GetAnnotation(node_based_graph.GetEdgeData(main_road.eid).annotation_data)
|
||||||
.name_id;
|
.name_id;
|
||||||
const auto main_road_name_empty = main_road_name_id == EMPTY_NAMEID ||
|
const auto main_road_name_empty = name_table.GetNameForID(main_road_name_id).empty();
|
||||||
name_table.GetNameForID(main_road_name_id).empty();
|
|
||||||
const auto &sliproad_annotation =
|
const auto &sliproad_annotation =
|
||||||
node_data_container.GetAnnotation(sliproad_edge_data.annotation_data);
|
node_data_container.GetAnnotation(sliproad_edge_data.annotation_data);
|
||||||
const auto sliproad_name_empty =
|
const auto sliproad_name_empty =
|
||||||
sliproad_annotation.name_id == EMPTY_NAMEID ||
|
|
||||||
name_table.GetNameForID(sliproad_annotation.name_id).empty();
|
name_table.GetNameForID(sliproad_annotation.name_id).empty();
|
||||||
const auto candidate_road_name_empty =
|
const auto candidate_road_name_empty =
|
||||||
candidate_data.name_id == EMPTY_NAMEID ||
|
|
||||||
name_table.GetNameForID(candidate_data.name_id).empty();
|
name_table.GetNameForID(candidate_data.name_id).empty();
|
||||||
if (!sliproad_edge_data.flags.road_classification.IsLinkClass() &&
|
if (!sliproad_edge_data.flags.road_classification.IsLinkClass() &&
|
||||||
!sliproad_name_empty && !main_road_name_empty && !candidate_road_name_empty &&
|
!sliproad_name_empty && !main_road_name_empty && !candidate_road_name_empty &&
|
||||||
@ -583,8 +580,9 @@ operator()(const NodeID /*nid*/, const EdgeID source_edge_id, Intersection inter
|
|||||||
intersection[*obvious].instruction.direction_modifier =
|
intersection[*obvious].instruction.direction_modifier =
|
||||||
getTurnDirection(intersection[*obvious].angle);
|
getTurnDirection(intersection[*obvious].angle);
|
||||||
}
|
}
|
||||||
else if (main_annotation.name_id != EMPTY_NAMEID)
|
else if (!name_table.GetNameForID(main_annotation.name_id).empty())
|
||||||
{
|
{
|
||||||
|
OSRM_ASSERT(false, coordinates[intersection_node_id]);
|
||||||
intersection[*obvious].instruction.type = TurnType::NewName;
|
intersection[*obvious].instruction.type = TurnType::NewName;
|
||||||
intersection[*obvious].instruction.direction_modifier =
|
intersection[*obvious].instruction.direction_modifier =
|
||||||
getTurnDirection(intersection[*obvious].angle);
|
getTurnDirection(intersection[*obvious].angle);
|
||||||
|
@ -199,8 +199,7 @@ bool TurnHandler::isObviousOfTwo(const EdgeID via_edge,
|
|||||||
|
|
||||||
const bool turn_is_perfectly_straight =
|
const bool turn_is_perfectly_straight =
|
||||||
angularDeviation(road.angle, STRAIGHT_ANGLE) < std::numeric_limits<double>::epsilon();
|
angularDeviation(road.angle, STRAIGHT_ANGLE) < std::numeric_limits<double>::epsilon();
|
||||||
const auto &via_name_empty =
|
const auto &via_name_empty = name_table.GetNameForID(via_data.name_id).empty();
|
||||||
via_data.name_id == EMPTY_NAMEID || name_table.GetNameForID(via_data.name_id).empty();
|
|
||||||
if (!via_name_empty)
|
if (!via_name_empty)
|
||||||
{
|
{
|
||||||
const auto same_name = !util::guidance::requiresNameAnnounced(
|
const auto same_name = !util::guidance::requiresNameAnnounced(
|
||||||
|
Loading…
Reference in New Issue
Block a user