| 1109 | } |
| 1110 | |
| 1111 | int IndexRouter::PointsOnEdgesSnapping::Snap(m2::PointD const & start, m2::PointD const & finish, |
| 1112 | m2::PointD const & direction, FakeEnding & startEnding, |
| 1113 | FakeEnding & finishEnding, bool & startIsCodirectional) |
| 1114 | { |
| 1115 | if (m_startSegments.empty()) // A first call for the first starting point |
| 1116 | { |
| 1117 | FillDeadEndsCache(finish); |
| 1118 | |
| 1119 | if (!FindBestSegments(start, direction, true /* isOutgoing */, m_startSegments, startIsCodirectional)) |
| 1120 | return 1; |
| 1121 | } |
| 1122 | |
| 1123 | vector<Segment> finishSegments; |
| 1124 | bool dummy; |
| 1125 | if (!FindBestSegments(finish, {} /* direction */, false /* isOutgoing */, finishSegments, dummy)) |
| 1126 | return 2; |
| 1127 | |
| 1128 | // One of startEnding or finishEnding will be empty here. |
| 1129 | if (startEnding.m_projections.empty()) |
| 1130 | startEnding = MakeFakeEnding(m_startSegments, start, m_graph); |
| 1131 | |
| 1132 | if (finishEnding.m_projections.empty()) |
| 1133 | finishEnding = MakeFakeEnding(finishSegments, finish, m_graph); |
| 1134 | |
| 1135 | return 0; |
| 1136 | } |
| 1137 | |
| 1138 | void IndexRouter::PointsOnEdgesSnapping::FillDeadEndsCache(m2::PointD const & point) |
| 1139 | { |
no test coverage detected