Free functions for guidance intersections analysis

This commit is contained in:
Michael Krasnyk
2017-11-20 17:20:49 +01:00
parent 3c3322173c
commit 9c033ff461
7 changed files with 478 additions and 16 deletions
@@ -0,0 +1,50 @@
#ifndef OSRM_EXTRACTOR_INTERSECTION_INTERSECTION_ANALYSIS_HPP
#define OSRM_EXTRACTOR_INTERSECTION_INTERSECTION_ANALYSIS_HPP
#include "extractor/compressed_edge_container.hpp"
#include "extractor/guidance/turn_lane_types.hpp"
#include "extractor/intersection/intersection_edge.hpp"
#include "extractor/restriction_index.hpp"
#include "util/coordinate.hpp"
#include "util/node_based_graph.hpp"
#include <unordered_set>
#include <vector>
namespace osrm
{
namespace extractor
{
namespace intersection
{
IntersectionEdges getIncomingEdges(const util::NodeBasedDynamicGraph &graph,
const NodeID intersection);
IntersectionEdges getOutgoingEdges(const util::NodeBasedDynamicGraph &graph,
const NodeID intersection);
IntersectionEdgeBearings
getIntersectionBearings(const util::NodeBasedDynamicGraph &graph,
const extractor::CompressedEdgeContainer &compressed_geometries,
const std::vector<util::Coordinate> &node_coordinates,
const NodeID intersection);
bool isTurnAllowed(const util::NodeBasedDynamicGraph &graph,
const EdgeBasedNodeDataContainer &node_data_container,
const RestrictionMap &restriction_map,
const std::unordered_set<NodeID> &barrier_nodes,
const IntersectionEdgeBearings &bearings,
const guidance::TurnLanesIndexedArray &turn_lanes_data,
const IntersectionEdge &from,
const IntersectionEdge &to);
double computeTurnAngle(const IntersectionEdgeBearings &bearings,
const IntersectionEdge &from,
const IntersectionEdge &to);
}
}
}
#endif
@@ -0,0 +1,42 @@
#ifndef OSRM_EXTRACTOR_INTERSECTION_INTERSECTION_EDGE_HPP
#define OSRM_EXTRACTOR_INTERSECTION_INTERSECTION_EDGE_HPP
#include "util/typedefs.hpp"
#include <vector>
namespace osrm
{
namespace extractor
{
namespace intersection
{
// IntersectionEdge is an alias for incoming and outgoing node-based graph edges of an intersection
struct IntersectionEdge
{
NodeID node;
EdgeID edge;
bool operator<(const IntersectionEdge &other) const
{
return std::tie(node, edge) < std::tie(other.node, other.edge);
}
};
using IntersectionEdges = std::vector<IntersectionEdge>;
struct IntersectionEdgeBearing
{
EdgeID edge;
float bearing;
bool operator<(const IntersectionEdgeBearing &other) const { return edge < other.edge; }
};
using IntersectionEdgeBearings = std::vector<IntersectionEdgeBearing>;
}
}
}
#endif