2016-04-08 06:49:14 -04:00
|
|
|
#ifndef OSRM_EXTRACTOR_GUIDANCE_ROUNDABOUT_HANDLER_HPP_
|
|
|
|
#define OSRM_EXTRACTOR_GUIDANCE_ROUNDABOUT_HANDLER_HPP_
|
|
|
|
|
2016-04-18 07:41:19 -04:00
|
|
|
#include "extractor/compressed_edge_container.hpp"
|
2016-04-08 06:49:14 -04:00
|
|
|
#include "extractor/guidance/intersection.hpp"
|
2016-08-15 06:43:26 -04:00
|
|
|
#include "extractor/guidance/intersection_generator.hpp"
|
2016-09-06 09:47:03 -04:00
|
|
|
#include "extractor/guidance/intersection_handler.hpp"
|
2016-04-18 07:41:19 -04:00
|
|
|
#include "extractor/guidance/roundabout_type.hpp"
|
2016-07-18 09:34:12 -04:00
|
|
|
#include "extractor/profile_properties.hpp"
|
2016-07-26 15:44:17 -04:00
|
|
|
#include "extractor/query_node.hpp"
|
2016-04-08 06:49:14 -04:00
|
|
|
|
|
|
|
#include "util/name_table.hpp"
|
|
|
|
#include "util/node_based_graph.hpp"
|
|
|
|
#include "util/typedefs.hpp"
|
|
|
|
|
2016-04-18 07:41:19 -04:00
|
|
|
#include <set>
|
2016-04-08 06:49:14 -04:00
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace extractor
|
|
|
|
{
|
|
|
|
namespace guidance
|
|
|
|
{
|
|
|
|
|
|
|
|
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.
|
|
|
|
class RoundaboutHandler : public IntersectionHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RoundaboutHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
|
|
|
const std::vector<QueryNode> &node_info_list,
|
2016-04-22 05:31:46 -04:00
|
|
|
const CompressedEdgeContainer &compressed_edge_container,
|
2016-04-18 07:41:19 -04:00
|
|
|
const util::NameTable &name_table,
|
2016-07-18 09:34:12 -04:00
|
|
|
const SuffixTable &street_name_suffix_table,
|
2016-08-15 06:43:26 -04:00
|
|
|
const ProfileProperties &profile_properties,
|
|
|
|
const IntersectionGenerator &intersection_generator);
|
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
|
|
|
|
2016-04-15 11:18:55 -04:00
|
|
|
void invalidateExitAgainstDirection(const NodeID from_nid,
|
|
|
|
const EdgeID via_eid,
|
|
|
|
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
|
|
|
|
|
|
|
bool qualifiesAsRoundaboutIntersection(const std::set<NodeID> &roundabout_nodes) const;
|
|
|
|
|
|
|
|
const CompressedEdgeContainer &compressed_edge_container;
|
2016-07-18 09:34:12 -04:00
|
|
|
const ProfileProperties &profile_properties;
|
2016-04-08 06:49:14 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace guidance
|
|
|
|
} // namespace extractor
|
|
|
|
} // namespace osrm
|
|
|
|
|
|
|
|
#endif /*OSRM_EXTRACTOR_GUIDANCE_ROUNDABOUT_HANDLER_HPP_*/
|