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

Method ExtractTrafficKeys

libs/traffic/traffic_info.cpp:173–191  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

171
172// static
173void TrafficInfo::ExtractTrafficKeys(string const & mwmPath, vector<RoadSegmentId> & result)
174{
175 result.clear();
176 feature::ForEachFeature(mwmPath, [&](FeatureType & ft, uint32_t const fid)
177 {
178 feature::TypesHolder const types(ft);
179 if (!routing::CarModel::AllLimitsInstance().IsRoad(types))
180 return;
181
182 ft.ParseGeometry(FeatureType::BEST_GEOMETRY);
183 auto const numPoints = static_cast<uint16_t>(ft.GetPointsCount());
184 uint8_t const numDirs = routing::CarModel::AllLimitsInstance().IsOneWay(types) ? 1 : 2;
185 for (uint16_t i = 0; i + 1 < numPoints; ++i)
186 for (uint8_t dir = 0; dir < numDirs; ++dir)
187 result.emplace_back(fid, i, dir);
188 });
189
190 ASSERT(is_sorted(result.begin(), result.end()), ());
191}
192
193// static
194void TrafficInfo::CombineColorings(vector<TrafficInfo::RoadSegmentId> const & keys,

Callers

nothing calls this directly

Calls 10

ForEachFeatureFunction · 0.85
ASSERTFunction · 0.85
ParseGeometryMethod · 0.80
clearMethod · 0.45
IsRoadMethod · 0.45
GetPointsCountMethod · 0.45
IsOneWayMethod · 0.45
emplace_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected