Implement re-enabling of PhantomNode directions after bearing filtering

This commit is contained in:
Patrick Niklaus
2016-03-28 17:06:51 +02:00
parent 5829bbe22d
commit fda4656630
16 changed files with 302 additions and 280 deletions
+10 -10
View File
@@ -56,10 +56,10 @@ void filterCandidates(const std::vector<util::Coordinate> &coordinates,
candidates.begin(), candidates.end(),
[](const PhantomNodeWithDistance &lhs, const PhantomNodeWithDistance &rhs)
{
return lhs.phantom_node.forward_node_id < rhs.phantom_node.forward_node_id ||
(lhs.phantom_node.forward_node_id == rhs.phantom_node.forward_node_id &&
(lhs.phantom_node.reverse_node_id < rhs.phantom_node.reverse_node_id ||
(lhs.phantom_node.reverse_node_id == rhs.phantom_node.reverse_node_id &&
return lhs.phantom_node.forward_segment_id.id < rhs.phantom_node.forward_segment_id.id ||
(lhs.phantom_node.forward_segment_id.id == rhs.phantom_node.forward_segment_id.id &&
(lhs.phantom_node.reverse_segment_id.id < rhs.phantom_node.reverse_segment_id.id ||
(lhs.phantom_node.reverse_segment_id.id == rhs.phantom_node.reverse_segment_id.id &&
lhs.distance < rhs.distance)));
});
@@ -67,8 +67,8 @@ void filterCandidates(const std::vector<util::Coordinate> &coordinates,
candidates.begin(), candidates.end(),
[](const PhantomNodeWithDistance &lhs, const PhantomNodeWithDistance &rhs)
{
return lhs.phantom_node.forward_node_id == rhs.phantom_node.forward_node_id &&
lhs.phantom_node.reverse_node_id == rhs.phantom_node.reverse_node_id;
return lhs.phantom_node.forward_segment_id.id == rhs.phantom_node.forward_segment_id.id &&
lhs.phantom_node.reverse_segment_id.id == rhs.phantom_node.reverse_segment_id.id;
});
candidates.resize(new_end - candidates.begin());
@@ -78,15 +78,15 @@ void filterCandidates(const std::vector<util::Coordinate> &coordinates,
for (const auto i : util::irange<std::size_t>(0, compact_size))
{
// Split edge if it is bidirectional and append reverse direction to end of list
if (candidates[i].phantom_node.forward_node_id != SPECIAL_NODEID &&
candidates[i].phantom_node.reverse_node_id != SPECIAL_NODEID)
if (candidates[i].phantom_node.forward_segment_id.enabled &&
candidates[i].phantom_node.reverse_segment_id.enabled)
{
PhantomNode reverse_node(candidates[i].phantom_node);
reverse_node.forward_node_id = SPECIAL_NODEID;
reverse_node.forward_segment_id.enabled = false;
candidates.push_back(
PhantomNodeWithDistance{reverse_node, candidates[i].distance});
candidates[i].phantom_node.reverse_node_id = SPECIAL_NODEID;
candidates[i].phantom_node.reverse_segment_id.enabled = false;
}
}
}