New "sides" setting in base parameters for phantom nodes.
- Adding sides parameter into base parameters, it can take the values SIDE, OPPOSITE or DEFAULT. - Adding url parser for "sides" parameter, url values are "s" for SIDE, "o" for OPPOSITE and "d" for DEFAULT, example : "sides=s;s". - Checking parameters, if "sides" parameter is used, the number of parameter is the same as number of location. - Create a phantom to start at side driving or Opposite side driving. Signed-off-by: FILLAU Jean-Maxime <jean-maxime.fillau@mapotempo.com>
This commit is contained in:
committed by
Patrick Niklaus
parent
579a1ed42e
commit
8e70c87e64
@@ -30,6 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "engine/bearing.hpp"
|
||||
#include "engine/hint.hpp"
|
||||
#include "engine/side.hpp"
|
||||
#include "util/coordinate.hpp"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
@@ -55,6 +56,7 @@ namespace api
|
||||
* optional per coordinate
|
||||
* - bearings: limits the search for segments in the road network to given bearing(s) in degree
|
||||
* towards true north in clockwise direction, optional per coordinate
|
||||
* - sides: force the phantom node to start towards the node with the road country side.
|
||||
*
|
||||
* \see OSRM, Coordinate, Hint, Bearing, RouteParame, RouteParameters, TableParameters,
|
||||
* NearestParameters, TripParameters, MatchParameters and TileParameters
|
||||
@@ -65,6 +67,7 @@ struct BaseParameters
|
||||
std::vector<boost::optional<Hint>> hints;
|
||||
std::vector<boost::optional<double>> radiuses;
|
||||
std::vector<boost::optional<Bearing>> bearings;
|
||||
std::vector<boost::optional<Side>> sides;
|
||||
|
||||
// Adds hints to response which can be included in subsequent requests, see `hints` above.
|
||||
bool generate_hints = true;
|
||||
@@ -73,9 +76,10 @@ struct BaseParameters
|
||||
const std::vector<boost::optional<Hint>> hints_ = {},
|
||||
std::vector<boost::optional<double>> radiuses_ = {},
|
||||
std::vector<boost::optional<Bearing>> bearings_ = {},
|
||||
std::vector<boost::optional<Side>> sides_ = {},
|
||||
bool generate_hints_ = true)
|
||||
: coordinates(coordinates_), hints(hints_), radiuses(radiuses_), bearings(bearings_),
|
||||
generate_hints(generate_hints_)
|
||||
sides(sides_), generate_hints(generate_hints_)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -85,6 +89,7 @@ struct BaseParameters
|
||||
return (hints.empty() || hints.size() == coordinates.size()) &&
|
||||
(bearings.empty() || bearings.size() == coordinates.size()) &&
|
||||
(radiuses.empty() || radiuses.size() == coordinates.size()) &&
|
||||
(sides.empty() || sides.size() == coordinates.size()) &&
|
||||
std::all_of(bearings.begin(),
|
||||
bearings.end(),
|
||||
[](const boost::optional<Bearing> bearing_and_range) {
|
||||
|
||||
Reference in New Issue
Block a user