Also exclude the compressed flag from the data format
This commit is contained in:
parent
8d7821c84e
commit
21245273b4
@ -160,7 +160,6 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
|
||||
m_name_ID_list[i] = current_edge_data.name_id;
|
||||
m_turn_instruction_list[i] = current_edge_data.turn_instruction;
|
||||
m_travel_mode_list[i] = current_edge_data.travel_mode;
|
||||
BOOST_ASSERT(current_edge_data.compressed_geometry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,12 +300,14 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
|
||||
std::vector<NodeID> id_vector;
|
||||
facade->GetUncompressedGeometry(facade->GetGeometryIndexForEdgeID(ed.id),
|
||||
id_vector);
|
||||
BOOST_ASSERT(id_vector.size() > 0);
|
||||
|
||||
std::vector<EdgeWeight> weight_vector;
|
||||
facade->GetUncompressedWeights(facade->GetGeometryIndexForEdgeID(ed.id),
|
||||
weight_vector);
|
||||
BOOST_ASSERT(weight_vector.size() > 0);
|
||||
|
||||
int total_weight =
|
||||
auto total_weight =
|
||||
std::accumulate(weight_vector.begin(), weight_vector.end(), 0);
|
||||
|
||||
BOOST_ASSERT(weight_vector.size() == id_vector.size());
|
||||
@ -322,13 +324,14 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
|
||||
const std::size_t end_index = id_vector.size();
|
||||
|
||||
BOOST_ASSERT(start_index >= 0);
|
||||
BOOST_ASSERT(start_index <= end_index);
|
||||
BOOST_ASSERT(start_index < end_index);
|
||||
for (std::size_t i = start_index; i < end_index; ++i)
|
||||
{
|
||||
unpacked_path.emplace_back(id_vector[i], name_index,
|
||||
extractor::TurnInstruction::NoTurn, weight_vector[i],
|
||||
travel_mode);
|
||||
}
|
||||
BOOST_ASSERT(unpacked_path.size() > 0);
|
||||
unpacked_path.back().turn_instruction = turn_instruction;
|
||||
unpacked_path.back().segment_duration += (ed.distance - total_weight);
|
||||
}
|
||||
|
@ -17,24 +17,22 @@ struct OriginalEdgeData
|
||||
explicit OriginalEdgeData(NodeID via_node,
|
||||
unsigned name_id,
|
||||
TurnInstruction turn_instruction,
|
||||
bool compressed_geometry,
|
||||
TravelMode travel_mode)
|
||||
: via_node(via_node), name_id(name_id), turn_instruction(turn_instruction),
|
||||
compressed_geometry(compressed_geometry), travel_mode(travel_mode)
|
||||
travel_mode(travel_mode)
|
||||
{
|
||||
}
|
||||
|
||||
OriginalEdgeData()
|
||||
: via_node(std::numeric_limits<unsigned>::max()),
|
||||
name_id(std::numeric_limits<unsigned>::max()), turn_instruction(TurnInstruction::NoTurn),
|
||||
compressed_geometry(false), travel_mode(TRAVEL_MODE_INACCESSIBLE)
|
||||
travel_mode(TRAVEL_MODE_INACCESSIBLE)
|
||||
{
|
||||
}
|
||||
|
||||
NodeID via_node;
|
||||
unsigned name_id;
|
||||
TurnInstruction turn_instruction;
|
||||
bool compressed_geometry;
|
||||
TravelMode travel_mode;
|
||||
};
|
||||
}
|
||||
|
@ -297,7 +297,6 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
restricted_turns_counter = 0;
|
||||
skipped_uturns_counter = 0;
|
||||
skipped_barrier_turns_counter = 0;
|
||||
std::size_t compressed = 0;
|
||||
|
||||
std::ofstream edge_data_file(original_edge_data_filename.c_str(), std::ios::binary);
|
||||
std::ofstream edge_segment_file;
|
||||
@ -371,19 +370,10 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
|
||||
distance += turn_penalty;
|
||||
|
||||
const bool edge_is_compressed =
|
||||
m_compressed_edge_container.HasEntryForID(edge_form_u);
|
||||
|
||||
if (edge_is_compressed)
|
||||
{
|
||||
++compressed;
|
||||
}
|
||||
|
||||
BOOST_ASSERT(m_compressed_edge_container.HasEntryForID(edge_form_u));
|
||||
original_edge_data_vector.emplace_back(
|
||||
(edge_is_compressed ? m_compressed_edge_container.GetPositionForID(edge_form_u)
|
||||
: node_v),
|
||||
edge_data1.name_id, turn_instruction, edge_is_compressed,
|
||||
edge_data1.travel_mode);
|
||||
m_compressed_edge_container.GetPositionForID(edge_form_u), edge_data1.name_id,
|
||||
turn_instruction, edge_data1.travel_mode);
|
||||
|
||||
++original_edges_counter;
|
||||
|
||||
@ -418,56 +408,32 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
unsigned fixed_penalty = distance - edge_data1.distance;
|
||||
edge_penalty_file.write(reinterpret_cast<const char *>(&fixed_penalty),
|
||||
sizeof(fixed_penalty));
|
||||
if (edge_is_compressed)
|
||||
const auto node_based_edges =
|
||||
m_compressed_edge_container.GetBucketReference(edge_form_u);
|
||||
NodeID previous = node_u;
|
||||
|
||||
const unsigned node_count = node_based_edges.size() + 1;
|
||||
edge_segment_file.write(reinterpret_cast<const char *>(&node_count),
|
||||
sizeof(node_count));
|
||||
const QueryNode &first_node = m_node_info_list[previous];
|
||||
edge_segment_file.write(reinterpret_cast<const char *>(&first_node.node_id),
|
||||
sizeof(first_node.node_id));
|
||||
|
||||
for (auto target_node : node_based_edges)
|
||||
{
|
||||
const auto node_based_edges =
|
||||
m_compressed_edge_container.GetBucketReference(edge_form_u);
|
||||
NodeID previous = node_u;
|
||||
|
||||
const unsigned node_count = node_based_edges.size() + 1;
|
||||
edge_segment_file.write(reinterpret_cast<const char *>(&node_count),
|
||||
sizeof(node_count));
|
||||
const QueryNode &first_node = m_node_info_list[previous];
|
||||
edge_segment_file.write(reinterpret_cast<const char *>(&first_node.node_id),
|
||||
sizeof(first_node.node_id));
|
||||
|
||||
for (auto target_node : node_based_edges)
|
||||
{
|
||||
const QueryNode &from = m_node_info_list[previous];
|
||||
const QueryNode &to = m_node_info_list[target_node.node_id];
|
||||
const double segment_length =
|
||||
util::coordinate_calculation::greatCircleDistance(
|
||||
from.lat, from.lon, to.lat, to.lon);
|
||||
|
||||
edge_segment_file.write(reinterpret_cast<const char *>(&to.node_id),
|
||||
sizeof(to.node_id));
|
||||
edge_segment_file.write(reinterpret_cast<const char *>(&segment_length),
|
||||
sizeof(segment_length));
|
||||
edge_segment_file.write(
|
||||
reinterpret_cast<const char *>(&target_node.weight),
|
||||
sizeof(target_node.weight));
|
||||
previous = target_node.node_id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
static const unsigned node_count = 2;
|
||||
const QueryNode from = m_node_info_list[node_u];
|
||||
const QueryNode to = m_node_info_list[node_v];
|
||||
const QueryNode &from = m_node_info_list[previous];
|
||||
const QueryNode &to = m_node_info_list[target_node.node_id];
|
||||
const double segment_length =
|
||||
util::coordinate_calculation::greatCircleDistance(from.lat, from.lon,
|
||||
to.lat, to.lon);
|
||||
edge_segment_file.write(reinterpret_cast<const char *>(&node_count),
|
||||
sizeof(node_count));
|
||||
edge_segment_file.write(reinterpret_cast<const char *>(&from.node_id),
|
||||
sizeof(from.node_id));
|
||||
|
||||
edge_segment_file.write(reinterpret_cast<const char *>(&to.node_id),
|
||||
sizeof(to.node_id));
|
||||
edge_segment_file.write(reinterpret_cast<const char *>(&segment_length),
|
||||
sizeof(segment_length));
|
||||
edge_segment_file.write(
|
||||
reinterpret_cast<const char *>(&edge_data1.distance),
|
||||
sizeof(edge_data1.distance));
|
||||
edge_segment_file.write(reinterpret_cast<const char *>(&target_node.weight),
|
||||
sizeof(target_node.weight));
|
||||
previous = target_node.node_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -405,7 +405,6 @@ int Storage::Run()
|
||||
name_id_ptr[i] = current_edge_data.name_id;
|
||||
travel_mode_ptr[i] = current_edge_data.travel_mode;
|
||||
turn_instructions_ptr[i] = current_edge_data.turn_instruction;
|
||||
BOOST_ASSERT(current_edge_data.compressed_geometry);
|
||||
}
|
||||
edges_input_stream.close();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user