/
srv
/
osrm
/
osrm-backend
/
include
/
guidance
/
/srv/osrm/osrm-backend/include/guidance
mkdir
upload
Name
Size
Mode
Actions
constants.hpp
1265
0644
edit
dl
rm
driveway_handler.hpp
1540
0644
edit
dl
rm
files.hpp
1996
0644
edit
dl
rm
guidance_processing.hpp
2161
0644
edit
dl
rm
intersection.hpp
4933
0644
edit
dl
rm
intersection_handler.hpp
30075
0644
edit
dl
rm
is_through_street.hpp
2392
0644
edit
dl
rm
motorway_handler.hpp
2229
0644
edit
dl
rm
parsing_toolkit.hpp
3571
0644
edit
dl
rm
roundabout_handler.hpp
3374
0644
edit
dl
rm
roundabout_type.hpp
510
0644
edit
dl
rm
segregated_intersection_classification.hpp
677
0644
edit
dl
rm
serialization.hpp
1966
0644
edit
dl
rm
sliproad_handler.hpp
3683
0644
edit
dl
rm
statistics_handler.hpp
4235
0644
edit
dl
rm
suppress_mode_handler.hpp
1765
0644
edit
dl
rm
turn_analysis.hpp
2838
0644
edit
dl
rm
turn_bearing.hpp
777
0644
edit
dl
rm
turn_classification.hpp
535
0644
edit
dl
rm
turn_data_container.hpp
4326
0644
edit
dl
rm
turn_discovery.hpp
1509
0644
edit
dl
rm
turn_handler.hpp
4137
0644
edit
dl
rm
turn_instruction.hpp
16737
0644
edit
dl
rm
turn_lane_augmentation.hpp
507
0644
edit
dl
rm
turn_lane_data.hpp
1403
0644
edit
dl
rm
turn_lane_handler.hpp
6321
0644
edit
dl
rm
turn_lane_matcher.hpp
2047
0644
edit
dl
rm
Edit:
/srv/osrm/osrm-backend/include/guidance/parsing_toolkit.hpp
(3571B)
#ifndef OSRM_GUIDANCE_PARSING_TOOLKIT_HPP_ #define OSRM_GUIDANCE_PARSING_TOOLKIT_HPP_ #include <cstdint> #include <string> #include <boost/algorithm/string.hpp> #include <boost/tokenizer.hpp> #include "util/attributes.hpp" namespace osrm::extractor::guidance { // Public service vehicle lanes and similar can introduce additional lanes into the lane string that // are not specifically marked for left/right turns. This function can be used from the profile to // trim the lane string appropriately // // left|throught| // in combination with lanes:psv:forward=1 // will be corrected to left|throught, since the final lane is not drivable. // This is in contrast to a situation with lanes:psv:forward=0 (or not set) where left|through| // represents left|through|through OSRM_ATTR_WARN_UNUSED inline std::string trimLaneString(std::string lane_string, std::int32_t count_left, std::int32_t count_right) { if (count_left) { bool sane = count_left < static_cast<std::int32_t>(lane_string.size()); for (std::int32_t i = 0; i < count_left; ++i) // this is adjusted for our fake pipe. The moment cucumber can handle multiple escaped // pipes, the '&' part can be removed if (lane_string[i] != '|') { sane = false; break; } if (sane) { lane_string.erase(lane_string.begin(), lane_string.begin() + count_left); } } if (count_right) { bool sane = count_right < static_cast<std::int32_t>(lane_string.size()); for (auto itr = lane_string.rbegin(); itr != lane_string.rend() && itr != lane_string.rbegin() + count_right; ++itr) { if (*itr != '|') { sane = false; break; } } if (sane) lane_string.resize(lane_string.size() - count_right); } return lane_string; } // https://github.com/Project-OSRM/osrm-backend/issues/2638 // It can happen that some lanes are not drivable by car. Here we handle this tagging scheme // (vehicle:lanes) to filter out not-allowed roads // lanes=3 // turn:lanes=left|through|through|right // vehicle:lanes=yes|yes|no|yes // bicycle:lanes=yes|no|designated|yes OSRM_ATTR_WARN_UNUSED inline std::string applyAccessTokens(std::string lane_string, const std::string &access_tokens) { typedef boost::tokenizer<boost::char_separator<char>> tokenizer; boost::char_separator<char> sep("|", "", boost::keep_empty_tokens); tokenizer tokens(lane_string, sep); tokenizer access(access_tokens, sep); // strings don't match, don't do anything if (std::distance(std::begin(tokens), std::end(tokens)) != std::distance(std::begin(access), std::end(access))) return lane_string; std::string result_string = ""; const static std::string yes = "yes"; for (auto token_itr = std::begin(tokens), access_itr = std::begin(access); token_itr != std::end(tokens); ++token_itr, ++access_itr) { if (*access_itr == yes) { // we have to add this in front, because the next token could be invalid. Doing this on // non-empty strings makes sure that the token string will be valid in the end if (!result_string.empty()) result_string += '|'; result_string += *token_itr; } } return result_string; } } // namespace osrm::extractor::guidance #endif // OSRM_GUIDANCE_PARSING_TOOLKIT_HPP_
Save
cmd:
run