Recreate feature/expose_node_ids

This commit is contained in:
Lauren Budorick
2016-05-18 16:09:14 -04:00
committed by Daniel J. Hofmann
parent 448f8377fb
commit a4ac07866a
10 changed files with 59 additions and 0 deletions
+2
View File
@@ -729,6 +729,7 @@ void trimShortSegments(std::vector<RouteStep> &steps, LegGeometry &geometry)
// fixup the coordinate
geometry.locations.erase(geometry.locations.begin());
geometry.annotations.erase(geometry.annotations.begin());
geometry.osm_node_ids.erase(geometry.osm_node_ids.begin());
// remove the initial distance value
geometry.segment_distances.erase(geometry.segment_distances.begin());
@@ -818,6 +819,7 @@ void trimShortSegments(std::vector<RouteStep> &steps, LegGeometry &geometry)
{
geometry.locations.pop_back();
geometry.annotations.pop_back();
geometry.osm_node_ids.pop_back();
geometry.segment_offsets.pop_back();
BOOST_ASSERT(geometry.segment_distances.back() < 1);
geometry.segment_distances.pop_back();
+6
View File
@@ -244,6 +244,9 @@ int Storage::Run()
nodes_input_stream.read((char *)&coordinate_list_size, sizeof(unsigned));
shared_layout_ptr->SetBlockSize<util::Coordinate>(SharedDataLayout::COORDINATE_LIST,
coordinate_list_size);
// we'll read a list of OSM node IDs from the same data, so set the same block size:
shared_layout_ptr->SetBlockSize<OSMNodeID>(SharedDataLayout::OSM_NODE_ID_LIST,
coordinate_list_size);
// load geometries sizes
boost::filesystem::ifstream geometry_input_stream(config.geometries_path, std::ios::binary);
@@ -535,12 +538,15 @@ int Storage::Run()
// Loading list of coordinates
util::Coordinate *coordinates_ptr = shared_layout_ptr->GetBlockPtr<util::Coordinate, true>(
shared_memory_ptr, SharedDataLayout::COORDINATE_LIST);
OSMNodeID *osmnodeid_ptr = shared_layout_ptr->GetBlockPtr<OSMNodeID, true>(
shared_memory_ptr, SharedDataLayout::OSM_NODE_ID_LIST);
extractor::QueryNode current_node;
for (unsigned i = 0; i < coordinate_list_size; ++i)
{
nodes_input_stream.read((char *)&current_node, sizeof(extractor::QueryNode));
coordinates_ptr[i] = util::Coordinate(current_node.lon, current_node.lat);
osmnodeid_ptr[i] = OSMNodeID(current_node.node_id);
}
nodes_input_stream.close();