unpacking of target segment works
This commit is contained in:
@@ -288,14 +288,16 @@ public:
|
||||
|
||||
SimpleLogger().Write(logDEBUG) << "phantom_node_pair.startPhantom.forward_node_id: " << phantom_node_pair.startPhantom.forward_node_id;
|
||||
SimpleLogger().Write(logDEBUG) << "phantom_node_pair.startPhantom.reverse_node_id: " << phantom_node_pair.startPhantom.reverse_node_id;
|
||||
SimpleLogger().Write(logDEBUG) << "packed_shortest_path.front(): " << packed_shortest_path.front();
|
||||
SimpleLogger().Write(logDEBUG) << "phantom_node_pair.targetPhantom.packed_geometry_id: " << phantom_node_pair.targetPhantom.packed_geometry_id;
|
||||
// SimpleLogger().Write(logDEBUG) << "packed_shortest_path.back(): " << packed_shortest_path.back();
|
||||
|
||||
super::UnpackPath(
|
||||
packed_shortest_path,
|
||||
phantom_node_pair.startPhantom.fwd_segment_position,
|
||||
(packed_shortest_path.front() != phantom_node_pair.startPhantom.forward_node_id),
|
||||
phantom_node_pair.targetPhantom.fwd_segment_position,//( packed_forward_path.back() == phantom_node_pair.targetPhantom.forward_node_id ? 1 : -1 )*phantom_node_pair.targetPhantom.fwd_segment_position,
|
||||
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),
|
||||
raw_route_data.unpacked_path_segments.front()
|
||||
);
|
||||
raw_route_data.lengthOfShortestPath = upper_bound_to_shortest_path_distance;
|
||||
@@ -359,7 +361,7 @@ private:
|
||||
// unpack, supply correct offsets to packed start and end nodes.
|
||||
super::UnpackPath(
|
||||
packed_s_v_path,
|
||||
0, false, 0, //TODO: replace by real offsets
|
||||
0, false, SPECIAL_EDGEID, 0, false, //TODO: replace by real offsets
|
||||
unpacked_path
|
||||
);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
) const {
|
||||
const NodeID node = forward_heap.DeleteMin();
|
||||
const int distance = forward_heap.GetKey(node);
|
||||
SimpleLogger().Write() << (forward_direction ? "fwd" : "rev") << " settled (" << forward_heap.GetData( node ).parent << "," << node << ")=" << distance;
|
||||
// SimpleLogger().Write() << (forward_direction ? "fwd" : "rev") << " settled (" << forward_heap.GetData( node ).parent << "," << node << ")=" << distance;
|
||||
if(reverse_heap.WasInserted(node) ){
|
||||
const int new_distance = reverse_heap.GetKey(node) + distance;
|
||||
if(new_distance < *upper_bound ){
|
||||
@@ -136,11 +136,15 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//TODO: refactor parameters to only edge ids for start and end
|
||||
inline void UnpackPath(
|
||||
const std::vector<NodeID> & packed_path,
|
||||
int fwd_index_offset,
|
||||
bool start_traversed_in_reverse,
|
||||
int rev_index_offset,
|
||||
const int fwd_index_offset,
|
||||
const bool start_traversed_in_reverse,
|
||||
const unsigned packed_geometry_id_of_last_edge,
|
||||
const int rev_index_offset,
|
||||
const bool target_traversed_in_reverse,
|
||||
std::vector<PathData> & unpacked_path
|
||||
) const {
|
||||
const unsigned packed_path_size = packed_path.size();
|
||||
@@ -223,7 +227,7 @@ public:
|
||||
);
|
||||
} else {
|
||||
std::vector<unsigned> id_vector;
|
||||
facade->GetUncompressedGeometry(ed.id, id_vector);
|
||||
facade->GetUncompressedGeometry(facade->GetGeometryIndexForEdgeID(ed.id), id_vector);
|
||||
|
||||
const int start_index = ( unpacked_path.empty() ? ( ( start_traversed_in_reverse ) ? id_vector.size() - fwd_index_offset - 1 : fwd_index_offset ) : 0 );
|
||||
const int end_index = id_vector.size();
|
||||
@@ -249,6 +253,31 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
if(SPECIAL_EDGEID != packed_geometry_id_of_last_edge) {
|
||||
SimpleLogger().Write(logDEBUG) << "unpacking last segment " << packed_geometry_id_of_last_edge;
|
||||
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;
|
||||
|
||||
BOOST_ASSERT( start_index >= 0 );
|
||||
BOOST_ASSERT( start_index <= end_index );
|
||||
for(
|
||||
unsigned i = start_index;
|
||||
i < end_index;
|
||||
++i
|
||||
) {
|
||||
SimpleLogger().Write(logDEBUG) << facade->GetCoordinateOfNode(id_vector[i]);
|
||||
unpacked_path.push_back(
|
||||
PathData(
|
||||
id_vector[i],
|
||||
0,
|
||||
TurnInstructionsClass::NoTurn,
|
||||
0
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void UnpackEdge(
|
||||
@@ -330,8 +359,7 @@ public:
|
||||
current_node_id = forward_heap.GetData(current_node_id).parent;
|
||||
packed_path.push_back(current_node_id);
|
||||
}
|
||||
//throw away first segment, unpack individually
|
||||
|
||||
SimpleLogger().Write() << "parent of last node. " << forward_heap.GetData(current_node_id).parent;
|
||||
std::reverse(packed_path.begin(), packed_path.end());
|
||||
packed_path.push_back(middle_node_id);
|
||||
current_node_id = middle_node_id;
|
||||
@@ -340,7 +368,7 @@ public:
|
||||
packed_path.push_back(current_node_id);
|
||||
}
|
||||
|
||||
|
||||
SimpleLogger().Write(logDEBUG) << "packed path";
|
||||
BOOST_FOREACH(NodeID node, packed_path) {
|
||||
SimpleLogger().Write(logDEBUG) << "node: " << node;
|
||||
}
|
||||
|
||||
@@ -365,8 +365,8 @@ public:
|
||||
super::UnpackPath(
|
||||
packed_legs1[i],
|
||||
( at_beginning ? start_offset : 0),
|
||||
0,
|
||||
false,
|
||||
SPECIAL_EDGEID, 0, false,
|
||||
raw_route_data.unpacked_path_segments[i]
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user