handle combined turns at segregated roads

This commit is contained in:
Moritz Kobitzsch
2016-04-14 10:41:56 +02:00
committed by Patrick Niklaus
parent 3ac061c546
commit 754bc2d274
5 changed files with 577 additions and 10 deletions
@@ -17,6 +17,13 @@ namespace guidance
// passed as none-reference to modify in-place and move out again
std::vector<RouteStep> postProcess(std::vector<RouteStep> steps);
// Multiple possible reasons can result in unnecessary/confusing instructions
// A prime example would be a segregated intersection. Turning around at this
// intersection would result in two instructions to turn left.
// Collapsing such turns into a single turn instruction, we give a clearer
// set of instructionst that is not cluttered by unnecessary turns/name changes.
std::vector<RouteStep> collapseTurns(std::vector<RouteStep> steps);
// trim initial/final segment of very short length.
// This function uses in/out parameter passing to modify both steps and geometry in place.
// We use this method since both steps and geometry are closely coupled logically but
@@ -30,6 +37,9 @@ std::vector<RouteStep> assignRelativeLocations(std::vector<RouteStep> steps,
const PhantomNode &source_node,
const PhantomNode &target_node);
//remove steps invalidated by post-processing
std::vector<RouteStep> removeNoTurnInstructions(std::vector<RouteStep> steps);
// postProcess will break the connection between the leg geometry
// for which a segment is supposed to represent exactly the coordinates
// between routing maneuvers and the route steps itself.
+8
View File
@@ -4,6 +4,8 @@
#include "extractor/guidance/turn_instruction.hpp"
#include "util/bearing.hpp"
#include <algorithm>
namespace osrm
{
namespace engine
@@ -56,6 +58,12 @@ inline extractor::guidance::DirectionModifier angleToDirectionModifier(const dou
return extractor::guidance::DirectionModifier::Left;
}
inline double angularDeviation(const double angle, const double from)
{
const double deviation = std::abs(angle - from);
return std::min(360 - deviation, deviation);
}
} // namespace guidance
} // namespace engine
} // namespace osrm