Slightly changed the serialization order.

This commit is contained in:
Denis Chaplygin 2019-08-12 14:27:28 +03:00
parent 889c82516f
commit 73f544d4da
2 changed files with 13 additions and 11 deletions

View File

@ -130,9 +130,9 @@ public:
raw_route.target_traversed_in_reverse)); raw_route.target_traversed_in_reverse));
} }
response.add_waypoints(getWaypoints());
auto routes_vector = fb_result.CreateVector(routes); auto routes_vector = fb_result.CreateVector(routes);
response.add_routes(routes_vector); response.add_routes(routes_vector);
response.add_waypoints(getWaypoints());
return response; return response;
} }
@ -303,17 +303,11 @@ public:
//Fill basix route info //Fill basix route info
auto route = guidance::assembleRoute(legs); auto route = guidance::assembleRoute(legs);
auto weight_name_string = fb_result.CreateString(facade.GetWeightName());
routeObject.add_weight_name(weight_name_string);
routeObject.add_distance(route.distance); routeObject.add_distance(route.distance);
routeObject.add_duration(route.duration); routeObject.add_duration(route.duration);
routeObject.add_weight(route.weight); routeObject.add_weight(route.weight);
auto weight_name_string = fb_result.CreateString(facade.GetWeightName());
//Fill geometry routeObject.add_weight_name(weight_name_string);
auto overview = MakeOverview(leg_geometries);
if(overview) {
MakeGeometry(routeObject, overview->begin(), overview->end());
}
//Fill legs //Fill legs
std::vector<flatbuffers::Offset<fbresult::Leg>> routeLegs; std::vector<flatbuffers::Offset<fbresult::Leg>> routeLegs;
@ -548,6 +542,12 @@ public:
auto legs_vector = fb_result.CreateVector(routeLegs); auto legs_vector = fb_result.CreateVector(routeLegs);
routeObject.add_legs(legs_vector); routeObject.add_legs(legs_vector);
//Fill geometry
auto overview = MakeOverview(leg_geometries);
if(overview) {
MakeGeometry(routeObject, overview->begin(), overview->end());
}
return routeObject.Finish(); return routeObject.Finish();
} }

View File

@ -95,8 +95,6 @@ class TableAPI final : public BaseAPI
table.add_destinations(MakeWaypoints(fb_result, phantoms, parameters.destinations)); table.add_destinations(MakeWaypoints(fb_result, phantoms, parameters.destinations));
} }
table.add_rows(number_of_sources);
table.add_cols(number_of_destinations);
if (parameters.annotations & TableParameters::AnnotationsType::Duration) if (parameters.annotations & TableParameters::AnnotationsType::Duration)
{ {
table.add_durations(MakeDurationTable(fb_result, tables.first)); table.add_durations(MakeDurationTable(fb_result, tables.first));
@ -111,6 +109,10 @@ class TableAPI final : public BaseAPI
{ {
table.add_fallback_speed_cells(MakeEstimatesTable(fb_result, fallback_speed_cells)); table.add_fallback_speed_cells(MakeEstimatesTable(fb_result, fallback_speed_cells));
} }
table.add_rows(number_of_sources);
table.add_cols(number_of_destinations);
response.add_table(table.Finish()); response.add_table(table.Finish());
fb_result.Finish(response.Finish()); fb_result.Finish(response.Finish());
} }