Compare commits

..

5 Commits

Author SHA1 Message Date
Daniel Patterson 951af0c245 Prepare 5.22.0 release. 2019-01-30 15:35:51 -08:00
Daniel Patterson bbf338aa7c Merge branch 'master' into 5.22 2019-01-30 15:35:20 -08:00
Daniel Patterson 67809998f9 Prepare 5.22.0-rc.2 2019-01-24 17:01:23 -08:00
Daniel Patterson 8992134d4c Fix regression in profile. 2019-01-24 17:00:55 -08:00
Daniel Patterson 51dd414b83 Prepare release candidate. 2019-01-24 16:35:10 -08:00
15 changed files with 45 additions and 168 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ branches:
only: only:
- master - master
# enable building tags # enable building tags
- /^v\d+\.\d+(\.\d+)?(\+[^-]+)?(-\S*)?$/ - /^v\d+\.\d+(\.\d+)?(-\S*)?$/
cache: cache:
npm: true npm: true
+1 -1
View File
@@ -1,4 +1,4 @@
# Unreleased # 5.22.0
- Changes from 5.21.0 - Changes from 5.21.0
- Build: - Build:
- ADDED: optionally build Node `lts` and `latest` bindings [#5347](https://github.com/Project-OSRM/osrm-backend/pull/5347) - ADDED: optionally build Node `lts` and `latest` bindings [#5347](https://github.com/Project-OSRM/osrm-backend/pull/5347)
-20
View File
@@ -35,23 +35,3 @@ Feature: Car - Allowed start/end modes
| from | to | route | modes | | from | to | route | modes |
| 1 | 2 | ab,ab | driving,driving | | 1 | 2 | ab,ab | driving,driving |
| 2 | 1 | ab,ab | driving,driving | | 2 | 1 | ab,ab | driving,driving |
Scenario: Car - URL override of non-startpoints
Given the node map
"""
a 1 b c 2 d
"""
Given the query options
| snapping | any |
And the ways
| nodes | highway | access |
| ab | service | private |
| bc | primary | |
| cd | service | private |
When I route I should get
| from | to | route |
| 1 | 2 | ab,bc,cd |
| 2 | 1 | cd,bc,ab |
+2 -10
View File
@@ -78,11 +78,6 @@ struct RouteParameters : public BaseParameters
Speed = 0x20, Speed = 0x20,
All = Duration | Nodes | Distance | Weight | Datasources | Speed All = Duration | Nodes | Distance | Weight | Datasources | Speed
}; };
enum class SnappingType
{
Default,
Any
};
RouteParameters() = default; RouteParameters() = default;
@@ -152,13 +147,12 @@ struct RouteParameters : public BaseParameters
const OverviewType overview_, const OverviewType overview_,
const boost::optional<bool> continue_straight_, const boost::optional<bool> continue_straight_,
std::vector<std::size_t> waypoints_, std::vector<std::size_t> waypoints_,
const SnappingType snapping_,
const Args... args_) const Args... args_)
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_}, : BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_}, number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_},
annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None}, annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None},
geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_}, geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_},
waypoints{waypoints_}, snapping{snapping_} waypoints{waypoints_}
{ {
} }
@@ -171,13 +165,12 @@ struct RouteParameters : public BaseParameters
const OverviewType overview_, const OverviewType overview_,
const boost::optional<bool> continue_straight_, const boost::optional<bool> continue_straight_,
std::vector<std::size_t> waypoints_, std::vector<std::size_t> waypoints_,
const SnappingType snapping_,
Args... args_) Args... args_)
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_}, : BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
number_of_alternatives{alternatives_ ? 1u : 0u}, number_of_alternatives{alternatives_ ? 1u : 0u},
annotations{annotations_ == AnnotationsType::None ? false : true}, annotations{annotations_ == AnnotationsType::None ? false : true},
annotations_type{annotations_}, geometries{geometries_}, overview{overview_}, annotations_type{annotations_}, geometries{geometries_}, overview{overview_},
continue_straight{continue_straight_}, waypoints{waypoints_}, snapping{snapping_} continue_straight{continue_straight_}, waypoints{waypoints_}
{ {
} }
@@ -191,7 +184,6 @@ struct RouteParameters : public BaseParameters
OverviewType overview = OverviewType::Simplified; OverviewType overview = OverviewType::Simplified;
boost::optional<bool> continue_straight; boost::optional<bool> continue_straight;
std::vector<std::size_t> waypoints; std::vector<std::size_t> waypoints;
SnappingType snapping = SnappingType::Default;
bool IsValid() const bool IsValid() const
{ {
@@ -389,25 +389,23 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
std::pair<PhantomNode, PhantomNode> std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const Approach approach, const Approach approach) const override final
const bool use_all_edges) const override final
{ {
BOOST_ASSERT(m_geospatial_query.get()); BOOST_ASSERT(m_geospatial_query.get());
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent( return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
input_coordinate, approach, use_all_edges); input_coordinate, approach);
} }
std::pair<PhantomNode, PhantomNode> std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const double max_distance, const double max_distance,
const Approach approach, const Approach approach) const override final
const bool use_all_edges) const override final
{ {
BOOST_ASSERT(m_geospatial_query.get()); BOOST_ASSERT(m_geospatial_query.get());
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent( return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
input_coordinate, max_distance, approach, use_all_edges); input_coordinate, max_distance, approach);
} }
std::pair<PhantomNode, PhantomNode> std::pair<PhantomNode, PhantomNode>
@@ -415,26 +413,24 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
const double max_distance, const double max_distance,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const Approach approach, const Approach approach) const override final
const bool use_all_edges) const override final
{ {
BOOST_ASSERT(m_geospatial_query.get()); BOOST_ASSERT(m_geospatial_query.get());
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent( return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
input_coordinate, max_distance, bearing, bearing_range, approach, use_all_edges); input_coordinate, max_distance, bearing, bearing_range, approach);
} }
std::pair<PhantomNode, PhantomNode> std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const Approach approach, const Approach approach) const override final
const bool use_all_edges) const override final
{ {
BOOST_ASSERT(m_geospatial_query.get()); BOOST_ASSERT(m_geospatial_query.get());
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent( return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
input_coordinate, bearing, bearing_range, approach, use_all_edges); input_coordinate, bearing, bearing_range, approach);
} }
std::uint32_t GetCheckSum() const override final { return m_check_sum; } std::uint32_t GetCheckSum() const override final { return m_check_sum; }
@@ -161,26 +161,22 @@ class BaseDataFacade
virtual std::pair<PhantomNode, PhantomNode> virtual std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const Approach approach, const Approach approach) const = 0;
const bool use_all_edges) const = 0;
virtual std::pair<PhantomNode, PhantomNode> virtual std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const double max_distance, const double max_distance,
const Approach approach, const Approach approach) const = 0;
const bool use_all_edges) const = 0;
virtual std::pair<PhantomNode, PhantomNode> virtual std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const double max_distance, const double max_distance,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const Approach approach, const Approach approach) const = 0;
const bool use_all_edges) const = 0;
virtual std::pair<PhantomNode, PhantomNode> virtual std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const Approach approach, const Approach approach) const = 0;
const bool use_all_edges = false) const = 0;
virtual bool HasLaneData(const EdgeID id) const = 0; virtual bool HasLaneData(const EdgeID id) const = 0;
virtual util::guidance::LaneTupleIdPair GetLaneData(const EdgeID id) const = 0; virtual util::guidance::LaneTupleIdPair GetLaneData(const EdgeID id) const = 0;
+14 -28
View File
@@ -205,23 +205,18 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
std::pair<PhantomNode, PhantomNode> std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const double max_distance, const double max_distance,
const Approach approach, const Approach approach) const
const bool use_all_edges) const
{ {
bool has_small_component = false; bool has_small_component = false;
bool has_big_component = false; bool has_big_component = false;
auto results = rtree.Nearest( auto results = rtree.Nearest(
input_coordinate, input_coordinate,
[this, [this, approach, &input_coordinate, &has_big_component, &has_small_component](
approach, const CandidateSegment &segment) {
&input_coordinate,
&has_big_component,
&has_small_component,
&use_all_edges](const CandidateSegment &segment) {
auto use_segment = auto use_segment =
(!has_small_component || (!has_big_component && !IsTinyComponent(segment))); (!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
auto use_directions = std::make_pair(use_segment, use_segment); auto use_directions = std::make_pair(use_segment, use_segment);
const auto valid_edges = HasValidEdge(segment, use_all_edges); const auto valid_edges = HasValidEdge(segment);
const auto admissible_segments = CheckSegmentExclude(segment); const auto admissible_segments = CheckSegmentExclude(segment);
use_directions = boolPairAnd(use_directions, admissible_segments); use_directions = boolPairAnd(use_directions, admissible_segments);
use_directions = boolPairAnd(use_directions, valid_edges); use_directions = boolPairAnd(use_directions, valid_edges);
@@ -256,24 +251,19 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
// a second phantom node is return that is the nearest coordinate in a big component. // a second phantom node is return that is the nearest coordinate in a big component.
std::pair<PhantomNode, PhantomNode> std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const Approach approach, const Approach approach) const
const bool use_all_edges) const
{ {
bool has_small_component = false; bool has_small_component = false;
bool has_big_component = false; bool has_big_component = false;
auto results = rtree.Nearest( auto results = rtree.Nearest(
input_coordinate, input_coordinate,
[this, [this, approach, &input_coordinate, &has_big_component, &has_small_component](
approach, const CandidateSegment &segment) {
&input_coordinate,
&has_big_component,
&has_small_component,
&use_all_edges](const CandidateSegment &segment) {
auto use_segment = auto use_segment =
(!has_small_component || (!has_big_component && !IsTinyComponent(segment))); (!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
auto use_directions = std::make_pair(use_segment, use_segment); auto use_directions = std::make_pair(use_segment, use_segment);
const auto valid_edges = HasValidEdge(segment, use_all_edges); const auto valid_edges = HasValidEdge(segment);
const auto admissible_segments = CheckSegmentExclude(segment); const auto admissible_segments = CheckSegmentExclude(segment);
use_directions = boolPairAnd(use_directions, admissible_segments); use_directions = boolPairAnd(use_directions, admissible_segments);
use_directions = boolPairAnd(use_directions, valid_edges); use_directions = boolPairAnd(use_directions, valid_edges);
@@ -308,8 +298,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const Approach approach, const Approach approach) const
const bool use_all_edges) const
{ {
bool has_small_component = false; bool has_small_component = false;
bool has_big_component = false; bool has_big_component = false;
@@ -321,13 +310,12 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
bearing, bearing,
bearing_range, bearing_range,
&has_big_component, &has_big_component,
&has_small_component, &has_small_component](const CandidateSegment &segment) {
&use_all_edges](const CandidateSegment &segment) {
auto use_segment = auto use_segment =
(!has_small_component || (!has_big_component && !IsTinyComponent(segment))); (!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
auto use_directions = std::make_pair(use_segment, use_segment); auto use_directions = std::make_pair(use_segment, use_segment);
const auto admissible_segments = CheckSegmentExclude(segment); const auto admissible_segments = CheckSegmentExclude(segment);
use_directions = boolPairAnd(use_directions, HasValidEdge(segment, use_all_edges)); use_directions = boolPairAnd(use_directions, HasValidEdge(segment));
if (use_segment) if (use_segment)
{ {
@@ -368,8 +356,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
const double max_distance, const double max_distance,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const Approach approach, const Approach approach) const
const bool use_all_edges) const
{ {
bool has_small_component = false; bool has_small_component = false;
bool has_big_component = false; bool has_big_component = false;
@@ -381,13 +368,12 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
bearing, bearing,
bearing_range, bearing_range,
&has_big_component, &has_big_component,
&has_small_component, &has_small_component](const CandidateSegment &segment) {
&use_all_edges](const CandidateSegment &segment) {
auto use_segment = auto use_segment =
(!has_small_component || (!has_big_component && !IsTinyComponent(segment))); (!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
auto use_directions = std::make_pair(use_segment, use_segment); auto use_directions = std::make_pair(use_segment, use_segment);
const auto admissible_segments = CheckSegmentExclude(segment); const auto admissible_segments = CheckSegmentExclude(segment);
use_directions = boolPairAnd(use_directions, HasValidEdge(segment, use_all_edges)); use_directions = boolPairAnd(use_directions, HasValidEdge(segment));
if (use_segment) if (use_segment)
{ {
+5 -11
View File
@@ -262,8 +262,7 @@ class BasePlugin
} }
std::vector<PhantomNodePair> GetPhantomNodes(const datafacade::BaseDataFacade &facade, std::vector<PhantomNodePair> GetPhantomNodes(const datafacade::BaseDataFacade &facade,
const api::BaseParameters &parameters, const api::BaseParameters &parameters) const
const bool use_all_edges = false) const
{ {
std::vector<PhantomNodePair> phantom_node_pairs(parameters.coordinates.size()); std::vector<PhantomNodePair> phantom_node_pairs(parameters.coordinates.size());
@@ -297,8 +296,7 @@ class BasePlugin
*parameters.radiuses[i], *parameters.radiuses[i],
parameters.bearings[i]->bearing, parameters.bearings[i]->bearing,
parameters.bearings[i]->range, parameters.bearings[i]->range,
approach, approach);
use_all_edges);
} }
else else
{ {
@@ -307,8 +305,7 @@ class BasePlugin
parameters.coordinates[i], parameters.coordinates[i],
parameters.bearings[i]->bearing, parameters.bearings[i]->bearing,
parameters.bearings[i]->range, parameters.bearings[i]->range,
approach, approach);
use_all_edges);
} }
} }
else else
@@ -317,16 +314,13 @@ class BasePlugin
{ {
phantom_node_pairs[i] = phantom_node_pairs[i] =
facade.NearestPhantomNodeWithAlternativeFromBigComponent( facade.NearestPhantomNodeWithAlternativeFromBigComponent(
parameters.coordinates[i], parameters.coordinates[i], *parameters.radiuses[i], approach);
*parameters.radiuses[i],
approach,
use_all_edges);
} }
else else
{ {
phantom_node_pairs[i] = phantom_node_pairs[i] =
facade.NearestPhantomNodeWithAlternativeFromBigComponent( facade.NearestPhantomNodeWithAlternativeFromBigComponent(
parameters.coordinates[i], approach, use_all_edges); parameters.coordinates[i], approach);
} }
} }
-29
View File
@@ -1010,35 +1010,6 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
} }
} }
if (obj->Has(Nan::New("snapping").ToLocalChecked()))
{
v8::Local<v8::Value> snapping = obj->Get(Nan::New("snapping").ToLocalChecked());
if (snapping.IsEmpty())
return route_parameters_ptr();
if (!snapping->IsString())
{
Nan::ThrowError("Snapping must be a string: [default, any]");
return route_parameters_ptr();
}
const Nan::Utf8String snapping_utf8str(snapping);
std::string snapping_str{*snapping_utf8str, *snapping_utf8str + snapping_utf8str.length()};
if (snapping_str == "default")
{
params->snapping = osrm::RouteParameters::SnappingType::Default;
}
else if (snapping_str == "any")
{
params->snapping = osrm::RouteParameters::SnappingType::Any;
}
else
{
Nan::ThrowError("'snapping' param must be one of [default, any]");
return route_parameters_ptr();
}
}
bool parsedSuccessfully = parseCommonParameters(obj, params); bool parsedSuccessfully = parseCommonParameters(obj, params);
if (!parsedSuccessfully) if (!parsedSuccessfully)
{ {
@@ -82,9 +82,6 @@ struct RouteParametersGrammar : public BaseParametersGrammar<Iterator, Signature
qi::lit("waypoints=") > qi::lit("waypoints=") >
(size_t_ % ';')[ph::bind(&engine::api::RouteParameters::waypoints, qi::_r1) = qi::_1]; (size_t_ % ';')[ph::bind(&engine::api::RouteParameters::waypoints, qi::_r1) = qi::_1];
snapping_type.add("default", engine::api::RouteParameters::SnappingType::Default)(
"any", engine::api::RouteParameters::SnappingType::Any);
base_rule = base_rule =
BaseGrammar::base_rule(qi::_r1) | waypoints_rule(qi::_r1) | BaseGrammar::base_rule(qi::_r1) | waypoints_rule(qi::_r1) |
(qi::lit("steps=") > (qi::lit("steps=") >
@@ -94,8 +91,6 @@ struct RouteParametersGrammar : public BaseParametersGrammar<Iterator, Signature
qi::_1]) | qi::_1]) |
(qi::lit("overview=") > (qi::lit("overview=") >
overview_type[ph::bind(&engine::api::RouteParameters::overview, qi::_r1) = qi::_1]) | overview_type[ph::bind(&engine::api::RouteParameters::overview, qi::_r1) = qi::_1]) |
(qi::lit("snapping=") >
snapping_type[ph::bind(&engine::api::RouteParameters::snapping, qi::_r1) = qi::_1]) |
(qi::lit("annotations=") > (qi::lit("annotations=") >
(qi::lit("true")[ph::bind(add_annotation, qi::_r1, AnnotationsType::All)] | (qi::lit("true")[ph::bind(add_annotation, qi::_r1, AnnotationsType::All)] |
qi::lit("false")[ph::bind(add_annotation, qi::_r1, AnnotationsType::None)] | qi::lit("false")[ph::bind(add_annotation, qi::_r1, AnnotationsType::None)] |
@@ -117,7 +112,6 @@ struct RouteParametersGrammar : public BaseParametersGrammar<Iterator, Signature
qi::symbols<char, engine::api::RouteParameters::GeometriesType> geometries_type; qi::symbols<char, engine::api::RouteParameters::GeometriesType> geometries_type;
qi::symbols<char, engine::api::RouteParameters::OverviewType> overview_type; qi::symbols<char, engine::api::RouteParameters::OverviewType> overview_type;
qi::symbols<char, engine::api::RouteParameters::AnnotationsType> annotations_type; qi::symbols<char, engine::api::RouteParameters::AnnotationsType> annotations_type;
qi::symbols<char, engine::api::RouteParameters::SnappingType> snapping_type;
}; };
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "osrm", "name": "osrm",
"version": "5.22.0+customsnapping.4", "version": "5.22.0",
"private": false, "private": false,
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.", "description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
"dependencies": { "dependencies": {
+1 -4
View File
@@ -87,10 +87,7 @@ Status ViaRoutePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithm
return Status::Error; return Status::Error;
const auto &facade = algorithms.GetFacade(); const auto &facade = algorithms.GetFacade();
auto phantom_node_pairs = auto phantom_node_pairs = GetPhantomNodes(facade, route_parameters);
GetPhantomNodes(facade,
route_parameters,
(route_parameters.snapping == api::RouteParameters::SnappingType::Any));
if (phantom_node_pairs.size() != route_parameters.coordinates.size()) if (phantom_node_pairs.size() != route_parameters.coordinates.size())
{ {
return Error("NoSegment", return Error("NoSegment",
-21
View File
@@ -689,25 +689,4 @@ test('route: throws on invalid waypoints values, waypoints must be an array of i
}; };
assert.throws(function () { osrm.route(options, function (err, response) { console.error(`response: ${response}`); console.error(`error: ${err}`); }); }, assert.throws(function () { osrm.route(options, function (err, response) { console.error(`response: ${response}`); console.error(`error: ${err}`); }); },
/Waypoints must be supplied in increasing order/); /Waypoints must be supplied in increasing order/);
});
test('route: throws on invalid snapping values', function (assert) {
assert.plan(1);
var osrm = new OSRM(monaco_path);
var options = {
steps: true,
coordinates: three_test_coordinates.concat(three_test_coordinates),
snapping: "zing"
};
assert.throws(function () { osrm.route(options, function (err, response) { console.error(`response: ${response}`); console.error(`error: ${err}`); }); },
/'snapping' param must be one of \[default, any\]/);
});
test('route: snapping parameter passed through OK', function(assert) {
assert.plan(2);
var osrm = new OSRM(monaco_path);
osrm.route({snapping: "any", coordinates: [[7.448205209414596,43.754001097311544],[7.447122039202185,43.75306156811368]]}, function(err, route) {
assert.ifError(err);
assert.equal(Math.round(route.routes[0].distance * 10), 1314); // Round it to nearest 0.1m to eliminate floating point comparison error
});
}); });
+4 -8
View File
@@ -284,8 +284,7 @@ class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm>
std::pair<PhantomNode, PhantomNode> std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate /*input_coordinate*/, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate /*input_coordinate*/,
const Approach /*approach*/, const Approach /*approach*/) const override
const bool /* use_all_edges */) const override
{ {
return {}; return {};
} }
@@ -293,8 +292,7 @@ class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm>
std::pair<PhantomNode, PhantomNode> std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate /*input_coordinate*/, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate /*input_coordinate*/,
const double /*max_distance*/, const double /*max_distance*/,
const Approach /*approach*/, const Approach /*approach*/) const override
const bool /* use_all_edges */) const override
{ {
return {}; return {};
} }
@@ -304,8 +302,7 @@ class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm>
const double /*max_distance*/, const double /*max_distance*/,
const int /*bearing*/, const int /*bearing*/,
const int /*bearing_range*/, const int /*bearing_range*/,
const Approach /*approach*/, const Approach /*approach*/) const override
const bool /* use_all_edges */) const override
{ {
return {}; return {};
} }
@@ -314,8 +311,7 @@ class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate /*input_coordinate*/, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate /*input_coordinate*/,
const int /*bearing*/, const int /*bearing*/,
const int /*bearing_range*/, const int /*bearing_range*/,
const Approach /*approach*/, const Approach /*approach*/) const override
const bool /* use_all_edges */) const override
{ {
return {}; return {};
} }
+4 -8
View File
@@ -169,8 +169,7 @@ class MockBaseDataFacade : public engine::datafacade::BaseDataFacade
std::pair<engine::PhantomNode, engine::PhantomNode> std::pair<engine::PhantomNode, engine::PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent( NearestPhantomNodeWithAlternativeFromBigComponent(
const util::Coordinate /*input_coordinate*/, const util::Coordinate /*input_coordinate*/,
const engine::Approach /*approach*/, const engine::Approach /*approach*/) const override
const bool /* use_all_edges */) const override
{ {
return {}; return {};
} }
@@ -179,8 +178,7 @@ class MockBaseDataFacade : public engine::datafacade::BaseDataFacade
NearestPhantomNodeWithAlternativeFromBigComponent( NearestPhantomNodeWithAlternativeFromBigComponent(
const util::Coordinate /*input_coordinate*/, const util::Coordinate /*input_coordinate*/,
const double /*max_distance*/, const double /*max_distance*/,
const engine::Approach /*approach*/, const engine::Approach /*approach*/) const override
const bool /* use_all_edges */) const override
{ {
return {}; return {};
} }
@@ -191,8 +189,7 @@ class MockBaseDataFacade : public engine::datafacade::BaseDataFacade
const double /*max_distance*/, const double /*max_distance*/,
const int /*bearing*/, const int /*bearing*/,
const int /*bearing_range*/, const int /*bearing_range*/,
const engine::Approach /*approach*/, const engine::Approach /*approach*/) const override
const bool /* use_all_edges */) const override
{ {
return {}; return {};
} }
@@ -202,8 +199,7 @@ class MockBaseDataFacade : public engine::datafacade::BaseDataFacade
const util::Coordinate /*input_coordinate*/, const util::Coordinate /*input_coordinate*/,
const int /*bearing*/, const int /*bearing*/,
const int /*bearing_range*/, const int /*bearing_range*/,
const engine::Approach /*approach*/, const engine::Approach /*approach*/) const override
const bool /* use_all_edges */) const override
{ {
return {}; return {};
} }