Split intersection analysis and guidance code
Intersection analysis occupy in osrm::extractor::intersection namespace and guidance code osrm::guidance
This commit is contained in:
@@ -19,9 +19,9 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace TurnType = osrm::extractor::guidance::TurnType;
|
||||
namespace DirectionModifier = osrm::extractor::guidance::DirectionModifier;
|
||||
using TurnInstruction = osrm::extractor::guidance::TurnInstruction;
|
||||
namespace TurnType = osrm::guidance::TurnType;
|
||||
namespace DirectionModifier = osrm::guidance::DirectionModifier;
|
||||
using TurnInstruction = osrm::guidance::TurnInstruction;
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
@@ -56,7 +56,7 @@ util::json::Array lanesFromIntersection(const guidance::IntermediateIntersection
|
||||
{
|
||||
--lane_id;
|
||||
util::json::Object lane;
|
||||
lane.values["indications"] = extractor::guidance::TurnLaneType::toJsonArray(lane_desc);
|
||||
lane.values["indications"] = extractor::TurnLaneType::toJsonArray(lane_desc);
|
||||
if (lane_id >= intersection.lanes.first_lane_from_the_right &&
|
||||
lane_id <
|
||||
intersection.lanes.first_lane_from_the_right + intersection.lanes.lanes_in_turn)
|
||||
@@ -97,7 +97,7 @@ util::json::Object makeStepManeuver(const guidance::StepManeuver &maneuver)
|
||||
std::string maneuver_type;
|
||||
|
||||
if (maneuver.waypoint_type == guidance::WaypointType::None)
|
||||
maneuver_type = extractor::guidance::instructionTypeToString(maneuver.instruction.type);
|
||||
maneuver_type = osrm::guidance::instructionTypeToString(maneuver.instruction.type);
|
||||
else
|
||||
maneuver_type = detail::waypointTypeToString(maneuver.waypoint_type);
|
||||
|
||||
@@ -107,8 +107,8 @@ util::json::Object makeStepManeuver(const guidance::StepManeuver &maneuver)
|
||||
step_maneuver.values["type"] = std::move(maneuver_type);
|
||||
|
||||
if (detail::isValidModifier(maneuver))
|
||||
step_maneuver.values["modifier"] = extractor::guidance::instructionModifierToString(
|
||||
maneuver.instruction.direction_modifier);
|
||||
step_maneuver.values["modifier"] =
|
||||
osrm::guidance::instructionModifierToString(maneuver.instruction.direction_modifier);
|
||||
|
||||
step_maneuver.values["location"] = detail::coordinateToLonLat(maneuver.location);
|
||||
step_maneuver.values["bearing_before"] = detail::roundAndClampBearing(maneuver.bearing_before);
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace engine
|
||||
{
|
||||
namespace guidance
|
||||
{
|
||||
using namespace osrm::guidance;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@@ -10,16 +10,14 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
using osrm::extractor::guidance::TurnInstruction;
|
||||
using osrm::util::angularDeviation;
|
||||
using namespace osrm::extractor::guidance;
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
{
|
||||
namespace guidance
|
||||
{
|
||||
using osrm::util::angularDeviation;
|
||||
using namespace osrm::guidance;
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -53,7 +51,7 @@ double findTotalTurnAngle(const RouteStep &entry_step, const RouteStep &exit_ste
|
||||
// both angles are in the same direction, the total turn gets increased
|
||||
//
|
||||
// a ---- b
|
||||
// \
|
||||
// \
|
||||
// c
|
||||
// |
|
||||
// d
|
||||
@@ -286,8 +284,7 @@ void StaggeredTurnStrategy::operator()(RouteStep &step_at_turn_location,
|
||||
: TurnType::NewName;
|
||||
}
|
||||
|
||||
SetFixedInstructionStrategy::SetFixedInstructionStrategy(
|
||||
const extractor::guidance::TurnInstruction instruction)
|
||||
SetFixedInstructionStrategy::SetFixedInstructionStrategy(const TurnInstruction instruction)
|
||||
: instruction(instruction)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -9,16 +9,13 @@
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
|
||||
using osrm::extractor::guidance::TurnInstruction;
|
||||
using osrm::extractor::guidance::isLeftTurn;
|
||||
using osrm::extractor::guidance::isRightTurn;
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
{
|
||||
namespace guidance
|
||||
{
|
||||
using namespace osrm::guidance;
|
||||
|
||||
std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
|
||||
const double min_distance_needed_for_lane_change)
|
||||
|
||||
@@ -23,20 +23,15 @@
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
using osrm::util::angularDeviation;
|
||||
using osrm::extractor::guidance::getTurnDirection;
|
||||
using osrm::extractor::guidance::hasRampType;
|
||||
using osrm::extractor::guidance::mirrorDirectionModifier;
|
||||
using osrm::extractor::guidance::bearingToDirectionModifier;
|
||||
|
||||
using RouteStepIterator = std::vector<osrm::engine::guidance::RouteStep>::iterator;
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
{
|
||||
namespace guidance
|
||||
{
|
||||
using namespace osrm::guidance;
|
||||
|
||||
using RouteStepIterator = std::vector<osrm::engine::guidance::RouteStep>::iterator;
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -465,7 +460,7 @@ std::vector<RouteStep> assignRelativeLocations(std::vector<RouteStep> steps,
|
||||
distance_to_start <= MAXIMAL_RELATIVE_DISTANCE
|
||||
? bearingToDirectionModifier(util::coordinate_calculation::computeAngle(
|
||||
source_node.input_location, leg_geometry.locations[0], leg_geometry.locations[1]))
|
||||
: extractor::guidance::DirectionModifier::UTurn;
|
||||
: DirectionModifier::UTurn;
|
||||
|
||||
steps.front().maneuver.instruction.direction_modifier = initial_modifier;
|
||||
|
||||
@@ -478,7 +473,7 @@ std::vector<RouteStep> assignRelativeLocations(std::vector<RouteStep> steps,
|
||||
leg_geometry.locations[leg_geometry.locations.size() - 2],
|
||||
leg_geometry.locations[leg_geometry.locations.size() - 1],
|
||||
target_node.input_location))
|
||||
: extractor::guidance::DirectionModifier::UTurn;
|
||||
: DirectionModifier::UTurn;
|
||||
|
||||
steps.back().maneuver.instruction.direction_modifier = final_modifier;
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace engine
|
||||
{
|
||||
namespace guidance
|
||||
{
|
||||
using namespace osrm::guidance;
|
||||
|
||||
std::vector<RouteStep> suppressShortNameSegments(std::vector<RouteStep> steps)
|
||||
{
|
||||
// guard against empty routes, even though they shouldn't happen
|
||||
|
||||
@@ -765,11 +765,10 @@ void encodeVectorTile(const DataFacadeBase &facade,
|
||||
auto weight_idx =
|
||||
point_float_index.add(t.weight / 10.0); // Note conversion to float here
|
||||
|
||||
auto turntype_idx =
|
||||
point_string_index.add(extractor::guidance::internalInstructionTypeToString(
|
||||
t.turn_instruction.type));
|
||||
auto turntype_idx = point_string_index.add(
|
||||
osrm::guidance::internalInstructionTypeToString(t.turn_instruction.type));
|
||||
auto turnmodifier_idx =
|
||||
point_string_index.add(extractor::guidance::instructionModifierToString(
|
||||
point_string_index.add(osrm::guidance::instructionModifierToString(
|
||||
t.turn_instruction.direction_modifier));
|
||||
return EncodedTurnData{t.coordinate,
|
||||
angle_idx,
|
||||
|
||||
Reference in New Issue
Block a user