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

Method Snap

libs/routing/index_router.cpp:1111–1136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1109}
1110
1111int 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
1138void IndexRouter::PointsOnEdgesSnapping::FillDeadEndsCache(m2::PointD const & point)
1139{

Callers 1

DoCalculateRouteMethod · 0.80

Calls 2

MakeFakeEndingFunction · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected