Correct data entry for the empty string.
Rename name_offsets to name_lengths, because that makes more sense.
This commit is contained in:
parent
68c01d09bb
commit
6914d26187
@ -57,8 +57,8 @@ ExtractionContainers::ExtractionContainers()
|
|||||||
{
|
{
|
||||||
// Check if stxxl can be instantiated
|
// Check if stxxl can be instantiated
|
||||||
stxxl::vector<unsigned> dummy_vector;
|
stxxl::vector<unsigned> dummy_vector;
|
||||||
name_char_data.push_back('\0');
|
// Insert the empty string, it has no data and is zero length
|
||||||
name_offsets.push_back(1);
|
name_lengths.push_back(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtractionContainers::~ExtractionContainers()
|
ExtractionContainers::~ExtractionContainers()
|
||||||
@ -68,7 +68,7 @@ ExtractionContainers::~ExtractionContainers()
|
|||||||
all_nodes_list.clear();
|
all_nodes_list.clear();
|
||||||
all_edges_list.clear();
|
all_edges_list.clear();
|
||||||
name_char_data.clear();
|
name_char_data.clear();
|
||||||
name_offsets.clear();
|
name_lengths.clear();
|
||||||
restrictions_list.clear();
|
restrictions_list.clear();
|
||||||
way_start_end_id_list.clear();
|
way_start_end_id_list.clear();
|
||||||
}
|
}
|
||||||
@ -121,13 +121,13 @@ void ExtractionContainers::WriteNames(const std::string& names_file_name) const
|
|||||||
|
|
||||||
unsigned total_length = 0;
|
unsigned total_length = 0;
|
||||||
|
|
||||||
for (const unsigned &name_offset : name_offsets)
|
for (const unsigned &name_length : name_lengths)
|
||||||
{
|
{
|
||||||
total_length += name_offset;
|
total_length += name_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
// builds and writes the index
|
// builds and writes the index
|
||||||
RangeTable<> name_index_range(name_offsets);
|
RangeTable<> name_index_range(name_lengths);
|
||||||
name_file_stream << name_index_range;
|
name_file_stream << name_index_range;
|
||||||
|
|
||||||
name_file_stream.write((char *)&total_length, sizeof(unsigned));
|
name_file_stream.write((char *)&total_length, sizeof(unsigned));
|
||||||
|
@ -71,7 +71,7 @@ class ExtractionContainers
|
|||||||
STXXLNodeVector all_nodes_list;
|
STXXLNodeVector all_nodes_list;
|
||||||
STXXLEdgeVector all_edges_list;
|
STXXLEdgeVector all_edges_list;
|
||||||
stxxl::vector<char> name_char_data;
|
stxxl::vector<char> name_char_data;
|
||||||
std::vector<unsigned> name_offsets;
|
std::vector<unsigned> name_lengths;
|
||||||
STXXLRestrictionsVector restrictions_list;
|
STXXLRestrictionsVector restrictions_list;
|
||||||
STXXLWayIDStartEndVector way_start_end_id_list;
|
STXXLWayIDStartEndVector way_start_end_id_list;
|
||||||
std::unordered_map<OSMNodeID, NodeID> external_to_internal_node_id_map;
|
std::unordered_map<OSMNodeID, NodeID> external_to_internal_node_id_map;
|
||||||
|
@ -153,7 +153,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
|
|||||||
|
|
||||||
// Get the unique identifier for the street name
|
// Get the unique identifier for the street name
|
||||||
const auto &string_map_iterator = string_map.find(parsed_way.name);
|
const auto &string_map_iterator = string_map.find(parsed_way.name);
|
||||||
unsigned name_id = external_memory.name_offsets.size();
|
unsigned name_id = external_memory.name_lengths.size();
|
||||||
if (string_map.end() == string_map_iterator)
|
if (string_map.end() == string_map_iterator)
|
||||||
{
|
{
|
||||||
unsigned name_length = 0;
|
unsigned name_length = 0;
|
||||||
@ -167,7 +167,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
|
|||||||
external_memory.name_char_data.push_back(c);
|
external_memory.name_char_data.push_back(c);
|
||||||
name_length++;
|
name_length++;
|
||||||
}
|
}
|
||||||
external_memory.name_offsets.push_back(name_length);
|
external_memory.name_lengths.push_back(name_length);
|
||||||
string_map.insert(std::make_pair(parsed_way.name, name_id));
|
string_map.insert(std::make_pair(parsed_way.name, name_id));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user