unpacking target correctly, also partial unpacking origin and destination are on the very same packed edge

This commit is contained in:
Dennis Luxen
2014-03-03 18:47:34 +01:00
parent eca09e6c81
commit 6b91d6692f
6 changed files with 54 additions and 21 deletions
+7 -1
View File
@@ -292,12 +292,17 @@ public:
// SimpleLogger().Write(logDEBUG) << "packed_shortest_path.back(): " << packed_shortest_path.back();
super::UnpackPath(
// -- packed input
packed_shortest_path,
// -- start of route
phantom_node_pair.startPhantom.packed_geometry_id,
phantom_node_pair.startPhantom.fwd_segment_position,
(packed_shortest_path.front() != phantom_node_pair.startPhantom.forward_node_id),
// -- end of route
phantom_node_pair.targetPhantom.packed_geometry_id,
phantom_node_pair.targetPhantom.fwd_segment_position,
(packed_shortest_path.back() != phantom_node_pair.targetPhantom.forward_node_id),
// -- unpacked output
raw_route_data.unpacked_path_segments.front()
);
raw_route_data.lengthOfShortestPath = upper_bound_to_shortest_path_distance;
@@ -361,7 +366,8 @@ private:
// unpack, supply correct offsets to packed start and end nodes.
super::UnpackPath(
packed_s_v_path,
0, false, SPECIAL_EDGEID, 0, false, //TODO: replace by real offsets
SPECIAL_EDGEID, 0, false, //TODO: replace with actual data
SPECIAL_EDGEID, 0, false, //TODO: replace with actual data
unpacked_path
);
}
+11 -2
View File
@@ -140,6 +140,7 @@ public:
//TODO: refactor parameters to only edge ids for start and end
inline void UnpackPath(
const std::vector<NodeID> & packed_path,
const unsigned packed_geometry_id_of_first_edge,
const int fwd_index_offset,
const bool start_traversed_in_reverse,
const unsigned packed_geometry_id_of_last_edge,
@@ -255,10 +256,18 @@ public:
}
if(SPECIAL_EDGEID != packed_geometry_id_of_last_edge) {
SimpleLogger().Write(logDEBUG) << "unpacking last segment " << packed_geometry_id_of_last_edge;
SimpleLogger().Write(logDEBUG) << "target_traversed_in_reverse: " << (target_traversed_in_reverse ? "y" : "n");
std::vector<unsigned> id_vector;
facade->GetUncompressedGeometry(packed_geometry_id_of_last_edge, id_vector);
const int start_index = 0;
const int end_index = rev_index_offset;
if( target_traversed_in_reverse ) {
std::reverse(id_vector.begin(), id_vector.end() );
}
SimpleLogger().Write(logDEBUG) << "id_vector.size() " << id_vector.size();
const bool start_and_end_on_same_edge = (packed_geometry_id_of_first_edge == packed_geometry_id_of_last_edge) && unpacked_path.empty();
const int start_index = ( start_and_end_on_same_edge ? id_vector.size() - fwd_index_offset : 0 );
const int end_index = (target_traversed_in_reverse ? id_vector.size() - rev_index_offset : rev_index_offset);
SimpleLogger().Write(logDEBUG) << "fetching from [" << start_index << "," << end_index << "]";
BOOST_ASSERT( start_index >= 0 );
BOOST_ASSERT( start_index <= end_index );
+1 -2
View File
@@ -364,8 +364,7 @@ public:
BOOST_ASSERT(packed_legs1.size() == raw_route_data.unpacked_path_segments.size() );
super::UnpackPath(
packed_legs1[i],
( at_beginning ? start_offset : 0),
false,
SPECIAL_EDGEID, ( at_beginning ? start_offset : 0), false,
SPECIAL_EDGEID, 0, false,
raw_route_data.unpacked_path_segments[i]
);