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

Method DeserializeFromJson

libs/transit/transit_graph_data.cpp:226–242  ·  view source on GitHub ↗

GraphData --------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

224
225// GraphData --------------------------------------------------------------------------------------
226void GraphData::DeserializeFromJson(base::Json const & root, OsmIdToFeatureIdsMap const & mapping)
227{
228 DeserializerFromJson deserializer(root.get(), mapping);
229 Visit(deserializer);
230
231 // Removes equivalent edges from |m_edges|. If there are several equivalent edges only
232 // the most lightweight edge is left.
233 // Note. It's possible that two stops are connected with the same line several times
234 // in the same direction. It happens in Oslo metro (T-banen):
235 // https://en.wikipedia.org/wiki/Oslo_Metro#/media/File:Oslo_Metro_Map.svg branch 5.
236 base::SortUnique(m_edges, [](Edge const & e1, Edge const & e2)
237 {
238 if (e1 != e2)
239 return e1 < e2;
240 return e1.GetWeight() < e2.GetWeight();
241 }, [](Edge const & e1, Edge const & e2) { return e1 == e2; });
242}
243
244void GraphData::Serialize(Writer & writer)
245{

Callers 2

DeserializeFromJsonFunction · 0.45
DeserializeFromJsonFunction · 0.45

Calls 3

SortUniqueFunction · 0.85
getMethod · 0.65
GetWeightMethod · 0.45

Tested by

no test coverage detected