#5325 Fixes after the revew
This commit is contained in:
parent
b1cfc02454
commit
848e96238e
@ -49,8 +49,9 @@ class CompressedEdgeContainer
|
|||||||
const SegmentWeight duration);
|
const SegmentWeight duration);
|
||||||
|
|
||||||
void InitializeBothwayVector();
|
void InitializeBothwayVector();
|
||||||
unsigned
|
unsigned ZipEdges(const unsigned f_edge_pos,
|
||||||
ZipEdges(const unsigned f_edge_pos, const unsigned r_edge_pos, OSMWayIDMap &osm_way_id_map);
|
const unsigned r_edge_pos,
|
||||||
|
const OSMWayIDMap &osm_way_id_map);
|
||||||
|
|
||||||
bool HasEntryForID(const EdgeID edge_id) const;
|
bool HasEntryForID(const EdgeID edge_id) const;
|
||||||
bool HasZippedEntryForForwardID(const EdgeID edge_id) const;
|
bool HasZippedEntryForForwardID(const EdgeID edge_id) const;
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class NodeBasedGraphFactory
|
|||||||
// Most ways are bidirectional, making the geometry in forward and backward direction the same,
|
// Most ways are bidirectional, making the geometry in forward and backward direction the same,
|
||||||
// except for reversal. We make use of this fact by keeping only one representation of the
|
// except for reversal. We make use of this fact by keeping only one representation of the
|
||||||
// geometry around
|
// geometry around
|
||||||
void CompressGeometry(OSMWayIDMap &osm_way_id_map);
|
void CompressGeometry(const OSMWayIDMap &osm_way_id_map);
|
||||||
|
|
||||||
// After graph compression, some of the annotation entries might not be referenced anymore. We
|
// After graph compression, some of the annotation entries might not be referenced anymore. We
|
||||||
// compress the annotation data by relabeling the node-based graph references and removing all
|
// compress the annotation data by relabeling the node-based graph references and removing all
|
||||||
|
|||||||
@ -104,7 +104,6 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
|
|||||||
|
|
||||||
auto GetReverseOSMWayIDs(const DirectionalGeometryID id)
|
auto GetReverseOSMWayIDs(const DirectionalGeometryID id)
|
||||||
{
|
{
|
||||||
// return boost::adaptors::reverse(GetForwardOSMWayIDs(id));
|
|
||||||
return boost::adaptors::reverse(
|
return boost::adaptors::reverse(
|
||||||
boost::adaptors::transform(GetForwardOSMWayIDs(id), std::negate<OSMWayIDDir>()));
|
boost::adaptors::transform(GetForwardOSMWayIDs(id), std::negate<OSMWayIDDir>()));
|
||||||
}
|
}
|
||||||
@ -180,7 +179,6 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
|
|||||||
|
|
||||||
auto GetReverseOSMWayIDs(const DirectionalGeometryID id) const
|
auto GetReverseOSMWayIDs(const DirectionalGeometryID id) const
|
||||||
{
|
{
|
||||||
// return boost::adaptors::reverse(GetForwardOSMWayIDs(id));
|
|
||||||
return boost::adaptors::reverse(
|
return boost::adaptors::reverse(
|
||||||
boost::adaptors::transform(GetForwardOSMWayIDs(id), std::negate<OSMWayIDDir>()));
|
boost::adaptors::transform(GetForwardOSMWayIDs(id), std::negate<OSMWayIDDir>()));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -264,7 +264,7 @@ void CompressedEdgeContainer::InitializeBothwayVector()
|
|||||||
|
|
||||||
unsigned CompressedEdgeContainer::ZipEdges(const EdgeID f_edge_id,
|
unsigned CompressedEdgeContainer::ZipEdges(const EdgeID f_edge_id,
|
||||||
const EdgeID r_edge_id,
|
const EdgeID r_edge_id,
|
||||||
OSMWayIDMap &osm_way_id_map)
|
const OSMWayIDMap &osm_way_id_map)
|
||||||
{
|
{
|
||||||
if (!segment_data)
|
if (!segment_data)
|
||||||
InitializeBothwayVector();
|
InitializeBothwayVector();
|
||||||
@ -293,14 +293,7 @@ unsigned CompressedEdgeContainer::ZipEdges(const EdgeID f_edge_id,
|
|||||||
segment_data->fwd_datasources.emplace_back(LUA_SOURCE);
|
segment_data->fwd_datasources.emplace_back(LUA_SOURCE);
|
||||||
segment_data->rev_datasources.emplace_back(LUA_SOURCE);
|
segment_data->rev_datasources.emplace_back(LUA_SOURCE);
|
||||||
|
|
||||||
for (std::size_t i = 0; i < forward_bucket.size() - 1; ++i)
|
auto store_way_id = [&](const NodeID prev_node_id, const NodeID node_id) {
|
||||||
{
|
|
||||||
const auto &fwd_node = forward_bucket.at(i);
|
|
||||||
const auto &rev_node = reverse_bucket.at(reverse_bucket.size() - 2 - i);
|
|
||||||
|
|
||||||
BOOST_ASSERT(fwd_node.node_id == rev_node.node_id);
|
|
||||||
|
|
||||||
auto node_id = fwd_node.node_id;
|
|
||||||
if (node_id != prev_node_id)
|
if (node_id != prev_node_id)
|
||||||
{
|
{
|
||||||
auto find_way_id = osm_way_id_map.find(OSMWayIDMapKey(prev_node_id, node_id));
|
auto find_way_id = osm_way_id_map.find(OSMWayIDMapKey(prev_node_id, node_id));
|
||||||
@ -323,6 +316,18 @@ unsigned CompressedEdgeContainer::ZipEdges(const EdgeID f_edge_id,
|
|||||||
// Special case (artificial lighting signal edge)
|
// Special case (artificial lighting signal edge)
|
||||||
segment_data->osm_ways.emplace_back(osm_way_id);
|
segment_data->osm_ways.emplace_back(osm_way_id);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for (std::size_t i = 0; i < forward_bucket.size() - 1; ++i)
|
||||||
|
{
|
||||||
|
const auto &fwd_node = forward_bucket.at(i);
|
||||||
|
const auto &rev_node = reverse_bucket.at(reverse_bucket.size() - 2 - i);
|
||||||
|
|
||||||
|
BOOST_ASSERT(fwd_node.node_id == rev_node.node_id);
|
||||||
|
|
||||||
|
auto node_id = fwd_node.node_id;
|
||||||
|
|
||||||
|
store_way_id(prev_node_id, node_id);
|
||||||
|
|
||||||
segment_data->nodes.emplace_back(fwd_node.node_id);
|
segment_data->nodes.emplace_back(fwd_node.node_id);
|
||||||
segment_data->fwd_weights.emplace_back(fwd_node.weight);
|
segment_data->fwd_weights.emplace_back(fwd_node.weight);
|
||||||
@ -336,28 +341,7 @@ unsigned CompressedEdgeContainer::ZipEdges(const EdgeID f_edge_id,
|
|||||||
|
|
||||||
const auto &last_node = forward_bucket.back();
|
const auto &last_node = forward_bucket.back();
|
||||||
auto node_id = last_node.node_id;
|
auto node_id = last_node.node_id;
|
||||||
if (node_id != prev_node_id)
|
store_way_id(prev_node_id, node_id);
|
||||||
{
|
|
||||||
auto find_way_id = osm_way_id_map.find(OSMWayIDMapKey(prev_node_id, node_id));
|
|
||||||
if (find_way_id != osm_way_id_map.cend())
|
|
||||||
{
|
|
||||||
segment_data->osm_ways.emplace_back(osm_way_id = find_way_id->second);
|
|
||||||
util::Log(logDEBUG) << "zipped_geometry_id: " << zipped_geometry_id << " "
|
|
||||||
<< prev_node_id << "->" << node_id << " = " << osm_way_id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
util::Log(logERROR)
|
|
||||||
<< "OSM Way ID not found for (nbg) nodes, it should never be happened: "
|
|
||||||
<< prev_node_id << "<-x->" << node_id;
|
|
||||||
segment_data->osm_ways.emplace_back(osm_way_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Special case (artificial lighting signal edge)
|
|
||||||
segment_data->osm_ways.emplace_back(osm_way_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make osm_ways vector size the same as
|
// Make osm_ways vector size the same as
|
||||||
// nodes vector size to use index vector for the both
|
// nodes vector size to use index vector for the both
|
||||||
|
|||||||
@ -94,7 +94,7 @@ void NodeBasedGraphFactory::Compress(ScriptingEnvironment &scripting_environment
|
|||||||
compressed_edge_container);
|
compressed_edge_container);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeBasedGraphFactory::CompressGeometry(OSMWayIDMap &osm_way_id_map)
|
void NodeBasedGraphFactory::CompressGeometry(const OSMWayIDMap &osm_way_id_map)
|
||||||
{
|
{
|
||||||
for (const auto nbg_node_u : util::irange(0u, compressed_output_graph.GetNumberOfNodes()))
|
for (const auto nbg_node_u : util::irange(0u, compressed_output_graph.GetNumberOfNodes()))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -733,7 +733,6 @@ BOOST_AUTO_TEST_CASE(test_route_annotated_ways)
|
|||||||
BOOST_TEST_MESSAGE("split_trace_locations with steps");
|
BOOST_TEST_MESSAGE("split_trace_locations with steps");
|
||||||
check_route_annotated_ways(coordinates, osrm, node_pair_to_way_id_map, true);
|
check_route_annotated_ways(coordinates, osrm, node_pair_to_way_id_map, true);
|
||||||
coordinates = get_locations_in_big_component();
|
coordinates = get_locations_in_big_component();
|
||||||
// auto coords =
|
|
||||||
BOOST_TEST_MESSAGE("locations_in_big_component without steps");
|
BOOST_TEST_MESSAGE("locations_in_big_component without steps");
|
||||||
check_route_annotated_ways(coordinates, osrm, node_pair_to_way_id_map, false);
|
check_route_annotated_ways(coordinates, osrm, node_pair_to_way_id_map, false);
|
||||||
BOOST_TEST_MESSAGE("locations_in_big_component with steps");
|
BOOST_TEST_MESSAGE("locations_in_big_component with steps");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user