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

Method CalculateETA

libs/routing/index_graph_starter.cpp:288–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288double IndexGraphStarter::CalculateETA(Segment const & from, Segment const & to) const
289{
290 // We don't distinguish fake segment weight and fake segment transit time.
291 if (IsFakeSegment(to))
292 return CalcSegmentWeight(to, EdgeEstimator::Purpose::ETA).GetWeight();
293
294 if (IsFakeSegment(from))
295 return CalculateETAWithoutPenalty(to);
296
297 if (IsGuidesSegment(from) || IsGuidesSegment(to))
298 {
299 double res = 0.0;
300 if (IsGuidesSegment(from))
301 res += CalcGuidesSegmentWeight(from, EdgeEstimator::Purpose::ETA).GetWeight();
302 else
303 res += CalculateETAWithoutPenalty(from);
304
305 if (IsGuidesSegment(to))
306 res += CalcGuidesSegmentWeight(to, EdgeEstimator::Purpose::ETA).GetWeight();
307 else
308 res += CalculateETAWithoutPenalty(to);
309
310 return res;
311 }
312
313 if (IsRegionsGraphMode())
314 return m_regionsGraph->CalcSegmentWeight(from).GetWeight() + m_regionsGraph->CalcSegmentWeight(to).GetWeight();
315
316 return m_graph.CalculateETA(from, to);
317}
318
319double IndexGraphStarter::CalculateETAWithoutPenalty(Segment const & segment) const
320{

Callers

nothing calls this directly

Calls 2

GetWeightMethod · 0.45
CalcSegmentWeightMethod · 0.45

Tested by

no test coverage detected