2017-11-20 11:20:49 -05:00
|
|
|
#ifndef OSRM_EXTRACTOR_INTERSECTION_INTERSECTION_ANALYSIS_HPP
|
|
|
|
#define OSRM_EXTRACTOR_INTERSECTION_INTERSECTION_ANALYSIS_HPP
|
|
|
|
|
|
|
|
#include "extractor/compressed_edge_container.hpp"
|
|
|
|
#include "extractor/intersection/intersection_edge.hpp"
|
2018-01-05 08:33:53 -05:00
|
|
|
#include "extractor/intersection/intersection_view.hpp"
|
|
|
|
#include "extractor/intersection/mergable_road_detector.hpp"
|
2020-12-20 16:59:57 -05:00
|
|
|
#include "extractor/node_restriction_map.hpp"
|
2018-01-05 08:33:53 -05:00
|
|
|
#include "extractor/turn_lane_types.hpp"
|
2017-11-20 11:20:49 -05:00
|
|
|
|
|
|
|
#include "util/coordinate.hpp"
|
|
|
|
#include "util/node_based_graph.hpp"
|
|
|
|
|
|
|
|
#include <unordered_set>
|
|
|
|
#include <vector>
|
|
|
|
|
2022-12-11 04:10:26 -05:00
|
|
|
namespace osrm::extractor::intersection
|
2017-11-20 11:20:49 -05:00
|
|
|
{
|
|
|
|
|
|
|
|
IntersectionEdges getIncomingEdges(const util::NodeBasedDynamicGraph &graph,
|
|
|
|
const NodeID intersection);
|
|
|
|
|
|
|
|
IntersectionEdges getOutgoingEdges(const util::NodeBasedDynamicGraph &graph,
|
|
|
|
const NodeID intersection);
|
|
|
|
|
2017-12-03 15:32:17 -05:00
|
|
|
bool isTurnAllowed(const util::NodeBasedDynamicGraph &graph,
|
|
|
|
const EdgeBasedNodeDataContainer &node_data_container,
|
|
|
|
const RestrictionMap &restriction_map,
|
|
|
|
const std::unordered_set<NodeID> &barrier_nodes,
|
|
|
|
const IntersectionEdgeGeometries &geometries,
|
2018-01-05 08:33:53 -05:00
|
|
|
const TurnLanesIndexedArray &turn_lanes_data,
|
2017-12-03 15:32:17 -05:00
|
|
|
const IntersectionEdge &from,
|
|
|
|
const IntersectionEdge &to);
|
|
|
|
|
|
|
|
double findEdgeBearing(const IntersectionEdgeGeometries &geometries, const EdgeID &edge);
|
|
|
|
|
|
|
|
double findEdgeLength(const IntersectionEdgeGeometries &geometries, const EdgeID &edge);
|
|
|
|
|
2017-11-21 14:23:35 -05:00
|
|
|
std::pair<IntersectionEdgeGeometries, std::unordered_set<EdgeID>>
|
|
|
|
getIntersectionGeometries(const util::NodeBasedDynamicGraph &graph,
|
|
|
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
|
|
|
const std::vector<util::Coordinate> &node_coordinates,
|
2018-01-05 08:33:53 -05:00
|
|
|
const MergableRoadDetector &detector,
|
2017-11-21 14:23:35 -05:00
|
|
|
const NodeID intersection);
|
|
|
|
|
2018-01-05 08:33:53 -05:00
|
|
|
IntersectionView convertToIntersectionView(const util::NodeBasedDynamicGraph &graph,
|
|
|
|
const EdgeBasedNodeDataContainer &node_data_container,
|
|
|
|
const RestrictionMap &restriction_map,
|
|
|
|
const std::unordered_set<NodeID> &barrier_nodes,
|
|
|
|
const IntersectionEdgeGeometries &edge_geometries,
|
|
|
|
const TurnLanesIndexedArray &turn_lanes_data,
|
|
|
|
const IntersectionEdge &incoming_edge,
|
|
|
|
const IntersectionEdges &outgoing_edges,
|
|
|
|
const std::unordered_set<EdgeID> &merged_edges);
|
2017-11-20 11:20:49 -05:00
|
|
|
|
2017-12-05 08:54:20 -05:00
|
|
|
// Check for restrictions/barriers and generate a list of valid and invalid turns present at
|
|
|
|
// the node reached from `incoming_edge`. The resulting candidates have to be analyzed
|
|
|
|
// for their actual instructions later on.
|
2017-12-06 18:27:53 -05:00
|
|
|
template <bool USE_CLOSE_COORDINATE>
|
2018-01-05 08:33:53 -05:00
|
|
|
IntersectionView getConnectedRoads(const util::NodeBasedDynamicGraph &graph,
|
|
|
|
const EdgeBasedNodeDataContainer &node_data_container,
|
|
|
|
const std::vector<util::Coordinate> &node_coordinates,
|
|
|
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
|
|
|
const RestrictionMap &node_restriction_map,
|
|
|
|
const std::unordered_set<NodeID> &barrier_nodes,
|
|
|
|
const TurnLanesIndexedArray &turn_lanes_data,
|
|
|
|
const IntersectionEdge &incoming_edge);
|
2017-12-04 07:11:45 -05:00
|
|
|
|
2021-01-27 07:11:54 -05:00
|
|
|
IntersectionView
|
|
|
|
getConnectedRoadsForEdgeGeometries(const util::NodeBasedDynamicGraph &graph,
|
|
|
|
const EdgeBasedNodeDataContainer &node_data_container,
|
|
|
|
const RestrictionMap &node_restriction_map,
|
|
|
|
const std::unordered_set<NodeID> &barrier_nodes,
|
|
|
|
const TurnLanesIndexedArray &turn_lanes_data,
|
|
|
|
const IntersectionEdge &incoming_edge,
|
|
|
|
const IntersectionEdgeGeometries &edge_geometries,
|
|
|
|
const std::unordered_set<EdgeID> &merged_edge_ids);
|
2018-12-16 11:49:13 -05:00
|
|
|
|
2017-12-05 08:54:20 -05:00
|
|
|
// Graph Compression cannot compress every setting. For example any barrier/traffic light cannot
|
|
|
|
// be compressed. As a result, a simple road of the form `a ----- b` might end up as having an
|
|
|
|
// intermediate intersection, if there is a traffic light in between. If we want to look farther
|
|
|
|
// down a road, finding the next actual decision requires the look at multiple intersections.
|
|
|
|
// Here we follow the road until we either reach a dead end or find the next intersection with
|
|
|
|
// more than a single next road. This function skips over degree two nodes to find correct input
|
|
|
|
// for getConnectedRoads.
|
2017-12-04 07:11:45 -05:00
|
|
|
IntersectionEdge skipDegreeTwoNodes(const util::NodeBasedDynamicGraph &graph,
|
|
|
|
IntersectionEdge road);
|
2022-12-20 12:00:11 -05:00
|
|
|
} // namespace osrm::extractor::intersection
|
2017-11-20 11:20:49 -05:00
|
|
|
|
|
|
|
#endif
|