| 1066 | } |
| 1067 | |
| 1068 | void RoutingManager::ReorderIntermediatePoints() |
| 1069 | { |
| 1070 | vector<RouteMarkPoint *> prevPoints; |
| 1071 | vector<m2::PointD> prevPositions; |
| 1072 | prevPoints.reserve(RoutePointsLayout::kMaxIntermediatePointsCount); |
| 1073 | prevPositions.reserve(RoutePointsLayout::kMaxIntermediatePointsCount); |
| 1074 | RoutePointsLayout routePoints(*m_bmManager); |
| 1075 | |
| 1076 | RouteMarkPoint * addedPoint = nullptr; |
| 1077 | m2::PointD addedPosition; |
| 1078 | |
| 1079 | for (auto const & p : routePoints.GetRoutePoints()) |
| 1080 | { |
| 1081 | CHECK(p, ()); |
| 1082 | if (p->GetRoutePointType() == RouteMarkType::Intermediate) |
| 1083 | { |
| 1084 | // Note. An added (new) intermediate point is the first intermediate point at |routePoints.GetRoutePoints()|. |
| 1085 | // The other intermediate points are former ones. |
| 1086 | if (addedPoint == nullptr) |
| 1087 | { |
| 1088 | addedPoint = p; |
| 1089 | addedPosition = p->GetPivot(); |
| 1090 | } |
| 1091 | else |
| 1092 | { |
| 1093 | prevPoints.push_back(p); |
| 1094 | prevPositions.push_back(p->GetPivot()); |
| 1095 | } |
| 1096 | } |
| 1097 | } |
| 1098 | if (addedPoint == nullptr) |
| 1099 | return; |
| 1100 | |
| 1101 | CheckpointPredictor predictor(m_routingSession.GetStartPoint(), m_routingSession.GetEndPoint()); |
| 1102 | |
| 1103 | size_t const insertIndex = predictor.PredictPosition(prevPositions, addedPosition); |
| 1104 | addedPoint->SetIntermediateIndex(insertIndex); |
| 1105 | for (size_t i = 0; i < prevPoints.size(); ++i) |
| 1106 | prevPoints[i]->SetIntermediateIndex(i < insertIndex ? i : i + 1); |
| 1107 | } |
| 1108 | |
| 1109 | void RoutingManager::GenerateNotifications(vector<string> & turnNotifications, bool announceStreets) |
| 1110 | { |
nothing calls this directly
no test coverage detected