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

Function DeserializeRoutePoints

libs/map/routing_manager.cpp:174–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174vector<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
213VehicleType GetVehicleType(RouterType routerType)
214{

Callers 1

LoadRoutePointsMethod · 0.85

Calls 7

DeserializeRoutePointFunction · 0.85
ZeroFunction · 0.85
getMethod · 0.65
reserveMethod · 0.45
EqualDxDyMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected