| 108 | } |
| 109 | |
| 110 | void DirectionsEngine::GetSegmentRangeAndAdjacentEdges(IRoadGraph::EdgeListT const & outgoingEdges, Edge const & inEdge, |
| 111 | uint32_t startSegId, uint32_t endSegId, |
| 112 | SegmentRange & segmentRange, TurnCandidates & outgoingTurns) |
| 113 | { |
| 114 | outgoingTurns.isCandidatesAngleValid = true; |
| 115 | outgoingTurns.candidates.reserve(outgoingEdges.size()); |
| 116 | segmentRange = SegmentRange(inEdge.GetFeatureId(), startSegId, endSegId, inEdge.IsForward(), inEdge.GetStartPoint(), |
| 117 | inEdge.GetEndPoint()); |
| 118 | CHECK(segmentRange.IsCorrect(), ()); |
| 119 | m2::PointD const & ingoingPoint = inEdge.GetStartJunction().GetPoint(); |
| 120 | m2::PointD const & junctionPoint = inEdge.GetEndJunction().GetPoint(); |
| 121 | |
| 122 | for (auto const & edge : outgoingEdges) |
| 123 | { |
| 124 | if (edge.IsFake()) |
| 125 | continue; |
| 126 | |
| 127 | auto ft = GetFeature(edge.GetFeatureId()); |
| 128 | if (!ft) |
| 129 | continue; |
| 130 | |
| 131 | feature::TypesHolder types(*ft); |
| 132 | |
| 133 | auto const highwayClass = GetHighwayClass(types); |
| 134 | ASSERT(highwayClass != HighwayClass::Undefined, (edge.PrintLatLon())); |
| 135 | |
| 136 | double angle = 0; |
| 137 | |
| 138 | if (inEdge.GetFeatureId().m_mwmId == edge.GetFeatureId().m_mwmId) |
| 139 | { |
| 140 | ASSERT_LESS(mercator::DistanceOnEarth(junctionPoint, edge.GetStartJunction().GetPoint()), |
| 141 | turns::kFeaturesNearTurnMeters, ()); |
| 142 | angle = |
| 143 | math::RadToDeg(turns::PiMinusTwoVectorsAngle(junctionPoint, ingoingPoint, edge.GetEndJunction().GetPoint())); |
| 144 | } |
| 145 | else |
| 146 | { |
| 147 | // Note. In case of crossing mwm border |
| 148 | // (inEdge.GetFeatureId().m_mwmId != edge.GetFeatureId().m_mwmId) |
| 149 | // twins of inEdge.GetFeatureId() are considered as outgoing features. |
| 150 | // In this case that turn candidate angle is invalid and |
| 151 | // should not be used for turn generation. |
| 152 | outgoingTurns.isCandidatesAngleValid = false; |
| 153 | } |
| 154 | |
| 155 | outgoingTurns.candidates.emplace_back(angle, ConvertEdgeToSegment(*m_numMwmIds, edge), highwayClass, |
| 156 | m_linkChecker(types)); |
| 157 | } |
| 158 | |
| 159 | if (outgoingTurns.isCandidatesAngleValid) |
| 160 | sort(outgoingTurns.candidates.begin(), outgoingTurns.candidates.end(), base::LessBy(&TurnCandidate::m_angle)); |
| 161 | } |
| 162 | |
| 163 | void DirectionsEngine::FillPathSegmentsAndAdjacentEdgesMap(IndexRoadGraph const & graph, |
| 164 | vector<geometry::PointWithAltitude> const & path, |
nothing calls this directly
no test coverage detected