Deduplicate foward/reverse geometries

Changes the internal representation of compressed geometries to be a
single array shared between forward and reverse geometries that can be
read in either direction. Includes a change on
extractor::OriginalEdgeData to store via_geometry ids that indicate
which direction to read the geometry for that edge based edge.

Closes #2592
This commit is contained in:
Lauren Budorick
2016-07-22 18:23:54 +02:00
committed by Jake Pruitt
parent 73179641b1
commit a75e16e26b
24 changed files with 769 additions and 428 deletions
+8 -12
View File
@@ -45,14 +45,10 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
// Need to get the node ID preceding the source phantom node
// TODO: check if this was traversed in reverse?
std::vector<NodeID> reverse_geometry;
facade.GetUncompressedGeometry(source_node.reverse_packed_geometry_id, reverse_geometry);
const std::vector<NodeID> source_geometry =
facade.GetUncompressedForwardGeometry(source_node.packed_geometry_id);
geometry.osm_node_ids.push_back(facade.GetOSMNodeIDOfNode(
reverse_geometry[reverse_geometry.size() - source_node.fwd_segment_position - 1]));
std::vector<uint8_t> forward_datasource_vector;
facade.GetUncompressedDatasources(source_node.forward_packed_geometry_id,
forward_datasource_vector);
source_geometry[source_node.fwd_segment_position]));
auto cumulative_distance = 0.;
auto current_distance = 0.;
@@ -84,8 +80,8 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
// segment leading to the target node
geometry.segment_distances.push_back(cumulative_distance);
std::vector<DatasourceID> forward_datasources;
facade.GetUncompressedDatasources(target_node.forward_packed_geometry_id, forward_datasources);
const std::vector<DatasourceID> forward_datasources =
facade.GetUncompressedForwardDatasources(target_node.packed_geometry_id);
geometry.annotations.emplace_back(
LegGeometry::Annotation{current_distance,
@@ -96,10 +92,10 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
// Need to get the node ID following the destination phantom node
// TODO: check if this was traversed in reverse??
std::vector<NodeID> forward_geometry;
facade.GetUncompressedGeometry(target_node.forward_packed_geometry_id, forward_geometry);
const std::vector<NodeID> target_geometry =
facade.GetUncompressedForwardGeometry(target_node.packed_geometry_id);
geometry.osm_node_ids.push_back(
facade.GetOSMNodeIDOfNode(forward_geometry[target_node.fwd_segment_position]));
facade.GetOSMNodeIDOfNode(target_geometry[target_node.fwd_segment_position + 1]));
BOOST_ASSERT(geometry.segment_distances.size() == geometry.segment_offsets.size() - 1);
BOOST_ASSERT(geometry.locations.size() > geometry.segment_distances.size());