| 63 | } |
| 64 | |
| 65 | RouteWeight TransitGraph::CalcSegmentWeight(Segment const & segment, EdgeEstimator::Purpose purpose) const |
| 66 | { |
| 67 | CHECK(IsTransitSegment(segment), ("Nontransit segment passed to TransitGraph.")); |
| 68 | |
| 69 | if (m_transitVersion == ::transit::TransitVersion::OnlySubway) |
| 70 | { |
| 71 | if (IsGate(segment)) |
| 72 | { |
| 73 | auto const weight = GetGate(segment).GetWeight(); |
| 74 | return RouteWeight(weight, 0 /* numPassThroughChanges */, 0 /* numAccessChanges */, |
| 75 | 0 /* numAccessConditionalPenalties */, weight /* transitTime */); |
| 76 | } |
| 77 | |
| 78 | if (IsEdge(segment)) |
| 79 | { |
| 80 | auto const weight = GetEdge(segment).GetWeight(); |
| 81 | return RouteWeight(weight, 0 /* numPassThroughChanges */, 0 /* numAccessChanges */, |
| 82 | 0 /* numAccessConditionalPenalties */, weight /* transitTime */); |
| 83 | } |
| 84 | } |
| 85 | else if (m_transitVersion == ::transit::TransitVersion::AllPublicTransport) |
| 86 | { |
| 87 | if (IsGate(segment)) |
| 88 | { |
| 89 | // TODO (o.khlopkova) Manage different weights for different stops linked to the gate. |
| 90 | auto const weight = kDefaultIntervalS; |
| 91 | return RouteWeight(weight /* weight */, 0 /* numPassThroughChanges */, 0 /* numAccessChanges */, |
| 92 | 0 /* numAccessConditionalPenalties */, weight /* transitTime */); |
| 93 | } |
| 94 | |
| 95 | if (IsEdge(segment)) |
| 96 | { |
| 97 | auto const weight = GetEdgePT(segment).GetWeight(); |
| 98 | CHECK_NOT_EQUAL(weight, 0, (segment)); |
| 99 | return RouteWeight(weight /* weight */, 0 /* numPassThroughChanges */, 0 /* numAccessChanges */, |
| 100 | 0 /* numAccessConditionalPenalties */, weight /* transitTime */); |
| 101 | } |
| 102 | } |
| 103 | else |
| 104 | { |
| 105 | CHECK(false, (m_transitVersion)); |
| 106 | UNREACHABLE(); |
| 107 | } |
| 108 | |
| 109 | return RouteWeight(m_estimator->CalcOffroad(GetJunction(segment, false /* front */).GetLatLon(), |
| 110 | GetJunction(segment, true /* front */).GetLatLon(), purpose)); |
| 111 | } |
| 112 | |
| 113 | RouteWeight TransitGraph::GetTransferPenalty(Segment const & from, Segment const & to) const |
| 114 | { |
nothing calls this directly
no test coverage detected