handling of roundabouts (simple version)

This commit is contained in:
Moritz Kobitzsch
2016-02-24 14:03:51 +01:00
committed by Patrick Niklaus
parent 4b46dec169
commit ad56ed8832
3 changed files with 97 additions and 34 deletions
+3 -1
View File
@@ -24,7 +24,7 @@ namespace guidance
namespace detail
{
// FIXME move implementation to cpp
inline StepManeuver stepManeuverFromGeometry(const TurnInstruction instruction,
inline StepManeuver stepManeuverFromGeometry(TurnInstruction instruction,
const LegGeometry &leg_geometry,
const std::size_t segment_index,
const unsigned exit)
@@ -45,8 +45,10 @@ inline StepManeuver stepManeuverFromGeometry(const TurnInstruction instruction,
return StepManeuver{turn_coordinate, pre_turn_bearing, post_turn_bearing, instruction, exit};
}
}
template <typename DataFacadeT>
std::vector<RouteStep> assembleSteps(const DataFacadeT &facade,
const std::vector<PathData> &leg_data,
+11 -5
View File
@@ -1,6 +1,7 @@
#ifndef OSRM_GUIDANCE_GUIDANCE_TOOLKIT_HPP_
#define OSRM_GUIDANCE_GUIDANCE_TOOLKIT_HPP_
#include "util/bearing.hpp"
#include "util/coordinate.hpp"
#include "util/coordinate_calculation.hpp"
@@ -42,8 +43,7 @@ getCoordinateFromCompressedRange(util::Coordinate current_coordinate,
const util::Coordinate final_coordinate,
const std::vector<extractor::QueryNode> &query_nodes)
{
const auto extractCoordinateFromNode = [](
const extractor::QueryNode &node) -> util::Coordinate
const auto extractCoordinateFromNode = [](const extractor::QueryNode &node) -> util::Coordinate
{
return {node.lon, node.lat};
};
@@ -105,8 +105,7 @@ getRepresentativeCoordinate(const NodeID from_node,
const extractor::CompressedEdgeContainer &compressed_geometries,
const std::vector<extractor::QueryNode> &query_nodes)
{
const auto extractCoordinateFromNode = [](
const extractor::QueryNode &node) -> util::Coordinate
const auto extractCoordinateFromNode = [](const extractor::QueryNode &node) -> util::Coordinate
{
return {node.lon, node.lat};
};
@@ -170,7 +169,9 @@ inline DirectionModifier shiftCW(const DirectionModifier modifier)
inline bool entersRoundabout(const TurnInstruction instruction)
{
return (instruction.type == TurnType::EnterRoundabout ||
instruction.type == TurnType::EnterRotary);
instruction.type == TurnType::EnterRotary ||
instruction.type == TurnType::EnterRoundaboutAtExit ||
instruction.type == TurnType::EnterRotaryAtExit);
}
inline bool leavesRoundabout(const TurnInstruction instruction)
@@ -381,6 +382,11 @@ inline DirectionModifier bearingToDirectionModifier(const std::string &bearing)
return hash.find(bearing)->second;
}
inline DirectionModifier bearingToDirectionModifier(const double angle)
{
return bearingToDirectionModifier( util::bearing::get(angle) );
}
inline bool isHighway(FunctionalRoadClass road_class)
{
return road_class == FunctionalRoadClass::MOTORWAY || road_class == FunctionalRoadClass::TRUNK;