handle stronger merge cases as well

This commit is contained in:
Moritz Kobitzsch
2016-08-11 14:21:34 +02:00
parent 7886d06839
commit 6a2518c0df
9 changed files with 468 additions and 65 deletions
@@ -48,11 +48,12 @@ class IntersectionGenerator
// from `from_node` via `via_eid`
// The resulting candidates have to be analysed for their actual instructions later on.
OSRM_ATTR_WARN_UNUSED
Intersection getConnectedRoads(const NodeID from_node, const EdgeID via_eid) const;
Intersection GetConnectedRoads(const NodeID from_node, const EdgeID via_eid) const;
// check if two indices in an intersection can be seen as a single road in the perceived
// intersection representation
bool canMerge(const Intersection &intersection,
bool CanMerge(const NodeID intersection_node,
const Intersection &intersection,
std::size_t first_index,
std::size_t second_index) const;
@@ -68,7 +69,8 @@ class IntersectionGenerator
// The treatment results in a straight turn angle of 180º rather than a turn angle of approx
// 160
OSRM_ATTR_WARN_UNUSED
Intersection mergeSegregatedRoads(Intersection intersection) const;
Intersection MergeSegregatedRoads(const NodeID intersection_node,
Intersection intersection) const;
// The counterpiece to mergeSegregatedRoads. While we can adjust roads that split up at the
// intersection itself, it can also happen that intersections are connected to joining roads.
@@ -81,8 +83,20 @@ class IntersectionGenerator
// b
//
// for the local view of b at a.
Intersection adjustForJoiningRoads(const NodeID node_at_intersection,
OSRM_ATTR_WARN_UNUSED
Intersection AdjustForJoiningRoads(const NodeID node_at_intersection,
Intersection intersection) const;
// 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.
inline Intersection GetActualNextIntersection(const NodeID starting_node,
const EdgeID via_edge,
NodeID *resulting_from_node,
EdgeID *resulting_via_edge) const;
};
} // namespace guidance
-2
View File
@@ -20,8 +20,6 @@ namespace guidance
{
inline void print(const engine::guidance::RouteStep &step)
{
const auto lanes = step.intersections.front().lanes;
std::cout << static_cast<int>(step.maneuver.instruction.type) << " "
<< static_cast<int>(step.maneuver.instruction.direction_modifier) << " "
<< static_cast<int>(step.maneuver.waypoint_type) << " "
+7 -2
View File
@@ -51,14 +51,19 @@ struct NodeBasedEdgeData
LaneDescriptionID lane_description_id;
extractor::guidance::RoadClassification road_classification;
bool IsCompatibleTo(const NodeBasedEdgeData &other) const
bool IsCompatibleToExceptForName(const NodeBasedEdgeData &other) const
{
return (name_id == other.name_id) && (reversed == other.reversed) &&
return (reversed == other.reversed) &&
(roundabout == other.roundabout) && (startpoint == other.startpoint) &&
(access_restricted == other.access_restricted) &&
(travel_mode == other.travel_mode) &&
(road_classification == other.road_classification);
}
bool IsCompatibleTo(const NodeBasedEdgeData &other) const
{
return (name_id == other.name_id) && IsCompatibleToExceptForName(other);
}
};
using NodeBasedDynamicGraph = DynamicGraph<NodeBasedEdgeData>;