Distinguish between offramps and sliproads.

This commit is contained in:
Daniel Patterson
2016-05-25 15:24:11 +02:00
committed by Patrick Niklaus
parent 089e60fa1e
commit 3d03797e53
13 changed files with 428 additions and 114 deletions
@@ -47,6 +47,17 @@ inline bool isRampClass(const FunctionalRoadClass road_class)
road_class == FunctionalRoadClass::TRUNK_LINK;
}
// Links are usually smaller than ramps, but are sometimes tagged
// as MOTORWAY_LINK if they exit/enter a motorway/trunk road.
inline bool isLinkClass(const FunctionalRoadClass road_class)
{
return road_class == FunctionalRoadClass::MOTORWAY_LINK ||
road_class == FunctionalRoadClass::TRUNK_LINK ||
road_class == FunctionalRoadClass::PRIMARY_LINK ||
road_class == FunctionalRoadClass::SECONDARY_LINK ||
road_class == FunctionalRoadClass::TERTIARY_LINK;
}
// TODO augment this with all data required for guidance generation
struct RoadClassificationData
{
+3 -1
View File
@@ -22,10 +22,12 @@ const double constexpr FUZZY_ANGLE_DIFFERENCE = 20.;
const double constexpr DISTINCTION_RATIO = 2;
const unsigned constexpr INVALID_NAME_ID = 0;
const double constexpr MAX_ROUNDABOUT_INTERSECTION_RADIUS = 5;
const double constexpr MAX_ROUNDABOUT_INTERSECTION_RADIUS = 5;
const double constexpr MAX_ROUNDABOUT_RADIUS = 15; // 30 m diameter as final distinction
const double constexpr INCREASES_BY_FOURTY_PERCENT = 1.4;
const unsigned constexpr MAX_SLIPROAD_THRESHOLD = 250;
} // namespace guidance
} // namespace extractor
} // namespace osrm
@@ -2,6 +2,7 @@
#define OSRM_EXTRACTOR_GUIDANCE_MOTORWAY_HANDLER_HPP_
#include "extractor/guidance/intersection.hpp"
#include "extractor/guidance/intersection_generator.hpp"
#include "extractor/guidance/intersection_handler.hpp"
#include "extractor/query_node.hpp"
@@ -25,7 +26,8 @@ class MotorwayHandler : public IntersectionHandler
MotorwayHandler(const util::NodeBasedDynamicGraph &node_based_graph,
const std::vector<QueryNode> &node_info_list,
const util::NameTable &name_table,
const SuffixTable &street_name_suffix_table);
const SuffixTable &street_name_suffix_table,
const IntersectionGenerator &intersection_generator);
~MotorwayHandler() override final;
// check whether the handler can actually handle the intersection
@@ -39,10 +41,14 @@ class MotorwayHandler : public IntersectionHandler
Intersection intersection) const override final;
private:
Intersection handleSliproads(const NodeID intersection_node_id,
Intersection intersection) const;
Intersection fromMotorway(const EdgeID via_edge, Intersection intersection) const;
Intersection fromRamp(const EdgeID via_edge, Intersection intersection) const;
Intersection fallback(Intersection intersection) const;
const IntersectionGenerator &intersection_generator;
};
} // namespace guidance
@@ -59,6 +59,9 @@ class TurnAnalysis
// Utility function, setting basic turn types. Prepares for normal turn handling.
Intersection
setTurnTypes(const NodeID from, const EdgeID via_edge, Intersection intersection) const;
Intersection handleSliproads(const NodeID intersection_node_id,
Intersection intersection) const;
}; // class TurnAnalysis
} // namespace guidance
+34 -29
View File
@@ -20,7 +20,6 @@ namespace detail
const constexpr uint8_t num_direction_modifiers = 8;
} // detail
// direction modifiers based on angle
namespace DirectionModifier
{
@@ -38,31 +37,36 @@ const constexpr Enum SharpLeft = 7;
namespace TurnType
{
typedef std::uint8_t Enum;
const constexpr Enum Invalid = 0; // no valid turn instruction
const constexpr Enum NewName = 1; // no turn, but name changes
const constexpr Enum Continue = 2; // remain on a street
const constexpr Enum Turn = 3; // basic turn
const constexpr Enum Merge = 4; // merge onto a street
const constexpr Enum OnRamp = 5; // special turn (highway ramp on-ramps)
const constexpr Enum OffRamp = 6; // special turn, highway exit
const constexpr Enum Fork = 7; // fork road splitting up
const constexpr Enum EndOfRoad = 8; // T intersection
const constexpr Enum Notification = 9; // Travel Mode Changes, Restrictions apply...
const constexpr Enum EnterRoundabout = 10; // Entering a small Roundabout
const constexpr Enum EnterAndExitRoundabout = 11; // Touching a roundabout
const constexpr Enum EnterRotary = 12; // Enter a rotary
const constexpr Enum EnterAndExitRotary = 13; // Touching a rotary
const constexpr Enum EnterRoundaboutIntersection = 14; // Entering a small Roundabout
const constexpr Enum Invalid = 0; // no valid turn instruction
const constexpr Enum NewName = 1; // no turn, but name changes
const constexpr Enum Continue = 2; // remain on a street
const constexpr Enum Turn = 3; // basic turn
const constexpr Enum Merge = 4; // merge onto a street
const constexpr Enum OnRamp = 5; // special turn (highway ramp on-ramps)
const constexpr Enum OffRamp = 6; // special turn, highway exit
const constexpr Enum Fork = 7; // fork road splitting up
const constexpr Enum EndOfRoad = 8; // T intersection
const constexpr Enum Notification = 9; // Travel Mode Changes, Restrictions apply...
const constexpr Enum EnterRoundabout = 10; // Entering a small Roundabout
const constexpr Enum EnterAndExitRoundabout = 11; // Touching a roundabout
const constexpr Enum EnterRotary = 12; // Enter a rotary
const constexpr Enum EnterAndExitRotary = 13; // Touching a rotary
const constexpr Enum EnterRoundaboutIntersection = 14; // Entering a small Roundabout
const constexpr Enum EnterAndExitRoundaboutIntersection = 15; // Touching a roundabout
const constexpr Enum NoTurn = 16; // end of segment without turn/middle of a segment
const constexpr Enum Suppressed = 17; // location that suppresses a turn
const constexpr Enum EnterRoundaboutAtExit = 18; // Entering a small Roundabout at a countable exit
const constexpr Enum ExitRoundabout = 19; // Exiting a small Roundabout
const constexpr Enum EnterRotaryAtExit = 20; // Enter A Rotary at a countable exit
const constexpr Enum ExitRotary = 21; // Exit a rotary
const constexpr Enum EnterRoundaboutIntersectionAtExit = 22; // Entering a small Roundabout at a countable exit
const constexpr Enum ExitRoundaboutIntersection = 23; // Exiting a small Roundabout
const constexpr Enum StayOnRoundabout = 24; // Continue on Either a small or a large Roundabout
// Values below here are silent instructions
const constexpr Enum NoTurn = 16; // end of segment without turn/middle of a segment
const constexpr Enum Suppressed = 17; // location that suppresses a turn
const constexpr Enum EnterRoundaboutAtExit = 18; // Entering a small Roundabout at a countable exit
const constexpr Enum ExitRoundabout = 19; // Exiting a small Roundabout
const constexpr Enum EnterRotaryAtExit = 20; // Enter A Rotary at a countable exit
const constexpr Enum ExitRotary = 21; // Exit a rotary
const constexpr Enum EnterRoundaboutIntersectionAtExit =
22; // Entering a small Roundabout at a countable exit
const constexpr Enum ExitRoundaboutIntersection = 23; // Exiting a small Roundabout
const constexpr Enum StayOnRoundabout = 24; // Continue on Either a small or a large Roundabout
const constexpr Enum Sliproad =
25; // Something that looks like a ramp, but is actually just a small sliproad
}
// turn angle in 1.40625 degree -> 128 == 180 degree
@@ -87,7 +91,8 @@ struct TurnInstruction
return TurnInstruction(TurnType::NoTurn, DirectionModifier::UTurn);
}
static TurnInstruction REMAIN_ROUNDABOUT(const RoundaboutType, const DirectionModifier::Enum modifier)
static TurnInstruction REMAIN_ROUNDABOUT(const RoundaboutType,
const DirectionModifier::Enum modifier)
{
return TurnInstruction(TurnType::StayOnRoundabout, modifier);
}
@@ -104,9 +109,9 @@ struct TurnInstruction
static TurnInstruction EXIT_ROUNDABOUT(const RoundaboutType roundabout_type,
const DirectionModifier::Enum modifier)
{
const constexpr TurnType::Enum exit_instruction[] = {TurnType::Invalid, TurnType::ExitRoundabout,
TurnType::ExitRotary,
TurnType::ExitRoundaboutIntersection};
const constexpr TurnType::Enum exit_instruction[] = {
TurnType::Invalid, TurnType::ExitRoundabout, TurnType::ExitRotary,
TurnType::ExitRoundaboutIntersection};
return {exit_instruction[static_cast<int>(roundabout_type)], modifier};
}