Include datasources for each segment in route annotation.
This commit is contained in:
@@ -50,6 +50,10 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
||||
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);
|
||||
|
||||
|
||||
auto cumulative_distance = 0.;
|
||||
auto current_distance = 0.;
|
||||
auto prev_coordinate = geometry.locations.front();
|
||||
@@ -70,7 +74,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
||||
|
||||
prev_coordinate = coordinate;
|
||||
geometry.annotations.emplace_back(
|
||||
LegGeometry::Annotation{current_distance, path_point.duration_until_turn / 10.});
|
||||
LegGeometry::Annotation{current_distance, path_point.duration_until_turn / 10., path_point.datasource_id});
|
||||
geometry.locations.push_back(std::move(coordinate));
|
||||
geometry.osm_node_ids.push_back(facade.GetOSMNodeIDOfNode(path_point.turn_via_node));
|
||||
}
|
||||
@@ -79,8 +83,12 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
||||
cumulative_distance += current_distance;
|
||||
// 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);
|
||||
|
||||
geometry.annotations.emplace_back(
|
||||
LegGeometry::Annotation{current_distance, target_node.forward_weight / 10.});
|
||||
LegGeometry::Annotation{current_distance, target_node.forward_weight / 10., forward_datasources[target_node.fwd_segment_position]});
|
||||
geometry.segment_offsets.push_back(geometry.locations.size());
|
||||
geometry.locations.push_back(target_node.location);
|
||||
|
||||
@@ -91,6 +99,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
||||
geometry.osm_node_ids.push_back(
|
||||
facade.GetOSMNodeIDOfNode(forward_geometry[target_node.fwd_segment_position]));
|
||||
|
||||
|
||||
BOOST_ASSERT(geometry.segment_distances.size() == geometry.segment_offsets.size() - 1);
|
||||
BOOST_ASSERT(geometry.locations.size() > geometry.segment_distances.size());
|
||||
BOOST_ASSERT(geometry.annotations.size() == geometry.locations.size() - 1);
|
||||
|
||||
@@ -39,6 +39,7 @@ struct LegGeometry
|
||||
{
|
||||
double distance;
|
||||
double duration;
|
||||
DatasourceID datasource;
|
||||
};
|
||||
std::vector<Annotation> annotations;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user