do not emit turns on ferries
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "extractor/guidance/intersection_handler.hpp"
|
||||
#include "extractor/guidance/constants.hpp"
|
||||
#include "extractor/travel_mode.hpp"
|
||||
|
||||
#include "util/coordinate_calculation.hpp"
|
||||
#include "util/guidance/name_announcements.hpp"
|
||||
@@ -326,8 +327,10 @@ void IntersectionHandler::assignTrivialTurns(const EdgeID via_eid,
|
||||
{
|
||||
for (std::size_t index = begin; index != end; ++index)
|
||||
if (intersection[index].entry_allowed)
|
||||
{
|
||||
intersection[index].instruction = {findBasicTurnType(via_eid, intersection[index]),
|
||||
getTurnDirection(intersection[index].angle)};
|
||||
}
|
||||
}
|
||||
|
||||
bool IntersectionHandler::isThroughStreet(const std::size_t index,
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
#include "extractor/guidance/constants.hpp"
|
||||
#include "extractor/guidance/suppress_mode_handler.hpp"
|
||||
#include "extractor/travel_mode.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace extractor
|
||||
{
|
||||
namespace guidance
|
||||
{
|
||||
|
||||
SuppressModeHandler::SuppressModeHandler(const IntersectionGenerator &intersection_generator,
|
||||
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||
const std::vector<QueryNode> &node_info_list,
|
||||
const util::NameTable &name_table,
|
||||
const SuffixTable &street_name_suffix_table)
|
||||
: IntersectionHandler(node_based_graph,
|
||||
node_info_list,
|
||||
name_table,
|
||||
street_name_suffix_table,
|
||||
intersection_generator)
|
||||
{
|
||||
}
|
||||
|
||||
// travel modes for which navigation should be suppressed
|
||||
const SuppressModeHandler::SuppressModeListT constexpr SUPPRESS_MODE_LIST = {
|
||||
{TRAVEL_MODE_TRAIN, TRAVEL_MODE_FERRY}};
|
||||
|
||||
bool SuppressModeHandler::canProcess(const NodeID /*nid*/,
|
||||
const EdgeID via_eid,
|
||||
const Intersection &intersection) const
|
||||
{
|
||||
// if the approach way is not on the suppression blacklist, and not all the exit ways share that mode,
|
||||
// there are no ways to suppress by this criteria
|
||||
const auto in_mode = node_based_graph.GetEdgeData(via_eid).travel_mode;
|
||||
const auto suppress_in_mode =
|
||||
std::find(begin(SUPPRESS_MODE_LIST), end(SUPPRESS_MODE_LIST), in_mode);
|
||||
|
||||
auto Begin = begin(intersection) + 1;
|
||||
auto End = end(intersection);
|
||||
const auto all_share_mode = std::all_of(Begin, End, [this, &in_mode](const ConnectedRoad &way) {
|
||||
return node_based_graph.GetEdgeData(way.eid).travel_mode == in_mode;
|
||||
});
|
||||
|
||||
return (suppress_in_mode != end(SUPPRESS_MODE_LIST)) && all_share_mode;
|
||||
}
|
||||
|
||||
Intersection SuppressModeHandler::
|
||||
operator()(const NodeID nid, const EdgeID via_eid, Intersection intersection) const
|
||||
{
|
||||
const auto suppress_all = SuppressModeHandler::canProcess(nid, via_eid, intersection);
|
||||
if (suppress_all)
|
||||
{
|
||||
std::for_each(begin(intersection) + 1, end(intersection), [&](ConnectedRoad &out_way) {
|
||||
out_way.instruction = {TurnType::Suppressed, getTurnDirection(out_way.angle)};
|
||||
});
|
||||
}
|
||||
|
||||
return intersection;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "extractor/guidance/turn_analysis.hpp"
|
||||
#include "extractor/guidance/constants.hpp"
|
||||
#include "extractor/guidance/road_classification.hpp"
|
||||
#include "extractor/guidance/turn_analysis.hpp"
|
||||
|
||||
#include "util/coordinate.hpp"
|
||||
#include "util/coordinate_calculation.hpp"
|
||||
@@ -65,7 +65,12 @@ TurnAnalysis::TurnAnalysis(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||
node_based_graph,
|
||||
node_info_list,
|
||||
name_table,
|
||||
street_name_suffix_table)
|
||||
street_name_suffix_table),
|
||||
suppress_mode_handler(intersection_generator,
|
||||
node_based_graph,
|
||||
node_info_list,
|
||||
name_table,
|
||||
street_name_suffix_table)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -106,6 +111,16 @@ Intersection TurnAnalysis::AssignTurnTypes(const NodeID node_prior_to_intersecti
|
||||
{TurnType::Invalid, DirectionModifier::UTurn},
|
||||
INVALID_LANE_DATAID);
|
||||
});
|
||||
// Suppress turns on ways between mode types that do not need guidance
|
||||
if (suppress_mode_handler.canProcess(
|
||||
node_prior_to_intersection, entering_via_edge, intersection))
|
||||
{
|
||||
intersection = suppress_mode_handler(
|
||||
node_prior_to_intersection, entering_via_edge, std::move(intersection));
|
||||
|
||||
return intersection;
|
||||
}
|
||||
|
||||
if (roundabout_handler.canProcess(node_prior_to_intersection, entering_via_edge, intersection))
|
||||
{
|
||||
intersection = roundabout_handler(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "extractor/guidance/turn_handler.hpp"
|
||||
#include "extractor/guidance/constants.hpp"
|
||||
#include "extractor/guidance/turn_handler.hpp"
|
||||
|
||||
#include "util/bearing.hpp"
|
||||
#include "util/guidance/name_announcements.hpp"
|
||||
@@ -151,6 +151,7 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection
|
||||
\
|
||||
OOOOOOO
|
||||
*/
|
||||
|
||||
const auto fork_range = findFork(via_edge, intersection);
|
||||
if (fork_range.first == 1 && fork_range.second == 2 && obvious_index == 0)
|
||||
assignFork(via_edge, intersection[2], intersection[1]);
|
||||
|
||||
Reference in New Issue
Block a user