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

Function GetProjection

libs/transit/world_feed/feed_helpers.cpp:59–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59ProjectionData GetProjection(std::vector<m2::PointD> const & polyline, size_t index, Direction direction,
60 ProjectionToShape const & proj)
61{
62 ProjectionData projData;
63 projData.m_distFromPoint = proj.m_dist;
64 projData.m_proj = proj.m_point;
65
66 int64_t const next = direction == Direction::Forward ? index + 1 : index - 1;
67 CHECK_GREATER_OR_EQUAL(next, 0, ());
68 CHECK_LESS(static_cast<size_t>(next), polyline.size(), ());
69
70 if (AlmostEqualAbs(proj.m_point, polyline[index], kEps))
71 {
72 projData.m_indexOnShape = index;
73 projData.m_needsInsertion = false;
74 }
75 else if (AlmostEqualAbs(proj.m_point, polyline[next], kEps))
76 {
77 projData.m_indexOnShape = next;
78 projData.m_needsInsertion = false;
79 }
80 else
81 {
82 projData.m_indexOnShape = direction == Direction::Forward ? next : index;
83 projData.m_needsInsertion = true;
84 }
85
86 return projData;
87}
88
89void FillProjections(std::vector<m2::PointD> & polyline, size_t startIndex, size_t endIndex, m2::PointD const & point,
90 double distStopsM, Direction direction, std::vector<ProjectionData> & projections)

Callers 1

FillProjectionsFunction · 0.85

Calls 2

AlmostEqualAbsFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected