MCPcopy Create free account
hub / github.com/comaps/comaps / BuildTransit

Function BuildTransit

generator/transit_generator.cpp:188–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188void 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

Callers 1

generator_tool.cppFile · 0.50

Calls 13

AddSlashIfNeededFunction · 0.85
JoinPathFunction · 0.85
ProcessGraphFunction · 0.85
ClipGraphMethod · 0.80
AppendToMethod · 0.80
GetWriterMethod · 0.80
GetMwmPathFunction · 0.70
FillOsmIdToFeatureIdsMapFunction · 0.70
LoadBordersFunction · 0.70
DeserializeFromJsonFunction · 0.70
IsEmptyMethod · 0.45

Tested by

no test coverage detected