Compare commits

...

11 Commits

Author SHA1 Message Date
Daniel J. Hofmann 4db1b7bea5 Implements Cucumber shared vs. static library detection, fixes #2999 2016-10-04 14:15:37 +02:00
Daniel J. Hofmann 32c5f14ed3 Makes the OSRM interface threadsafe.
Technically speaking we're changing the `libosrm` API.

But since we're only lifting restrictions by marking the API threadsafe,
we should be fine here.
2016-10-04 09:38:51 +02:00
Daniel J. Hofmann cbd88c63b9 Re-introduces the old RouteParameters ctor for API compatibility, see #2978 2016-10-03 20:02:11 +02:00
Daniel J. Hofmann 621e302a38 Disables ld.gold on binutils < 2.26, resolves #2984 2016-10-03 15:47:29 +02:00
Moritz Kobitzsch 1db794b2cb prepare 5.4.0-rc.7 2016-09-30 14:48:32 +02:00
Moritz Kobitzsch a1ccedb5bf re-introduce space into summaries 2016-09-30 14:46:34 +02:00
Moritz Kobitzsch 189f8c3265 move summaries to car profile, test for references, use boost adaptors 2016-09-30 11:07:46 +02:00
karenzshea 12238ebb52 handle empty names in summaries 2016-09-30 11:06:39 +02:00
Moritz Kobitzsch b033ac9f0b initialize 5.4.0-rc.6 changelog 2016-09-29 17:44:28 +02:00
Moritz Kobitzsch a411589092 fix polyline decoding 2016-09-29 17:42:29 +02:00
Johan Uhle 45673581ea Changelog: Fix typo for 5.4.0-rc.5 2016-09-26 14:47:21 +02:00
14 changed files with 206 additions and 52 deletions
+16 -1
View File
@@ -1,9 +1,20 @@
# 5.4.0-rc.7
- Chages from 5.4.0-rc.6
- Bugfixes re-introduce space between two entries in summaries
# 5.4.0-rc.6
- Changes from 5.4.0-rc.5
- Bugfixes
- fixed a bug where polyline decoding on a defective polyline could end up in out-of-bound access on a vector
- Guidance
- Summaries have been improved to consider references as well
# 5.4.0-rc.5
- Changes from 5.4.0-rc.4
- Guidance
- Improved detection of obvious name changes
- Profiles
- The defautl profile for car now excludes HOV only routes in navigation by default
- The default profile for car now excludes HOV-only routes in navigation by default
- Bugfixes
- Fixed a bug that could result in endless loops in combination with sliproads
@@ -17,6 +28,10 @@
- Bugfixes
- BREAKING: Fixed a bug where some roads could be falsly identified as sliproadsi This change requires reprocessing datasets with osrm-extract and osrm-contract
- BREAKING: Fixed a bug that resulted in false names/ref/destination/pronunciation This change requires reprocessing datasets with osrm-extract and osrm-contract
- `restrictions` is now used for namespaced restrictions and restriction exceptions (e.g. `restriction:motorcar=` as well as `except=motorcar`)
- replaced lhs/rhs profiles by using test defined profiles
- Trip Plugin
- changed internal behaviour to prefer the smallest lexicographic result over the largest one
# 5.4.0
- Changes from 5.3.0
+2 -2
View File
@@ -127,8 +127,8 @@ if(ENABLE_GOLD_LINKER)
# Issue 2785: check gold binutils version and don't use gc-sections for versions prior 2.25
string(REGEX REPLACE ".*\\(GNU Binutils[^\\)0-9]+([0-9]+\\.[0-9]+)[^\\)]*\\).*" "\\1" GOLD_BINUTILS_VERSION "${LD_VERSION}")
if ("${GOLD_BINUTILS_VERSION}" VERSION_LESS "2.25")
message(STATUS "Disabling gc-sections on gold binutils < 2.25, see: https://sourceware.org/bugzilla/show_bug.cgi?id=17639")
if ("${GOLD_BINUTILS_VERSION}" VERSION_LESS "2.26")
message(STATUS "Disabling gc-sections on gold binutils < 2.26, see: https://sourceware.org/bugzilla/show_bug.cgi?id=17639")
set(LD_AVOID_GC_SECTIONS TRUE)
endif()
else()
+1 -1
View File
@@ -34,7 +34,7 @@ int main(int argc, const char *argv[])
config.use_shared_memory = false;
// Routing machine with several services (such as Route, Table, Nearest, Trip, Match)
OSRM osrm{config};
const OSRM osrm{config};
// The following shows how to use the Route service; configure this service
RouteParameters params;
+94
View File
@@ -0,0 +1,94 @@
@routing @basic @car
Feature: Basic Routing
Background:
Given the profile "car"
Given a grid size of 500 meters
@smallest
Scenario: Summaries when routing on a simple network
Given the node map
| b | | | f |
| | | | |
| c | d | | g |
| | | | |
| a | | e | |
And the ways
| nodes | name |
| acb | road |
| de | 1 st |
| cd | |
| dg | blvd |
| df | street |
When I route I should get
| waypoints | route | summary |
| a,e | road,,1 st,1 st | road, 1 st |
| a,d,f | road,,,street,street | road;street |
| a,e,f | road,,1 st,1 st,1 st,street,street | road, 1 st;1 st, street |
Scenario: Name Empty
Given the node map
| a | | b | | | c |
And the ways
| nodes | name |
| ab | road |
| bc | |
When I route I should get
| waypoints | route | summary |
| a,c | road, | road |
Scenario: Name Empty But Ref
Given the node map
| a | | b | | | c |
And the ways
| nodes | name | ref |
| ab | road | |
| bc | | 101 |
When I route I should get
| waypoints | route | summary |
| a,c | road, | road, 101 |
Scenario: Only Refs
Given the node map
| a | | b | | | c |
And the ways
| nodes | name | ref |
| ab | | 100 |
| bc | | 101 |
When I route I should get
| waypoints | route | summary |
| a,c | , | 100, 101 |
Scenario: Single Ref
Given the node map
| a | | b | | | c |
And the ways
| nodes | name | ref |
| ab | | |
| bc | | 101 |
When I route I should get
| waypoints | route | summary |
| a,c | ,, | 101 |
Scenario: Nothing
Given the node map
| a | | b | | | c |
And the ways
| nodes | name |
| ab | |
| bc | |
When I route I should get
| waypoints | route | summary |
| a,c | , | |
+21 -3
View File
@@ -51,8 +51,26 @@ module.exports = function () {
} else {
this.TERMSIGNAL = 'SIGTERM';
this.EXE = '';
// TODO autodetect if this was build with shared or static libraries
this.LIB = process.env.BUILD_SHARED_LIBS && '.so' || '.a';
// heuristically detect .so/.a suffix
this.LIB = null;
try {
const dot_a = util.format('%s/libosrm%s', this.BIN_PATH, '.a');
fs.accessSync(dot_a, fs.F_OK);
this.LIB = '.a';
} catch(e) { /*nop*/ }
try {
const dot_so = util.format('%s/libosrm%s', this.BIN_PATH, '.so');
fs.accessSync(dot_so, fs.F_OK);
this.LIB = '.so';
} catch(e) { /*nop*/ }
if (!this.LIB) {
throw new Error('*** Unable to detect dynamic or static libosrm libraries');
}
this.QQ = '';
}
@@ -65,7 +83,7 @@ module.exports = function () {
// eslint-disable-next-line no-console
console.info(util.format('Node Version', process.version));
if (parseInt(process.version.match(/v(\d)/)[1]) < 4) throw new Error('*** PLease upgrade to Node 4.+ to run OSRM cucumber tests');
if (parseInt(process.version.match(/v(\d)/)[1]) < 4) throw new Error('*** Please upgrade to Node 4.+ to run OSRM cucumber tests');
fs.exists(this.TEST_PATH, (exists) => {
if (exists)
+1 -1
View File
@@ -132,7 +132,7 @@ module.exports = function () {
this.summary = (instructions) => {
if (instructions) {
return instructions.legs.map(l => l.summary).join(',');
return instructions.legs.map(l => l.summary).join(';');
}
};
+3 -3
View File
@@ -53,9 +53,9 @@ Feature: Basic Routing
| ab |
When I route I should get
| from | to | route | summary |
| a | b | ab,ab | ab |
| b | a | ab,ab | ab |
| from | to | route | summary |
| a | b | ab,ab | ab |
| b | a | ab,ab | ab |
@repeated
Scenario: Check handling empty values
+15
View File
@@ -69,6 +69,21 @@ struct RouteParameters : public BaseParameters
RouteParameters() = default;
template <typename... Args>
RouteParameters(const bool steps_,
const bool alternatives_,
const GeometriesType geometries_,
const OverviewType overview_,
const boost::optional<bool> continue_straight_,
Args... args_)
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
annotations{false}, geometries{geometries_}, overview{overview_},
continue_straight{continue_straight_}
// Once we perfectly-forward `args` (see #2990) this constructor can delegate to the one below.
{
}
// RouteParameters constructor adding the `annotations` setting in a API-compatible way.
template <typename... Args>
RouteParameters(const bool steps_,
const bool alternatives_,
+7 -7
View File
@@ -55,7 +55,7 @@ class Engine final
// Needs to be public
struct EngineLock;
explicit Engine(EngineConfig &config);
explicit Engine(const EngineConfig &config);
Engine(Engine &&) noexcept;
Engine &operator=(Engine &&) noexcept;
@@ -63,12 +63,12 @@ class Engine final
// Impl. in cpp since for unique_ptr of incomplete types
~Engine();
Status Route(const api::RouteParameters &parameters, util::json::Object &result);
Status Table(const api::TableParameters &parameters, util::json::Object &result);
Status Nearest(const api::NearestParameters &parameters, util::json::Object &result);
Status Trip(const api::TripParameters &parameters, util::json::Object &result);
Status Match(const api::MatchParameters &parameters, util::json::Object &result);
Status Tile(const api::TileParameters &parameters, std::string &result);
Status Route(const api::RouteParameters &parameters, util::json::Object &result) const;
Status Table(const api::TableParameters &parameters, util::json::Object &result) const;
Status Nearest(const api::NearestParameters &parameters, util::json::Object &result) const;
Status Trip(const api::TripParameters &parameters, util::json::Object &result) const;
Status Match(const api::MatchParameters &parameters, util::json::Object &result) const;
Status Tile(const api::TileParameters &parameters, std::string &result) const;
private:
std::unique_ptr<EngineLock> lock;
+25 -13
View File
@@ -6,6 +6,11 @@
#include "engine/guidance/route_leg.hpp"
#include "engine/guidance/route_step.hpp"
#include "engine/internal_route_result.hpp"
#include "util/typedefs.hpp"
#include <boost/algorithm/string/join.hpp>
#include <boost/range/adaptor/filtered.hpp>
#include <boost/range/adaptor/transformed.hpp>
#include <cstddef>
#include <cstdint>
@@ -107,7 +112,7 @@ std::array<std::uint32_t, SegmentNumber> summarizeRoute(const std::vector<PathDa
});
std::array<std::uint32_t, SegmentNumber> summary;
std::fill(summary.begin(), summary.end(), 0);
std::fill(summary.begin(), summary.end(), EMPTY_NAMEID);
std::transform(segments.begin(),
segments.end(),
summary.begin(),
@@ -172,21 +177,28 @@ inline RouteLeg assembleLeg(const datafacade::BaseDataFacade &facade,
{
auto summary_array = detail::summarizeRoute<detail::MAX_USED_SEGMENTS>(
route_data, target_node, target_traversed_in_reverse);
if (route_data.empty())
summary_array[0] = source_node.name_id;
BOOST_ASSERT(detail::MAX_USED_SEGMENTS > 0);
BOOST_ASSERT(summary_array.begin() != summary_array.end());
summary = std::accumulate(std::next(summary_array.begin()),
summary_array.end(),
facade.GetNameForID(summary_array.front()),
[&facade](std::string previous, const std::uint32_t name_id) {
if (name_id != 0)
{
previous += ", " + facade.GetNameForID(name_id);
}
return previous;
});
// transform a name_id into a string containing either the name, or -if the name is empty-
// the reference.
const auto name_id_to_string = [&](const NameID name_id) {
const auto name = facade.GetNameForID(name_id);
if (!name.empty())
return name;
else
{
const auto ref = facade.GetRefForID(name_id);
return ref;
}
};
const auto not_empty = [&](const std::string &name) { return !name.empty(); };
const auto summary_names = summary_array | boost::adaptors::transformed(name_id_to_string) |
boost::adaptors::filtered(not_empty);
summary = boost::algorithm::join(summary_names, ", ");
}
return RouteLeg{duration, distance, summary, {}};
+6 -6
View File
@@ -83,7 +83,7 @@ class OSRM final
* \return Status indicating success for the query or failure
* \see Status, RouteParameters and json::Object
*/
Status Route(const RouteParameters &parameters, json::Object &result);
Status Route(const RouteParameters &parameters, json::Object &result) const;
/**
* Distance tables for coordinates.
@@ -92,7 +92,7 @@ class OSRM final
* \return Status indicating success for the query or failure
* \see Status, TableParameters and json::Object
*/
Status Table(const TableParameters &parameters, json::Object &result);
Status Table(const TableParameters &parameters, json::Object &result) const;
/**
* Nearest street segment for coordinate.
@@ -101,7 +101,7 @@ class OSRM final
* \return Status indicating success for the query or failure
* \see Status, NearestParameters and json::Object
*/
Status Nearest(const NearestParameters &parameters, json::Object &result);
Status Nearest(const NearestParameters &parameters, json::Object &result) const;
/**
* Trip: shortest round trip between coordinates.
@@ -110,7 +110,7 @@ class OSRM final
* \return Status indicating success for the query or failure
* \see Status, TripParameters and json::Object
*/
Status Trip(const TripParameters &parameters, json::Object &result);
Status Trip(const TripParameters &parameters, json::Object &result) const;
/**
* Match: snaps noisy coordinate traces to the road network
@@ -119,7 +119,7 @@ class OSRM final
* \return Status indicating success for the query or failure
* \see Status, MatchParameters and json::Object
*/
Status Match(const MatchParameters &parameters, json::Object &result);
Status Match(const MatchParameters &parameters, json::Object &result) const;
/**
* Tile: vector tiles with internal graph representation
@@ -128,7 +128,7 @@ class OSRM final
* \return Status indicating success for the query or failure
* \see Status, TileParameters and json::Object
*/
Status Tile(const TileParameters &parameters, std::string &result);
Status Tile(const TileParameters &parameters, std::string &result) const;
private:
std::unique_ptr<engine::Engine> engine_;
+7 -7
View File
@@ -124,7 +124,7 @@ namespace osrm
namespace engine
{
Engine::Engine(EngineConfig &config)
Engine::Engine(const EngineConfig &config)
{
if (config.use_shared_memory)
{
@@ -157,32 +157,32 @@ Engine::~Engine() = default;
Engine::Engine(Engine &&) noexcept = default;
Engine &Engine::operator=(Engine &&) noexcept = default;
Status Engine::Route(const api::RouteParameters &params, util::json::Object &result)
Status Engine::Route(const api::RouteParameters &params, util::json::Object &result) const
{
return RunQuery(lock, *query_data_facade, params, *route_plugin, result);
}
Status Engine::Table(const api::TableParameters &params, util::json::Object &result)
Status Engine::Table(const api::TableParameters &params, util::json::Object &result) const
{
return RunQuery(lock, *query_data_facade, params, *table_plugin, result);
}
Status Engine::Nearest(const api::NearestParameters &params, util::json::Object &result)
Status Engine::Nearest(const api::NearestParameters &params, util::json::Object &result) const
{
return RunQuery(lock, *query_data_facade, params, *nearest_plugin, result);
}
Status Engine::Trip(const api::TripParameters &params, util::json::Object &result)
Status Engine::Trip(const api::TripParameters &params, util::json::Object &result) const
{
return RunQuery(lock, *query_data_facade, params, *trip_plugin, result);
}
Status Engine::Match(const api::MatchParameters &params, util::json::Object &result)
Status Engine::Match(const api::MatchParameters &params, util::json::Object &result) const
{
return RunQuery(lock, *query_data_facade, params, *match_plugin, result);
}
Status Engine::Tile(const api::TileParameters &params, std::string &result)
Status Engine::Tile(const api::TileParameters &params, std::string &result) const
{
return RunQuery(lock, *query_data_facade, params, *tile_plugin, result);
}
+2 -2
View File
@@ -100,7 +100,7 @@ std::vector<util::Coordinate> decodePolyline(const std::string &geometry_string)
b = geometry_string.at(index++) - 63;
result |= (b & 0x1f) << shift;
shift += 5;
} while (b >= 0x20);
} while (b >= 0x20 && index < len);
int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
lat += dlat;
@@ -111,7 +111,7 @@ std::vector<util::Coordinate> decodePolyline(const std::string &geometry_string)
b = geometry_string.at(index++) - 63;
result |= (b & 0x1f) << shift;
shift += 5;
} while (b >= 0x20);
} while (b >= 0x20 && index < len);
int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
lng += dlng;
+6 -6
View File
@@ -21,32 +21,32 @@ OSRM &OSRM::operator=(OSRM &&) noexcept = default;
// Forward to implementation
engine::Status OSRM::Route(const engine::api::RouteParameters &params, util::json::Object &result)
engine::Status OSRM::Route(const engine::api::RouteParameters &params, util::json::Object &result) const
{
return engine_->Route(params, result);
}
engine::Status OSRM::Table(const engine::api::TableParameters &params, json::Object &result)
engine::Status OSRM::Table(const engine::api::TableParameters &params, json::Object &result) const
{
return engine_->Table(params, result);
}
engine::Status OSRM::Nearest(const engine::api::NearestParameters &params, json::Object &result)
engine::Status OSRM::Nearest(const engine::api::NearestParameters &params, json::Object &result) const
{
return engine_->Nearest(params, result);
}
engine::Status OSRM::Trip(const engine::api::TripParameters &params, json::Object &result)
engine::Status OSRM::Trip(const engine::api::TripParameters &params, json::Object &result) const
{
return engine_->Trip(params, result);
}
engine::Status OSRM::Match(const engine::api::MatchParameters &params, json::Object &result)
engine::Status OSRM::Match(const engine::api::MatchParameters &params, json::Object &result) const
{
return engine_->Match(params, result);
}
engine::Status OSRM::Tile(const engine::api::TileParameters &params, std::string &result)
engine::Status OSRM::Tile(const engine::api::TileParameters &params, std::string &result) const
{
return engine_->Tile(params, result);
}