| 172 | } |
| 173 | |
| 174 | vector<RouteMarkData> DeserializeRoutePoints(string const & data) |
| 175 | { |
| 176 | try |
| 177 | { |
| 178 | base::Json root(data.c_str()); |
| 179 | |
| 180 | if (root.get() == nullptr || !json_is_array(root.get())) |
| 181 | return {}; |
| 182 | |
| 183 | size_t const sz = json_array_size(root.get()); |
| 184 | if (sz == 0) |
| 185 | return {}; |
| 186 | |
| 187 | vector<RouteMarkData> result; |
| 188 | result.reserve(sz); |
| 189 | for (size_t i = 0; i < sz; ++i) |
| 190 | { |
| 191 | auto pointNode = json_array_get(root.get(), i); |
| 192 | if (pointNode == nullptr) |
| 193 | continue; |
| 194 | |
| 195 | auto point = DeserializeRoutePoint(pointNode); |
| 196 | if (point.m_position.EqualDxDy(m2::PointD::Zero(), mercator::kPointEqualityEps)) |
| 197 | continue; |
| 198 | |
| 199 | result.push_back(std::move(point)); |
| 200 | } |
| 201 | |
| 202 | if (result.size() < 2) |
| 203 | return {}; |
| 204 | |
| 205 | return result; |
| 206 | } |
| 207 | catch (base::Json::Exception const &) |
| 208 | { |
| 209 | return {}; |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | VehicleType GetVehicleType(RouterType routerType) |
| 214 | { |
no test coverage detected