uncompressed edges get serialized correctly'ish

This commit is contained in:
Dennis Luxen 2014-02-18 19:26:57 +01:00
parent ba0b664e3f
commit f7d5b0db9c
12 changed files with 349 additions and 193 deletions

View File

@ -34,6 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include <fstream> #include <fstream>
#include <iomanip>
EdgeBasedGraphFactory::EdgeBasedGraphFactory( EdgeBasedGraphFactory::EdgeBasedGraphFactory(
int number_of_nodes, int number_of_nodes,
@ -85,10 +86,15 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(
traffic_light_node_list.end() traffic_light_node_list.end()
); );
DeallocatingVector< NodeBasedEdge > edges_list; std::sort( input_edge_list.begin(), input_edge_list.end() );
//TODO: remove duplicate edges
DeallocatingVector<NodeBasedEdge> edges_list;
NodeBasedEdge edge; NodeBasedEdge edge;
BOOST_FOREACH(const ImportEdge & import_edge, input_edge_list) { BOOST_FOREACH(const ImportEdge & import_edge, input_edge_list) {
if(!import_edge.isForward()) {
if( !import_edge.isForward() ) {
edge.source = import_edge.target(); edge.source = import_edge.target();
edge.target = import_edge.source(); edge.target = import_edge.source();
edge.data.backward = import_edge.isForward(); edge.data.backward = import_edge.isForward();
@ -99,7 +105,8 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(
edge.data.forward = import_edge.isForward(); edge.data.forward = import_edge.isForward();
edge.data.backward = import_edge.isBackward(); edge.data.backward = import_edge.isBackward();
} }
if(edge.source == edge.target) {
if( edge.source == edge.target ) {
continue; continue;
} }
@ -114,11 +121,21 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(
edge.data.contraFlow = import_edge.isContraFlow(); edge.data.contraFlow = import_edge.isContraFlow();
edges_list.push_back( edge ); edges_list.push_back( edge );
std::swap( edge.source, edge.target ); if( !import_edge.IsSplit() ) {
using std::swap; //enable ADL
swap( edge.source, edge.target );
edge.data.SwapDirectionFlags(); edge.data.SwapDirectionFlags();
edges_list.push_back( edge ); edges_list.push_back( edge );
} }
// if( import_edge.source() == 150903 || import_edge.target() == 150903 ) {
// SimpleLogger().Write(logDEBUG) << "[" << edges_list.size() << "] (" << import_edge.source() << "," << import_edge.target() << "), w: " << import_edge.weight();
// if( import_edge.IsSplit() ) {
// SimpleLogger().Write(logDEBUG) << "edge split: (" << import_edge.source() << "," << import_edge.target() << ")";
// }
// }
}
std::vector<ImportEdge>().swap(input_edge_list); std::vector<ImportEdge>().swap(input_edge_list);
std::sort( edges_list.begin(), edges_list.end() ); std::sort( edges_list.begin(), edges_list.end() );
@ -267,31 +284,64 @@ bool EdgeBasedGraphFactory::CheckIfTurnIsRestricted(
void EdgeBasedGraphFactory::InsertEdgeBasedNode( void EdgeBasedGraphFactory::InsertEdgeBasedNode(
NodeIterator u, NodeIterator u,
NodeIterator v, NodeIterator v,
EdgeIterator e1,
bool belongs_to_tiny_cc bool belongs_to_tiny_cc
) { ) {
// merge edges together into one EdgeBasedNode // merge edges together into one EdgeBasedNode
BOOST_ASSERT( u != std::numeric_limits<unsigned>::max() ); BOOST_ASSERT( u != SPECIAL_NODEID );
BOOST_ASSERT( v != std::numeric_limits<unsigned>::max() ); BOOST_ASSERT( v != SPECIAL_NODEID );
BOOST_ASSERT( e1 != SPECIAL_EDGEID );
// find forward edge id and // find forward edge id and
const EdgeID e1 = m_node_based_graph->FindEdge(u, v); // const EdgeID e1 = m_node_based_graph->FindEdge(u, v);
BOOST_ASSERT( e1 != std::numeric_limits<unsigned>::max() ); BOOST_ASSERT( e1 != std::numeric_limits<unsigned>::max() );
const EdgeData & forward_data = m_node_based_graph->GetEdgeData(e1); const EdgeData & forward_data = m_node_based_graph->GetEdgeData(e1);
if( forward_data.edgeBasedNodeID == std::numeric_limits<unsigned>::max() ) {
for(EdgeIterator id = m_node_based_graph->BeginEdges(v); id < m_node_based_graph->EndEdges(v); ++id) {
SimpleLogger().Write(logDEBUG) << " id: " << id << ", edge (" << v << "," << m_node_based_graph->GetTarget(id) << ")";
}
SimpleLogger().Write() << "e1: " << e1 << "u: " << u << ", v: " << v;
SimpleLogger().Write() << std::setprecision(6) << m_node_info_list[u].lat/COORDINATE_PRECISION << "," << m_node_info_list[u].lon/COORDINATE_PRECISION << " <-> " <<
m_node_info_list[v].lat/COORDINATE_PRECISION << "," << m_node_info_list[v].lon/COORDINATE_PRECISION;
}
BOOST_ASSERT( forward_data.edgeBasedNodeID != std::numeric_limits<unsigned>::max() );
if( forward_data.ignore_in_grid ) { if( forward_data.ignore_in_grid ) {
// SimpleLogger().Write(logDEBUG) << "skipped edge at " << m_node_info_list[u].lat << "," << // SimpleLogger().Write(logDEBUG) << "skipped edge at " << m_node_info_list[u].lat << "," <<
// m_node_info_list[u].lon << " - " << // m_node_info_list[u].lon << " - " <<
// m_node_info_list[v].lat << "," << // m_node_info_list[v].lat << "," <<
// m_node_info_list[v].lon; // m_node_info_list[v].lon;
return; return;
} }
BOOST_ASSERT( forward_data.forward );
// find reverse edge id and // find reverse edge id and
const EdgeID e2 = m_node_based_graph->FindEdge(v, u); const EdgeID e2 = m_node_based_graph->FindEdge(v, u);
if ( e2 == m_node_based_graph->EndEdges(v) ) {
SimpleLogger().Write(logDEBUG) << "Did not find edge (" << v << "," << u << ")";
}
BOOST_ASSERT( e2 != std::numeric_limits<unsigned>::max() ); BOOST_ASSERT( e2 != std::numeric_limits<unsigned>::max() );
BOOST_ASSERT( e2 < m_node_based_graph->EndEdges(v) );
const EdgeData & reverse_data = m_node_based_graph->GetEdgeData(e2); const EdgeData & reverse_data = m_node_based_graph->GetEdgeData(e2);
// if( forward_data.forward == reverse_data.forward && forward_data.forward != forward_data.backward ) {
// SimpleLogger().Write(logDEBUG) << "flags on edge (" << u << "," << v << "), e1: " << e1 << ", e2: " << e2;
// SimpleLogger().Write(logDEBUG) << "fwd-fwd: " << (forward_data.forward ? "y" : "n");
// SimpleLogger().Write(logDEBUG) << "fwd-rev: " << (forward_data.backward ? "y": "n");
// SimpleLogger().Write(logDEBUG) << "rev-fwd: " << (reverse_data.forward ? "y" : "n");
// SimpleLogger().Write(logDEBUG) << "rev-rev: " << (reverse_data.backward ? "y": "n");
// SimpleLogger().Write(logDEBUG) << "outgoing edges to ";
// for(EdgeIterator id = m_node_based_graph->BeginEdges(v); id < m_node_based_graph->EndEdges(v); ++id) {
// SimpleLogger().Write(logDEBUG) << " id: " << id << ", edge (" << v << "," << m_node_based_graph->GetTarget(id) << ")";
// }
// BOOST_ASSERT( reverse_data.edgeBasedNodeID != std::numeric_limits<unsigned>::max() );
// } else {
// BOOST_ASSERT( reverse_data.edgeBasedNodeID == std::numeric_limits<unsigned>::max() );
// }
if( m_geometry_compressor.HasEntryForID(e1) ) { if( m_geometry_compressor.HasEntryForID(e1) ) {
BOOST_ASSERT( m_geometry_compressor.HasEntryForID(e2) ); BOOST_ASSERT( m_geometry_compressor.HasEntryForID(e2) );
@ -300,34 +350,96 @@ void EdgeBasedGraphFactory::InsertEdgeBasedNode(
const std::vector<GeometryCompressor::CompressedNode> & reverse_geometry = m_geometry_compressor.GetBucketReference(e2); const std::vector<GeometryCompressor::CompressedNode> & reverse_geometry = m_geometry_compressor.GetBucketReference(e2);
BOOST_ASSERT( forward_geometry.size() == reverse_geometry.size() ); BOOST_ASSERT( forward_geometry.size() == reverse_geometry.size() );
BOOST_ASSERT( 0 != forward_geometry.size() ); BOOST_ASSERT( 0 != forward_geometry.size() );
for( unsigned i = 0; i < reverse_geometry.size(); ++i ) { // for( unsigned i = 0; i < reverse_geometry.size(); ++i ) {
if( forward_geometry[i].first != reverse_geometry[reverse_geometry.size()-1-i].first ) { // if( forward_geometry[i].first != reverse_geometry.back().first ) {
#ifndef NDEBUG // #ifndef NDEBUG
//Dumps debug information when data is borked // //Dumps debug information when data is borked
SimpleLogger().Write() << "size1: " << forward_geometry.size() << ", size2: " << reverse_geometry.size(); // SimpleLogger().Write() << "size1: " << forward_geometry.size() << ", size2: " << reverse_geometry.size();
SimpleLogger().Write() << "index1: " << i << ", index2: " << reverse_geometry.size()-1-i; // SimpleLogger().Write() << "index1: " << i << ", index2: " << reverse_geometry.size()-1-i;
SimpleLogger().Write() << forward_geometry[0].first << "!=" << reverse_geometry[reverse_geometry.size()-1-i].first; // SimpleLogger().Write() << forward_geometry[0].first << "!=" << reverse_geometry[reverse_geometry.size()-1-i].first;
BOOST_FOREACH(const GeometryCompressor::CompressedNode geometry_node, forward_geometry) { // BOOST_FOREACH(const GeometryCompressor::CompressedNode geometry_node, forward_geometry) {
SimpleLogger().Write(logDEBUG) << "fwd node " << geometry_node.first << "," << m_node_info_list[geometry_node.first].lat/COORDINATE_PRECISION << "," << m_node_info_list[geometry_node.first].lon/COORDINATE_PRECISION; // SimpleLogger().Write(logDEBUG) << "fwd node " << geometry_node.first << "," << m_node_info_list[geometry_node.first].lat/COORDINATE_PRECISION << "," << m_node_info_list[geometry_node.first].lon/COORDINATE_PRECISION;
} // }
BOOST_FOREACH(const GeometryCompressor::CompressedNode geometry_node, reverse_geometry) { // BOOST_FOREACH(const GeometryCompressor::CompressedNode geometry_node, reverse_geometry) {
SimpleLogger().Write(logDEBUG) << "rev node " << geometry_node.first << "," << m_node_info_list[geometry_node.first].lat/COORDINATE_PRECISION << "," << m_node_info_list[geometry_node.first].lon/COORDINATE_PRECISION; // SimpleLogger().Write(logDEBUG) << "rev node " << geometry_node.first << "," << m_node_info_list[geometry_node.first].lat/COORDINATE_PRECISION << "," << m_node_info_list[geometry_node.first].lon/COORDINATE_PRECISION;
} // }
#endif // #endif
} // }
BOOST_ASSERT( forward_geometry[i].first == reverse_geometry[reverse_geometry.size()-1-i].first ); // BOOST_ASSERT( forward_geometry[i].first == reverse_geometry[reverse_geometry.size()-1-i].first );
// }
//TODO reconstruct bidirectional edge with weights. //TODO reconstruct bidirectional edge with weights.
int fwd_sum_of_weights = 0;
NodeID fwd_start_node = u;
// SimpleLogger().Write(logDEBUG) << "fwd node " << "weight" << "," << m_node_info_list[u].lat/COORDINATE_PRECISION << "," << m_node_info_list[u].lon/COORDINATE_PRECISION;
SimpleLogger().Write(logDEBUG) << "fwd edge id: " << e1;
BOOST_FOREACH(const GeometryCompressor::CompressedNode geometry_node, forward_geometry) {
NodeID fwd_end_node = geometry_node.first;
EdgeWeight fwd_weight = geometry_node.second;
// SimpleLogger().Write(logDEBUG) << "fwd node " << geometry_node.first << "," << m_node_info_list[geometry_node.first].lat/COORDINATE_PRECISION << "," << m_node_info_list[geometry_node.first].lon/COORDINATE_PRECISION << ", w: " << geometry_node.second;
fwd_sum_of_weights += geometry_node.second;
SimpleLogger().Write(logDEBUG) << "fwd-edge (" << fwd_start_node << "," << fwd_end_node << "), w: " << fwd_weight;
fwd_start_node = fwd_end_node;
} }
SimpleLogger().Write(logDEBUG) << "fwd-edge (" << fwd_start_node << "," << v << "), w: " << (forward_data.distance - fwd_sum_of_weights);
// SimpleLogger().Write(logDEBUG) << "fwd node " << "weight" << "," << m_node_info_list[v].lat/COORDINATE_PRECISION << "," << m_node_info_list[v].lon/COORDINATE_PRECISION;
// SimpleLogger().Write(logDEBUG) << "rev node " << "weight" << "," << m_node_info_list[v].lat/COORDINATE_PRECISION << "," << m_node_info_list[v].lon/COORDINATE_PRECISION;
// BOOST_FOREACH(const GeometryCompressor::CompressedNode geometry_node, reverse_geometry) {
// SimpleLogger().Write(logDEBUG) << "rev node " << geometry_node.first << "," << m_node_info_list[geometry_node.first].lat/COORDINATE_PRECISION << "," << m_node_info_list[geometry_node.first].lon/COORDINATE_PRECISION;
// }
// SimpleLogger().Write(logDEBUG) << "rev node " << "weight" << "," << m_node_info_list[u].lat/COORDINATE_PRECISION << "," << m_node_info_list[u].lon/COORDINATE_PRECISION;
SimpleLogger().Write(logDEBUG) << "fwd sum of edge weights: " << fwd_sum_of_weights;
SimpleLogger().Write(logDEBUG) << "c'ted edge weight: " << forward_data.distance;
SimpleLogger().Write(logDEBUG) << "weight diff: " << (forward_data.distance - fwd_sum_of_weights);
int rev_sum_of_weights = 0;
NodeID rev_start_node = v;
// SimpleLogger().Write(logDEBUG) << "fwd node " << "weight" << "," << m_node_info_list[u].lat/COORDINATE_PRECISION << "," << m_node_info_list[u].lon/COORDINATE_PRECISION;
BOOST_FOREACH(const GeometryCompressor::CompressedNode geometry_node, reverse_geometry) {
NodeID rev_end_node = geometry_node.first;
EdgeWeight rev_weight = geometry_node.second;
// SimpleLogger().Write(logDEBUG) << "fwd node " << geometry_node.first << "," << m_node_info_list[geometry_node.first].lat/COORDINATE_PRECISION << "," << m_node_info_list[geometry_node.first].lon/COORDINATE_PRECISION << ", w: " << geometry_node.second;
rev_sum_of_weights += geometry_node.second;
SimpleLogger().Write(logDEBUG) << "Edge (" << rev_start_node << "," << rev_end_node << "), w: " << rev_weight;
rev_start_node = rev_end_node;
}
SimpleLogger().Write(logDEBUG) << "Edge (" << rev_start_node << "," << u << "), w: " << (reverse_data.distance - rev_sum_of_weights);
SimpleLogger().Write(logDEBUG) << "rev sum of edge weights: " << rev_sum_of_weights;
SimpleLogger().Write(logDEBUG) << "c'ted edge weight: " << reverse_data.distance;
SimpleLogger().Write(logDEBUG) << "weight diff: " << (reverse_data.distance - rev_sum_of_weights);
BOOST_ASSERT(false);
// SimpleLogger().Write(logDEBUG) << "start " << m_node_info_list[u].lat << "," << m_node_info_list[u].lon; // SimpleLogger().Write(logDEBUG) << "start " << m_node_info_list[u].lat << "," << m_node_info_list[u].lon;
// SimpleLogger().Write(logDEBUG) << "target " << m_node_info_list[v].lat << "," << m_node_info_list[v].lon; // SimpleLogger().Write(logDEBUG) << "target " << m_node_info_list[v].lat << "," << m_node_info_list[v].lon;
// BOOST_ASSERT( false ); // BOOST_ASSERT( false );
} //else { } else {
//TODO: emplace back with C++11 BOOST_ASSERT( !m_geometry_compressor.HasEntryForID(e2) );
if( forward_data.edgeBasedNodeID != std::numeric_limits<unsigned>::max() ) {
BOOST_ASSERT( forward_data.forward );
}
if( reverse_data.edgeBasedNodeID != std::numeric_limits<unsigned>::max() ) {
BOOST_ASSERT( reverse_data.forward );
}
if( forward_data.edgeBasedNodeID == std::numeric_limits<unsigned>::max() ) {
BOOST_ASSERT( !forward_data.forward );
}
if( reverse_data.edgeBasedNodeID == std::numeric_limits<unsigned>::max() ) {
BOOST_ASSERT( !reverse_data.forward );
}
// BOOST_ASSERT( forward_data.forward == reverse_data.backward );
// BOOST_ASSERT( reverse_data.forward == forward_data.backward );
//TODO: emplace_back with C++11
m_edge_based_node_list.push_back( m_edge_based_node_list.push_back(
EdgeBasedNode( EdgeBasedNode(
forward_data.edgeBasedNodeID, forward_data.edgeBasedNodeID,
@ -344,7 +456,7 @@ void EdgeBasedGraphFactory::InsertEdgeBasedNode(
0 0
) )
); );
// } }
} }
@ -372,6 +484,7 @@ void EdgeBasedGraphFactory::Run(
SimpleLogger().Write(logDEBUG) << "Input graph has " << original_number_of_nodes << " nodes and " << original_number_of_edges << " edges"; SimpleLogger().Write(logDEBUG) << "Input graph has " << original_number_of_nodes << " nodes and " << original_number_of_edges << " edges";
Percent p(original_number_of_nodes); Percent p(original_number_of_nodes);
unsigned removed_node_count = 0; unsigned removed_node_count = 0;
for( NodeID v = 0; v < original_number_of_nodes; ++v ) { for( NodeID v = 0; v < original_number_of_nodes; ++v ) {
p.printStatus(v); p.printStatus(v);
@ -402,6 +515,7 @@ void EdgeBasedGraphFactory::Run(
BOOST_ASSERT( u != v ); BOOST_ASSERT( u != v );
const EdgeIterator forward_e1 = m_node_based_graph->FindEdge(u, v); const EdgeIterator forward_e1 = m_node_based_graph->FindEdge(u, v);
BOOST_ASSERT( m_node_based_graph->EndEdges(u) != forward_e1 );
BOOST_ASSERT( std::numeric_limits<unsigned>::max() != forward_e1 ); BOOST_ASSERT( std::numeric_limits<unsigned>::max() != forward_e1 );
BOOST_ASSERT( v == m_node_based_graph->GetTarget(forward_e1)); BOOST_ASSERT( v == m_node_based_graph->GetTarget(forward_e1));
const EdgeIterator reverse_e1 = m_node_based_graph->FindEdge(w, v); const EdgeIterator reverse_e1 = m_node_based_graph->FindEdge(w, v);
@ -411,8 +525,9 @@ void EdgeBasedGraphFactory::Run(
const EdgeData & fwd_edge_data1 = m_node_based_graph->GetEdgeData(forward_e1); const EdgeData & fwd_edge_data1 = m_node_based_graph->GetEdgeData(forward_e1);
const EdgeData & rev_edge_data1 = m_node_based_graph->GetEdgeData(reverse_e1); const EdgeData & rev_edge_data1 = m_node_based_graph->GetEdgeData(reverse_e1);
if( m_node_based_graph->FindEdge(u, w) != m_node_based_graph->EndEdges(u) || if(
m_node_based_graph->FindEdge(w, u) != m_node_based_graph->EndEdges(w) ( m_node_based_graph->FindEdge(u, w) != m_node_based_graph->EndEdges(u) ) ||
( m_node_based_graph->FindEdge(w, u) != m_node_based_graph->EndEdges(w) )
) { ) {
continue; continue;
} }
@ -421,20 +536,42 @@ void EdgeBasedGraphFactory::Run(
fwd_edge_data1.IsEqualTo(fwd_edge_data2) && fwd_edge_data1.IsEqualTo(fwd_edge_data2) &&
rev_edge_data1.IsEqualTo(rev_edge_data2) rev_edge_data1.IsEqualTo(rev_edge_data2)
) { ) {
// extend e1's to targets of e2's //Get distances before graph is modified
m_node_based_graph->SetTarget(forward_e1, w); const bool fwd_e1_is_compressed = m_geometry_compressor.HasEntryForID(forward_e1);
m_node_based_graph->SetTarget(reverse_e1, u); int forward_weight1 = 0;
if( fwd_e1_is_compressed ) {
forward_weight1 = m_geometry_compressor.GetBucketReference(forward_e1).back().second;
} else {
forward_weight1 = m_node_based_graph->GetEdgeData(forward_e1).distance;
}
if( 0 == forward_e1 ) {
SimpleLogger().Write(logDEBUG) << (fwd_e1_is_compressed ? "fetched" : "used") << " fwd weight: " << forward_weight1;
}
const int forward_weight1 = m_node_based_graph->GetEdgeData(forward_e1).distance; BOOST_ASSERT( 0 != forward_weight1 );
// const int forward_weight2 = fwd_edge_data2.distance; // const int forward_weight2 = fwd_edge_data2.distance;
const int reverse_weight1 = m_node_based_graph->GetEdgeData(reverse_e1).distance; const bool rev_e1_is_compressed = m_geometry_compressor.HasEntryForID(reverse_e1);
// const int reverse_weight2 = rev_edge_data2.distance; int reverse_weight1 = 0;
if( rev_e1_is_compressed ) {
reverse_weight1 = m_geometry_compressor.GetBucketReference(reverse_e1).back().second;
} else {
reverse_weight1 = m_node_based_graph->GetEdgeData(reverse_e1).distance;
}
BOOST_ASSERT( 0 != reverse_weight1 );
if( 0 == reverse_e1 ) {
SimpleLogger().Write(logDEBUG) << (rev_e1_is_compressed ? "fetched" : "used") << " fwd weight: " << reverse_weight1;
}
// add weight of e2's to e1 // add weight of e2's to e1
m_node_based_graph->GetEdgeData(forward_e1).distance += fwd_edge_data2.distance; m_node_based_graph->GetEdgeData(forward_e1).distance += fwd_edge_data2.distance;
m_node_based_graph->GetEdgeData(reverse_e1).distance += rev_edge_data2.distance; m_node_based_graph->GetEdgeData(reverse_e1).distance += rev_edge_data2.distance;
// extend e1's to targets of e2's
m_node_based_graph->SetTarget(forward_e1, w);
m_node_based_graph->SetTarget(reverse_e1, u);
// remove e2's (if bidir, otherwise only one) // remove e2's (if bidir, otherwise only one)
m_node_based_graph->DeleteEdge(v, forward_e2); m_node_based_graph->DeleteEdge(v, forward_e2);
m_node_based_graph->DeleteEdge(v, reverse_e2); m_node_based_graph->DeleteEdge(v, reverse_e2);
@ -446,6 +583,8 @@ void EdgeBasedGraphFactory::Run(
FixupStartingTurnRestriction( w, v, u ); FixupStartingTurnRestriction( w, v, u );
FixupArrivingTurnRestriction( w, v, u ); FixupArrivingTurnRestriction( w, v, u );
// const int reverse_weight2 = rev_edge_data2.distance;
// store compressed geometry in container // store compressed geometry in container
m_geometry_compressor.CompressEdge( m_geometry_compressor.CompressEdge(
forward_e1, forward_e1,
@ -477,48 +616,28 @@ void EdgeBasedGraphFactory::Run(
} }
} }
SimpleLogger().Write() << "new nodes: " << new_node_count << ", edges " << new_edge_count; SimpleLogger().Write() << "new nodes: " << new_node_count << ", edges " << new_edge_count;
SimpleLogger().Write(logDEBUG) << "Graph reports: " << m_node_based_graph->GetNumberOfEdges() << " edges";
SimpleLogger().Write() << "Node compression ratio: " << new_node_count/(double)original_number_of_nodes; SimpleLogger().Write() << "Node compression ratio: " << new_node_count/(double)original_number_of_nodes;
SimpleLogger().Write() << "Edge compression ratio: " << new_edge_count/(double)original_number_of_edges; SimpleLogger().Write() << "Edge compression ratio: " << new_edge_count/(double)original_number_of_edges;
//Extract routing graph // renumber edge based node IDs
unsigned numbered_edges_count = 0; unsigned numbered_edges_count = 0;
for(NodeID source = 0; source < m_node_based_graph->GetNumberOfNodes(); ++source) { for(NodeID current_node = 0; current_node < m_node_based_graph->GetNumberOfNodes(); ++current_node) {
for( for(EdgeIterator current_edge = m_node_based_graph->BeginEdges(current_node); current_edge < m_node_based_graph->EndEdges(current_node); ++current_edge) {
EdgeID current_edge_id = m_node_based_graph->BeginEdges(source); EdgeData & edge_data = m_node_based_graph->GetEdgeData(current_edge);
current_edge_id < m_node_based_graph->EndEdges(source);
++current_edge_id
) {
const NodeID target = m_node_based_graph->GetTarget(current_edge_id);
EdgeData & edge_data = m_node_based_graph->GetEdgeData(current_edge_id);
if( 0 == numbered_edges_count ){
SimpleLogger().Write(logDEBUG) << "uninitialized edge based node id: " << edge_data.edgeBasedNodeID;
}
if( !edge_data.forward ) { if( !edge_data.forward ) {
// SimpleLogger().Write(logDEBUG) << "skipped edge (" << source << "," << target << ")=[" << current_edge_id << "]"; // SimpleLogger().Write(logDEBUG) << "skipped edge (" << source << "," << target << ")=[" << current_edge_id << "]";
continue; continue;
} }
if( edge_data.edgeBasedNodeID != std::numeric_limits<unsigned>::max() ) {//source > target ) {
// SimpleLogger().Write(logDEBUG) << "skipping edge based node id: " << edge_data.edgeBasedNodeID;
continue;
}
BOOST_ASSERT( numbered_edges_count < m_node_based_graph->GetNumberOfEdges() ); BOOST_ASSERT( numbered_edges_count < m_node_based_graph->GetNumberOfEdges() );
edge_data.edgeBasedNodeID = numbered_edges_count; edge_data.edgeBasedNodeID = numbered_edges_count;
++numbered_edges_count; ++numbered_edges_count;
const EdgeID reverse_edge_id = m_node_based_graph->FindEdge(target, source); BOOST_ASSERT( std::numeric_limits<unsigned>::max() != edge_data.edgeBasedNodeID);
BOOST_ASSERT( reverse_edge_id != m_node_based_graph->EndEdges(target)); }
EdgeData & reverse_edge_data = m_node_based_graph->GetEdgeData(reverse_edge_id);
if( !reverse_edge_data.forward ) {
continue;
} }
BOOST_ASSERT( numbered_edges_count < m_node_based_graph->GetNumberOfEdges() );
reverse_edge_data.edgeBasedNodeID = numbered_edges_count;
++numbered_edges_count;
}
}
SimpleLogger().Write(logDEBUG) << "numbered " << numbered_edges_count << " edge-expanded nodes"; SimpleLogger().Write(logDEBUG) << "numbered " << numbered_edges_count << " edge-expanded nodes";
SimpleLogger().Write() << "Identifying components of the road network"; SimpleLogger().Write() << "Identifying components of the road network";
@ -538,8 +657,8 @@ void EdgeBasedGraphFactory::Run(
//Run a BFS on the undirected graph and identify small components //Run a BFS on the undirected graph and identify small components
std::vector<unsigned> component_index_list; std::vector<unsigned> component_index_list;
std::vector<NodeID> component_index_size; std::vector<NodeID > component_index_size;
BFSCompentExplorer( component_index_list, component_index_size); BFSCompentExplorer( component_index_list, component_index_size );
SimpleLogger().Write() << SimpleLogger().Write() <<
"identified: " << component_index_size.size() << " many components"; "identified: " << component_index_size.size() << " many components";
@ -563,6 +682,10 @@ void EdgeBasedGraphFactory::Run(
e1 < last_edge; e1 < last_edge;
++e1 ++e1
) { ) {
const EdgeData & edge_data = m_node_based_graph->GetEdgeData(e1);
if( edge_data.edgeBasedNodeID == std::numeric_limits<unsigned>::max() ) {
continue;
}
BOOST_ASSERT( e1 != std::numeric_limits<unsigned>::max() ); BOOST_ASSERT( e1 != std::numeric_limits<unsigned>::max() );
NodeIterator v = m_node_based_graph->GetTarget(e1); NodeIterator v = m_node_based_graph->GetTarget(e1);
BOOST_ASSERT( std::numeric_limits<unsigned>::max() != v ); BOOST_ASSERT( std::numeric_limits<unsigned>::max() != v );
@ -571,9 +694,7 @@ void EdgeBasedGraphFactory::Run(
continue; continue;
} }
BOOST_ASSERT( u < v ); BOOST_ASSERT( u < v );
BOOST_ASSERT( BOOST_ASSERT( edge_data.type != SHRT_MAX );
m_node_based_graph->GetEdgeData(e1).type != SHRT_MAX
);
//Note: edges that end on barrier nodes or on a turn restriction //Note: edges that end on barrier nodes or on a turn restriction
//may actually be in two distinct components. We choose the smallest //may actually be in two distinct components. We choose the smallest
@ -582,16 +703,45 @@ void EdgeBasedGraphFactory::Run(
component_index_size[component_index_list[v]] component_index_size[component_index_list[v]]
); );
InsertEdgeBasedNode( u, v, size_of_component < 1000 ); const bool component_is_tiny = ( size_of_component < 1000 );
InsertEdgeBasedNode( u, v, e1, component_is_tiny );
} }
} }
//TODO: check if correct, suspect two off by ones here // for(
// NodeIterator u = 0, end = m_node_based_graph->GetNumberOfNodes();
// u < end;
// ++u
// ) {
// BOOST_ASSERT( u != std::numeric_limits<unsigned>::max() );
// BOOST_ASSERT( u < m_node_based_graph->GetNumberOfNodes() );
// p.printIncrement();
// for(
// EdgeIterator e1 = m_node_based_graph->BeginEdges(u),
// last_edge = m_node_based_graph->EndEdges(u);
// e1 < last_edge;
// ++e1
// ) {
// BOOST_ASSERT( e1 != std::numeric_limits<unsigned>::max() );
// NodeIterator v = m_node_based_graph->GetTarget(e1);
// EdgeIterator e2 = m_node_based_graph->FindEdge(u, v);
// BOOST_ASSERT( e2 != m_node_based_graph->EndEdges(v) );
// BOOST_ASSERT( e1 == e2 );
// const EdgeData & data = m_node_based_graph->GetEdgeData(e1);
// if( data.forward ) {
// BOOST_ASSERT( data.edgeBasedNodeID != std::numeric_limits<unsigned>::max() );
// }
// }
// }
m_number_of_edge_based_nodes = numbered_edges_count; m_number_of_edge_based_nodes = numbered_edges_count;
SimpleLogger().Write() SimpleLogger().Write() << "Generated " << m_edge_based_node_list.size() <<
<< "Generated " << m_edge_based_node_list.size() << " nodes in " << " nodes in edge-expanded graph";
"edge-expanded graph";
SimpleLogger().Write() << "generating edge-expanded edges"; SimpleLogger().Write() << "generating edge-expanded edges";
std::vector<NodeID>().swap(component_index_size); std::vector<NodeID>().swap(component_index_size);

View File

@ -181,6 +181,7 @@ private:
void InsertEdgeBasedNode( void InsertEdgeBasedNode(
NodeBasedDynamicGraph::NodeIterator u, NodeBasedDynamicGraph::NodeIterator u,
NodeBasedDynamicGraph::NodeIterator v, NodeBasedDynamicGraph::NodeIterator v,
NodeBasedDynamicGraph::EdgeIterator e1,
bool belongsToTinyComponent bool belongsToTinyComponent
); );

View File

@ -146,10 +146,10 @@ void GeometryCompressor::CompressEdge(
// const EdgeWeight weight2 // const EdgeWeight weight2
) { ) {
BOOST_ASSERT( UINT_MAX != surviving_edge_id ); BOOST_ASSERT( SPECIAL_EDGEID != surviving_edge_id );
BOOST_ASSERT( UINT_MAX != removed_edge_id ); BOOST_ASSERT( SPECIAL_NODEID != removed_edge_id );
BOOST_ASSERT( UINT_MAX != via_node_id ); BOOST_ASSERT( SPECIAL_NODEID != via_node_id );
BOOST_ASSERT( std::numeric_limits<unsigned>::max() != weight1 );
// append list of removed edge_id plus via node to surviving edge id: // append list of removed edge_id plus via node to surviving edge id:
// <surv_1, .. , surv_n, via_node_id, rem_1, .. rem_n // <surv_1, .. , surv_n, via_node_id, rem_1, .. rem_n
// //
@ -179,9 +179,15 @@ void GeometryCompressor::CompressEdge(
BOOST_ASSERT( surving_list_id < m_compressed_geometries.size() ); BOOST_ASSERT( surving_list_id < m_compressed_geometries.size() );
std::vector<CompressedNode> & surviving_geometry_list = m_compressed_geometries[surving_list_id]; std::vector<CompressedNode> & surviving_geometry_list = m_compressed_geometries[surving_list_id];
if( !surviving_geometry_list.empty() ) { BOOST_ASSERT(
BOOST_ASSERT( via_node_id != surviving_geometry_list.back().first ); surviving_geometry_list.empty() ||
( via_node_id != surviving_geometry_list.back().first )
);
if(surviving_edge_id == 0) {
SimpleLogger().Write(logDEBUG) << "adding via " << via_node_id << ", w: " << weight1;
} }
surviving_geometry_list.push_back( std::make_pair(via_node_id, weight1) ); surviving_geometry_list.push_back( std::make_pair(via_node_id, weight1) );
BOOST_ASSERT( 0 < surviving_geometry_list.size() ); BOOST_ASSERT( 0 < surviving_geometry_list.size() );
BOOST_ASSERT( !surviving_geometry_list.empty() ); BOOST_ASSERT( !surviving_geometry_list.empty() );
@ -195,6 +201,14 @@ void GeometryCompressor::CompressEdge(
BOOST_ASSERT( list_to_remove_index < m_compressed_geometries.size() ); BOOST_ASSERT( list_to_remove_index < m_compressed_geometries.size() );
std::vector<CompressedNode> & remove_geometry_list = m_compressed_geometries[list_to_remove_index]; std::vector<CompressedNode> & remove_geometry_list = m_compressed_geometries[list_to_remove_index];
if(surviving_edge_id == 0) {
SimpleLogger().Write(logDEBUG) << "appending to list: ";
BOOST_FOREACH(const CompressedNode & node, remove_geometry_list) {
SimpleLogger().Write(logDEBUG) << "adding via " << node.first << ", w: " << node.second;
}
}
// found an existing list, append it to the list of surviving_edge_id // found an existing list, append it to the list of surviving_edge_id
surviving_geometry_list.insert( surviving_geometry_list.insert(
surviving_geometry_list.end(), surviving_geometry_list.end(),

View File

@ -61,7 +61,8 @@ public:
bool ra, bool ra,
bool ig, bool ig,
bool ar, bool ar,
bool cf bool cf,
bool is_split
) : _source(s), ) : _source(s),
_target(t), _target(t),
_name(n), _name(n),
@ -72,7 +73,8 @@ public:
_roundabout(ra), _roundabout(ra),
_ignoreInGrid(ig), _ignoreInGrid(ig),
_accessRestricted(ar), _accessRestricted(ar),
_contraFlow(cf) _contraFlow(cf),
is_split(is_split)
{ {
if(ty < 0) { if(ty < 0) {
throw OSRMException("negative edge type"); throw OSRMException("negative edge type");
@ -93,6 +95,7 @@ public:
bool ignoreInGrid() const { return _ignoreInGrid; } bool ignoreInGrid() const { return _ignoreInGrid; }
bool isAccessRestricted() const { return _accessRestricted; } bool isAccessRestricted() const { return _accessRestricted; }
bool isContraFlow() const { return _contraFlow; } bool isContraFlow() const { return _contraFlow; }
bool IsSplit() const { return is_split; }
//TODO: names need to be fixed. //TODO: names need to be fixed.
NodeID _source; NodeID _source;
@ -106,6 +109,7 @@ public:
bool _ignoreInGrid:1; bool _ignoreInGrid:1;
bool _accessRestricted:1; bool _accessRestricted:1;
bool _contraFlow:1; bool _contraFlow:1;
bool is_split:1;
private: private:
NodeBasedEdge() { } NodeBasedEdge() { }

View File

@ -44,11 +44,17 @@ struct ExternalMemoryNode : NodeInfo {
bollard(bollard), bollard(bollard),
trafficLight(traffic_light) trafficLight(traffic_light)
{ } { }
ExternalMemoryNode() : bollard(false), trafficLight(false) {}
ExternalMemoryNode()
:
bollard(false),
trafficLight(false)
{ }
static ExternalMemoryNode min_value() { static ExternalMemoryNode min_value() {
return ExternalMemoryNode(0,0,0, false, false); return ExternalMemoryNode(0,0,0, false, false);
} }
static ExternalMemoryNode max_value() { static ExternalMemoryNode max_value() {
return ExternalMemoryNode( return ExternalMemoryNode(
std::numeric_limits<int>::max(), std::numeric_limits<int>::max(),
@ -58,9 +64,11 @@ struct ExternalMemoryNode : NodeInfo {
false false
); );
} }
NodeID key() const { NodeID key() const {
return id; return id;
} }
bool bollard; bool bollard;
bool trafficLight; bool trafficLight;
}; };

View File

@ -33,9 +33,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
struct PhantomNode { struct PhantomNode {
PhantomNode() : PhantomNode() :
forward_node_id(UINT_MAX), forward_node_id(std::numeric_limits<unsigned>::max()),
reverse_node_id(UINT_MAX), reverse_node_id(std::numeric_limits<unsigned>::max()),
name_id(UINT_MAX), name_id(std::numeric_limits<unsigned>::max()),
forward_weight(INT_MAX), forward_weight(INT_MAX),
reverse_weight(INT_MAX), reverse_weight(INT_MAX),
ratio(0.) ratio(0.)
@ -50,15 +50,15 @@ struct PhantomNode {
FixedPointCoordinate location; FixedPointCoordinate location;
void Reset() { void Reset() {
forward_node_id = UINT_MAX; forward_node_id = std::numeric_limits<unsigned>::max();
name_id = UINT_MAX; name_id = std::numeric_limits<unsigned>::max();
forward_weight = INT_MAX; forward_weight = INT_MAX;
reverse_weight = INT_MAX; reverse_weight = INT_MAX;
ratio = 0.; ratio = 0.;
location.Reset(); location.Reset();
} }
bool isBidirected() const { bool isBidirected() const {
return forward_weight != INT_MAX && reverse_weight != INT_MAX; return forward_node_id != UINT_MAX && reverse_node_id != UINT_MAX;
} }
bool isValid(const unsigned numberOfNodes) const { bool isValid(const unsigned numberOfNodes) const {
return return
@ -67,7 +67,7 @@ struct PhantomNode {
( (forward_weight != INT_MAX) || (reverse_weight != INT_MAX) ) && ( (forward_weight != INT_MAX) || (reverse_weight != INT_MAX) ) &&
(ratio >= 0.) && (ratio >= 0.) &&
(ratio <= 1.) && (ratio <= 1.) &&
(name_id != UINT_MAX); (name_id != std::numeric_limits<unsigned>::max());
} }
bool operator==(const PhantomNode & other) const { bool operator==(const PhantomNode & other) const {
@ -88,7 +88,7 @@ struct PhantomNodes {
} }
bool AtLeastOnePhantomNodeIsUINTMAX() const { bool AtLeastOnePhantomNodeIsUINTMAX() const {
return !(startPhantom.forward_node_id == UINT_MAX || targetPhantom.forward_node_id == UINT_MAX); return !(startPhantom.forward_node_id == std::numeric_limits<unsigned>::max() || targetPhantom.forward_node_id == std::numeric_limits<unsigned>::max());
} }
bool PhantomNodesHaveEqualLocation() const { bool PhantomNodesHaveEqualLocation() const {

View File

@ -722,6 +722,11 @@ public:
} }
result_phantom_node.ratio = ratio; result_phantom_node.ratio = ratio;
SimpleLogger().Write(logDEBUG) << "result location: " << result_phantom_node.location;
SimpleLogger().Write(logDEBUG) << "fwd node: " << result_phantom_node.forward_node_id << ", rev node: " << result_phantom_node.reverse_node_id;
SimpleLogger().Write(logDEBUG) << "fwd weight: " << result_phantom_node.forward_weight << ", rev weight: " << result_phantom_node.reverse_weight << ", ratio: " << result_phantom_node.ratio;
return found_a_nearest_edge; return found_a_nearest_edge;
} }

View File

@ -373,23 +373,27 @@ void ExtractionContainers::PrepareData(
sizeof(short) sizeof(short)
); );
file_out_stream.write( file_out_stream.write(
(char*)&edge_iterator->nameID, (char *) &edge_iterator->nameID,
sizeof(unsigned) sizeof(unsigned)
); );
file_out_stream.write( file_out_stream.write(
(char*)&edge_iterator->isRoundabout, (char *) &edge_iterator->isRoundabout,
sizeof(bool) sizeof(bool)
); );
file_out_stream.write( file_out_stream.write(
(char*)&edge_iterator->ignoreInGrid, (char *) &edge_iterator->ignoreInGrid,
sizeof(bool) sizeof(bool)
); );
file_out_stream.write( file_out_stream.write(
(char*)&edge_iterator->isAccessRestricted, (char *) &edge_iterator->isAccessRestricted,
sizeof(bool) sizeof(bool)
); );
file_out_stream.write( file_out_stream.write(
(char*)&edge_iterator->isContraFlow, (char *) &edge_iterator->isContraFlow,
sizeof(bool)
);
file_out_stream.write(
(char *) &edge_iterator->is_split,
sizeof(bool) sizeof(bool)
); );
++number_of_used_edges; ++number_of_used_edges;

View File

@ -36,8 +36,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <osrm/Coordinate.h> #include <osrm/Coordinate.h>
#include <cfloat>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/regex.hpp> #include <boost/algorithm/string/regex.hpp>
#include <boost/regex.hpp> #include <boost/regex.hpp>
@ -113,7 +111,8 @@ void ExtractorCallbacks::wayFunction(ExtractionWay &parsed_way) {
for(std::vector< NodeID >::size_type n = 0; n < parsed_way.path.size()-1; ++n) { for(std::vector< NodeID >::size_type n = 0; n < parsed_way.path.size()-1; ++n) {
externalMemory->all_edges_list.push_back( externalMemory->all_edges_list.push_back(
InternalExtractorEdge(parsed_way.path[n], InternalExtractorEdge(
parsed_way.path[n],
parsed_way.path[n+1], parsed_way.path[n+1],
parsed_way.type, parsed_way.type,
(split_bidirectional_edge ? ExtractionWay::oneway : parsed_way.direction), (split_bidirectional_edge ? ExtractionWay::oneway : parsed_way.direction),
@ -122,7 +121,9 @@ void ExtractorCallbacks::wayFunction(ExtractionWay &parsed_way) {
parsed_way.roundabout, parsed_way.roundabout,
parsed_way.ignoreInGrid, parsed_way.ignoreInGrid,
(0 < parsed_way.duration), (0 < parsed_way.duration),
parsed_way.isAccessRestricted parsed_way.isAccessRestricted,
false,
split_bidirectional_edge
) )
); );
externalMemory->used_node_id_list.push_back(parsed_way.path[n]); externalMemory->used_node_id_list.push_back(parsed_way.path[n]);
@ -136,7 +137,8 @@ void ExtractorCallbacks::wayFunction(ExtractionWay &parsed_way) {
std::reverse( parsed_way.path.begin(), parsed_way.path.end() ); std::reverse( parsed_way.path.begin(), parsed_way.path.end() );
for(std::vector< NodeID >::size_type n = 0; n < parsed_way.path.size()-1; ++n) { for(std::vector< NodeID >::size_type n = 0; n < parsed_way.path.size()-1; ++n) {
externalMemory->all_edges_list.push_back( externalMemory->all_edges_list.push_back(
InternalExtractorEdge(parsed_way.path[n], InternalExtractorEdge(
parsed_way.path[n],
parsed_way.path[n+1], parsed_way.path[n+1],
parsed_way.type, parsed_way.type,
ExtractionWay::oneway, ExtractionWay::oneway,
@ -146,7 +148,8 @@ void ExtractorCallbacks::wayFunction(ExtractionWay &parsed_way) {
parsed_way.ignoreInGrid, parsed_way.ignoreInGrid,
(0 < parsed_way.duration), (0 < parsed_way.duration),
parsed_way.isAccessRestricted, parsed_way.isAccessRestricted,
(ExtractionWay::oneway == parsed_way.direction) (ExtractionWay::oneway == parsed_way.direction),
split_bidirectional_edge
) )
); );
} }

View File

@ -28,9 +28,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INTERNAL_EXTRACTOR_EDGE_H #ifndef INTERNAL_EXTRACTOR_EDGE_H
#define INTERNAL_EXTRACTOR_EDGE_H #define INTERNAL_EXTRACTOR_EDGE_H
#include <osrm/Coordinate.h>
#include "../typedefs.h" #include "../typedefs.h"
#include <osrm/Coordinate.h>
#include <boost/assert.hpp> #include <boost/assert.hpp>
@ -47,70 +47,10 @@ struct InternalExtractorEdge {
ignoreInGrid(false), ignoreInGrid(false),
isDurationSet(false), isDurationSet(false),
isAccessRestricted(false), isAccessRestricted(false),
isContraFlow(false) isContraFlow(false),
is_split(false)
{ } { }
explicit InternalExtractorEdge(NodeID start, NodeID target)
:
start(start),
target(target),
type(0),
direction(0),
speed(0),
nameID(0),
isRoundabout(false),
ignoreInGrid(false),
isDurationSet(false),
isAccessRestricted(false),
isContraFlow(false)
{ }
explicit InternalExtractorEdge(
NodeID start,
NodeID target,
short type,
short d,
double speed
) :
start(start),
target(target),
type(type),
direction(d),
speed(speed),
nameID(0),
isRoundabout(false),
ignoreInGrid(false),
isDurationSet(false),
isAccessRestricted(false),
isContraFlow(false)
{ }
explicit InternalExtractorEdge(
NodeID start,
NodeID target,
short type,
short direction,
double speed,
unsigned nameID,
bool isRoundabout,
bool ignoreInGrid,
bool isDurationSet,
bool isAccressRestricted
) :
start(start),
target(target),
type(type),
direction(direction),
speed(speed),
nameID(nameID),
isRoundabout(isRoundabout),
ignoreInGrid(ignoreInGrid),
isDurationSet(isDurationSet),
isAccessRestricted(isAccressRestricted),
isContraFlow(false)
{
BOOST_ASSERT(0 <= type);
}
explicit InternalExtractorEdge( explicit InternalExtractorEdge(
NodeID start, NodeID start,
@ -123,7 +63,8 @@ struct InternalExtractorEdge {
bool ignoreInGrid, bool ignoreInGrid,
bool isDurationSet, bool isDurationSet,
bool isAccressRestricted, bool isAccressRestricted,
bool isContraFlow bool isContraFlow,
bool is_split
) : ) :
start(start), start(start),
target(target), target(target),
@ -135,19 +76,43 @@ struct InternalExtractorEdge {
ignoreInGrid(ignoreInGrid), ignoreInGrid(ignoreInGrid),
isDurationSet(isDurationSet), isDurationSet(isDurationSet),
isAccessRestricted(isAccressRestricted), isAccessRestricted(isAccressRestricted),
isContraFlow(isContraFlow) isContraFlow(isContraFlow),
is_split(is_split)
{ {
BOOST_ASSERT(0 <= type); BOOST_ASSERT(0 <= type);
} }
// necessary static util functions for stxxl's sorting // necessary static util functions for stxxl's sorting
static InternalExtractorEdge min_value() { static InternalExtractorEdge min_value() {
return InternalExtractorEdge(0,0); return InternalExtractorEdge(
0,
0,
0,
0,
0,
0,
false,
false,
false,
false,
false,
false
);
} }
static InternalExtractorEdge max_value() { static InternalExtractorEdge max_value() {
return InternalExtractorEdge( return InternalExtractorEdge(
std::numeric_limits<unsigned>::max(), std::numeric_limits<unsigned>::max(),
std::numeric_limits<unsigned>::max() std::numeric_limits<unsigned>::max(),
0,
0,
0,
0,
false,
false,
false,
false,
false,
false
); );
} }
@ -162,6 +127,7 @@ struct InternalExtractorEdge {
bool isDurationSet; bool isDurationSet;
bool isAccessRestricted; bool isAccessRestricted;
bool isContraFlow; bool isContraFlow;
bool is_split;
FixedPointCoordinate startCoord; FixedPointCoordinate startCoord;
FixedPointCoordinate targetCoord; FixedPointCoordinate targetCoord;

View File

@ -66,7 +66,7 @@ ScriptingEnvironment::ScriptingEnvironment(const char * fileName) {
luabind::module(myLuaState) [ luabind::module(myLuaState) [
luabind::class_<HashTable<std::string, std::string> >("keyVals") luabind::class_<HashTable<std::string, std::string> >("keyVals")
.def("Add", &HashTable<std::string, std::string>::Add) .def("Add", &HashTable<std::string, std::string>::Add)
.def("Get", &HashTable<std::string, std::string>::Get) .def("Find", &HashTable<std::string, std::string>::Find)
.def("Holds", &HashTable<std::string, std::string>::Holds) .def("Holds", &HashTable<std::string, std::string>::Holds)
]; ];

View File

@ -136,7 +136,7 @@ NodeID readBinaryOSRMGraphFromStream(
short type; short type;
NodeID nameID; NodeID nameID;
int length; int length;
bool isRoundabout, ignoreInGrid, isAccessRestricted, isContraFlow; bool isRoundabout, ignoreInGrid, isAccessRestricted, isContraFlow, is_split;
for (EdgeID i=0; i<m; ++i) { for (EdgeID i=0; i<m; ++i) {
input_stream.read((char*)&source, sizeof(unsigned)); input_stream.read((char*)&source, sizeof(unsigned));
@ -150,6 +150,7 @@ NodeID readBinaryOSRMGraphFromStream(
input_stream.read((char*)&ignoreInGrid, sizeof(bool)); input_stream.read((char*)&ignoreInGrid, sizeof(bool));
input_stream.read((char*)&isAccessRestricted, sizeof(bool)); input_stream.read((char*)&isAccessRestricted, sizeof(bool));
input_stream.read((char*)&isContraFlow, sizeof(bool)); input_stream.read((char*)&isContraFlow, sizeof(bool));
input_stream.read((char*)&is_split, sizeof(bool));
BOOST_ASSERT_MSG(length > 0, "loaded null length edge" ); BOOST_ASSERT_MSG(length > 0, "loaded null length edge" );
BOOST_ASSERT_MSG(weight > 0, "loaded null weight"); BOOST_ASSERT_MSG(weight > 0, "loaded null weight");
@ -190,7 +191,7 @@ NodeID readBinaryOSRMGraphFromStream(
std::swap(forward, backward); std::swap(forward, backward);
} }
EdgeT inputEdge(source, target, nameID, weight, forward, backward, type, isRoundabout, ignoreInGrid, isAccessRestricted, isContraFlow ); EdgeT inputEdge(source, target, nameID, weight, forward, backward, type, isRoundabout, ignoreInGrid, isAccessRestricted, isContraFlow, is_split );
edge_list.push_back(inputEdge); edge_list.push_back(inputEdge);
} }
std::sort(edge_list.begin(), edge_list.end()); std::sort(edge_list.begin(), edge_list.end());