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

Method GetReverseBearing

tools/openlr/router.cpp:390–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

388}
389
390uint32_t Router::GetReverseBearing(Vertex const & u, Links const & links) const
391{
392 m2::PointD const a = u.m_junction.GetPoint();
393 m2::PointD b = m2::PointD::Zero();
394
395 Vertex curr = u;
396 double passed = 0;
397 bool found = false;
398 while (true)
399 {
400 auto const it = links.find(curr);
401 if (it == links.end())
402 break;
403
404 auto const & p = it->second;
405 auto const & prev = p.first;
406 auto const & edge = p.second.m_raw;
407
408 if (prev.m_stage != curr.m_stage)
409 break;
410
411 double const weight = GetWeight(edge);
412
413 if (passed + weight >= kBearingDist)
414 {
415 double const delta = kBearingDist - passed;
416 b = PointAtSegment(edge.GetEndJunction().GetPoint(), edge.GetStartJunction().GetPoint(), delta);
417 found = true;
418 break;
419 }
420
421 passed += weight;
422 curr = prev;
423 }
424 if (!found)
425 b = curr.m_junction.GetPoint();
426 return Bearing(a, b);
427}
428
429template <typename Fn>
430void Router::ForEachEdge(Vertex const & u, bool outgoing, FunctionalRoadClass restriction, Fn && fn)

Callers

nothing calls this directly

Calls 7

ZeroFunction · 0.85
PointAtSegmentFunction · 0.85
BearingFunction · 0.70
GetWeightFunction · 0.50
GetPointMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected