Split intersection analysis and guidance code
Intersection analysis occupy in osrm::extractor::intersection namespace and guidance code osrm::guidance
This commit is contained in:
@@ -70,7 +70,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
||||
cumulative_distance += current_distance;
|
||||
|
||||
// all changes to this check have to be matched with assemble_steps
|
||||
if (path_point.turn_instruction.type != extractor::guidance::TurnType::NoTurn)
|
||||
if (path_point.turn_instruction.type != osrm::guidance::TurnType::NoTurn)
|
||||
{
|
||||
geometry.segment_distances.push_back(cumulative_distance);
|
||||
geometry.segment_offsets.push_back(geometry.locations.size());
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#define ENGINE_GUIDANCE_ASSEMBLE_STEPS_HPP_
|
||||
|
||||
#include "extractor/travel_mode.hpp"
|
||||
#include "extractor/turn_lane_types.hpp"
|
||||
#include "guidance/turn_instruction.hpp"
|
||||
#include "guidance/turn_lane_types.hpp"
|
||||
#include "engine/datafacade/datafacade_base.hpp"
|
||||
#include "engine/guidance/leg_geometry.hpp"
|
||||
#include "engine/guidance/route_step.hpp"
|
||||
@@ -83,7 +83,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
|
||||
StepManeuver maneuver{source_node.location,
|
||||
bearings.first,
|
||||
bearings.second,
|
||||
extractor::guidance::TurnInstruction::NO_TURN(),
|
||||
osrm::guidance::TurnInstruction::NO_TURN(),
|
||||
WaypointType::Depart,
|
||||
0};
|
||||
|
||||
@@ -115,7 +115,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
|
||||
segment_weight += path_point.weight_until_turn;
|
||||
|
||||
// all changes to this check have to be matched with assemble_geometry
|
||||
if (path_point.turn_instruction.type != extractor::guidance::TurnType::NoTurn)
|
||||
if (path_point.turn_instruction.type != osrm::guidance::TurnType::NoTurn)
|
||||
{
|
||||
BOOST_ASSERT(segment_weight >= 0);
|
||||
const auto name = facade.GetNameForID(step_name_id);
|
||||
@@ -171,7 +171,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
|
||||
intersection.lane_description =
|
||||
path_point.lane_data.second != INVALID_LANE_DESCRIPTIONID
|
||||
? facade.GetTurnDescription(path_point.lane_data.second)
|
||||
: extractor::guidance::TurnLaneDescription();
|
||||
: extractor::TurnLaneDescription();
|
||||
|
||||
// Lanes in turn are bound by total number of lanes at the location
|
||||
BOOST_ASSERT(intersection.lanes.lanes_in_turn <=
|
||||
@@ -290,7 +290,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
|
||||
maneuver = {intersection.location,
|
||||
bearings.first,
|
||||
bearings.second,
|
||||
extractor::guidance::TurnInstruction::NO_TURN(),
|
||||
osrm::guidance::TurnInstruction::NO_TURN(),
|
||||
WaypointType::Arrive,
|
||||
0};
|
||||
|
||||
|
||||
@@ -77,10 +77,10 @@ struct AdjustToCombinedTurnStrategy : CombineStrategy
|
||||
// Set a fixed instruction type
|
||||
struct SetFixedInstructionStrategy : CombineStrategy
|
||||
{
|
||||
SetFixedInstructionStrategy(const extractor::guidance::TurnInstruction instruction);
|
||||
SetFixedInstructionStrategy(const osrm::guidance::TurnInstruction instruction);
|
||||
void operator()(RouteStep &step_at_turn_location, const RouteStep &transfer_from_step) const;
|
||||
|
||||
const extractor::guidance::TurnInstruction instruction;
|
||||
const osrm::guidance::TurnInstruction instruction;
|
||||
};
|
||||
|
||||
// Handling of staggered intersections
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
#include <boost/range/algorithm_ext/erase.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
using osrm::extractor::guidance::TurnInstruction;
|
||||
using namespace osrm::extractor::guidance;
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
@@ -30,7 +27,7 @@ const constexpr double NAME_SEGMENT_CUTOFF_LENGTH = 105.0;
|
||||
// check if a step is completely without turn type
|
||||
inline bool hasTurnType(const RouteStep &step)
|
||||
{
|
||||
return step.maneuver.instruction.type != TurnType::NoTurn;
|
||||
return step.maneuver.instruction.type != osrm::guidance::TurnType::NoTurn;
|
||||
}
|
||||
inline bool hasWaypointType(const RouteStep &step)
|
||||
{
|
||||
@@ -67,12 +64,13 @@ inline RouteStepIterator findNextTurn(RouteStepIterator current_step)
|
||||
}
|
||||
|
||||
// alias for comparisons
|
||||
inline bool hasTurnType(const RouteStep &step, const TurnType::Enum type)
|
||||
inline bool hasTurnType(const RouteStep &step, const osrm::guidance::TurnType::Enum type)
|
||||
{
|
||||
return type == step.maneuver.instruction.type;
|
||||
}
|
||||
// alias for comparisons
|
||||
inline bool hasModifier(const RouteStep &step, const DirectionModifier::Enum modifier)
|
||||
inline bool hasModifier(const RouteStep &step,
|
||||
const osrm::guidance::DirectionModifier::Enum modifier)
|
||||
{
|
||||
return modifier == step.maneuver.instruction.direction_modifier;
|
||||
}
|
||||
@@ -96,12 +94,12 @@ inline std::size_t numberOfAllowedTurns(const RouteStep &step)
|
||||
// fulfill:
|
||||
inline bool isTrafficLightStep(const RouteStep &step)
|
||||
{
|
||||
return hasTurnType(step, TurnType::Suppressed) && numberOfAvailableTurns(step) == 2 &&
|
||||
numberOfAllowedTurns(step) == 1;
|
||||
return hasTurnType(step, osrm::guidance::TurnType::Suppressed) &&
|
||||
numberOfAvailableTurns(step) == 2 && numberOfAllowedTurns(step) == 1;
|
||||
}
|
||||
|
||||
// alias for readability
|
||||
inline void setInstructionType(RouteStep &step, const TurnType::Enum type)
|
||||
inline void setInstructionType(RouteStep &step, const osrm::guidance::TurnType::Enum type)
|
||||
{
|
||||
step.maneuver.instruction.type = type;
|
||||
}
|
||||
@@ -151,12 +149,12 @@ inline bool haveSameName(const RouteStep &lhs, const RouteStep &rhs)
|
||||
inline bool areSameSide(const RouteStep &lhs, const RouteStep &rhs)
|
||||
{
|
||||
const auto is_left = [](const RouteStep &step) {
|
||||
return hasModifier(step, DirectionModifier::Straight) ||
|
||||
return hasModifier(step, osrm::guidance::DirectionModifier::Straight) ||
|
||||
hasLeftModifier(step.maneuver.instruction);
|
||||
};
|
||||
|
||||
const auto is_right = [](const RouteStep &step) {
|
||||
return hasModifier(step, DirectionModifier::Straight) ||
|
||||
return hasModifier(step, osrm::guidance::DirectionModifier::Straight) ||
|
||||
hasRightModifier(step.maneuver.instruction);
|
||||
};
|
||||
|
||||
@@ -174,7 +172,7 @@ inline std::vector<RouteStep> removeNoTurnInstructions(std::vector<RouteStep> st
|
||||
|
||||
// keep valid instructions
|
||||
const auto not_is_valid = [](const RouteStep &step) {
|
||||
return step.maneuver.instruction == TurnInstruction::NO_TURN() &&
|
||||
return step.maneuver.instruction == osrm::guidance::TurnInstruction::NO_TURN() &&
|
||||
step.maneuver.waypoint_type == WaypointType::None;
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "util/guidance/bearing_class.hpp"
|
||||
#include "util/guidance/entry_class.hpp"
|
||||
|
||||
#include "guidance/turn_lane_types.hpp"
|
||||
#include "extractor/turn_lane_types.hpp"
|
||||
#include "util/guidance/turn_lanes.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
@@ -41,7 +41,7 @@ struct IntermediateIntersection
|
||||
|
||||
// turn lane information
|
||||
util::guidance::LaneTuple lanes;
|
||||
extractor::guidance::TurnLaneDescription lane_description;
|
||||
extractor::TurnLaneDescription lane_description;
|
||||
std::vector<std::string> classes;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ struct StepManeuver
|
||||
util::Coordinate location;
|
||||
short bearing_before;
|
||||
short bearing_after;
|
||||
extractor::guidance::TurnInstruction instruction;
|
||||
osrm::guidance::TurnInstruction instruction;
|
||||
|
||||
WaypointType waypoint_type;
|
||||
unsigned exit;
|
||||
@@ -39,7 +39,7 @@ inline StepManeuver getInvalidStepManeuver()
|
||||
return {util::Coordinate{util::FloatLongitude{0.0}, util::FloatLatitude{0.0}},
|
||||
0,
|
||||
0,
|
||||
extractor::guidance::TurnInstruction::NO_TURN(),
|
||||
osrm::guidance::TurnInstruction::NO_TURN(),
|
||||
WaypointType::None,
|
||||
0};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user