2016-07-04 06:19:49 -04:00
|
|
|
#ifndef OSRM_EXTRACTOR_GUIDANCE_SLIPROAD_HANDLER_HPP_
|
|
|
|
#define OSRM_EXTRACTOR_GUIDANCE_SLIPROAD_HANDLER_HPP_
|
|
|
|
|
|
|
|
#include "extractor/guidance/intersection.hpp"
|
|
|
|
#include "extractor/guidance/intersection_generator.hpp"
|
2016-07-26 09:00:58 -04:00
|
|
|
#include "extractor/guidance/intersection_handler.hpp"
|
2016-07-04 06:19:49 -04:00
|
|
|
#include "extractor/query_node.hpp"
|
|
|
|
|
|
|
|
#include "util/name_table.hpp"
|
|
|
|
#include "util/node_based_graph.hpp"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2016-10-26 17:32:29 -04:00
|
|
|
#include <boost/optional.hpp>
|
|
|
|
|
2016-07-04 06:19:49 -04:00
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace extractor
|
|
|
|
{
|
|
|
|
namespace guidance
|
|
|
|
{
|
|
|
|
|
|
|
|
// Intersection handlers deal with all issues related to intersections.
|
2016-10-26 17:32:29 -04:00
|
|
|
class SliproadHandler final : public IntersectionHandler
|
2016-07-04 06:19:49 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
SliproadHandler(const IntersectionGenerator &intersection_generator,
|
|
|
|
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,
|
2016-07-04 06:19:49 -04:00
|
|
|
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;
|
2016-10-26 17:32:29 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
boost::optional<std::size_t> getObviousIndexWithSliproads(const EdgeID from,
|
|
|
|
const Intersection &intersection,
|
|
|
|
const NodeID at) const;
|
|
|
|
|
|
|
|
// Next intersection from `start` onto `onto` is too far away for a Siproad scenario
|
|
|
|
bool nextIntersectionIsTooFarAway(const NodeID start, const EdgeID onto) const;
|
|
|
|
|
|
|
|
// Through street: does a road continue with from's name at the intersection
|
|
|
|
bool isThroughStreet(const EdgeID from, const IntersectionView &intersection) const;
|
|
|
|
|
|
|
|
// Does the road from `current` to `next` continue
|
|
|
|
bool roadContinues(const EdgeID current, const EdgeID next) const;
|
|
|
|
|
|
|
|
// Is the area under the triangle a valid Sliproad triangle
|
|
|
|
bool isValidSliproadArea(const double max_area, const NodeID, const NodeID, const NodeID) const;
|
|
|
|
|
|
|
|
// Is the Sliproad a link the both roads it shortcuts must not be links
|
|
|
|
bool isValidSliproadLink(const IntersectionViewData &sliproad,
|
|
|
|
const IntersectionViewData &first,
|
|
|
|
const IntersectionViewData &second) const;
|
|
|
|
|
2017-02-15 09:12:24 -05:00
|
|
|
// check if no mode changes are involved
|
|
|
|
bool allSameMode(const EdgeID in_road,
|
|
|
|
const EdgeID sliproad_candidate,
|
|
|
|
const EdgeID target_road) const;
|
|
|
|
|
2016-10-26 17:32:29 -04:00
|
|
|
// Could a Sliproad reach this intersection?
|
|
|
|
static bool canBeTargetOfSliproad(const IntersectionView &intersection);
|
|
|
|
|
|
|
|
// Scales a threshold based on the underlying road classification.
|
|
|
|
// Example: a 100 m threshold for a highway if different on living streets.
|
|
|
|
// The return value is guaranteed to not be larger than `threshold`.
|
|
|
|
static double scaledThresholdByRoadClass(const double max_threshold,
|
|
|
|
const RoadClassification &classification);
|
2016-07-04 06:19:49 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace guidance
|
|
|
|
} // namespace extractor
|
|
|
|
} // namespace osrm
|
|
|
|
|
|
|
|
#endif /*OSRM_EXTRACTOR_GUIDANCE_SLIPROAD_HANDLER_HPP_*/
|