2018-01-05 08:33:53 -05:00
|
|
|
#ifndef OSRM_GUIDANCE_ROUNDABOUT_HANDLER_HPP_
|
|
|
|
#define OSRM_GUIDANCE_ROUNDABOUT_HANDLER_HPP_
|
2016-04-08 06:49:14 -04:00
|
|
|
|
2016-04-18 07:41:19 -04:00
|
|
|
#include "extractor/compressed_edge_container.hpp"
|
2018-01-05 08:33:53 -05:00
|
|
|
#include "extractor/intersection/coordinate_extractor.hpp"
|
2018-03-21 07:10:02 -04:00
|
|
|
#include "extractor/name_table.hpp"
|
2018-03-22 14:26:40 -04:00
|
|
|
#include "extractor/query_node.hpp"
|
2018-03-21 07:10:02 -04:00
|
|
|
|
2018-01-05 07:05:53 -05:00
|
|
|
#include "guidance/intersection.hpp"
|
|
|
|
#include "guidance/intersection_handler.hpp"
|
|
|
|
#include "guidance/is_through_street.hpp"
|
2018-01-05 08:33:53 -05:00
|
|
|
#include "guidance/roundabout_type.hpp"
|
2016-04-08 06:49:14 -04:00
|
|
|
|
|
|
|
#include "util/node_based_graph.hpp"
|
|
|
|
#include "util/typedefs.hpp"
|
|
|
|
|
2016-09-07 12:51:10 -04:00
|
|
|
#include <unordered_set>
|
2016-04-08 06:49:14 -04:00
|
|
|
#include <vector>
|
|
|
|
|
2022-12-11 04:10:26 -05:00
|
|
|
namespace osrm::guidance
|
2016-04-08 06:49:14 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
namespace detail
|
|
|
|
{
|
|
|
|
struct RoundaboutFlags
|
|
|
|
{
|
|
|
|
bool on_roundabout;
|
|
|
|
bool can_enter;
|
|
|
|
bool can_exit_separately;
|
|
|
|
};
|
|
|
|
} // namespace detail
|
|
|
|
|
|
|
|
// The roundabout handler processes all roundabout related instructions.
|
|
|
|
// It performs both the distinction between rotaries and roundabouts and
|
|
|
|
// assigns appropriate entry/exit instructions.
|
2022-06-27 19:14:28 -04:00
|
|
|
class RoundaboutHandler final : public IntersectionHandler
|
2016-04-08 06:49:14 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
RoundaboutHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
2018-01-05 08:33:53 -05:00
|
|
|
const extractor::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,
|
2018-01-05 08:33:53 -05:00
|
|
|
const extractor::RestrictionMap &node_restriction_map,
|
2017-12-03 15:32:17 -05:00
|
|
|
const std::unordered_set<NodeID> &barrier_nodes,
|
2018-01-05 08:33:53 -05:00
|
|
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
2018-03-21 07:10:02 -04:00
|
|
|
const extractor::NameTable &name_table,
|
2018-01-05 08:33:53 -05:00
|
|
|
const extractor::SuffixTable &street_name_suffix_table);
|
2016-04-08 06:49:14 -04:00
|
|
|
|
2016-07-04 06:19:49 -04:00
|
|
|
~RoundaboutHandler() override final = default;
|
2016-04-08 06:49:14 -04:00
|
|
|
|
|
|
|
// check whether the handler can actually handle the intersection
|
2016-04-11 06:51:06 -04:00
|
|
|
bool canProcess(const NodeID from_nid,
|
|
|
|
const EdgeID via_eid,
|
|
|
|
const Intersection &intersection) const override final;
|
2016-04-08 06:49:14 -04:00
|
|
|
|
|
|
|
// process the intersection
|
2016-04-11 06:51:06 -04:00
|
|
|
Intersection operator()(const NodeID from_nid,
|
|
|
|
const EdgeID via_eid,
|
|
|
|
Intersection intersection) const override final;
|
2016-04-08 06:49:14 -04:00
|
|
|
|
|
|
|
private:
|
2016-04-11 06:51:06 -04:00
|
|
|
detail::RoundaboutFlags getRoundaboutFlags(const NodeID from_nid,
|
|
|
|
const EdgeID via_eid,
|
|
|
|
const Intersection &intersection) const;
|
2016-04-08 06:49:14 -04:00
|
|
|
|
|
|
|
// decide whether we lookk at a roundabout or a rotary
|
2016-04-18 07:41:19 -04:00
|
|
|
RoundaboutType getRoundaboutType(const NodeID nid) const;
|
2016-04-08 06:49:14 -04:00
|
|
|
|
|
|
|
// TODO handle bike/walk cases that allow crossing a roundabout!
|
|
|
|
// Processing of roundabouts
|
|
|
|
// Produces instructions to enter/exit a roundabout or to stay on it.
|
|
|
|
// Performs the distinction between roundabout and rotaries.
|
2016-04-18 07:41:19 -04:00
|
|
|
Intersection handleRoundabouts(const RoundaboutType roundabout_type,
|
2016-04-08 06:49:14 -04:00
|
|
|
const EdgeID via_edge,
|
|
|
|
const bool on_roundabout,
|
|
|
|
const bool can_exit_roundabout,
|
|
|
|
Intersection intersection) const;
|
2016-04-18 07:41:19 -04:00
|
|
|
|
2016-09-07 12:51:10 -04:00
|
|
|
bool
|
|
|
|
qualifiesAsRoundaboutIntersection(const std::unordered_set<NodeID> &roundabout_nodes) const;
|
2016-04-18 07:41:19 -04:00
|
|
|
|
2018-01-05 08:33:53 -05:00
|
|
|
const extractor::intersection::CoordinateExtractor coordinate_extractor;
|
2016-04-08 06:49:14 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace osrm
|
|
|
|
|
2018-01-05 08:33:53 -05:00
|
|
|
#endif /*OSRM_GUIDANCE_ROUNDABOUT_HANDLER_HPP_*/
|