Updated changelog entry
This commit is contained in:
parent
ff46e98d21
commit
a9c187c99b
@ -7,6 +7,7 @@
|
|||||||
- ADDED: data timestamp information in the response (saved in new file `.osrm.timestamp`). [#5115](https://github.com/Project-OSRM/osrm-backend/issues/5115)
|
- ADDED: data timestamp information in the response (saved in new file `.osrm.timestamp`). [#5115](https://github.com/Project-OSRM/osrm-backend/issues/5115)
|
||||||
- ADDED: new API parameter - `snapping=any|default` to allow snapping to previously unsnappable edges [#5361](https://github.com/Project-OSRM/osrm-backend/pull/5361)
|
- ADDED: new API parameter - `snapping=any|default` to allow snapping to previously unsnappable edges [#5361](https://github.com/Project-OSRM/osrm-backend/pull/5361)
|
||||||
- ADDED: keepalive support to the osrm-routed HTTP server [#5518](https://github.com/Project-OSRM/osrm-backend/pull/5518)
|
- ADDED: keepalive support to the osrm-routed HTTP server [#5518](https://github.com/Project-OSRM/osrm-backend/pull/5518)
|
||||||
|
- ADDED: flatbuffers output format support [#5513](https://github.com/Project-OSRM/osrm-backend/pull/5513)
|
||||||
- Routing:
|
- Routing:
|
||||||
- CHANGED: allow routing past `barrier=arch` [#5352](https://github.com/Project-OSRM/osrm-backend/pull/5352)
|
- CHANGED: allow routing past `barrier=arch` [#5352](https://github.com/Project-OSRM/osrm-backend/pull/5352)
|
||||||
- CHANGED: default car weight was reduced to 2000 kg. [#5371](https://github.com/Project-OSRM/osrm-backend/pull/5371)
|
- CHANGED: default car weight was reduced to 2000 kg. [#5371](https://github.com/Project-OSRM/osrm-backend/pull/5371)
|
||||||
|
@ -72,16 +72,22 @@ class BaseAPI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>> MakeWaypoints(flatbuffers::FlatBufferBuilder& builder, const std::vector<PhantomNodes> &segment_end_coordinates) const
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||||
|
MakeWaypoints(flatbuffers::FlatBufferBuilder &builder,
|
||||||
|
const std::vector<PhantomNodes> &segment_end_coordinates) const
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(parameters.coordinates.size() > 0);
|
BOOST_ASSERT(parameters.coordinates.size() > 0);
|
||||||
BOOST_ASSERT(parameters.coordinates.size() == segment_end_coordinates.size() + 1);
|
BOOST_ASSERT(parameters.coordinates.size() == segment_end_coordinates.size() + 1);
|
||||||
|
|
||||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||||
waypoints.resize(parameters.coordinates.size());
|
waypoints.resize(parameters.coordinates.size());
|
||||||
waypoints[0] = MakeWaypoint(builder, segment_end_coordinates.front().source_phantom).Finish();
|
waypoints[0] =
|
||||||
|
MakeWaypoint(builder, segment_end_coordinates.front().source_phantom).Finish();
|
||||||
|
|
||||||
std::transform(segment_end_coordinates.begin(), segment_end_coordinates.end(), std::next(waypoints.begin()), [this, &builder](const PhantomNodes &phantom_pair) {
|
std::transform(segment_end_coordinates.begin(),
|
||||||
|
segment_end_coordinates.end(),
|
||||||
|
std::next(waypoints.begin()),
|
||||||
|
[this, &builder](const PhantomNodes &phantom_pair) {
|
||||||
return MakeWaypoint(builder, phantom_pair.target_phantom).Finish();
|
return MakeWaypoint(builder, phantom_pair.target_phantom).Finish();
|
||||||
});
|
});
|
||||||
return builder.CreateVector(waypoints);
|
return builder.CreateVector(waypoints);
|
||||||
@ -89,15 +95,19 @@ class BaseAPI
|
|||||||
|
|
||||||
// FIXME: gcc 4.9 does not like MakeWaypoints to be protected
|
// FIXME: gcc 4.9 does not like MakeWaypoints to be protected
|
||||||
// protected:
|
// protected:
|
||||||
fbresult::WaypointBuilder MakeWaypoint(flatbuffers::FlatBufferBuilder& builder, const PhantomNode &phantom) const
|
fbresult::WaypointBuilder MakeWaypoint(flatbuffers::FlatBufferBuilder &builder,
|
||||||
|
const PhantomNode &phantom) const
|
||||||
{
|
{
|
||||||
|
|
||||||
auto location = fbresult::Position(static_cast<double>(util::toFloating(phantom.location.lon)), static_cast<double>(util::toFloating(phantom.location.lat)));
|
auto location =
|
||||||
|
fbresult::Position(static_cast<double>(util::toFloating(phantom.location.lon)),
|
||||||
|
static_cast<double>(util::toFloating(phantom.location.lat)));
|
||||||
fbresult::WaypointBuilder waypoint(builder);
|
fbresult::WaypointBuilder waypoint(builder);
|
||||||
waypoint.add_location(&location);
|
waypoint.add_location(&location);
|
||||||
waypoint.add_distance(util::coordinate_calculation::fccApproximateDistance(phantom.location,
|
waypoint.add_distance(util::coordinate_calculation::fccApproximateDistance(
|
||||||
phantom.input_location));
|
phantom.location, phantom.input_location));
|
||||||
auto name_string = builder.CreateString(facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)).to_string());
|
auto name_string = builder.CreateString(
|
||||||
|
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)).to_string());
|
||||||
waypoint.add_name(name_string);
|
waypoint.add_name(name_string);
|
||||||
if (parameters.generate_hints)
|
if (parameters.generate_hints)
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,8 @@ namespace engine
|
|||||||
{
|
{
|
||||||
namespace api
|
namespace api
|
||||||
{
|
{
|
||||||
using ResultT = mapbox::util::variant<util::json::Object, std::string, flatbuffers::FlatBufferBuilder>;
|
using ResultT =
|
||||||
|
mapbox::util::variant<util::json::Object, std::string, flatbuffers::FlatBufferBuilder>;
|
||||||
} // ns api
|
} // ns api
|
||||||
} // ns engine
|
} // ns engine
|
||||||
} // ns osrm
|
} // ns osrm
|
||||||
|
@ -34,10 +34,13 @@ class MatchAPI final : public RouteAPI
|
|||||||
osrm::engine::api::ResultT &response) const
|
osrm::engine::api::ResultT &response) const
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(sub_matchings.size() == sub_routes.size());
|
BOOST_ASSERT(sub_matchings.size() == sub_routes.size());
|
||||||
if (response.is<flatbuffers::FlatBufferBuilder>()) {
|
if (response.is<flatbuffers::FlatBufferBuilder>())
|
||||||
|
{
|
||||||
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
||||||
MakeResponse(sub_matchings, sub_routes, fb_result);
|
MakeResponse(sub_matchings, sub_routes, fb_result);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
auto &json_result = response.get<util::json::Object>();
|
auto &json_result = response.get<util::json::Object>();
|
||||||
MakeResponse(sub_matchings, sub_routes, json_result);
|
MakeResponse(sub_matchings, sub_routes, json_result);
|
||||||
}
|
}
|
||||||
@ -46,7 +49,9 @@ class MatchAPI final : public RouteAPI
|
|||||||
const std::vector<InternalRouteResult> &sub_routes,
|
const std::vector<InternalRouteResult> &sub_routes,
|
||||||
flatbuffers::FlatBufferBuilder &fb_result) const
|
flatbuffers::FlatBufferBuilder &fb_result) const
|
||||||
{
|
{
|
||||||
auto response = MakeFBResponse(sub_routes, fb_result, [this, &fb_result, &sub_matchings]() { return MakeTracepoints(fb_result, sub_matchings); });
|
auto response = MakeFBResponse(sub_routes, fb_result, [this, &fb_result, &sub_matchings]() {
|
||||||
|
return MakeTracepoints(fb_result, sub_matchings);
|
||||||
|
});
|
||||||
|
|
||||||
fb_result.Finish(response.Finish());
|
fb_result.Finish(response.Finish());
|
||||||
}
|
}
|
||||||
@ -94,7 +99,8 @@ class MatchAPI final : public RouteAPI
|
|||||||
};
|
};
|
||||||
|
|
||||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||||
MakeTracepoints(flatbuffers::FlatBufferBuilder &fb_result, const std::vector<map_matching::SubMatching> &sub_matchings) const
|
MakeTracepoints(flatbuffers::FlatBufferBuilder &fb_result,
|
||||||
|
const std::vector<map_matching::SubMatching> &sub_matchings) const
|
||||||
{
|
{
|
||||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||||
waypoints.reserve(parameters.coordinates.size());
|
waypoints.reserve(parameters.coordinates.size());
|
||||||
@ -137,7 +143,9 @@ class MatchAPI final : public RouteAPI
|
|||||||
{
|
{
|
||||||
waypoint.add_waypoint_index(0);
|
waypoint.add_waypoint_index(0);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
waypoint.add_waypoint_index(matching_index.point_index);
|
waypoint.add_waypoint_index(matching_index.point_index);
|
||||||
}
|
}
|
||||||
waypoints.push_back(waypoint.Finish());
|
waypoints.push_back(waypoint.Finish());
|
||||||
@ -198,12 +206,16 @@ class MatchAPI final : public RouteAPI
|
|||||||
return waypoints;
|
return waypoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<MatchingIndex> MakeMatchingIndices(const std::vector<map_matching::SubMatching> &sub_matchings) const {
|
std::vector<MatchingIndex>
|
||||||
|
MakeMatchingIndices(const std::vector<map_matching::SubMatching> &sub_matchings) const
|
||||||
|
{
|
||||||
std::vector<MatchingIndex> trace_idx_to_matching_idx(parameters.coordinates.size());
|
std::vector<MatchingIndex> trace_idx_to_matching_idx(parameters.coordinates.size());
|
||||||
for (auto sub_matching_index :
|
for (auto sub_matching_index :
|
||||||
util::irange(0u, static_cast<unsigned>(sub_matchings.size()))) {
|
util::irange(0u, static_cast<unsigned>(sub_matchings.size())))
|
||||||
|
{
|
||||||
for (auto point_index : util::irange(
|
for (auto point_index : util::irange(
|
||||||
0u, static_cast<unsigned>(sub_matchings[sub_matching_index].indices.size()))) {
|
0u, static_cast<unsigned>(sub_matchings[sub_matching_index].indices.size())))
|
||||||
|
{
|
||||||
// tidied_to_original: index of the input coordinate that a tidied coordinate
|
// tidied_to_original: index of the input coordinate that a tidied coordinate
|
||||||
// corresponds to.
|
// corresponds to.
|
||||||
// sub_matching indices: index of the coordinate passed to map matching plugin that
|
// sub_matching indices: index of the coordinate passed to map matching plugin that
|
||||||
|
@ -27,7 +27,8 @@ class NearestAPI final : public BaseAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MakeResponse(const std::vector<std::vector<PhantomNodeWithDistance>> &phantom_nodes,
|
void MakeResponse(const std::vector<std::vector<PhantomNodeWithDistance>> &phantom_nodes,
|
||||||
osrm::engine::api::ResultT &response) const {
|
osrm::engine::api::ResultT &response) const
|
||||||
|
{
|
||||||
BOOST_ASSERT(phantom_nodes.size() == 1);
|
BOOST_ASSERT(phantom_nodes.size() == 1);
|
||||||
BOOST_ASSERT(parameters.coordinates.size() == 1);
|
BOOST_ASSERT(parameters.coordinates.size() == 1);
|
||||||
|
|
||||||
@ -41,7 +42,6 @@ class NearestAPI final : public BaseAPI
|
|||||||
auto &json_result = response.get<util::json::Object>();
|
auto &json_result = response.get<util::json::Object>();
|
||||||
MakeResponse(phantom_nodes, json_result);
|
MakeResponse(phantom_nodes, json_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeResponse(const std::vector<std::vector<PhantomNodeWithDistance>> &phantom_nodes,
|
void MakeResponse(const std::vector<std::vector<PhantomNodeWithDistance>> &phantom_nodes,
|
||||||
@ -51,8 +51,7 @@ class NearestAPI final : public BaseAPI
|
|||||||
|
|
||||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||||
waypoints.resize(phantom_nodes.front().size());
|
waypoints.resize(phantom_nodes.front().size());
|
||||||
std::transform(
|
std::transform(phantom_nodes.front().begin(),
|
||||||
phantom_nodes.front().begin(),
|
|
||||||
phantom_nodes.front().end(),
|
phantom_nodes.front().end(),
|
||||||
waypoints.begin(),
|
waypoints.begin(),
|
||||||
[this, &fb_result](const PhantomNodeWithDistance &phantom_with_distance) {
|
[this, &fb_result](const PhantomNodeWithDistance &phantom_with_distance) {
|
||||||
@ -76,8 +75,7 @@ class NearestAPI final : public BaseAPI
|
|||||||
{
|
{
|
||||||
util::json::Array waypoints;
|
util::json::Array waypoints;
|
||||||
waypoints.values.resize(phantom_nodes.front().size());
|
waypoints.values.resize(phantom_nodes.front().size());
|
||||||
std::transform(
|
std::transform(phantom_nodes.front().begin(),
|
||||||
phantom_nodes.front().begin(),
|
|
||||||
phantom_nodes.front().end(),
|
phantom_nodes.front().end(),
|
||||||
waypoints.values.begin(),
|
waypoints.values.begin(),
|
||||||
[this](const PhantomNodeWithDistance &phantom_with_distance) {
|
[this](const PhantomNodeWithDistance &phantom_with_distance) {
|
||||||
@ -102,7 +100,8 @@ class NearestAPI final : public BaseAPI
|
|||||||
const NearestParameters ¶meters;
|
const NearestParameters ¶meters;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::pair<uint64_t, uint64_t> MakeNodes(const PhantomNode& phantom_node) const {
|
std::pair<uint64_t, uint64_t> MakeNodes(const PhantomNode &phantom_node) const
|
||||||
|
{
|
||||||
std::uint64_t from_node = 0;
|
std::uint64_t from_node = 0;
|
||||||
std::uint64_t to_node = 0;
|
std::uint64_t to_node = 0;
|
||||||
|
|
||||||
@ -113,8 +112,8 @@ protected:
|
|||||||
const auto geometry_id = facade.GetGeometryIndex(segment_id).id;
|
const auto geometry_id = facade.GetGeometryIndex(segment_id).id;
|
||||||
forward_geometry = facade.GetUncompressedForwardGeometry(geometry_id);
|
forward_geometry = facade.GetUncompressedForwardGeometry(geometry_id);
|
||||||
|
|
||||||
auto osm_node_id = facade.GetOSMNodeIDOfNode(
|
auto osm_node_id =
|
||||||
forward_geometry(phantom_node.fwd_segment_position));
|
facade.GetOSMNodeIDOfNode(forward_geometry(phantom_node.fwd_segment_position));
|
||||||
to_node = static_cast<std::uint64_t>(osm_node_id);
|
to_node = static_cast<std::uint64_t>(osm_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,12 +126,11 @@ protected:
|
|||||||
facade.GetOSMNodeIDOfNode(geometry(phantom_node.fwd_segment_position + 1));
|
facade.GetOSMNodeIDOfNode(geometry(phantom_node.fwd_segment_position + 1));
|
||||||
from_node = static_cast<std::uint64_t>(osm_node_id);
|
from_node = static_cast<std::uint64_t>(osm_node_id);
|
||||||
}
|
}
|
||||||
else if (phantom_node.forward_segment_id.enabled &&
|
else if (phantom_node.forward_segment_id.enabled && phantom_node.fwd_segment_position > 0)
|
||||||
phantom_node.fwd_segment_position > 0)
|
|
||||||
{
|
{
|
||||||
// In the case of one way, rely on forward segment only
|
// In the case of one way, rely on forward segment only
|
||||||
auto osm_node_id = facade.GetOSMNodeIDOfNode(
|
auto osm_node_id =
|
||||||
forward_geometry(phantom_node.fwd_segment_position - 1));
|
facade.GetOSMNodeIDOfNode(forward_geometry(phantom_node.fwd_segment_position - 1));
|
||||||
from_node = static_cast<std::uint64_t>(osm_node_id);
|
from_node = static_cast<std::uint64_t>(osm_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,23 +36,29 @@ namespace engine
|
|||||||
namespace api
|
namespace api
|
||||||
{
|
{
|
||||||
|
|
||||||
class RouteAPI : public BaseAPI {
|
class RouteAPI : public BaseAPI
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
RouteAPI(const datafacade::BaseDataFacade &facade_, const RouteParameters ¶meters_)
|
RouteAPI(const datafacade::BaseDataFacade &facade_, const RouteParameters ¶meters_)
|
||||||
: BaseAPI(facade_, parameters_), parameters(parameters_) {
|
: BaseAPI(facade_, parameters_), parameters(parameters_)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MakeResponse(const InternalManyRoutesResult &raw_routes,
|
MakeResponse(const InternalManyRoutesResult &raw_routes,
|
||||||
const std::vector<PhantomNodes>
|
const std::vector<PhantomNodes>
|
||||||
&all_start_end_points, // all used coordinates, ignoring waypoints= parameter
|
&all_start_end_points, // all used coordinates, ignoring waypoints= parameter
|
||||||
osrm::engine::api::ResultT &response) const {
|
osrm::engine::api::ResultT &response) const
|
||||||
|
{
|
||||||
BOOST_ASSERT(!raw_routes.routes.empty());
|
BOOST_ASSERT(!raw_routes.routes.empty());
|
||||||
|
|
||||||
if (response.is<flatbuffers::FlatBufferBuilder>()) {
|
if (response.is<flatbuffers::FlatBufferBuilder>())
|
||||||
|
{
|
||||||
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
||||||
MakeResponse(raw_routes, all_start_end_points, fb_result);
|
MakeResponse(raw_routes, all_start_end_points, fb_result);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
auto &json_result = response.get<util::json::Object>();
|
auto &json_result = response.get<util::json::Object>();
|
||||||
MakeResponse(raw_routes, all_start_end_points, json_result);
|
MakeResponse(raw_routes, all_start_end_points, json_result);
|
||||||
}
|
}
|
||||||
@ -64,7 +70,8 @@ public:
|
|||||||
&all_start_end_points, // all used coordinates, ignoring waypoints= parameter
|
&all_start_end_points, // all used coordinates, ignoring waypoints= parameter
|
||||||
flatbuffers::FlatBufferBuilder &fb_result) const
|
flatbuffers::FlatBufferBuilder &fb_result) const
|
||||||
{
|
{
|
||||||
auto response = MakeFBResponse(raw_routes, fb_result, [this, &all_start_end_points, &fb_result]() {
|
auto response =
|
||||||
|
MakeFBResponse(raw_routes, fb_result, [this, &all_start_end_points, &fb_result]() {
|
||||||
return BaseAPI::MakeWaypoints(fb_result, all_start_end_points);
|
return BaseAPI::MakeWaypoints(fb_result, all_start_end_points);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -109,8 +116,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
template <typename GetWptsFn>
|
template <typename GetWptsFn>
|
||||||
fbresult::FBResultBuilder
|
fbresult::FBResultBuilder MakeFBResponse(const InternalManyRoutesResult &raw_routes,
|
||||||
MakeFBResponse(const InternalManyRoutesResult &raw_routes,
|
|
||||||
flatbuffers::FlatBufferBuilder &fb_result,
|
flatbuffers::FlatBufferBuilder &fb_result,
|
||||||
GetWptsFn getWaypoints) const
|
GetWptsFn getWaypoints) const
|
||||||
{
|
{
|
||||||
@ -140,13 +146,18 @@ public:
|
|||||||
template <typename BuilderType, typename ForwardIter>
|
template <typename BuilderType, typename ForwardIter>
|
||||||
void MakeGeometry(BuilderType builder, ForwardIter begin, ForwardIter end) const
|
void MakeGeometry(BuilderType builder, ForwardIter begin, ForwardIter end) const
|
||||||
{
|
{
|
||||||
if (parameters.geometries == RouteParameters::GeometriesType::Polyline) {
|
if (parameters.geometries == RouteParameters::GeometriesType::Polyline)
|
||||||
|
{
|
||||||
auto polyline_string = builder.fbb_.CreateString(encodePolyline<100000>(begin, end));
|
auto polyline_string = builder.fbb_.CreateString(encodePolyline<100000>(begin, end));
|
||||||
builder.add_polyline(polyline_string);
|
builder.add_polyline(polyline_string);
|
||||||
} else if (parameters.geometries == RouteParameters::GeometriesType::Polyline6) {
|
}
|
||||||
|
else if (parameters.geometries == RouteParameters::GeometriesType::Polyline6)
|
||||||
|
{
|
||||||
auto polyline_string = builder.fbb_.CreateString(encodePolyline<1000000>(begin, end));
|
auto polyline_string = builder.fbb_.CreateString(encodePolyline<1000000>(begin, end));
|
||||||
builder.add_polyline(polyline_string);
|
builder.add_polyline(polyline_string);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
std::vector<fbresult::Position> coordinates;
|
std::vector<fbresult::Position> coordinates;
|
||||||
coordinates.resize(std::distance(begin, end));
|
coordinates.resize(std::distance(begin, end));
|
||||||
std::transform(begin, end, coordinates.begin(), [](const Coordinate &c) {
|
std::transform(begin, end, coordinates.begin(), [](const Coordinate &c) {
|
||||||
@ -158,19 +169,24 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<util::json::Value> MakeGeometry(boost::optional<std::vector<Coordinate>>&& annotations) const
|
boost::optional<util::json::Value>
|
||||||
|
MakeGeometry(boost::optional<std::vector<Coordinate>> &&annotations) const
|
||||||
{
|
{
|
||||||
boost::optional<util::json::Value> json_geometry;
|
boost::optional<util::json::Value> json_geometry;
|
||||||
if (annotations) {
|
if (annotations)
|
||||||
|
{
|
||||||
auto begin = annotations->begin();
|
auto begin = annotations->begin();
|
||||||
auto end = annotations->end();
|
auto end = annotations->end();
|
||||||
if (parameters.geometries == RouteParameters::GeometriesType::Polyline)
|
if (parameters.geometries == RouteParameters::GeometriesType::Polyline)
|
||||||
{
|
{
|
||||||
json_geometry = json::makePolyline<100000>(begin, end);
|
json_geometry = json::makePolyline<100000>(begin, end);
|
||||||
} else if (parameters.geometries == RouteParameters::GeometriesType::Polyline6)
|
}
|
||||||
|
else if (parameters.geometries == RouteParameters::GeometriesType::Polyline6)
|
||||||
{
|
{
|
||||||
json_geometry = json::makePolyline<1000000>(begin, end);
|
json_geometry = json::makePolyline<1000000>(begin, end);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
BOOST_ASSERT(parameters.geometries == RouteParameters::GeometriesType::GeoJSON);
|
BOOST_ASSERT(parameters.geometries == RouteParameters::GeometriesType::GeoJSON);
|
||||||
json_geometry = json::makeGeoJSONGeometry(begin, end);
|
json_geometry = json::makeGeoJSONGeometry(begin, end);
|
||||||
}
|
}
|
||||||
@ -179,7 +195,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename ValueType, typename GetFn>
|
template <typename ValueType, typename GetFn>
|
||||||
flatbuffers::Offset<flatbuffers::Vector<ValueType>> GetAnnotations(flatbuffers::FlatBufferBuilder& fb_result, guidance::LegGeometry &leg, GetFn Get) const
|
flatbuffers::Offset<flatbuffers::Vector<ValueType>> GetAnnotations(
|
||||||
|
flatbuffers::FlatBufferBuilder &fb_result, guidance::LegGeometry &leg, GetFn Get) const
|
||||||
{
|
{
|
||||||
std::vector<ValueType> annotations_store;
|
std::vector<ValueType> annotations_store;
|
||||||
annotations_store.reserve(leg.annotations.size());
|
annotations_store.reserve(leg.annotations.size());
|
||||||
@ -206,8 +223,10 @@ public:
|
|||||||
return annotations_store;
|
return annotations_store;
|
||||||
}
|
}
|
||||||
|
|
||||||
fbresult::ManeuverType WaypointTypeToFB(guidance::WaypointType type) const {
|
fbresult::ManeuverType WaypointTypeToFB(guidance::WaypointType type) const
|
||||||
switch(type) {
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
case guidance::WaypointType::Arrive:
|
case guidance::WaypointType::Arrive:
|
||||||
return fbresult::ManeuverType_Arrive;
|
return fbresult::ManeuverType_Arrive;
|
||||||
case guidance::WaypointType::Depart:
|
case guidance::WaypointType::Depart:
|
||||||
@ -217,7 +236,8 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fbresult::ManeuverType TurnTypeToFB(osrm::guidance::TurnType::Enum turn) const {
|
fbresult::ManeuverType TurnTypeToFB(osrm::guidance::TurnType::Enum turn) const
|
||||||
|
{
|
||||||
static std::map<osrm::guidance::TurnType::Enum, fbresult::ManeuverType> mappings = {
|
static std::map<osrm::guidance::TurnType::Enum, fbresult::ManeuverType> mappings = {
|
||||||
{osrm::guidance::TurnType::Invalid, fbresult::ManeuverType_Notification},
|
{osrm::guidance::TurnType::Invalid, fbresult::ManeuverType_Notification},
|
||||||
{osrm::guidance::TurnType::NewName, fbresult::ManeuverType_NewName},
|
{osrm::guidance::TurnType::NewName, fbresult::ManeuverType_NewName},
|
||||||
@ -230,27 +250,32 @@ public:
|
|||||||
{osrm::guidance::TurnType::EndOfRoad, fbresult::ManeuverType_EndOfRoad},
|
{osrm::guidance::TurnType::EndOfRoad, fbresult::ManeuverType_EndOfRoad},
|
||||||
{osrm::guidance::TurnType::Notification, fbresult::ManeuverType_Notification},
|
{osrm::guidance::TurnType::Notification, fbresult::ManeuverType_Notification},
|
||||||
{osrm::guidance::TurnType::EnterRoundabout, fbresult::ManeuverType_Roundabout},
|
{osrm::guidance::TurnType::EnterRoundabout, fbresult::ManeuverType_Roundabout},
|
||||||
{osrm::guidance::TurnType::EnterAndExitRoundabout, fbresult::ManeuverType_ExitRoundabout},
|
{osrm::guidance::TurnType::EnterAndExitRoundabout,
|
||||||
|
fbresult::ManeuverType_ExitRoundabout},
|
||||||
{osrm::guidance::TurnType::EnterRotary, fbresult::ManeuverType_Rotary},
|
{osrm::guidance::TurnType::EnterRotary, fbresult::ManeuverType_Rotary},
|
||||||
{osrm::guidance::TurnType::EnterAndExitRotary, fbresult::ManeuverType_ExitRotary},
|
{osrm::guidance::TurnType::EnterAndExitRotary, fbresult::ManeuverType_ExitRotary},
|
||||||
{osrm::guidance::TurnType::EnterRoundaboutIntersection, fbresult::ManeuverType_Roundabout},
|
{osrm::guidance::TurnType::EnterRoundaboutIntersection,
|
||||||
{osrm::guidance::TurnType::EnterAndExitRoundaboutIntersection, fbresult::ManeuverType_ExitRoundabout},
|
fbresult::ManeuverType_Roundabout},
|
||||||
|
{osrm::guidance::TurnType::EnterAndExitRoundaboutIntersection,
|
||||||
|
fbresult::ManeuverType_ExitRoundabout},
|
||||||
{osrm::guidance::TurnType::NoTurn, fbresult::ManeuverType_Notification},
|
{osrm::guidance::TurnType::NoTurn, fbresult::ManeuverType_Notification},
|
||||||
{osrm::guidance::TurnType::Suppressed, fbresult::ManeuverType_Notification},
|
{osrm::guidance::TurnType::Suppressed, fbresult::ManeuverType_Notification},
|
||||||
{osrm::guidance::TurnType::EnterRoundaboutAtExit, fbresult::ManeuverType_Roundabout},
|
{osrm::guidance::TurnType::EnterRoundaboutAtExit, fbresult::ManeuverType_Roundabout},
|
||||||
{osrm::guidance::TurnType::ExitRoundabout, fbresult::ManeuverType_ExitRoundabout},
|
{osrm::guidance::TurnType::ExitRoundabout, fbresult::ManeuverType_ExitRoundabout},
|
||||||
{osrm::guidance::TurnType::EnterRotaryAtExit, fbresult::ManeuverType_Rotary},
|
{osrm::guidance::TurnType::EnterRotaryAtExit, fbresult::ManeuverType_Rotary},
|
||||||
{osrm::guidance::TurnType::ExitRotary, fbresult::ManeuverType_ExitRotary},
|
{osrm::guidance::TurnType::ExitRotary, fbresult::ManeuverType_ExitRotary},
|
||||||
{osrm::guidance::TurnType::EnterRoundaboutIntersectionAtExit, fbresult::ManeuverType_Roundabout},
|
{osrm::guidance::TurnType::EnterRoundaboutIntersectionAtExit,
|
||||||
{osrm::guidance::TurnType::ExitRoundaboutIntersection, fbresult::ManeuverType_ExitRoundabout},
|
fbresult::ManeuverType_Roundabout},
|
||||||
|
{osrm::guidance::TurnType::ExitRoundaboutIntersection,
|
||||||
|
fbresult::ManeuverType_ExitRoundabout},
|
||||||
{osrm::guidance::TurnType::StayOnRoundabout, fbresult::ManeuverType_RoundaboutTurn},
|
{osrm::guidance::TurnType::StayOnRoundabout, fbresult::ManeuverType_RoundaboutTurn},
|
||||||
{osrm::guidance::TurnType::Sliproad, fbresult::ManeuverType_Notification},
|
{osrm::guidance::TurnType::Sliproad, fbresult::ManeuverType_Notification},
|
||||||
{osrm::guidance::TurnType::MaxTurnType, fbresult::ManeuverType_Notification}
|
{osrm::guidance::TurnType::MaxTurnType, fbresult::ManeuverType_Notification}};
|
||||||
};
|
|
||||||
return mappings[turn];
|
return mappings[turn];
|
||||||
}
|
}
|
||||||
|
|
||||||
fbresult::Turn TurnModifierToFB(osrm::guidance::DirectionModifier::Enum modifier) const {
|
fbresult::Turn TurnModifierToFB(osrm::guidance::DirectionModifier::Enum modifier) const
|
||||||
|
{
|
||||||
static std::map<osrm::guidance::DirectionModifier::Enum, fbresult::Turn> mappings = {
|
static std::map<osrm::guidance::DirectionModifier::Enum, fbresult::Turn> mappings = {
|
||||||
{osrm::guidance::DirectionModifier::UTurn, fbresult::Turn_UTurn},
|
{osrm::guidance::DirectionModifier::UTurn, fbresult::Turn_UTurn},
|
||||||
{osrm::guidance::DirectionModifier::SharpRight, fbresult::Turn_SharpRight},
|
{osrm::guidance::DirectionModifier::SharpRight, fbresult::Turn_SharpRight},
|
||||||
@ -264,7 +289,8 @@ public:
|
|||||||
return mappings[modifier];
|
return mappings[modifier];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int8_t> TurnLaneTypeToFB(const extractor::TurnLaneType::Mask lane_type) const {
|
std::vector<int8_t> TurnLaneTypeToFB(const extractor::TurnLaneType::Mask lane_type) const
|
||||||
|
{
|
||||||
const static fbresult::Turn mapping[] = {fbresult::Turn_None,
|
const static fbresult::Turn mapping[] = {fbresult::Turn_None,
|
||||||
fbresult::Turn_Straight,
|
fbresult::Turn_Straight,
|
||||||
fbresult::Turn_SharpLeft,
|
fbresult::Turn_SharpLeft,
|
||||||
@ -286,7 +312,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
flatbuffers::Offset<fbresult::RouteObject>
|
flatbuffers::Offset<fbresult::RouteObject>
|
||||||
MakeRoute(flatbuffers::FlatBufferBuilder &fb_result,
|
MakeRoute(flatbuffers::FlatBufferBuilder &fb_result,
|
||||||
@ -297,7 +322,10 @@ public:
|
|||||||
{
|
{
|
||||||
fbresult::RouteObjectBuilder routeObject(fb_result);
|
fbresult::RouteObjectBuilder routeObject(fb_result);
|
||||||
|
|
||||||
auto legs_info = MakeLegs(segment_end_coordinates, unpacked_path_segments, source_traversed_in_reverse, target_traversed_in_reverse);
|
auto legs_info = MakeLegs(segment_end_coordinates,
|
||||||
|
unpacked_path_segments,
|
||||||
|
source_traversed_in_reverse,
|
||||||
|
target_traversed_in_reverse);
|
||||||
std::vector<guidance::RouteLeg> legs = legs_info.first;
|
std::vector<guidance::RouteLeg> legs = legs_info.first;
|
||||||
std::vector<guidance::LegGeometry> leg_geometries = legs_info.second;
|
std::vector<guidance::LegGeometry> leg_geometries = legs_info.second;
|
||||||
|
|
||||||
@ -312,63 +340,83 @@ public:
|
|||||||
// Fill legs
|
// Fill legs
|
||||||
std::vector<flatbuffers::Offset<fbresult::Leg>> routeLegs;
|
std::vector<flatbuffers::Offset<fbresult::Leg>> routeLegs;
|
||||||
routeLegs.reserve(legs.size());
|
routeLegs.reserve(legs.size());
|
||||||
for (const auto idx : util::irange<std::size_t>(0UL, legs.size())) {
|
for (const auto idx : util::irange<std::size_t>(0UL, legs.size()))
|
||||||
|
{
|
||||||
auto leg = legs[idx];
|
auto leg = legs[idx];
|
||||||
auto &leg_geometry = leg_geometries[idx];
|
auto &leg_geometry = leg_geometries[idx];
|
||||||
fbresult::LegBuilder legBuilder(fb_result);
|
fbresult::LegBuilder legBuilder(fb_result);
|
||||||
legBuilder.add_distance(leg.distance);
|
legBuilder.add_distance(leg.distance);
|
||||||
legBuilder.add_duration(leg.duration);
|
legBuilder.add_duration(leg.duration);
|
||||||
legBuilder.add_weight(leg.weight);
|
legBuilder.add_weight(leg.weight);
|
||||||
if (!leg.summary.empty()) {
|
if (!leg.summary.empty())
|
||||||
|
{
|
||||||
auto summary_string = fb_result.CreateString(leg.summary);
|
auto summary_string = fb_result.CreateString(leg.summary);
|
||||||
legBuilder.add_summary(summary_string);
|
legBuilder.add_summary(summary_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill steps
|
// Fill steps
|
||||||
if (!leg.steps.empty()) {
|
if (!leg.steps.empty())
|
||||||
|
{
|
||||||
std::vector<flatbuffers::Offset<fbresult::Step>> legSteps;
|
std::vector<flatbuffers::Offset<fbresult::Step>> legSteps;
|
||||||
legSteps.resize(leg.steps.size());
|
legSteps.resize(leg.steps.size());
|
||||||
std::transform(leg.steps.begin(), leg.steps.end(), legSteps.begin(), [this, &leg_geometry, &fb_result](const guidance::RouteStep& step) {
|
std::transform(
|
||||||
|
leg.steps.begin(),
|
||||||
|
leg.steps.end(),
|
||||||
|
legSteps.begin(),
|
||||||
|
[this, &leg_geometry, &fb_result](const guidance::RouteStep &step) {
|
||||||
fbresult::StepBuilder stepBuilder(fb_result);
|
fbresult::StepBuilder stepBuilder(fb_result);
|
||||||
stepBuilder.add_duration(step.duration);
|
stepBuilder.add_duration(step.duration);
|
||||||
stepBuilder.add_distance(step.distance);
|
stepBuilder.add_distance(step.distance);
|
||||||
stepBuilder.add_weight(step.weight);
|
stepBuilder.add_weight(step.weight);
|
||||||
auto name_string = fb_result.CreateString(step.name);
|
auto name_string = fb_result.CreateString(step.name);
|
||||||
stepBuilder.add_name(name_string);
|
stepBuilder.add_name(name_string);
|
||||||
if (!step.ref.empty()) {
|
if (!step.ref.empty())
|
||||||
|
{
|
||||||
auto ref_string = fb_result.CreateString(step.ref);
|
auto ref_string = fb_result.CreateString(step.ref);
|
||||||
stepBuilder.add_ref(ref_string);
|
stepBuilder.add_ref(ref_string);
|
||||||
}
|
}
|
||||||
if (!step.pronunciation.empty()) {
|
if (!step.pronunciation.empty())
|
||||||
|
{
|
||||||
auto pronunciation_string = fb_result.CreateString(step.pronunciation);
|
auto pronunciation_string = fb_result.CreateString(step.pronunciation);
|
||||||
stepBuilder.add_pronunciation(pronunciation_string);
|
stepBuilder.add_pronunciation(pronunciation_string);
|
||||||
}
|
}
|
||||||
if (!step.destinations.empty()) {
|
if (!step.destinations.empty())
|
||||||
|
{
|
||||||
auto destinations_string = fb_result.CreateString(step.destinations);
|
auto destinations_string = fb_result.CreateString(step.destinations);
|
||||||
stepBuilder.add_destinations(destinations_string);
|
stepBuilder.add_destinations(destinations_string);
|
||||||
}
|
}
|
||||||
if (!step.exits.empty()) {
|
if (!step.exits.empty())
|
||||||
|
{
|
||||||
auto exists_string = fb_result.CreateString(step.exits);
|
auto exists_string = fb_result.CreateString(step.exits);
|
||||||
stepBuilder.add_exits(exists_string);
|
stepBuilder.add_exits(exists_string);
|
||||||
}
|
}
|
||||||
if(!step.rotary_name.empty()) {
|
if (!step.rotary_name.empty())
|
||||||
|
{
|
||||||
auto rotary_name_string = fb_result.CreateString(step.rotary_name);
|
auto rotary_name_string = fb_result.CreateString(step.rotary_name);
|
||||||
stepBuilder.add_rotary_name(rotary_name_string);
|
stepBuilder.add_rotary_name(rotary_name_string);
|
||||||
if (!step.rotary_pronunciation.empty()) {
|
if (!step.rotary_pronunciation.empty())
|
||||||
auto rotary_pronunciation_string = fb_result.CreateString(step.rotary_pronunciation);
|
{
|
||||||
|
auto rotary_pronunciation_string =
|
||||||
|
fb_result.CreateString(step.rotary_pronunciation);
|
||||||
stepBuilder.add_rotary_pronunciation(rotary_pronunciation_string);
|
stepBuilder.add_rotary_pronunciation(rotary_pronunciation_string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto mode_string = fb_result.CreateString(extractor::travelModeToString(step.mode));
|
auto mode_string =
|
||||||
|
fb_result.CreateString(extractor::travelModeToString(step.mode));
|
||||||
stepBuilder.add_mode(mode_string);
|
stepBuilder.add_mode(mode_string);
|
||||||
stepBuilder.add_driving_side(step.is_left_hand_driving);
|
stepBuilder.add_driving_side(step.is_left_hand_driving);
|
||||||
|
|
||||||
// Geometry
|
// Geometry
|
||||||
MakeGeometry(stepBuilder, leg_geometry.locations.begin() + step.geometry_begin, leg_geometry.locations.begin() + step.geometry_end);
|
MakeGeometry(stepBuilder,
|
||||||
|
leg_geometry.locations.begin() + step.geometry_begin,
|
||||||
|
leg_geometry.locations.begin() + step.geometry_end);
|
||||||
// Maneuver
|
// Maneuver
|
||||||
fbresult::StepManeuverBuilder maneuver(fb_result);
|
fbresult::StepManeuverBuilder maneuver(fb_result);
|
||||||
fbresult::Position maneuverPosition{static_cast<float>(util::toFloating(step.maneuver.location.lon).__value),
|
fbresult::Position maneuverPosition{
|
||||||
static_cast<float>(util::toFloating(step.maneuver.location.lat).__value)};
|
static_cast<float>(
|
||||||
|
util::toFloating(step.maneuver.location.lon).__value),
|
||||||
|
static_cast<float>(
|
||||||
|
util::toFloating(step.maneuver.location.lat).__value)};
|
||||||
maneuver.add_location(&maneuverPosition);
|
maneuver.add_location(&maneuverPosition);
|
||||||
maneuver.add_bearing_before(step.maneuver.bearing_before);
|
maneuver.add_bearing_before(step.maneuver.bearing_before);
|
||||||
maneuver.add_bearing_after(step.maneuver.bearing_after);
|
maneuver.add_bearing_after(step.maneuver.bearing_after);
|
||||||
@ -376,26 +424,41 @@ public:
|
|||||||
maneuver.add_type(TurnTypeToFB(step.maneuver.instruction.type));
|
maneuver.add_type(TurnTypeToFB(step.maneuver.instruction.type));
|
||||||
else
|
else
|
||||||
maneuver.add_type(WaypointTypeToFB(step.maneuver.waypoint_type));
|
maneuver.add_type(WaypointTypeToFB(step.maneuver.waypoint_type));
|
||||||
if (osrm::engine::api::json::detail::isValidModifier(step.maneuver)) {
|
if (osrm::engine::api::json::detail::isValidModifier(step.maneuver))
|
||||||
maneuver.add_modifier(TurnModifierToFB(step.maneuver.instruction.direction_modifier));
|
{
|
||||||
|
maneuver.add_modifier(
|
||||||
|
TurnModifierToFB(step.maneuver.instruction.direction_modifier));
|
||||||
}
|
}
|
||||||
if (step.maneuver.exit != 0) {
|
if (step.maneuver.exit != 0)
|
||||||
|
{
|
||||||
maneuver.add_exit(step.maneuver.exit);
|
maneuver.add_exit(step.maneuver.exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
// intersections
|
// intersections
|
||||||
std::vector<flatbuffers::Offset<fbresult::Intersection>> intersections;
|
std::vector<flatbuffers::Offset<fbresult::Intersection>> intersections;
|
||||||
intersections.resize(step.intersections.size());
|
intersections.resize(step.intersections.size());
|
||||||
std::transform(step.intersections.begin(), step.intersections.end(), intersections.begin(), [&fb_result, this](const guidance::IntermediateIntersection& intersection) {
|
std::transform(
|
||||||
|
step.intersections.begin(),
|
||||||
|
step.intersections.end(),
|
||||||
|
intersections.begin(),
|
||||||
|
[&fb_result,
|
||||||
|
this](const guidance::IntermediateIntersection &intersection) {
|
||||||
fbresult::IntersectionBuilder intersectionBuilder(fb_result);
|
fbresult::IntersectionBuilder intersectionBuilder(fb_result);
|
||||||
fbresult::Position maneuverPosition{static_cast<float>(util::toFloating(intersection.location.lon).__value),
|
fbresult::Position maneuverPosition{
|
||||||
static_cast<float>(util::toFloating(intersection.location.lat).__value)};
|
static_cast<float>(
|
||||||
|
util::toFloating(intersection.location.lon).__value),
|
||||||
|
static_cast<float>(
|
||||||
|
util::toFloating(intersection.location.lat).__value)};
|
||||||
intersectionBuilder.add_location(&maneuverPosition);
|
intersectionBuilder.add_location(&maneuverPosition);
|
||||||
auto bearings_vector = fb_result.CreateVector(intersection.bearings);
|
auto bearings_vector =
|
||||||
|
fb_result.CreateVector(intersection.bearings);
|
||||||
intersectionBuilder.add_bearings(bearings_vector);
|
intersectionBuilder.add_bearings(bearings_vector);
|
||||||
std::vector<flatbuffers::Offset<flatbuffers::String>> classes;
|
std::vector<flatbuffers::Offset<flatbuffers::String>> classes;
|
||||||
classes.resize(intersection.classes.size());
|
classes.resize(intersection.classes.size());
|
||||||
std::transform(intersection.classes.begin(), intersection.classes.end(), classes.begin(), [&fb_result](const std::string cls) {
|
std::transform(intersection.classes.begin(),
|
||||||
|
intersection.classes.end(),
|
||||||
|
classes.begin(),
|
||||||
|
[&fb_result](const std::string cls) {
|
||||||
return fb_result.CreateString(cls);
|
return fb_result.CreateString(cls);
|
||||||
});
|
});
|
||||||
auto classes_vector = fb_result.CreateVector(classes);
|
auto classes_vector = fb_result.CreateVector(classes);
|
||||||
@ -404,7 +467,8 @@ public:
|
|||||||
intersectionBuilder.add_entry(entry_vector);
|
intersectionBuilder.add_entry(entry_vector);
|
||||||
intersectionBuilder.add_in(intersection.in);
|
intersectionBuilder.add_in(intersection.in);
|
||||||
intersectionBuilder.add_out(intersection.out);
|
intersectionBuilder.add_out(intersection.out);
|
||||||
if (api::json::detail::hasValidLanes(intersection)) {
|
if (api::json::detail::hasValidLanes(intersection))
|
||||||
|
{
|
||||||
BOOST_ASSERT(intersection.lanes.lanes_in_turn >= 1);
|
BOOST_ASSERT(intersection.lanes.lanes_in_turn >= 1);
|
||||||
std::vector<flatbuffers::Offset<fbresult::Lane>> lanes;
|
std::vector<flatbuffers::Offset<fbresult::Lane>> lanes;
|
||||||
lanes.resize(intersection.lane_description.size());
|
lanes.resize(intersection.lane_description.size());
|
||||||
@ -414,11 +478,13 @@ public:
|
|||||||
{
|
{
|
||||||
--lane_id;
|
--lane_id;
|
||||||
fbresult::LaneBuilder laneBuilder(fb_result);
|
fbresult::LaneBuilder laneBuilder(fb_result);
|
||||||
auto indications_vector = fb_result.CreateVector(TurnLaneTypeToFB(lane_desc));
|
auto indications_vector =
|
||||||
|
fb_result.CreateVector(TurnLaneTypeToFB(lane_desc));
|
||||||
laneBuilder.add_indications(indications_vector);
|
laneBuilder.add_indications(indications_vector);
|
||||||
if (lane_id >= intersection.lanes.first_lane_from_the_right &&
|
if (lane_id >=
|
||||||
lane_id <
|
intersection.lanes.first_lane_from_the_right &&
|
||||||
intersection.lanes.first_lane_from_the_right + intersection.lanes.lanes_in_turn)
|
lane_id < intersection.lanes.first_lane_from_the_right +
|
||||||
|
intersection.lanes.lanes_in_turn)
|
||||||
laneBuilder.add_valid(true);
|
laneBuilder.add_valid(true);
|
||||||
else
|
else
|
||||||
laneBuilder.add_valid(false);
|
laneBuilder.add_valid(false);
|
||||||
@ -458,7 +524,9 @@ public:
|
|||||||
{
|
{
|
||||||
double prev_speed = 0;
|
double prev_speed = 0;
|
||||||
auto speed = GetAnnotations<float>(
|
auto speed = GetAnnotations<float>(
|
||||||
fb_result, leg_geometry, [&prev_speed](const guidance::LegGeometry::Annotation &anno) {
|
fb_result,
|
||||||
|
leg_geometry,
|
||||||
|
[&prev_speed](const guidance::LegGeometry::Annotation &anno) {
|
||||||
if (anno.duration < std::numeric_limits<float>::min())
|
if (anno.duration < std::numeric_limits<float>::min())
|
||||||
{
|
{
|
||||||
return prev_speed;
|
return prev_speed;
|
||||||
@ -492,8 +560,9 @@ public:
|
|||||||
if (requested_annotations & RouteParameters::AnnotationsType::Weight)
|
if (requested_annotations & RouteParameters::AnnotationsType::Weight)
|
||||||
{
|
{
|
||||||
auto weight = GetAnnotations<uint32_t>(
|
auto weight = GetAnnotations<uint32_t>(
|
||||||
fb_result, leg_geometry,
|
fb_result, leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||||
[](const guidance::LegGeometry::Annotation &anno) { return anno.weight; });
|
return anno.weight;
|
||||||
|
});
|
||||||
annotation.add_weight(weight);
|
annotation.add_weight(weight);
|
||||||
}
|
}
|
||||||
if (requested_annotations & RouteParameters::AnnotationsType::Datasources)
|
if (requested_annotations & RouteParameters::AnnotationsType::Datasources)
|
||||||
@ -527,7 +596,8 @@ public:
|
|||||||
// Length of 0 indicates the first empty name, so we can stop here
|
// Length of 0 indicates the first empty name, so we can stop here
|
||||||
if (name.size() == 0)
|
if (name.size() == 0)
|
||||||
break;
|
break;
|
||||||
names.emplace_back(fb_result.CreateString(std::string(facade.GetDatasourceName(i))));
|
names.emplace_back(
|
||||||
|
fb_result.CreateString(std::string(facade.GetDatasourceName(i))));
|
||||||
}
|
}
|
||||||
auto datasource_names_vector = fb_result.CreateVector(names);
|
auto datasource_names_vector = fb_result.CreateVector(names);
|
||||||
metadata.add_datasource_names(datasource_names_vector);
|
metadata.add_datasource_names(datasource_names_vector);
|
||||||
@ -544,7 +614,8 @@ public:
|
|||||||
|
|
||||||
// Fill geometry
|
// Fill geometry
|
||||||
auto overview = MakeOverview(leg_geometries);
|
auto overview = MakeOverview(leg_geometries);
|
||||||
if(overview) {
|
if (overview)
|
||||||
|
{
|
||||||
MakeGeometry(routeObject, overview->begin(), overview->end());
|
MakeGeometry(routeObject, overview->begin(), overview->end());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,12 +627,16 @@ public:
|
|||||||
const std::vector<bool> &source_traversed_in_reverse,
|
const std::vector<bool> &source_traversed_in_reverse,
|
||||||
const std::vector<bool> &target_traversed_in_reverse) const
|
const std::vector<bool> &target_traversed_in_reverse) const
|
||||||
{
|
{
|
||||||
auto legs_info = MakeLegs(segment_end_coordinates, unpacked_path_segments, source_traversed_in_reverse, target_traversed_in_reverse);
|
auto legs_info = MakeLegs(segment_end_coordinates,
|
||||||
|
unpacked_path_segments,
|
||||||
|
source_traversed_in_reverse,
|
||||||
|
target_traversed_in_reverse);
|
||||||
std::vector<guidance::RouteLeg> legs = legs_info.first;
|
std::vector<guidance::RouteLeg> legs = legs_info.first;
|
||||||
std::vector<guidance::LegGeometry> leg_geometries = legs_info.second;
|
std::vector<guidance::LegGeometry> leg_geometries = legs_info.second;
|
||||||
|
|
||||||
auto route = guidance::assembleRoute(legs);
|
auto route = guidance::assembleRoute(legs);
|
||||||
boost::optional<util::json::Value> json_overview = MakeGeometry(MakeOverview(leg_geometries));
|
boost::optional<util::json::Value> json_overview =
|
||||||
|
MakeGeometry(MakeOverview(leg_geometries));
|
||||||
|
|
||||||
std::vector<util::json::Value> step_geometries;
|
std::vector<util::json::Value> step_geometries;
|
||||||
const auto total_step_count =
|
const auto total_step_count =
|
||||||
@ -712,8 +787,10 @@ public:
|
|||||||
MakeLegs(const std::vector<PhantomNodes> &segment_end_coordinates,
|
MakeLegs(const std::vector<PhantomNodes> &segment_end_coordinates,
|
||||||
const std::vector<std::vector<PathData>> &unpacked_path_segments,
|
const std::vector<std::vector<PathData>> &unpacked_path_segments,
|
||||||
const std::vector<bool> &source_traversed_in_reverse,
|
const std::vector<bool> &source_traversed_in_reverse,
|
||||||
const std::vector<bool> &target_traversed_in_reverse) const {
|
const std::vector<bool> &target_traversed_in_reverse) const
|
||||||
auto result = std::make_pair(std::vector<guidance::RouteLeg>(), std::vector<guidance::LegGeometry>());
|
{
|
||||||
|
auto result =
|
||||||
|
std::make_pair(std::vector<guidance::RouteLeg>(), std::vector<guidance::LegGeometry>());
|
||||||
auto &legs = result.first;
|
auto &legs = result.first;
|
||||||
auto &leg_geometries = result.second;
|
auto &leg_geometries = result.second;
|
||||||
auto number_of_legs = segment_end_coordinates.size();
|
auto number_of_legs = segment_end_coordinates.size();
|
||||||
@ -811,7 +888,9 @@ public:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::vector<Coordinate>> MakeOverview(const std::vector<guidance::LegGeometry>& leg_geometries) const {
|
boost::optional<std::vector<Coordinate>>
|
||||||
|
MakeOverview(const std::vector<guidance::LegGeometry> &leg_geometries) const
|
||||||
|
{
|
||||||
boost::optional<std::vector<Coordinate>> overview;
|
boost::optional<std::vector<Coordinate>> overview;
|
||||||
if (parameters.overview != RouteParameters::OverviewType::False)
|
if (parameters.overview != RouteParameters::OverviewType::False)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,8 @@ class TableAPI final : public BaseAPI
|
|||||||
const std::vector<TableCellRef> &fallback_speed_cells,
|
const std::vector<TableCellRef> &fallback_speed_cells,
|
||||||
osrm::engine::api::ResultT &response) const
|
osrm::engine::api::ResultT &response) const
|
||||||
{
|
{
|
||||||
if(response.is<flatbuffers::FlatBufferBuilder>()) {
|
if (response.is<flatbuffers::FlatBufferBuilder>())
|
||||||
|
{
|
||||||
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
||||||
MakeResponse(tables, phantoms, fallback_speed_cells, fb_result);
|
MakeResponse(tables, phantoms, fallback_speed_cells, fb_result);
|
||||||
}
|
}
|
||||||
@ -66,7 +67,8 @@ class TableAPI final : public BaseAPI
|
|||||||
MakeResponse(const std::pair<std::vector<EdgeDuration>, std::vector<EdgeDistance>> &tables,
|
MakeResponse(const std::pair<std::vector<EdgeDuration>, std::vector<EdgeDistance>> &tables,
|
||||||
const std::vector<PhantomNode> &phantoms,
|
const std::vector<PhantomNode> &phantoms,
|
||||||
const std::vector<TableCellRef> &fallback_speed_cells,
|
const std::vector<TableCellRef> &fallback_speed_cells,
|
||||||
flatbuffers::FlatBufferBuilder &fb_result) const {
|
flatbuffers::FlatBufferBuilder &fb_result) const
|
||||||
|
{
|
||||||
auto number_of_sources = parameters.sources.size();
|
auto number_of_sources = parameters.sources.size();
|
||||||
auto number_of_destinations = parameters.destinations.size();
|
auto number_of_destinations = parameters.destinations.size();
|
||||||
|
|
||||||
@ -169,16 +171,17 @@ class TableAPI final : public BaseAPI
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
virtual flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||||
MakeWaypoints(flatbuffers::FlatBufferBuilder& builder, const std::vector<PhantomNode> &phantoms) const
|
MakeWaypoints(flatbuffers::FlatBufferBuilder &builder,
|
||||||
|
const std::vector<PhantomNode> &phantoms) const
|
||||||
{
|
{
|
||||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||||
waypoints.reserve(phantoms.size());
|
waypoints.reserve(phantoms.size());
|
||||||
BOOST_ASSERT(phantoms.size() == parameters.coordinates.size());
|
BOOST_ASSERT(phantoms.size() == parameters.coordinates.size());
|
||||||
|
|
||||||
boost::range::transform(
|
boost::range::transform(
|
||||||
phantoms,
|
phantoms, std::back_inserter(waypoints), [this, &builder](const PhantomNode &phantom) {
|
||||||
std::back_inserter(waypoints),
|
return BaseAPI::MakeWaypoint(builder, phantom).Finish();
|
||||||
[this, &builder](const PhantomNode &phantom) { return BaseAPI::MakeWaypoint(builder, phantom).Finish(); });
|
});
|
||||||
return builder.CreateVector(waypoints);
|
return builder.CreateVector(waypoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,8 +207,10 @@ class TableAPI final : public BaseAPI
|
|||||||
{
|
{
|
||||||
std::vector<float> distance_table;
|
std::vector<float> distance_table;
|
||||||
distance_table.resize(values.size());
|
distance_table.resize(values.size());
|
||||||
std::transform(values.begin(), values.end(), distance_table.begin(), [](const EdgeWeight duration) {
|
std::transform(
|
||||||
if (duration == MAXIMAL_EDGE_DURATION) {
|
values.begin(), values.end(), distance_table.begin(), [](const EdgeWeight duration) {
|
||||||
|
if (duration == MAXIMAL_EDGE_DURATION)
|
||||||
|
{
|
||||||
return 0.;
|
return 0.;
|
||||||
}
|
}
|
||||||
return duration / 10.;
|
return duration / 10.;
|
||||||
@ -219,8 +224,10 @@ class TableAPI final : public BaseAPI
|
|||||||
{
|
{
|
||||||
std::vector<float> duration_table;
|
std::vector<float> duration_table;
|
||||||
duration_table.resize(values.size());
|
duration_table.resize(values.size());
|
||||||
std::transform(values.begin(), values.end(), duration_table.begin(), [](const EdgeDistance distance) {
|
std::transform(
|
||||||
if (distance == INVALID_EDGE_DISTANCE) {
|
values.begin(), values.end(), duration_table.begin(), [](const EdgeDistance distance) {
|
||||||
|
if (distance == INVALID_EDGE_DISTANCE)
|
||||||
|
{
|
||||||
return 0.;
|
return 0.;
|
||||||
}
|
}
|
||||||
return std::round(distance * 10) / 10.;
|
return std::round(distance * 10) / 10.;
|
||||||
@ -229,7 +236,8 @@ class TableAPI final : public BaseAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual flatbuffers::Offset<flatbuffers::Vector<uint32_t>>
|
virtual flatbuffers::Offset<flatbuffers::Vector<uint32_t>>
|
||||||
MakeEstimatesTable(flatbuffers::FlatBufferBuilder& builder, const std::vector<TableCellRef> &fallback_speed_cells) const
|
MakeEstimatesTable(flatbuffers::FlatBufferBuilder &builder,
|
||||||
|
const std::vector<TableCellRef> &fallback_speed_cells) const
|
||||||
{
|
{
|
||||||
std::vector<uint32_t> fb_table;
|
std::vector<uint32_t> fb_table;
|
||||||
fb_table.reserve(fallback_speed_cells.size());
|
fb_table.reserve(fallback_speed_cells.size());
|
||||||
@ -241,7 +249,6 @@ class TableAPI final : public BaseAPI
|
|||||||
return builder.CreateVector(fb_table);
|
return builder.CreateVector(fb_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual util::json::Array MakeWaypoints(const std::vector<PhantomNode> &phantoms) const
|
virtual util::json::Array MakeWaypoints(const std::vector<PhantomNode> &phantoms) const
|
||||||
{
|
{
|
||||||
util::json::Array json_waypoints;
|
util::json::Array json_waypoints;
|
||||||
|
@ -31,21 +31,26 @@ class TripAPI final : public RouteAPI
|
|||||||
{
|
{
|
||||||
BOOST_ASSERT(sub_trips.size() == sub_routes.size());
|
BOOST_ASSERT(sub_trips.size() == sub_routes.size());
|
||||||
|
|
||||||
if (response.is<flatbuffers::FlatBufferBuilder>()) {
|
if (response.is<flatbuffers::FlatBufferBuilder>())
|
||||||
|
{
|
||||||
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
||||||
MakeResponse(sub_trips, sub_routes, phantoms, fb_result);
|
MakeResponse(sub_trips, sub_routes, phantoms, fb_result);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
auto &json_result = response.get<util::json::Object>();
|
auto &json_result = response.get<util::json::Object>();
|
||||||
MakeResponse(sub_trips, sub_routes, phantoms, json_result);
|
MakeResponse(sub_trips, sub_routes, phantoms, json_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void MakeResponse(const std::vector<std::vector<NodeID>> &sub_trips,
|
void MakeResponse(const std::vector<std::vector<NodeID>> &sub_trips,
|
||||||
const std::vector<InternalRouteResult> &sub_routes,
|
const std::vector<InternalRouteResult> &sub_routes,
|
||||||
const std::vector<PhantomNode> &phantoms,
|
const std::vector<PhantomNode> &phantoms,
|
||||||
flatbuffers::FlatBufferBuilder &fb_result) const
|
flatbuffers::FlatBufferBuilder &fb_result) const
|
||||||
{
|
{
|
||||||
auto response = MakeFBResponse(sub_routes, fb_result, [this, &fb_result, &sub_trips, &phantoms]() { return MakeWaypoints(fb_result, sub_trips, phantoms); });
|
auto response =
|
||||||
|
MakeFBResponse(sub_routes, fb_result, [this, &fb_result, &sub_trips, &phantoms]() {
|
||||||
|
return MakeWaypoints(fb_result, sub_trips, phantoms);
|
||||||
|
});
|
||||||
|
|
||||||
fb_result.Finish(response.Finish());
|
fb_result.Finish(response.Finish());
|
||||||
}
|
}
|
||||||
@ -74,23 +79,27 @@ class TripAPI final : public RouteAPI
|
|||||||
// FIXME this logic is a little backwards. We should change the output format of the
|
// FIXME this logic is a little backwards. We should change the output format of the
|
||||||
// trip plugin routing algorithm to be easier to consume here.
|
// trip plugin routing algorithm to be easier to consume here.
|
||||||
|
|
||||||
struct TripIndex {
|
struct TripIndex
|
||||||
|
{
|
||||||
TripIndex() = default;
|
TripIndex() = default;
|
||||||
|
|
||||||
TripIndex(unsigned sub_trip_index_, unsigned point_index_)
|
TripIndex(unsigned sub_trip_index_, unsigned point_index_)
|
||||||
: sub_trip_index(sub_trip_index_), point_index(point_index_) {
|
: sub_trip_index(sub_trip_index_), point_index(point_index_)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned sub_trip_index = std::numeric_limits<unsigned>::max();
|
unsigned sub_trip_index = std::numeric_limits<unsigned>::max();
|
||||||
unsigned point_index = std::numeric_limits<unsigned>::max();
|
unsigned point_index = std::numeric_limits<unsigned>::max();
|
||||||
|
|
||||||
bool NotUsed() {
|
bool NotUsed()
|
||||||
|
{
|
||||||
return sub_trip_index == std::numeric_limits<unsigned>::max() &&
|
return sub_trip_index == std::numeric_limits<unsigned>::max() &&
|
||||||
point_index == std::numeric_limits<unsigned>::max();
|
point_index == std::numeric_limits<unsigned>::max();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>> MakeWaypoints(flatbuffers::FlatBufferBuilder &fb_result,
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||||
|
MakeWaypoints(flatbuffers::FlatBufferBuilder &fb_result,
|
||||||
const std::vector<std::vector<NodeID>> &sub_trips,
|
const std::vector<std::vector<NodeID>> &sub_trips,
|
||||||
const std::vector<PhantomNode> &phantoms) const
|
const std::vector<PhantomNode> &phantoms) const
|
||||||
{
|
{
|
||||||
@ -135,11 +144,13 @@ class TripAPI final : public RouteAPI
|
|||||||
return waypoints;
|
return waypoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<TripIndex>
|
std::vector<TripIndex> MakeTripIndices(const std::vector<std::vector<NodeID>> &sub_trips) const
|
||||||
MakeTripIndices(const std::vector<std::vector<NodeID>> &sub_trips) const {
|
{
|
||||||
std::vector<TripIndex> input_idx_to_trip_idx(parameters.coordinates.size());
|
std::vector<TripIndex> input_idx_to_trip_idx(parameters.coordinates.size());
|
||||||
for (auto sub_trip_index : util::irange<unsigned>(0u, sub_trips.size())) {
|
for (auto sub_trip_index : util::irange<unsigned>(0u, sub_trips.size()))
|
||||||
for (auto point_index : util::irange<unsigned>(0u, sub_trips[sub_trip_index].size())) {
|
{
|
||||||
|
for (auto point_index : util::irange<unsigned>(0u, sub_trips[sub_trip_index].size()))
|
||||||
|
{
|
||||||
input_idx_to_trip_idx[sub_trips[sub_trip_index][point_index]] =
|
input_idx_to_trip_idx[sub_trips[sub_trip_index][point_index]] =
|
||||||
TripIndex{sub_trip_index, point_index};
|
TripIndex{sub_trip_index, point_index};
|
||||||
}
|
}
|
||||||
|
@ -32,18 +32,13 @@ class EngineInterface
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~EngineInterface() = default;
|
virtual ~EngineInterface() = default;
|
||||||
virtual Status Route(const api::RouteParameters ¶meters,
|
virtual Status Route(const api::RouteParameters ¶meters, api::ResultT &result) const = 0;
|
||||||
api::ResultT &result) const = 0;
|
virtual Status Table(const api::TableParameters ¶meters, api::ResultT &result) const = 0;
|
||||||
virtual Status Table(const api::TableParameters ¶meters,
|
|
||||||
api::ResultT &result) const = 0;
|
|
||||||
virtual Status Nearest(const api::NearestParameters ¶meters,
|
virtual Status Nearest(const api::NearestParameters ¶meters,
|
||||||
api::ResultT &result) const = 0;
|
api::ResultT &result) const = 0;
|
||||||
virtual Status Trip(const api::TripParameters ¶meters,
|
virtual Status Trip(const api::TripParameters ¶meters, api::ResultT &result) const = 0;
|
||||||
api::ResultT &result) const = 0;
|
virtual Status Match(const api::MatchParameters ¶meters, api::ResultT &result) const = 0;
|
||||||
virtual Status Match(const api::MatchParameters ¶meters,
|
virtual Status Tile(const api::TileParameters ¶meters, api::ResultT &result) const = 0;
|
||||||
api::ResultT &result) const = 0;
|
|
||||||
virtual Status Tile(const api::TileParameters ¶meters,
|
|
||||||
api::ResultT &result) const = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Algorithm> class Engine final : public EngineInterface
|
template <typename Algorithm> class Engine final : public EngineInterface
|
||||||
@ -90,38 +85,32 @@ template <typename Algorithm> class Engine final : public EngineInterface
|
|||||||
Engine &operator=(const Engine &) = delete;
|
Engine &operator=(const Engine &) = delete;
|
||||||
virtual ~Engine() = default;
|
virtual ~Engine() = default;
|
||||||
|
|
||||||
Status Route(const api::RouteParameters ¶ms,
|
Status Route(const api::RouteParameters ¶ms, api::ResultT &result) const override final
|
||||||
api::ResultT &result) const override final
|
|
||||||
{
|
{
|
||||||
return route_plugin.HandleRequest(GetAlgorithms(params), params, result);
|
return route_plugin.HandleRequest(GetAlgorithms(params), params, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status Table(const api::TableParameters ¶ms,
|
Status Table(const api::TableParameters ¶ms, api::ResultT &result) const override final
|
||||||
api::ResultT &result) const override final
|
|
||||||
{
|
{
|
||||||
return table_plugin.HandleRequest(GetAlgorithms(params), params, result);
|
return table_plugin.HandleRequest(GetAlgorithms(params), params, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status Nearest(const api::NearestParameters ¶ms,
|
Status Nearest(const api::NearestParameters ¶ms, api::ResultT &result) const override final
|
||||||
api::ResultT &result) const override final
|
|
||||||
{
|
{
|
||||||
return nearest_plugin.HandleRequest(GetAlgorithms(params), params, result);
|
return nearest_plugin.HandleRequest(GetAlgorithms(params), params, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status Trip(const api::TripParameters ¶ms,
|
Status Trip(const api::TripParameters ¶ms, api::ResultT &result) const override final
|
||||||
api::ResultT &result) const override final
|
|
||||||
{
|
{
|
||||||
return trip_plugin.HandleRequest(GetAlgorithms(params), params, result);
|
return trip_plugin.HandleRequest(GetAlgorithms(params), params, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status Match(const api::MatchParameters ¶ms,
|
Status Match(const api::MatchParameters ¶ms, api::ResultT &result) const override final
|
||||||
api::ResultT &result) const override final
|
|
||||||
{
|
{
|
||||||
return match_plugin.HandleRequest(GetAlgorithms(params), params, result);
|
return match_plugin.HandleRequest(GetAlgorithms(params), params, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status Tile(const api::TileParameters ¶ms,
|
Status Tile(const api::TileParameters ¶ms, api::ResultT &result) const override final
|
||||||
api::ResultT &result) const override final
|
|
||||||
{
|
{
|
||||||
return tile_plugin.HandleRequest(GetAlgorithms(params), params, result);
|
return tile_plugin.HandleRequest(GetAlgorithms(params), params, result);
|
||||||
}
|
}
|
||||||
|
@ -64,17 +64,21 @@ class BasePlugin
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ErrorRenderer {
|
struct ErrorRenderer
|
||||||
|
{
|
||||||
std::string code;
|
std::string code;
|
||||||
std::string message;
|
std::string message;
|
||||||
|
|
||||||
ErrorRenderer(std::string code, std::string message) : code(std::move(code)), message(std::move(message)) {};
|
ErrorRenderer(std::string code, std::string message)
|
||||||
|
: code(std::move(code)), message(std::move(message)){};
|
||||||
|
|
||||||
void operator()(util::json::Object& json_result) {
|
void operator()(util::json::Object &json_result)
|
||||||
|
{
|
||||||
json_result.values["code"] = code;
|
json_result.values["code"] = code;
|
||||||
json_result.values["message"] = message;
|
json_result.values["message"] = message;
|
||||||
};
|
};
|
||||||
void operator()(flatbuffers::FlatBufferBuilder& fb_result) {
|
void operator()(flatbuffers::FlatBufferBuilder &fb_result)
|
||||||
|
{
|
||||||
api::fbresult::FBResultBuilder error(fb_result);
|
api::fbresult::FBResultBuilder error(fb_result);
|
||||||
error.add_error(true);
|
error.add_error(true);
|
||||||
|
|
||||||
@ -84,7 +88,8 @@ class BasePlugin
|
|||||||
error.add_code(codeBuilder.Finish());
|
error.add_code(codeBuilder.Finish());
|
||||||
fb_result.Finish(error.Finish());
|
fb_result.Finish(error.Finish());
|
||||||
};
|
};
|
||||||
void operator()(std::string& str_result) {
|
void operator()(std::string &str_result)
|
||||||
|
{
|
||||||
str_result = str(boost::format("code=%1% message=%2%") % code % message);
|
str_result = str(boost::format("code=%1% message=%2%") % code % message);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -28,9 +28,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#ifndef OSRM_HPP
|
#ifndef OSRM_HPP
|
||||||
#define OSRM_HPP
|
#define OSRM_HPP
|
||||||
|
|
||||||
|
#include "engine/api/base_result.hpp"
|
||||||
#include "osrm/osrm_fwd.hpp"
|
#include "osrm/osrm_fwd.hpp"
|
||||||
#include "osrm/status.hpp"
|
#include "osrm/status.hpp"
|
||||||
#include "engine/api/base_result.hpp"
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -169,10 +169,11 @@ struct BaseParametersGrammar : boost::spirit::qi::grammar<Iterator, Signature>
|
|||||||
qi::lit("snapping=") >
|
qi::lit("snapping=") >
|
||||||
snapping_type[ph::bind(&engine::api::BaseParameters::snapping, qi::_r1) = qi::_1];
|
snapping_type[ph::bind(&engine::api::BaseParameters::snapping, qi::_r1) = qi::_1];
|
||||||
|
|
||||||
format_type.add(".json", engine::api::BaseParameters::OutputFormatType::JSON)
|
format_type.add(".json", engine::api::BaseParameters::OutputFormatType::JSON)(
|
||||||
(".flatbuffers", engine::api::BaseParameters::OutputFormatType::FLATBUFFERS);
|
".flatbuffers", engine::api::BaseParameters::OutputFormatType::FLATBUFFERS);
|
||||||
|
|
||||||
format_rule = -format_type[ph::bind(&engine::api::BaseParameters::format, qi::_r1) = qi::_1];
|
format_rule =
|
||||||
|
-format_type[ph::bind(&engine::api::BaseParameters::format, qi::_r1) = qi::_1];
|
||||||
|
|
||||||
exclude_rule = qi::lit("exclude=") >
|
exclude_rule = qi::lit("exclude=") >
|
||||||
(qi::as_string[+qi::char_("a-zA-Z0-9")] %
|
(qi::as_string[+qi::char_("a-zA-Z0-9")] %
|
||||||
|
@ -22,8 +22,9 @@ class MatchService final : public BaseService
|
|||||||
public:
|
public:
|
||||||
MatchService(OSRM &routing_machine) : BaseService(routing_machine) {}
|
MatchService(OSRM &routing_machine) : BaseService(routing_machine) {}
|
||||||
|
|
||||||
engine::Status
|
engine::Status RunQuery(std::size_t prefix_length,
|
||||||
RunQuery(std::size_t prefix_length, std::string &query, osrm::engine::api::ResultT &result) final override;
|
std::string &query,
|
||||||
|
osrm::engine::api::ResultT &result) final override;
|
||||||
|
|
||||||
unsigned GetVersion() final override { return 1; }
|
unsigned GetVersion() final override { return 1; }
|
||||||
};
|
};
|
||||||
|
@ -22,8 +22,9 @@ class NearestService final : public BaseService
|
|||||||
public:
|
public:
|
||||||
NearestService(OSRM &routing_machine) : BaseService(routing_machine) {}
|
NearestService(OSRM &routing_machine) : BaseService(routing_machine) {}
|
||||||
|
|
||||||
engine::Status
|
engine::Status RunQuery(std::size_t prefix_length,
|
||||||
RunQuery(std::size_t prefix_length, std::string &query, osrm::engine::api::ResultT &result) final override;
|
std::string &query,
|
||||||
|
osrm::engine::api::ResultT &result) final override;
|
||||||
|
|
||||||
unsigned GetVersion() final override { return 1; }
|
unsigned GetVersion() final override { return 1; }
|
||||||
};
|
};
|
||||||
|
@ -22,8 +22,9 @@ class RouteService final : public BaseService
|
|||||||
public:
|
public:
|
||||||
RouteService(OSRM &routing_machine) : BaseService(routing_machine) {}
|
RouteService(OSRM &routing_machine) : BaseService(routing_machine) {}
|
||||||
|
|
||||||
engine::Status
|
engine::Status RunQuery(std::size_t prefix_length,
|
||||||
RunQuery(std::size_t prefix_length, std::string &query, osrm::engine::api::ResultT &result) final override;
|
std::string &query,
|
||||||
|
osrm::engine::api::ResultT &result) final override;
|
||||||
|
|
||||||
unsigned GetVersion() final override { return 1; }
|
unsigned GetVersion() final override { return 1; }
|
||||||
};
|
};
|
||||||
|
@ -22,8 +22,9 @@ class TableService final : public BaseService
|
|||||||
public:
|
public:
|
||||||
TableService(OSRM &routing_machine) : BaseService(routing_machine) {}
|
TableService(OSRM &routing_machine) : BaseService(routing_machine) {}
|
||||||
|
|
||||||
engine::Status
|
engine::Status RunQuery(std::size_t prefix_length,
|
||||||
RunQuery(std::size_t prefix_length, std::string &query, osrm::engine::api::ResultT &result) final override;
|
std::string &query,
|
||||||
|
osrm::engine::api::ResultT &result) final override;
|
||||||
|
|
||||||
unsigned GetVersion() final override { return 1; }
|
unsigned GetVersion() final override { return 1; }
|
||||||
};
|
};
|
||||||
|
@ -22,8 +22,9 @@ class TileService final : public BaseService
|
|||||||
public:
|
public:
|
||||||
TileService(OSRM &routing_machine) : BaseService(routing_machine) {}
|
TileService(OSRM &routing_machine) : BaseService(routing_machine) {}
|
||||||
|
|
||||||
engine::Status
|
engine::Status RunQuery(std::size_t prefix_length,
|
||||||
RunQuery(std::size_t prefix_length, std::string &query, osrm::engine::api::ResultT &result) final override;
|
std::string &query,
|
||||||
|
osrm::engine::api::ResultT &result) final override;
|
||||||
|
|
||||||
unsigned GetVersion() final override { return 1; }
|
unsigned GetVersion() final override { return 1; }
|
||||||
};
|
};
|
||||||
|
@ -22,8 +22,9 @@ class TripService final : public BaseService
|
|||||||
public:
|
public:
|
||||||
TripService(OSRM &routing_machine) : BaseService(routing_machine) {}
|
TripService(OSRM &routing_machine) : BaseService(routing_machine) {}
|
||||||
|
|
||||||
engine::Status
|
engine::Status RunQuery(std::size_t prefix_length,
|
||||||
RunQuery(std::size_t prefix_length, std::string &query, osrm::engine::api::ResultT &result) final override;
|
std::string &query,
|
||||||
|
osrm::engine::api::ResultT &result) final override;
|
||||||
|
|
||||||
unsigned GetVersion() final override { return 1; }
|
unsigned GetVersion() final override { return 1; }
|
||||||
};
|
};
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
#include "server/service/base_service.hpp"
|
#include "server/service/base_service.hpp"
|
||||||
|
|
||||||
#include "osrm/osrm.hpp"
|
|
||||||
#include "engine/api/base_api.hpp"
|
#include "engine/api/base_api.hpp"
|
||||||
|
#include "osrm/osrm.hpp"
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
|
@ -217,7 +217,8 @@ int main(int argc, const char *argv[]) try
|
|||||||
engine::api::ResultT result = json::Object();
|
engine::api::ResultT result = json::Object();
|
||||||
const auto rc = osrm.Match(params, result);
|
const auto rc = osrm.Match(params, result);
|
||||||
auto &json_result = result.get<json::Object>();
|
auto &json_result = result.get<json::Object>();
|
||||||
if (rc != Status::Ok || json_result.values.at("matchings").get<json::Array>().values.size() != 1)
|
if (rc != Status::Ok ||
|
||||||
|
json_result.values.at("matchings").get<json::Array>().values.size() != 1)
|
||||||
{
|
{
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -158,8 +158,7 @@ Status MatchPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
|||||||
|
|
||||||
if (!time_increases_monotonically)
|
if (!time_increases_monotonically)
|
||||||
{
|
{
|
||||||
return Error(
|
return Error("InvalidValue", "Timestamps need to be monotonically increasing.", result);
|
||||||
"InvalidValue", "Timestamps need to be monotonically increasing.", result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SubMatchingList sub_matchings;
|
SubMatchingList sub_matchings;
|
||||||
@ -180,9 +179,8 @@ Status MatchPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
|||||||
(tidied.parameters.waypoints[0] != 0 ||
|
(tidied.parameters.waypoints[0] != 0 ||
|
||||||
tidied.parameters.waypoints.back() != (tidied.parameters.coordinates.size() - 1)))
|
tidied.parameters.waypoints.back() != (tidied.parameters.coordinates.size() - 1)))
|
||||||
{
|
{
|
||||||
return Error("InvalidValue",
|
return Error(
|
||||||
"First and last coordinates must be specified as waypoints.",
|
"InvalidValue", "First and last coordinates must be specified as waypoints.", result);
|
||||||
result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// assuming radius is the standard deviation of a normal distribution
|
// assuming radius is the standard deviation of a normal distribution
|
||||||
@ -260,8 +258,7 @@ Status MatchPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
|||||||
}
|
}
|
||||||
if (!tidied_waypoints.empty())
|
if (!tidied_waypoints.empty())
|
||||||
{
|
{
|
||||||
return Error(
|
return Error("NoMatch", "Requested waypoint parameter could not be matched.", result);
|
||||||
"NoMatch", "Requested waypoint parameter could not be matched.", result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// we haven't errored yet, only allow leg collapsing if it was originally requested
|
// we haven't errored yet, only allow leg collapsing if it was originally requested
|
||||||
|
@ -78,9 +78,8 @@ Status ViaRoutePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithm
|
|||||||
(route_parameters.waypoints[0] != 0 ||
|
(route_parameters.waypoints[0] != 0 ||
|
||||||
route_parameters.waypoints.back() != (route_parameters.coordinates.size() - 1)))
|
route_parameters.waypoints.back() != (route_parameters.coordinates.size() - 1)))
|
||||||
{
|
{
|
||||||
return Error("InvalidValue",
|
return Error(
|
||||||
"First and last coordinates must be specified as waypoints.",
|
"InvalidValue", "First and last coordinates must be specified as waypoints.", result);
|
||||||
result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CheckAlgorithms(route_parameters, algorithms, result))
|
if (!CheckAlgorithms(route_parameters, algorithms, result))
|
||||||
|
@ -118,7 +118,8 @@ void RequestHandler::HandleRequest(const http::request ¤t_request, http::r
|
|||||||
buffer.GetBufferPointer() + buffer.GetSize(),
|
buffer.GetBufferPointer() + buffer.GetSize(),
|
||||||
current_reply.content.begin());
|
current_reply.content.begin());
|
||||||
|
|
||||||
current_reply.headers.emplace_back("Content-Type", "application/x-flatbuffers;schema=osrm.engine.api.fbresult");
|
current_reply.headers.emplace_back(
|
||||||
|
"Content-Type", "application/x-flatbuffers;schema=osrm.engine.api.fbresult");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -41,8 +41,9 @@ std::string getWrongOptionHelp(const engine::api::MatchParameters ¶meters)
|
|||||||
}
|
}
|
||||||
} // anon. ns
|
} // anon. ns
|
||||||
|
|
||||||
engine::Status
|
engine::Status MatchService::RunQuery(std::size_t prefix_length,
|
||||||
MatchService::RunQuery(std::size_t prefix_length, std::string &query, osrm::engine::api::ResultT &result)
|
std::string &query,
|
||||||
|
osrm::engine::api::ResultT &result)
|
||||||
{
|
{
|
||||||
result = util::json::Object();
|
result = util::json::Object();
|
||||||
auto &json_result = result.get<util::json::Object>();
|
auto &json_result = result.get<util::json::Object>();
|
||||||
@ -70,7 +71,8 @@ MatchService::RunQuery(std::size_t prefix_length, std::string &query, osrm::engi
|
|||||||
|
|
||||||
if (parameters->format)
|
if (parameters->format)
|
||||||
{
|
{
|
||||||
if (parameters->format == engine::api::BaseParameters::OutputFormatType::FLATBUFFERS) {
|
if (parameters->format == engine::api::BaseParameters::OutputFormatType::FLATBUFFERS)
|
||||||
|
{
|
||||||
result = flatbuffers::FlatBufferBuilder();
|
result = flatbuffers::FlatBufferBuilder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,9 @@ std::string getWrongOptionHelp(const engine::api::NearestParameters ¶meters)
|
|||||||
}
|
}
|
||||||
} // anon. ns
|
} // anon. ns
|
||||||
|
|
||||||
engine::Status
|
engine::Status NearestService::RunQuery(std::size_t prefix_length,
|
||||||
NearestService::RunQuery(std::size_t prefix_length, std::string &query, osrm::engine::api::ResultT &result)
|
std::string &query,
|
||||||
|
osrm::engine::api::ResultT &result)
|
||||||
{
|
{
|
||||||
result = util::json::Object();
|
result = util::json::Object();
|
||||||
auto &json_result = result.get<util::json::Object>();
|
auto &json_result = result.get<util::json::Object>();
|
||||||
@ -64,7 +65,8 @@ NearestService::RunQuery(std::size_t prefix_length, std::string &query, osrm::en
|
|||||||
|
|
||||||
if (parameters->format)
|
if (parameters->format)
|
||||||
{
|
{
|
||||||
if (parameters->format == engine::api::BaseParameters::OutputFormatType::FLATBUFFERS) {
|
if (parameters->format == engine::api::BaseParameters::OutputFormatType::FLATBUFFERS)
|
||||||
|
{
|
||||||
result = flatbuffers::FlatBufferBuilder();
|
result = flatbuffers::FlatBufferBuilder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,9 @@ std::string getWrongOptionHelp(const engine::api::RouteParameters ¶meters)
|
|||||||
}
|
}
|
||||||
} // anon. ns
|
} // anon. ns
|
||||||
|
|
||||||
engine::Status
|
engine::Status RouteService::RunQuery(std::size_t prefix_length,
|
||||||
RouteService::RunQuery(std::size_t prefix_length, std::string &query, osrm::engine::api::ResultT &result)
|
std::string &query,
|
||||||
|
osrm::engine::api::ResultT &result)
|
||||||
{
|
{
|
||||||
result = util::json::Object();
|
result = util::json::Object();
|
||||||
auto &json_result = result.get<util::json::Object>();
|
auto &json_result = result.get<util::json::Object>();
|
||||||
@ -68,7 +69,8 @@ RouteService::RunQuery(std::size_t prefix_length, std::string &query, osrm::engi
|
|||||||
|
|
||||||
if (parameters->format)
|
if (parameters->format)
|
||||||
{
|
{
|
||||||
if (parameters->format == engine::api::BaseParameters::OutputFormatType::FLATBUFFERS) {
|
if (parameters->format == engine::api::BaseParameters::OutputFormatType::FLATBUFFERS)
|
||||||
|
{
|
||||||
result = flatbuffers::FlatBufferBuilder();
|
result = flatbuffers::FlatBufferBuilder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,8 +70,9 @@ std::string getWrongOptionHelp(const engine::api::TableParameters ¶meters)
|
|||||||
}
|
}
|
||||||
} // anon. ns
|
} // anon. ns
|
||||||
|
|
||||||
engine::Status
|
engine::Status TableService::RunQuery(std::size_t prefix_length,
|
||||||
TableService::RunQuery(std::size_t prefix_length, std::string &query, osrm::engine::api::ResultT &result)
|
std::string &query,
|
||||||
|
osrm::engine::api::ResultT &result)
|
||||||
{
|
{
|
||||||
result = util::json::Object();
|
result = util::json::Object();
|
||||||
auto &json_result = result.get<util::json::Object>();
|
auto &json_result = result.get<util::json::Object>();
|
||||||
@ -99,7 +100,8 @@ TableService::RunQuery(std::size_t prefix_length, std::string &query, osrm::engi
|
|||||||
|
|
||||||
if (parameters->format)
|
if (parameters->format)
|
||||||
{
|
{
|
||||||
if (parameters->format == engine::api::BaseParameters::OutputFormatType::FLATBUFFERS) {
|
if (parameters->format == engine::api::BaseParameters::OutputFormatType::FLATBUFFERS)
|
||||||
|
{
|
||||||
result = flatbuffers::FlatBufferBuilder();
|
result = flatbuffers::FlatBufferBuilder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,9 @@ namespace server
|
|||||||
namespace service
|
namespace service
|
||||||
{
|
{
|
||||||
|
|
||||||
engine::Status TileService::RunQuery(std::size_t prefix_length, std::string &query, osrm::engine::api::ResultT &result)
|
engine::Status TileService::RunQuery(std::size_t prefix_length,
|
||||||
|
std::string &query,
|
||||||
|
osrm::engine::api::ResultT &result)
|
||||||
{
|
{
|
||||||
auto query_iterator = query.begin();
|
auto query_iterator = query.begin();
|
||||||
auto parameters =
|
auto parameters =
|
||||||
|
@ -41,7 +41,9 @@ std::string getWrongOptionHelp(const engine::api::TripParameters ¶meters)
|
|||||||
}
|
}
|
||||||
} // anon. ns
|
} // anon. ns
|
||||||
|
|
||||||
engine::Status TripService::RunQuery(std::size_t prefix_length, std::string &query, osrm::engine::api::ResultT &result)
|
engine::Status TripService::RunQuery(std::size_t prefix_length,
|
||||||
|
std::string &query,
|
||||||
|
osrm::engine::api::ResultT &result)
|
||||||
{
|
{
|
||||||
result = util::json::Object();
|
result = util::json::Object();
|
||||||
auto &json_result = result.get<util::json::Object>();
|
auto &json_result = result.get<util::json::Object>();
|
||||||
@ -71,7 +73,8 @@ engine::Status TripService::RunQuery(std::size_t prefix_length, std::string &que
|
|||||||
|
|
||||||
if (parameters->format)
|
if (parameters->format)
|
||||||
{
|
{
|
||||||
if (parameters->format == engine::api::BaseParameters::OutputFormatType::FLATBUFFERS) {
|
if (parameters->format == engine::api::BaseParameters::OutputFormatType::FLATBUFFERS)
|
||||||
|
{
|
||||||
result = flatbuffers::FlatBufferBuilder();
|
result = flatbuffers::FlatBufferBuilder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,8 @@ BOOST_AUTO_TEST_CASE(test_table_three_coords_one_source_one_dest_matrix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check destinations array of waypoint objects
|
// check destinations array of waypoint objects
|
||||||
const auto &destinations_array = json_result.values.at("destinations").get<json::Array>().values;
|
const auto &destinations_array =
|
||||||
|
json_result.values.at("destinations").get<json::Array>().values;
|
||||||
BOOST_CHECK_EQUAL(destinations_array.size(), params.destinations.size());
|
BOOST_CHECK_EQUAL(destinations_array.size(), params.destinations.size());
|
||||||
for (const auto &destination : destinations_array)
|
for (const auto &destination : destinations_array)
|
||||||
{
|
{
|
||||||
@ -108,7 +109,8 @@ BOOST_AUTO_TEST_CASE(test_table_three_coords_one_source_matrix)
|
|||||||
params.sources.size() * params.coordinates.size());
|
params.sources.size() * params.coordinates.size());
|
||||||
}
|
}
|
||||||
// check destinations array of waypoint objects
|
// check destinations array of waypoint objects
|
||||||
const auto &destinations_array = json_result.values.at("destinations").get<json::Array>().values;
|
const auto &destinations_array =
|
||||||
|
json_result.values.at("destinations").get<json::Array>().values;
|
||||||
BOOST_CHECK_EQUAL(destinations_array.size(), params.coordinates.size());
|
BOOST_CHECK_EQUAL(destinations_array.size(), params.coordinates.size());
|
||||||
for (const auto &destination : destinations_array)
|
for (const auto &destination : destinations_array)
|
||||||
{
|
{
|
||||||
@ -154,7 +156,8 @@ BOOST_AUTO_TEST_CASE(test_table_three_coordinates_matrix)
|
|||||||
BOOST_CHECK_EQUAL(durations_matrix[i].get<json::Number>().value, 0);
|
BOOST_CHECK_EQUAL(durations_matrix[i].get<json::Number>().value, 0);
|
||||||
BOOST_CHECK_EQUAL(durations_matrix.size(), params.coordinates.size());
|
BOOST_CHECK_EQUAL(durations_matrix.size(), params.coordinates.size());
|
||||||
}
|
}
|
||||||
const auto &destinations_array = json_result.values.at("destinations").get<json::Array>().values;
|
const auto &destinations_array =
|
||||||
|
json_result.values.at("destinations").get<json::Array>().values;
|
||||||
for (const auto &destination : destinations_array)
|
for (const auto &destination : destinations_array)
|
||||||
{
|
{
|
||||||
BOOST_CHECK(waypoint_check(destination));
|
BOOST_CHECK(waypoint_check(destination));
|
||||||
|
Loading…
Reference in New Issue
Block a user