| 198 | } |
| 199 | |
| 200 | void MetalinesBuilder::Save() |
| 201 | { |
| 202 | LOG(LINFO, ("Saving metalines to", GetFilename())); |
| 203 | |
| 204 | std::unordered_multimap<size_t, std::shared_ptr<LineString>> keyToLineString; |
| 205 | FileReader reader(GetTmpFilename()); |
| 206 | ReaderSource<FileReader> src(reader); |
| 207 | while (src.Size() > 0) |
| 208 | { |
| 209 | auto const key = ReadVarUint<uint64_t>(src); |
| 210 | keyToLineString.emplace(key, std::make_shared<LineString>(LineString::Deserialize(src))); |
| 211 | } |
| 212 | |
| 213 | FileWriter writer(GetFilename()); |
| 214 | uint32_t countLines = 0; |
| 215 | uint32_t countWays = 0; |
| 216 | auto const mergedData = LineStringMerger::Merge(keyToLineString); |
| 217 | for (auto const & p : mergedData) |
| 218 | { |
| 219 | for (auto const & lineString : p.second) |
| 220 | { |
| 221 | auto const & ways = lineString->GetWays(); |
| 222 | rw::WriteVectorOfPOD(writer, ways); |
| 223 | countWays += ways.size(); |
| 224 | ++countLines; |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | LOG(LINFO, ("Finished saving metalines. Wrote", countLines, "metalines [with", countWays, "ways]")); |
| 229 | } |
| 230 | |
| 231 | void MetalinesBuilder::OrderCollectedData() |
| 232 | { |
nothing calls this directly
no test coverage detected