improve sliproad / fork handling

This commit is contained in:
Moritz Kobitzsch
2016-07-04 12:19:49 +02:00
committed by Patrick Niklaus
parent 1309dd2a0f
commit 9e323d2d42
17 changed files with 558 additions and 426 deletions
@@ -29,7 +29,8 @@ class IntersectionHandler
const std::vector<QueryNode> &node_info_list,
const util::NameTable &name_table,
const SuffixTable &street_name_suffix_table);
virtual ~IntersectionHandler();
virtual ~IntersectionHandler() = default;
// check whether the handler can actually handle the intersection
virtual bool
@@ -51,6 +52,9 @@ class IntersectionHandler
// Decide on a basic turn types
TurnType::Enum findBasicTurnType(const EdgeID via_edge, const ConnectedRoad &candidate) const;
// Find the most obvious turn to follow
std::size_t findObviousTurn(const EdgeID via_edge, const Intersection &intersection) const;
// Get the Instruction for an obvious turn
TurnInstruction getInstructionForObvious(const std::size_t number_of_candidates,
const EdgeID via_edge,
@@ -10,11 +10,6 @@ namespace extractor
namespace guidance
{
// possible fork
bool isFork(const ConnectedRoad &uturn,
const ConnectedRoad &possible_right_fork,
const ConnectedRoad &possible_left_fork);
// Ending in a T-Intersection
bool isEndOfRoad(const ConnectedRoad &uturn,
const ConnectedRoad &possible_right_turn,
@@ -26,7 +26,8 @@ class MotorwayHandler : public IntersectionHandler
const std::vector<QueryNode> &node_info_list,
const util::NameTable &name_table,
const SuffixTable &street_name_suffix_table);
~MotorwayHandler() override final;
~MotorwayHandler() override final = default;
// check whether the handler can actually handle the intersection
bool canProcess(const NodeID nid,
@@ -44,7 +44,7 @@ class RoundaboutHandler : public IntersectionHandler
const util::NameTable &name_table,
const SuffixTable &street_name_suffix_table);
~RoundaboutHandler() override final;
~RoundaboutHandler() override final = default;
// check whether the handler can actually handle the intersection
bool canProcess(const NodeID from_nid,
@@ -0,0 +1,53 @@
#ifndef OSRM_EXTRACTOR_GUIDANCE_SLIPROAD_HANDLER_HPP_
#define OSRM_EXTRACTOR_GUIDANCE_SLIPROAD_HANDLER_HPP_
#include "extractor/guidance/intersection.hpp"
#include "extractor/guidance/intersection_handler.hpp"
#include "extractor/guidance/intersection_generator.hpp"
#include "extractor/query_node.hpp"
#include "util/name_table.hpp"
#include "util/node_based_graph.hpp"
#include <cstddef>
#include <utility>
#include <vector>
namespace osrm
{
namespace extractor
{
namespace guidance
{
// Intersection handlers deal with all issues related to intersections.
// They assign appropriate turn operations to the TurnOperations.
class SliproadHandler : public IntersectionHandler
{
public:
SliproadHandler(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);
~SliproadHandler() override final = default;
// check whether the handler can actually handle the intersection
bool canProcess(const NodeID /*nid*/,
const EdgeID /*via_eid*/,
const Intersection & /*intersection*/) const override final;
// process the intersection
Intersection operator()(const NodeID nid,
const EdgeID via_eid,
Intersection intersection) const override final;
private:
const IntersectionGenerator &intersection_generator;
};
} // namespace guidance
} // namespace extractor
} // namespace osrm
#endif /*OSRM_EXTRACTOR_GUIDANCE_SLIPROAD_HANDLER_HPP_*/
+1 -1
View File
@@ -428,7 +428,7 @@ inline int getPriority(const FunctionalRoadClass road_class)
// They are used in Fork-Discovery. Possibly should be moved to profiles post v5?
// A fork can happen between road types that are at most 1 priority apart from each other
const constexpr int road_priority[] = {
10, 0, 10, 2, 10, 4, 10, 6, 10, 8, 10, 11, 10, 12, 10, 14};
14, 0, 14, 2, 14, 4, 14, 6, 14, 8, 10, 11, 10, 12, 10, 14};
return road_priority[static_cast<int>(road_class)];
}
+2 -3
View File
@@ -6,6 +6,7 @@
#include "extractor/guidance/intersection_generator.hpp"
#include "extractor/guidance/motorway_handler.hpp"
#include "extractor/guidance/roundabout_handler.hpp"
#include "extractor/guidance/sliproad_handler.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "extractor/guidance/turn_classification.hpp"
#include "extractor/guidance/turn_handler.hpp"
@@ -59,13 +60,11 @@ class TurnAnalysis
const RoundaboutHandler roundabout_handler;
const MotorwayHandler motorway_handler;
const TurnHandler turn_handler;
const SliproadHandler sliproad_handler;
// 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
+6 -3
View File
@@ -28,7 +28,8 @@ class TurnHandler : public IntersectionHandler
const std::vector<QueryNode> &node_info_list,
const util::NameTable &name_table,
const SuffixTable &street_name_suffix_table);
~TurnHandler() override final;
~TurnHandler() override final = default;
// check whether the handler can actually handle the intersection
bool canProcess(const NodeID nid,
@@ -41,6 +42,9 @@ class TurnHandler : public IntersectionHandler
Intersection intersection) const override final;
private:
bool isObviousOfTwo(const EdgeID via_edge,
const ConnectedRoad &road,
const ConnectedRoad &other) const;
// Dead end.
Intersection handleOneWayTurn(Intersection intersection) const;
@@ -57,8 +61,7 @@ class TurnHandler : public IntersectionHandler
handleDistinctConflict(const EdgeID via_edge, ConnectedRoad &left, ConnectedRoad &right) const;
// Classification
std::size_t findObviousTurn(const EdgeID via_edge, const Intersection &intersection) const;
std::pair<std::size_t, std::size_t> findFork(const Intersection &intersection) const;
std::pair<std::size_t, std::size_t> findFork(const EdgeID via_edge, const Intersection &intersection) const;
Intersection assignLeftTurns(const EdgeID via_edge,
Intersection intersection,