2016-04-08 06:49:14 -04:00
|
|
|
#ifndef OSRM_EXTRACTOR_GUIDANCE_TURN_HANDLER_HPP_
|
|
|
|
#define OSRM_EXTRACTOR_GUIDANCE_TURN_HANDLER_HPP_
|
|
|
|
|
|
|
|
#include "extractor/guidance/intersection.hpp"
|
2016-09-06 09:47:03 -04:00
|
|
|
#include "extractor/guidance/intersection_handler.hpp"
|
2018-01-19 13:49:00 -05:00
|
|
|
#include "extractor/guidance/is_through_street.hpp"
|
2016-04-08 06:49:14 -04:00
|
|
|
#include "extractor/query_node.hpp"
|
|
|
|
|
2016-08-02 09:43:29 -04:00
|
|
|
#include "util/attributes.hpp"
|
2016-04-08 06:49:14 -04:00
|
|
|
#include "util/name_table.hpp"
|
|
|
|
#include "util/node_based_graph.hpp"
|
|
|
|
|
2017-01-07 08:13:32 -05:00
|
|
|
#include <boost/optional.hpp>
|
|
|
|
|
2016-04-08 06:49:14 -04:00
|
|
|
#include <cstddef>
|
|
|
|
#include <utility>
|
2016-04-11 06:51:06 -04:00
|
|
|
#include <vector>
|
2016-04-08 06:49:14 -04:00
|
|
|
|
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace extractor
|
|
|
|
{
|
|
|
|
namespace guidance
|
|
|
|
{
|
|
|
|
|
|
|
|
// Intersection handlers deal with all issues related to intersections.
|
|
|
|
class TurnHandler : public IntersectionHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TurnHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
2017-09-25 09:37:11 -04:00
|
|
|
const EdgeBasedNodeDataContainer &node_data_container,
|
2017-04-02 19:58:06 -04:00
|
|
|
const std::vector<util::Coordinate> &coordinates,
|
2017-12-03 15:32:17 -05:00
|
|
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
|
|
|
const RestrictionMap &node_restriction_map,
|
|
|
|
const std::unordered_set<NodeID> &barrier_nodes,
|
|
|
|
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
2016-04-22 05:31:46 -04:00
|
|
|
const util::NameTable &name_table,
|
2017-12-04 07:11:45 -05:00
|
|
|
const SuffixTable &street_name_suffix_table);
|
2016-07-04 06:19:49 -04:00
|
|
|
|
|
|
|
~TurnHandler() override final = default;
|
2016-04-08 06:49:14 -04:00
|
|
|
|
|
|
|
// 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:
|
2017-01-07 08:13:32 -05:00
|
|
|
struct Fork
|
|
|
|
{
|
2017-01-15 10:09:33 -05:00
|
|
|
const Intersection::iterator intersection_base;
|
|
|
|
const Intersection::iterator begin;
|
|
|
|
const Intersection::iterator end;
|
2017-01-07 08:13:32 -05:00
|
|
|
const std::size_t size;
|
2017-01-15 10:09:33 -05:00
|
|
|
Fork(const Intersection::iterator intersection_base,
|
|
|
|
const Intersection::iterator begin,
|
|
|
|
const Intersection::iterator end);
|
|
|
|
ConnectedRoad &getRight() const;
|
|
|
|
ConnectedRoad &getLeft() const;
|
|
|
|
ConnectedRoad &getMiddle() const;
|
|
|
|
ConnectedRoad &getRight();
|
|
|
|
ConnectedRoad &getLeft();
|
|
|
|
ConnectedRoad &getMiddle();
|
|
|
|
std::size_t getRightIndex() const;
|
|
|
|
std::size_t getLeftIndex() const;
|
2017-01-07 08:13:32 -05:00
|
|
|
};
|
|
|
|
|
2016-07-04 06:19:49 -04:00
|
|
|
bool isObviousOfTwo(const EdgeID via_edge,
|
|
|
|
const ConnectedRoad &road,
|
|
|
|
const ConnectedRoad &other) const;
|
2017-01-07 08:13:32 -05:00
|
|
|
|
|
|
|
bool hasObvious(const EdgeID &via_edge, const Fork &fork) const;
|
|
|
|
|
|
|
|
boost::optional<Fork> findForkCandidatesByGeometry(Intersection &intersection) const;
|
|
|
|
|
|
|
|
bool isCompatibleByRoadClass(const Intersection &intersection, const Fork fork) const;
|
|
|
|
|
2016-04-08 06:49:14 -04:00
|
|
|
// Dead end.
|
2016-08-02 09:43:29 -04:00
|
|
|
OSRM_ATTR_WARN_UNUSED
|
2016-04-08 06:49:14 -04:00
|
|
|
Intersection handleOneWayTurn(Intersection intersection) const;
|
|
|
|
|
|
|
|
// Mode Changes, new names...
|
2016-08-02 09:43:29 -04:00
|
|
|
OSRM_ATTR_WARN_UNUSED
|
2016-04-08 06:49:14 -04:00
|
|
|
Intersection handleTwoWayTurn(const EdgeID via_edge, Intersection intersection) const;
|
|
|
|
|
|
|
|
// Forks, T intersections and similar
|
2016-08-02 09:43:29 -04:00
|
|
|
OSRM_ATTR_WARN_UNUSED
|
2016-04-08 06:49:14 -04:00
|
|
|
Intersection handleThreeWayTurn(const EdgeID via_edge, Intersection intersection) const;
|
|
|
|
|
|
|
|
// Handling of turns larger then degree three
|
2016-08-02 09:43:29 -04:00
|
|
|
OSRM_ATTR_WARN_UNUSED
|
2016-04-08 06:49:14 -04:00
|
|
|
Intersection handleComplexTurn(const EdgeID via_edge, Intersection intersection) const;
|
|
|
|
|
|
|
|
void
|
|
|
|
handleDistinctConflict(const EdgeID via_edge, ConnectedRoad &left, ConnectedRoad &right) const;
|
|
|
|
|
|
|
|
// Classification
|
2017-01-07 08:13:32 -05:00
|
|
|
boost::optional<Fork> findFork(const EdgeID via_edge, Intersection &intersection) const;
|
2016-04-08 06:49:14 -04:00
|
|
|
|
2016-08-02 09:43:29 -04:00
|
|
|
OSRM_ATTR_WARN_UNUSED
|
2016-04-08 06:49:14 -04:00
|
|
|
Intersection assignLeftTurns(const EdgeID via_edge,
|
|
|
|
Intersection intersection,
|
|
|
|
const std::size_t starting_at) const;
|
2016-08-02 09:43:29 -04:00
|
|
|
|
|
|
|
OSRM_ATTR_WARN_UNUSED
|
2016-04-08 06:49:14 -04:00
|
|
|
Intersection assignRightTurns(const EdgeID via_edge,
|
|
|
|
Intersection intersection,
|
|
|
|
const std::size_t up_to) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace guidance
|
|
|
|
} // namespace extractor
|
|
|
|
} // namespace osrm
|
|
|
|
|
|
|
|
#endif /*OSRM_EXTRACTOR_GUIDANCE_TURN_HANDLER_HPP_*/
|