| 186 | } |
| 187 | |
| 188 | void BuildTransit(std::string const & mwmDir, CountryId const & countryId, std::string const & osmIdToFeatureIdsPath, |
| 189 | std::string const & transitDir) |
| 190 | { |
| 191 | std::string const mwmPath = GetMwmPath(mwmDir, countryId); |
| 192 | LOG(LINFO, ("Building transit section for", mwmPath)); |
| 193 | |
| 194 | OsmIdToFeatureIdsMap mapping; |
| 195 | FillOsmIdToFeatureIdsMap(osmIdToFeatureIdsPath, mapping); |
| 196 | std::vector<m2::RegionD> mwmBorders; |
| 197 | LoadBorders(mwmDir, countryId, mwmBorders); |
| 198 | |
| 199 | Platform::FilesList graphFiles; |
| 200 | Platform::GetFilesByExt(base::AddSlashIfNeeded(transitDir), TRANSIT_FILE_EXTENSION, graphFiles); |
| 201 | |
| 202 | GraphData jointData; |
| 203 | for (auto const & fileName : graphFiles) |
| 204 | { |
| 205 | auto const filePath = base::JoinPath(transitDir, fileName); |
| 206 | GraphData data; |
| 207 | DeserializeFromJson(mapping, filePath, data); |
| 208 | // @todo(bykoianko) Json should be clipped on feature generation step. It's much more efficient. |
| 209 | data.ClipGraph(mwmBorders); |
| 210 | jointData.AppendTo(data); |
| 211 | } |
| 212 | |
| 213 | if (jointData.IsEmpty()) |
| 214 | return; // Empty transit section. |
| 215 | |
| 216 | ProcessGraph(mwmPath, countryId, mapping, jointData); |
| 217 | jointData.CheckValidSortedUnique(); |
| 218 | |
| 219 | FilesContainerW cont(mwmPath, FileWriter::OP_WRITE_EXISTING); |
| 220 | auto writer = cont.GetWriter(TRANSIT_FILE_TAG); |
| 221 | jointData.Serialize(*writer); |
| 222 | } |
| 223 | } // namespace routing::transit |
no test coverage detected