hydrays / osrm-backend

Project OSRM: C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Re: question in wiki section - Memo #2

Open jhljx opened 7 years ago

jhljx commented 7 years ago

@hydrays

In wiki section-Memo

UnpackPath It is in the base Class BasicRoutingInterface. It calls UnpackCHPath with a complex callback function. In the callback function, the second (last) parameter stores a extracted non-shortcut EdgeData. What's the first parameter do? I modified this callback function trying to output edgeid. Two things are outputted: (1) edge_data.id. (2) const auto name_index = facade.GetNameIndexFromEdgeID(edge_data.id); What we want is output 1 to be the node or edge id of the internal edge-based-graph; and (2) to be the road name in the OSM map file.

I've read the Class BasicRoutingInterface. the purpose of the C++ function UnpackCHpath is unpack the contracted edge in CH contracted graph,expand the shortcut to origin route path. The last parameter Callback of UnpackCHpath is a C++ template parameter. The function UnpackPath in BasicRoutingInterface call UnpackCHPath(facade,packed_path_begin,packed_path_end,[this,&facade,&unpacked_path,&phantom_node_pair,&start_traversed_in_reverse,&target_traversed_in_reverse](std::pair<NodeID, NodeID>,const EdgeData &edge_data) {...}.

The function [this,&facade,&unpacked_path,&phantom_node_pair,&start_traversed_in_reverse,&target_traversed_in_reverse](std::pair<NodeID, NodeID>,const EdgeData &edge_data) {...} is a C++ anonymous function.

The first parameter is a NodeID pair, this pair is the origin path in edge-based graph after unpacking from CH contracted shortcut. The second parameter edge_data is the edge information of origin edge(first parameter).

hydrays commented 7 years ago

Thanks! It answers my question. You are welcome to add whatever you want to the wiki to enlarge out knowledgebase.

By the way, you should take a look at the revision I did. Keep in mind that I may be wrong.

https://github.com/hydrays/osrm-backend/commit/baf885a898179a1a42b707130483fb10bff08f02

Best, Yucheng

On 2017年03月02日 07:10, jhljx wrote:

In wiki section-Memo

UnpackPath It is in the base Class BasicRoutingInterface. It calls UnpackCHPath with a complex callback function. In the callback function, the second (last) parameter stores a extracted non-shortcut EdgeData. What's the first parameter do? I modified this callback function trying to output edgeid. Two things are outputted: (1) edge_data.id. (2) const auto name_index = facade.GetNameIndexFromEdgeID(edge_data.id); What we want is output 1 to be the node or edge id of the internal edge-based-graph; and (2) to be the road name in the OSM map file.

I've read the Class BasicRoutingInterface. the purpose of the C++ function UnpackCHpath is unpack the contracted edge in CH contracted graph,expand the shortcut to origin route path. The last parameter Callback of UnpackCHpath is a C++ template parameter. The function UnpackPath in BasicRoutingInterface call UnpackCHPath(facade,packed_path_begin,packed_path_end,[this,&facade,&unpacked_path,&phantom_node_pair,&start_traversed_in_reverse,&target_traversed_in_reverse](std::pair<NodeID, NodeID>,const EdgeData &edge_data) {...}.

The function [this,&facade,&unpacked_path,&phantom_node_pair,&start_traversed_in_reverse,&target_traversed_in_reverse](std::pair<NodeID, NodeID>,const EdgeData &edge_data) {...} is a C++ anonymous function.

The first parameter is a NodeID pair, this pair is the origin path in edge-based graph after unpacking from CH contracted shortcut. The second parameter edge_data is the edge information of origin edge(first parameter).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hydrays/osrm-backend/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/ALNmXXLAxj0qnD_GWeoKAWlpfv3I2p0mks5rhfr5gaJpZM4MQVMN.