Split intersection analysis and guidance code
Intersection analysis occupy in osrm::extractor::intersection namespace and guidance code osrm::guidance
This commit is contained in:
parent
36877e4de5
commit
988b6e3311
@ -157,7 +157,8 @@ add_executable(osrm-routed src/tools/routed.cpp $<TARGET_OBJECTS:SERVER> $<TARGE
|
|||||||
add_executable(osrm-datastore src/tools/store.cpp $<TARGET_OBJECTS:UTIL>)
|
add_executable(osrm-datastore src/tools/store.cpp $<TARGET_OBJECTS:UTIL>)
|
||||||
add_library(osrm src/osrm/osrm.cpp $<TARGET_OBJECTS:ENGINE> $<TARGET_OBJECTS:UTIL> $<TARGET_OBJECTS:STORAGE>)
|
add_library(osrm src/osrm/osrm.cpp $<TARGET_OBJECTS:ENGINE> $<TARGET_OBJECTS:UTIL> $<TARGET_OBJECTS:STORAGE>)
|
||||||
add_library(osrm_contract src/osrm/contractor.cpp $<TARGET_OBJECTS:CONTRACTOR> $<TARGET_OBJECTS:UTIL>)
|
add_library(osrm_contract src/osrm/contractor.cpp $<TARGET_OBJECTS:CONTRACTOR> $<TARGET_OBJECTS:UTIL>)
|
||||||
add_library(osrm_extract src/osrm/extractor.cpp $<TARGET_OBJECTS:GUIDANCE> $<TARGET_OBJECTS:EXTRACTOR> $<TARGET_OBJECTS:UTIL>)
|
add_library(osrm_extract src/osrm/extractor.cpp $<TARGET_OBJECTS:EXTRACTOR> $<TARGET_OBJECTS:UTIL>)
|
||||||
|
add_library(osrm_guidance $<TARGET_OBJECTS:GUIDANCE> $<TARGET_OBJECTS:UTIL>)
|
||||||
add_library(osrm_partition src/osrm/partitioner.cpp $<TARGET_OBJECTS:PARTITIONER> $<TARGET_OBJECTS:UTIL>)
|
add_library(osrm_partition src/osrm/partitioner.cpp $<TARGET_OBJECTS:PARTITIONER> $<TARGET_OBJECTS:UTIL>)
|
||||||
add_library(osrm_customize src/osrm/customizer.cpp $<TARGET_OBJECTS:CUSTOMIZER> $<TARGET_OBJECTS:UTIL>)
|
add_library(osrm_customize src/osrm/customizer.cpp $<TARGET_OBJECTS:CUSTOMIZER> $<TARGET_OBJECTS:UTIL>)
|
||||||
add_library(osrm_update $<TARGET_OBJECTS:UPDATER> $<TARGET_OBJECTS:UTIL>)
|
add_library(osrm_update $<TARGET_OBJECTS:UPDATER> $<TARGET_OBJECTS:UTIL>)
|
||||||
@ -626,6 +627,12 @@ set(EXTRACTOR_LIBRARIES
|
|||||||
${TBB_LIBRARIES}
|
${TBB_LIBRARIES}
|
||||||
${ZLIB_LIBRARY}
|
${ZLIB_LIBRARY}
|
||||||
${MAYBE_COVERAGE_LIBRARIES})
|
${MAYBE_COVERAGE_LIBRARIES})
|
||||||
|
set(GUIDANCE_LIBRARIES
|
||||||
|
${BOOST_BASE_LIBRARIES}
|
||||||
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
|
${USED_LUA_LIBRARIES}
|
||||||
|
${TBB_LIBRARIES}
|
||||||
|
${MAYBE_COVERAGE_LIBRARIES})
|
||||||
set(PARTITIONER_LIBRARIES
|
set(PARTITIONER_LIBRARIES
|
||||||
${BOOST_ENGINE_LIBRARIES}
|
${BOOST_ENGINE_LIBRARIES}
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
@ -678,7 +685,7 @@ set(UTIL_LIBRARIES
|
|||||||
target_link_libraries(osrm ${ENGINE_LIBRARIES})
|
target_link_libraries(osrm ${ENGINE_LIBRARIES})
|
||||||
target_link_libraries(osrm_update ${UPDATER_LIBRARIES})
|
target_link_libraries(osrm_update ${UPDATER_LIBRARIES})
|
||||||
target_link_libraries(osrm_contract ${CONTRACTOR_LIBRARIES} osrm_update osrm_store)
|
target_link_libraries(osrm_contract ${CONTRACTOR_LIBRARIES} osrm_update osrm_store)
|
||||||
target_link_libraries(osrm_extract ${EXTRACTOR_LIBRARIES})
|
target_link_libraries(osrm_extract osrm_guidance ${EXTRACTOR_LIBRARIES})
|
||||||
target_link_libraries(osrm_partition ${PARTITIONER_LIBRARIES})
|
target_link_libraries(osrm_partition ${PARTITIONER_LIBRARIES})
|
||||||
target_link_libraries(osrm_customize ${CUSTOMIZER_LIBRARIES} osrm_update osrm_store)
|
target_link_libraries(osrm_customize ${CUSTOMIZER_LIBRARIES} osrm_update osrm_store)
|
||||||
target_link_libraries(osrm_store ${STORAGE_LIBRARIES})
|
target_link_libraries(osrm_store ${STORAGE_LIBRARIES})
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
#include "extractor/packed_osm_ids.hpp"
|
#include "extractor/packed_osm_ids.hpp"
|
||||||
#include "extractor/profile_properties.hpp"
|
#include "extractor/profile_properties.hpp"
|
||||||
#include "extractor/segment_data_container.hpp"
|
#include "extractor/segment_data_container.hpp"
|
||||||
#include "extractor/turn_data_container.hpp"
|
#include "extractor/turn_lane_types.hpp"
|
||||||
|
#include "guidance/turn_data_container.hpp"
|
||||||
#include "guidance/turn_instruction.hpp"
|
#include "guidance/turn_instruction.hpp"
|
||||||
#include "guidance/turn_lane_types.hpp"
|
|
||||||
|
|
||||||
#include "contractor/query_graph.hpp"
|
#include "contractor/query_graph.hpp"
|
||||||
|
|
||||||
@ -192,12 +192,12 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
util::vector_view<util::Coordinate> m_coordinate_list;
|
util::vector_view<util::Coordinate> m_coordinate_list;
|
||||||
extractor::PackedOSMIDsView m_osmnodeid_list;
|
extractor::PackedOSMIDsView m_osmnodeid_list;
|
||||||
util::vector_view<std::uint32_t> m_lane_description_offsets;
|
util::vector_view<std::uint32_t> m_lane_description_offsets;
|
||||||
util::vector_view<extractor::guidance::TurnLaneType::Mask> m_lane_description_masks;
|
util::vector_view<extractor::TurnLaneType::Mask> m_lane_description_masks;
|
||||||
util::vector_view<TurnPenalty> m_turn_weight_penalties;
|
util::vector_view<TurnPenalty> m_turn_weight_penalties;
|
||||||
util::vector_view<TurnPenalty> m_turn_duration_penalties;
|
util::vector_view<TurnPenalty> m_turn_duration_penalties;
|
||||||
extractor::SegmentDataView segment_data;
|
extractor::SegmentDataView segment_data;
|
||||||
extractor::TurnDataView turn_data;
|
|
||||||
extractor::EdgeBasedNodeDataView edge_based_node_data;
|
extractor::EdgeBasedNodeDataView edge_based_node_data;
|
||||||
|
guidance::TurnDataView turn_data;
|
||||||
|
|
||||||
util::vector_view<char> m_datasource_name_data;
|
util::vector_view<char> m_datasource_name_data;
|
||||||
util::vector_view<std::size_t> m_datasource_name_offsets;
|
util::vector_view<std::size_t> m_datasource_name_offsets;
|
||||||
@ -318,10 +318,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
util::vector_view<LaneDataID> lane_data_ids(
|
util::vector_view<LaneDataID> lane_data_ids(
|
||||||
lane_data_id_ptr, layout.num_entries[storage::DataLayout::LANE_DATA_ID]);
|
lane_data_id_ptr, layout.num_entries[storage::DataLayout::LANE_DATA_ID]);
|
||||||
|
|
||||||
const auto turn_instruction_list_ptr =
|
const auto turn_instruction_list_ptr = layout.GetBlockPtr<guidance::TurnInstruction>(
|
||||||
layout.GetBlockPtr<extractor::guidance::TurnInstruction>(
|
memory_ptr, storage::DataLayout::TURN_INSTRUCTION);
|
||||||
memory_ptr, storage::DataLayout::TURN_INSTRUCTION);
|
util::vector_view<guidance::TurnInstruction> turn_instructions(
|
||||||
util::vector_view<extractor::guidance::TurnInstruction> turn_instructions(
|
|
||||||
turn_instruction_list_ptr, layout.num_entries[storage::DataLayout::TURN_INSTRUCTION]);
|
turn_instruction_list_ptr, layout.num_entries[storage::DataLayout::TURN_INSTRUCTION]);
|
||||||
|
|
||||||
const auto entry_class_id_list_ptr =
|
const auto entry_class_id_list_ptr =
|
||||||
@ -339,11 +338,11 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
util::vector_view<util::guidance::TurnBearing> post_turn_bearings(
|
util::vector_view<util::guidance::TurnBearing> post_turn_bearings(
|
||||||
post_turn_bearing_ptr, layout.num_entries[storage::DataLayout::POST_TURN_BEARING]);
|
post_turn_bearing_ptr, layout.num_entries[storage::DataLayout::POST_TURN_BEARING]);
|
||||||
|
|
||||||
turn_data = extractor::TurnDataView(std::move(turn_instructions),
|
turn_data = guidance::TurnDataView(std::move(turn_instructions),
|
||||||
std::move(lane_data_ids),
|
std::move(lane_data_ids),
|
||||||
std::move(entry_class_ids),
|
std::move(entry_class_ids),
|
||||||
std::move(pre_turn_bearings),
|
std::move(pre_turn_bearings),
|
||||||
std::move(post_turn_bearings));
|
std::move(post_turn_bearings));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeNamePointers(storage::DataLayout &data_layout, char *memory_block)
|
void InitializeNamePointers(storage::DataLayout &data_layout, char *memory_block)
|
||||||
@ -363,10 +362,10 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
offsets_ptr, data_layout.num_entries[storage::DataLayout::LANE_DESCRIPTION_OFFSETS]);
|
offsets_ptr, data_layout.num_entries[storage::DataLayout::LANE_DESCRIPTION_OFFSETS]);
|
||||||
m_lane_description_offsets = std::move(offsets);
|
m_lane_description_offsets = std::move(offsets);
|
||||||
|
|
||||||
auto masks_ptr = data_layout.GetBlockPtr<extractor::guidance::TurnLaneType::Mask>(
|
auto masks_ptr = data_layout.GetBlockPtr<extractor::TurnLaneType::Mask>(
|
||||||
memory_block, storage::DataLayout::LANE_DESCRIPTION_MASKS);
|
memory_block, storage::DataLayout::LANE_DESCRIPTION_MASKS);
|
||||||
|
|
||||||
util::vector_view<extractor::guidance::TurnLaneType::Mask> masks(
|
util::vector_view<extractor::TurnLaneType::Mask> masks(
|
||||||
masks_ptr, data_layout.num_entries[storage::DataLayout::LANE_DESCRIPTION_MASKS]);
|
masks_ptr, data_layout.num_entries[storage::DataLayout::LANE_DESCRIPTION_MASKS]);
|
||||||
m_lane_description_masks = std::move(masks);
|
m_lane_description_masks = std::move(masks);
|
||||||
|
|
||||||
@ -609,7 +608,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
return m_turn_duration_penalties[id];
|
return m_turn_duration_penalties[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
extractor::guidance::TurnInstruction
|
osrm::guidance::TurnInstruction
|
||||||
GetTurnInstructionForEdgeID(const EdgeID id) const override final
|
GetTurnInstructionForEdgeID(const EdgeID id) const override final
|
||||||
{
|
{
|
||||||
return turn_data.GetTurnInstruction(id);
|
return turn_data.GetTurnInstruction(id);
|
||||||
@ -868,13 +867,13 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
return m_lane_tupel_id_pairs.at(turn_data.GetLaneDataID(id));
|
return m_lane_tupel_id_pairs.at(turn_data.GetLaneDataID(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
extractor::guidance::TurnLaneDescription
|
extractor::TurnLaneDescription
|
||||||
GetTurnDescription(const LaneDescriptionID lane_description_id) const override final
|
GetTurnDescription(const LaneDescriptionID lane_description_id) const override final
|
||||||
{
|
{
|
||||||
if (lane_description_id == INVALID_LANE_DESCRIPTIONID)
|
if (lane_description_id == INVALID_LANE_DESCRIPTIONID)
|
||||||
return {};
|
return {};
|
||||||
else
|
else
|
||||||
return extractor::guidance::TurnLaneDescription(
|
return extractor::TurnLaneDescription(
|
||||||
m_lane_description_masks.begin() + m_lane_description_offsets[lane_description_id],
|
m_lane_description_masks.begin() + m_lane_description_offsets[lane_description_id],
|
||||||
m_lane_description_masks.begin() +
|
m_lane_description_masks.begin() +
|
||||||
m_lane_description_offsets[lane_description_id + 1]);
|
m_lane_description_offsets[lane_description_id + 1]);
|
||||||
|
@ -10,11 +10,10 @@
|
|||||||
|
|
||||||
#include "extractor/class_data.hpp"
|
#include "extractor/class_data.hpp"
|
||||||
#include "extractor/edge_based_node_segment.hpp"
|
#include "extractor/edge_based_node_segment.hpp"
|
||||||
#include "extractor/original_edge_data.hpp"
|
|
||||||
#include "extractor/query_node.hpp"
|
#include "extractor/query_node.hpp"
|
||||||
#include "extractor/travel_mode.hpp"
|
#include "extractor/travel_mode.hpp"
|
||||||
|
#include "extractor/turn_lane_types.hpp"
|
||||||
#include "guidance/turn_instruction.hpp"
|
#include "guidance/turn_instruction.hpp"
|
||||||
#include "guidance/turn_lane_types.hpp"
|
|
||||||
|
|
||||||
#include "util/exception.hpp"
|
#include "util/exception.hpp"
|
||||||
#include "util/guidance/bearing_class.hpp"
|
#include "util/guidance/bearing_class.hpp"
|
||||||
@ -87,8 +86,7 @@ class BaseDataFacade
|
|||||||
// Gets the name of a datasource
|
// Gets the name of a datasource
|
||||||
virtual StringView GetDatasourceName(const DatasourceID id) const = 0;
|
virtual StringView GetDatasourceName(const DatasourceID id) const = 0;
|
||||||
|
|
||||||
virtual extractor::guidance::TurnInstruction
|
virtual osrm::guidance::TurnInstruction GetTurnInstructionForEdgeID(const EdgeID id) const = 0;
|
||||||
GetTurnInstructionForEdgeID(const EdgeID id) const = 0;
|
|
||||||
|
|
||||||
virtual extractor::TravelMode GetTravelMode(const NodeID id) const = 0;
|
virtual extractor::TravelMode GetTravelMode(const NodeID id) const = 0;
|
||||||
|
|
||||||
@ -156,7 +154,7 @@ class BaseDataFacade
|
|||||||
|
|
||||||
virtual bool HasLaneData(const EdgeID id) const = 0;
|
virtual bool HasLaneData(const EdgeID id) const = 0;
|
||||||
virtual util::guidance::LaneTupleIdPair GetLaneData(const EdgeID id) const = 0;
|
virtual util::guidance::LaneTupleIdPair GetLaneData(const EdgeID id) const = 0;
|
||||||
virtual extractor::guidance::TurnLaneDescription
|
virtual extractor::TurnLaneDescription
|
||||||
GetTurnDescription(const LaneDescriptionID lane_description_id) const = 0;
|
GetTurnDescription(const LaneDescriptionID lane_description_id) const = 0;
|
||||||
|
|
||||||
virtual NameID GetNameIndex(const NodeID id) const = 0;
|
virtual NameID GetNameIndex(const NodeID id) const = 0;
|
||||||
|
@ -70,7 +70,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
|||||||
cumulative_distance += current_distance;
|
cumulative_distance += current_distance;
|
||||||
|
|
||||||
// all changes to this check have to be matched with assemble_steps
|
// 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_distances.push_back(cumulative_distance);
|
||||||
geometry.segment_offsets.push_back(geometry.locations.size());
|
geometry.segment_offsets.push_back(geometry.locations.size());
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#define ENGINE_GUIDANCE_ASSEMBLE_STEPS_HPP_
|
#define ENGINE_GUIDANCE_ASSEMBLE_STEPS_HPP_
|
||||||
|
|
||||||
#include "extractor/travel_mode.hpp"
|
#include "extractor/travel_mode.hpp"
|
||||||
|
#include "extractor/turn_lane_types.hpp"
|
||||||
#include "guidance/turn_instruction.hpp"
|
#include "guidance/turn_instruction.hpp"
|
||||||
#include "guidance/turn_lane_types.hpp"
|
|
||||||
#include "engine/datafacade/datafacade_base.hpp"
|
#include "engine/datafacade/datafacade_base.hpp"
|
||||||
#include "engine/guidance/leg_geometry.hpp"
|
#include "engine/guidance/leg_geometry.hpp"
|
||||||
#include "engine/guidance/route_step.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,
|
StepManeuver maneuver{source_node.location,
|
||||||
bearings.first,
|
bearings.first,
|
||||||
bearings.second,
|
bearings.second,
|
||||||
extractor::guidance::TurnInstruction::NO_TURN(),
|
osrm::guidance::TurnInstruction::NO_TURN(),
|
||||||
WaypointType::Depart,
|
WaypointType::Depart,
|
||||||
0};
|
0};
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
|
|||||||
segment_weight += path_point.weight_until_turn;
|
segment_weight += path_point.weight_until_turn;
|
||||||
|
|
||||||
// all changes to this check have to be matched with assemble_geometry
|
// 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);
|
BOOST_ASSERT(segment_weight >= 0);
|
||||||
const auto name = facade.GetNameForID(step_name_id);
|
const auto name = facade.GetNameForID(step_name_id);
|
||||||
@ -171,7 +171,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
|
|||||||
intersection.lane_description =
|
intersection.lane_description =
|
||||||
path_point.lane_data.second != INVALID_LANE_DESCRIPTIONID
|
path_point.lane_data.second != INVALID_LANE_DESCRIPTIONID
|
||||||
? facade.GetTurnDescription(path_point.lane_data.second)
|
? 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
|
// Lanes in turn are bound by total number of lanes at the location
|
||||||
BOOST_ASSERT(intersection.lanes.lanes_in_turn <=
|
BOOST_ASSERT(intersection.lanes.lanes_in_turn <=
|
||||||
@ -290,7 +290,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
|
|||||||
maneuver = {intersection.location,
|
maneuver = {intersection.location,
|
||||||
bearings.first,
|
bearings.first,
|
||||||
bearings.second,
|
bearings.second,
|
||||||
extractor::guidance::TurnInstruction::NO_TURN(),
|
osrm::guidance::TurnInstruction::NO_TURN(),
|
||||||
WaypointType::Arrive,
|
WaypointType::Arrive,
|
||||||
0};
|
0};
|
||||||
|
|
||||||
|
@ -77,10 +77,10 @@ struct AdjustToCombinedTurnStrategy : CombineStrategy
|
|||||||
// Set a fixed instruction type
|
// Set a fixed instruction type
|
||||||
struct SetFixedInstructionStrategy : CombineStrategy
|
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;
|
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
|
// Handling of staggered intersections
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
#include <boost/range/algorithm_ext/erase.hpp>
|
#include <boost/range/algorithm_ext/erase.hpp>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
using osrm::extractor::guidance::TurnInstruction;
|
|
||||||
using namespace osrm::extractor::guidance;
|
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace engine
|
namespace engine
|
||||||
@ -30,7 +27,7 @@ const constexpr double NAME_SEGMENT_CUTOFF_LENGTH = 105.0;
|
|||||||
// check if a step is completely without turn type
|
// check if a step is completely without turn type
|
||||||
inline bool hasTurnType(const RouteStep &step)
|
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)
|
inline bool hasWaypointType(const RouteStep &step)
|
||||||
{
|
{
|
||||||
@ -67,12 +64,13 @@ inline RouteStepIterator findNextTurn(RouteStepIterator current_step)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// alias for comparisons
|
// 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;
|
return type == step.maneuver.instruction.type;
|
||||||
}
|
}
|
||||||
// alias for comparisons
|
// 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;
|
return modifier == step.maneuver.instruction.direction_modifier;
|
||||||
}
|
}
|
||||||
@ -96,12 +94,12 @@ inline std::size_t numberOfAllowedTurns(const RouteStep &step)
|
|||||||
// fulfill:
|
// fulfill:
|
||||||
inline bool isTrafficLightStep(const RouteStep &step)
|
inline bool isTrafficLightStep(const RouteStep &step)
|
||||||
{
|
{
|
||||||
return hasTurnType(step, TurnType::Suppressed) && numberOfAvailableTurns(step) == 2 &&
|
return hasTurnType(step, osrm::guidance::TurnType::Suppressed) &&
|
||||||
numberOfAllowedTurns(step) == 1;
|
numberOfAvailableTurns(step) == 2 && numberOfAllowedTurns(step) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// alias for readability
|
// 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;
|
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)
|
inline bool areSameSide(const RouteStep &lhs, const RouteStep &rhs)
|
||||||
{
|
{
|
||||||
const auto is_left = [](const RouteStep &step) {
|
const auto is_left = [](const RouteStep &step) {
|
||||||
return hasModifier(step, DirectionModifier::Straight) ||
|
return hasModifier(step, osrm::guidance::DirectionModifier::Straight) ||
|
||||||
hasLeftModifier(step.maneuver.instruction);
|
hasLeftModifier(step.maneuver.instruction);
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto is_right = [](const RouteStep &step) {
|
const auto is_right = [](const RouteStep &step) {
|
||||||
return hasModifier(step, DirectionModifier::Straight) ||
|
return hasModifier(step, osrm::guidance::DirectionModifier::Straight) ||
|
||||||
hasRightModifier(step.maneuver.instruction);
|
hasRightModifier(step.maneuver.instruction);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -174,7 +172,7 @@ inline std::vector<RouteStep> removeNoTurnInstructions(std::vector<RouteStep> st
|
|||||||
|
|
||||||
// keep valid instructions
|
// keep valid instructions
|
||||||
const auto not_is_valid = [](const RouteStep &step) {
|
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;
|
step.maneuver.waypoint_type == WaypointType::None;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "util/guidance/bearing_class.hpp"
|
#include "util/guidance/bearing_class.hpp"
|
||||||
#include "util/guidance/entry_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 "util/guidance/turn_lanes.hpp"
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
@ -41,7 +41,7 @@ struct IntermediateIntersection
|
|||||||
|
|
||||||
// turn lane information
|
// turn lane information
|
||||||
util::guidance::LaneTuple lanes;
|
util::guidance::LaneTuple lanes;
|
||||||
extractor::guidance::TurnLaneDescription lane_description;
|
extractor::TurnLaneDescription lane_description;
|
||||||
std::vector<std::string> classes;
|
std::vector<std::string> classes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ struct StepManeuver
|
|||||||
util::Coordinate location;
|
util::Coordinate location;
|
||||||
short bearing_before;
|
short bearing_before;
|
||||||
short bearing_after;
|
short bearing_after;
|
||||||
extractor::guidance::TurnInstruction instruction;
|
osrm::guidance::TurnInstruction instruction;
|
||||||
|
|
||||||
WaypointType waypoint_type;
|
WaypointType waypoint_type;
|
||||||
unsigned exit;
|
unsigned exit;
|
||||||
@ -39,7 +39,7 @@ inline StepManeuver getInvalidStepManeuver()
|
|||||||
return {util::Coordinate{util::FloatLongitude{0.0}, util::FloatLatitude{0.0}},
|
return {util::Coordinate{util::FloatLongitude{0.0}, util::FloatLatitude{0.0}},
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
extractor::guidance::TurnInstruction::NO_TURN(),
|
osrm::guidance::TurnInstruction::NO_TURN(),
|
||||||
WaypointType::None,
|
WaypointType::None,
|
||||||
0};
|
0};
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ struct PathData
|
|||||||
// will contain the duration of the turn. Otherwise it will be 0.
|
// will contain the duration of the turn. Otherwise it will be 0.
|
||||||
EdgeWeight duration_of_turn;
|
EdgeWeight duration_of_turn;
|
||||||
// instruction to execute at the turn
|
// instruction to execute at the turn
|
||||||
extractor::guidance::TurnInstruction turn_instruction;
|
osrm::guidance::TurnInstruction turn_instruction;
|
||||||
// turn lane data
|
// turn lane data
|
||||||
util::guidance::LaneTupleIdPair lane_data;
|
util::guidance::LaneTupleIdPair lane_data;
|
||||||
// travel mode of the street that leads to the turn
|
// travel mode of the street that leads to the turn
|
||||||
|
@ -199,7 +199,7 @@ void annotatePath(const FacadeT &facade,
|
|||||||
0,
|
0,
|
||||||
duration_vector[segment_idx],
|
duration_vector[segment_idx],
|
||||||
0,
|
0,
|
||||||
extractor::guidance::TurnInstruction::NO_TURN(),
|
guidance::TurnInstruction::NO_TURN(),
|
||||||
{{0, INVALID_LANEID}, INVALID_LANE_DESCRIPTIONID},
|
{{0, INVALID_LANEID}, INVALID_LANE_DESCRIPTIONID},
|
||||||
travel_mode,
|
travel_mode,
|
||||||
classes,
|
classes,
|
||||||
@ -273,7 +273,7 @@ void annotatePath(const FacadeT &facade,
|
|||||||
0,
|
0,
|
||||||
duration_vector[segment_idx],
|
duration_vector[segment_idx],
|
||||||
0,
|
0,
|
||||||
extractor::guidance::TurnInstruction::NO_TURN(),
|
guidance::TurnInstruction::NO_TURN(),
|
||||||
{{0, INVALID_LANEID}, INVALID_LANE_DESCRIPTIONID},
|
{{0, INVALID_LANEID}, INVALID_LANE_DESCRIPTIONID},
|
||||||
facade.GetTravelMode(target_node_id),
|
facade.GetTravelMode(target_node_id),
|
||||||
facade.GetClassData(target_node_id),
|
facade.GetClassData(target_node_id),
|
||||||
|
@ -24,7 +24,7 @@ struct TurnData final
|
|||||||
const int turn_angle;
|
const int turn_angle;
|
||||||
const EdgeWeight weight;
|
const EdgeWeight weight;
|
||||||
const EdgeWeight duration;
|
const EdgeWeight duration;
|
||||||
const extractor::guidance::TurnInstruction turn_instruction;
|
const guidance::TurnInstruction turn_instruction;
|
||||||
};
|
};
|
||||||
|
|
||||||
using RTreeLeaf = datafacade::BaseDataFacade::RTreeLeaf;
|
using RTreeLeaf = datafacade::BaseDataFacade::RTreeLeaf;
|
||||||
|
@ -10,13 +10,12 @@
|
|||||||
#include "extractor/extraction_turn.hpp"
|
#include "extractor/extraction_turn.hpp"
|
||||||
#include "extractor/nbg_to_ebg.hpp"
|
#include "extractor/nbg_to_ebg.hpp"
|
||||||
#include "extractor/node_data_container.hpp"
|
#include "extractor/node_data_container.hpp"
|
||||||
#include "extractor/original_edge_data.hpp"
|
|
||||||
#include "extractor/query_node.hpp"
|
#include "extractor/query_node.hpp"
|
||||||
#include "extractor/restriction_index.hpp"
|
#include "extractor/restriction_index.hpp"
|
||||||
|
#include "extractor/turn_lane_types.hpp"
|
||||||
#include "extractor/way_restriction_map.hpp"
|
#include "extractor/way_restriction_map.hpp"
|
||||||
#include "guidance/turn_analysis.hpp"
|
#include "guidance/turn_analysis.hpp"
|
||||||
#include "guidance/turn_instruction.hpp"
|
#include "guidance/turn_instruction.hpp"
|
||||||
#include "guidance/turn_lane_types.hpp"
|
|
||||||
|
|
||||||
#include "util/concurrent_id_map.hpp"
|
#include "util/concurrent_id_map.hpp"
|
||||||
#include "util/deallocating_vector.hpp"
|
#include "util/deallocating_vector.hpp"
|
||||||
@ -76,7 +75,7 @@ class EdgeBasedGraphFactory
|
|||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const std::unordered_set<EdgeID> &segregated_edges,
|
const std::unordered_set<EdgeID> &segregated_edges,
|
||||||
guidance::LaneDescriptionMap &lane_description_map);
|
LaneDescriptionMap &lane_description_map);
|
||||||
|
|
||||||
void Run(ScriptingEnvironment &scripting_environment,
|
void Run(ScriptingEnvironment &scripting_environment,
|
||||||
const std::string &turn_data_filename,
|
const std::string &turn_data_filename,
|
||||||
@ -159,7 +158,7 @@ class EdgeBasedGraphFactory
|
|||||||
|
|
||||||
const util::NameTable &name_table;
|
const util::NameTable &name_table;
|
||||||
const std::unordered_set<EdgeID> &segregated_edges;
|
const std::unordered_set<EdgeID> &segregated_edges;
|
||||||
guidance::LaneDescriptionMap &lane_description_map;
|
LaneDescriptionMap &lane_description_map;
|
||||||
|
|
||||||
// In the edge based graph, any traversable (non reversed) edge of the node-based graph forms a
|
// In the edge based graph, any traversable (non reversed) edge of the node-based graph forms a
|
||||||
// node of the edge-based graph. To be able to name these nodes, we loop over the node-based
|
// node of the edge-based graph. To be able to name these nodes, we loop over the node-based
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef OSRM_EXTRACTION_TURN_HPP
|
#ifndef OSRM_EXTRACTION_TURN_HPP
|
||||||
#define OSRM_EXTRACTION_TURN_HPP
|
#define OSRM_EXTRACTION_TURN_HPP
|
||||||
|
|
||||||
#include <boost/numeric/conversion/cast.hpp>
|
#include <extractor/travel_mode.hpp>
|
||||||
|
|
||||||
#include <guidance/intersection.hpp>
|
#include <boost/numeric/conversion/cast.hpp>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef EXTRACTION_WAY_HPP
|
#ifndef EXTRACTION_WAY_HPP
|
||||||
#define EXTRACTION_WAY_HPP
|
#define EXTRACTION_WAY_HPP
|
||||||
|
|
||||||
|
#include "extractor/road_classification.hpp"
|
||||||
#include "extractor/travel_mode.hpp"
|
#include "extractor/travel_mode.hpp"
|
||||||
#include "guidance/road_classification.hpp"
|
|
||||||
#include "util/guidance/turn_lanes.hpp"
|
#include "util/guidance/turn_lanes.hpp"
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
|
|
||||||
@ -54,9 +54,9 @@ struct ExtractionWay
|
|||||||
exits.clear();
|
exits.clear();
|
||||||
turn_lanes_forward.clear();
|
turn_lanes_forward.clear();
|
||||||
turn_lanes_backward.clear();
|
turn_lanes_backward.clear();
|
||||||
road_classification = guidance::RoadClassification();
|
road_classification = RoadClassification();
|
||||||
forward_travel_mode = extractor::TRAVEL_MODE_INACCESSIBLE;
|
forward_travel_mode = TRAVEL_MODE_INACCESSIBLE;
|
||||||
backward_travel_mode = extractor::TRAVEL_MODE_INACCESSIBLE;
|
backward_travel_mode = TRAVEL_MODE_INACCESSIBLE;
|
||||||
roundabout = false;
|
roundabout = false;
|
||||||
circular = false;
|
circular = false;
|
||||||
is_startpoint = true;
|
is_startpoint = true;
|
||||||
@ -113,9 +113,9 @@ struct ExtractionWay
|
|||||||
std::string exits;
|
std::string exits;
|
||||||
std::string turn_lanes_forward;
|
std::string turn_lanes_forward;
|
||||||
std::string turn_lanes_backward;
|
std::string turn_lanes_backward;
|
||||||
guidance::RoadClassification road_classification;
|
RoadClassification road_classification;
|
||||||
extractor::TravelMode forward_travel_mode : 4;
|
TravelMode forward_travel_mode : 4;
|
||||||
extractor::TravelMode backward_travel_mode : 4;
|
TravelMode backward_travel_mode : 4;
|
||||||
|
|
||||||
// Boolean flags
|
// Boolean flags
|
||||||
bool roundabout : 1;
|
bool roundabout : 1;
|
||||||
|
@ -57,7 +57,7 @@ class Extractor
|
|||||||
private:
|
private:
|
||||||
ExtractorConfig config;
|
ExtractorConfig config;
|
||||||
|
|
||||||
std::tuple<guidance::LaneDescriptionMap,
|
std::tuple<LaneDescriptionMap,
|
||||||
std::vector<TurnRestriction>,
|
std::vector<TurnRestriction>,
|
||||||
std::vector<ConditionalTurnRestriction>>
|
std::vector<ConditionalTurnRestriction>>
|
||||||
ParseOSMData(ScriptingEnvironment &scripting_environment, const unsigned number_of_threads);
|
ParseOSMData(ScriptingEnvironment &scripting_environment, const unsigned number_of_threads);
|
||||||
@ -73,7 +73,7 @@ class Extractor
|
|||||||
const std::vector<ConditionalTurnRestriction> &conditional_turn_restrictions,
|
const std::vector<ConditionalTurnRestriction> &conditional_turn_restrictions,
|
||||||
const std::unordered_set<EdgeID> &segregated_edges,
|
const std::unordered_set<EdgeID> &segregated_edges,
|
||||||
// might have to be updated to add new lane combinations
|
// might have to be updated to add new lane combinations
|
||||||
guidance::LaneDescriptionMap &turn_lane_map,
|
LaneDescriptionMap &turn_lane_map,
|
||||||
// for calculating turn penalties
|
// for calculating turn penalties
|
||||||
ScriptingEnvironment &scripting_environment,
|
ScriptingEnvironment &scripting_environment,
|
||||||
// output data
|
// output data
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define EXTRACTOR_CALLBACKS_HPP
|
#define EXTRACTOR_CALLBACKS_HPP
|
||||||
|
|
||||||
#include "extractor/class_data.hpp"
|
#include "extractor/class_data.hpp"
|
||||||
#include "guidance/turn_lane_types.hpp"
|
#include "extractor/turn_lane_types.hpp"
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
|
|
||||||
#include <boost/functional/hash.hpp>
|
#include <boost/functional/hash.hpp>
|
||||||
@ -67,7 +67,7 @@ class ExtractorCallbacks
|
|||||||
StringMap string_map;
|
StringMap string_map;
|
||||||
ExtractionContainers &external_memory;
|
ExtractionContainers &external_memory;
|
||||||
std::unordered_map<std::string, ClassData> &classes_map;
|
std::unordered_map<std::string, ClassData> &classes_map;
|
||||||
guidance::LaneDescriptionMap &lane_description_map;
|
LaneDescriptionMap &lane_description_map;
|
||||||
bool fallback_to_duration;
|
bool fallback_to_duration;
|
||||||
bool force_split_edges;
|
bool force_split_edges;
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ class ExtractorCallbacks
|
|||||||
|
|
||||||
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers,
|
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers,
|
||||||
std::unordered_map<std::string, ClassData> &classes_map,
|
std::unordered_map<std::string, ClassData> &classes_map,
|
||||||
guidance::LaneDescriptionMap &lane_description_map,
|
LaneDescriptionMap &lane_description_map,
|
||||||
const ProfileProperties &properties);
|
const ProfileProperties &properties);
|
||||||
|
|
||||||
ExtractorCallbacks(const ExtractorCallbacks &) = delete;
|
ExtractorCallbacks(const ExtractorCallbacks &) = delete;
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
#include "extractor/node_data_container.hpp"
|
#include "extractor/node_data_container.hpp"
|
||||||
#include "extractor/profile_properties.hpp"
|
#include "extractor/profile_properties.hpp"
|
||||||
#include "extractor/serialization.hpp"
|
#include "extractor/serialization.hpp"
|
||||||
#include "extractor/turn_data_container.hpp"
|
#include "extractor/turn_lane_types.hpp"
|
||||||
#include "guidance/turn_lane_types.hpp"
|
|
||||||
|
|
||||||
#include "util/coordinate.hpp"
|
#include "util/coordinate.hpp"
|
||||||
#include "util/guidance/bearing_class.hpp"
|
#include "util/guidance/bearing_class.hpp"
|
||||||
@ -197,34 +196,6 @@ inline void writeSegmentData(const boost::filesystem::path &path, const SegmentD
|
|||||||
serialization::write(writer, segment_data);
|
serialization::write(writer, segment_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reads .osrm.edges
|
|
||||||
template <typename TurnDataT>
|
|
||||||
inline void readTurnData(const boost::filesystem::path &path, TurnDataT &turn_data)
|
|
||||||
{
|
|
||||||
static_assert(std::is_same<TurnDataContainer, TurnDataT>::value ||
|
|
||||||
std::is_same<TurnDataView, TurnDataT>::value ||
|
|
||||||
std::is_same<TurnDataExternalContainer, TurnDataT>::value,
|
|
||||||
"");
|
|
||||||
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
|
|
||||||
storage::io::FileReader reader{path, fingerprint};
|
|
||||||
|
|
||||||
serialization::read(reader, turn_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// writes .osrm.edges
|
|
||||||
template <typename TurnDataT>
|
|
||||||
inline void writeTurnData(const boost::filesystem::path &path, const TurnDataT &turn_data)
|
|
||||||
{
|
|
||||||
static_assert(std::is_same<TurnDataContainer, TurnDataT>::value ||
|
|
||||||
std::is_same<TurnDataView, TurnDataT>::value ||
|
|
||||||
std::is_same<TurnDataExternalContainer, TurnDataT>::value,
|
|
||||||
"");
|
|
||||||
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
|
|
||||||
storage::io::FileWriter writer{path, fingerprint};
|
|
||||||
|
|
||||||
serialization::write(writer, turn_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// reads .osrm.ebg_nodes
|
// reads .osrm.ebg_nodes
|
||||||
template <typename NodeDataT>
|
template <typename NodeDataT>
|
||||||
inline void readNodeData(const boost::filesystem::path &path, NodeDataT &node_data)
|
inline void readNodeData(const boost::filesystem::path &path, NodeDataT &node_data)
|
||||||
@ -259,9 +230,8 @@ inline void readTurnLaneDescriptions(const boost::filesystem::path &path,
|
|||||||
OffsetsT &turn_offsets,
|
OffsetsT &turn_offsets,
|
||||||
MaskT &turn_masks)
|
MaskT &turn_masks)
|
||||||
{
|
{
|
||||||
static_assert(
|
static_assert(std::is_same<typename MaskT::value_type, extractor::TurnLaneType::Mask>::value,
|
||||||
std::is_same<typename MaskT::value_type, extractor::guidance::TurnLaneType::Mask>::value,
|
"");
|
||||||
"");
|
|
||||||
static_assert(std::is_same<typename OffsetsT::value_type, std::uint32_t>::value, "");
|
static_assert(std::is_same<typename OffsetsT::value_type, std::uint32_t>::value, "");
|
||||||
|
|
||||||
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
|
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
|
||||||
@ -277,9 +247,8 @@ inline void writeTurnLaneDescriptions(const boost::filesystem::path &path,
|
|||||||
const OffsetsT &turn_offsets,
|
const OffsetsT &turn_offsets,
|
||||||
const MaskT &turn_masks)
|
const MaskT &turn_masks)
|
||||||
{
|
{
|
||||||
static_assert(
|
static_assert(std::is_same<typename MaskT::value_type, extractor::TurnLaneType::Mask>::value,
|
||||||
std::is_same<typename MaskT::value_type, extractor::guidance::TurnLaneType::Mask>::value,
|
"");
|
||||||
"");
|
|
||||||
static_assert(std::is_same<typename OffsetsT::value_type, std::uint32_t>::value, "");
|
static_assert(std::is_same<typename OffsetsT::value_type, std::uint32_t>::value, "");
|
||||||
|
|
||||||
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
|
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
#include "extractor/node_based_edge.hpp"
|
#include "extractor/node_based_edge.hpp"
|
||||||
#include "extractor/travel_mode.hpp"
|
#include "extractor/travel_mode.hpp"
|
||||||
#include "guidance/road_classification.hpp"
|
|
||||||
#include "guidance/turn_lane_types.hpp"
|
|
||||||
#include "osrm/coordinate.hpp"
|
#include "osrm/coordinate.hpp"
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
|
|
||||||
|
37
include/extractor/intersection/constants.hpp
Normal file
37
include/extractor/intersection/constants.hpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#ifndef OSRM_EXTRACTOR_INTERSECTION_CONSTANTS_HPP_
|
||||||
|
#define OSRM_EXTRACTOR_INTERSECTION_CONSTANTS_HPP_
|
||||||
|
|
||||||
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace extractor
|
||||||
|
{
|
||||||
|
namespace intersection
|
||||||
|
{
|
||||||
|
|
||||||
|
// what angle is interpreted as going straight
|
||||||
|
const double constexpr STRAIGHT_ANGLE = 180.;
|
||||||
|
const double constexpr ORTHOGONAL_ANGLE = 90.;
|
||||||
|
// if a turn deviates this much from going straight, it will be kept straight
|
||||||
|
const double constexpr MAXIMAL_ALLOWED_NO_TURN_DEVIATION = 3.;
|
||||||
|
// angle that lies between two nearly indistinguishable roads
|
||||||
|
const double constexpr NARROW_TURN_ANGLE = 40.;
|
||||||
|
const double constexpr GROUP_ANGLE = 60;
|
||||||
|
// angle difference that can be classified as straight, if its the only narrow turn
|
||||||
|
const double constexpr FUZZY_ANGLE_DIFFERENCE = 25.;
|
||||||
|
|
||||||
|
// Road priorities give an idea of how obvious a turn is. If two priorities differ greatly (e.g.
|
||||||
|
// service road over a primary road, the better priority can be seen as obvious due to its road
|
||||||
|
// category).
|
||||||
|
const double constexpr PRIORITY_DISTINCTION_FACTOR = 1.75;
|
||||||
|
|
||||||
|
// the lane width we assume for a single lane
|
||||||
|
const auto constexpr ASSUMED_LANE_WIDTH = 3.25;
|
||||||
|
|
||||||
|
// how far apart can roads be at the most, when thinking about merging them?
|
||||||
|
const auto constexpr MERGABLE_ANGLE_DIFFERENCE = 95.0;
|
||||||
|
|
||||||
|
} // namespace intersection
|
||||||
|
} // namespace extractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
|
#endif // OSRM_EXTRACTOR_INTERSECTION_CONSTANTS_HPP_
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_COORDINATE_EXTRACTOR_HPP_
|
#ifndef OSRM_EXTRACTOR_INTERSECTION_COORDINATE_EXTRACTOR_HPP_
|
||||||
#define OSRM_EXTRACTOR_COORDINATE_EXTRACTOR_HPP_
|
#define OSRM_EXTRACTOR_INTERSECTION_COORDINATE_EXTRACTOR_HPP_
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -15,7 +15,7 @@ namespace osrm
|
|||||||
{
|
{
|
||||||
namespace extractor
|
namespace extractor
|
||||||
{
|
{
|
||||||
namespace guidance
|
namespace intersection
|
||||||
{
|
{
|
||||||
|
|
||||||
class CoordinateExtractor
|
class CoordinateExtractor
|
||||||
@ -251,8 +251,8 @@ class CoordinateExtractor
|
|||||||
const std::uint8_t considered_lanes) const;
|
const std::uint8_t considered_lanes) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace intersection
|
||||||
} // namespace extractor
|
} // namespace extractor
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_EXTRACTOR_COORDINATE_EXTRACTOR_HPP_
|
#endif // OSRM_EXTRACTOR_INTERSECTION_COORDINATE_EXTRACTOR_HPP_
|
@ -1,15 +1,15 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_HAVE_IDENTICAL_NAMES_HPP_
|
#ifndef OSRM_EXTRACTOR_INTERSECTION_HAVE_IDENTICAL_NAMES_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_HAVE_IDENTICAL_NAMES_HPP_
|
#define OSRM_EXTRACTOR_INTERSECTION_HAVE_IDENTICAL_NAMES_HPP_
|
||||||
|
|
||||||
#include "guidance/constants.hpp"
|
|
||||||
#include "extractor/suffix_table.hpp"
|
#include "extractor/suffix_table.hpp"
|
||||||
|
#include "guidance/constants.hpp"
|
||||||
#include "util/name_table.hpp"
|
#include "util/name_table.hpp"
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
namespace extractor
|
||||||
{
|
{
|
||||||
namespace guidance
|
namespace intersection
|
||||||
{
|
{
|
||||||
|
|
||||||
// check if two name ids can be seen as identical (in presence of refs/others)
|
// check if two name ids can be seen as identical (in presence of refs/others)
|
||||||
@ -20,8 +20,8 @@ bool HaveIdenticalNames(const NameID lhs,
|
|||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table);
|
const SuffixTable &street_name_suffix_table);
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace intersection
|
||||||
} // namespace extractor
|
} // namespace extractor
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /*OSRM_EXTRACTOR_GUIDANCE_HAVE_IDENTICAL_NAMES_HPP_*/
|
#endif /*OSRM_EXTRACTOR_INTERSECTION_HAVE_IDENTICAL_NAMES_HPP_*/
|
@ -3,9 +3,10 @@
|
|||||||
|
|
||||||
#include "extractor/compressed_edge_container.hpp"
|
#include "extractor/compressed_edge_container.hpp"
|
||||||
#include "extractor/intersection/intersection_edge.hpp"
|
#include "extractor/intersection/intersection_edge.hpp"
|
||||||
|
#include "extractor/intersection/intersection_view.hpp"
|
||||||
|
#include "extractor/intersection/mergable_road_detector.hpp"
|
||||||
#include "extractor/restriction_index.hpp"
|
#include "extractor/restriction_index.hpp"
|
||||||
#include "guidance/mergable_road_detector.hpp"
|
#include "extractor/turn_lane_types.hpp"
|
||||||
#include "guidance/turn_lane_types.hpp"
|
|
||||||
|
|
||||||
#include "util/coordinate.hpp"
|
#include "util/coordinate.hpp"
|
||||||
#include "util/node_based_graph.hpp"
|
#include "util/node_based_graph.hpp"
|
||||||
@ -31,7 +32,7 @@ bool isTurnAllowed(const util::NodeBasedDynamicGraph &graph,
|
|||||||
const RestrictionMap &restriction_map,
|
const RestrictionMap &restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const IntersectionEdgeGeometries &geometries,
|
const IntersectionEdgeGeometries &geometries,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const IntersectionEdge &from,
|
const IntersectionEdge &from,
|
||||||
const IntersectionEdge &to);
|
const IntersectionEdge &to);
|
||||||
|
|
||||||
@ -43,33 +44,31 @@ std::pair<IntersectionEdgeGeometries, std::unordered_set<EdgeID>>
|
|||||||
getIntersectionGeometries(const util::NodeBasedDynamicGraph &graph,
|
getIntersectionGeometries(const util::NodeBasedDynamicGraph &graph,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const guidance::MergableRoadDetector &detector,
|
const MergableRoadDetector &detector,
|
||||||
const NodeID intersection);
|
const NodeID intersection);
|
||||||
|
|
||||||
guidance::IntersectionView
|
IntersectionView convertToIntersectionView(const util::NodeBasedDynamicGraph &graph,
|
||||||
convertToIntersectionView(const util::NodeBasedDynamicGraph &graph,
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const RestrictionMap &restriction_map,
|
||||||
const RestrictionMap &restriction_map,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const IntersectionEdgeGeometries &edge_geometries,
|
||||||
const IntersectionEdgeGeometries &edge_geometries,
|
const TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const IntersectionEdge &incoming_edge,
|
||||||
const IntersectionEdge &incoming_edge,
|
const IntersectionEdges &outgoing_edges,
|
||||||
const IntersectionEdges &outgoing_edges,
|
const std::unordered_set<EdgeID> &merged_edges);
|
||||||
const std::unordered_set<EdgeID> &merged_edges);
|
|
||||||
|
|
||||||
// Check for restrictions/barriers and generate a list of valid and invalid turns present at
|
// Check for restrictions/barriers and generate a list of valid and invalid turns present at
|
||||||
// the node reached from `incoming_edge`. The resulting candidates have to be analyzed
|
// the node reached from `incoming_edge`. The resulting candidates have to be analyzed
|
||||||
// for their actual instructions later on.
|
// for their actual instructions later on.
|
||||||
template <bool USE_CLOSE_COORDINATE>
|
template <bool USE_CLOSE_COORDINATE>
|
||||||
guidance::IntersectionView
|
IntersectionView getConnectedRoads(const util::NodeBasedDynamicGraph &graph,
|
||||||
getConnectedRoads(const util::NodeBasedDynamicGraph &graph,
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const RestrictionMap &node_restriction_map,
|
||||||
const RestrictionMap &node_restriction_map,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const IntersectionEdge &incoming_edge);
|
||||||
const IntersectionEdge &incoming_edge);
|
|
||||||
|
|
||||||
// Graph Compression cannot compress every setting. For example any barrier/traffic light cannot
|
// 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
|
// be compressed. As a result, a simple road of the form `a ----- b` might end up as having an
|
||||||
|
256
include/extractor/intersection/intersection_view.hpp
Normal file
256
include/extractor/intersection/intersection_view.hpp
Normal file
@ -0,0 +1,256 @@
|
|||||||
|
#ifndef OSRM_EXTRACTOR_INTERSECTION_INTERSECTION_VIEW_HPP_
|
||||||
|
#define OSRM_EXTRACTOR_INTERSECTION_INTERSECTION_VIEW_HPP_
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <functional>
|
||||||
|
#include <limits>
|
||||||
|
#include <string>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "util/bearing.hpp"
|
||||||
|
#include "util/log.hpp"
|
||||||
|
#include "util/node_based_graph.hpp"
|
||||||
|
#include "util/typedefs.hpp" // EdgeID
|
||||||
|
|
||||||
|
#include "guidance/turn_instruction.hpp"
|
||||||
|
|
||||||
|
#include <boost/range/algorithm/count_if.hpp>
|
||||||
|
#include <boost/range/algorithm/find_if.hpp>
|
||||||
|
#include <boost/range/algorithm/min_element.hpp>
|
||||||
|
|
||||||
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace extractor
|
||||||
|
{
|
||||||
|
namespace intersection
|
||||||
|
{
|
||||||
|
|
||||||
|
// the shape of an intersection only knows about edge IDs and bearings
|
||||||
|
// `bearing` is the direction in clockwise angle from true north after taking the turn:
|
||||||
|
// 0 = heading north, 90 = east, 180 = south, 270 = west
|
||||||
|
struct IntersectionShapeData
|
||||||
|
{
|
||||||
|
EdgeID eid;
|
||||||
|
double bearing;
|
||||||
|
double segment_length;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline auto makeCompareShapeDataByBearing(const double base_bearing)
|
||||||
|
{
|
||||||
|
return [base_bearing](const auto &lhs, const auto &rhs) {
|
||||||
|
return util::angularDeviation(lhs.bearing, base_bearing) <
|
||||||
|
util::angularDeviation(rhs.bearing, base_bearing);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
inline auto makeCompareAngularDeviation(const double angle)
|
||||||
|
{
|
||||||
|
return [angle](const auto &lhs, const auto &rhs) {
|
||||||
|
return util::angularDeviation(lhs.angle, angle) < util::angularDeviation(rhs.angle, angle);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
inline auto makeExtractLanesForRoad(const util::NodeBasedDynamicGraph &node_based_graph)
|
||||||
|
{
|
||||||
|
return [&node_based_graph](const auto &road) {
|
||||||
|
return node_based_graph.GetEdgeData(road.eid).road_classification.GetNumberOfLanes();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// When viewing an intersection from an incoming edge, we can transform a shape into a view which
|
||||||
|
// gives additional information on angles and whether a turn is allowed
|
||||||
|
struct IntersectionViewData : IntersectionShapeData
|
||||||
|
{
|
||||||
|
IntersectionViewData(const IntersectionShapeData &shape,
|
||||||
|
const bool entry_allowed,
|
||||||
|
const double angle)
|
||||||
|
: IntersectionShapeData(shape), entry_allowed(entry_allowed), angle(angle)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool entry_allowed;
|
||||||
|
double angle;
|
||||||
|
|
||||||
|
bool CompareByAngle(const IntersectionViewData &other) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
// small helper function to print the content of a connected road
|
||||||
|
std::string toString(const IntersectionShapeData &shape);
|
||||||
|
std::string toString(const IntersectionViewData &view);
|
||||||
|
|
||||||
|
// Intersections are sorted roads: [0] being the UTurn road, then from sharp right to sharp left.
|
||||||
|
// common operations shared amongst all intersection types
|
||||||
|
template <typename Self> struct EnableShapeOps
|
||||||
|
{
|
||||||
|
// same as closest turn, but for bearings
|
||||||
|
auto FindClosestBearing(double bearing) const
|
||||||
|
{
|
||||||
|
auto comp = makeCompareShapeDataByBearing(bearing);
|
||||||
|
return std::min_element(self()->begin(), self()->end(), comp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// search a given eid in the intersection
|
||||||
|
auto FindEid(const EdgeID eid) const
|
||||||
|
{
|
||||||
|
return boost::range::find_if(*self(), [eid](const auto &road) { return road.eid == eid; });
|
||||||
|
}
|
||||||
|
|
||||||
|
// find the maximum value based on a conversion operator
|
||||||
|
template <typename UnaryProjection> auto FindMaximum(UnaryProjection converter) const
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(!self()->empty());
|
||||||
|
auto initial = converter(self()->front());
|
||||||
|
|
||||||
|
const auto extract_maximal_value = [&initial, converter](const auto &road) {
|
||||||
|
initial = std::max(initial, converter(road));
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
boost::range::find_if(*self(), extract_maximal_value);
|
||||||
|
return initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find the maximum value based on a conversion operator and a predefined initial value
|
||||||
|
template <typename UnaryPredicate> auto Count(UnaryPredicate detector) const
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(!self()->empty());
|
||||||
|
return boost::range::count_if(*self(), detector);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
auto self() { return static_cast<Self *>(this); }
|
||||||
|
auto self() const { return static_cast<const Self *>(this); }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct IntersectionShape final : std::vector<IntersectionShapeData>, //
|
||||||
|
EnableShapeOps<IntersectionShape> //
|
||||||
|
{
|
||||||
|
using Base = std::vector<IntersectionShapeData>;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Common operations shared among IntersectionView and Intersections.
|
||||||
|
// Inherit to enable those operations on your compatible type. CRTP pattern.
|
||||||
|
template <typename Self> struct EnableIntersectionOps
|
||||||
|
{
|
||||||
|
// Find the turn whose angle offers the least angular deviation to the specified angle
|
||||||
|
// For turn angles [0, 90, 260] and a query of 180 we return the 260 degree turn.
|
||||||
|
auto findClosestTurn(double angle) const
|
||||||
|
{
|
||||||
|
auto comp = makeCompareAngularDeviation(angle);
|
||||||
|
return boost::range::min_element(*self(), comp);
|
||||||
|
}
|
||||||
|
// returns a non-const_interator
|
||||||
|
auto findClosestTurn(double angle)
|
||||||
|
{
|
||||||
|
auto comp = makeCompareAngularDeviation(angle);
|
||||||
|
return std::min_element(self()->begin(), self()->end(), comp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check validity of the intersection object. We assume a few basic properties every set of
|
||||||
|
* connected roads should follow throughout guidance pre-processing. This utility function
|
||||||
|
* allows checking intersections for validity
|
||||||
|
*/
|
||||||
|
auto valid() const
|
||||||
|
{
|
||||||
|
if (self()->empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
auto comp = [](const auto &lhs, const auto &rhs) { return lhs.CompareByAngle(rhs); };
|
||||||
|
|
||||||
|
const auto ordered = std::is_sorted(self()->begin(), self()->end(), comp);
|
||||||
|
|
||||||
|
if (!ordered)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const auto uturn = self()->operator[](0).angle < std::numeric_limits<double>::epsilon();
|
||||||
|
|
||||||
|
if (!uturn)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the UTurn road we took to arrive at this intersection.
|
||||||
|
const auto &getUTurnRoad() const { return self()->operator[](0); }
|
||||||
|
|
||||||
|
// Returns the right-most road at this intersection.
|
||||||
|
const auto &getRightmostRoad() const
|
||||||
|
{
|
||||||
|
return self()->size() > 1 ? self()->operator[](1) : self()->getUTurnRoad();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the left-most road at this intersection.
|
||||||
|
const auto &getLeftmostRoad() const
|
||||||
|
{
|
||||||
|
return self()->size() > 1 ? self()->back() : self()->getUTurnRoad();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Can this be skipped over?
|
||||||
|
auto isTrafficSignalOrBarrier() const { return self()->size() == 2; }
|
||||||
|
|
||||||
|
// Checks if there is at least one road available (except UTurn road) on which to continue.
|
||||||
|
auto isDeadEnd() const
|
||||||
|
{
|
||||||
|
auto pred = [](const auto &road) { return road.entry_allowed; };
|
||||||
|
return std::none_of(self()->begin() + 1, self()->end(), pred);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the number of roads we can enter at this intersection, respectively.
|
||||||
|
auto countEnterable() const
|
||||||
|
{
|
||||||
|
auto pred = [](const auto &road) { return road.entry_allowed; };
|
||||||
|
return boost::range::count_if(*self(), pred);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the number of roads we can not enter at this intersection, respectively.
|
||||||
|
auto countNonEnterable() const { return self()->size() - self()->countEnterable(); }
|
||||||
|
|
||||||
|
// same as find closests turn but with an additional predicate to allow filtering
|
||||||
|
// the filter has to return `true` for elements that should be ignored
|
||||||
|
template <typename UnaryPredicate>
|
||||||
|
auto findClosestTurn(const double angle, const UnaryPredicate filter) const
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(!self()->empty());
|
||||||
|
const auto candidate =
|
||||||
|
boost::range::min_element(*self(), [angle, &filter](const auto &lhs, const auto &rhs) {
|
||||||
|
const auto filtered_lhs = filter(lhs), filtered_rhs = filter(rhs);
|
||||||
|
const auto deviation_lhs = util::angularDeviation(lhs.angle, angle),
|
||||||
|
deviation_rhs = util::angularDeviation(rhs.angle, angle);
|
||||||
|
return std::tie(filtered_lhs, deviation_lhs) <
|
||||||
|
std::tie(filtered_rhs, deviation_rhs);
|
||||||
|
});
|
||||||
|
|
||||||
|
// make sure only to return valid elements
|
||||||
|
return filter(*candidate) ? self()->end() : candidate;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if all roads between begin and end allow entry
|
||||||
|
template <typename InputIt>
|
||||||
|
bool hasAllValidEntries(const InputIt begin, const InputIt end) const
|
||||||
|
{
|
||||||
|
static_assert(
|
||||||
|
std::is_base_of<std::input_iterator_tag,
|
||||||
|
typename std::iterator_traits<InputIt>::iterator_category>::value,
|
||||||
|
"hasAllValidEntries() only accepts input iterators");
|
||||||
|
return std::all_of(
|
||||||
|
begin, end, [](const IntersectionViewData &road) { return road.entry_allowed; });
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
auto self() { return static_cast<Self *>(this); }
|
||||||
|
auto self() const { return static_cast<const Self *>(this); }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct IntersectionView final : std::vector<IntersectionViewData>, //
|
||||||
|
EnableShapeOps<IntersectionView>, //
|
||||||
|
EnableIntersectionOps<IntersectionView> //
|
||||||
|
{
|
||||||
|
using Base = std::vector<IntersectionViewData>;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace intersection
|
||||||
|
} // namespace extractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
|
#endif /* OSRM_EXTRACTOR_INTERSECTION_INTERSECTION_VIEW_HPP_*/
|
@ -2,11 +2,11 @@
|
|||||||
#define OSRM_EXTRACTOR_GUIDANCE_MERGEABLE_ROADS
|
#define OSRM_EXTRACTOR_GUIDANCE_MERGEABLE_ROADS
|
||||||
|
|
||||||
#include "extractor/compressed_edge_container.hpp"
|
#include "extractor/compressed_edge_container.hpp"
|
||||||
|
#include "extractor/intersection/coordinate_extractor.hpp"
|
||||||
|
#include "extractor/intersection/have_identical_names.hpp"
|
||||||
#include "extractor/restriction_index.hpp"
|
#include "extractor/restriction_index.hpp"
|
||||||
#include "guidance/have_identical_names.hpp"
|
#include "extractor/turn_lane_types.hpp"
|
||||||
#include "guidance/coordinate_extractor.hpp"
|
|
||||||
#include "guidance/intersection.hpp"
|
#include "guidance/intersection.hpp"
|
||||||
#include "guidance/turn_lane_types.hpp"
|
|
||||||
#include "util/coordinate.hpp"
|
#include "util/coordinate.hpp"
|
||||||
#include "util/node_based_graph.hpp"
|
#include "util/node_based_graph.hpp"
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
@ -31,7 +31,7 @@ namespace extractor
|
|||||||
|
|
||||||
class SuffixTable;
|
class SuffixTable;
|
||||||
|
|
||||||
namespace guidance
|
namespace intersection
|
||||||
{
|
{
|
||||||
class IntersectionGenerator;
|
class IntersectionGenerator;
|
||||||
class CoordinateExtractor;
|
class CoordinateExtractor;
|
||||||
@ -48,7 +48,7 @@ class MergableRoadDetector
|
|||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table);
|
const SuffixTable &street_name_suffix_table);
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ class MergableRoadDetector
|
|||||||
const extractor::CompressedEdgeContainer &compressed_geometries;
|
const extractor::CompressedEdgeContainer &compressed_geometries;
|
||||||
const RestrictionMap &node_restriction_map;
|
const RestrictionMap &node_restriction_map;
|
||||||
const std::unordered_set<NodeID> &barrier_nodes;
|
const std::unordered_set<NodeID> &barrier_nodes;
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data;
|
const TurnLanesIndexedArray &turn_lanes_data;
|
||||||
|
|
||||||
// name detection
|
// name detection
|
||||||
const util::NameTable &name_table;
|
const util::NameTable &name_table;
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_NODE_BASED_GRAPH_WALKER
|
#ifndef OSRM_EXTRACTOR_INTERSECTION_NODE_BASED_GRAPH_WALKER
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_NODE_BASED_GRAPH_WALKER
|
#define OSRM_EXTRACTOR_INTERSECTION_NODE_BASED_GRAPH_WALKER
|
||||||
|
|
||||||
|
#include "extractor/intersection/coordinate_extractor.hpp"
|
||||||
#include "extractor/intersection/intersection_analysis.hpp"
|
#include "extractor/intersection/intersection_analysis.hpp"
|
||||||
#include "guidance/constants.hpp"
|
#include "extractor/intersection/intersection_view.hpp"
|
||||||
#include "guidance/coordinate_extractor.hpp"
|
|
||||||
#include "guidance/turn_lane_data.hpp"
|
#include "guidance/turn_lane_data.hpp"
|
||||||
#include "util/coordinate.hpp"
|
#include "util/coordinate.hpp"
|
||||||
#include "util/coordinate_calculation.hpp"
|
#include "util/coordinate_calculation.hpp"
|
||||||
@ -19,7 +19,7 @@ namespace osrm
|
|||||||
{
|
{
|
||||||
namespace extractor
|
namespace extractor
|
||||||
{
|
{
|
||||||
namespace guidance
|
namespace intersection
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -35,7 +35,7 @@ class NodeBasedGraphWalker
|
|||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data);
|
const TurnLanesIndexedArray &turn_lanes_data);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* the returned node-id, edge-id are either the last ones used, just prior accumulator
|
* the returned node-id, edge-id are either the last ones used, just prior accumulator
|
||||||
@ -58,7 +58,7 @@ class NodeBasedGraphWalker
|
|||||||
const extractor::CompressedEdgeContainer &compressed_geometries;
|
const extractor::CompressedEdgeContainer &compressed_geometries;
|
||||||
const RestrictionMap &node_restriction_map;
|
const RestrictionMap &node_restriction_map;
|
||||||
const std::unordered_set<NodeID> &barrier_nodes;
|
const std::unordered_set<NodeID> &barrier_nodes;
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data;
|
const TurnLanesIndexedArray &turn_lanes_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -68,7 +68,7 @@ class NodeBasedGraphWalker
|
|||||||
struct LengthLimitedCoordinateAccumulator
|
struct LengthLimitedCoordinateAccumulator
|
||||||
{
|
{
|
||||||
LengthLimitedCoordinateAccumulator(
|
LengthLimitedCoordinateAccumulator(
|
||||||
const extractor::guidance::CoordinateExtractor &coordinate_extractor,
|
const extractor::intersection::CoordinateExtractor &coordinate_extractor,
|
||||||
const double max_length);
|
const double max_length);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -93,7 +93,7 @@ struct LengthLimitedCoordinateAccumulator
|
|||||||
std::vector<util::Coordinate> coordinates;
|
std::vector<util::Coordinate> coordinates;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const extractor::guidance::CoordinateExtractor &coordinate_extractor;
|
const extractor::intersection::CoordinateExtractor &coordinate_extractor;
|
||||||
const double max_length;
|
const double max_length;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ struct IntersectionFinderAccumulator
|
|||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data);
|
const TurnLanesIndexedArray &turn_lanes_data);
|
||||||
// true if the path has traversed enough distance
|
// true if the path has traversed enough distance
|
||||||
bool terminate();
|
bool terminate();
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ struct IntersectionFinderAccumulator
|
|||||||
const extractor::CompressedEdgeContainer &compressed_geometries;
|
const extractor::CompressedEdgeContainer &compressed_geometries;
|
||||||
const RestrictionMap &node_restriction_map;
|
const RestrictionMap &node_restriction_map;
|
||||||
const std::unordered_set<NodeID> &barrier_nodes;
|
const std::unordered_set<NodeID> &barrier_nodes;
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data;
|
const TurnLanesIndexedArray &turn_lanes_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class accumulator_type, class selector_type>
|
template <class accumulator_type, class selector_type>
|
||||||
@ -278,7 +278,7 @@ struct SkipTrafficSignalBarrierRoadSelector
|
|||||||
struct DistanceToNextIntersectionAccumulator
|
struct DistanceToNextIntersectionAccumulator
|
||||||
{
|
{
|
||||||
DistanceToNextIntersectionAccumulator(
|
DistanceToNextIntersectionAccumulator(
|
||||||
const extractor::guidance::CoordinateExtractor &extractor_,
|
const extractor::intersection::CoordinateExtractor &extractor_,
|
||||||
const util::NodeBasedDynamicGraph &graph_,
|
const util::NodeBasedDynamicGraph &graph_,
|
||||||
const double threshold)
|
const double threshold)
|
||||||
: extractor{extractor_}, graph{graph_}, threshold{threshold}
|
: extractor{extractor_}, graph{graph_}, threshold{threshold}
|
||||||
@ -304,7 +304,7 @@ struct DistanceToNextIntersectionAccumulator
|
|||||||
distance += getLength(coords.begin(), coords.end(), &haversineDistance);
|
distance += getLength(coords.begin(), coords.end(), &haversineDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
const extractor::guidance::CoordinateExtractor &extractor;
|
const extractor::intersection::CoordinateExtractor &extractor;
|
||||||
const util::NodeBasedDynamicGraph &graph;
|
const util::NodeBasedDynamicGraph &graph;
|
||||||
const double threshold;
|
const double threshold;
|
||||||
bool too_far_away = false;
|
bool too_far_away = false;
|
||||||
@ -315,4 +315,4 @@ struct DistanceToNextIntersectionAccumulator
|
|||||||
} // namespace extractor
|
} // namespace extractor
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /* OSRM_EXTRACTOR_GUIDANCE_NODE_BASED_GRAPH_WALKER */
|
#endif
|
@ -8,7 +8,7 @@
|
|||||||
#include "extractor/travel_mode.hpp"
|
#include "extractor/travel_mode.hpp"
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
|
|
||||||
#include "guidance/road_classification.hpp"
|
#include "extractor/road_classification.hpp"
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
@ -19,16 +19,16 @@ namespace extractor
|
|||||||
// generation but is not available in annotation/navigation
|
// generation but is not available in annotation/navigation
|
||||||
struct NodeBasedEdgeClassification
|
struct NodeBasedEdgeClassification
|
||||||
{
|
{
|
||||||
std::uint8_t forward : 1; // 1
|
std::uint8_t forward : 1; // 1
|
||||||
std::uint8_t backward : 1; // 1
|
std::uint8_t backward : 1; // 1
|
||||||
std::uint8_t is_split : 1; // 1
|
std::uint8_t is_split : 1; // 1
|
||||||
std::uint8_t roundabout : 1; // 1
|
std::uint8_t roundabout : 1; // 1
|
||||||
std::uint8_t circular : 1; // 1
|
std::uint8_t circular : 1; // 1
|
||||||
std::uint8_t startpoint : 1; // 1
|
std::uint8_t startpoint : 1; // 1
|
||||||
std::uint8_t restricted : 1; // 1
|
std::uint8_t restricted : 1; // 1
|
||||||
guidance::RoadClassification road_classification; // 16 2
|
RoadClassification road_classification; // 16 2
|
||||||
std::uint8_t highway_turn_classification : 4; // 4
|
std::uint8_t highway_turn_classification : 4; // 4
|
||||||
std::uint8_t access_turn_classification : 4; // 4
|
std::uint8_t access_turn_classification : 4; // 4
|
||||||
|
|
||||||
NodeBasedEdgeClassification();
|
NodeBasedEdgeClassification();
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ struct NodeBasedEdgeClassification
|
|||||||
const bool circular,
|
const bool circular,
|
||||||
const bool startpoint,
|
const bool startpoint,
|
||||||
const bool restricted,
|
const bool restricted,
|
||||||
guidance::RoadClassification road_classification,
|
RoadClassification road_classification,
|
||||||
const std::uint8_t highway_turn_classification,
|
const std::uint8_t highway_turn_classification,
|
||||||
const std::uint8_t access_turn_classification)
|
const std::uint8_t access_turn_classification)
|
||||||
: forward(forward), backward(backward), is_split(is_split), roundabout(roundabout),
|
: forward(forward), backward(backward), is_split(is_split), roundabout(roundabout),
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
#ifndef ORIGINAL_EDGE_DATA_HPP
|
|
||||||
#define ORIGINAL_EDGE_DATA_HPP
|
|
||||||
|
|
||||||
#include "extractor/travel_mode.hpp"
|
|
||||||
#include "guidance/turn_instruction.hpp"
|
|
||||||
#include "util/guidance/turn_bearing.hpp"
|
|
||||||
#include "util/typedefs.hpp"
|
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <limits>
|
|
||||||
|
|
||||||
namespace osrm
|
|
||||||
{
|
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
|
|
||||||
struct OriginalEdgeData
|
|
||||||
{
|
|
||||||
explicit OriginalEdgeData(GeometryID via_geometry,
|
|
||||||
NameID name_id,
|
|
||||||
LaneDataID lane_data_id,
|
|
||||||
guidance::TurnInstruction turn_instruction,
|
|
||||||
EntryClassID entry_classid,
|
|
||||||
extractor::TravelMode travel_mode,
|
|
||||||
util::guidance::TurnBearing pre_turn_bearing,
|
|
||||||
util::guidance::TurnBearing post_turn_bearing)
|
|
||||||
: via_geometry(via_geometry), name_id(name_id), entry_classid(entry_classid),
|
|
||||||
lane_data_id(lane_data_id), turn_instruction(turn_instruction), travel_mode(travel_mode),
|
|
||||||
pre_turn_bearing(pre_turn_bearing), post_turn_bearing(post_turn_bearing)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
OriginalEdgeData()
|
|
||||||
: via_geometry{std::numeric_limits<unsigned>::max() >> 1, false},
|
|
||||||
name_id(std::numeric_limits<unsigned>::max()), entry_classid(INVALID_ENTRY_CLASSID),
|
|
||||||
lane_data_id(INVALID_LANE_DATAID), turn_instruction(guidance::TurnInstruction::INVALID()),
|
|
||||||
travel_mode(extractor::TRAVEL_MODE_INACCESSIBLE), pre_turn_bearing(0.0),
|
|
||||||
post_turn_bearing(0.0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
GeometryID via_geometry;
|
|
||||||
NameID name_id;
|
|
||||||
EntryClassID entry_classid;
|
|
||||||
LaneDataID lane_data_id;
|
|
||||||
guidance::TurnInstruction turn_instruction;
|
|
||||||
extractor::TravelMode travel_mode;
|
|
||||||
util::guidance::TurnBearing pre_turn_bearing;
|
|
||||||
util::guidance::TurnBearing post_turn_bearing;
|
|
||||||
};
|
|
||||||
|
|
||||||
static_assert(sizeof(OriginalEdgeData) == 16,
|
|
||||||
"Increasing the size of OriginalEdgeData increases memory consumption");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // ORIGINAL_EDGE_DATA_HPP
|
|
@ -10,6 +10,7 @@
|
|||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <array>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
|
@ -6,14 +6,12 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "guidance/constants.hpp"
|
#include "extractor/intersection/constants.hpp"
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
namespace extractor
|
||||||
{
|
{
|
||||||
namespace guidance
|
|
||||||
{
|
|
||||||
|
|
||||||
// Priorities are used to distinguish between how likely a turn is in comparison to a different
|
// Priorities are used to distinguish between how likely a turn is in comparison to a different
|
||||||
// road. The priorities here are used to distinguish between obvious turns (e.g. following a primary
|
// road. The priorities here are used to distinguish between obvious turns (e.g. following a primary
|
||||||
@ -132,8 +130,9 @@ inline bool obviousByRoadClass(const RoadClassification in_classification,
|
|||||||
const RoadClassification compare_candidate)
|
const RoadClassification compare_candidate)
|
||||||
{
|
{
|
||||||
// lower numbers are of higher priority
|
// lower numbers are of higher priority
|
||||||
const bool has_high_priority = PRIORITY_DISTINCTION_FACTOR * obvious_candidate.GetPriority() <
|
const bool has_high_priority =
|
||||||
compare_candidate.GetPriority();
|
intersection::PRIORITY_DISTINCTION_FACTOR * obvious_candidate.GetPriority() <
|
||||||
|
compare_candidate.GetPriority();
|
||||||
|
|
||||||
const bool continues_on_same_class = in_classification == obvious_candidate;
|
const bool continues_on_same_class = in_classification == obvious_candidate;
|
||||||
return (has_high_priority && continues_on_same_class) ||
|
return (has_high_priority && continues_on_same_class) ||
|
||||||
@ -142,7 +141,6 @@ inline bool obviousByRoadClass(const RoadClassification in_classification,
|
|||||||
compare_candidate.IsLowPriorityRoadClass());
|
compare_candidate.IsLowPriorityRoadClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace guidance
|
|
||||||
} // namespace extractor
|
} // namespace extractor
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
@ -4,7 +4,6 @@
|
|||||||
#include "extractor/internal_extractor_edge.hpp"
|
#include "extractor/internal_extractor_edge.hpp"
|
||||||
#include "extractor/profile_properties.hpp"
|
#include "extractor/profile_properties.hpp"
|
||||||
#include "extractor/restriction.hpp"
|
#include "extractor/restriction.hpp"
|
||||||
#include "guidance/turn_lane_types.hpp"
|
|
||||||
|
|
||||||
#include <osmium/memory/buffer.hpp>
|
#include <osmium/memory/buffer.hpp>
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include "extractor/profile_properties.hpp"
|
#include "extractor/profile_properties.hpp"
|
||||||
#include "extractor/restriction.hpp"
|
#include "extractor/restriction.hpp"
|
||||||
#include "extractor/segment_data_container.hpp"
|
#include "extractor/segment_data_container.hpp"
|
||||||
#include "extractor/turn_data_container.hpp"
|
|
||||||
|
|
||||||
#include "storage/io.hpp"
|
#include "storage/io.hpp"
|
||||||
#include "storage/serialization.hpp"
|
#include "storage/serialization.hpp"
|
||||||
@ -93,29 +92,6 @@ inline void write(storage::io::FileWriter &writer,
|
|||||||
storage::serialization::write(writer, segment_data.rev_datasources);
|
storage::serialization::write(writer, segment_data.rev_datasources);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read/write for turn data file
|
|
||||||
template <storage::Ownership Ownership>
|
|
||||||
inline void read(storage::io::FileReader &reader,
|
|
||||||
detail::TurnDataContainerImpl<Ownership> &turn_data_container)
|
|
||||||
{
|
|
||||||
storage::serialization::read(reader, turn_data_container.turn_instructions);
|
|
||||||
storage::serialization::read(reader, turn_data_container.lane_data_ids);
|
|
||||||
storage::serialization::read(reader, turn_data_container.entry_class_ids);
|
|
||||||
storage::serialization::read(reader, turn_data_container.pre_turn_bearings);
|
|
||||||
storage::serialization::read(reader, turn_data_container.post_turn_bearings);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <storage::Ownership Ownership>
|
|
||||||
inline void write(storage::io::FileWriter &writer,
|
|
||||||
const detail::TurnDataContainerImpl<Ownership> &turn_data_container)
|
|
||||||
{
|
|
||||||
storage::serialization::write(writer, turn_data_container.turn_instructions);
|
|
||||||
storage::serialization::write(writer, turn_data_container.lane_data_ids);
|
|
||||||
storage::serialization::write(writer, turn_data_container.entry_class_ids);
|
|
||||||
storage::serialization::write(writer, turn_data_container.pre_turn_bearings);
|
|
||||||
storage::serialization::write(writer, turn_data_container.post_turn_bearings);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <storage::Ownership Ownership>
|
template <storage::Ownership Ownership>
|
||||||
inline void read(storage::io::FileReader &reader,
|
inline void read(storage::io::FileReader &reader,
|
||||||
detail::EdgeBasedNodeDataContainerImpl<Ownership> &node_data_container)
|
detail::EdgeBasedNodeDataContainerImpl<Ownership> &node_data_container)
|
||||||
|
@ -19,8 +19,6 @@ namespace osrm
|
|||||||
{
|
{
|
||||||
namespace extractor
|
namespace extractor
|
||||||
{
|
{
|
||||||
namespace guidance
|
|
||||||
{
|
|
||||||
|
|
||||||
namespace TurnLaneType
|
namespace TurnLaneType
|
||||||
{
|
{
|
||||||
@ -95,9 +93,7 @@ struct TurnLaneDescription_hash
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef util::ConcurrentIDMap<guidance::TurnLaneDescription,
|
typedef util::ConcurrentIDMap<TurnLaneDescription, LaneDescriptionID, TurnLaneDescription_hash>
|
||||||
LaneDescriptionID,
|
|
||||||
guidance::TurnLaneDescription_hash>
|
|
||||||
LaneDescriptionMap;
|
LaneDescriptionMap;
|
||||||
|
|
||||||
using TurnLanesIndexedArray =
|
using TurnLanesIndexedArray =
|
||||||
@ -121,7 +117,7 @@ inline TurnLanesIndexedArray transformTurnLaneMapIntoArrays(const LaneDescriptio
|
|||||||
std::partial_sum(turn_lane_offsets.begin(), turn_lane_offsets.end(), turn_lane_offsets.begin());
|
std::partial_sum(turn_lane_offsets.begin(), turn_lane_offsets.end(), turn_lane_offsets.begin());
|
||||||
|
|
||||||
// allocate the current masks
|
// allocate the current masks
|
||||||
std::vector<guidance::TurnLaneType::Mask> turn_lane_masks(turn_lane_offsets.back());
|
std::vector<TurnLaneType::Mask> turn_lane_masks(turn_lane_offsets.back());
|
||||||
for (auto entry = turn_lane_map.data.begin(); entry != turn_lane_map.data.end(); ++entry)
|
for (auto entry = turn_lane_map.data.begin(); entry != turn_lane_map.data.end(); ++entry)
|
||||||
std::copy(entry->first.begin(),
|
std::copy(entry->first.begin(),
|
||||||
entry->first.end(),
|
entry->first.end(),
|
||||||
@ -130,7 +126,6 @@ inline TurnLanesIndexedArray transformTurnLaneMapIntoArrays(const LaneDescriptio
|
|||||||
return std::make_tuple(std::move(turn_lane_offsets), std::move(turn_lane_masks));
|
return std::make_tuple(std::move(turn_lane_offsets), std::move(turn_lane_masks));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // guidance
|
|
||||||
} // extractor
|
} // extractor
|
||||||
} // osrm
|
} // osrm
|
||||||
|
|
@ -1,25 +1,23 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_CONSTANTS_HPP_
|
#ifndef OSRM_GUIDANCE_CONSTANTS_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_CONSTANTS_HPP_
|
#define OSRM_GUIDANCE_CONSTANTS_HPP_
|
||||||
|
|
||||||
|
#include "extractor/intersection/constants.hpp"
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
const bool constexpr INVERT = true;
|
|
||||||
|
|
||||||
// what angle is interpreted as going straight
|
// what angle is interpreted as going straight
|
||||||
const double constexpr STRAIGHT_ANGLE = 180.;
|
using extractor::intersection::STRAIGHT_ANGLE;
|
||||||
const double constexpr ORTHOGONAL_ANGLE = 90.;
|
|
||||||
// if a turn deviates this much from going straight, it will be kept straight
|
// if a turn deviates this much from going straight, it will be kept straight
|
||||||
const double constexpr MAXIMAL_ALLOWED_NO_TURN_DEVIATION = 3.;
|
using extractor::intersection::MAXIMAL_ALLOWED_NO_TURN_DEVIATION;
|
||||||
// angle that lies between two nearly indistinguishable roads
|
// angle that lies between two nearly indistinguishable roads
|
||||||
const double constexpr NARROW_TURN_ANGLE = 40.;
|
using extractor::intersection::NARROW_TURN_ANGLE;
|
||||||
const double constexpr GROUP_ANGLE = 60;
|
using extractor::intersection::GROUP_ANGLE;
|
||||||
// angle difference that can be classified as straight, if its the only narrow turn
|
// angle difference that can be classified as straight, if its the only narrow turn
|
||||||
const double constexpr FUZZY_ANGLE_DIFFERENCE = 25.;
|
using extractor::intersection::FUZZY_ANGLE_DIFFERENCE;
|
||||||
|
|
||||||
const double constexpr DISTINCTION_RATIO = 2;
|
const double constexpr DISTINCTION_RATIO = 2;
|
||||||
|
|
||||||
// Named roundabouts with radii larger then than this are seen as rotary
|
// Named roundabouts with radii larger then than this are seen as rotary
|
||||||
@ -32,19 +30,7 @@ const double constexpr INCREASES_BY_FOURTY_PERCENT = 1.4;
|
|||||||
|
|
||||||
const int constexpr MAX_SLIPROAD_THRESHOLD = 250;
|
const int constexpr MAX_SLIPROAD_THRESHOLD = 250;
|
||||||
|
|
||||||
// Road priorities give an idea of how obvious a turn is. If two priorities differ greatly (e.g.
|
|
||||||
// service road over a primary road, the better priority can be seen as obvious due to its road
|
|
||||||
// category).
|
|
||||||
const double constexpr PRIORITY_DISTINCTION_FACTOR = 1.75;
|
|
||||||
|
|
||||||
// the lane width we assume for a single lane
|
|
||||||
const auto constexpr ASSUMED_LANE_WIDTH = 3.25;
|
|
||||||
|
|
||||||
// how far apart can roads be at the most, when thinking about merging them?
|
|
||||||
const auto constexpr MERGABLE_ANGLE_DIFFERENCE = 95.0;
|
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_EXTRACTOR_GUIDANCE_CONSTANTS_HPP_
|
#endif // OSRM_GUIDANCE_CONSTANTS_HPP_
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_DRIVEWAY_HANDLER_HPP
|
#ifndef OSRM_GUIDANCE_DRIVEWAY_HANDLER_HPP
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_DRIVEWAY_HANDLER_HPP
|
#define OSRM_GUIDANCE_DRIVEWAY_HANDLER_HPP
|
||||||
|
|
||||||
#include "guidance/intersection_handler.hpp"
|
#include "guidance/intersection_handler.hpp"
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -15,14 +13,14 @@ class DrivewayHandler final : public IntersectionHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DrivewayHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
DrivewayHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table);
|
const extractor::SuffixTable &street_name_suffix_table);
|
||||||
|
|
||||||
~DrivewayHandler() override final = default;
|
~DrivewayHandler() override final = default;
|
||||||
|
|
||||||
@ -38,7 +36,6 @@ class DrivewayHandler final : public IntersectionHandler
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /* OSRM_EXTRACTOR_GUIDANCE_DRIVEWAY_HANDLER_HPP */
|
#endif /* OSRM_GUIDANCE_DRIVEWAY_HANDLER_HPP */
|
||||||
|
51
include/guidance/files.hpp
Normal file
51
include/guidance/files.hpp
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#ifndef OSRM_GUIDANCE_FILES_HPP
|
||||||
|
#define OSRM_GUIDANCE_FILES_HPP
|
||||||
|
|
||||||
|
#include "guidance/serialization.hpp"
|
||||||
|
#include "guidance/turn_data_container.hpp"
|
||||||
|
|
||||||
|
#include "util/packed_vector.hpp"
|
||||||
|
#include "util/range_table.hpp"
|
||||||
|
#include "util/serialization.hpp"
|
||||||
|
|
||||||
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace guidance
|
||||||
|
{
|
||||||
|
namespace files
|
||||||
|
{
|
||||||
|
|
||||||
|
// reads .osrm.edges
|
||||||
|
template <typename TurnDataT>
|
||||||
|
inline void readTurnData(const boost::filesystem::path &path, TurnDataT &turn_data)
|
||||||
|
{
|
||||||
|
static_assert(std::is_same<guidance::TurnDataContainer, TurnDataT>::value ||
|
||||||
|
std::is_same<guidance::TurnDataView, TurnDataT>::value ||
|
||||||
|
std::is_same<guidance::TurnDataExternalContainer, TurnDataT>::value,
|
||||||
|
"");
|
||||||
|
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
|
||||||
|
storage::io::FileReader reader{path, fingerprint};
|
||||||
|
|
||||||
|
serialization::read(reader, turn_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// writes .osrm.edges
|
||||||
|
template <typename TurnDataT>
|
||||||
|
inline void writeTurnData(const boost::filesystem::path &path, const TurnDataT &turn_data)
|
||||||
|
{
|
||||||
|
static_assert(std::is_same<guidance::TurnDataContainer, TurnDataT>::value ||
|
||||||
|
std::is_same<guidance::TurnDataView, TurnDataT>::value ||
|
||||||
|
std::is_same<guidance::TurnDataExternalContainer, TurnDataT>::value,
|
||||||
|
"");
|
||||||
|
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
|
||||||
|
storage::io::FileWriter writer{path, fingerprint};
|
||||||
|
|
||||||
|
serialization::write(writer, turn_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -1,80 +1,14 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_INTERSECTION_HPP_
|
#ifndef OSRM_GUIDANCE_INTERSECTION_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_INTERSECTION_HPP_
|
#define OSRM_GUIDANCE_INTERSECTION_HPP_
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <functional>
|
|
||||||
#include <limits>
|
|
||||||
#include <string>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "util/bearing.hpp"
|
|
||||||
#include "util/log.hpp"
|
|
||||||
#include "util/node_based_graph.hpp"
|
|
||||||
#include "util/typedefs.hpp" // EdgeID
|
|
||||||
|
|
||||||
|
#include "extractor/intersection/intersection_view.hpp"
|
||||||
#include "guidance/turn_instruction.hpp"
|
#include "guidance/turn_instruction.hpp"
|
||||||
|
|
||||||
#include <boost/range/algorithm/count_if.hpp>
|
|
||||||
#include <boost/range/algorithm/find_if.hpp>
|
|
||||||
#include <boost/range/algorithm/min_element.hpp>
|
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
// the shape of an intersection only knows about edge IDs and bearings
|
|
||||||
// `bearing` is the direction in clockwise angle from true north after taking the turn:
|
|
||||||
// 0 = heading north, 90 = east, 180 = south, 270 = west
|
|
||||||
struct IntersectionShapeData
|
|
||||||
{
|
|
||||||
EdgeID eid;
|
|
||||||
double bearing;
|
|
||||||
double segment_length;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline auto makeCompareShapeDataByBearing(const double base_bearing)
|
|
||||||
{
|
|
||||||
return [base_bearing](const auto &lhs, const auto &rhs) {
|
|
||||||
return util::angularDeviation(lhs.bearing, base_bearing) <
|
|
||||||
util::angularDeviation(rhs.bearing, base_bearing);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
inline auto makeCompareAngularDeviation(const double angle)
|
|
||||||
{
|
|
||||||
return [angle](const auto &lhs, const auto &rhs) {
|
|
||||||
return util::angularDeviation(lhs.angle, angle) < util::angularDeviation(rhs.angle, angle);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
inline auto makeExtractLanesForRoad(const util::NodeBasedDynamicGraph &node_based_graph)
|
|
||||||
{
|
|
||||||
return [&node_based_graph](const auto &road) {
|
|
||||||
return node_based_graph.GetEdgeData(road.eid).road_classification.GetNumberOfLanes();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// When viewing an intersection from an incoming edge, we can transform a shape into a view which
|
|
||||||
// gives additional information on angles and whether a turn is allowed
|
|
||||||
struct IntersectionViewData : IntersectionShapeData
|
|
||||||
{
|
|
||||||
IntersectionViewData(const IntersectionShapeData &shape,
|
|
||||||
const bool entry_allowed,
|
|
||||||
const double angle)
|
|
||||||
: IntersectionShapeData(shape), entry_allowed(entry_allowed), angle(angle)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool entry_allowed;
|
|
||||||
double angle;
|
|
||||||
|
|
||||||
bool CompareByAngle(const IntersectionViewData &other) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
// A Connected Road is the internal representation of a potential turn. Internally, we require
|
// A Connected Road is the internal representation of a potential turn. Internally, we require
|
||||||
// full list of all connected roads to determine the outcome.
|
// full list of all connected roads to determine the outcome.
|
||||||
// The reasoning behind is that even invalid turns can influence the perceived angles, or even
|
// The reasoning behind is that even invalid turns can influence the perceived angles, or even
|
||||||
@ -95,9 +29,9 @@ struct IntersectionViewData : IntersectionShapeData
|
|||||||
// aaaaaaaa
|
// aaaaaaaa
|
||||||
//
|
//
|
||||||
// We would perceive a->c as a sharp turn, a->b as a slight turn, and b->c as a slight turn.
|
// We would perceive a->c as a sharp turn, a->b as a slight turn, and b->c as a slight turn.
|
||||||
struct ConnectedRoad final : IntersectionViewData
|
struct ConnectedRoad final : extractor::intersection::IntersectionViewData
|
||||||
{
|
{
|
||||||
ConnectedRoad(const IntersectionViewData &view,
|
ConnectedRoad(const extractor::intersection::IntersectionViewData &view,
|
||||||
const TurnInstruction instruction,
|
const TurnInstruction instruction,
|
||||||
const LaneDataID lane_data_id)
|
const LaneDataID lane_data_id)
|
||||||
: IntersectionViewData(view), instruction(instruction), lane_data_id(lane_data_id)
|
: IntersectionViewData(view), instruction(instruction), lane_data_id(lane_data_id)
|
||||||
@ -111,187 +45,34 @@ struct ConnectedRoad final : IntersectionViewData
|
|||||||
bool compareByAngle(const ConnectedRoad &other) const;
|
bool compareByAngle(const ConnectedRoad &other) const;
|
||||||
|
|
||||||
// make a left turn into an equivalent right turn and vice versa
|
// make a left turn into an equivalent right turn and vice versa
|
||||||
void mirror();
|
void mirror()
|
||||||
|
{
|
||||||
|
const constexpr DirectionModifier::Enum mirrored_modifiers[] = {
|
||||||
|
DirectionModifier::UTurn,
|
||||||
|
DirectionModifier::SharpLeft,
|
||||||
|
DirectionModifier::Left,
|
||||||
|
DirectionModifier::SlightLeft,
|
||||||
|
DirectionModifier::Straight,
|
||||||
|
DirectionModifier::SlightRight,
|
||||||
|
DirectionModifier::Right,
|
||||||
|
DirectionModifier::SharpRight};
|
||||||
|
|
||||||
OSRM_ATTR_WARN_UNUSED
|
static_assert(
|
||||||
ConnectedRoad getMirroredCopy() const;
|
sizeof(mirrored_modifiers) / sizeof(DirectionModifier::Enum) ==
|
||||||
|
DirectionModifier::MaxDirectionModifier,
|
||||||
|
"The list of mirrored modifiers needs to match the available modifiers in size.");
|
||||||
|
|
||||||
|
if (util::angularDeviation(angle, 0) > std::numeric_limits<double>::epsilon())
|
||||||
|
{
|
||||||
|
angle = 360 - angle;
|
||||||
|
instruction.direction_modifier = mirrored_modifiers[instruction.direction_modifier];
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// small helper function to print the content of a connected road
|
// small helper function to print the content of a connected road
|
||||||
std::string toString(const IntersectionShapeData &shape);
|
|
||||||
std::string toString(const IntersectionViewData &view);
|
|
||||||
std::string toString(const ConnectedRoad &road);
|
std::string toString(const ConnectedRoad &road);
|
||||||
|
|
||||||
// Intersections are sorted roads: [0] being the UTurn road, then from sharp right to sharp left.
|
|
||||||
// common operations shared amongst all intersection types
|
|
||||||
template <typename Self> struct EnableShapeOps
|
|
||||||
{
|
|
||||||
// same as closest turn, but for bearings
|
|
||||||
auto FindClosestBearing(double bearing) const
|
|
||||||
{
|
|
||||||
auto comp = makeCompareShapeDataByBearing(bearing);
|
|
||||||
return std::min_element(self()->begin(), self()->end(), comp);
|
|
||||||
}
|
|
||||||
|
|
||||||
// search a given eid in the intersection
|
|
||||||
auto FindEid(const EdgeID eid) const
|
|
||||||
{
|
|
||||||
return boost::range::find_if(*self(), [eid](const auto &road) { return road.eid == eid; });
|
|
||||||
}
|
|
||||||
|
|
||||||
// find the maximum value based on a conversion operator
|
|
||||||
template <typename UnaryProjection> auto FindMaximum(UnaryProjection converter) const
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(!self()->empty());
|
|
||||||
auto initial = converter(self()->front());
|
|
||||||
|
|
||||||
const auto extract_maximal_value = [&initial, converter](const auto &road) {
|
|
||||||
initial = std::max(initial, converter(road));
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
boost::range::find_if(*self(), extract_maximal_value);
|
|
||||||
return initial;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find the maximum value based on a conversion operator and a predefined initial value
|
|
||||||
template <typename UnaryPredicate> auto Count(UnaryPredicate detector) const
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(!self()->empty());
|
|
||||||
return boost::range::count_if(*self(), detector);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
auto self() { return static_cast<Self *>(this); }
|
|
||||||
auto self() const { return static_cast<const Self *>(this); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct IntersectionShape final : std::vector<IntersectionShapeData>, //
|
|
||||||
EnableShapeOps<IntersectionShape> //
|
|
||||||
{
|
|
||||||
using Base = std::vector<IntersectionShapeData>;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Common operations shared among IntersectionView and Intersections.
|
|
||||||
// Inherit to enable those operations on your compatible type. CRTP pattern.
|
|
||||||
template <typename Self> struct EnableIntersectionOps
|
|
||||||
{
|
|
||||||
// Find the turn whose angle offers the least angular deviation to the specified angle
|
|
||||||
// For turn angles [0, 90, 260] and a query of 180 we return the 260 degree turn.
|
|
||||||
auto findClosestTurn(double angle) const
|
|
||||||
{
|
|
||||||
auto comp = makeCompareAngularDeviation(angle);
|
|
||||||
return boost::range::min_element(*self(), comp);
|
|
||||||
}
|
|
||||||
// returns a non-const_interator
|
|
||||||
auto findClosestTurn(double angle)
|
|
||||||
{
|
|
||||||
auto comp = makeCompareAngularDeviation(angle);
|
|
||||||
return std::min_element(self()->begin(), self()->end(), comp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check validity of the intersection object. We assume a few basic properties every set of
|
|
||||||
* connected roads should follow throughout guidance pre-processing. This utility function
|
|
||||||
* allows checking intersections for validity
|
|
||||||
*/
|
|
||||||
auto valid() const
|
|
||||||
{
|
|
||||||
if (self()->empty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
auto comp = [](const auto &lhs, const auto &rhs) { return lhs.CompareByAngle(rhs); };
|
|
||||||
|
|
||||||
const auto ordered = std::is_sorted(self()->begin(), self()->end(), comp);
|
|
||||||
|
|
||||||
if (!ordered)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const auto uturn = self()->operator[](0).angle < std::numeric_limits<double>::epsilon();
|
|
||||||
|
|
||||||
if (!uturn)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the UTurn road we took to arrive at this intersection.
|
|
||||||
const auto &getUTurnRoad() const { return self()->operator[](0); }
|
|
||||||
|
|
||||||
// Returns the right-most road at this intersection.
|
|
||||||
const auto &getRightmostRoad() const
|
|
||||||
{
|
|
||||||
return self()->size() > 1 ? self()->operator[](1) : self()->getUTurnRoad();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the left-most road at this intersection.
|
|
||||||
const auto &getLeftmostRoad() const
|
|
||||||
{
|
|
||||||
return self()->size() > 1 ? self()->back() : self()->getUTurnRoad();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Can this be skipped over?
|
|
||||||
auto isTrafficSignalOrBarrier() const { return self()->size() == 2; }
|
|
||||||
|
|
||||||
// Checks if there is at least one road available (except UTurn road) on which to continue.
|
|
||||||
auto isDeadEnd() const
|
|
||||||
{
|
|
||||||
auto pred = [](const auto &road) { return road.entry_allowed; };
|
|
||||||
return std::none_of(self()->begin() + 1, self()->end(), pred);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the number of roads we can enter at this intersection, respectively.
|
|
||||||
auto countEnterable() const
|
|
||||||
{
|
|
||||||
auto pred = [](const auto &road) { return road.entry_allowed; };
|
|
||||||
return boost::range::count_if(*self(), pred);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the number of roads we can not enter at this intersection, respectively.
|
|
||||||
auto countNonEnterable() const { return self()->size() - self()->countEnterable(); }
|
|
||||||
|
|
||||||
// same as find closests turn but with an additional predicate to allow filtering
|
|
||||||
// the filter has to return `true` for elements that should be ignored
|
|
||||||
template <typename UnaryPredicate>
|
|
||||||
auto findClosestTurn(const double angle, const UnaryPredicate filter) const
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(!self()->empty());
|
|
||||||
const auto candidate =
|
|
||||||
boost::range::min_element(*self(), [angle, &filter](const auto &lhs, const auto &rhs) {
|
|
||||||
const auto filtered_lhs = filter(lhs), filtered_rhs = filter(rhs);
|
|
||||||
const auto deviation_lhs = util::angularDeviation(lhs.angle, angle),
|
|
||||||
deviation_rhs = util::angularDeviation(rhs.angle, angle);
|
|
||||||
return std::tie(filtered_lhs, deviation_lhs) <
|
|
||||||
std::tie(filtered_rhs, deviation_rhs);
|
|
||||||
});
|
|
||||||
|
|
||||||
// make sure only to return valid elements
|
|
||||||
return filter(*candidate) ? self()->end() : candidate;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if all roads between begin and end allow entry
|
|
||||||
template <typename InputIt>
|
|
||||||
bool hasAllValidEntries(const InputIt begin, const InputIt end) const
|
|
||||||
{
|
|
||||||
static_assert(
|
|
||||||
std::is_base_of<std::input_iterator_tag,
|
|
||||||
typename std::iterator_traits<InputIt>::iterator_category>::value,
|
|
||||||
"hasAllValidEntries() only accepts input iterators");
|
|
||||||
return std::all_of(
|
|
||||||
begin, end, [](const IntersectionViewData &road) { return road.entry_allowed; });
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
auto self() { return static_cast<Self *>(this); }
|
|
||||||
auto self() const { return static_cast<const Self *>(this); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct IntersectionView final : std::vector<IntersectionViewData>, //
|
|
||||||
EnableShapeOps<IntersectionView>, //
|
|
||||||
EnableIntersectionOps<IntersectionView> //
|
|
||||||
{
|
|
||||||
using Base = std::vector<IntersectionViewData>;
|
|
||||||
};
|
|
||||||
|
|
||||||
// `Intersection` is a relative view of an intersection by an incoming edge.
|
// `Intersection` is a relative view of an intersection by an incoming edge.
|
||||||
// `Intersection` are streets at an intersection stored as an ordered list of connected roads
|
// `Intersection` are streets at an intersection stored as an ordered list of connected roads
|
||||||
// ordered from sharp right counter-clockwise to
|
// ordered from sharp right counter-clockwise to
|
||||||
@ -317,15 +98,31 @@ struct IntersectionView final : std::vector<IntersectionViewData>, //
|
|||||||
// intersec := intersection
|
// intersec := intersection
|
||||||
// nbh := node_based_graph
|
// nbh := node_based_graph
|
||||||
//
|
//
|
||||||
struct Intersection final : std::vector<ConnectedRoad>, //
|
struct Intersection final : std::vector<ConnectedRoad>, //
|
||||||
EnableShapeOps<Intersection>, //
|
extractor::intersection::EnableShapeOps<Intersection>, //
|
||||||
EnableIntersectionOps<Intersection> //
|
extractor::intersection::EnableIntersectionOps<Intersection> //
|
||||||
{
|
{
|
||||||
using Base = std::vector<ConnectedRoad>;
|
using Base = std::vector<ConnectedRoad>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline std::string toString(const ConnectedRoad &road)
|
||||||
|
{
|
||||||
|
std::string result = "[connection] ";
|
||||||
|
result += std::to_string(road.eid);
|
||||||
|
result += " allows entry: ";
|
||||||
|
result += std::to_string(road.entry_allowed);
|
||||||
|
result += " angle: ";
|
||||||
|
result += std::to_string(road.angle);
|
||||||
|
result += " bearing: ";
|
||||||
|
result += std::to_string(road.bearing);
|
||||||
|
result += " instruction: ";
|
||||||
|
result += std::to_string(static_cast<std::int32_t>(road.instruction.type)) + " " +
|
||||||
|
std::to_string(static_cast<std::int32_t>(road.instruction.direction_modifier)) + " " +
|
||||||
|
std::to_string(static_cast<std::int32_t>(road.lane_data_id));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /*OSRM_EXTRACTOR_GUIDANCE_INTERSECTION_HPP_*/
|
#endif /* OSRM_GUIDANCE_INTERSECTION_HPP_*/
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_INTERSECTION_HANDLER_HPP_
|
#ifndef OSRM_GUIDANCE_INTERSECTION_HANDLER_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_INTERSECTION_HANDLER_HPP_
|
#define OSRM_GUIDANCE_INTERSECTION_HANDLER_HPP_
|
||||||
|
|
||||||
#include "extractor/intersection/intersection_analysis.hpp"
|
#include "extractor/intersection/intersection_analysis.hpp"
|
||||||
#include "extractor/query_node.hpp"
|
#include "extractor/intersection/node_based_graph_walker.hpp"
|
||||||
#include "extractor/suffix_table.hpp"
|
#include "extractor/suffix_table.hpp"
|
||||||
|
#include "guidance/constants.hpp"
|
||||||
#include "guidance/intersection.hpp"
|
#include "guidance/intersection.hpp"
|
||||||
#include "guidance/node_based_graph_walker.hpp"
|
|
||||||
|
|
||||||
#include "util/coordinate_calculation.hpp"
|
#include "util/coordinate_calculation.hpp"
|
||||||
#include "util/guidance/name_announcements.hpp"
|
#include "util/guidance/name_announcements.hpp"
|
||||||
@ -21,8 +21,6 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -33,14 +31,14 @@ class IntersectionHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IntersectionHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
IntersectionHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table);
|
const extractor::SuffixTable &street_name_suffix_table);
|
||||||
|
|
||||||
virtual ~IntersectionHandler() = default;
|
virtual ~IntersectionHandler() = default;
|
||||||
|
|
||||||
@ -54,15 +52,16 @@ class IntersectionHandler
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph;
|
const util::NodeBasedDynamicGraph &node_based_graph;
|
||||||
const EdgeBasedNodeDataContainer &node_data_container;
|
const extractor::EdgeBasedNodeDataContainer &node_data_container;
|
||||||
const std::vector<util::Coordinate> &node_coordinates;
|
const std::vector<util::Coordinate> &node_coordinates;
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries;
|
const extractor::CompressedEdgeContainer &compressed_geometries;
|
||||||
const RestrictionMap &node_restriction_map;
|
const extractor::RestrictionMap &node_restriction_map;
|
||||||
const std::unordered_set<NodeID> &barrier_nodes;
|
const std::unordered_set<NodeID> &barrier_nodes;
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data;
|
const extractor::TurnLanesIndexedArray &turn_lanes_data;
|
||||||
const util::NameTable &name_table;
|
const util::NameTable &name_table;
|
||||||
const SuffixTable &street_name_suffix_table;
|
const extractor::SuffixTable &street_name_suffix_table;
|
||||||
const NodeBasedGraphWalker graph_walker; // for skipping traffic signal, distances etc.
|
const extractor::intersection::NodeBasedGraphWalker
|
||||||
|
graph_walker; // for skipping traffic signal, distances etc.
|
||||||
|
|
||||||
// Decide on a basic turn types
|
// Decide on a basic turn types
|
||||||
TurnType::Enum findBasicTurnType(const EdgeID via_edge, const ConnectedRoad &candidate) const;
|
TurnType::Enum findBasicTurnType(const EdgeID via_edge, const ConnectedRoad &candidate) const;
|
||||||
@ -101,8 +100,8 @@ class IntersectionHandler
|
|||||||
// See `getNextIntersection`
|
// See `getNextIntersection`
|
||||||
struct IntersectionViewAndNode final
|
struct IntersectionViewAndNode final
|
||||||
{
|
{
|
||||||
IntersectionView intersection; // < actual intersection
|
extractor::intersection::IntersectionView intersection; // < actual intersection
|
||||||
NodeID node; // < node at this intersection
|
NodeID node; // < node at this intersection
|
||||||
};
|
};
|
||||||
|
|
||||||
// Skips over artificial intersections i.e. traffic lights, barriers etc.
|
// Skips over artificial intersections i.e. traffic lights, barriers etc.
|
||||||
@ -153,7 +152,7 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
double best_continue_deviation = 180;
|
double best_continue_deviation = 180;
|
||||||
|
|
||||||
/* helper functions */
|
/* helper functions */
|
||||||
const auto IsContinueRoad = [&](const NodeBasedEdgeAnnotation &way_data) {
|
const auto IsContinueRoad = [&](const extractor::NodeBasedEdgeAnnotation &way_data) {
|
||||||
return !util::guidance::requiresNameAnnounced(
|
return !util::guidance::requiresNameAnnounced(
|
||||||
in_way_data.name_id, way_data.name_id, name_table, street_name_suffix_table);
|
in_way_data.name_id, way_data.name_id, name_table, street_name_suffix_table);
|
||||||
};
|
};
|
||||||
@ -571,20 +570,20 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
// even reverse the direction. Since we don't want to compute actual turns but simply
|
// even reverse the direction. Since we don't want to compute actual turns but simply
|
||||||
// try to find whether there is a turn going to the opposite direction of our obvious
|
// try to find whether there is a turn going to the opposite direction of our obvious
|
||||||
// turn, this should be alright.
|
// turn, this should be alright.
|
||||||
const auto previous_intersection = [&]() -> IntersectionView {
|
const auto previous_intersection = [&]() -> extractor::intersection::IntersectionView {
|
||||||
const auto parameters = intersection::skipDegreeTwoNodes(
|
const auto parameters = extractor::intersection::skipDegreeTwoNodes(
|
||||||
node_based_graph, {node_at_intersection, intersection[0].eid});
|
node_based_graph, {node_at_intersection, intersection[0].eid});
|
||||||
if (node_based_graph.GetTarget(parameters.edge) == node_at_intersection)
|
if (node_based_graph.GetTarget(parameters.edge) == node_at_intersection)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
return intersection::getConnectedRoads<false>(node_based_graph,
|
return extractor::intersection::getConnectedRoads<false>(node_based_graph,
|
||||||
node_data_container,
|
node_data_container,
|
||||||
node_coordinates,
|
node_coordinates,
|
||||||
compressed_geometries,
|
compressed_geometries,
|
||||||
node_restriction_map,
|
node_restriction_map,
|
||||||
barrier_nodes,
|
barrier_nodes,
|
||||||
turn_lanes_data,
|
turn_lanes_data,
|
||||||
parameters);
|
parameters);
|
||||||
}();
|
}();
|
||||||
|
|
||||||
if (!previous_intersection.empty())
|
if (!previous_intersection.empty())
|
||||||
@ -615,7 +614,6 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /*OSRM_EXTRACTOR_GUIDANCE_INTERSECTION_HANDLER_HPP_*/
|
#endif /*OSRM_GUIDANCE_INTERSECTION_HANDLER_HPP_*/
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_IS_THROUGH_STREET_HPP_
|
#ifndef OSRM_GUIDANCE_IS_THROUGH_STREET_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_IS_THROUGH_STREET_HPP_
|
#define OSRM_GUIDANCE_IS_THROUGH_STREET_HPP_
|
||||||
|
|
||||||
#include "guidance/constants.hpp"
|
#include "guidance/constants.hpp"
|
||||||
|
|
||||||
|
#include "extractor/intersection/have_identical_names.hpp"
|
||||||
|
#include "extractor/node_data_container.hpp"
|
||||||
#include "extractor/suffix_table.hpp"
|
#include "extractor/suffix_table.hpp"
|
||||||
|
|
||||||
#include "util/guidance/name_announcements.hpp"
|
#include "util/guidance/name_announcements.hpp"
|
||||||
|
|
||||||
using osrm::util::angularDeviation;
|
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -18,10 +18,11 @@ template <typename IntersectionType>
|
|||||||
inline bool isThroughStreet(const std::size_t index,
|
inline bool isThroughStreet(const std::size_t index,
|
||||||
const IntersectionType &intersection,
|
const IntersectionType &intersection,
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph,
|
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table)
|
const extractor::SuffixTable &street_name_suffix_table)
|
||||||
{
|
{
|
||||||
|
using osrm::util::angularDeviation;
|
||||||
|
|
||||||
const auto &data_at_index = node_data_container.GetAnnotation(
|
const auto &data_at_index = node_data_container.GetAnnotation(
|
||||||
node_based_graph.GetEdgeData(intersection[index].eid).annotation_data);
|
node_based_graph.GetEdgeData(intersection[index].eid).annotation_data);
|
||||||
@ -43,7 +44,7 @@ inline bool isThroughStreet(const std::size_t index,
|
|||||||
const bool is_nearly_straight = angularDeviation(road.angle, intersection[index].angle) >
|
const bool is_nearly_straight = angularDeviation(road.angle, intersection[index].angle) >
|
||||||
(STRAIGHT_ANGLE - FUZZY_ANGLE_DIFFERENCE);
|
(STRAIGHT_ANGLE - FUZZY_ANGLE_DIFFERENCE);
|
||||||
|
|
||||||
const bool have_same_name = HaveIdenticalNames(
|
const bool have_same_name = extractor::intersection::HaveIdenticalNames(
|
||||||
data_at_index.name_id, road_data.name_id, name_table, street_name_suffix_table);
|
data_at_index.name_id, road_data.name_id, name_table, street_name_suffix_table);
|
||||||
|
|
||||||
const bool have_same_category =
|
const bool have_same_category =
|
||||||
@ -57,7 +58,6 @@ inline bool isThroughStreet(const std::size_t index,
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /*OSRM_EXTRACTOR_GUIDANCE_IS_THROUGH_STREET_HPP_*/
|
#endif /*OSRM_GUIDANCE_IS_THROUGH_STREET_HPP_*/
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_MOTORWAY_HANDLER_HPP_
|
#ifndef OSRM_GUIDANCE_MOTORWAY_HANDLER_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_MOTORWAY_HANDLER_HPP_
|
#define OSRM_GUIDANCE_MOTORWAY_HANDLER_HPP_
|
||||||
|
|
||||||
#include "extractor/query_node.hpp"
|
|
||||||
#include "guidance/intersection.hpp"
|
#include "guidance/intersection.hpp"
|
||||||
#include "guidance/intersection_handler.hpp"
|
#include "guidance/intersection_handler.hpp"
|
||||||
#include "guidance/is_through_street.hpp"
|
#include "guidance/is_through_street.hpp"
|
||||||
@ -14,8 +13,6 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -24,14 +21,14 @@ class MotorwayHandler : public IntersectionHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MotorwayHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
MotorwayHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table);
|
const extractor::SuffixTable &street_name_suffix_table);
|
||||||
|
|
||||||
~MotorwayHandler() override final = default;
|
~MotorwayHandler() override final = default;
|
||||||
|
|
||||||
@ -61,7 +58,6 @@ class MotorwayHandler : public IntersectionHandler
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /*OSRM_EXTRACTOR_GUIDANCE_MOTORWAY_HANDLER_HPP_*/
|
#endif /*OSRM_GUIDANCE_MOTORWAY_HANDLER_HPP_*/
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_ROUNDABOUT_HANDLER_HPP_
|
#ifndef OSRM_GUIDANCE_ROUNDABOUT_HANDLER_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_ROUNDABOUT_HANDLER_HPP_
|
#define OSRM_GUIDANCE_ROUNDABOUT_HANDLER_HPP_
|
||||||
|
|
||||||
#include "extractor/compressed_edge_container.hpp"
|
#include "extractor/compressed_edge_container.hpp"
|
||||||
|
#include "extractor/intersection/coordinate_extractor.hpp"
|
||||||
#include "extractor/query_node.hpp"
|
#include "extractor/query_node.hpp"
|
||||||
#include "guidance/coordinate_extractor.hpp"
|
|
||||||
#include "guidance/intersection.hpp"
|
#include "guidance/intersection.hpp"
|
||||||
#include "guidance/intersection_handler.hpp"
|
#include "guidance/intersection_handler.hpp"
|
||||||
#include "guidance/roundabout_type.hpp"
|
|
||||||
#include "guidance/is_through_street.hpp"
|
#include "guidance/is_through_street.hpp"
|
||||||
|
#include "guidance/roundabout_type.hpp"
|
||||||
|
|
||||||
#include "util/name_table.hpp"
|
#include "util/name_table.hpp"
|
||||||
#include "util/node_based_graph.hpp"
|
#include "util/node_based_graph.hpp"
|
||||||
@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -40,14 +38,14 @@ class RoundaboutHandler : public IntersectionHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RoundaboutHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
RoundaboutHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table);
|
const extractor::SuffixTable &street_name_suffix_table);
|
||||||
|
|
||||||
~RoundaboutHandler() override final = default;
|
~RoundaboutHandler() override final = default;
|
||||||
|
|
||||||
@ -82,11 +80,10 @@ class RoundaboutHandler : public IntersectionHandler
|
|||||||
bool
|
bool
|
||||||
qualifiesAsRoundaboutIntersection(const std::unordered_set<NodeID> &roundabout_nodes) const;
|
qualifiesAsRoundaboutIntersection(const std::unordered_set<NodeID> &roundabout_nodes) const;
|
||||||
|
|
||||||
const CoordinateExtractor coordinate_extractor;
|
const extractor::intersection::CoordinateExtractor coordinate_extractor;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /*OSRM_EXTRACTOR_GUIDANCE_ROUNDABOUT_HANDLER_HPP_*/
|
#endif /*OSRM_GUIDANCE_ROUNDABOUT_HANDLER_HPP_*/
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_ROUNDABOUT_TYPES_HPP_
|
#ifndef OSRM_GUIDANCE_ROUNDABOUT_TYPES_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_ROUNDABOUT_TYPES_HPP_
|
#define OSRM_GUIDANCE_ROUNDABOUT_TYPES_HPP_
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
enum class RoundaboutType
|
enum class RoundaboutType
|
||||||
@ -15,7 +13,6 @@ enum class RoundaboutType
|
|||||||
RoundaboutIntersection // small roundabout with distinct turns, handled as intersection
|
RoundaboutIntersection // small roundabout with distinct turns, handled as intersection
|
||||||
};
|
};
|
||||||
} /* namespace guidance */
|
} /* namespace guidance */
|
||||||
} /* namespace extractor */
|
|
||||||
} /* namespace osrm */
|
} /* namespace osrm */
|
||||||
|
|
||||||
#endif /* OSRM_EXTRACTOR_GUIDANCE_ROUNDABOUT_TYPES_HPP_ */
|
#endif /* OSRM_EXTRACTOR_GUIDANCE_ROUNDABOUT_TYPES_HPP_ */
|
||||||
|
44
include/guidance/serialization.hpp
Normal file
44
include/guidance/serialization.hpp
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#ifndef OSRM_GUIDANCE_IO_HPP
|
||||||
|
#define OSRM_GUIDANCE_IO_HPP
|
||||||
|
|
||||||
|
#include "guidance/turn_data_container.hpp"
|
||||||
|
|
||||||
|
#include "storage/io.hpp"
|
||||||
|
#include "storage/serialization.hpp"
|
||||||
|
|
||||||
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace guidance
|
||||||
|
{
|
||||||
|
namespace serialization
|
||||||
|
{
|
||||||
|
|
||||||
|
// read/write for turn data file
|
||||||
|
template <storage::Ownership Ownership>
|
||||||
|
inline void read(storage::io::FileReader &reader,
|
||||||
|
guidance::detail::TurnDataContainerImpl<Ownership> &turn_data_container)
|
||||||
|
{
|
||||||
|
storage::serialization::read(reader, turn_data_container.turn_instructions);
|
||||||
|
storage::serialization::read(reader, turn_data_container.lane_data_ids);
|
||||||
|
storage::serialization::read(reader, turn_data_container.entry_class_ids);
|
||||||
|
storage::serialization::read(reader, turn_data_container.pre_turn_bearings);
|
||||||
|
storage::serialization::read(reader, turn_data_container.post_turn_bearings);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <storage::Ownership Ownership>
|
||||||
|
inline void write(storage::io::FileWriter &writer,
|
||||||
|
const guidance::detail::TurnDataContainerImpl<Ownership> &turn_data_container)
|
||||||
|
{
|
||||||
|
storage::serialization::write(writer, turn_data_container.turn_instructions);
|
||||||
|
storage::serialization::write(writer, turn_data_container.lane_data_ids);
|
||||||
|
storage::serialization::write(writer, turn_data_container.entry_class_ids);
|
||||||
|
storage::serialization::write(writer, turn_data_container.pre_turn_bearings);
|
||||||
|
storage::serialization::write(writer, turn_data_container.post_turn_bearings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -1,7 +1,6 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_SLIPROAD_HANDLER_HPP_
|
#ifndef OSRM_GUIDANCE_SLIPROAD_HANDLER_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_SLIPROAD_HANDLER_HPP_
|
#define OSRM_GUIDANCE_SLIPROAD_HANDLER_HPP_
|
||||||
|
|
||||||
#include "extractor/query_node.hpp"
|
|
||||||
#include "guidance/intersection.hpp"
|
#include "guidance/intersection.hpp"
|
||||||
#include "guidance/intersection_handler.hpp"
|
#include "guidance/intersection_handler.hpp"
|
||||||
#include "guidance/is_through_street.hpp"
|
#include "guidance/is_through_street.hpp"
|
||||||
@ -15,8 +14,6 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -25,14 +22,14 @@ class SliproadHandler final : public IntersectionHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SliproadHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
SliproadHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table);
|
const extractor::SuffixTable &street_name_suffix_table);
|
||||||
|
|
||||||
~SliproadHandler() override final = default;
|
~SliproadHandler() override final = default;
|
||||||
|
|
||||||
@ -61,9 +58,9 @@ class SliproadHandler final : public IntersectionHandler
|
|||||||
bool isValidSliproadArea(const double max_area, const NodeID, const NodeID, const NodeID) const;
|
bool isValidSliproadArea(const double max_area, const NodeID, const NodeID, const NodeID) const;
|
||||||
|
|
||||||
// Is the Sliproad a link the both roads it shortcuts must not be links
|
// Is the Sliproad a link the both roads it shortcuts must not be links
|
||||||
bool isValidSliproadLink(const IntersectionViewData &sliproad,
|
bool isValidSliproadLink(const extractor::intersection::IntersectionViewData &sliproad,
|
||||||
const IntersectionViewData &first,
|
const extractor::intersection::IntersectionViewData &first,
|
||||||
const IntersectionViewData &second) const;
|
const extractor::intersection::IntersectionViewData &second) const;
|
||||||
|
|
||||||
// check if no mode changes are involved
|
// check if no mode changes are involved
|
||||||
bool allSameMode(const EdgeID in_road,
|
bool allSameMode(const EdgeID in_road,
|
||||||
@ -71,19 +68,19 @@ class SliproadHandler final : public IntersectionHandler
|
|||||||
const EdgeID target_road) const;
|
const EdgeID target_road) const;
|
||||||
|
|
||||||
// Could a Sliproad reach this intersection?
|
// Could a Sliproad reach this intersection?
|
||||||
static bool canBeTargetOfSliproad(const IntersectionView &intersection);
|
static bool
|
||||||
|
canBeTargetOfSliproad(const extractor::intersection::IntersectionView &intersection);
|
||||||
|
|
||||||
// Scales a threshold based on the underlying road classification.
|
// Scales a threshold based on the underlying road classification.
|
||||||
// Example: a 100 m threshold for a highway if different on living streets.
|
// Example: a 100 m threshold for a highway if different on living streets.
|
||||||
// The return value is guaranteed to not be larger than `threshold`.
|
// The return value is guaranteed to not be larger than `threshold`.
|
||||||
static double scaledThresholdByRoadClass(const double max_threshold,
|
static double scaledThresholdByRoadClass(const double max_threshold,
|
||||||
const RoadClassification &classification);
|
const extractor::RoadClassification &classification);
|
||||||
|
|
||||||
const CoordinateExtractor coordinate_extractor;
|
const extractor::intersection::CoordinateExtractor coordinate_extractor;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /*OSRM_EXTRACTOR_GUIDANCE_SLIPROAD_HANDLER_HPP_*/
|
#endif /*OSRM_GUIDANCE_SLIPROAD_HANDLER_HPP_*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_STATISTICS_HANDLER_HPP_
|
#ifndef OSRM_GUIDANCE_STATISTICS_HANDLER_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_STATISTICS_HANDLER_HPP_
|
#define OSRM_GUIDANCE_STATISTICS_HANDLER_HPP_
|
||||||
|
|
||||||
#include "guidance/intersection.hpp"
|
#include "guidance/intersection.hpp"
|
||||||
#include "guidance/intersection_handler.hpp"
|
#include "guidance/intersection_handler.hpp"
|
||||||
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -28,14 +26,14 @@ class StatisticsHandler final : public IntersectionHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StatisticsHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
StatisticsHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table)
|
const extractor::SuffixTable &street_name_suffix_table)
|
||||||
: IntersectionHandler(node_based_graph,
|
: IntersectionHandler(node_based_graph,
|
||||||
node_data_container,
|
node_data_container,
|
||||||
coordinates,
|
coordinates,
|
||||||
@ -110,7 +108,6 @@ class StatisticsHandler final : public IntersectionHandler
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_EXTRACTOR_GUIDANCE_VALIDATION_HANDLER_HPP_
|
#endif // OSRM_GUIDANCE_VALIDATION_HANDLER_HPP_
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_SUPPRESS_MODE_HANDLER_HPP_
|
#ifndef OSRM_GUIDANCE_SUPPRESS_MODE_HANDLER_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_SUPPRESS_MODE_HANDLER_HPP_
|
#define OSRM_GUIDANCE_SUPPRESS_MODE_HANDLER_HPP_
|
||||||
|
|
||||||
#include "extractor/travel_mode.hpp"
|
|
||||||
#include "guidance/constants.hpp"
|
|
||||||
#include "guidance/intersection.hpp"
|
#include "guidance/intersection.hpp"
|
||||||
#include "guidance/intersection_handler.hpp"
|
#include "guidance/intersection_handler.hpp"
|
||||||
#include "util/node_based_graph.hpp"
|
#include "util/node_based_graph.hpp"
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -21,14 +17,14 @@ class SuppressModeHandler final : public IntersectionHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SuppressModeHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
SuppressModeHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table);
|
const extractor::SuffixTable &street_name_suffix_table);
|
||||||
|
|
||||||
~SuppressModeHandler() override final = default;
|
~SuppressModeHandler() override final = default;
|
||||||
|
|
||||||
@ -41,8 +37,7 @@ class SuppressModeHandler final : public IntersectionHandler
|
|||||||
Intersection intersection) const override final;
|
Intersection intersection) const override final;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace osrm
|
|
||||||
} // namespace extractor
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /* OSRM_EXTRACTOR_GUIDANCE_SUPPRESS_MODE_HANDLER_HPP_ */
|
#endif /* OSRM_GUIDANCE_SUPPRESS_MODE_HANDLER_HPP_ */
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_TURN_ANALYSIS
|
#ifndef OSRM_GUIDANCE_TURN_ANALYSIS
|
||||||
#define OSRM_EXTRACTOR_TURN_ANALYSIS
|
#define OSRM_GUIDANCE_TURN_ANALYSIS
|
||||||
|
|
||||||
#include "extractor/compressed_edge_container.hpp"
|
#include "extractor/compressed_edge_container.hpp"
|
||||||
#include "extractor/query_node.hpp"
|
#include "extractor/intersection/intersection_view.hpp"
|
||||||
#include "extractor/restriction_index.hpp"
|
#include "extractor/restriction_index.hpp"
|
||||||
#include "extractor/suffix_table.hpp"
|
#include "extractor/suffix_table.hpp"
|
||||||
#include "guidance/driveway_handler.hpp"
|
#include "guidance/driveway_handler.hpp"
|
||||||
@ -30,8 +30,6 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -39,14 +37,14 @@ class TurnAnalysis
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TurnAnalysis(const util::NodeBasedDynamicGraph &node_based_graph,
|
TurnAnalysis(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const CompressedEdgeContainer &compressed_edge_container,
|
const extractor::CompressedEdgeContainer &compressed_edge_container,
|
||||||
const RestrictionMap &restriction_map,
|
const extractor::RestrictionMap &restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table);
|
const extractor::SuffixTable &street_name_suffix_table);
|
||||||
|
|
||||||
/* Full Analysis Process for a single node/edge combination. Use with caution, as the process is
|
/* Full Analysis Process for a single node/edge combination. Use with caution, as the process is
|
||||||
* relatively expensive */
|
* relatively expensive */
|
||||||
@ -56,9 +54,10 @@ class TurnAnalysis
|
|||||||
|
|
||||||
// Select turn types based on the intersection shape
|
// Select turn types based on the intersection shape
|
||||||
OSRM_ATTR_WARN_UNUSED
|
OSRM_ATTR_WARN_UNUSED
|
||||||
Intersection AssignTurnTypes(const NodeID from_node,
|
Intersection
|
||||||
const EdgeID via_eid,
|
AssignTurnTypes(const NodeID from_node,
|
||||||
const IntersectionView &intersection) const;
|
const EdgeID via_eid,
|
||||||
|
const extractor::intersection::IntersectionView &intersection) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph;
|
const util::NodeBasedDynamicGraph &node_based_graph;
|
||||||
@ -76,7 +75,6 @@ class TurnAnalysis
|
|||||||
}; // class TurnAnalysis
|
}; // class TurnAnalysis
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_EXTRACTOR_TURN_ANALYSIS
|
#endif // OSRM_GUIDANCE_TURN_ANALYSIS
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -20,7 +18,6 @@ std::pair<util::guidance::EntryClass, util::guidance::BearingClass>
|
|||||||
classifyIntersection(Intersection intersection, const osrm::util::Coordinate &location);
|
classifyIntersection(Intersection intersection, const osrm::util::Coordinate &location);
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_GUIDANCE_TURN_CLASSIFICATION_HPP_
|
#endif // OSRM_GUIDANCE_TURN_CLASSIFICATION_HPP_
|
||||||
|
123
include/guidance/turn_data_container.hpp
Normal file
123
include/guidance/turn_data_container.hpp
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
#ifndef OSRM_GUIDANCE_TURN_DATA_CONTAINER_HPP
|
||||||
|
#define OSRM_GUIDANCE_TURN_DATA_CONTAINER_HPP
|
||||||
|
|
||||||
|
#include "extractor/travel_mode.hpp"
|
||||||
|
#include "guidance/turn_instruction.hpp"
|
||||||
|
|
||||||
|
#include "storage/io_fwd.hpp"
|
||||||
|
#include "storage/shared_memory_ownership.hpp"
|
||||||
|
|
||||||
|
#include "util/guidance/turn_bearing.hpp"
|
||||||
|
#include "util/vector_view.hpp"
|
||||||
|
|
||||||
|
#include "util/typedefs.hpp"
|
||||||
|
|
||||||
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace guidance
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <storage::Ownership Ownership> class TurnDataContainerImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace serialization
|
||||||
|
{
|
||||||
|
template <storage::Ownership Ownership>
|
||||||
|
void read(storage::io::FileReader &reader, detail::TurnDataContainerImpl<Ownership> &turn_data);
|
||||||
|
|
||||||
|
template <storage::Ownership Ownership>
|
||||||
|
void write(storage::io::FileWriter &writer,
|
||||||
|
const detail::TurnDataContainerImpl<Ownership> &turn_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TurnData
|
||||||
|
{
|
||||||
|
guidance::TurnInstruction turn_instruction;
|
||||||
|
LaneDataID lane_data_id;
|
||||||
|
EntryClassID entry_class_id;
|
||||||
|
util::guidance::TurnBearing pre_turn_bearing;
|
||||||
|
util::guidance::TurnBearing post_turn_bearing;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <storage::Ownership Ownership> class TurnDataContainerImpl
|
||||||
|
{
|
||||||
|
template <typename T> using Vector = util::ViewOrVector<T, Ownership>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
TurnDataContainerImpl() = default;
|
||||||
|
|
||||||
|
TurnDataContainerImpl(Vector<guidance::TurnInstruction> turn_instructions,
|
||||||
|
Vector<LaneDataID> lane_data_ids,
|
||||||
|
Vector<EntryClassID> entry_class_ids,
|
||||||
|
Vector<util::guidance::TurnBearing> pre_turn_bearings,
|
||||||
|
Vector<util::guidance::TurnBearing> post_turn_bearings)
|
||||||
|
: turn_instructions(std::move(turn_instructions)), lane_data_ids(std::move(lane_data_ids)),
|
||||||
|
entry_class_ids(std::move(entry_class_ids)),
|
||||||
|
pre_turn_bearings(std::move(pre_turn_bearings)),
|
||||||
|
post_turn_bearings(std::move(post_turn_bearings))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
EntryClassID GetEntryClassID(const EdgeID id) const { return entry_class_ids[id]; }
|
||||||
|
|
||||||
|
util::guidance::TurnBearing GetPreTurnBearing(const EdgeID id) const
|
||||||
|
{
|
||||||
|
return pre_turn_bearings[id];
|
||||||
|
}
|
||||||
|
|
||||||
|
util::guidance::TurnBearing GetPostTurnBearing(const EdgeID id) const
|
||||||
|
{
|
||||||
|
return post_turn_bearings[id];
|
||||||
|
}
|
||||||
|
|
||||||
|
LaneDataID GetLaneDataID(const EdgeID id) const { return lane_data_ids[id]; }
|
||||||
|
|
||||||
|
bool HasLaneData(const EdgeID id) const { return INVALID_LANE_DATAID != lane_data_ids[id]; }
|
||||||
|
|
||||||
|
guidance::TurnInstruction GetTurnInstruction(const EdgeID id) const
|
||||||
|
{
|
||||||
|
return turn_instructions[id];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used by EdgeBasedGraphFactory to fill data structure
|
||||||
|
template <typename = std::enable_if<Ownership == storage::Ownership::Container>>
|
||||||
|
void push_back(const TurnData &data)
|
||||||
|
{
|
||||||
|
turn_instructions.push_back(data.turn_instruction);
|
||||||
|
lane_data_ids.push_back(data.lane_data_id);
|
||||||
|
entry_class_ids.push_back(data.entry_class_id);
|
||||||
|
pre_turn_bearings.push_back(data.pre_turn_bearing);
|
||||||
|
post_turn_bearings.push_back(data.post_turn_bearing);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename = std::enable_if<Ownership == storage::Ownership::Container>>
|
||||||
|
void append(const std::vector<TurnData> &others)
|
||||||
|
{
|
||||||
|
std::for_each(
|
||||||
|
others.begin(), others.end(), [this](const TurnData &other) { push_back(other); });
|
||||||
|
}
|
||||||
|
|
||||||
|
friend void serialization::read<Ownership>(storage::io::FileReader &reader,
|
||||||
|
TurnDataContainerImpl &turn_data_container);
|
||||||
|
friend void serialization::write<Ownership>(storage::io::FileWriter &writer,
|
||||||
|
const TurnDataContainerImpl &turn_data_container);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Vector<guidance::TurnInstruction> turn_instructions;
|
||||||
|
Vector<LaneDataID> lane_data_ids;
|
||||||
|
Vector<EntryClassID> entry_class_ids;
|
||||||
|
Vector<util::guidance::TurnBearing> pre_turn_bearings;
|
||||||
|
Vector<util::guidance::TurnBearing> post_turn_bearings;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
using TurnDataExternalContainer = detail::TurnDataContainerImpl<storage::Ownership::External>;
|
||||||
|
using TurnDataContainer = detail::TurnDataContainerImpl<storage::Ownership::Container>;
|
||||||
|
using TurnDataView = detail::TurnDataContainerImpl<storage::Ownership::View>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_TURN_DISCOVERY_HPP_
|
#ifndef OSRM_GUIDANCE_TURN_DISCOVERY_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_TURN_DISCOVERY_HPP_
|
#define OSRM_GUIDANCE_TURN_DISCOVERY_HPP_
|
||||||
|
|
||||||
#include "extractor/restriction_index.hpp"
|
#include "extractor/restriction_index.hpp"
|
||||||
#include "guidance/intersection.hpp"
|
#include "guidance/intersection.hpp"
|
||||||
@ -17,8 +17,8 @@ struct Coordinate;
|
|||||||
|
|
||||||
namespace extractor
|
namespace extractor
|
||||||
{
|
{
|
||||||
|
|
||||||
class CompressedEdgeContainer;
|
class CompressedEdgeContainer;
|
||||||
|
}
|
||||||
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
@ -34,20 +34,19 @@ bool findPreviousIntersection(
|
|||||||
const EdgeID via_edge,
|
const EdgeID via_edge,
|
||||||
const Intersection &intersection,
|
const Intersection &intersection,
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph, // query edge data
|
const util::NodeBasedDynamicGraph &node_based_graph, // query edge data
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
// output parameters, will be in an arbitrary state on failure
|
// output parameters, will be in an arbitrary state on failure
|
||||||
NodeID &result_node,
|
NodeID &result_node,
|
||||||
EdgeID &result_via_edge,
|
EdgeID &result_via_edge,
|
||||||
IntersectionView &result_intersection);
|
extractor::intersection::IntersectionView &result_intersection);
|
||||||
|
|
||||||
} // namespace lanes
|
} // namespace lanes
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /*OSRM_EXTRACTOR_GUIDANCE_TURN_DISCOVERY_HPP_*/
|
#endif /*OSRM_GUIDANCE_TURN_DISCOVERY_HPP_*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_TURN_HANDLER_HPP_
|
#ifndef OSRM_GUIDANCE_TURN_HANDLER_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_TURN_HANDLER_HPP_
|
#define OSRM_GUIDANCE_TURN_HANDLER_HPP_
|
||||||
|
|
||||||
#include "extractor/query_node.hpp"
|
#include "extractor/query_node.hpp"
|
||||||
#include "guidance/intersection.hpp"
|
#include "guidance/intersection.hpp"
|
||||||
@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -28,14 +26,14 @@ class TurnHandler : public IntersectionHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TurnHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
TurnHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table);
|
const extractor::SuffixTable &street_name_suffix_table);
|
||||||
|
|
||||||
~TurnHandler() override final = default;
|
~TurnHandler() override final = default;
|
||||||
|
|
||||||
@ -113,7 +111,6 @@ class TurnHandler : public IntersectionHandler
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /*OSRM_EXTRACTOR_GUIDANCE_TURN_HANDLER_HPP_*/
|
#endif /*OSRM_GUIDANCE_TURN_HANDLER_HPP_*/
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -157,7 +155,7 @@ inline bool operator==(const TurnInstruction lhs, const TurnInstruction rhs)
|
|||||||
// check if a instruction is associated in any form with a roundabout
|
// check if a instruction is associated in any form with a roundabout
|
||||||
inline bool hasRoundaboutType(const TurnInstruction instruction)
|
inline bool hasRoundaboutType(const TurnInstruction instruction)
|
||||||
{
|
{
|
||||||
using namespace extractor::guidance::TurnType;
|
using namespace guidance::TurnType;
|
||||||
const constexpr TurnType::Enum valid_types[] = {TurnType::EnterRoundabout,
|
const constexpr TurnType::Enum valid_types[] = {TurnType::EnterRoundabout,
|
||||||
TurnType::EnterAndExitRoundabout,
|
TurnType::EnterAndExitRoundabout,
|
||||||
TurnType::EnterRotary,
|
TurnType::EnterRotary,
|
||||||
@ -178,106 +176,106 @@ inline bool hasRoundaboutType(const TurnInstruction instruction)
|
|||||||
return std::find(first, last, instruction.type) != last;
|
return std::find(first, last, instruction.type) != last;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool entersRoundabout(const extractor::guidance::TurnInstruction instruction)
|
inline bool entersRoundabout(const guidance::TurnInstruction instruction)
|
||||||
{
|
{
|
||||||
return (instruction.type == extractor::guidance::TurnType::EnterRoundabout ||
|
return (instruction.type == guidance::TurnType::EnterRoundabout ||
|
||||||
instruction.type == extractor::guidance::TurnType::EnterRotary ||
|
instruction.type == guidance::TurnType::EnterRotary ||
|
||||||
instruction.type == extractor::guidance::TurnType::EnterRoundaboutIntersection ||
|
instruction.type == guidance::TurnType::EnterRoundaboutIntersection ||
|
||||||
instruction.type == extractor::guidance::TurnType::EnterRoundaboutAtExit ||
|
instruction.type == guidance::TurnType::EnterRoundaboutAtExit ||
|
||||||
instruction.type == extractor::guidance::TurnType::EnterRotaryAtExit ||
|
instruction.type == guidance::TurnType::EnterRotaryAtExit ||
|
||||||
instruction.type == extractor::guidance::TurnType::EnterRoundaboutIntersectionAtExit ||
|
instruction.type == guidance::TurnType::EnterRoundaboutIntersectionAtExit ||
|
||||||
instruction.type == extractor::guidance::TurnType::EnterAndExitRoundabout ||
|
instruction.type == guidance::TurnType::EnterAndExitRoundabout ||
|
||||||
instruction.type == extractor::guidance::TurnType::EnterAndExitRotary ||
|
instruction.type == guidance::TurnType::EnterAndExitRotary ||
|
||||||
instruction.type == extractor::guidance::TurnType::EnterAndExitRoundaboutIntersection);
|
instruction.type == guidance::TurnType::EnterAndExitRoundaboutIntersection);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool leavesRoundabout(const extractor::guidance::TurnInstruction instruction)
|
inline bool leavesRoundabout(const guidance::TurnInstruction instruction)
|
||||||
{
|
{
|
||||||
return (instruction.type == extractor::guidance::TurnType::ExitRoundabout ||
|
return (instruction.type == guidance::TurnType::ExitRoundabout ||
|
||||||
instruction.type == extractor::guidance::TurnType::ExitRotary ||
|
instruction.type == guidance::TurnType::ExitRotary ||
|
||||||
instruction.type == extractor::guidance::TurnType::ExitRoundaboutIntersection ||
|
instruction.type == guidance::TurnType::ExitRoundaboutIntersection ||
|
||||||
instruction.type == extractor::guidance::TurnType::EnterAndExitRoundabout ||
|
instruction.type == guidance::TurnType::EnterAndExitRoundabout ||
|
||||||
instruction.type == extractor::guidance::TurnType::EnterAndExitRotary ||
|
instruction.type == guidance::TurnType::EnterAndExitRotary ||
|
||||||
instruction.type == extractor::guidance::TurnType::EnterAndExitRoundaboutIntersection);
|
instruction.type == guidance::TurnType::EnterAndExitRoundaboutIntersection);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool staysOnRoundabout(const extractor::guidance::TurnInstruction instruction)
|
inline bool staysOnRoundabout(const guidance::TurnInstruction instruction)
|
||||||
{
|
{
|
||||||
return instruction.type == extractor::guidance::TurnType::StayOnRoundabout ||
|
return instruction.type == guidance::TurnType::StayOnRoundabout ||
|
||||||
instruction.type == extractor::guidance::TurnType::EnterRoundaboutAtExit ||
|
instruction.type == guidance::TurnType::EnterRoundaboutAtExit ||
|
||||||
instruction.type == extractor::guidance::TurnType::EnterRotaryAtExit ||
|
instruction.type == guidance::TurnType::EnterRotaryAtExit ||
|
||||||
instruction.type == extractor::guidance::TurnType::EnterRoundaboutIntersectionAtExit;
|
instruction.type == guidance::TurnType::EnterRoundaboutIntersectionAtExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Silent Turn Instructions are not to be mentioned to the outside world but
|
// Silent Turn Instructions are not to be mentioned to the outside world but
|
||||||
inline bool isSilent(const extractor::guidance::TurnInstruction instruction)
|
inline bool isSilent(const guidance::TurnInstruction instruction)
|
||||||
{
|
{
|
||||||
return instruction.type == extractor::guidance::TurnType::NoTurn ||
|
return instruction.type == guidance::TurnType::NoTurn ||
|
||||||
instruction.type == extractor::guidance::TurnType::Suppressed ||
|
instruction.type == guidance::TurnType::Suppressed ||
|
||||||
instruction.type == extractor::guidance::TurnType::StayOnRoundabout;
|
instruction.type == guidance::TurnType::StayOnRoundabout;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool hasRampType(const extractor::guidance::TurnInstruction instruction)
|
inline bool hasRampType(const guidance::TurnInstruction instruction)
|
||||||
{
|
{
|
||||||
return instruction.type == extractor::guidance::TurnType::OffRamp ||
|
return instruction.type == guidance::TurnType::OffRamp ||
|
||||||
instruction.type == extractor::guidance::TurnType::OnRamp;
|
instruction.type == guidance::TurnType::OnRamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline extractor::guidance::DirectionModifier::Enum getTurnDirection(const double angle)
|
inline guidance::DirectionModifier::Enum getTurnDirection(const double angle)
|
||||||
{
|
{
|
||||||
// An angle of zero is a u-turn
|
// An angle of zero is a u-turn
|
||||||
// 180 goes perfectly straight
|
// 180 goes perfectly straight
|
||||||
// 0-180 are right turns
|
// 0-180 are right turns
|
||||||
// 180-360 are left turns
|
// 180-360 are left turns
|
||||||
if (angle > 0 && angle < 60)
|
if (angle > 0 && angle < 60)
|
||||||
return extractor::guidance::DirectionModifier::SharpRight;
|
return guidance::DirectionModifier::SharpRight;
|
||||||
if (angle >= 60 && angle < 140)
|
if (angle >= 60 && angle < 140)
|
||||||
return extractor::guidance::DirectionModifier::Right;
|
return guidance::DirectionModifier::Right;
|
||||||
if (angle >= 140 && angle < 160)
|
if (angle >= 140 && angle < 160)
|
||||||
return extractor::guidance::DirectionModifier::SlightRight;
|
return guidance::DirectionModifier::SlightRight;
|
||||||
if (angle >= 160 && angle <= 200)
|
if (angle >= 160 && angle <= 200)
|
||||||
return extractor::guidance::DirectionModifier::Straight;
|
return guidance::DirectionModifier::Straight;
|
||||||
if (angle > 200 && angle <= 220)
|
if (angle > 200 && angle <= 220)
|
||||||
return extractor::guidance::DirectionModifier::SlightLeft;
|
return guidance::DirectionModifier::SlightLeft;
|
||||||
if (angle > 220 && angle <= 300)
|
if (angle > 220 && angle <= 300)
|
||||||
return extractor::guidance::DirectionModifier::Left;
|
return guidance::DirectionModifier::Left;
|
||||||
if (angle > 300 && angle < 360)
|
if (angle > 300 && angle < 360)
|
||||||
return extractor::guidance::DirectionModifier::SharpLeft;
|
return guidance::DirectionModifier::SharpLeft;
|
||||||
return extractor::guidance::DirectionModifier::UTurn;
|
return guidance::DirectionModifier::UTurn;
|
||||||
}
|
}
|
||||||
|
|
||||||
// swaps left <-> right modifier types
|
// swaps left <-> right modifier types
|
||||||
OSRM_ATTR_WARN_UNUSED
|
OSRM_ATTR_WARN_UNUSED
|
||||||
inline extractor::guidance::DirectionModifier::Enum
|
inline guidance::DirectionModifier::Enum
|
||||||
mirrorDirectionModifier(const extractor::guidance::DirectionModifier::Enum modifier)
|
mirrorDirectionModifier(const guidance::DirectionModifier::Enum modifier)
|
||||||
{
|
{
|
||||||
const constexpr extractor::guidance::DirectionModifier::Enum results[] = {
|
const constexpr guidance::DirectionModifier::Enum results[] = {
|
||||||
extractor::guidance::DirectionModifier::UTurn,
|
guidance::DirectionModifier::UTurn,
|
||||||
extractor::guidance::DirectionModifier::SharpLeft,
|
guidance::DirectionModifier::SharpLeft,
|
||||||
extractor::guidance::DirectionModifier::Left,
|
guidance::DirectionModifier::Left,
|
||||||
extractor::guidance::DirectionModifier::SlightLeft,
|
guidance::DirectionModifier::SlightLeft,
|
||||||
extractor::guidance::DirectionModifier::Straight,
|
guidance::DirectionModifier::Straight,
|
||||||
extractor::guidance::DirectionModifier::SlightRight,
|
guidance::DirectionModifier::SlightRight,
|
||||||
extractor::guidance::DirectionModifier::Right,
|
guidance::DirectionModifier::Right,
|
||||||
extractor::guidance::DirectionModifier::SharpRight};
|
guidance::DirectionModifier::SharpRight};
|
||||||
return results[modifier];
|
return results[modifier];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool hasLeftModifier(const extractor::guidance::TurnInstruction instruction)
|
inline bool hasLeftModifier(const guidance::TurnInstruction instruction)
|
||||||
{
|
{
|
||||||
return instruction.direction_modifier == extractor::guidance::DirectionModifier::SharpLeft ||
|
return instruction.direction_modifier == guidance::DirectionModifier::SharpLeft ||
|
||||||
instruction.direction_modifier == extractor::guidance::DirectionModifier::Left ||
|
instruction.direction_modifier == guidance::DirectionModifier::Left ||
|
||||||
instruction.direction_modifier == extractor::guidance::DirectionModifier::SlightLeft;
|
instruction.direction_modifier == guidance::DirectionModifier::SlightLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool hasRightModifier(const extractor::guidance::TurnInstruction instruction)
|
inline bool hasRightModifier(const guidance::TurnInstruction instruction)
|
||||||
{
|
{
|
||||||
return instruction.direction_modifier == extractor::guidance::DirectionModifier::SharpRight ||
|
return instruction.direction_modifier == guidance::DirectionModifier::SharpRight ||
|
||||||
instruction.direction_modifier == extractor::guidance::DirectionModifier::Right ||
|
instruction.direction_modifier == guidance::DirectionModifier::Right ||
|
||||||
instruction.direction_modifier == extractor::guidance::DirectionModifier::SlightRight;
|
instruction.direction_modifier == guidance::DirectionModifier::SlightRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isLeftTurn(const extractor::guidance::TurnInstruction instruction)
|
inline bool isLeftTurn(const guidance::TurnInstruction instruction)
|
||||||
{
|
{
|
||||||
switch (instruction.type)
|
switch (instruction.type)
|
||||||
{
|
{
|
||||||
@ -288,7 +286,7 @@ inline bool isLeftTurn(const extractor::guidance::TurnInstruction instruction)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isRightTurn(const extractor::guidance::TurnInstruction instruction)
|
inline bool isRightTurn(const guidance::TurnInstruction instruction)
|
||||||
{
|
{
|
||||||
switch (instruction.type)
|
switch (instruction.type)
|
||||||
{
|
{
|
||||||
@ -303,14 +301,14 @@ inline DirectionModifier::Enum bearingToDirectionModifier(const double bearing)
|
|||||||
{
|
{
|
||||||
if (bearing < 135)
|
if (bearing < 135)
|
||||||
{
|
{
|
||||||
return extractor::guidance::DirectionModifier::Right;
|
return guidance::DirectionModifier::Right;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bearing <= 225)
|
if (bearing <= 225)
|
||||||
{
|
{
|
||||||
return extractor::guidance::DirectionModifier::Straight;
|
return guidance::DirectionModifier::Straight;
|
||||||
}
|
}
|
||||||
return extractor::guidance::DirectionModifier::Left;
|
return guidance::DirectionModifier::Left;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
@ -337,7 +335,7 @@ struct TurnTypeName
|
|||||||
const char *internal_name;
|
const char *internal_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Indexes in this list correspond to the Enum values of osrm::extractor::guidance::TurnType
|
// Indexes in this list correspond to the Enum values of osrm::guidance::TurnType
|
||||||
const constexpr TurnTypeName turn_type_names[] = {
|
const constexpr TurnTypeName turn_type_names[] = {
|
||||||
{"invalid", "(not set)"},
|
{"invalid", "(not set)"},
|
||||||
{"new name", "new name"},
|
{"new name", "new name"},
|
||||||
@ -394,7 +392,6 @@ inline std::string instructionModifierToString(const DirectionModifier::Enum mod
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_GUIDANCE_TURN_INSTRUCTION_HPP_
|
#endif // OSRM_GUIDANCE_TURN_INSTRUCTION_HPP_
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_AUGMENTATION_HPP_
|
#ifndef OSRM_GUIDANCE_TURN_LANE_AUGMENTATION_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_AUGMENTATION_HPP_
|
#define OSRM_GUIDANCE_TURN_LANE_AUGMENTATION_HPP_
|
||||||
|
|
||||||
#include "guidance/intersection.hpp"
|
#include "guidance/intersection.hpp"
|
||||||
#include "guidance/turn_lane_data.hpp"
|
#include "guidance/turn_lane_data.hpp"
|
||||||
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
namespace lanes
|
namespace lanes
|
||||||
@ -20,7 +18,6 @@ LaneDataVector handleNoneValueAtSimpleTurn(LaneDataVector lane_data,
|
|||||||
|
|
||||||
} // namespace lanes
|
} // namespace lanes
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /* OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_AUGMENTATION_HPP_ */
|
#endif /* OSRM_GUIDANCE_TURN_LANE_AUGMENTATION_HPP_ */
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_DATA_HPP_
|
#ifndef OSRM_GUIDANCE_TURN_LANE_DATA_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_DATA_HPP_
|
#define OSRM_GUIDANCE_TURN_LANE_DATA_HPP_
|
||||||
|
|
||||||
#include "guidance/turn_lane_types.hpp"
|
#include "extractor/turn_lane_types.hpp"
|
||||||
#include "util/attributes.hpp"
|
#include "util/attributes.hpp"
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
namespace lanes
|
namespace lanes
|
||||||
@ -17,7 +15,7 @@ namespace lanes
|
|||||||
|
|
||||||
struct TurnLaneData
|
struct TurnLaneData
|
||||||
{
|
{
|
||||||
TurnLaneType::Mask tag;
|
extractor::TurnLaneType::Mask tag;
|
||||||
LaneID from;
|
LaneID from;
|
||||||
LaneID to;
|
LaneID to;
|
||||||
|
|
||||||
@ -30,18 +28,18 @@ typedef std::vector<TurnLaneData> LaneDataVector;
|
|||||||
|
|
||||||
// convertes a string given in the OSM format into a TurnLaneData vector
|
// convertes a string given in the OSM format into a TurnLaneData vector
|
||||||
OSRM_ATTR_WARN_UNUSED
|
OSRM_ATTR_WARN_UNUSED
|
||||||
LaneDataVector laneDataFromDescription(TurnLaneDescription turn_lane_description);
|
LaneDataVector laneDataFromDescription(extractor::TurnLaneDescription turn_lane_description);
|
||||||
|
|
||||||
// Locate A Tag in a lane data vector (if multiple tags are set, the first one found is returned)
|
// Locate A Tag in a lane data vector (if multiple tags are set, the first one found is returned)
|
||||||
LaneDataVector::const_iterator findTag(const TurnLaneType::Mask tag, const LaneDataVector &data);
|
LaneDataVector::const_iterator findTag(const extractor::TurnLaneType::Mask tag,
|
||||||
LaneDataVector::iterator findTag(const TurnLaneType::Mask tag, LaneDataVector &data);
|
const LaneDataVector &data);
|
||||||
|
LaneDataVector::iterator findTag(const extractor::TurnLaneType::Mask tag, LaneDataVector &data);
|
||||||
|
|
||||||
// Returns true if any of the queried tags is contained
|
// Returns true if any of the queried tags is contained
|
||||||
bool hasTag(const TurnLaneType::Mask tag, const LaneDataVector &data);
|
bool hasTag(const extractor::TurnLaneType::Mask tag, const LaneDataVector &data);
|
||||||
} // namespace lane_data_generation
|
} // namespace lane_data_generation
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /* OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_DATA_HPP_ */
|
#endif /* OSRM_GUIDANCE_TURN_LANE_DATA_HPP_ */
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_HANDLER_HPP_
|
#ifndef OSRM_GUIDANCE_TURN_LANE_HANDLER_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_HANDLER_HPP_
|
#define OSRM_GUIDANCE_TURN_LANE_HANDLER_HPP_
|
||||||
|
|
||||||
#include "extractor/query_node.hpp"
|
#include "extractor/query_node.hpp"
|
||||||
|
#include "extractor/turn_lane_types.hpp"
|
||||||
#include "guidance/intersection.hpp"
|
#include "guidance/intersection.hpp"
|
||||||
#include "guidance/turn_analysis.hpp"
|
#include "guidance/turn_analysis.hpp"
|
||||||
#include "guidance/turn_lane_data.hpp"
|
#include "guidance/turn_lane_data.hpp"
|
||||||
#include "guidance/turn_lane_types.hpp"
|
|
||||||
|
|
||||||
#include "util/attributes.hpp"
|
#include "util/attributes.hpp"
|
||||||
#include "util/guidance/turn_lanes.hpp"
|
#include "util/guidance/turn_lanes.hpp"
|
||||||
@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -73,13 +71,13 @@ class TurnLaneHandler
|
|||||||
typedef std::vector<TurnLaneData> LaneDataVector;
|
typedef std::vector<TurnLaneData> LaneDataVector;
|
||||||
|
|
||||||
TurnLaneHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
TurnLaneHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
LaneDescriptionMap &lane_description_map,
|
extractor::LaneDescriptionMap &lane_description_map,
|
||||||
const TurnAnalysis &turn_analysis,
|
const TurnAnalysis &turn_analysis,
|
||||||
util::guidance::LaneDataIdMap &id_map);
|
util::guidance::LaneDataIdMap &id_map);
|
||||||
|
|
||||||
@ -94,16 +92,16 @@ class TurnLaneHandler
|
|||||||
// we need to be able to look at previous intersections to, in some cases, find the correct turn
|
// we need to be able to look at previous intersections to, in some cases, find the correct turn
|
||||||
// lanes for a turn
|
// lanes for a turn
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph;
|
const util::NodeBasedDynamicGraph &node_based_graph;
|
||||||
const EdgeBasedNodeDataContainer &node_data_container;
|
const extractor::EdgeBasedNodeDataContainer &node_data_container;
|
||||||
const std::vector<util::Coordinate> &node_coordinates;
|
const std::vector<util::Coordinate> &node_coordinates;
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries;
|
const extractor::CompressedEdgeContainer &compressed_geometries;
|
||||||
const RestrictionMap &node_restriction_map;
|
const extractor::RestrictionMap &node_restriction_map;
|
||||||
const std::unordered_set<NodeID> &barrier_nodes;
|
const std::unordered_set<NodeID> &barrier_nodes;
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data;
|
const extractor::TurnLanesIndexedArray &turn_lanes_data;
|
||||||
|
|
||||||
std::vector<std::uint32_t> turn_lane_offsets;
|
std::vector<std::uint32_t> turn_lane_offsets;
|
||||||
std::vector<TurnLaneType::Mask> turn_lane_masks;
|
std::vector<extractor::TurnLaneType::Mask> turn_lane_masks;
|
||||||
LaneDescriptionMap &lane_description_map;
|
extractor::LaneDescriptionMap &lane_description_map;
|
||||||
const TurnAnalysis &turn_analysis;
|
const TurnAnalysis &turn_analysis;
|
||||||
util::guidance::LaneDataIdMap &id_map;
|
util::guidance::LaneDataIdMap &id_map;
|
||||||
|
|
||||||
@ -155,7 +153,6 @@ static_assert(sizeof(scenario_names) / sizeof(*scenario_names) == TurnLaneScenar
|
|||||||
|
|
||||||
} // namespace lanes
|
} // namespace lanes
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_HANDLER_HPP_
|
#endif // OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_HANDLER_HPP_
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_MATCHER_HPP_
|
#ifndef OSRM_GUIDANCE_TURN_LANE_MATCHER_HPP_
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_MATCHER_HPP_
|
#define OSRM_GUIDANCE_TURN_LANE_MATCHER_HPP_
|
||||||
|
|
||||||
#include "guidance/intersection.hpp"
|
#include "guidance/intersection.hpp"
|
||||||
#include "guidance/turn_instruction.hpp"
|
#include "guidance/turn_instruction.hpp"
|
||||||
@ -11,28 +11,27 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
namespace lanes
|
namespace lanes
|
||||||
{
|
{
|
||||||
|
|
||||||
// Translate Turn Lane Tags into a matching modifier
|
// Translate Turn Lane Tags into a matching modifier
|
||||||
DirectionModifier::Enum getMatchingModifier(const TurnLaneType::Mask tag);
|
DirectionModifier::Enum getMatchingModifier(const extractor::TurnLaneType::Mask tag);
|
||||||
|
|
||||||
// check whether a match of a given tag and a turn instruction can be seen as valid
|
// check whether a match of a given tag and a turn instruction can be seen as valid
|
||||||
bool isValidMatch(const TurnLaneType::Mask tag, const TurnInstruction instruction);
|
bool isValidMatch(const extractor::TurnLaneType::Mask tag, const TurnInstruction instruction);
|
||||||
|
|
||||||
// localisation of the best possible match for a tag
|
// localisation of the best possible match for a tag
|
||||||
typename Intersection::const_iterator findBestMatch(const TurnLaneType::Mask tag,
|
typename Intersection::const_iterator findBestMatch(const extractor::TurnLaneType::Mask tag,
|
||||||
const Intersection &intersection);
|
const Intersection &intersection);
|
||||||
|
|
||||||
// the quality of a matching to decide between first/second possibility on segregated intersections
|
// the quality of a matching to decide between first/second possibility on segregated intersections
|
||||||
double getMatchingQuality(const TurnLaneType::Mask tag, const ConnectedRoad &road);
|
double getMatchingQuality(const extractor::TurnLaneType::Mask tag, const ConnectedRoad &road);
|
||||||
|
|
||||||
typename Intersection::const_iterator findBestMatchForReverse(const TurnLaneType::Mask leftmost_tag,
|
typename Intersection::const_iterator
|
||||||
const Intersection &intersection);
|
findBestMatchForReverse(const extractor::TurnLaneType::Mask leftmost_tag,
|
||||||
|
const Intersection &intersection);
|
||||||
|
|
||||||
// a match is trivial if all turns can be associated with their best match in a valid way and the
|
// a match is trivial if all turns can be associated with their best match in a valid way and the
|
||||||
// matches occur in order
|
// matches occur in order
|
||||||
@ -48,7 +47,6 @@ Intersection triviallyMatchLanesToTurns(Intersection intersection,
|
|||||||
|
|
||||||
} // namespace lanes
|
} // namespace lanes
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /*OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_MATCHER_HPP_*/
|
#endif /*OSRM_GUIDANCE_TURN_LANE_MATCHER_HPP_*/
|
||||||
|
@ -64,7 +64,7 @@ inline void print(const std::vector<engine::guidance::RouteStep> &steps)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void print(const extractor::guidance::Intersection &intersection)
|
inline void print(const osrm::guidance::Intersection &intersection)
|
||||||
{
|
{
|
||||||
std::cout << " Intersection:\n";
|
std::cout << " Intersection:\n";
|
||||||
for (const auto &road : intersection)
|
for (const auto &road : intersection)
|
||||||
@ -73,7 +73,7 @@ inline void print(const extractor::guidance::Intersection &intersection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void print(const NodeBasedDynamicGraph &node_based_graph,
|
inline void print(const NodeBasedDynamicGraph &node_based_graph,
|
||||||
const extractor::guidance::Intersection &intersection)
|
const osrm::guidance::Intersection &intersection)
|
||||||
{
|
{
|
||||||
std::cout << " Intersection:\n";
|
std::cout << " Intersection:\n";
|
||||||
for (const auto &road : intersection)
|
for (const auto &road : intersection)
|
||||||
@ -86,22 +86,20 @@ inline void print(const NodeBasedDynamicGraph &node_based_graph,
|
|||||||
std::cout << std::flush;
|
std::cout << std::flush;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void print(const extractor::guidance::lanes::LaneDataVector &turn_lane_data)
|
inline void print(const osrm::guidance::lanes::LaneDataVector &turn_lane_data)
|
||||||
{
|
{
|
||||||
std::cout << " Tags:\n";
|
std::cout << " Tags:\n";
|
||||||
for (auto entry : turn_lane_data)
|
for (auto entry : turn_lane_data)
|
||||||
std::cout << "\t" << entry.tag << "("
|
std::cout << "\t" << entry.tag << "(" << extractor::TurnLaneType::toString(entry.tag)
|
||||||
<< extractor::guidance::TurnLaneType::toString(entry.tag)
|
|
||||||
<< ") from: " << static_cast<int>(entry.from)
|
<< ") from: " << static_cast<int>(entry.from)
|
||||||
<< " to: " << static_cast<int>(entry.to) << "\n";
|
<< " to: " << static_cast<int>(entry.to) << "\n";
|
||||||
std::cout << std::flush;
|
std::cout << std::flush;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void printTurnAssignmentData(const NodeID at,
|
||||||
printTurnAssignmentData(const NodeID at,
|
const osrm::guidance::lanes::LaneDataVector &turn_lane_data,
|
||||||
const extractor::guidance::lanes::LaneDataVector &turn_lane_data,
|
const osrm::guidance::Intersection &intersection,
|
||||||
const extractor::guidance::Intersection &intersection,
|
const std::vector<extractor::QueryNode> &node_info_list)
|
||||||
const std::vector<extractor::QueryNode> &node_info_list)
|
|
||||||
{
|
{
|
||||||
std::cout << "[Turn Assignment Progress]\nLocation:";
|
std::cout << "[Turn Assignment Progress]\nLocation:";
|
||||||
auto coordinate = node_info_list[at];
|
auto coordinate = node_info_list[at];
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include "extractor/class_data.hpp"
|
#include "extractor/class_data.hpp"
|
||||||
#include "extractor/node_based_edge.hpp"
|
#include "extractor/node_based_edge.hpp"
|
||||||
#include "extractor/node_data_container.hpp"
|
#include "extractor/node_data_container.hpp"
|
||||||
#include "guidance/road_classification.hpp"
|
|
||||||
#include "util/dynamic_graph.hpp"
|
#include "util/dynamic_graph.hpp"
|
||||||
#include "util/graph_utils.hpp"
|
#include "util/graph_utils.hpp"
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace TurnType = osrm::extractor::guidance::TurnType;
|
namespace TurnType = osrm::guidance::TurnType;
|
||||||
namespace DirectionModifier = osrm::extractor::guidance::DirectionModifier;
|
namespace DirectionModifier = osrm::guidance::DirectionModifier;
|
||||||
using TurnInstruction = osrm::extractor::guidance::TurnInstruction;
|
using TurnInstruction = osrm::guidance::TurnInstruction;
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
@ -56,7 +56,7 @@ util::json::Array lanesFromIntersection(const guidance::IntermediateIntersection
|
|||||||
{
|
{
|
||||||
--lane_id;
|
--lane_id;
|
||||||
util::json::Object lane;
|
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 &&
|
if (lane_id >= intersection.lanes.first_lane_from_the_right &&
|
||||||
lane_id <
|
lane_id <
|
||||||
intersection.lanes.first_lane_from_the_right + intersection.lanes.lanes_in_turn)
|
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;
|
std::string maneuver_type;
|
||||||
|
|
||||||
if (maneuver.waypoint_type == guidance::WaypointType::None)
|
if (maneuver.waypoint_type == guidance::WaypointType::None)
|
||||||
maneuver_type = extractor::guidance::instructionTypeToString(maneuver.instruction.type);
|
maneuver_type = osrm::guidance::instructionTypeToString(maneuver.instruction.type);
|
||||||
else
|
else
|
||||||
maneuver_type = detail::waypointTypeToString(maneuver.waypoint_type);
|
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);
|
step_maneuver.values["type"] = std::move(maneuver_type);
|
||||||
|
|
||||||
if (detail::isValidModifier(maneuver))
|
if (detail::isValidModifier(maneuver))
|
||||||
step_maneuver.values["modifier"] = extractor::guidance::instructionModifierToString(
|
step_maneuver.values["modifier"] =
|
||||||
maneuver.instruction.direction_modifier);
|
osrm::guidance::instructionModifierToString(maneuver.instruction.direction_modifier);
|
||||||
|
|
||||||
step_maneuver.values["location"] = detail::coordinateToLonLat(maneuver.location);
|
step_maneuver.values["location"] = detail::coordinateToLonLat(maneuver.location);
|
||||||
step_maneuver.values["bearing_before"] = detail::roundAndClampBearing(maneuver.bearing_before);
|
step_maneuver.values["bearing_before"] = detail::roundAndClampBearing(maneuver.bearing_before);
|
||||||
|
@ -12,6 +12,7 @@ namespace engine
|
|||||||
{
|
{
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
using namespace osrm::guidance;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -10,16 +10,14 @@
|
|||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
using osrm::extractor::guidance::TurnInstruction;
|
|
||||||
using osrm::util::angularDeviation;
|
|
||||||
using namespace osrm::extractor::guidance;
|
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace engine
|
namespace engine
|
||||||
{
|
{
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
using osrm::util::angularDeviation;
|
||||||
|
using namespace osrm::guidance;
|
||||||
|
|
||||||
namespace
|
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
|
// both angles are in the same direction, the total turn gets increased
|
||||||
//
|
//
|
||||||
// a ---- b
|
// a ---- b
|
||||||
// \
|
// \
|
||||||
// c
|
// c
|
||||||
// |
|
// |
|
||||||
// d
|
// d
|
||||||
@ -286,8 +284,7 @@ void StaggeredTurnStrategy::operator()(RouteStep &step_at_turn_location,
|
|||||||
: TurnType::NewName;
|
: TurnType::NewName;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetFixedInstructionStrategy::SetFixedInstructionStrategy(
|
SetFixedInstructionStrategy::SetFixedInstructionStrategy(const TurnInstruction instruction)
|
||||||
const extractor::guidance::TurnInstruction instruction)
|
|
||||||
: instruction(instruction)
|
: instruction(instruction)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -9,16 +9,13 @@
|
|||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
using osrm::extractor::guidance::TurnInstruction;
|
|
||||||
using osrm::extractor::guidance::isLeftTurn;
|
|
||||||
using osrm::extractor::guidance::isRightTurn;
|
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace engine
|
namespace engine
|
||||||
{
|
{
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
using namespace osrm::guidance;
|
||||||
|
|
||||||
std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
|
std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
|
||||||
const double min_distance_needed_for_lane_change)
|
const double min_distance_needed_for_lane_change)
|
||||||
|
@ -23,20 +23,15 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
#include <utility>
|
#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 osrm
|
||||||
{
|
{
|
||||||
namespace engine
|
namespace engine
|
||||||
{
|
{
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
using namespace osrm::guidance;
|
||||||
|
|
||||||
|
using RouteStepIterator = std::vector<osrm::engine::guidance::RouteStep>::iterator;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -465,7 +460,7 @@ std::vector<RouteStep> assignRelativeLocations(std::vector<RouteStep> steps,
|
|||||||
distance_to_start <= MAXIMAL_RELATIVE_DISTANCE
|
distance_to_start <= MAXIMAL_RELATIVE_DISTANCE
|
||||||
? bearingToDirectionModifier(util::coordinate_calculation::computeAngle(
|
? bearingToDirectionModifier(util::coordinate_calculation::computeAngle(
|
||||||
source_node.input_location, leg_geometry.locations[0], leg_geometry.locations[1]))
|
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;
|
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() - 2],
|
||||||
leg_geometry.locations[leg_geometry.locations.size() - 1],
|
leg_geometry.locations[leg_geometry.locations.size() - 1],
|
||||||
target_node.input_location))
|
target_node.input_location))
|
||||||
: extractor::guidance::DirectionModifier::UTurn;
|
: DirectionModifier::UTurn;
|
||||||
|
|
||||||
steps.back().maneuver.instruction.direction_modifier = final_modifier;
|
steps.back().maneuver.instruction.direction_modifier = final_modifier;
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@ namespace engine
|
|||||||
{
|
{
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
using namespace osrm::guidance;
|
||||||
|
|
||||||
std::vector<RouteStep> suppressShortNameSegments(std::vector<RouteStep> steps)
|
std::vector<RouteStep> suppressShortNameSegments(std::vector<RouteStep> steps)
|
||||||
{
|
{
|
||||||
// guard against empty routes, even though they shouldn't happen
|
// guard against empty routes, even though they shouldn't happen
|
||||||
|
@ -765,11 +765,10 @@ void encodeVectorTile(const DataFacadeBase &facade,
|
|||||||
auto weight_idx =
|
auto weight_idx =
|
||||||
point_float_index.add(t.weight / 10.0); // Note conversion to float here
|
point_float_index.add(t.weight / 10.0); // Note conversion to float here
|
||||||
|
|
||||||
auto turntype_idx =
|
auto turntype_idx = point_string_index.add(
|
||||||
point_string_index.add(extractor::guidance::internalInstructionTypeToString(
|
osrm::guidance::internalInstructionTypeToString(t.turn_instruction.type));
|
||||||
t.turn_instruction.type));
|
|
||||||
auto turnmodifier_idx =
|
auto turnmodifier_idx =
|
||||||
point_string_index.add(extractor::guidance::instructionModifierToString(
|
point_string_index.add(osrm::guidance::instructionModifierToString(
|
||||||
t.turn_instruction.direction_modifier));
|
t.turn_instruction.direction_modifier));
|
||||||
return EncodedTurnData{t.coordinate,
|
return EncodedTurnData{t.coordinate,
|
||||||
angle_idx,
|
angle_idx,
|
||||||
|
@ -2,14 +2,16 @@
|
|||||||
#include "extractor/conditional_turn_penalty.hpp"
|
#include "extractor/conditional_turn_penalty.hpp"
|
||||||
#include "extractor/edge_based_edge.hpp"
|
#include "extractor/edge_based_edge.hpp"
|
||||||
#include "extractor/files.hpp"
|
#include "extractor/files.hpp"
|
||||||
|
#include "extractor/intersection/intersection_analysis.hpp"
|
||||||
#include "extractor/scripting_environment.hpp"
|
#include "extractor/scripting_environment.hpp"
|
||||||
|
#include "extractor/serialization.hpp"
|
||||||
#include "extractor/suffix_table.hpp"
|
#include "extractor/suffix_table.hpp"
|
||||||
|
|
||||||
|
#include "guidance/files.hpp"
|
||||||
#include "guidance/turn_analysis.hpp"
|
#include "guidance/turn_analysis.hpp"
|
||||||
|
#include "guidance/turn_data_container.hpp"
|
||||||
#include "guidance/turn_lane_handler.hpp"
|
#include "guidance/turn_lane_handler.hpp"
|
||||||
|
|
||||||
#include "extractor/intersection/intersection_analysis.hpp"
|
|
||||||
|
|
||||||
#include "extractor/serialization.hpp"
|
|
||||||
#include "storage/io.hpp"
|
#include "storage/io.hpp"
|
||||||
|
|
||||||
#include "util/assert.hpp"
|
#include "util/assert.hpp"
|
||||||
@ -73,7 +75,7 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(
|
|||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const std::unordered_set<EdgeID> &segregated_edges,
|
const std::unordered_set<EdgeID> &segregated_edges,
|
||||||
guidance::LaneDescriptionMap &lane_description_map)
|
extractor::LaneDescriptionMap &lane_description_map)
|
||||||
: m_edge_based_node_container(node_data_container), m_number_of_edge_based_nodes(0),
|
: m_edge_based_node_container(node_data_container), m_number_of_edge_based_nodes(0),
|
||||||
m_coordinates(coordinates), m_node_based_graph(std::move(node_based_graph)),
|
m_coordinates(coordinates), m_node_based_graph(std::move(node_based_graph)),
|
||||||
m_barrier_nodes(barrier_nodes), m_traffic_lights(traffic_lights),
|
m_barrier_nodes(barrier_nodes), m_traffic_lights(traffic_lights),
|
||||||
@ -424,19 +426,19 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
|||||||
storage::io::FileWriter turn_penalties_index_file(turn_penalties_index_filename,
|
storage::io::FileWriter turn_penalties_index_file(turn_penalties_index_filename,
|
||||||
storage::io::FileWriter::HasNoFingerprint);
|
storage::io::FileWriter::HasNoFingerprint);
|
||||||
|
|
||||||
TurnDataExternalContainer turn_data_container;
|
guidance::TurnDataExternalContainer turn_data_container;
|
||||||
|
|
||||||
SuffixTable street_name_suffix_table(scripting_environment);
|
SuffixTable street_name_suffix_table(scripting_environment);
|
||||||
const auto &turn_lanes_data = transformTurnLaneMapIntoArrays(lane_description_map);
|
const auto &turn_lanes_data = transformTurnLaneMapIntoArrays(lane_description_map);
|
||||||
guidance::MergableRoadDetector mergable_road_detector(m_node_based_graph,
|
intersection::MergableRoadDetector mergable_road_detector(m_node_based_graph,
|
||||||
m_edge_based_node_container,
|
m_edge_based_node_container,
|
||||||
m_coordinates,
|
m_coordinates,
|
||||||
m_compressed_edge_container,
|
m_compressed_edge_container,
|
||||||
node_restriction_map,
|
node_restriction_map,
|
||||||
m_barrier_nodes,
|
m_barrier_nodes,
|
||||||
turn_lanes_data,
|
turn_lanes_data,
|
||||||
name_table,
|
name_table,
|
||||||
street_name_suffix_table);
|
street_name_suffix_table);
|
||||||
|
|
||||||
// Loop over all turns and generate new set of edges.
|
// Loop over all turns and generate new set of edges.
|
||||||
// Three nested loop look super-linear, but we are dealing with a (kind of)
|
// Three nested loop look super-linear, but we are dealing with a (kind of)
|
||||||
@ -526,8 +528,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
|||||||
{
|
{
|
||||||
std::size_t nodes_processed = 0;
|
std::size_t nodes_processed = 0;
|
||||||
|
|
||||||
std::vector<TurnData> continuous_turn_data; // populate answers from guidance
|
std::vector<guidance::TurnData> continuous_turn_data; // populate answers from guidance
|
||||||
std::vector<TurnData> delayed_turn_data; // populate answers from guidance
|
std::vector<guidance::TurnData> delayed_turn_data; // populate answers from guidance
|
||||||
};
|
};
|
||||||
using TurnsPipelineBufferPtr = std::shared_ptr<TurnsPipelineBuffer>;
|
using TurnsPipelineBufferPtr = std::shared_ptr<TurnsPipelineBuffer>;
|
||||||
|
|
||||||
@ -607,7 +609,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
|||||||
|
|
||||||
// compute weight and duration penalties
|
// compute weight and duration penalties
|
||||||
const auto is_traffic_light = m_traffic_lights.count(intersection_node);
|
const auto is_traffic_light = m_traffic_lights.count(intersection_node);
|
||||||
const auto is_uturn = guidance::getTurnDirection(turn_angle) == guidance::DirectionModifier::UTurn;
|
const auto is_uturn =
|
||||||
|
guidance::getTurnDirection(turn_angle) == guidance::DirectionModifier::UTurn;
|
||||||
|
|
||||||
ExtractionTurn extracted_turn(
|
ExtractionTurn extracted_turn(
|
||||||
// general info
|
// general info
|
||||||
@ -810,7 +813,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
|||||||
};
|
};
|
||||||
|
|
||||||
// all connected roads on the right of a u turn
|
// all connected roads on the right of a u turn
|
||||||
const auto is_uturn = guidance::getTurnDirection(turn->angle) == guidance::DirectionModifier::UTurn;
|
const auto is_uturn = guidance::getTurnDirection(turn->angle) ==
|
||||||
|
guidance::DirectionModifier::UTurn;
|
||||||
if (is_uturn)
|
if (is_uturn)
|
||||||
{
|
{
|
||||||
if (turn != intersection_view.begin())
|
if (turn != intersection_view.begin())
|
||||||
@ -876,10 +880,6 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
|||||||
// a via way restriction. If that should be the case, we switch the id
|
// a via way restriction. If that should be the case, we switch the id
|
||||||
// of the edge-based-node for the target to the ID of the duplicated
|
// of the edge-based-node for the target to the ID of the duplicated
|
||||||
// node associated with the turn. (e.g. ab via bc switches bc to bc_dup)
|
// node associated with the turn. (e.g. ab via bc switches bc to bc_dup)
|
||||||
const auto turn_angle = util::bearing::angleBetween(
|
|
||||||
incoming_bearing,
|
|
||||||
findEdgeBearing(edge_geometries, outgoing_edge.edge));
|
|
||||||
|
|
||||||
auto const target_id = way_restriction_map.RemapIfRestricted(
|
auto const target_id = way_restriction_map.RemapIfRestricted(
|
||||||
nbe_to_ebn_mapping[outgoing_edge.edge],
|
nbe_to_ebn_mapping[outgoing_edge.edge],
|
||||||
incoming_edge.node,
|
incoming_edge.node,
|
||||||
@ -1094,10 +1094,6 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
|||||||
const auto turning_off_via_way =
|
const auto turning_off_via_way =
|
||||||
way_restriction_map.IsViaWay(incoming_edge.node, intersection_node);
|
way_restriction_map.IsViaWay(incoming_edge.node, intersection_node);
|
||||||
|
|
||||||
// Save reversed incoming bearing to compute turn angles
|
|
||||||
const auto reversed_incoming_bearing = util::bearing::reverse(
|
|
||||||
findEdgeBearing(edge_geometries, incoming_edge.edge));
|
|
||||||
|
|
||||||
for (const auto &outgoing_edge : outgoing_edges)
|
for (const auto &outgoing_edge : outgoing_edges)
|
||||||
{
|
{
|
||||||
if (!intersection::isTurnAllowed(m_node_based_graph,
|
if (!intersection::isTurnAllowed(m_node_based_graph,
|
||||||
@ -1120,12 +1116,12 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
|||||||
OSRM_ASSERT(turn != intersection.end(),
|
OSRM_ASSERT(turn != intersection.end(),
|
||||||
m_coordinates[intersection_node]);
|
m_coordinates[intersection_node]);
|
||||||
|
|
||||||
buffer->continuous_turn_data.push_back(
|
buffer->continuous_turn_data.push_back(guidance::TurnData{
|
||||||
TurnData{turn->instruction,
|
turn->instruction,
|
||||||
turn->lane_data_id,
|
turn->lane_data_id,
|
||||||
entry_class_id,
|
entry_class_id,
|
||||||
util::guidance::TurnBearing(intersection[0].bearing),
|
util::guidance::TurnBearing(intersection[0].bearing),
|
||||||
util::guidance::TurnBearing(turn->bearing)});
|
util::guidance::TurnBearing(turn->bearing)});
|
||||||
|
|
||||||
// when turning off a a via-way turn restriction, we need to not only
|
// when turning off a a via-way turn restriction, we need to not only
|
||||||
// handle the normal edges for the way, but also add turns for every
|
// handle the normal edges for the way, but also add turns for every
|
||||||
@ -1155,7 +1151,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
|||||||
if (restriction.condition.empty())
|
if (restriction.condition.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
buffer->delayed_turn_data.push_back(TurnData{
|
buffer->delayed_turn_data.push_back(guidance::TurnData{
|
||||||
turn->instruction,
|
turn->instruction,
|
||||||
turn->lane_data_id,
|
turn->lane_data_id,
|
||||||
entry_class_id,
|
entry_class_id,
|
||||||
@ -1164,7 +1160,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer->delayed_turn_data.push_back(TurnData{
|
buffer->delayed_turn_data.push_back(guidance::TurnData{
|
||||||
turn->instruction,
|
turn->instruction,
|
||||||
turn->lane_data_id,
|
turn->lane_data_id,
|
||||||
entry_class_id,
|
entry_class_id,
|
||||||
@ -1212,7 +1208,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
|||||||
|
|
||||||
// Last part of the pipeline puts all the calculated data into the serial buffers
|
// Last part of the pipeline puts all the calculated data into the serial buffers
|
||||||
util::Percent guidance_progress(log, node_count);
|
util::Percent guidance_progress(log, node_count);
|
||||||
std::vector<TurnData> delayed_turn_data;
|
std::vector<guidance::TurnData> delayed_turn_data;
|
||||||
|
|
||||||
tbb::filter_t<TurnsPipelineBufferPtr, void> guidance_output_stage(
|
tbb::filter_t<TurnsPipelineBufferPtr, void> guidance_output_stage(
|
||||||
tbb::filter::serial_in_order, [&](auto buffer) {
|
tbb::filter::serial_in_order, [&](auto buffer) {
|
||||||
@ -1320,7 +1316,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
|||||||
}
|
}
|
||||||
util::Log() << "done.";
|
util::Log() << "done.";
|
||||||
|
|
||||||
files::writeTurnData(turn_data_filename, turn_data_container);
|
guidance::files::writeTurnData(turn_data_filename, turn_data_container);
|
||||||
|
|
||||||
util::Log() << "Generated " << m_edge_based_node_segments.size() << " edge based node segments";
|
util::Log() << "Generated " << m_edge_based_node_segments.size() << " edge based node segments";
|
||||||
util::Log() << "Node-based graph contains " << node_based_edge_counter << " edges";
|
util::Log() << "Node-based graph contains " << node_based_edge_counter << " edges";
|
||||||
|
@ -196,7 +196,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
|||||||
: tbb::task_scheduler_init::automatic);
|
: tbb::task_scheduler_init::automatic);
|
||||||
BOOST_ASSERT(init.is_active());
|
BOOST_ASSERT(init.is_active());
|
||||||
|
|
||||||
guidance::LaneDescriptionMap turn_lane_map;
|
LaneDescriptionMap turn_lane_map;
|
||||||
std::vector<TurnRestriction> turn_restrictions;
|
std::vector<TurnRestriction> turn_restrictions;
|
||||||
std::vector<ConditionalTurnRestriction> conditional_turn_restrictions;
|
std::vector<ConditionalTurnRestriction> conditional_turn_restrictions;
|
||||||
std::tie(turn_lane_map, turn_restrictions, conditional_turn_restrictions) =
|
std::tie(turn_lane_map, turn_restrictions, conditional_turn_restrictions) =
|
||||||
@ -345,7 +345,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<guidance::LaneDescriptionMap,
|
std::tuple<LaneDescriptionMap,
|
||||||
std::vector<TurnRestriction>,
|
std::vector<TurnRestriction>,
|
||||||
std::vector<ConditionalTurnRestriction>>
|
std::vector<ConditionalTurnRestriction>>
|
||||||
Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
||||||
@ -394,7 +394,7 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
|||||||
// Extraction containers and restriction parser
|
// Extraction containers and restriction parser
|
||||||
ExtractionContainers extraction_containers;
|
ExtractionContainers extraction_containers;
|
||||||
ExtractorCallbacks::ClassesMap classes_map;
|
ExtractorCallbacks::ClassesMap classes_map;
|
||||||
guidance::LaneDescriptionMap turn_lane_map;
|
LaneDescriptionMap turn_lane_map;
|
||||||
auto extractor_callbacks =
|
auto extractor_callbacks =
|
||||||
std::make_unique<ExtractorCallbacks>(extraction_containers,
|
std::make_unique<ExtractorCallbacks>(extraction_containers,
|
||||||
classes_map,
|
classes_map,
|
||||||
@ -673,7 +673,7 @@ EdgeID Extractor::BuildEdgeExpandedGraph(
|
|||||||
const std::vector<ConditionalTurnRestriction> &conditional_turn_restrictions,
|
const std::vector<ConditionalTurnRestriction> &conditional_turn_restrictions,
|
||||||
const std::unordered_set<EdgeID> &segregated_edges,
|
const std::unordered_set<EdgeID> &segregated_edges,
|
||||||
// might have to be updated to add new lane combinations
|
// might have to be updated to add new lane combinations
|
||||||
guidance::LaneDescriptionMap &turn_lane_map,
|
LaneDescriptionMap &turn_lane_map,
|
||||||
// for calculating turn penalties
|
// for calculating turn penalties
|
||||||
ScriptingEnvironment &scripting_environment,
|
ScriptingEnvironment &scripting_environment,
|
||||||
// output data
|
// output data
|
||||||
@ -731,9 +731,9 @@ EdgeID Extractor::BuildEdgeExpandedGraph(
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::vector<std::uint32_t> turn_lane_offsets;
|
std::vector<std::uint32_t> turn_lane_offsets;
|
||||||
std::vector<guidance::TurnLaneType::Mask> turn_lane_masks;
|
std::vector<TurnLaneType::Mask> turn_lane_masks;
|
||||||
std::tie(turn_lane_offsets, turn_lane_masks) =
|
std::tie(turn_lane_offsets, turn_lane_masks) =
|
||||||
guidance::transformTurnLaneMapIntoArrays(turn_lane_map);
|
transformTurnLaneMapIntoArrays(turn_lane_map);
|
||||||
files::writeTurnLaneDescriptions(
|
files::writeTurnLaneDescriptions(
|
||||||
config.GetPath(".osrm.tls"), turn_lane_offsets, turn_lane_masks);
|
config.GetPath(".osrm.tls"), turn_lane_offsets, turn_lane_masks);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "extractor/profile_properties.hpp"
|
#include "extractor/profile_properties.hpp"
|
||||||
#include "extractor/query_node.hpp"
|
#include "extractor/query_node.hpp"
|
||||||
#include "extractor/restriction.hpp"
|
#include "extractor/restriction.hpp"
|
||||||
#include "guidance/road_classification.hpp"
|
#include "extractor/road_classification.hpp"
|
||||||
|
|
||||||
#include "util/for_each_pair.hpp"
|
#include "util/for_each_pair.hpp"
|
||||||
#include "util/guidance/turn_lanes.hpp"
|
#include "util/guidance/turn_lanes.hpp"
|
||||||
@ -29,13 +29,9 @@ namespace osrm
|
|||||||
{
|
{
|
||||||
namespace extractor
|
namespace extractor
|
||||||
{
|
{
|
||||||
|
|
||||||
using TurnLaneDescription = guidance::TurnLaneDescription;
|
|
||||||
namespace TurnLaneType = guidance::TurnLaneType;
|
|
||||||
|
|
||||||
ExtractorCallbacks::ExtractorCallbacks(ExtractionContainers &extraction_containers_,
|
ExtractorCallbacks::ExtractorCallbacks(ExtractionContainers &extraction_containers_,
|
||||||
std::unordered_map<std::string, ClassData> &classes_map,
|
std::unordered_map<std::string, ClassData> &classes_map,
|
||||||
guidance::LaneDescriptionMap &lane_description_map,
|
LaneDescriptionMap &lane_description_map,
|
||||||
const ProfileProperties &properties)
|
const ProfileProperties &properties)
|
||||||
: external_memory(extraction_containers_), classes_map(classes_map),
|
: external_memory(extraction_containers_), classes_map(classes_map),
|
||||||
lane_description_map(lane_description_map),
|
lane_description_map(lane_description_map),
|
||||||
@ -260,9 +256,9 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
|
|||||||
for (auto iter = tokens.begin(); iter != tokens.end(); ++iter)
|
for (auto iter = tokens.begin(); iter != tokens.end(); ++iter)
|
||||||
{
|
{
|
||||||
tokenizer inner_tokens(*iter, inner_sep);
|
tokenizer inner_tokens(*iter, inner_sep);
|
||||||
guidance::TurnLaneType::Mask lane_mask = inner_tokens.begin() == inner_tokens.end()
|
TurnLaneType::Mask lane_mask = inner_tokens.begin() == inner_tokens.end()
|
||||||
? TurnLaneType::none
|
? TurnLaneType::none
|
||||||
: TurnLaneType::empty;
|
: TurnLaneType::empty;
|
||||||
for (auto token_itr = inner_tokens.begin(); token_itr != inner_tokens.end();
|
for (auto token_itr = inner_tokens.begin(); token_itr != inner_tokens.end();
|
||||||
++token_itr)
|
++token_itr)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "guidance/coordinate_extractor.hpp"
|
#include "extractor/intersection/coordinate_extractor.hpp"
|
||||||
#include "guidance/constants.hpp"
|
#include "extractor/intersection/constants.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
@ -17,7 +17,7 @@ namespace osrm
|
|||||||
{
|
{
|
||||||
namespace extractor
|
namespace extractor
|
||||||
{
|
{
|
||||||
namespace guidance
|
namespace intersection
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace
|
namespace
|
@ -1,13 +1,10 @@
|
|||||||
#ifndef OSRM_EXTRACTOR_GUIDANCE_HAVE_IDENTICAL_NAMES_HPP_
|
|
||||||
#define OSRM_EXTRACTOR_GUIDANCE_HAVE_IDENTICAL_NAMES_HPP_
|
|
||||||
|
|
||||||
#include "util/guidance/name_announcements.hpp"
|
#include "util/guidance/name_announcements.hpp"
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
namespace extractor
|
||||||
{
|
{
|
||||||
namespace guidance
|
namespace intersection
|
||||||
{
|
{
|
||||||
|
|
||||||
// check if two name ids can be seen as identical (in presence of refs/others)
|
// check if two name ids can be seen as identical (in presence of refs/others)
|
||||||
@ -16,7 +13,7 @@ namespace guidance
|
|||||||
bool HaveIdenticalNames(const NameID lhs,
|
bool HaveIdenticalNames(const NameID lhs,
|
||||||
const NameID rhs,
|
const NameID rhs,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table)
|
const extractor::SuffixTable &street_name_suffix_table)
|
||||||
{
|
{
|
||||||
const auto non_empty = (lhs != EMPTY_NAMEID) && (rhs != EMPTY_NAMEID);
|
const auto non_empty = (lhs != EMPTY_NAMEID) && (rhs != EMPTY_NAMEID);
|
||||||
|
|
||||||
@ -29,5 +26,3 @@ bool HaveIdenticalNames(const NameID lhs,
|
|||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
} // namespace extractor
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /*OSRM_EXTRACTOR_GUIDANCE_HAVE_IDENTICAL_NAMES_HPP_*/
|
|
44
src/extractor/intersection/intersection.cpp
Normal file
44
src/extractor/intersection/intersection.cpp
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#include "guidance/intersection.hpp"
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <boost/range/adaptors.hpp>
|
||||||
|
|
||||||
|
using osrm::util::angularDeviation;
|
||||||
|
|
||||||
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace extractor
|
||||||
|
{
|
||||||
|
namespace intersection
|
||||||
|
{
|
||||||
|
|
||||||
|
bool IntersectionViewData::CompareByAngle(const IntersectionViewData &other) const
|
||||||
|
{
|
||||||
|
return angle < other.angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string toString(const IntersectionShapeData &shape)
|
||||||
|
{
|
||||||
|
std::string result =
|
||||||
|
"[shape] " + std::to_string(shape.eid) + " bearing: " + std::to_string(shape.bearing);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string toString(const IntersectionViewData &view)
|
||||||
|
{
|
||||||
|
std::string result = "[view] ";
|
||||||
|
result += std::to_string(view.eid);
|
||||||
|
result += " allows entry: ";
|
||||||
|
result += std::to_string(view.entry_allowed);
|
||||||
|
result += " angle: ";
|
||||||
|
result += std::to_string(view.angle);
|
||||||
|
result += " bearing: ";
|
||||||
|
result += std::to_string(view.bearing);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace intersection
|
||||||
|
} // namespace extractor
|
||||||
|
} // namespace osrm
|
@ -1,11 +1,10 @@
|
|||||||
#include "extractor/intersection/intersection_analysis.hpp"
|
#include "extractor/intersection/intersection_analysis.hpp"
|
||||||
|
#include "extractor/intersection/coordinate_extractor.hpp"
|
||||||
|
|
||||||
#include "util/assert.hpp"
|
#include "util/assert.hpp"
|
||||||
#include "util/bearing.hpp"
|
#include "util/bearing.hpp"
|
||||||
#include "util/coordinate_calculation.hpp"
|
#include "util/coordinate_calculation.hpp"
|
||||||
|
|
||||||
#include "guidance/coordinate_extractor.hpp"
|
|
||||||
|
|
||||||
#include <boost/optional/optional_io.hpp>
|
#include <boost/optional/optional_io.hpp>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
@ -116,8 +115,6 @@ std::pair<bool, double> findMergedBearing(const util::NodeBasedDynamicGraph &gra
|
|||||||
// Function returns a pair with a flag and a value of bearing for merged roads
|
// Function returns a pair with a flag and a value of bearing for merged roads
|
||||||
// If the flag is false the bearing must not be used as a merged value at neighbor intersections
|
// If the flag is false the bearing must not be used as a merged value at neighbor intersections
|
||||||
|
|
||||||
using guidance::STRAIGHT_ANGLE;
|
|
||||||
using guidance::MAXIMAL_ALLOWED_NO_TURN_DEVIATION;
|
|
||||||
using util::bearing::angleBetween;
|
using util::bearing::angleBetween;
|
||||||
using util::angularDeviation;
|
using util::angularDeviation;
|
||||||
|
|
||||||
@ -166,7 +163,7 @@ std::pair<bool, double> findMergedBearing(const util::NodeBasedDynamicGraph &gra
|
|||||||
return {true, merged_bearing};
|
return {true, merged_bearing};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isRoadsPairMergeable(const guidance::MergableRoadDetector &detector,
|
bool isRoadsPairMergeable(const MergableRoadDetector &detector,
|
||||||
const IntersectionEdgeGeometries &edge_geometries,
|
const IntersectionEdgeGeometries &edge_geometries,
|
||||||
const NodeID intersection_node,
|
const NodeID intersection_node,
|
||||||
const std::size_t index)
|
const std::size_t index)
|
||||||
@ -212,8 +209,7 @@ getIntersectionOutgoingGeometries(const util::NodeBasedDynamicGraph &graph,
|
|||||||
IntersectionEdgeGeometries edge_geometries;
|
IntersectionEdgeGeometries edge_geometries;
|
||||||
|
|
||||||
// TODO: keep CoordinateExtractor to reproduce bearings, simplify later
|
// TODO: keep CoordinateExtractor to reproduce bearings, simplify later
|
||||||
const guidance::CoordinateExtractor coordinate_extractor(
|
const CoordinateExtractor coordinate_extractor(graph, compressed_geometries, node_coordinates);
|
||||||
graph, compressed_geometries, node_coordinates);
|
|
||||||
|
|
||||||
const auto max_lanes_intersection = getIntersectionLanes(graph, intersection_node);
|
const auto max_lanes_intersection = getIntersectionLanes(graph, intersection_node);
|
||||||
|
|
||||||
@ -263,7 +259,7 @@ std::pair<IntersectionEdgeGeometries, std::unordered_set<EdgeID>>
|
|||||||
getIntersectionGeometries(const util::NodeBasedDynamicGraph &graph,
|
getIntersectionGeometries(const util::NodeBasedDynamicGraph &graph,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const guidance::MergableRoadDetector &detector,
|
const MergableRoadDetector &detector,
|
||||||
const NodeID intersection_node)
|
const NodeID intersection_node)
|
||||||
{
|
{
|
||||||
IntersectionEdgeGeometries edge_geometries = getIntersectionOutgoingGeometries<false>(
|
IntersectionEdgeGeometries edge_geometries = getIntersectionOutgoingGeometries<false>(
|
||||||
@ -462,7 +458,7 @@ bool isTurnAllowed(const util::NodeBasedDynamicGraph &graph,
|
|||||||
const RestrictionMap &restriction_map,
|
const RestrictionMap &restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const IntersectionEdgeGeometries &geometries,
|
const IntersectionEdgeGeometries &geometries,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const IntersectionEdge &from,
|
const IntersectionEdge &from,
|
||||||
const IntersectionEdge &to)
|
const IntersectionEdge &to)
|
||||||
{
|
{
|
||||||
@ -567,7 +563,7 @@ bool isTurnAllowed(const util::NodeBasedDynamicGraph &graph,
|
|||||||
|
|
||||||
if (std::any_of(turn_lanes.begin() + turn_lane_offsets[lane_description_id],
|
if (std::any_of(turn_lanes.begin() + turn_lane_offsets[lane_description_id],
|
||||||
turn_lanes.begin() + turn_lane_offsets[lane_description_id + 1],
|
turn_lanes.begin() + turn_lane_offsets[lane_description_id + 1],
|
||||||
[](const auto &lane) { return lane & guidance::TurnLaneType::uturn; }))
|
[](const auto &lane) { return lane & TurnLaneType::uturn; }))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,16 +616,15 @@ bool isTurnAllowed(const util::NodeBasedDynamicGraph &graph,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The function adapts intersection geometry data to TurnAnalysis
|
// The function adapts intersection geometry data to TurnAnalysis
|
||||||
guidance::IntersectionView
|
IntersectionView convertToIntersectionView(const util::NodeBasedDynamicGraph &graph,
|
||||||
convertToIntersectionView(const util::NodeBasedDynamicGraph &graph,
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const RestrictionMap &restriction_map,
|
||||||
const RestrictionMap &restriction_map,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const IntersectionEdgeGeometries &edge_geometries,
|
||||||
const IntersectionEdgeGeometries &edge_geometries,
|
const TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const IntersectionEdge &incoming_edge,
|
||||||
const IntersectionEdge &incoming_edge,
|
const IntersectionEdges &outgoing_edges,
|
||||||
const IntersectionEdges &outgoing_edges,
|
const std::unordered_set<EdgeID> &merged_edges)
|
||||||
const std::unordered_set<EdgeID> &merged_edges)
|
|
||||||
{
|
{
|
||||||
using util::bearing::angleBetween;
|
using util::bearing::angleBetween;
|
||||||
|
|
||||||
@ -637,9 +632,9 @@ convertToIntersectionView(const util::NodeBasedDynamicGraph &graph,
|
|||||||
const auto incoming_bearing = edge_it->perceived_bearing;
|
const auto incoming_bearing = edge_it->perceived_bearing;
|
||||||
const auto initial_incoming_bearing = edge_it->initial_bearing;
|
const auto initial_incoming_bearing = edge_it->initial_bearing;
|
||||||
|
|
||||||
using IntersectionViewDataWithAngle = std::pair<guidance::IntersectionViewData, double>;
|
using IntersectionViewDataWithAngle = std::pair<IntersectionViewData, double>;
|
||||||
std::vector<IntersectionViewDataWithAngle> pre_intersection_view;
|
std::vector<IntersectionViewDataWithAngle> pre_intersection_view;
|
||||||
guidance::IntersectionViewData uturn{{SPECIAL_EDGEID, 0., 0.}, false, 0.};
|
IntersectionViewData uturn{{SPECIAL_EDGEID, 0., 0.}, false, 0.};
|
||||||
std::size_t allowed_uturns_number = 0;
|
std::size_t allowed_uturns_number = 0;
|
||||||
for (const auto &outgoing_edge : outgoing_edges)
|
for (const auto &outgoing_edge : outgoing_edges)
|
||||||
{
|
{
|
||||||
@ -678,7 +673,7 @@ convertToIntersectionView(const util::NodeBasedDynamicGraph &graph,
|
|||||||
|
|
||||||
const auto is_uturn_angle = is_uturn(turn_angle);
|
const auto is_uturn_angle = is_uturn(turn_angle);
|
||||||
|
|
||||||
guidance::IntersectionViewData road{
|
IntersectionViewData road{
|
||||||
{outgoing_edge.edge, outgoing_bearing, segment_length}, is_turn_allowed, turn_angle};
|
{outgoing_edge.edge, outgoing_bearing, segment_length}, is_turn_allowed, turn_angle};
|
||||||
|
|
||||||
if (graph.GetTarget(outgoing_edge.edge) == incoming_edge.node)
|
if (graph.GetTarget(outgoing_edge.edge) == incoming_edge.node)
|
||||||
@ -733,7 +728,7 @@ convertToIntersectionView(const util::NodeBasedDynamicGraph &graph,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Copy intersection view data
|
// Copy intersection view data
|
||||||
guidance::IntersectionView intersection_view;
|
IntersectionView intersection_view;
|
||||||
intersection_view.reserve(pre_intersection_view.size());
|
intersection_view.reserve(pre_intersection_view.size());
|
||||||
std::transform(pre_intersection_view.begin(),
|
std::transform(pre_intersection_view.begin(),
|
||||||
pre_intersection_view.end(),
|
pre_intersection_view.end(),
|
||||||
@ -757,15 +752,14 @@ convertToIntersectionView(const util::NodeBasedDynamicGraph &graph,
|
|||||||
// but also (from_node, turn_node, a), (from_node, turn_node, b). These turns are
|
// but also (from_node, turn_node, a), (from_node, turn_node, b). These turns are
|
||||||
// marked as invalid and only needed for intersection classification.
|
// marked as invalid and only needed for intersection classification.
|
||||||
template <bool USE_CLOSE_COORDINATE>
|
template <bool USE_CLOSE_COORDINATE>
|
||||||
guidance::IntersectionView
|
IntersectionView getConnectedRoads(const util::NodeBasedDynamicGraph &graph,
|
||||||
getConnectedRoads(const util::NodeBasedDynamicGraph &graph,
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const RestrictionMap &node_restriction_map,
|
||||||
const RestrictionMap &node_restriction_map,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const IntersectionEdge &incoming_edge)
|
||||||
const IntersectionEdge &incoming_edge)
|
|
||||||
{
|
{
|
||||||
const auto intersection_node = graph.GetTarget(incoming_edge.edge);
|
const auto intersection_node = graph.GetTarget(incoming_edge.edge);
|
||||||
const auto &outgoing_edges = intersection::getOutgoingEdges(graph, intersection_node);
|
const auto &outgoing_edges = intersection::getOutgoingEdges(graph, intersection_node);
|
||||||
@ -800,24 +794,24 @@ getConnectedRoads(const util::NodeBasedDynamicGraph &graph,
|
|||||||
std::unordered_set<EdgeID>());
|
std::unordered_set<EdgeID>());
|
||||||
}
|
}
|
||||||
|
|
||||||
template guidance::IntersectionView
|
template IntersectionView
|
||||||
getConnectedRoads<false>(const util::NodeBasedDynamicGraph &graph,
|
getConnectedRoads<false>(const util::NodeBasedDynamicGraph &graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const IntersectionEdge &incoming_edge);
|
const IntersectionEdge &incoming_edge);
|
||||||
|
|
||||||
template guidance::IntersectionView
|
template IntersectionView
|
||||||
getConnectedRoads<true>(const util::NodeBasedDynamicGraph &graph,
|
getConnectedRoads<true>(const util::NodeBasedDynamicGraph &graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const IntersectionEdge &incoming_edge);
|
const IntersectionEdge &incoming_edge);
|
||||||
|
|
||||||
IntersectionEdge skipDegreeTwoNodes(const util::NodeBasedDynamicGraph &graph, IntersectionEdge road)
|
IntersectionEdge skipDegreeTwoNodes(const util::NodeBasedDynamicGraph &graph, IntersectionEdge road)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "guidance/mergable_road_detector.hpp"
|
#include "extractor/intersection/mergable_road_detector.hpp"
|
||||||
#include "extractor/intersection/intersection_analysis.hpp"
|
#include "extractor/intersection/intersection_analysis.hpp"
|
||||||
|
#include "extractor/intersection/node_based_graph_walker.hpp"
|
||||||
#include "extractor/query_node.hpp"
|
#include "extractor/query_node.hpp"
|
||||||
#include "extractor/suffix_table.hpp"
|
#include "extractor/suffix_table.hpp"
|
||||||
#include "guidance/constants.hpp"
|
#include "guidance/constants.hpp"
|
||||||
#include "guidance/node_based_graph_walker.hpp"
|
|
||||||
|
|
||||||
#include "util/bearing.hpp"
|
#include "util/bearing.hpp"
|
||||||
#include "util/coordinate_calculation.hpp"
|
#include "util/coordinate_calculation.hpp"
|
||||||
@ -16,7 +16,7 @@ namespace osrm
|
|||||||
{
|
{
|
||||||
namespace extractor
|
namespace extractor
|
||||||
{
|
{
|
||||||
namespace guidance
|
namespace intersection
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -58,7 +58,7 @@ MergableRoadDetector::MergableRoadDetector(
|
|||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table)
|
const SuffixTable &street_name_suffix_table)
|
||||||
: node_based_graph(node_based_graph), node_data_container(node_data_container),
|
: node_based_graph(node_based_graph), node_data_container(node_data_container),
|
@ -1,4 +1,4 @@
|
|||||||
#include "guidance/node_based_graph_walker.hpp"
|
#include "extractor/intersection/node_based_graph_walker.hpp"
|
||||||
#include "extractor/intersection/intersection_analysis.hpp"
|
#include "extractor/intersection/intersection_analysis.hpp"
|
||||||
#include "util/bearing.hpp"
|
#include "util/bearing.hpp"
|
||||||
#include "util/coordinate_calculation.hpp"
|
#include "util/coordinate_calculation.hpp"
|
||||||
@ -11,7 +11,7 @@ namespace osrm
|
|||||||
{
|
{
|
||||||
namespace extractor
|
namespace extractor
|
||||||
{
|
{
|
||||||
namespace guidance
|
namespace intersection
|
||||||
{
|
{
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
@ -22,7 +22,7 @@ NodeBasedGraphWalker::NodeBasedGraphWalker(
|
|||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data)
|
const TurnLanesIndexedArray &turn_lanes_data)
|
||||||
: node_based_graph(node_based_graph), node_data_container(node_data_container),
|
: node_based_graph(node_based_graph), node_data_container(node_data_container),
|
||||||
node_coordinates(node_coordinates), compressed_geometries(compressed_geometries),
|
node_coordinates(node_coordinates), compressed_geometries(compressed_geometries),
|
||||||
node_restriction_map(node_restriction_map), barrier_nodes(barrier_nodes),
|
node_restriction_map(node_restriction_map), barrier_nodes(barrier_nodes),
|
||||||
@ -31,7 +31,7 @@ NodeBasedGraphWalker::NodeBasedGraphWalker(
|
|||||||
}
|
}
|
||||||
|
|
||||||
LengthLimitedCoordinateAccumulator::LengthLimitedCoordinateAccumulator(
|
LengthLimitedCoordinateAccumulator::LengthLimitedCoordinateAccumulator(
|
||||||
const extractor::guidance::CoordinateExtractor &coordinate_extractor, const double max_length)
|
const CoordinateExtractor &coordinate_extractor, const double max_length)
|
||||||
: accumulated_length(0), coordinate_extractor(coordinate_extractor), max_length(max_length)
|
: accumulated_length(0), coordinate_extractor(coordinate_extractor), max_length(max_length)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -250,7 +250,7 @@ IntersectionFinderAccumulator::IntersectionFinderAccumulator(
|
|||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data)
|
const TurnLanesIndexedArray &turn_lanes_data)
|
||||||
: hops(0), hop_limit(hop_limit), node_based_graph(node_based_graph),
|
: hops(0), hop_limit(hop_limit), node_based_graph(node_based_graph),
|
||||||
node_data_container(node_data_container), node_coordinates(node_coordinates),
|
node_data_container(node_data_container), node_coordinates(node_coordinates),
|
||||||
compressed_geometries(compressed_geometries), node_restriction_map(node_restriction_map),
|
compressed_geometries(compressed_geometries), node_restriction_map(node_restriction_map),
|
||||||
@ -289,6 +289,6 @@ void IntersectionFinderAccumulator::update(const NodeID from_node,
|
|||||||
{from_node, via_edge});
|
{from_node, via_edge});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace intersection
|
||||||
} // namespace extractor
|
} // namespace extractor
|
||||||
} // namespace osrm
|
} // namespace osrm
|
@ -11,6 +11,9 @@
|
|||||||
#include "extractor/query_node.hpp"
|
#include "extractor/query_node.hpp"
|
||||||
#include "extractor/raster_source.hpp"
|
#include "extractor/raster_source.hpp"
|
||||||
#include "extractor/restriction_parser.hpp"
|
#include "extractor/restriction_parser.hpp"
|
||||||
|
|
||||||
|
#include "guidance/turn_instruction.hpp"
|
||||||
|
|
||||||
#include "util/coordinate.hpp"
|
#include "util/coordinate.hpp"
|
||||||
#include "util/exception.hpp"
|
#include "util/exception.hpp"
|
||||||
#include "util/log.hpp"
|
#include "util/log.hpp"
|
||||||
@ -135,27 +138,27 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
|||||||
|
|
||||||
context.state.new_enum("road_priority_class",
|
context.state.new_enum("road_priority_class",
|
||||||
"motorway",
|
"motorway",
|
||||||
extractor::guidance::RoadPriorityClass::MOTORWAY,
|
extractor::RoadPriorityClass::MOTORWAY,
|
||||||
"trunk",
|
"trunk",
|
||||||
extractor::guidance::RoadPriorityClass::TRUNK,
|
extractor::RoadPriorityClass::TRUNK,
|
||||||
"primary",
|
"primary",
|
||||||
extractor::guidance::RoadPriorityClass::PRIMARY,
|
extractor::RoadPriorityClass::PRIMARY,
|
||||||
"secondary",
|
"secondary",
|
||||||
extractor::guidance::RoadPriorityClass::SECONDARY,
|
extractor::RoadPriorityClass::SECONDARY,
|
||||||
"tertiary",
|
"tertiary",
|
||||||
extractor::guidance::RoadPriorityClass::TERTIARY,
|
extractor::RoadPriorityClass::TERTIARY,
|
||||||
"main_residential",
|
"main_residential",
|
||||||
extractor::guidance::RoadPriorityClass::MAIN_RESIDENTIAL,
|
extractor::RoadPriorityClass::MAIN_RESIDENTIAL,
|
||||||
"side_residential",
|
"side_residential",
|
||||||
extractor::guidance::RoadPriorityClass::SIDE_RESIDENTIAL,
|
extractor::RoadPriorityClass::SIDE_RESIDENTIAL,
|
||||||
"link_road",
|
"link_road",
|
||||||
extractor::guidance::RoadPriorityClass::LINK_ROAD,
|
extractor::RoadPriorityClass::LINK_ROAD,
|
||||||
"bike_path",
|
"bike_path",
|
||||||
extractor::guidance::RoadPriorityClass::BIKE_PATH,
|
extractor::RoadPriorityClass::BIKE_PATH,
|
||||||
"foot_path",
|
"foot_path",
|
||||||
extractor::guidance::RoadPriorityClass::FOOT_PATH,
|
extractor::RoadPriorityClass::FOOT_PATH,
|
||||||
"connectivity",
|
"connectivity",
|
||||||
extractor::guidance::RoadPriorityClass::CONNECTIVITY);
|
extractor::RoadPriorityClass::CONNECTIVITY);
|
||||||
|
|
||||||
context.state.new_enum("item_type",
|
context.state.new_enum("item_type",
|
||||||
"node",
|
"node",
|
||||||
@ -263,23 +266,20 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
|||||||
"barrier",
|
"barrier",
|
||||||
&ExtractionNode::barrier);
|
&ExtractionNode::barrier);
|
||||||
|
|
||||||
context.state.new_usertype<guidance::RoadClassification>(
|
context.state.new_usertype<RoadClassification>(
|
||||||
"RoadClassification",
|
"RoadClassification",
|
||||||
"motorway_class",
|
"motorway_class",
|
||||||
sol::property(&guidance::RoadClassification::IsMotorwayClass,
|
sol::property(&RoadClassification::IsMotorwayClass, &RoadClassification::SetMotorwayFlag),
|
||||||
&guidance::RoadClassification::SetMotorwayFlag),
|
|
||||||
"link_class",
|
"link_class",
|
||||||
sol::property(&guidance::RoadClassification::IsLinkClass,
|
sol::property(&RoadClassification::IsLinkClass, &RoadClassification::SetLinkClass),
|
||||||
&guidance::RoadClassification::SetLinkClass),
|
|
||||||
"may_be_ignored",
|
"may_be_ignored",
|
||||||
sol::property(&guidance::RoadClassification::IsLowPriorityRoadClass,
|
sol::property(&RoadClassification::IsLowPriorityRoadClass,
|
||||||
&guidance::RoadClassification::SetLowPriorityFlag),
|
&RoadClassification::SetLowPriorityFlag),
|
||||||
"road_priority_class",
|
"road_priority_class",
|
||||||
sol::property(&guidance::RoadClassification::GetClass,
|
sol::property(&RoadClassification::GetClass, &RoadClassification::SetClass),
|
||||||
&guidance::RoadClassification::SetClass),
|
|
||||||
"num_lanes",
|
"num_lanes",
|
||||||
sol::property(&guidance::RoadClassification::GetNumberOfLanes,
|
sol::property(&RoadClassification::GetNumberOfLanes,
|
||||||
&guidance::RoadClassification::SetNumberOfLanes));
|
&RoadClassification::SetNumberOfLanes));
|
||||||
|
|
||||||
context.state.new_usertype<ExtractionWay>(
|
context.state.new_usertype<ExtractionWay>(
|
||||||
"ResultWay",
|
"ResultWay",
|
||||||
@ -573,16 +573,16 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
|||||||
sol::property([](const ExtractionTurn &turn) {
|
sol::property([](const ExtractionTurn &turn) {
|
||||||
if (turn.number_of_roads > 2 || turn.source_mode != turn.target_mode ||
|
if (turn.number_of_roads > 2 || turn.source_mode != turn.target_mode ||
|
||||||
turn.is_u_turn)
|
turn.is_u_turn)
|
||||||
return guidance::TurnType::Turn;
|
return osrm::guidance::TurnType::Turn;
|
||||||
else
|
else
|
||||||
return guidance::TurnType::NoTurn;
|
return osrm::guidance::TurnType::NoTurn;
|
||||||
}),
|
}),
|
||||||
"direction_modifier",
|
"direction_modifier",
|
||||||
sol::property([](const ExtractionTurn &turn) {
|
sol::property([](const ExtractionTurn &turn) {
|
||||||
if (turn.is_u_turn)
|
if (turn.is_u_turn)
|
||||||
return guidance::DirectionModifier::UTurn;
|
return osrm::guidance::DirectionModifier::UTurn;
|
||||||
else
|
else
|
||||||
return guidance::DirectionModifier::Straight;
|
return osrm::guidance::DirectionModifier::Straight;
|
||||||
}),
|
}),
|
||||||
"has_traffic_light",
|
"has_traffic_light",
|
||||||
&ExtractionTurn::has_traffic_light,
|
&ExtractionTurn::has_traffic_light,
|
||||||
@ -599,77 +599,77 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
|||||||
|
|
||||||
context.state.new_enum("turn_type",
|
context.state.new_enum("turn_type",
|
||||||
"invalid",
|
"invalid",
|
||||||
extractor::guidance::TurnType::Invalid,
|
osrm::guidance::TurnType::Invalid,
|
||||||
"new_name",
|
"new_name",
|
||||||
extractor::guidance::TurnType::NewName,
|
osrm::guidance::TurnType::NewName,
|
||||||
"continue",
|
"continue",
|
||||||
extractor::guidance::TurnType::Continue,
|
osrm::guidance::TurnType::Continue,
|
||||||
"turn",
|
"turn",
|
||||||
extractor::guidance::TurnType::Turn,
|
osrm::guidance::TurnType::Turn,
|
||||||
"merge",
|
"merge",
|
||||||
extractor::guidance::TurnType::Merge,
|
osrm::guidance::TurnType::Merge,
|
||||||
"on_ramp",
|
"on_ramp",
|
||||||
extractor::guidance::TurnType::OnRamp,
|
osrm::guidance::TurnType::OnRamp,
|
||||||
"off_ramp",
|
"off_ramp",
|
||||||
extractor::guidance::TurnType::OffRamp,
|
osrm::guidance::TurnType::OffRamp,
|
||||||
"fork",
|
"fork",
|
||||||
extractor::guidance::TurnType::Fork,
|
osrm::guidance::TurnType::Fork,
|
||||||
"end_of_road",
|
"end_of_road",
|
||||||
extractor::guidance::TurnType::EndOfRoad,
|
osrm::guidance::TurnType::EndOfRoad,
|
||||||
"notification",
|
"notification",
|
||||||
extractor::guidance::TurnType::Notification,
|
osrm::guidance::TurnType::Notification,
|
||||||
"enter_roundabout",
|
"enter_roundabout",
|
||||||
extractor::guidance::TurnType::EnterRoundabout,
|
osrm::guidance::TurnType::EnterRoundabout,
|
||||||
"enter_and_exit_roundabout",
|
"enter_and_exit_roundabout",
|
||||||
extractor::guidance::TurnType::EnterAndExitRoundabout,
|
osrm::guidance::TurnType::EnterAndExitRoundabout,
|
||||||
"enter_rotary",
|
"enter_rotary",
|
||||||
extractor::guidance::TurnType::EnterRotary,
|
osrm::guidance::TurnType::EnterRotary,
|
||||||
"enter_and_exit_rotary",
|
"enter_and_exit_rotary",
|
||||||
extractor::guidance::TurnType::EnterAndExitRotary,
|
osrm::guidance::TurnType::EnterAndExitRotary,
|
||||||
"enter_roundabout_intersection",
|
"enter_roundabout_intersection",
|
||||||
extractor::guidance::TurnType::EnterRoundaboutIntersection,
|
osrm::guidance::TurnType::EnterRoundaboutIntersection,
|
||||||
"enter_and_exit_roundabout_intersection",
|
"enter_and_exit_roundabout_intersection",
|
||||||
extractor::guidance::TurnType::EnterAndExitRoundaboutIntersection,
|
osrm::guidance::TurnType::EnterAndExitRoundaboutIntersection,
|
||||||
"use_lane",
|
"use_lane",
|
||||||
extractor::guidance::TurnType::Suppressed,
|
osrm::guidance::TurnType::Suppressed,
|
||||||
"no_turn",
|
"no_turn",
|
||||||
extractor::guidance::TurnType::NoTurn,
|
osrm::guidance::TurnType::NoTurn,
|
||||||
"suppressed",
|
"suppressed",
|
||||||
extractor::guidance::TurnType::Suppressed,
|
osrm::guidance::TurnType::Suppressed,
|
||||||
"enter_roundabout_at_exit",
|
"enter_roundabout_at_exit",
|
||||||
extractor::guidance::TurnType::EnterRoundaboutAtExit,
|
osrm::guidance::TurnType::EnterRoundaboutAtExit,
|
||||||
"exit_roundabout",
|
"exit_roundabout",
|
||||||
extractor::guidance::TurnType::ExitRoundabout,
|
osrm::guidance::TurnType::ExitRoundabout,
|
||||||
"enter_rotary_at_exit",
|
"enter_rotary_at_exit",
|
||||||
extractor::guidance::TurnType::EnterRotaryAtExit,
|
osrm::guidance::TurnType::EnterRotaryAtExit,
|
||||||
"exit_rotary",
|
"exit_rotary",
|
||||||
extractor::guidance::TurnType::ExitRotary,
|
osrm::guidance::TurnType::ExitRotary,
|
||||||
"enter_roundabout_intersection_at_exit",
|
"enter_roundabout_intersection_at_exit",
|
||||||
extractor::guidance::TurnType::EnterRoundaboutIntersectionAtExit,
|
osrm::guidance::TurnType::EnterRoundaboutIntersectionAtExit,
|
||||||
"exit_roundabout_intersection",
|
"exit_roundabout_intersection",
|
||||||
extractor::guidance::TurnType::ExitRoundaboutIntersection,
|
osrm::guidance::TurnType::ExitRoundaboutIntersection,
|
||||||
"stay_on_roundabout",
|
"stay_on_roundabout",
|
||||||
extractor::guidance::TurnType::StayOnRoundabout,
|
osrm::guidance::TurnType::StayOnRoundabout,
|
||||||
"sliproad",
|
"sliproad",
|
||||||
extractor::guidance::TurnType::Sliproad);
|
osrm::guidance::TurnType::Sliproad);
|
||||||
|
|
||||||
context.state.new_enum("direction_modifier",
|
context.state.new_enum("direction_modifier",
|
||||||
"u_turn",
|
"u_turn",
|
||||||
extractor::guidance::DirectionModifier::UTurn,
|
osrm::guidance::DirectionModifier::UTurn,
|
||||||
"sharp_right",
|
"sharp_right",
|
||||||
extractor::guidance::DirectionModifier::SharpRight,
|
osrm::guidance::DirectionModifier::SharpRight,
|
||||||
"right",
|
"right",
|
||||||
extractor::guidance::DirectionModifier::Right,
|
osrm::guidance::DirectionModifier::Right,
|
||||||
"slight_right",
|
"slight_right",
|
||||||
extractor::guidance::DirectionModifier::SlightRight,
|
osrm::guidance::DirectionModifier::SlightRight,
|
||||||
"straight",
|
"straight",
|
||||||
extractor::guidance::DirectionModifier::Straight,
|
osrm::guidance::DirectionModifier::Straight,
|
||||||
"slight_left",
|
"slight_left",
|
||||||
extractor::guidance::DirectionModifier::SlightLeft,
|
osrm::guidance::DirectionModifier::SlightLeft,
|
||||||
"left",
|
"left",
|
||||||
extractor::guidance::DirectionModifier::Left,
|
osrm::guidance::DirectionModifier::Left,
|
||||||
"sharp_left",
|
"sharp_left",
|
||||||
extractor::guidance::DirectionModifier::SharpLeft);
|
osrm::guidance::DirectionModifier::SharpLeft);
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (context.api_version)
|
switch (context.api_version)
|
||||||
|
@ -2,25 +2,23 @@
|
|||||||
|
|
||||||
#include "util/assert.hpp"
|
#include "util/assert.hpp"
|
||||||
|
|
||||||
using osrm::extractor::guidance::getTurnDirection;
|
using osrm::guidance::getTurnDirection;
|
||||||
using osrm::util::angularDeviation;
|
using osrm::util::angularDeviation;
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
DrivewayHandler::DrivewayHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
DrivewayHandler::DrivewayHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table)
|
const extractor::SuffixTable &street_name_suffix_table)
|
||||||
: IntersectionHandler(node_based_graph,
|
: IntersectionHandler(node_based_graph,
|
||||||
node_data_container,
|
node_data_container,
|
||||||
node_coordinates,
|
node_coordinates,
|
||||||
@ -84,5 +82,4 @@ operator()(const NodeID nid, const EdgeID source_edge_id, Intersection intersect
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
@ -1,92 +0,0 @@
|
|||||||
#include "guidance/intersection.hpp"
|
|
||||||
|
|
||||||
#include <limits>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <boost/range/adaptors.hpp>
|
|
||||||
|
|
||||||
using osrm::util::angularDeviation;
|
|
||||||
|
|
||||||
namespace osrm
|
|
||||||
{
|
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
|
||||||
{
|
|
||||||
|
|
||||||
bool IntersectionViewData::CompareByAngle(const IntersectionViewData &other) const
|
|
||||||
{
|
|
||||||
return angle < other.angle;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ConnectedRoad::compareByAngle(const ConnectedRoad &other) const { return angle < other.angle; }
|
|
||||||
|
|
||||||
void ConnectedRoad::mirror()
|
|
||||||
{
|
|
||||||
const constexpr DirectionModifier::Enum mirrored_modifiers[] = {DirectionModifier::UTurn,
|
|
||||||
DirectionModifier::SharpLeft,
|
|
||||||
DirectionModifier::Left,
|
|
||||||
DirectionModifier::SlightLeft,
|
|
||||||
DirectionModifier::Straight,
|
|
||||||
DirectionModifier::SlightRight,
|
|
||||||
DirectionModifier::Right,
|
|
||||||
DirectionModifier::SharpRight};
|
|
||||||
|
|
||||||
static_assert(sizeof(mirrored_modifiers) / sizeof(DirectionModifier::Enum) ==
|
|
||||||
DirectionModifier::MaxDirectionModifier,
|
|
||||||
"The list of mirrored modifiers needs to match the available modifiers in size.");
|
|
||||||
|
|
||||||
if (util::angularDeviation(angle, 0) > std::numeric_limits<double>::epsilon())
|
|
||||||
{
|
|
||||||
angle = 360 - angle;
|
|
||||||
instruction.direction_modifier = mirrored_modifiers[instruction.direction_modifier];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ConnectedRoad ConnectedRoad::getMirroredCopy() const
|
|
||||||
{
|
|
||||||
ConnectedRoad copy(*this);
|
|
||||||
copy.mirror();
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string toString(const IntersectionShapeData &shape)
|
|
||||||
{
|
|
||||||
std::string result =
|
|
||||||
"[shape] " + std::to_string(shape.eid) + " bearing: " + std::to_string(shape.bearing);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string toString(const IntersectionViewData &view)
|
|
||||||
{
|
|
||||||
std::string result = "[view] ";
|
|
||||||
result += std::to_string(view.eid);
|
|
||||||
result += " allows entry: ";
|
|
||||||
result += std::to_string(view.entry_allowed);
|
|
||||||
result += " angle: ";
|
|
||||||
result += std::to_string(view.angle);
|
|
||||||
result += " bearing: ";
|
|
||||||
result += std::to_string(view.bearing);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string toString(const ConnectedRoad &road)
|
|
||||||
{
|
|
||||||
std::string result = "[connection] ";
|
|
||||||
result += std::to_string(road.eid);
|
|
||||||
result += " allows entry: ";
|
|
||||||
result += std::to_string(road.entry_allowed);
|
|
||||||
result += " angle: ";
|
|
||||||
result += std::to_string(road.angle);
|
|
||||||
result += " bearing: ";
|
|
||||||
result += std::to_string(road.bearing);
|
|
||||||
result += " instruction: ";
|
|
||||||
result += std::to_string(static_cast<std::int32_t>(road.instruction.type)) + " " +
|
|
||||||
std::to_string(static_cast<std::int32_t>(road.instruction.direction_modifier)) + " " +
|
|
||||||
std::to_string(static_cast<std::int32_t>(road.lane_data_id));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace guidance
|
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
|
@ -13,13 +13,11 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
using EdgeData = osrm::util::NodeBasedDynamicGraph::EdgeData;
|
using EdgeData = osrm::util::NodeBasedDynamicGraph::EdgeData;
|
||||||
using osrm::extractor::guidance::getTurnDirection;
|
using osrm::guidance::getTurnDirection;
|
||||||
using osrm::util::angularDeviation;
|
using osrm::util::angularDeviation;
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -27,7 +25,7 @@ namespace detail
|
|||||||
{
|
{
|
||||||
// TODO check flags!
|
// TODO check flags!
|
||||||
inline bool requiresAnnouncement(const util::NodeBasedDynamicGraph &node_based_graph,
|
inline bool requiresAnnouncement(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const EdgeID from,
|
const EdgeID from,
|
||||||
const EdgeID to)
|
const EdgeID to)
|
||||||
{
|
{
|
||||||
@ -48,14 +46,14 @@ inline bool requiresAnnouncement(const util::NodeBasedDynamicGraph &node_based_g
|
|||||||
|
|
||||||
IntersectionHandler::IntersectionHandler(
|
IntersectionHandler::IntersectionHandler(
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph,
|
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table)
|
const extractor::SuffixTable &street_name_suffix_table)
|
||||||
: node_based_graph(node_based_graph), node_data_container(node_data_container),
|
: node_based_graph(node_based_graph), node_data_container(node_data_container),
|
||||||
node_coordinates(node_coordinates), compressed_geometries(compressed_geometries),
|
node_coordinates(node_coordinates), compressed_geometries(compressed_geometries),
|
||||||
node_restriction_map(node_restriction_map), barrier_nodes(barrier_nodes),
|
node_restriction_map(node_restriction_map), barrier_nodes(barrier_nodes),
|
||||||
@ -450,7 +448,7 @@ IntersectionHandler::getNextIntersection(const NodeID at, const EdgeID via) cons
|
|||||||
// writing `tl` (traffic signal) node and the edge `e1` which has the intersection as target.
|
// writing `tl` (traffic signal) node and the edge `e1` which has the intersection as target.
|
||||||
|
|
||||||
const auto intersection_parameters =
|
const auto intersection_parameters =
|
||||||
intersection::skipDegreeTwoNodes(node_based_graph, {at, via});
|
extractor::intersection::skipDegreeTwoNodes(node_based_graph, {at, via});
|
||||||
// This should never happen, guard against nevertheless
|
// This should never happen, guard against nevertheless
|
||||||
if (intersection_parameters.node == SPECIAL_NODEID ||
|
if (intersection_parameters.node == SPECIAL_NODEID ||
|
||||||
intersection_parameters.edge == SPECIAL_EDGEID)
|
intersection_parameters.edge == SPECIAL_EDGEID)
|
||||||
@ -458,14 +456,14 @@ IntersectionHandler::getNextIntersection(const NodeID at, const EdgeID via) cons
|
|||||||
return boost::none;
|
return boost::none;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto intersection = intersection::getConnectedRoads<false>(node_based_graph,
|
auto intersection = extractor::intersection::getConnectedRoads<false>(node_based_graph,
|
||||||
node_data_container,
|
node_data_container,
|
||||||
node_coordinates,
|
node_coordinates,
|
||||||
compressed_geometries,
|
compressed_geometries,
|
||||||
node_restriction_map,
|
node_restriction_map,
|
||||||
barrier_nodes,
|
barrier_nodes,
|
||||||
turn_lanes_data,
|
turn_lanes_data,
|
||||||
intersection_parameters);
|
intersection_parameters);
|
||||||
auto intersection_node = node_based_graph.GetTarget(intersection_parameters.edge);
|
auto intersection_node = node_based_graph.GetTarget(intersection_parameters.edge);
|
||||||
|
|
||||||
if (intersection.size() <= 2 || intersection.isTrafficSignalOrBarrier())
|
if (intersection.size() <= 2 || intersection.isTrafficSignalOrBarrier())
|
||||||
@ -493,5 +491,4 @@ bool IntersectionHandler::isSameName(const EdgeID source_edge_id, const EdgeID t
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "guidance/motorway_handler.hpp"
|
#include "guidance/motorway_handler.hpp"
|
||||||
|
#include "extractor/road_classification.hpp"
|
||||||
#include "guidance/constants.hpp"
|
#include "guidance/constants.hpp"
|
||||||
#include "guidance/road_classification.hpp"
|
|
||||||
|
|
||||||
#include "util/assert.hpp"
|
#include "util/assert.hpp"
|
||||||
#include "util/bearing.hpp"
|
#include "util/bearing.hpp"
|
||||||
@ -12,12 +12,10 @@
|
|||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
using osrm::util::angularDeviation;
|
using osrm::util::angularDeviation;
|
||||||
using osrm::extractor::guidance::getTurnDirection;
|
using osrm::guidance::getTurnDirection;
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
@ -27,8 +25,8 @@ inline bool isMotorwayClass(EdgeID eid, const util::NodeBasedDynamicGraph &node_
|
|||||||
{
|
{
|
||||||
return node_based_graph.GetEdgeData(eid).flags.road_classification.IsMotorwayClass();
|
return node_based_graph.GetEdgeData(eid).flags.road_classification.IsMotorwayClass();
|
||||||
}
|
}
|
||||||
inline RoadClassification roadClass(const ConnectedRoad &road,
|
inline extractor::RoadClassification roadClass(const ConnectedRoad &road,
|
||||||
const util::NodeBasedDynamicGraph &graph)
|
const util::NodeBasedDynamicGraph &graph)
|
||||||
{
|
{
|
||||||
return graph.GetEdgeData(road.eid).flags.road_classification;
|
return graph.GetEdgeData(road.eid).flags.road_classification;
|
||||||
}
|
}
|
||||||
@ -41,14 +39,14 @@ inline bool isRampClass(EdgeID eid, const util::NodeBasedDynamicGraph &node_base
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
MotorwayHandler::MotorwayHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
MotorwayHandler::MotorwayHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table)
|
const extractor::SuffixTable &street_name_suffix_table)
|
||||||
: IntersectionHandler(node_based_graph,
|
: IntersectionHandler(node_based_graph,
|
||||||
node_data_container,
|
node_data_container,
|
||||||
coordinates,
|
coordinates,
|
||||||
@ -564,5 +562,4 @@ Intersection MotorwayHandler::fallback(Intersection intersection) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
@ -14,25 +14,23 @@
|
|||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
using osrm::extractor::guidance::getTurnDirection;
|
using osrm::guidance::getTurnDirection;
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
RoundaboutHandler::RoundaboutHandler(
|
RoundaboutHandler::RoundaboutHandler(
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph,
|
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table)
|
const extractor::SuffixTable &street_name_suffix_table)
|
||||||
: IntersectionHandler(node_based_graph,
|
: IntersectionHandler(node_based_graph,
|
||||||
node_data_container,
|
node_data_container,
|
||||||
coordinates,
|
coordinates,
|
||||||
@ -501,5 +499,4 @@ Intersection RoundaboutHandler::handleRoundabouts(const RoundaboutType roundabou
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "guidance/segregated_intersection_classification.hpp"
|
#include "guidance/segregated_intersection_classification.hpp"
|
||||||
|
#include "extractor/intersection/coordinate_extractor.hpp"
|
||||||
#include "extractor/node_based_graph_factory.hpp"
|
#include "extractor/node_based_graph_factory.hpp"
|
||||||
#include "guidance/coordinate_extractor.hpp"
|
|
||||||
|
|
||||||
#include "util/coordinate_calculation.hpp"
|
#include "util/coordinate_calculation.hpp"
|
||||||
#include "util/name_table.hpp"
|
#include "util/name_table.hpp"
|
||||||
@ -132,7 +132,7 @@ std::unordered_set<EdgeID> findSegregatedNodes(const NodeBasedGraphFactory &fact
|
|||||||
auto const &graph = factory.GetGraph();
|
auto const &graph = factory.GetGraph();
|
||||||
auto const &annotation = factory.GetAnnotationData();
|
auto const &annotation = factory.GetAnnotationData();
|
||||||
|
|
||||||
CoordinateExtractor coordExtractor(
|
extractor::intersection::CoordinateExtractor coordExtractor(
|
||||||
graph, factory.GetCompressedEdges(), factory.GetCoordinates());
|
graph, factory.GetCompressedEdges(), factory.GetCoordinates());
|
||||||
|
|
||||||
auto const get_edge_length = [&](NodeID from_node, EdgeID edgeID, NodeID to_node) {
|
auto const get_edge_length = [&](NodeID from_node, EdgeID edgeID, NodeID to_node) {
|
||||||
|
@ -12,25 +12,23 @@
|
|||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
using osrm::extractor::guidance::getTurnDirection;
|
using osrm::guidance::getTurnDirection;
|
||||||
using osrm::util::angularDeviation;
|
using osrm::util::angularDeviation;
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
SliproadHandler::SliproadHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
SliproadHandler::SliproadHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table)
|
const extractor::SuffixTable &street_name_suffix_table)
|
||||||
: IntersectionHandler(node_based_graph,
|
: IntersectionHandler(node_based_graph,
|
||||||
node_data_container,
|
node_data_container,
|
||||||
node_coordinates,
|
node_coordinates,
|
||||||
@ -250,15 +248,16 @@ operator()(const NodeID /*nid*/, const EdgeID source_edge_id, Intersection inter
|
|||||||
|
|
||||||
// Starting out at the intersection and going onto the Sliproad we skip artificial
|
// Starting out at the intersection and going onto the Sliproad we skip artificial
|
||||||
// degree two intersections and limit the max hop count in doing so.
|
// degree two intersections and limit the max hop count in doing so.
|
||||||
IntersectionFinderAccumulator intersection_finder{10,
|
extractor::intersection::IntersectionFinderAccumulator intersection_finder{
|
||||||
node_based_graph,
|
10,
|
||||||
node_data_container,
|
node_based_graph,
|
||||||
node_coordinates,
|
node_data_container,
|
||||||
compressed_geometries,
|
node_coordinates,
|
||||||
node_restriction_map,
|
compressed_geometries,
|
||||||
barrier_nodes,
|
node_restriction_map,
|
||||||
turn_lanes_data};
|
barrier_nodes,
|
||||||
const SkipTrafficSignalBarrierRoadSelector road_selector{};
|
turn_lanes_data};
|
||||||
|
const extractor::intersection::SkipTrafficSignalBarrierRoadSelector road_selector{};
|
||||||
(void)graph_walker.TraverseRoad(intersection_node_id, // start node
|
(void)graph_walker.TraverseRoad(intersection_node_id, // start node
|
||||||
sliproad_edge, // onto edge
|
sliproad_edge, // onto edge
|
||||||
intersection_finder, // accumulator
|
intersection_finder, // accumulator
|
||||||
@ -269,7 +268,7 @@ operator()(const NodeID /*nid*/, const EdgeID source_edge_id, Intersection inter
|
|||||||
if (target_intersection.isDeadEnd())
|
if (target_intersection.isDeadEnd())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const auto find_valid = [](const IntersectionView &view) {
|
const auto find_valid = [](const extractor::intersection::IntersectionView &view) {
|
||||||
// according to our current sliproad idea, there should only be one valid turn
|
// according to our current sliproad idea, there should only be one valid turn
|
||||||
auto itr = std::find_if(
|
auto itr = std::find_if(
|
||||||
view.begin(), view.end(), [](const auto &road) { return road.entry_allowed; });
|
view.begin(), view.end(), [](const auto &road) { return road.entry_allowed; });
|
||||||
@ -353,12 +352,13 @@ operator()(const NodeID /*nid*/, const EdgeID source_edge_id, Intersection inter
|
|||||||
auto index_of_sliproad_in_target_intersection =
|
auto index_of_sliproad_in_target_intersection =
|
||||||
sliproad_in_target_intersection - target_intersection.begin();
|
sliproad_in_target_intersection - target_intersection.begin();
|
||||||
|
|
||||||
if (isThroughStreet<IntersectionView>(index_of_sliproad_in_target_intersection,
|
if (isThroughStreet<extractor::intersection::IntersectionView>(
|
||||||
target_intersection,
|
index_of_sliproad_in_target_intersection,
|
||||||
node_based_graph,
|
target_intersection,
|
||||||
node_data_container,
|
node_based_graph,
|
||||||
name_table,
|
node_data_container,
|
||||||
street_name_suffix_table))
|
name_table,
|
||||||
|
street_name_suffix_table))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -573,15 +573,16 @@ operator()(const NodeID /*nid*/, const EdgeID source_edge_id, Intersection inter
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto skip_traffic_light_intersection = intersection::getConnectedRoads<false>(
|
const auto skip_traffic_light_intersection =
|
||||||
node_based_graph,
|
extractor::intersection::getConnectedRoads<false>(
|
||||||
node_data_container,
|
node_based_graph,
|
||||||
node_coordinates,
|
node_data_container,
|
||||||
compressed_geometries,
|
node_coordinates,
|
||||||
node_restriction_map,
|
compressed_geometries,
|
||||||
barrier_nodes,
|
node_restriction_map,
|
||||||
turn_lanes_data,
|
barrier_nodes,
|
||||||
{node_based_graph.GetTarget(sliproad_edge), candidate_road.eid});
|
turn_lanes_data,
|
||||||
|
{node_based_graph.GetTarget(sliproad_edge), candidate_road.eid});
|
||||||
if (skip_traffic_light_intersection.isTrafficSignalOrBarrier() &&
|
if (skip_traffic_light_intersection.isTrafficSignalOrBarrier() &&
|
||||||
node_based_graph.GetTarget(skip_traffic_light_intersection[1].eid) ==
|
node_based_graph.GetTarget(skip_traffic_light_intersection[1].eid) ==
|
||||||
main_road_intersection->node)
|
main_road_intersection->node)
|
||||||
@ -695,9 +696,9 @@ bool SliproadHandler::nextIntersectionIsTooFarAway(const NodeID start, const Edg
|
|||||||
const auto threshold = scaledThresholdByRoadClass(MAX_SLIPROAD_THRESHOLD, // <- scales down
|
const auto threshold = scaledThresholdByRoadClass(MAX_SLIPROAD_THRESHOLD, // <- scales down
|
||||||
data.road_classification);
|
data.road_classification);
|
||||||
|
|
||||||
DistanceToNextIntersectionAccumulator accumulator{
|
extractor::intersection::DistanceToNextIntersectionAccumulator accumulator{
|
||||||
coordinate_extractor, node_based_graph, threshold};
|
coordinate_extractor, node_based_graph, threshold};
|
||||||
const SkipTrafficSignalBarrierRoadSelector selector{};
|
const extractor::intersection::SkipTrafficSignalBarrierRoadSelector selector{};
|
||||||
|
|
||||||
(void)graph_walker.TraverseRoad(start, onto, accumulator, selector);
|
(void)graph_walker.TraverseRoad(start, onto, accumulator, selector);
|
||||||
|
|
||||||
@ -755,9 +756,10 @@ bool SliproadHandler::isValidSliproadArea(const double max_area,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SliproadHandler::isValidSliproadLink(const IntersectionViewData &sliproad,
|
bool SliproadHandler::isValidSliproadLink(
|
||||||
const IntersectionViewData & /*first*/,
|
const extractor::intersection::IntersectionViewData &sliproad,
|
||||||
const IntersectionViewData &second) const
|
const extractor::intersection::IntersectionViewData & /*first*/,
|
||||||
|
const extractor::intersection::IntersectionViewData &second) const
|
||||||
{
|
{
|
||||||
// If the Sliproad is not a link we don't care
|
// If the Sliproad is not a link we don't care
|
||||||
const auto &sliproad_data = node_based_graph.GetEdgeData(sliproad.eid).flags;
|
const auto &sliproad_data = node_based_graph.GetEdgeData(sliproad.eid).flags;
|
||||||
@ -791,7 +793,8 @@ bool SliproadHandler::allSameMode(const EdgeID from,
|
|||||||
(target_annotation.travel_mode == sliproad_annotation.travel_mode);
|
(target_annotation.travel_mode == sliproad_annotation.travel_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SliproadHandler::canBeTargetOfSliproad(const IntersectionView &intersection)
|
bool SliproadHandler::canBeTargetOfSliproad(
|
||||||
|
const extractor::intersection::IntersectionView &intersection)
|
||||||
{
|
{
|
||||||
// Example to handle:
|
// Example to handle:
|
||||||
// .
|
// .
|
||||||
@ -819,44 +822,45 @@ bool SliproadHandler::canBeTargetOfSliproad(const IntersectionView &intersection
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
double SliproadHandler::scaledThresholdByRoadClass(const double max_threshold,
|
double
|
||||||
const RoadClassification &classification)
|
SliproadHandler::scaledThresholdByRoadClass(const double max_threshold,
|
||||||
|
const extractor::RoadClassification &classification)
|
||||||
{
|
{
|
||||||
double factor = 1.0;
|
double factor = 1.0;
|
||||||
|
|
||||||
switch (classification.GetPriority())
|
switch (classification.GetPriority())
|
||||||
{
|
{
|
||||||
case RoadPriorityClass::MOTORWAY:
|
case extractor::RoadPriorityClass::MOTORWAY:
|
||||||
factor = 1.0;
|
factor = 1.0;
|
||||||
break;
|
break;
|
||||||
case RoadPriorityClass::TRUNK:
|
case extractor::RoadPriorityClass::TRUNK:
|
||||||
factor = 0.8;
|
factor = 0.8;
|
||||||
break;
|
break;
|
||||||
case RoadPriorityClass::PRIMARY:
|
case extractor::RoadPriorityClass::PRIMARY:
|
||||||
factor = 0.8;
|
factor = 0.8;
|
||||||
break;
|
break;
|
||||||
case RoadPriorityClass::SECONDARY:
|
case extractor::RoadPriorityClass::SECONDARY:
|
||||||
factor = 0.6;
|
factor = 0.6;
|
||||||
break;
|
break;
|
||||||
case RoadPriorityClass::TERTIARY:
|
case extractor::RoadPriorityClass::TERTIARY:
|
||||||
factor = 0.5;
|
factor = 0.5;
|
||||||
break;
|
break;
|
||||||
case RoadPriorityClass::MAIN_RESIDENTIAL:
|
case extractor::RoadPriorityClass::MAIN_RESIDENTIAL:
|
||||||
factor = 0.4;
|
factor = 0.4;
|
||||||
break;
|
break;
|
||||||
case RoadPriorityClass::SIDE_RESIDENTIAL:
|
case extractor::RoadPriorityClass::SIDE_RESIDENTIAL:
|
||||||
factor = 0.3;
|
factor = 0.3;
|
||||||
break;
|
break;
|
||||||
case RoadPriorityClass::LINK_ROAD:
|
case extractor::RoadPriorityClass::LINK_ROAD:
|
||||||
factor = 0.3;
|
factor = 0.3;
|
||||||
break;
|
break;
|
||||||
case RoadPriorityClass::CONNECTIVITY:
|
case extractor::RoadPriorityClass::CONNECTIVITY:
|
||||||
factor = 0.1;
|
factor = 0.1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// What
|
// What
|
||||||
case RoadPriorityClass::BIKE_PATH:
|
case extractor::RoadPriorityClass::BIKE_PATH:
|
||||||
case RoadPriorityClass::FOOT_PATH:
|
case extractor::RoadPriorityClass::FOOT_PATH:
|
||||||
default:
|
default:
|
||||||
factor = 0.1;
|
factor = 0.1;
|
||||||
}
|
}
|
||||||
@ -868,5 +872,4 @@ double SliproadHandler::scaledThresholdByRoadClass(const double max_threshold,
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
@ -6,21 +6,19 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
SuppressModeHandler::SuppressModeHandler(
|
SuppressModeHandler::SuppressModeHandler(
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph,
|
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table)
|
const extractor::SuffixTable &street_name_suffix_table)
|
||||||
: IntersectionHandler(node_based_graph,
|
: IntersectionHandler(node_based_graph,
|
||||||
node_data_container,
|
node_data_container,
|
||||||
coordinates,
|
coordinates,
|
||||||
@ -81,4 +79,3 @@ operator()(const NodeID, const EdgeID, Intersection intersection) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "guidance/turn_analysis.hpp"
|
#include "guidance/turn_analysis.hpp"
|
||||||
|
#include "extractor/road_classification.hpp"
|
||||||
#include "guidance/constants.hpp"
|
#include "guidance/constants.hpp"
|
||||||
#include "guidance/road_classification.hpp"
|
|
||||||
|
|
||||||
#include "util/coordinate.hpp"
|
#include "util/coordinate.hpp"
|
||||||
#include "util/coordinate_calculation.hpp"
|
#include "util/coordinate_calculation.hpp"
|
||||||
@ -10,26 +10,24 @@
|
|||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
using osrm::extractor::guidance::getTurnDirection;
|
using osrm::guidance::getTurnDirection;
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
using EdgeData = util::NodeBasedDynamicGraph::EdgeData;
|
using EdgeData = util::NodeBasedDynamicGraph::EdgeData;
|
||||||
|
|
||||||
TurnAnalysis::TurnAnalysis(const util::NodeBasedDynamicGraph &node_based_graph,
|
TurnAnalysis::TurnAnalysis(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const CompressedEdgeContainer &compressed_edge_container,
|
const extractor::CompressedEdgeContainer &compressed_edge_container,
|
||||||
const RestrictionMap &restriction_map,
|
const extractor::RestrictionMap &restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table)
|
const extractor::SuffixTable &street_name_suffix_table)
|
||||||
: node_based_graph(node_based_graph), roundabout_handler(node_based_graph,
|
: node_based_graph(node_based_graph), roundabout_handler(node_based_graph,
|
||||||
node_data_container,
|
node_data_container,
|
||||||
node_coordinates,
|
node_coordinates,
|
||||||
@ -96,9 +94,10 @@ TurnAnalysis::TurnAnalysis(const util::NodeBasedDynamicGraph &node_based_graph,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Intersection TurnAnalysis::AssignTurnTypes(const NodeID node_prior_to_intersection,
|
Intersection TurnAnalysis::AssignTurnTypes(
|
||||||
const EdgeID entering_via_edge,
|
const NodeID node_prior_to_intersection,
|
||||||
const IntersectionView &intersection_view) const
|
const EdgeID entering_via_edge,
|
||||||
|
const extractor::intersection::IntersectionView &intersection_view) const
|
||||||
{
|
{
|
||||||
// Roundabouts are a main priority. If there is a roundabout instruction present, we process the
|
// Roundabouts are a main priority. If there is a roundabout instruction present, we process the
|
||||||
// turn as a roundabout
|
// turn as a roundabout
|
||||||
@ -110,7 +109,7 @@ Intersection TurnAnalysis::AssignTurnTypes(const NodeID node_prior_to_intersecti
|
|||||||
std::transform(intersection_view.begin(),
|
std::transform(intersection_view.begin(),
|
||||||
intersection_view.end(),
|
intersection_view.end(),
|
||||||
std::back_inserter(intersection),
|
std::back_inserter(intersection),
|
||||||
[&](const IntersectionViewData &data) {
|
[&](const extractor::intersection::IntersectionViewData &data) {
|
||||||
return ConnectedRoad(data,
|
return ConnectedRoad(data,
|
||||||
{TurnType::Invalid, DirectionModifier::UTurn},
|
{TurnType::Invalid, DirectionModifier::UTurn},
|
||||||
INVALID_LANE_DATAID);
|
INVALID_LANE_DATAID);
|
||||||
@ -203,5 +202,4 @@ Intersection TurnAnalysis::setTurnTypes(const NodeID node_prior_to_intersection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -87,5 +85,4 @@ classifyIntersection(Intersection intersection, const osrm::util::Coordinate &lo
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "guidance/turn_discovery.hpp"
|
#include "guidance/turn_discovery.hpp"
|
||||||
|
#include "extractor/intersection/coordinate_extractor.hpp"
|
||||||
#include "extractor/intersection/intersection_analysis.hpp"
|
#include "extractor/intersection/intersection_analysis.hpp"
|
||||||
#include "guidance/constants.hpp"
|
#include "guidance/constants.hpp"
|
||||||
#include "guidance/coordinate_extractor.hpp"
|
|
||||||
#include "util/bearing.hpp"
|
#include "util/bearing.hpp"
|
||||||
#include "util/coordinate_calculation.hpp"
|
#include "util/coordinate_calculation.hpp"
|
||||||
|
|
||||||
@ -9,8 +9,6 @@ using osrm::util::angularDeviation;
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
namespace lanes
|
namespace lanes
|
||||||
@ -20,16 +18,16 @@ bool findPreviousIntersection(const NodeID node_v,
|
|||||||
const EdgeID via_edge,
|
const EdgeID via_edge,
|
||||||
const Intersection &intersection,
|
const Intersection &intersection,
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph,
|
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
// output parameters
|
// output parameters
|
||||||
NodeID &result_node,
|
NodeID &result_node,
|
||||||
EdgeID &result_via_edge,
|
EdgeID &result_via_edge,
|
||||||
IntersectionView &result_intersection)
|
extractor::intersection::IntersectionView &result_intersection)
|
||||||
{
|
{
|
||||||
/* We need to find the intersection that is located prior to via_edge.
|
/* We need to find the intersection that is located prior to via_edge.
|
||||||
|
|
||||||
@ -45,7 +43,7 @@ bool findPreviousIntersection(const NodeID node_v,
|
|||||||
*/
|
*/
|
||||||
const constexpr double COMBINE_DISTANCE_CUTOFF = 30;
|
const constexpr double COMBINE_DISTANCE_CUTOFF = 30;
|
||||||
|
|
||||||
const CoordinateExtractor coordinate_extractor(
|
const extractor::intersection::CoordinateExtractor coordinate_extractor(
|
||||||
node_based_graph, compressed_geometries, node_coordinates);
|
node_based_graph, compressed_geometries, node_coordinates);
|
||||||
|
|
||||||
const auto coordinates_along_via_edge =
|
const auto coordinates_along_via_edge =
|
||||||
@ -75,14 +73,14 @@ bool findPreviousIntersection(const NodeID node_v,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto node_v_reverse_intersection =
|
const auto node_v_reverse_intersection =
|
||||||
intersection::getConnectedRoads<true>(node_based_graph,
|
extractor::intersection::getConnectedRoads<true>(node_based_graph,
|
||||||
node_data_container,
|
node_data_container,
|
||||||
node_coordinates,
|
node_coordinates,
|
||||||
compressed_geometries,
|
compressed_geometries,
|
||||||
node_restriction_map,
|
node_restriction_map,
|
||||||
barrier_nodes,
|
barrier_nodes,
|
||||||
turn_lanes_data,
|
turn_lanes_data,
|
||||||
{node_w, u_turn_at_node_w});
|
{node_w, u_turn_at_node_w});
|
||||||
// Continue along the straightmost turn. If there is no straight turn, we cannot find a valid
|
// Continue along the straightmost turn. If there is no straight turn, we cannot find a valid
|
||||||
// previous intersection.
|
// previous intersection.
|
||||||
const auto straightmost_at_v_in_reverse =
|
const auto straightmost_at_v_in_reverse =
|
||||||
@ -94,15 +92,15 @@ bool findPreviousIntersection(const NodeID node_v,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto node_u = node_based_graph.GetTarget(straightmost_at_v_in_reverse->eid);
|
const auto node_u = node_based_graph.GetTarget(straightmost_at_v_in_reverse->eid);
|
||||||
const auto node_u_reverse_intersection =
|
const auto node_u_reverse_intersection = extractor::intersection::getConnectedRoads<true>(
|
||||||
intersection::getConnectedRoads<true>(node_based_graph,
|
node_based_graph,
|
||||||
node_data_container,
|
node_data_container,
|
||||||
node_coordinates,
|
node_coordinates,
|
||||||
compressed_geometries,
|
compressed_geometries,
|
||||||
node_restriction_map,
|
node_restriction_map,
|
||||||
barrier_nodes,
|
barrier_nodes,
|
||||||
turn_lanes_data,
|
turn_lanes_data,
|
||||||
{node_v, straightmost_at_v_in_reverse->eid});
|
{node_v, straightmost_at_v_in_reverse->eid});
|
||||||
|
|
||||||
// now check that the u-turn at the given intersection connects to via-edge
|
// now check that the u-turn at the given intersection connects to via-edge
|
||||||
// The u-turn at the now found intersection should, hopefully, represent the previous edge.
|
// The u-turn at the now found intersection should, hopefully, represent the previous edge.
|
||||||
@ -120,19 +118,22 @@ bool findPreviousIntersection(const NodeID node_v,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
result_intersection = intersection::getConnectedRoads<false>(node_based_graph,
|
result_intersection =
|
||||||
node_data_container,
|
extractor::intersection::getConnectedRoads<false>(node_based_graph,
|
||||||
node_coordinates,
|
node_data_container,
|
||||||
compressed_geometries,
|
node_coordinates,
|
||||||
node_restriction_map,
|
compressed_geometries,
|
||||||
barrier_nodes,
|
node_restriction_map,
|
||||||
turn_lanes_data,
|
barrier_nodes,
|
||||||
{node_u, result_via_edge});
|
turn_lanes_data,
|
||||||
|
{node_u, result_via_edge});
|
||||||
const auto check_via_edge =
|
const auto check_via_edge =
|
||||||
result_intersection.end() !=
|
result_intersection.end() !=
|
||||||
std::find_if(result_intersection.begin(),
|
std::find_if(result_intersection.begin(),
|
||||||
result_intersection.end(),
|
result_intersection.end(),
|
||||||
[via_edge](const IntersectionViewData &road) { return road.eid == via_edge; });
|
[via_edge](const extractor::intersection::IntersectionViewData &road) {
|
||||||
|
return road.eid == via_edge;
|
||||||
|
});
|
||||||
|
|
||||||
if (!check_via_edge)
|
if (!check_via_edge)
|
||||||
{
|
{
|
||||||
@ -146,5 +147,4 @@ bool findPreviousIntersection(const NodeID node_v,
|
|||||||
|
|
||||||
} // namespace lanes
|
} // namespace lanes
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
@ -11,13 +11,13 @@
|
|||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
using osrm::extractor::guidance::getTurnDirection;
|
using osrm::guidance::getTurnDirection;
|
||||||
using osrm::util::angularDeviation;
|
using osrm::util::angularDeviation;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
using namespace osrm::extractor::guidance;
|
using namespace osrm::guidance;
|
||||||
// given two adjacent roads in clockwise order and `road1` being a candidate for a fork,
|
// given two adjacent roads in clockwise order and `road1` being a candidate for a fork,
|
||||||
// return false, if next road `road2` is also a fork candidate or
|
// return false, if next road `road2` is also a fork candidate or
|
||||||
// return true, if `road2` is not a suitable fork candidate and thus, `road1` the outermost fork
|
// return true, if `road2` is not a suitable fork candidate and thus, `road1` the outermost fork
|
||||||
@ -72,8 +72,6 @@ InputIt findOutermostForkCandidate(const InputIt begin, const InputIt end)
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -111,14 +109,14 @@ std::size_t TurnHandler::Fork::getLeftIndex() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
TurnHandler::TurnHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
TurnHandler::TurnHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table)
|
const extractor::SuffixTable &street_name_suffix_table)
|
||||||
: IntersectionHandler(node_based_graph,
|
: IntersectionHandler(node_based_graph,
|
||||||
node_data_container,
|
node_data_container,
|
||||||
coordinates,
|
coordinates,
|
||||||
@ -844,5 +842,4 @@ void TurnHandler::handleDistinctConflict(const EdgeID via_edge,
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "guidance/turn_lane_augmentation.hpp"
|
#include "guidance/turn_lane_augmentation.hpp"
|
||||||
#include "guidance/turn_lane_types.hpp"
|
|
||||||
|
#include "extractor/turn_lane_types.hpp"
|
||||||
#include "util/log.hpp"
|
#include "util/log.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -9,8 +10,6 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
namespace lanes
|
namespace lanes
|
||||||
@ -19,14 +18,15 @@ namespace lanes
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
const constexpr TurnLaneType::Mask tag_by_modifier[] = {TurnLaneType::uturn,
|
const constexpr extractor::TurnLaneType::Mask tag_by_modifier[] = {
|
||||||
TurnLaneType::sharp_right,
|
extractor::TurnLaneType::uturn,
|
||||||
TurnLaneType::right,
|
extractor::TurnLaneType::sharp_right,
|
||||||
TurnLaneType::slight_right,
|
extractor::TurnLaneType::right,
|
||||||
TurnLaneType::straight,
|
extractor::TurnLaneType::slight_right,
|
||||||
TurnLaneType::slight_left,
|
extractor::TurnLaneType::straight,
|
||||||
TurnLaneType::left,
|
extractor::TurnLaneType::slight_left,
|
||||||
TurnLaneType::sharp_left};
|
extractor::TurnLaneType::left,
|
||||||
|
extractor::TurnLaneType::sharp_left};
|
||||||
|
|
||||||
std::size_t getNumberOfTurns(const Intersection &intersection)
|
std::size_t getNumberOfTurns(const Intersection &intersection)
|
||||||
{
|
{
|
||||||
@ -214,12 +214,13 @@ LaneDataVector handleRenamingSituations(const std::size_t none_index,
|
|||||||
// find missing tag and augment neighboring, if possible
|
// find missing tag and augment neighboring, if possible
|
||||||
if (none_index == 0)
|
if (none_index == 0)
|
||||||
{
|
{
|
||||||
if (has_right &&
|
if (has_right && (lane_data.size() == 1 ||
|
||||||
(lane_data.size() == 1 || (lane_data[none_index + 1].tag != TurnLaneType::sharp_right &&
|
(lane_data[none_index + 1].tag != extractor::TurnLaneType::sharp_right &&
|
||||||
lane_data[none_index + 1].tag != TurnLaneType::right)))
|
lane_data[none_index + 1].tag != extractor::TurnLaneType::right)))
|
||||||
{
|
{
|
||||||
lane_data[none_index].tag = TurnLaneType::right;
|
lane_data[none_index].tag = extractor::TurnLaneType::right;
|
||||||
if (lane_data.size() > 1 && lane_data[none_index + 1].tag == TurnLaneType::straight)
|
if (lane_data.size() > 1 &&
|
||||||
|
lane_data[none_index + 1].tag == extractor::TurnLaneType::straight)
|
||||||
{
|
{
|
||||||
lane_data[none_index + 1].from = lane_data[none_index].from;
|
lane_data[none_index + 1].from = lane_data[none_index].from;
|
||||||
// turning right through a possible through lane is not possible
|
// turning right through a possible through lane is not possible
|
||||||
@ -227,39 +228,40 @@ LaneDataVector handleRenamingSituations(const std::size_t none_index,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (has_through &&
|
else if (has_through &&
|
||||||
(lane_data.size() == 1 || lane_data[none_index + 1].tag != TurnLaneType::straight))
|
(lane_data.size() == 1 ||
|
||||||
|
lane_data[none_index + 1].tag != extractor::TurnLaneType::straight))
|
||||||
{
|
{
|
||||||
lane_data[none_index].tag = TurnLaneType::straight;
|
lane_data[none_index].tag = extractor::TurnLaneType::straight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (none_index + 1 == lane_data.size())
|
else if (none_index + 1 == lane_data.size())
|
||||||
{
|
{
|
||||||
if (has_left && ((lane_data[none_index - 1].tag != TurnLaneType::sharp_left &&
|
if (has_left && ((lane_data[none_index - 1].tag != extractor::TurnLaneType::sharp_left &&
|
||||||
lane_data[none_index - 1].tag != TurnLaneType::left)))
|
lane_data[none_index - 1].tag != extractor::TurnLaneType::left)))
|
||||||
{
|
{
|
||||||
lane_data[none_index].tag = TurnLaneType::left;
|
lane_data[none_index].tag = extractor::TurnLaneType::left;
|
||||||
if (lane_data[none_index - 1].tag == TurnLaneType::straight)
|
if (lane_data[none_index - 1].tag == extractor::TurnLaneType::straight)
|
||||||
{
|
{
|
||||||
lane_data[none_index - 1].to = lane_data[none_index].to;
|
lane_data[none_index - 1].to = lane_data[none_index].to;
|
||||||
// turning left through a possible through lane is not possible
|
// turning left through a possible through lane is not possible
|
||||||
lane_data[none_index].from = lane_data[none_index].to;
|
lane_data[none_index].from = lane_data[none_index].to;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (has_through && lane_data[none_index - 1].tag != TurnLaneType::straight)
|
else if (has_through && lane_data[none_index - 1].tag != extractor::TurnLaneType::straight)
|
||||||
{
|
{
|
||||||
lane_data[none_index].tag = TurnLaneType::straight;
|
lane_data[none_index].tag = extractor::TurnLaneType::straight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((lane_data[none_index + 1].tag == TurnLaneType::left ||
|
if ((lane_data[none_index + 1].tag == extractor::TurnLaneType::left ||
|
||||||
lane_data[none_index + 1].tag == TurnLaneType::slight_left ||
|
lane_data[none_index + 1].tag == extractor::TurnLaneType::slight_left ||
|
||||||
lane_data[none_index + 1].tag == TurnLaneType::sharp_left) &&
|
lane_data[none_index + 1].tag == extractor::TurnLaneType::sharp_left) &&
|
||||||
(lane_data[none_index - 1].tag == TurnLaneType::right ||
|
(lane_data[none_index - 1].tag == extractor::TurnLaneType::right ||
|
||||||
lane_data[none_index - 1].tag == TurnLaneType::slight_right ||
|
lane_data[none_index - 1].tag == extractor::TurnLaneType::slight_right ||
|
||||||
lane_data[none_index - 1].tag == TurnLaneType::sharp_right))
|
lane_data[none_index - 1].tag == extractor::TurnLaneType::sharp_right))
|
||||||
{
|
{
|
||||||
lane_data[none_index].tag = TurnLaneType::straight;
|
lane_data[none_index].tag = extractor::TurnLaneType::straight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return lane_data;
|
return lane_data;
|
||||||
@ -275,8 +277,8 @@ LaneDataVector handleRenamingSituations(const std::size_t none_index,
|
|||||||
LaneDataVector handleNoneValueAtSimpleTurn(LaneDataVector lane_data,
|
LaneDataVector handleNoneValueAtSimpleTurn(LaneDataVector lane_data,
|
||||||
const Intersection &intersection)
|
const Intersection &intersection)
|
||||||
{
|
{
|
||||||
const bool needs_no_processing =
|
const bool needs_no_processing = (intersection.empty() || lane_data.empty() ||
|
||||||
(intersection.empty() || lane_data.empty() || !hasTag(TurnLaneType::none, lane_data));
|
!hasTag(extractor::TurnLaneType::none, lane_data));
|
||||||
|
|
||||||
if (needs_no_processing)
|
if (needs_no_processing)
|
||||||
return lane_data;
|
return lane_data;
|
||||||
@ -305,11 +307,13 @@ LaneDataVector handleNoneValueAtSimpleTurn(LaneDataVector lane_data,
|
|||||||
|
|
||||||
const std::size_t connection_count =
|
const std::size_t connection_count =
|
||||||
getNumberOfTurns(intersection) -
|
getNumberOfTurns(intersection) -
|
||||||
((intersection[0].entry_allowed && lane_data.back().tag != TurnLaneType::uturn) ? 1 : 0);
|
((intersection[0].entry_allowed && lane_data.back().tag != extractor::TurnLaneType::uturn)
|
||||||
|
? 1
|
||||||
|
: 0);
|
||||||
|
|
||||||
// TODO check for impossible turns to see whether the turn lane is at the correct place
|
// TODO check for impossible turns to see whether the turn lane is at the correct place
|
||||||
const std::size_t none_index =
|
const std::size_t none_index =
|
||||||
std::distance(lane_data.begin(), findTag(TurnLaneType::none, lane_data));
|
std::distance(lane_data.begin(), findTag(extractor::TurnLaneType::none, lane_data));
|
||||||
BOOST_ASSERT(none_index != lane_data.size());
|
BOOST_ASSERT(none_index != lane_data.size());
|
||||||
// we have to create multiple turns
|
// we have to create multiple turns
|
||||||
if (connection_count > lane_data.size())
|
if (connection_count > lane_data.size())
|
||||||
@ -348,5 +352,4 @@ LaneDataVector handleNoneValueAtSimpleTurn(LaneDataVector lane_data,
|
|||||||
|
|
||||||
} // namespace lanes
|
} // namespace lanes
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
@ -10,12 +10,12 @@
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
namespace lanes
|
namespace lanes
|
||||||
{
|
{
|
||||||
|
namespace TurnLaneType = extractor::TurnLaneType;
|
||||||
|
using TurnLaneDescription = extractor::TurnLaneDescription;
|
||||||
|
|
||||||
bool TurnLaneData::operator<(const TurnLaneData &other) const
|
bool TurnLaneData::operator<(const TurnLaneData &other) const
|
||||||
{
|
{
|
||||||
@ -156,5 +156,4 @@ bool hasTag(const TurnLaneType::Mask tag, const LaneDataVector &data)
|
|||||||
|
|
||||||
} // namespace lanes
|
} // namespace lanes
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
@ -17,12 +17,12 @@ using osrm::util::angularDeviation;
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
namespace lanes
|
namespace lanes
|
||||||
{
|
{
|
||||||
|
namespace TurnLaneType = extractor::TurnLaneType;
|
||||||
|
using TurnLaneDescription = extractor::TurnLaneDescription;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -35,13 +35,13 @@ std::size_t getNumberOfTurns(const Intersection &intersection)
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TurnLaneHandler::TurnLaneHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
TurnLaneHandler::TurnLaneHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
const EdgeBasedNodeDataContainer &node_data_container,
|
const extractor::EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries,
|
const extractor::CompressedEdgeContainer &compressed_geometries,
|
||||||
const RestrictionMap &node_restriction_map,
|
const extractor::RestrictionMap &node_restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const guidance::TurnLanesIndexedArray &turn_lanes_data,
|
const extractor::TurnLanesIndexedArray &turn_lanes_data,
|
||||||
LaneDescriptionMap &lane_description_map,
|
extractor::LaneDescriptionMap &lane_description_map,
|
||||||
const TurnAnalysis &turn_analysis,
|
const TurnAnalysis &turn_analysis,
|
||||||
util::guidance::LaneDataIdMap &id_map)
|
util::guidance::LaneDataIdMap &id_map)
|
||||||
: node_based_graph(node_based_graph), node_data_container(node_data_container),
|
: node_based_graph(node_based_graph), node_data_container(node_data_container),
|
||||||
@ -209,7 +209,7 @@ TurnLaneScenario TurnLaneHandler::deduceScenario(const NodeID at,
|
|||||||
// Due to sliproads, we might need access to the previous intersection at this point already;
|
// Due to sliproads, we might need access to the previous intersection at this point already;
|
||||||
previous_node = SPECIAL_NODEID;
|
previous_node = SPECIAL_NODEID;
|
||||||
previous_via_edge = SPECIAL_EDGEID;
|
previous_via_edge = SPECIAL_EDGEID;
|
||||||
IntersectionView previous_intersection_view;
|
extractor::intersection::IntersectionView previous_intersection_view;
|
||||||
if (findPreviousIntersection(at,
|
if (findPreviousIntersection(at,
|
||||||
via_edge,
|
via_edge,
|
||||||
intersection,
|
intersection,
|
||||||
@ -575,14 +575,14 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
|
|||||||
const auto next_intersection = turn_analysis.AssignTurnTypes(
|
const auto next_intersection = turn_analysis.AssignTurnTypes(
|
||||||
at,
|
at,
|
||||||
straightmost->eid,
|
straightmost->eid,
|
||||||
intersection::getConnectedRoads<false>(node_based_graph,
|
extractor::intersection::getConnectedRoads<false>(node_based_graph,
|
||||||
node_data_container,
|
node_data_container,
|
||||||
node_coordinates,
|
node_coordinates,
|
||||||
compressed_geometries,
|
compressed_geometries,
|
||||||
node_restriction_map,
|
node_restriction_map,
|
||||||
barrier_nodes,
|
barrier_nodes,
|
||||||
turn_lanes_data,
|
turn_lanes_data,
|
||||||
{at, straightmost->eid}));
|
{at, straightmost->eid}));
|
||||||
|
|
||||||
// check where we can match turn lanes
|
// check where we can match turn lanes
|
||||||
std::size_t straightmost_tag_index = turn_lane_data.size();
|
std::size_t straightmost_tag_index = turn_lane_data.size();
|
||||||
@ -815,5 +815,4 @@ Intersection TurnLaneHandler::handleSliproadTurn(Intersection intersection,
|
|||||||
|
|
||||||
} // namespace lanes
|
} // namespace lanes
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
@ -10,12 +10,11 @@ using osrm::util::angularDeviation;
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
namespace guidance
|
namespace guidance
|
||||||
{
|
{
|
||||||
namespace lanes
|
namespace lanes
|
||||||
{
|
{
|
||||||
|
namespace TurnLaneType = extractor::TurnLaneType;
|
||||||
|
|
||||||
// Translate Turn Tags into a Matching Direction Modifier
|
// Translate Turn Tags into a Matching Direction Modifier
|
||||||
DirectionModifier::Enum getMatchingModifier(const TurnLaneType::Mask tag)
|
DirectionModifier::Enum getMatchingModifier(const TurnLaneType::Mask tag)
|
||||||
@ -54,8 +53,6 @@ DirectionModifier::Enum getMatchingModifier(const TurnLaneType::Mask tag)
|
|||||||
// check whether a match of a given tag and a turn instruction can be seen as valid
|
// check whether a match of a given tag and a turn instruction can be seen as valid
|
||||||
bool isValidMatch(const TurnLaneType::Mask tag, const TurnInstruction instruction)
|
bool isValidMatch(const TurnLaneType::Mask tag, const TurnInstruction instruction)
|
||||||
{
|
{
|
||||||
using extractor::guidance::hasLeftModifier;
|
|
||||||
using extractor::guidance::hasRightModifier;
|
|
||||||
const auto isMirroredModifier = [](const TurnInstruction instruction) {
|
const auto isMirroredModifier = [](const TurnInstruction instruction) {
|
||||||
return instruction.type == TurnType::Merge;
|
return instruction.type == TurnType::Merge;
|
||||||
};
|
};
|
||||||
@ -277,5 +274,4 @@ Intersection triviallyMatchLanesToTurns(Intersection intersection,
|
|||||||
|
|
||||||
} // namespace lane_matching
|
} // namespace lane_matching
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
} // namespace extractor
|
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
@ -17,11 +17,12 @@
|
|||||||
#include "extractor/edge_based_edge.hpp"
|
#include "extractor/edge_based_edge.hpp"
|
||||||
#include "extractor/edge_based_node.hpp"
|
#include "extractor/edge_based_node.hpp"
|
||||||
#include "extractor/files.hpp"
|
#include "extractor/files.hpp"
|
||||||
#include "extractor/original_edge_data.hpp"
|
|
||||||
#include "extractor/packed_osm_ids.hpp"
|
#include "extractor/packed_osm_ids.hpp"
|
||||||
#include "extractor/profile_properties.hpp"
|
#include "extractor/profile_properties.hpp"
|
||||||
#include "extractor/query_node.hpp"
|
#include "extractor/query_node.hpp"
|
||||||
#include "extractor/travel_mode.hpp"
|
#include "extractor/travel_mode.hpp"
|
||||||
|
|
||||||
|
#include "guidance/files.hpp"
|
||||||
#include "guidance/turn_instruction.hpp"
|
#include "guidance/turn_instruction.hpp"
|
||||||
|
|
||||||
#include "partitioner/cell_storage.hpp"
|
#include "partitioner/cell_storage.hpp"
|
||||||
@ -227,11 +228,11 @@ void Storage::PopulateLayout(DataLayout &layout)
|
|||||||
{
|
{
|
||||||
io::FileReader reader(config.GetPath(".osrm.tls"), io::FileReader::VerifyFingerprint);
|
io::FileReader reader(config.GetPath(".osrm.tls"), io::FileReader::VerifyFingerprint);
|
||||||
auto num_offsets = reader.ReadVectorSize<std::uint32_t>();
|
auto num_offsets = reader.ReadVectorSize<std::uint32_t>();
|
||||||
auto num_masks = reader.ReadVectorSize<extractor::guidance::TurnLaneType::Mask>();
|
auto num_masks = reader.ReadVectorSize<extractor::TurnLaneType::Mask>();
|
||||||
|
|
||||||
layout.SetBlockSize<std::uint32_t>(DataLayout::LANE_DESCRIPTION_OFFSETS, num_offsets);
|
layout.SetBlockSize<std::uint32_t>(DataLayout::LANE_DESCRIPTION_OFFSETS, num_offsets);
|
||||||
layout.SetBlockSize<extractor::guidance::TurnLaneType::Mask>(
|
layout.SetBlockSize<extractor::TurnLaneType::Mask>(DataLayout::LANE_DESCRIPTION_MASKS,
|
||||||
DataLayout::LANE_DESCRIPTION_MASKS, num_masks);
|
num_masks);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loading information for original edges
|
// Loading information for original edges
|
||||||
@ -244,8 +245,8 @@ void Storage::PopulateLayout(DataLayout &layout)
|
|||||||
number_of_original_edges);
|
number_of_original_edges);
|
||||||
layout.SetBlockSize<util::guidance::TurnBearing>(DataLayout::POST_TURN_BEARING,
|
layout.SetBlockSize<util::guidance::TurnBearing>(DataLayout::POST_TURN_BEARING,
|
||||||
number_of_original_edges);
|
number_of_original_edges);
|
||||||
layout.SetBlockSize<extractor::guidance::TurnInstruction>(DataLayout::TURN_INSTRUCTION,
|
layout.SetBlockSize<guidance::TurnInstruction>(DataLayout::TURN_INSTRUCTION,
|
||||||
number_of_original_edges);
|
number_of_original_edges);
|
||||||
layout.SetBlockSize<LaneDataID>(DataLayout::LANE_DATA_ID, number_of_original_edges);
|
layout.SetBlockSize<LaneDataID>(DataLayout::LANE_DATA_ID, number_of_original_edges);
|
||||||
layout.SetBlockSize<EntryClassID>(DataLayout::ENTRY_CLASSID, number_of_original_edges);
|
layout.SetBlockSize<EntryClassID>(DataLayout::ENTRY_CLASSID, number_of_original_edges);
|
||||||
}
|
}
|
||||||
@ -661,9 +662,9 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
|||||||
util::vector_view<std::uint32_t> offsets(
|
util::vector_view<std::uint32_t> offsets(
|
||||||
offsets_ptr, layout.num_entries[storage::DataLayout::LANE_DESCRIPTION_OFFSETS]);
|
offsets_ptr, layout.num_entries[storage::DataLayout::LANE_DESCRIPTION_OFFSETS]);
|
||||||
|
|
||||||
auto masks_ptr = layout.GetBlockPtr<extractor::guidance::TurnLaneType::Mask, true>(
|
auto masks_ptr = layout.GetBlockPtr<extractor::TurnLaneType::Mask, true>(
|
||||||
memory_ptr, storage::DataLayout::LANE_DESCRIPTION_MASKS);
|
memory_ptr, storage::DataLayout::LANE_DESCRIPTION_MASKS);
|
||||||
util::vector_view<extractor::guidance::TurnLaneType::Mask> masks(
|
util::vector_view<extractor::TurnLaneType::Mask> masks(
|
||||||
masks_ptr, layout.num_entries[storage::DataLayout::LANE_DESCRIPTION_MASKS]);
|
masks_ptr, layout.num_entries[storage::DataLayout::LANE_DESCRIPTION_MASKS]);
|
||||||
|
|
||||||
extractor::files::readTurnLaneDescriptions(config.GetPath(".osrm.tls"), offsets, masks);
|
extractor::files::readTurnLaneDescriptions(config.GetPath(".osrm.tls"), offsets, masks);
|
||||||
@ -697,10 +698,9 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
|||||||
util::vector_view<LaneDataID> lane_data_ids(
|
util::vector_view<LaneDataID> lane_data_ids(
|
||||||
lane_data_id_ptr, layout.num_entries[storage::DataLayout::LANE_DATA_ID]);
|
lane_data_id_ptr, layout.num_entries[storage::DataLayout::LANE_DATA_ID]);
|
||||||
|
|
||||||
const auto turn_instruction_list_ptr =
|
const auto turn_instruction_list_ptr = layout.GetBlockPtr<guidance::TurnInstruction, true>(
|
||||||
layout.GetBlockPtr<extractor::guidance::TurnInstruction, true>(
|
memory_ptr, storage::DataLayout::TURN_INSTRUCTION);
|
||||||
memory_ptr, storage::DataLayout::TURN_INSTRUCTION);
|
util::vector_view<guidance::TurnInstruction> turn_instructions(
|
||||||
util::vector_view<extractor::guidance::TurnInstruction> turn_instructions(
|
|
||||||
turn_instruction_list_ptr, layout.num_entries[storage::DataLayout::TURN_INSTRUCTION]);
|
turn_instruction_list_ptr, layout.num_entries[storage::DataLayout::TURN_INSTRUCTION]);
|
||||||
|
|
||||||
const auto entry_class_id_list_ptr =
|
const auto entry_class_id_list_ptr =
|
||||||
@ -718,13 +718,13 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
|||||||
util::vector_view<util::guidance::TurnBearing> post_turn_bearings(
|
util::vector_view<util::guidance::TurnBearing> post_turn_bearings(
|
||||||
post_turn_bearing_ptr, layout.num_entries[storage::DataLayout::POST_TURN_BEARING]);
|
post_turn_bearing_ptr, layout.num_entries[storage::DataLayout::POST_TURN_BEARING]);
|
||||||
|
|
||||||
extractor::TurnDataView turn_data(std::move(turn_instructions),
|
guidance::TurnDataView turn_data(std::move(turn_instructions),
|
||||||
std::move(lane_data_ids),
|
std::move(lane_data_ids),
|
||||||
std::move(entry_class_ids),
|
std::move(entry_class_ids),
|
||||||
std::move(pre_turn_bearings),
|
std::move(pre_turn_bearings),
|
||||||
std::move(post_turn_bearings));
|
std::move(post_turn_bearings));
|
||||||
|
|
||||||
extractor::files::readTurnData(config.GetPath(".osrm.edges"), turn_data);
|
guidance::files::readTurnData(config.GetPath(".osrm.edges"), turn_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// load compressed geometry
|
// load compressed geometry
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include "extractor/restriction.hpp"
|
#include "extractor/restriction.hpp"
|
||||||
#include "extractor/serialization.hpp"
|
#include "extractor/serialization.hpp"
|
||||||
|
|
||||||
|
#include "guidance/files.hpp"
|
||||||
|
|
||||||
#include "storage/io.hpp"
|
#include "storage/io.hpp"
|
||||||
|
|
||||||
#include "util/exception.hpp"
|
#include "util/exception.hpp"
|
||||||
|
@ -68,7 +68,7 @@ add_executable(contractor-tests
|
|||||||
add_executable(extractor-tests
|
add_executable(extractor-tests
|
||||||
EXCLUDE_FROM_ALL
|
EXCLUDE_FROM_ALL
|
||||||
${ExtractorTestsSources}
|
${ExtractorTestsSources}
|
||||||
$<TARGET_OBJECTS:EXTRACTOR> $<TARGET_OBJECTS:GUIDANCE> $<TARGET_OBJECTS:UTIL>)
|
$<TARGET_OBJECTS:EXTRACTOR> $<TARGET_OBJECTS:UTIL>)
|
||||||
|
|
||||||
add_executable(partitioner-tests
|
add_executable(partitioner-tests
|
||||||
EXCLUDE_FROM_ALL
|
EXCLUDE_FROM_ALL
|
||||||
@ -150,12 +150,12 @@ target_include_directories(updater-tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
|||||||
target_include_directories(contractor-tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(contractor-tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
target_link_libraries(engine-tests ${ENGINE_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
target_link_libraries(engine-tests ${ENGINE_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||||
target_link_libraries(extractor-tests ${EXTRACTOR_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
target_link_libraries(extractor-tests osrm_extract osrm_guidance ${EXTRACTOR_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||||
target_link_libraries(partitioner-tests ${PARTITIONER_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
target_link_libraries(partitioner-tests ${PARTITIONER_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||||
target_link_libraries(customizer-tests ${CUSTOMIZER_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
target_link_libraries(customizer-tests ${CUSTOMIZER_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||||
target_link_libraries(updater-tests ${UPDATER_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
target_link_libraries(updater-tests ${UPDATER_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||||
target_link_libraries(library-tests osrm ${ENGINE_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
target_link_libraries(library-tests osrm ${ENGINE_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||||
target_link_libraries(library-extract-tests osrm_extract ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
target_link_libraries(library-extract-tests osrm_extract osrm_guidance ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||||
target_link_libraries(library-contract-tests osrm_contract ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
target_link_libraries(library-contract-tests osrm_contract ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||||
target_link_libraries(library-customize-tests osrm_customize ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
target_link_libraries(library-customize-tests osrm_customize ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||||
target_link_libraries(library-partition-tests osrm_partition ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
target_link_libraries(library-partition-tests osrm_partition ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||||
|
@ -15,7 +15,7 @@ BOOST_AUTO_TEST_SUITE(guidance_assembly)
|
|||||||
BOOST_AUTO_TEST_CASE(trim_short_segments)
|
BOOST_AUTO_TEST_CASE(trim_short_segments)
|
||||||
{
|
{
|
||||||
using namespace osrm::extractor;
|
using namespace osrm::extractor;
|
||||||
using namespace osrm::extractor::guidance;
|
using namespace osrm::guidance;
|
||||||
using namespace osrm::engine::guidance;
|
using namespace osrm::engine::guidance;
|
||||||
using namespace osrm::engine;
|
using namespace osrm::engine;
|
||||||
using namespace osrm::util;
|
using namespace osrm::util;
|
||||||
@ -59,7 +59,8 @@ BOOST_AUTO_TEST_CASE(trim_short_segments)
|
|||||||
0},
|
0},
|
||||||
0,
|
0,
|
||||||
3,
|
3,
|
||||||
{intersection1}},
|
{intersection1},
|
||||||
|
false},
|
||||||
{324,
|
{324,
|
||||||
false,
|
false,
|
||||||
"Central Park West",
|
"Central Park West",
|
||||||
@ -81,7 +82,8 @@ BOOST_AUTO_TEST_CASE(trim_short_segments)
|
|||||||
0},
|
0},
|
||||||
2,
|
2,
|
||||||
3,
|
3,
|
||||||
{intersection2}}};
|
{intersection2},
|
||||||
|
false}};
|
||||||
|
|
||||||
LegGeometry geometry;
|
LegGeometry geometry;
|
||||||
geometry.locations = {{FloatLongitude{-73.981492}, FloatLatitude{40.768258}},
|
geometry.locations = {{FloatLongitude{-73.981492}, FloatLatitude{40.768258}},
|
||||||
|
@ -9,7 +9,7 @@ BOOST_AUTO_TEST_SUITE(json_factory)
|
|||||||
BOOST_AUTO_TEST_CASE(instructionTypeToString_test_size)
|
BOOST_AUTO_TEST_CASE(instructionTypeToString_test_size)
|
||||||
{
|
{
|
||||||
using namespace osrm::engine::api::json::detail;
|
using namespace osrm::engine::api::json::detail;
|
||||||
using namespace osrm::extractor::guidance;
|
using namespace osrm::guidance;
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(instructionTypeToString(TurnType::Sliproad), "invalid");
|
BOOST_CHECK_EQUAL(instructionTypeToString(TurnType::Sliproad), "invalid");
|
||||||
}
|
}
|
||||||
|
@ -208,10 +208,9 @@ class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm>
|
|||||||
|
|
||||||
StringView GetDatasourceName(const DatasourceID /*id*/) const override { return StringView{}; }
|
StringView GetDatasourceName(const DatasourceID /*id*/) const override { return StringView{}; }
|
||||||
|
|
||||||
extractor::guidance::TurnInstruction
|
guidance::TurnInstruction GetTurnInstructionForEdgeID(const EdgeID /*id*/) const override
|
||||||
GetTurnInstructionForEdgeID(const EdgeID /*id*/) const override
|
|
||||||
{
|
{
|
||||||
return extractor::guidance::TurnInstruction{};
|
return guidance::TurnInstruction{};
|
||||||
}
|
}
|
||||||
|
|
||||||
extractor::TravelMode GetTravelMode(const NodeID /*id*/) const override
|
extractor::TravelMode GetTravelMode(const NodeID /*id*/) const override
|
||||||
@ -320,7 +319,7 @@ class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm>
|
|||||||
return util::guidance::LaneTupleIdPair{};
|
return util::guidance::LaneTupleIdPair{};
|
||||||
}
|
}
|
||||||
|
|
||||||
extractor::guidance::TurnLaneDescription
|
extractor::TurnLaneDescription
|
||||||
GetTurnDescription(const LaneDescriptionID /*laneDescriptionID*/) const override
|
GetTurnDescription(const LaneDescriptionID /*laneDescriptionID*/) const override
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
BOOST_AUTO_TEST_SUITE(intersection_analysis_tests)
|
BOOST_AUTO_TEST_SUITE(intersection_analysis_tests)
|
||||||
|
|
||||||
using namespace osrm;
|
using namespace osrm;
|
||||||
|
using namespace osrm::guidance;
|
||||||
using namespace osrm::extractor;
|
using namespace osrm::extractor;
|
||||||
using namespace osrm::extractor::guidance;
|
|
||||||
using namespace osrm::extractor::intersection;
|
using namespace osrm::extractor::intersection;
|
||||||
using InputEdge = util::NodeBasedDynamicGraph::InputEdge;
|
using InputEdge = util::NodeBasedDynamicGraph::InputEdge;
|
||||||
using Graph = util::NodeBasedDynamicGraph;
|
using Graph = util::NodeBasedDynamicGraph;
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
#include "contractor/query_edge.hpp"
|
#include "contractor/query_edge.hpp"
|
||||||
#include "extractor/class_data.hpp"
|
#include "extractor/class_data.hpp"
|
||||||
#include "extractor/travel_mode.hpp"
|
#include "extractor/travel_mode.hpp"
|
||||||
|
#include "extractor/turn_lane_types.hpp"
|
||||||
#include "guidance/turn_instruction.hpp"
|
#include "guidance/turn_instruction.hpp"
|
||||||
#include "guidance/turn_lane_types.hpp"
|
|
||||||
|
|
||||||
#include "engine/algorithm.hpp"
|
#include "engine/algorithm.hpp"
|
||||||
#include "engine/datafacade/algorithm_datafacade.hpp"
|
#include "engine/datafacade/algorithm_datafacade.hpp"
|
||||||
@ -90,10 +90,10 @@ class MockBaseDataFacade : public engine::datafacade::BaseDataFacade
|
|||||||
|
|
||||||
StringView GetDatasourceName(const DatasourceID) const override final { return {}; }
|
StringView GetDatasourceName(const DatasourceID) const override final { return {}; }
|
||||||
|
|
||||||
extractor::guidance::TurnInstruction
|
osrm::guidance::TurnInstruction
|
||||||
GetTurnInstructionForEdgeID(const EdgeID /* id */) const override
|
GetTurnInstructionForEdgeID(const EdgeID /* id */) const override
|
||||||
{
|
{
|
||||||
return extractor::guidance::TurnInstruction::NO_TURN();
|
return osrm::guidance::TurnInstruction::NO_TURN();
|
||||||
}
|
}
|
||||||
std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate /* south_west */,
|
std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate /* south_west */,
|
||||||
const util::Coordinate /*north_east */) const override
|
const util::Coordinate /*north_east */) const override
|
||||||
@ -240,7 +240,7 @@ class MockBaseDataFacade : public engine::datafacade::BaseDataFacade
|
|||||||
{
|
{
|
||||||
return {{0, 0}, 0};
|
return {{0, 0}, 0};
|
||||||
}
|
}
|
||||||
extractor::guidance::TurnLaneDescription
|
extractor::TurnLaneDescription
|
||||||
GetTurnDescription(const LaneDescriptionID /*lane_description_id*/) const override final
|
GetTurnDescription(const LaneDescriptionID /*lane_description_id*/) const override final
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
|
Loading…
Reference in New Issue
Block a user