Implement re-enabling of PhantomNode directions after bearing filtering
This commit is contained in:
@@ -122,18 +122,30 @@ void EdgeBasedGraphFactory::InsertEdgeBasedNode(const NodeID node_u, const NodeI
|
||||
|
||||
NodeID current_edge_source_coordinate_id = node_u;
|
||||
|
||||
const auto edge_id_to_segment_id = [](const NodeID edge_based_node_id)
|
||||
{
|
||||
if (edge_based_node_id == SPECIAL_NODEID)
|
||||
{
|
||||
return SegmentID{SPECIAL_SEGMENTID, false};
|
||||
}
|
||||
|
||||
return SegmentID{edge_based_node_id, true};
|
||||
};
|
||||
|
||||
// traverse arrays from start and end respectively
|
||||
for (const auto i : util::irange(std::size_t{ 0 }, geometry_size))
|
||||
{
|
||||
BOOST_ASSERT(current_edge_source_coordinate_id ==
|
||||
m_compressed_edge_container.GetBucketReference(
|
||||
edge_id_2)[geometry_size - 1 - i].node_id);
|
||||
BOOST_ASSERT(
|
||||
current_edge_source_coordinate_id ==
|
||||
m_compressed_edge_container.GetBucketReference(edge_id_2)[geometry_size - 1 - i]
|
||||
.node_id);
|
||||
const NodeID current_edge_target_coordinate_id = forward_geometry[i].node_id;
|
||||
BOOST_ASSERT(current_edge_target_coordinate_id != current_edge_source_coordinate_id);
|
||||
|
||||
// build edges
|
||||
m_edge_based_node_list.emplace_back(
|
||||
forward_data.edge_id, reverse_data.edge_id, current_edge_source_coordinate_id,
|
||||
edge_id_to_segment_id(forward_data.edge_id),
|
||||
edge_id_to_segment_id(reverse_data.edge_id), current_edge_source_coordinate_id,
|
||||
current_edge_target_coordinate_id, forward_data.name_id,
|
||||
m_compressed_edge_container.GetPositionForID(edge_id_1),
|
||||
m_compressed_edge_container.GetPositionForID(edge_id_2), false, INVALID_COMPONENTID, i,
|
||||
@@ -208,7 +220,8 @@ unsigned EdgeBasedGraphFactory::RenumberEdges()
|
||||
// oneway streets always require this self-loop. Other streets only if a u-turn plus
|
||||
// traversal
|
||||
// of the street takes longer than the loop
|
||||
m_edge_based_node_weights.push_back(edge_data.distance + profile_properties.u_turn_penalty);
|
||||
m_edge_based_node_weights.push_back(edge_data.distance +
|
||||
profile_properties.u_turn_penalty);
|
||||
|
||||
BOOST_ASSERT(numbered_edges_count < m_node_based_graph->GetNumberOfEdges());
|
||||
edge_data.edge_id = numbered_edges_count;
|
||||
@@ -344,7 +357,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
distance += profile_properties.traffic_signal_penalty;
|
||||
}
|
||||
|
||||
const int turn_penalty = use_turn_function ? GetTurnPenalty(turn_angle, lua_state) : 0;
|
||||
const int turn_penalty =
|
||||
use_turn_function ? GetTurnPenalty(turn_angle, lua_state) : 0;
|
||||
const auto turn_instruction = turn.instruction;
|
||||
|
||||
if (guidance::isUturn(turn_instruction))
|
||||
|
||||
+17
-17
@@ -108,7 +108,7 @@ int Extractor::run()
|
||||
util::SimpleLogger().Write() << "Parsing in progress..";
|
||||
TIMER_START(parsing);
|
||||
|
||||
auto& main_context = scripting_environment.GetContex();
|
||||
auto &main_context = scripting_environment.GetContex();
|
||||
|
||||
// setup raster sources
|
||||
if (util::luaFunctionExists(main_context.state, "source_function"))
|
||||
@@ -163,7 +163,7 @@ int Extractor::run()
|
||||
{
|
||||
ExtractionNode result_node;
|
||||
ExtractionWay result_way;
|
||||
auto& local_context = scripting_environment.GetContex();
|
||||
auto &local_context = scripting_environment.GetContex();
|
||||
|
||||
for (auto x = range.begin(), end = range.end(); x != end; ++x)
|
||||
{
|
||||
@@ -258,7 +258,7 @@ int Extractor::run()
|
||||
// movement (e.g. turn from A->B, and B->A) becomes an edge
|
||||
//
|
||||
|
||||
auto& main_context = scripting_environment.GetContex();
|
||||
auto &main_context = scripting_environment.GetContex();
|
||||
|
||||
util::SimpleLogger().Write() << "Generating edge-expanded graph representation";
|
||||
|
||||
@@ -269,8 +269,7 @@ int Extractor::run()
|
||||
std::vector<bool> node_is_startpoint;
|
||||
std::vector<EdgeWeight> edge_based_node_weights;
|
||||
std::vector<QueryNode> internal_to_external_node_map;
|
||||
auto graph_size = BuildEdgeExpandedGraph(main_context.state,
|
||||
main_context.properties,
|
||||
auto graph_size = BuildEdgeExpandedGraph(main_context.state, main_context.properties,
|
||||
internal_to_external_node_map,
|
||||
edge_based_node_list, node_is_startpoint,
|
||||
edge_based_node_weights, edge_based_edge_list);
|
||||
@@ -317,7 +316,8 @@ int Extractor::run()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Extractor::WriteProfileProperties(const std::string& output_path, const ProfileProperties& properties) const
|
||||
void Extractor::WriteProfileProperties(const std::string &output_path,
|
||||
const ProfileProperties &properties) const
|
||||
{
|
||||
boost::filesystem::ofstream out_stream(output_path);
|
||||
if (!out_stream)
|
||||
@@ -325,7 +325,7 @@ void Extractor::WriteProfileProperties(const std::string& output_path, const Pro
|
||||
throw util::exception("Could not open " + output_path + " for writing.");
|
||||
}
|
||||
|
||||
out_stream.write(reinterpret_cast<const char*>(&properties), sizeof(properties));
|
||||
out_stream.write(reinterpret_cast<const char *>(&properties), sizeof(properties));
|
||||
}
|
||||
|
||||
void Extractor::FindComponents(unsigned max_edge_id,
|
||||
@@ -375,12 +375,12 @@ void Extractor::FindComponents(unsigned max_edge_id,
|
||||
// connect forward and backward nodes of each edge
|
||||
for (const auto &node : input_nodes)
|
||||
{
|
||||
if (node.reverse_edge_based_node_id != SPECIAL_NODEID)
|
||||
if (node.reverse_segment_id.enabled)
|
||||
{
|
||||
BOOST_ASSERT(node.forward_edge_based_node_id <= max_edge_id);
|
||||
BOOST_ASSERT(node.reverse_edge_based_node_id <= max_edge_id);
|
||||
edges.push_back({node.forward_edge_based_node_id, node.reverse_edge_based_node_id, {}});
|
||||
edges.push_back({node.reverse_edge_based_node_id, node.forward_edge_based_node_id, {}});
|
||||
BOOST_ASSERT(node.forward_segment_id.id <= max_edge_id);
|
||||
BOOST_ASSERT(node.reverse_segment_id.id <= max_edge_id);
|
||||
edges.push_back({node.forward_segment_id.id, node.reverse_segment_id.id, {}});
|
||||
edges.push_back({node.reverse_segment_id.id, node.forward_segment_id.id, {}});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,10 +396,10 @@ void Extractor::FindComponents(unsigned max_edge_id,
|
||||
|
||||
for (auto &node : input_nodes)
|
||||
{
|
||||
auto forward_component = component_search.get_component_id(node.forward_edge_based_node_id);
|
||||
BOOST_ASSERT(node.reverse_edge_based_node_id == SPECIAL_EDGEID ||
|
||||
auto forward_component = component_search.get_component_id(node.forward_segment_id.id);
|
||||
BOOST_ASSERT(!node.reverse_segment_id.enabled ||
|
||||
forward_component ==
|
||||
component_search.get_component_id(node.reverse_edge_based_node_id));
|
||||
component_search.get_component_id(node.reverse_segment_id.id));
|
||||
|
||||
const unsigned component_size = component_search.get_component_size(forward_component);
|
||||
node.component.is_tiny = component_size < config.small_component_size;
|
||||
@@ -468,8 +468,8 @@ Extractor::LoadNodeBasedGraph(std::unordered_set<NodeID> &barrier_nodes,
|
||||
\brief Building an edge-expanded graph from node-based input and turn restrictions
|
||||
*/
|
||||
std::pair<std::size_t, std::size_t>
|
||||
Extractor::BuildEdgeExpandedGraph(lua_State* lua_state,
|
||||
const ProfileProperties& profile_properties,
|
||||
Extractor::BuildEdgeExpandedGraph(lua_State *lua_state,
|
||||
const ProfileProperties &profile_properties,
|
||||
std::vector<QueryNode> &internal_to_external_node_map,
|
||||
std::vector<EdgeBasedNode> &node_based_edge_list,
|
||||
std::vector<bool> &node_is_startpoint,
|
||||
|
||||
Reference in New Issue
Block a user