/
srv
/
osrm
/
osrm-backend
/
include
/
extractor
/
/srv/osrm/osrm-backend/include/extractor
mkdir
upload
Name
Size
Mode
Actions
intersection/
-
0755
rm
class_data.hpp
981
0644
edit
dl
rm
compressed_edge_container.hpp
3336
0644
edit
dl
rm
compressed_node_based_graph_edge.hpp
418
0644
edit
dl
rm
conditional_turn_penalty.hpp
589
0644
edit
dl
rm
datasources.hpp
1207
0644
edit
dl
rm
edge_based_edge.hpp
3467
0644
edit
dl
rm
edge_based_graph_factory.hpp
7787
0644
edit
dl
rm
edge_based_node.hpp
383
0644
edit
dl
rm
edge_based_node_segment.hpp
2050
0644
edit
dl
rm
extraction_containers.hpp
3679
0644
edit
dl
rm
extraction_helper_functions.hpp
4827
0644
edit
dl
rm
extraction_node.hpp
459
0644
edit
dl
rm
extraction_relation.hpp
5949
0644
edit
dl
rm
extraction_segment.hpp
715
0644
edit
dl
rm
extraction_turn.hpp
4983
0644
edit
dl
rm
extraction_way.hpp
4268
0644
edit
dl
rm
extractor.hpp
5267
0644
edit
dl
rm
extractor_callbacks.hpp
3249
0644
edit
dl
rm
extractor_config.hpp
3040
0644
edit
dl
rm
files.hpp
24372
0644
edit
dl
rm
graph_compressor.hpp
1271
0644
edit
dl
rm
internal_extractor_edge.hpp
2642
0644
edit
dl
rm
intersection_bearings_container.hpp
4487
0644
edit
dl
rm
location_dependent_data.hpp
1797
0644
edit
dl
rm
maneuver_override.hpp
5456
0644
edit
dl
rm
maneuver_override_relation_parser.hpp
1785
0644
edit
dl
rm
name_table.hpp
3596
0644
edit
dl
rm
nbg_to_ebg.hpp
450
0644
edit
dl
rm
nodes_of_way.hpp
1411
0644
edit
dl
rm
node_based_edge.hpp
8024
0644
edit
dl
rm
node_based_graph_factory.hpp
5155
0644
edit
dl
rm
node_data_container.hpp
4558
0644
edit
dl
rm
node_restriction_map.hpp
2292
0644
edit
dl
rm
packed_osm_ids.hpp
520
0644
edit
dl
rm
profile_properties.hpp
5029
0644
edit
dl
rm
query_node.hpp
1411
0644
edit
dl
rm
raster_source.hpp
5002
0644
edit
dl
rm
restriction.hpp
1750
0644
edit
dl
rm
restriction_graph.hpp
4500
0644
edit
dl
rm
restriction_parser.hpp
1768
0644
edit
dl
rm
road_classification.hpp
8390
0644
edit
dl
rm
scripting_environment.hpp
2426
0644
edit
dl
rm
scripting_environment_lua.hpp
4253
0644
edit
dl
rm
segment_data_container.hpp
8032
0644
edit
dl
rm
serialization.hpp
8834
0644
edit
dl
rm
suffix_table.hpp
1407
0644
edit
dl
rm
traffic_lights.hpp
514
0644
edit
dl
rm
traffic_signals.hpp
656
0644
edit
dl
rm
travel_mode.hpp
3666
0644
edit
dl
rm
turn_lane_types.hpp
3754
0644
edit
dl
rm
turn_path.hpp
7483
0644
edit
dl
rm
turn_path_compressor.hpp
2220
0644
edit
dl
rm
turn_path_filter.hpp
669
0644
edit
dl
rm
way_restriction_map.hpp
3114
0644
edit
dl
rm
Edit:
/srv/osrm/osrm-backend/include/extractor/turn_path.hpp
(7483B)
#ifndef OSRM_TURN_PATH_HPP #define OSRM_TURN_PATH_HPP #include "util/typedefs.hpp" #include <algorithm> #include <mapbox/variant.hpp> #include <vector> namespace osrm::extractor { // Outside view of the variant, these are equal to the `which()` results enum TurnPathType { VIA_NODE_TURN_PATH = 0, VIA_WAY_TURN_PATH = 1, NUM_TURN_PATH_TYPES = 2 }; // OSM turn restrictions and maneuver overrides are relations that use the same path // representation. Therefore, we can represent these paths by a shared, common structure. // // from: the way from which the turn sequence begins // via: a node or list of ways, representing the intermediate path taken in the turn sequence // to: the final way in the turn sequence // // We will have two representations of the paths, via-node and via-way, to represent the two options // for the intermediate path. We parse both into the same input container // // A path turning at a single node. This is the most common type of relation: // // a - b - c // | // d // // ab via b to bd struct InputViaNodePath { OSMWayID from; OSMNodeID via; OSMWayID to; }; // A turn path that uses one or more via-way in between // // e - f - g // | // d // | // a - b - c // // ab via bd,df to fe struct InputViaWayPath { OSMWayID from; std::vector<OSMWayID> via; OSMWayID to; }; struct InputTurnPath { mapbox::util::variant<InputViaNodePath, InputViaWayPath> node_or_way; TurnPathType Type() const { BOOST_ASSERT(node_or_way.which() < TurnPathType::NUM_TURN_PATH_TYPES); return static_cast<TurnPathType>(node_or_way.which()); } OSMWayID From() const { return node_or_way.which() == TurnPathType::VIA_NODE_TURN_PATH ? mapbox::util::get<InputViaNodePath>(node_or_way).from : mapbox::util::get<InputViaWayPath>(node_or_way).from; } OSMWayID To() const { return node_or_way.which() == TurnPathType::VIA_NODE_TURN_PATH ? mapbox::util::get<InputViaNodePath>(node_or_way).to : mapbox::util::get<InputViaWayPath>(node_or_way).to; } InputViaWayPath &AsViaWayPath() { BOOST_ASSERT(node_or_way.which() == TurnPathType::VIA_WAY_TURN_PATH); return mapbox::util::get<InputViaWayPath>(node_or_way); } const InputViaWayPath &AsViaWayPath() const { BOOST_ASSERT(node_or_way.which() == TurnPathType::VIA_WAY_TURN_PATH); return mapbox::util::get<InputViaWayPath>(node_or_way); } InputViaNodePath &AsViaNodePath() { BOOST_ASSERT(node_or_way.which() == TurnPathType::VIA_NODE_TURN_PATH); return mapbox::util::get<InputViaNodePath>(node_or_way); } const InputViaNodePath &AsViaNodePath() const { BOOST_ASSERT(node_or_way.which() == TurnPathType::VIA_NODE_TURN_PATH); return mapbox::util::get<InputViaNodePath>(node_or_way); } }; // Internally, we convert the turn paths into a node-based-node representation. // This allows us to correctly track the edges as they processed, such as during graph compression. // Having access to the nodes directly allows look-up of the edges in the processed structures, // and can be utilised during edge-based-graph generation. // // Once again, we keep two representations of the paths, via-node and via-way, for more efficient // representation of the more common via-node path. // // a - b - c // | // d // // a via b to d struct ViaNodePath { NodeID from; NodeID via; NodeID to; // check if all parts of the restriction reference an actual node bool Valid() const { return from != SPECIAL_NODEID && to != SPECIAL_NODEID && via != SPECIAL_NODEID; }; bool operator==(const ViaNodePath &other) const { return std::tie(from, via, to) == std::tie(other.from, other.via, other.to); } }; // // // e - f - g // | // d // | // a - b - c // // a via bdf to e // (after compression) a via bf to e struct ViaWayPath { // A way path in OSRM needs to track all nodes that make up the via ways. Whilst most // of these nodes will be removed by compression, some nodes will contain features that need to // be considered when routing (e.g. intersections, nested restrictions, etc). NodeID from; std::vector<NodeID> via; NodeID to; // check if all parts of the path reference an actual node bool Valid() const { return from != SPECIAL_NODEID && to != SPECIAL_NODEID && via.size() >= 2 && std::all_of(via.begin(), via.end(), [](NodeID i) { return i != SPECIAL_NODEID; }); }; bool operator==(const ViaWayPath &other) const { return std::tie(from, via, to) == std::tie(other.from, other.via, other.to); } }; // Wrapper for turn paths that gives more information on its type / handles the switch // between node/way paths struct TurnPath { mapbox::util::variant<ViaNodePath, ViaWayPath> node_or_way; NodeID To() const { return node_or_way.which() == TurnPathType::VIA_NODE_TURN_PATH ? mapbox::util::get<ViaNodePath>(node_or_way).to : mapbox::util::get<ViaWayPath>(node_or_way).to; } NodeID From() const { return node_or_way.which() == TurnPathType::VIA_NODE_TURN_PATH ? mapbox::util::get<ViaNodePath>(node_or_way).from : mapbox::util::get<ViaWayPath>(node_or_way).from; } NodeID FirstVia() const { if (node_or_way.which() == TurnPathType::VIA_NODE_TURN_PATH) { return mapbox::util::get<ViaNodePath>(node_or_way).via; } else { BOOST_ASSERT(!mapbox::util::get<ViaWayPath>(node_or_way).via.empty()); return mapbox::util::get<ViaWayPath>(node_or_way).via[0]; } } ViaWayPath &AsViaWayPath() { BOOST_ASSERT(node_or_way.which() == TurnPathType::VIA_WAY_TURN_PATH); return mapbox::util::get<ViaWayPath>(node_or_way); } const ViaWayPath &AsViaWayPath() const { BOOST_ASSERT(node_or_way.which() == TurnPathType::VIA_WAY_TURN_PATH); return mapbox::util::get<ViaWayPath>(node_or_way); } ViaNodePath &AsViaNodePath() { BOOST_ASSERT(node_or_way.which() == TurnPathType::VIA_NODE_TURN_PATH); return mapbox::util::get<ViaNodePath>(node_or_way); } const ViaNodePath &AsViaNodePath() const { BOOST_ASSERT(node_or_way.which() == TurnPathType::VIA_NODE_TURN_PATH); return mapbox::util::get<ViaNodePath>(node_or_way); } TurnPathType Type() const { BOOST_ASSERT(node_or_way.which() < TurnPathType::NUM_TURN_PATH_TYPES); return static_cast<TurnPathType>(node_or_way.which()); } bool operator==(const TurnPath &other) const { if (Type() != other.Type()) return false; if (Type() == TurnPathType::VIA_WAY_TURN_PATH) { return AsViaWayPath() == other.AsViaWayPath(); } else { return AsViaNodePath() == other.AsViaNodePath(); } } bool Valid() const { if (Type() == TurnPathType::VIA_WAY_TURN_PATH) { return AsViaWayPath().Valid(); } else { return AsViaNodePath().Valid(); } }; }; } // namespace osrm::extractor #endif // OSRM_TURN_PATH_HPP
Save
cmd:
run