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

Method GetAllSuitablePaths

tools/openlr/candidate_paths_getter.cpp:116–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116void CandidatePathsGetter::GetAllSuitablePaths(Graph::EdgeVector const & startLines, bool isLastPoint, double bearDistM,
117 FunctionalRoadClass functionalRoadClass, FormOfWay formOfWay,
118 double distanceToNextPointM, vector<LinkPtr> & allPaths)
119{
120 queue<LinkPtr> q;
121
122 for (auto const & e : startLines)
123 {
124 auto const u = make_shared<Link>(nullptr /* parent */, e, 0 /* distanceM */);
125 q.push(u);
126 }
127
128 while (!q.empty())
129 {
130 auto const u = q.front();
131 q.pop();
132
133 auto const & currentEdge = u->m_edge;
134 auto const currentEdgeLen = EdgeLength(currentEdge);
135
136 // TODO(mgsergio): Maybe weak this constraint a bit.
137 if (u->m_distanceM + currentEdgeLen >= bearDistM)
138 {
139 allPaths.push_back(u);
140 continue;
141 }
142
143 ASSERT_LESS(u->m_distanceM + currentEdgeLen, bearDistM, ());
144
145 Graph::EdgeListT edges;
146 if (!isLastPoint)
147 m_graph.GetOutgoingEdges(currentEdge.GetEndJunction(), edges);
148 else
149 m_graph.GetIngoingEdges(currentEdge.GetStartJunction(), edges);
150
151 for (auto const & e : edges)
152 {
153 // Fake edges are allowed only at the start/end of the path.
154 if (e.IsFake())
155 continue;
156
157 if (EdgesAreAlmostEqual(e.GetReverseEdge(), currentEdge))
158 continue;
159
160 ASSERT(currentEdge.HasRealPart(), ());
161
162 if (!PassesRestriction(e, functionalRoadClass, formOfWay, 2 /* kFRCThreshold */, m_infoGetter))
163 continue;
164
165 // TODO(mgsergio): Should we check form of way as well?
166
167 if (u->IsPointOnPath(e.GetEndJunction()))
168 continue;
169
170 auto const p = make_shared<Link>(u, e, u->m_distanceM + currentEdgeLen);
171 q.push(p);
172 }
173 }

Callers

nothing calls this directly

Calls 15

EdgeLengthFunction · 0.85
EdgesAreAlmostEqualFunction · 0.85
ASSERTFunction · 0.85
PassesRestrictionFunction · 0.85
pushMethod · 0.80
frontMethod · 0.80
popMethod · 0.80
GetReverseEdgeMethod · 0.80
HasRealPartMethod · 0.80
IsPointOnPathMethod · 0.80
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected