Add BufferWriter/BufferReader and simplify interface for ConditionalRestrictions
This commit is contained in:
@@ -535,21 +535,21 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
&scripting_environment,
|
||||
weight_multiplier,
|
||||
&conditional_restriction_map](
|
||||
// what nodes will be used? In most cases this will be the id
|
||||
// stored in the edge_data. In case of duplicated nodes (e.g.
|
||||
// due to via-way restrictions), one/both of these might
|
||||
// refer to a newly added edge based node
|
||||
const auto edge_based_node_from,
|
||||
const auto edge_based_node_to,
|
||||
// the situation of the turn
|
||||
const auto node_along_road_entering,
|
||||
const auto node_based_edge_from,
|
||||
const auto intersection_node,
|
||||
const auto node_based_edge_to,
|
||||
const auto &turn_angle,
|
||||
const auto &road_legs_on_the_right,
|
||||
const auto &road_legs_on_the_left,
|
||||
const auto &edge_geometries) {
|
||||
// what nodes will be used? In most cases this will be the id
|
||||
// stored in the edge_data. In case of duplicated nodes (e.g.
|
||||
// due to via-way restrictions), one/both of these might
|
||||
// refer to a newly added edge based node
|
||||
const auto edge_based_node_from,
|
||||
const auto edge_based_node_to,
|
||||
// the situation of the turn
|
||||
const auto node_along_road_entering,
|
||||
const auto node_based_edge_from,
|
||||
const auto intersection_node,
|
||||
const auto node_based_edge_to,
|
||||
const auto &turn_angle,
|
||||
const auto &road_legs_on_the_right,
|
||||
const auto &road_legs_on_the_left,
|
||||
const auto &edge_geometries) {
|
||||
|
||||
const auto node_restricted =
|
||||
isRestricted(node_along_road_entering,
|
||||
@@ -871,7 +871,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
// TODO: this loop is not optimized - once we have a few
|
||||
// overrides available, we should index this for faster
|
||||
// lookups
|
||||
for (auto & override : unresolved_maneuver_overrides)
|
||||
for (auto &override : unresolved_maneuver_overrides)
|
||||
{
|
||||
for (auto &turn : override.turn_sequence)
|
||||
{
|
||||
@@ -1127,14 +1127,9 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
// do not really have a choice but to index the conditional penalties and walk over all
|
||||
// edge-based-edges to find the ID of the edge
|
||||
auto const indexed_conditionals = IndexConditionals(std::move(conditionals));
|
||||
{
|
||||
util::Log() << "Writing " << indexed_conditionals.size()
|
||||
<< " conditional turn penalties...";
|
||||
// write conditional turn penalties into the restrictions file
|
||||
storage::io::FileWriter writer(conditional_penalties_filename,
|
||||
storage::io::FileWriter::GenerateFingerprint);
|
||||
extractor::serialization::write(writer, indexed_conditionals);
|
||||
}
|
||||
util::Log() << "Writing " << indexed_conditionals.size() << " conditional turn penalties...";
|
||||
extractor::files::writeConditionalRestrictions(conditional_penalties_filename,
|
||||
indexed_conditionals);
|
||||
|
||||
// write weight penalties per turn
|
||||
BOOST_ASSERT(turn_weight_penalties.size() == turn_duration_penalties.size());
|
||||
|
||||
@@ -616,7 +616,7 @@ void ExtractionContainers::WriteNodes(storage::io::FileWriter &file_out) const
|
||||
}
|
||||
BOOST_ASSERT(*node_id_iterator == node_iterator->node_id);
|
||||
|
||||
file_out.WriteOne((*node_iterator));
|
||||
file_out.WriteFrom((*node_iterator));
|
||||
|
||||
++node_id_iterator;
|
||||
++node_iterator;
|
||||
|
||||
@@ -853,16 +853,16 @@ void Extractor::WriteCompressedNodeBasedGraph(const std::string &path,
|
||||
{
|
||||
const auto to_node = graph.GetTarget(edge);
|
||||
|
||||
writer.WriteOne(from_node);
|
||||
writer.WriteOne(to_node);
|
||||
writer.WriteFrom(from_node);
|
||||
writer.WriteFrom(to_node);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME this is unneccesary: We have this data
|
||||
for (const auto &qnode : coordinates)
|
||||
{
|
||||
writer.WriteOne(qnode.lon);
|
||||
writer.WriteOne(qnode.lat);
|
||||
writer.WriteFrom(qnode.lon);
|
||||
writer.WriteFrom(qnode.lat);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -596,9 +596,8 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
|
||||
std::vector<extractor::ConditionalTurnPenalty> conditional_turns;
|
||||
if (update_conditional_turns)
|
||||
{
|
||||
using storage::io::FileReader;
|
||||
FileReader reader(config.GetPath(".osrm.restrictions"), FileReader::VerifyFingerprint);
|
||||
extractor::serialization::read(reader, conditional_turns);
|
||||
extractor::files::readConditionalRestrictions(config.GetPath(".osrm.restrictions"),
|
||||
conditional_turns);
|
||||
}
|
||||
|
||||
tbb::concurrent_vector<GeometryID> updated_segments;
|
||||
|
||||
Reference in New Issue
Block a user