parent
ad5d8c6f9a
commit
94d5bcbf1c
@ -292,9 +292,8 @@ void EdgeBasedGraphFactory::Run(
|
|||||||
//linear number of turns only.
|
//linear number of turns only.
|
||||||
p.reinit(m_node_based_graph->GetNumberOfNodes());
|
p.reinit(m_node_based_graph->GetNumberOfNodes());
|
||||||
for(
|
for(
|
||||||
NodeIterator u = 0,
|
NodeIterator u = 0, end = m_node_based_graph->GetNumberOfNodes();
|
||||||
last_node = m_node_based_graph->GetNumberOfNodes();
|
u < end;
|
||||||
u < last_node;
|
|
||||||
++u
|
++u
|
||||||
) {
|
) {
|
||||||
for(
|
for(
|
||||||
@ -304,9 +303,12 @@ void EdgeBasedGraphFactory::Run(
|
|||||||
++e1
|
++e1
|
||||||
) {
|
) {
|
||||||
++node_based_edge_counter;
|
++node_based_edge_counter;
|
||||||
NodeIterator v = m_node_based_graph->GetTarget(e1);
|
const NodeIterator v = m_node_based_graph->GetTarget(e1);
|
||||||
const bool is_barrier_node = (m_barrier_nodes.find(v) != m_barrier_nodes.end());
|
const NodeID to_node_of_only_restriction = CheckForEmanatingIsOnlyTurn(u, v);
|
||||||
NodeID to_node_of_only_restriction = CheckForEmanatingIsOnlyTurn(u, v);
|
|
||||||
|
|
||||||
|
bool is_barrier_node = ( m_barrier_nodes.find(v) != m_barrier_nodes.end() );
|
||||||
|
|
||||||
for(
|
for(
|
||||||
EdgeIterator e2 = m_node_based_graph->BeginEdges(v),
|
EdgeIterator e2 = m_node_based_graph->BeginEdges(v),
|
||||||
last_edge_v = m_node_based_graph->EndEdges(v);
|
last_edge_v = m_node_based_graph->EndEdges(v);
|
||||||
@ -323,17 +325,27 @@ void EdgeBasedGraphFactory::Run(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( is_barrier_node && (u != w) ) {
|
||||||
|
++skipped_turns_counter;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(u == w && 1 != m_node_based_graph->GetOutDegree(v) ) {
|
if(u == w && 1 != m_node_based_graph->GetOutDegree(v) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !is_barrier_node ) {
|
|
||||||
//only add an edge if turn is not a U-turn except when it is
|
//only add an edge if turn is not a U-turn except when it is
|
||||||
//at the end of a dead-end street
|
//at the end of a dead-end street
|
||||||
if (
|
if (
|
||||||
!CheckIfTurnIsRestricted(u, v, w) ||
|
CheckIfTurnIsRestricted(u, v, w) &&
|
||||||
(to_node_of_only_restriction != UINT_MAX && w == to_node_of_only_restriction)
|
(to_node_of_only_restriction == UINT_MAX) &&
|
||||||
) { //only add an edge if turn is not prohibited
|
(w != to_node_of_only_restriction)
|
||||||
|
) {
|
||||||
|
++skipped_turns_counter;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//only add an edge if turn is not prohibited
|
||||||
const EdgeData edge_data1 = m_node_based_graph->GetEdgeData(e1);
|
const EdgeData edge_data1 = m_node_based_graph->GetEdgeData(e1);
|
||||||
const EdgeData edge_data2 = m_node_based_graph->GetEdgeData(e2);
|
const EdgeData edge_data2 = m_node_based_graph->GetEdgeData(e2);
|
||||||
BOOST_ASSERT(
|
BOOST_ASSERT(
|
||||||
@ -351,8 +363,7 @@ void EdgeBasedGraphFactory::Run(
|
|||||||
if(m_traffic_lights.find(v) != m_traffic_lights.end()) {
|
if(m_traffic_lights.find(v) != m_traffic_lights.end()) {
|
||||||
distance += speed_profile.trafficSignalPenalty;
|
distance += speed_profile.trafficSignalPenalty;
|
||||||
}
|
}
|
||||||
const unsigned penalty =
|
const unsigned penalty = GetTurnPenalty(u, v, w, lua_state);
|
||||||
GetTurnPenalty(u, v, w, lua_state);
|
|
||||||
TurnInstruction turnInstruction = AnalyzeTurn(u, v, w);
|
TurnInstruction turnInstruction = AnalyzeTurn(u, v, w);
|
||||||
if(turnInstruction == TurnInstructions.UTurn){
|
if(turnInstruction == TurnInstructions.UTurn){
|
||||||
distance += speed_profile.uTurnPenalty;
|
distance += speed_profile.uTurnPenalty;
|
||||||
@ -390,10 +401,6 @@ void EdgeBasedGraphFactory::Run(
|
|||||||
false
|
false
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
++skipped_turns_counter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.printIncrement();
|
p.printIncrement();
|
||||||
@ -403,10 +410,7 @@ void EdgeBasedGraphFactory::Run(
|
|||||||
original_edge_data_vector.size()*sizeof(OriginalEdgeData)
|
original_edge_data_vector.size()*sizeof(OriginalEdgeData)
|
||||||
);
|
);
|
||||||
edge_data_file.seekp( std::ios::beg );
|
edge_data_file.seekp( std::ios::beg );
|
||||||
edge_data_file.write(
|
edge_data_file.write( (char*)&original_edges_counter, sizeof(unsigned) );
|
||||||
(char*)&original_edges_counter,
|
|
||||||
sizeof(unsigned)
|
|
||||||
);
|
|
||||||
edge_data_file.close();
|
edge_data_file.close();
|
||||||
|
|
||||||
SimpleLogger().Write() <<
|
SimpleLogger().Write() <<
|
||||||
|
Loading…
Reference in New Issue
Block a user