Unpacking of intermediate paths
This commit is contained in:
@@ -86,6 +86,15 @@ public:
|
||||
const unsigned id
|
||||
) const = 0;
|
||||
|
||||
virtual bool EdgeIsCompressed( const unsigned id ) const = 0;
|
||||
|
||||
virtual unsigned GetGeometryIndexForEdgeID(const unsigned id) const = 0;
|
||||
|
||||
virtual void GetUncompressedGeometry(
|
||||
const unsigned id,
|
||||
std::vector<unsigned> & result_nodes
|
||||
) const = 0;
|
||||
|
||||
virtual TurnInstruction GetTurnInstructionForEdgeID(
|
||||
const unsigned id
|
||||
) const = 0;
|
||||
|
||||
@@ -67,6 +67,9 @@ private:
|
||||
ShM<TurnInstruction, false>::vector m_turn_instruction_list;
|
||||
ShM<char, false>::vector m_names_char_list;
|
||||
ShM<unsigned, false>::vector m_name_begin_indices;
|
||||
ShM<bool, false>::vector m_egde_is_compressed;
|
||||
ShM<unsigned, false>::vector m_compressed_geometry_indices;
|
||||
ShM<unsigned, false>::vector m_compressed_geometries;
|
||||
|
||||
StaticRTree<RTreeLeaf, false> * m_static_rtree;
|
||||
|
||||
@@ -146,9 +149,12 @@ private:
|
||||
);
|
||||
unsigned number_of_edges = 0;
|
||||
edges_input_stream.read((char*)&number_of_edges, sizeof(unsigned));
|
||||
m_via_node_list.resize(number_of_edges);
|
||||
m_name_ID_list.resize(number_of_edges);
|
||||
m_via_node_list.resize (number_of_edges);
|
||||
m_name_ID_list.resize (number_of_edges);
|
||||
m_turn_instruction_list.resize(number_of_edges);
|
||||
m_egde_is_compressed.resize (number_of_edges);
|
||||
|
||||
unsigned compressed = 0;
|
||||
|
||||
OriginalEdgeData current_edge_data;
|
||||
for(unsigned i = 0; i < number_of_edges; ++i) {
|
||||
@@ -157,16 +163,58 @@ private:
|
||||
sizeof(OriginalEdgeData)
|
||||
);
|
||||
m_via_node_list[i] = current_edge_data.via_node;
|
||||
if(current_edge_data.via_node == 0 && current_edge_data.compressed_geometry) {
|
||||
SimpleLogger().Write() << "0 at index " << i;
|
||||
}
|
||||
|
||||
m_name_ID_list[i] = current_edge_data.name_id;
|
||||
m_turn_instruction_list[i] = current_edge_data.turn_instruction;
|
||||
m_egde_is_compressed[i] = current_edge_data.compressed_geometry;
|
||||
if(m_egde_is_compressed[i]) {
|
||||
++compressed;
|
||||
}
|
||||
}
|
||||
SimpleLogger().Write(logDEBUG) << "compressed: " << compressed;
|
||||
|
||||
edges_input_stream.close();
|
||||
}
|
||||
|
||||
void LoadGeometries(
|
||||
const boost::filesystem::path & geometries_file
|
||||
const boost::filesystem::path & geometry_file
|
||||
) {
|
||||
std::ifstream geometry_stream(
|
||||
geometry_file.c_str(),
|
||||
std::ios::binary
|
||||
);
|
||||
unsigned number_of_indices = 0;
|
||||
unsigned number_of_compressed_geometries = 0;
|
||||
|
||||
geometry_stream.read(
|
||||
(char *)&number_of_indices,
|
||||
sizeof(unsigned)
|
||||
);
|
||||
m_compressed_geometry_indices.resize(number_of_indices);
|
||||
geometry_stream.read(
|
||||
(char *)&(m_compressed_geometry_indices[0]),
|
||||
number_of_indices*sizeof(unsigned)
|
||||
);
|
||||
|
||||
geometry_stream.read(
|
||||
(char *)&number_of_compressed_geometries,
|
||||
sizeof(unsigned)
|
||||
);
|
||||
|
||||
BOOST_ASSERT( m_compressed_geometry_indices.back() == number_of_compressed_geometries );
|
||||
m_compressed_geometries.resize( number_of_compressed_geometries );
|
||||
|
||||
geometry_stream.read(
|
||||
(char *)&(m_compressed_geometries[0]),
|
||||
number_of_compressed_geometries*sizeof(unsigned)
|
||||
);
|
||||
geometry_stream.close();
|
||||
|
||||
SimpleLogger().Write() << "number_of_indices: " << number_of_indices;
|
||||
SimpleLogger().Write() << "number_of_compressed_geometries: " << number_of_compressed_geometries;
|
||||
}
|
||||
|
||||
void LoadRTree(
|
||||
@@ -330,10 +378,15 @@ public:
|
||||
FixedPointCoordinate GetCoordinateOfNode(
|
||||
const unsigned id
|
||||
) const {
|
||||
const NodeID node = m_via_node_list.at(id);
|
||||
return m_coordinate_list.at(node);
|
||||
// const unsigned coordinate_index = m_via_node_list.at(id);
|
||||
return m_coordinate_list.at(id);
|
||||
};
|
||||
|
||||
bool EdgeIsCompressed( const unsigned id ) const {
|
||||
// const NodeID node = m_via_node_list.at(id);
|
||||
return m_egde_is_compressed.at(id);
|
||||
}
|
||||
|
||||
TurnInstruction GetTurnInstructionForEdgeID(
|
||||
const unsigned id
|
||||
) const {
|
||||
@@ -400,6 +453,29 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
virtual unsigned GetGeometryIndexForEdgeID(const unsigned id) const {
|
||||
return m_via_node_list.at(id);
|
||||
}
|
||||
|
||||
virtual void GetUncompressedGeometry(
|
||||
const unsigned id, std::vector<unsigned> & result_nodes
|
||||
) const {
|
||||
const NodeID node = m_via_node_list.at(id);
|
||||
SimpleLogger().Write() << "translated " << id << " to " << node;
|
||||
SimpleLogger().Write() << "getting geometry from compression bucket " << node << "/" << m_compressed_geometry_indices.size();
|
||||
unsigned begin = m_compressed_geometry_indices.at(node);
|
||||
unsigned end = m_compressed_geometry_indices.at(node+1);
|
||||
SimpleLogger().Write() << "bucket " << node << " has range [" << begin << "," << end-1 << "]";
|
||||
//TODO: use vector.insert(.)
|
||||
for(unsigned geometry_index = begin; geometry_index < end; ++geometry_index) {
|
||||
unsigned coordinate_id = m_compressed_geometries[geometry_index];
|
||||
// uncomment to use compressed geometry
|
||||
result_nodes.push_back( coordinate_id );
|
||||
SimpleLogger().Write() << "coordinate " << coordinate_id << " at " << m_coordinate_list.at(coordinate_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string GetTimestamp() const {
|
||||
return m_timestamp;
|
||||
}
|
||||
|
||||
@@ -308,10 +308,25 @@ public:
|
||||
FixedPointCoordinate GetCoordinateOfNode(
|
||||
const unsigned id
|
||||
) const {
|
||||
const NodeID node = m_via_node_list.at(id);
|
||||
return m_coordinate_list.at(node);
|
||||
// const NodeID node = m_via_node_list.at(id);
|
||||
return m_coordinate_list.at(id);
|
||||
};
|
||||
|
||||
virtual bool EdgeIsCompressed( const unsigned id ) const {
|
||||
//TODO!!
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void GetUncompressedGeometry(
|
||||
const unsigned id, std::vector<unsigned> & result_nodes
|
||||
) const {
|
||||
//TODO!!
|
||||
}
|
||||
|
||||
virtual unsigned GetGeometryIndexForEdgeID(const unsigned id) const {
|
||||
return m_via_node_list.at(id);
|
||||
}
|
||||
|
||||
TurnInstruction GetTurnInstructionForEdgeID(
|
||||
const unsigned id
|
||||
) const {
|
||||
|
||||
Reference in New Issue
Block a user