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

Method GetAllSuitablePaths

tools/openlr/score_candidate_paths_getter.cpp:130–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130void ScoreCandidatePathsGetter::GetAllSuitablePaths(ScoreEdgeVec const & startLines, LinearSegmentSource source,
131 bool isLastPoint, double bearDistM,
132 FunctionalRoadClass functionalRoadClass, FormOfWay formOfWay,
133 double distanceToNextPointM, vector<shared_ptr<Link>> & allPaths)
134{
135 CHECK_NOT_EQUAL(source, LinearSegmentSource::NotValid, ());
136
137 queue<shared_ptr<Link>> q;
138
139 for (auto const & e : startLines)
140 {
141 Score roadScore = 0; // Score based on functional road class and form of way.
142 if (source == LinearSegmentSource::FromLocationReferenceTag &&
143 !PassesRestrictionV3(e.m_edge, functionalRoadClass, formOfWay, m_infoGetter, roadScore))
144 {
145 continue;
146 }
147
148 q.push(make_shared<Link>(nullptr /* parent */, e.m_edge, 0 /* distanceM */, e.m_score, roadScore));
149 }
150
151 // Filling |allPaths| staring from |startLines| which have passed functional road class
152 // and form of way restrictions. All paths in |allPaths| are shorter then |bearDistM| plus
153 // one segment length.
154 while (!q.empty())
155 {
156 auto const u = q.front();
157 q.pop();
158
159 auto const & currentEdge = u->m_edge;
160 auto const currentEdgeLen = EdgeLength(currentEdge);
161
162 // The path from the start of the openlr segment to the finish to the openlr segment should be
163 // much shorter then the distance of any connection of openlr segment.
164 // This condition should be checked because otherwise in rare case |q| may be overfilled.
165 if (u->m_distanceM > distanceToNextPointM)
166 continue;
167
168 if (u->m_distanceM + currentEdgeLen >= bearDistM)
169 {
170 allPaths.emplace_back(std::move(u));
171 continue;
172 }
173
174 CHECK_LESS(u->m_distanceM + currentEdgeLen, bearDistM, ());
175
176 Graph::EdgeListT edges;
177 if (!isLastPoint)
178 m_graph.GetOutgoingEdges(currentEdge.GetEndJunction(), edges);
179 else
180 m_graph.GetIngoingEdges(currentEdge.GetStartJunction(), edges);
181
182 // It's possible that road edges are duplicated a lot of times. It's a error but
183 // a mapper may do that. To prevent a combinatorial explosion while matching
184 // duplicated edges should be removed.
185 scpg::EdgeSortUniqueByStartAndEndPoints(edges);
186
187 for (auto const & e : edges)

Callers

nothing calls this directly

Calls 15

PassesRestrictionV3Function · 0.85
EdgeLengthFunction · 0.85
EdgesAreAlmostEqualFunction · 0.85
pushMethod · 0.80
frontMethod · 0.80
popMethod · 0.80
GetReverseEdgeMethod · 0.80
HasRealPartMethod · 0.80
IsJunctionInPathMethod · 0.80
emptyMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected