Compare commits

...

41 Commits

Author SHA1 Message Date
Daniel Patterson
49c4df0617
Bumps version to 5.9.2 2017-07-25 15:06:04 -07:00
Daniel Patterson
db869786a4
Update CHANGELOG. 2017-07-25 14:17:53 -07:00
Daniel Patterson
a3a46c20c4
Don't include turn costs when calculation weight/duration/speed annotations. 2017-07-25 14:16:48 -07:00
Daniel J. Hofmann
9500facd9c Bumps version to 5.9.1 2017-07-24 14:30:34 +02:00
Daniel J. Hofmann
615e015700 Merges Changelog entries into 5.9.1 section 2017-07-24 13:09:32 +02:00
Michael Krasnyk
02922ecf5e Don't use STXXL library by default 2017-07-24 13:08:41 +02:00
Daniel J. Hofmann
bae1b9c5e2 Documents system-wide limit constructor parameters in node bindings, resolves #4317 2017-07-24 13:04:20 +02:00
Emil Tin
4c35352707 fix profile debugging related to way classes 2017-07-24 13:02:10 +02:00
Daniel J. Hofmann
c362a3d46d Fixes line endings, related to #4235 2017-07-24 12:48:33 +02:00
Daniel J. Hofmann
293a7177d0 Updates changelog 2017-07-24 12:37:30 +02:00
Daniel J. Hofmann
8af54ffe83 Handles distinction of no-route vs invalid-route in mld alternatives
The viaroute plugin always expects a route to be there potentially
with invalid edge weight to represent no-route-found. By switching
to the many-route-result for the mld alternatives algorithm we might
return an empty many-route-result invalidating the post-condition.
2017-07-24 12:27:06 +02:00
Daniel J. Hofmann
253c2dc570 Trigger lane anticipation based on distance, see discussion in #4260 2017-07-22 17:30:48 +02:00
Moritz Kobitzsch
0c6bb534fd changelog, consistent deprecated documentation
Conflicts:
	CHANGELOG.md
2017-07-22 17:30:33 +02:00
Moritz Kobitzsch
2d02fad09b remove usage of use-lane completely 2017-07-22 17:28:44 +02:00
Moritz Kobitzsch
361e6b998f deprecate use-lane -- the information can be found in the intersections array 2017-07-22 17:28:36 +02:00
Patrick Niklaus
210fa9d545 Update changelog and version 2017-07-19 16:34:49 +00:00
Daniel J. Hofmann
7eafb48d20 Introduces a construction whitelist in profiles 2017-07-19 16:32:42 +00:00
Daniel J. Hofmann
df0f407591 Makes construction=minor ways routable again, see #4258 2017-07-19 16:27:31 +00:00
Patrick Niklaus
f9a8bcc75c Bump version to v5.9.0-rc.3 2017-07-18 16:50:51 +00:00
Patrick Niklaus
f815daf026 Update the changelog 2017-07-18 16:50:24 +00:00
Patrick Niklaus
f393f47d43 Move classes to intersection object and don't emit notifications 2017-07-18 16:48:59 +00:00
Daniel J. Hofmann
1e258ed3fa Changelog entry for openmp 2017-07-17 19:24:27 +02:00
Daniel J. Hofmann
de084f201c Only enables -fopenmp in case the user wants stxxl 2017-07-17 19:20:35 +02:00
Patrick Niklaus
e34a74d4ac Add changelog entry 2017-07-13 21:50:01 +00:00
Daniel J. Hofmann
bd1391f6f7 Exposes EngineConfig system-wide limits in Node.js bindings, resolves #4226 2017-07-13 21:49:27 +00:00
Patrick Niklaus
f54631619a Add bug fix to changelog 2017-07-13 09:01:08 +00:00
Moritz Kobitzsch
070fa1a24c only consider allowed entries when continuing on motorways 2017-07-13 09:00:00 +00:00
Moritz Kobitzsch
f15285e9ee add test indicating missdetection of continuing on motorways 2017-07-13 09:00:00 +00:00
Patrick Niklaus
bae21f0d5d Bump version to RC2 2017-07-12 22:13:56 +00:00
Daniel Patterson
305df1fb6e Include osrm-customize when doing 'make install' 2017-07-12 22:12:14 +00:00
Daniel J. Hofmann
9ab0fca31c Canonicalizes all OSM string list handling in the profiles 2017-07-12 22:09:28 +00:00
Michael Krasnyk
e2e398edc5 Remove STXXL from OSM parsing and enable in CMake by default 2017-07-11 08:24:29 +00:00
Michael Krasnyk
b87366132b Updated ChangeLog 2017-07-11 08:24:29 +00:00
Michael Krasnyk
f4ef4b022e Added STXXL configuration 2017-07-11 08:24:29 +00:00
Michael Krasnyk
81d479304e Don't use stxxl vector in contractor 2017-07-11 08:24:29 +00:00
Michael Krasnyk
92b53e5be0 Switch from stxxl::vector to std::vector in extractor 2017-07-11 08:24:29 +00:00
Michael Krasnyk
cc73e753bd Removed external_to_internal_node_id_map container 2017-07-11 08:24:28 +00:00
Daniel J. Hofmann
725dc396c7 Fixes Node.js bindings always enabling alternatives when using boolean overload 2017-07-10 10:45:56 +02:00
Daniel J. Hofmann
890f0d8d7e Discards construction and proposed ways, resolves #4230 2017-07-10 10:38:30 +02:00
Patrick Niklaus
c9017090a2 Bump verison to 5.9.0-rc.1 2017-07-07 17:07:52 +00:00
Patrick Niklaus
e7061591e3 Enable travis on 5.9 2017-07-07 17:06:47 +00:00
63 changed files with 1377 additions and 1145 deletions

View File

@ -19,6 +19,7 @@ branches:
- master - master
# enable building tags # enable building tags
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/ - /^v\d+\.\d+(\.\d+)?(-\S*)?$/
- "5.9"
cache: cache:
yarn: true yarn: true
@ -72,7 +73,7 @@ matrix:
addons: &gcc6 addons: &gcc6
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev'] packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' ENABLE_COVERAGE=ON CUCUMBER_TIMEOUT=20000 env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' ENABLE_COVERAGE=ON CUCUMBER_TIMEOUT=20000
after_success: after_success:
- bash <(curl -s https://codecov.io/bash) - bash <(curl -s https://codecov.io/bash)
@ -82,7 +83,7 @@ matrix:
addons: &gcc6 addons: &gcc6
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev'] packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_SANITIZER=ON CUCUMBER_TIMEOUT=20000 env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_SANITIZER=ON CUCUMBER_TIMEOUT=20000
- os: linux - os: linux
@ -90,7 +91,7 @@ matrix:
addons: &clang40 addons: &clang40
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev'] packages: ['libstdc++-5-dev', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000 env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000
- os: linux - os: linux
@ -115,7 +116,7 @@ matrix:
addons: &gcc6 addons: &gcc6
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev'] packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
- os: linux - os: linux
@ -124,12 +125,20 @@ matrix:
TARGET_ARCH='i686' CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' TARGET_ARCH='i686' CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse' CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse'
- os: linux
compiler: "gcc-6-stxxl"
addons: &gcc6
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' ENABLE_STXXL=On
- os: linux - os: linux
compiler: "gcc-4.9-release" compiler: "gcc-4.9-release"
addons: &gcc49 addons: &gcc49
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.9', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache'] packages: ['g++-4.9', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache']
env: CCOMPILER='gcc-4.9' CXXCOMPILER='g++-4.9' BUILD_TYPE='Release' env: CCOMPILER='gcc-4.9' CXXCOMPILER='g++-4.9' BUILD_TYPE='Release'
- os: osx - os: osx
@ -146,7 +155,7 @@ matrix:
#- addons: &clang40 #- addons: &clang40
#- apt: #- apt:
#- sources: ['llvm-toolchain-trusty-4.0', 'ubuntu-toolchain-r-test'] #- sources: ['llvm-toolchain-trusty-4.0', 'ubuntu-toolchain-r-test']
#- packages: ['clang-4.0', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev'] #- packages: ['clang-4.0', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
#- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release' #- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release'
# Shared Library # Shared Library
@ -155,7 +164,7 @@ matrix:
addons: &gcc6 addons: &gcc6
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev'] packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
# Disabled because CI slowness # Disabled because CI slowness
@ -164,7 +173,7 @@ matrix:
#- addons: &clang40 #- addons: &clang40
#- apt: #- apt:
#- sources: ['llvm-toolchain-trusty-4.0', 'ubuntu-toolchain-r-test'] #- sources: ['llvm-toolchain-trusty-4.0', 'ubuntu-toolchain-r-test']
#- packages: ['clang-4.0', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev'] #- packages: ['clang-4.0', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
#- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON #- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
# Node build jobs. These skip running the tests. # Node build jobs. These skip running the tests.
@ -323,6 +332,7 @@ install:
-DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \ -DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \ -DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
-DENABLE_STXXL=${ENABLE_STXXL:-OFF} \
-DBUILD_TOOLS=ON \ -DBUILD_TOOLS=ON \
-DENABLE_CCACHE=ON \ -DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}

View File

@ -1,3 +1,13 @@
# 5.9.2
- API:
- `annotations=durations,weights,speeds` values no longer include turn penalty values ([#4330](https://github.com/Project-OSRM/osrm-backend/issues/4330))
# 5.9.1
- Changes from 5.9.0:
- #4322: Deprecated `UseLane`. Use the intersections array if you require lanes between steps
- #4321: Fixes a potential crash in the MLD alternative code path when not even a shortest path can be found
- #4324: STXXL is not required by default
# 5.9.0 # 5.9.0
- Changes from 5.8: - Changes from 5.8:
- Algorithm: - Algorithm:
@ -7,15 +17,22 @@
- API: - API:
- Exposes `alternatives=Number` parameter overload in addition to the boolean flag. - Exposes `alternatives=Number` parameter overload in addition to the boolean flag.
- Support for exits numbers and names. New member `exits` in `RouteStep`, based on `junction:ref` on ways - Support for exits numbers and names. New member `exits` in `RouteStep`, based on `junction:ref` on ways
- `RouteStep` now has new parameter `classes` that can be set in the profile on each way. - `Intersection` now has new parameter `classes` that can be set in the profile on each way.
- Profiles: - Profiles:
- `result.exits` allows you to set a way's exit numbers and names, see [`junction:ref`](http://wiki.openstreetmap.org/wiki/Proposed_features/junction_details) - `result.exits` allows you to set a way's exit numbers and names, see [`junction:ref`](http://wiki.openstreetmap.org/wiki/Proposed_features/junction_details)
- `ExtractionWay` now as new property `forward_classes` and `backward_classes` that can set in the `way_function`. - `ExtractionWay` now as new property `forward_classes` and `backward_classes` that can set in the `way_function`.
The maximum number of classes is 8. The maximum number of classes is 8.
- We now respect the `construction` tag. If the `construction` tag value is not on our whitelist (`minor`, `widening`, `no`) we will exclude the road.
- Node.js Bindings: - Node.js Bindings:
- Exposes `alternatives=Number` parameter overload in addition to the boolean flag - Exposes `alternatives=Number` parameter overload in addition to the boolean flag
- Expose `EngineConfig` options in the node bindings
- Tools: - Tools:
- Exposes engine limit on number of alternatives to generate `--max-alternatives` in `osrm-routed` (3 by default) - Exposes engine limit on number of alternatives to generate `--max-alternatives` in `osrm-routed` (3 by default)
- Infrastructure
- STXXL is not required to build OSRM and is an optional dependency for back-compatibility (ENABLE_STXXL=On)
- OpenMP is only required when the optional STXXL dependency is used
- Bug fixes:
- #4278: Remove superflous continious instruction on a motorway.
# 5.8.0 # 5.8.0
- Changes from 5.7 - Changes from 5.7

View File

@ -21,6 +21,7 @@ option(BUILD_PACKAGE "Build OSRM package" OFF)
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF) option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF) option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF) option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
option(ENABLE_STXXL "Use STXXL library" OFF)
option(ENABLE_LTO "Use LTO if available" OFF) option(ENABLE_LTO "Use LTO if available" OFF)
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF) option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON) option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON)
@ -55,7 +56,7 @@ endif()
project(OSRM C CXX) project(OSRM C CXX)
set(OSRM_VERSION_MAJOR 5) set(OSRM_VERSION_MAJOR 5)
set(OSRM_VERSION_MINOR 9) set(OSRM_VERSION_MINOR 9)
set(OSRM_VERSION_PATCH 0) set(OSRM_VERSION_PATCH 2)
set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}") set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}")
add_definitions(-DOSRM_PROJECT_DIR="${CMAKE_CURRENT_SOURCE_DIR}") add_definitions(-DOSRM_PROJECT_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
@ -428,9 +429,12 @@ if(ENABLE_MASON)
mason_use(boost_libsystem VERSION ${MASON_BOOST_VERSION}) mason_use(boost_libsystem VERSION ${MASON_BOOST_VERSION})
set(Boost_SYSTEM_LIBRARY ${MASON_PACKAGE_boost_libsystem_STATIC_LIBS}) set(Boost_SYSTEM_LIBRARY ${MASON_PACKAGE_boost_libsystem_STATIC_LIBS})
mason_use(stxxl VERSION ${MASON_STXXL_VERSION}) if (ENABLE_STXXL)
add_dependency_includes(${MASON_PACKAGE_stxxl_INCLUDE_DIRS}) mason_use(stxxl VERSION ${MASON_STXXL_VERSION})
set(STXXL_LIBRARY ${MASON_PACKAGE_stxxl_STATIC_LIBS}) add_dependency_includes(${MASON_PACKAGE_stxxl_INCLUDE_DIRS})
set(MAYBE_STXXL_LIBRARY ${MASON_PACKAGE_stxxl_STATIC_LIBS})
add_definitions(-DUSE_STXXL_LIBRARY)
endif()
mason_use(expat VERSION ${MASON_EXPAT_VERSION}) mason_use(expat VERSION ${MASON_EXPAT_VERSION})
add_dependency_includes(${MASON_PACKAGE_expat_INCLUDE_DIRS}) add_dependency_includes(${MASON_PACKAGE_expat_INCLUDE_DIRS})
@ -493,8 +497,16 @@ else()
find_package(EXPAT REQUIRED) find_package(EXPAT REQUIRED)
add_dependency_includes(${EXPAT_INCLUDE_DIRS}) add_dependency_includes(${EXPAT_INCLUDE_DIRS})
find_package(STXXL REQUIRED) if (ENABLE_STXXL)
add_dependency_includes(${STXXL_INCLUDE_DIR}) find_package(STXXL)
if (STXXL_FOUND)
add_dependency_includes(${STXXL_INCLUDE_DIR})
set(MAYBE_STXXL_LIBRARY ${STXXL_LIBRARY})
add_definitions(-DUSE_STXXL_LIBRARY)
else()
MESSAGE(STATUS "STXXL was requested but not found, default STL will be used")
endif()
endif()
find_package(BZip2 REQUIRED) find_package(BZip2 REQUIRED)
add_dependency_includes(${BZIP2_INCLUDE_DIR}) add_dependency_includes(${BZIP2_INCLUDE_DIR})
@ -578,11 +590,13 @@ add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3)
add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE) add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE)
add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED) add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED)
set(OpenMP_FIND_QUIETLY ON) if (ENABLE_STXXL)
find_package(OpenMP) set(OpenMP_FIND_QUIETLY ON)
if(OPENMP_FOUND) find_package(OpenMP)
message(STATUS "OpenMP support found. Linking just in case for stxxl") if(OPENMP_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") message(STATUS "OpenMP support found. Linking just in case for stxxl")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
endif() endif()
add_definitions(${OSRM_DEFINES}) add_definitions(${OSRM_DEFINES})
@ -617,7 +631,7 @@ set(EXTRACTOR_LIBRARIES
${EXPAT_LIBRARIES} ${EXPAT_LIBRARIES}
${USED_LUA_LIBRARIES} ${USED_LUA_LIBRARIES}
${OSMIUM_LIBRARIES} ${OSMIUM_LIBRARIES}
${STXXL_LIBRARY} ${MAYBE_STXXL_LIBRARY}
${TBB_LIBRARIES} ${TBB_LIBRARIES}
${ZLIB_LIBRARY} ${ZLIB_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES}) ${MAYBE_COVERAGE_LIBRARIES})
@ -645,7 +659,7 @@ set(CONTRACTOR_LIBRARIES
${BOOST_BASE_LIBRARIES} ${BOOST_BASE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${USED_LUA_LIBRARIES} ${USED_LUA_LIBRARIES}
${STXXL_LIBRARY} ${MAYBE_STXXL_LIBRARY}
${TBB_LIBRARIES} ${TBB_LIBRARIES}
${MAYBE_RT_LIBRARY} ${MAYBE_RT_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES}) ${MAYBE_COVERAGE_LIBRARIES})
@ -665,7 +679,7 @@ set(STORAGE_LIBRARIES
set(UTIL_LIBRARIES set(UTIL_LIBRARIES
${BOOST_BASE_LIBRARIES} ${BOOST_BASE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${STXXL_LIBRARY} ${MAYBE_STXXL_LIBRARY}
${TBB_LIBRARIES} ${TBB_LIBRARIES}
${MAYBE_COVERAGE_LIBRARIES}) ${MAYBE_COVERAGE_LIBRARIES})
@ -734,12 +748,14 @@ install(FILES ${ParametersGlob} DESTINATION include/osrm/engine/api)
install(FILES ${VariantGlob} DESTINATION include/mapbox) install(FILES ${VariantGlob} DESTINATION include/mapbox)
install(TARGETS osrm-extract DESTINATION bin) install(TARGETS osrm-extract DESTINATION bin)
install(TARGETS osrm-partition DESTINATION bin) install(TARGETS osrm-partition DESTINATION bin)
install(TARGETS osrm-customize DESTINATION bin)
install(TARGETS osrm-contract DESTINATION bin) install(TARGETS osrm-contract DESTINATION bin)
install(TARGETS osrm-datastore DESTINATION bin) install(TARGETS osrm-datastore DESTINATION bin)
install(TARGETS osrm-routed DESTINATION bin) install(TARGETS osrm-routed DESTINATION bin)
install(TARGETS osrm DESTINATION lib) install(TARGETS osrm DESTINATION lib)
install(TARGETS osrm_extract DESTINATION lib) install(TARGETS osrm_extract DESTINATION lib)
install(TARGETS osrm_partition DESTINATION lib) install(TARGETS osrm_partition DESTINATION lib)
install(TARGETS osrm_customize DESTINATION lib)
install(TARGETS osrm_update DESTINATION lib) install(TARGETS osrm_update DESTINATION lib)
install(TARGETS osrm_contract DESTINATION lib) install(TARGETS osrm_contract DESTINATION lib)
install(TARGETS osrm_store DESTINATION lib) install(TARGETS osrm_store DESTINATION lib)

View File

@ -1,286 +1,286 @@
# Locate Intel Threading Building Blocks include paths and libraries # Locate Intel Threading Building Blocks include paths and libraries
# FindTBB.cmake can be found at https://code.google.com/p/findtbb/ # FindTBB.cmake can be found at https://code.google.com/p/findtbb/
# Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de> # Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de>
# Improvements by Gino van den Bergen <gino _at_ dtecta.com>, # Improvements by Gino van den Bergen <gino _at_ dtecta.com>,
# Florian Uhlig <F.Uhlig _at_ gsi.de>, # Florian Uhlig <F.Uhlig _at_ gsi.de>,
# Jiri Marsik <jiri.marsik89 _at_ gmail.com> # Jiri Marsik <jiri.marsik89 _at_ gmail.com>
# The MIT License # The MIT License
# #
# Copyright (c) 2011 Hannes Hofmann # Copyright (c) 2011 Hannes Hofmann
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights # in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is # copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions: # furnished to do so, subject to the following conditions:
# #
# The above copyright notice and this permission notice shall be included in # The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software. # all copies or substantial portions of the Software.
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
# GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler. # GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler.
# e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21" # e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21"
# TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found # TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found
# in the TBB installation directory (TBB_INSTALL_DIR). # in the TBB installation directory (TBB_INSTALL_DIR).
# #
# GvdB: Mac OS X distribution places libraries directly in lib directory. # GvdB: Mac OS X distribution places libraries directly in lib directory.
# #
# For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER. # For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER.
# TBB_ARCHITECTURE [ ia32 | em64t | itanium ] # TBB_ARCHITECTURE [ ia32 | em64t | itanium ]
# which architecture to use # which architecture to use
# TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9 # TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9
# which compiler to use (detected automatically on Windows) # which compiler to use (detected automatically on Windows)
# This module respects # This module respects
# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR} # TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR}
# This module defines # This module defines
# TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc. # TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc.
# TBB_LIBRARY_DIRS, where to find libtbb, libtbbmalloc # TBB_LIBRARY_DIRS, where to find libtbb, libtbbmalloc
# TBB_DEBUG_LIBRARY_DIRS, where to find libtbb_debug, libtbbmalloc_debug # TBB_DEBUG_LIBRARY_DIRS, where to find libtbb_debug, libtbbmalloc_debug
# TBB_INSTALL_DIR, the base TBB install directory # TBB_INSTALL_DIR, the base TBB install directory
# TBB_LIBRARIES, the libraries to link against to use TBB. # TBB_LIBRARIES, the libraries to link against to use TBB.
# TBB_DEBUG_LIBRARIES, the libraries to link against to use TBB with debug symbols. # TBB_DEBUG_LIBRARIES, the libraries to link against to use TBB with debug symbols.
# TBB_FOUND, If false, don't try to use TBB. # TBB_FOUND, If false, don't try to use TBB.
# TBB_INTERFACE_VERSION, as defined in tbb/tbb_stddef.h # TBB_INTERFACE_VERSION, as defined in tbb/tbb_stddef.h
if (WIN32) if (WIN32)
# has em64t/vc8 em64t/vc9 # has em64t/vc8 em64t/vc9
# has ia32/vc7.1 ia32/vc8 ia32/vc9 # has ia32/vc7.1 ia32/vc8 ia32/vc9
set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB") set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB")
set(_TBB_LIB_NAME "tbb") set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc") set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug") set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug") set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
if (MSVC71) if (MSVC71)
set (_TBB_COMPILER "vc7.1") set (_TBB_COMPILER "vc7.1")
endif(MSVC71) endif(MSVC71)
if (MSVC80) if (MSVC80)
set(_TBB_COMPILER "vc8") set(_TBB_COMPILER "vc8")
endif(MSVC80) endif(MSVC80)
if (MSVC90) if (MSVC90)
set(_TBB_COMPILER "vc9") set(_TBB_COMPILER "vc9")
endif(MSVC90) endif(MSVC90)
if(MSVC10) if(MSVC10)
set(_TBB_COMPILER "vc10") set(_TBB_COMPILER "vc10")
endif(MSVC10) endif(MSVC10)
# Todo: add other Windows compilers such as ICL. # Todo: add other Windows compilers such as ICL.
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE}) set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
endif (WIN32) endif (WIN32)
if (UNIX) if (UNIX)
if (APPLE) if (APPLE)
# MAC # MAC
set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions") set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions")
# libs: libtbb.dylib, libtbbmalloc.dylib, *_debug # libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
set(_TBB_LIB_NAME "tbb") set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc") set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug") set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug") set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
# default flavor on apple: ia32/cc4.0.1_os10.4.9 # default flavor on apple: ia32/cc4.0.1_os10.4.9
# Jiri: There is no reason to presume there is only one flavor and # Jiri: There is no reason to presume there is only one flavor and
# that user's setting of variables should be ignored. # that user's setting of variables should be ignored.
if(NOT TBB_COMPILER) if(NOT TBB_COMPILER)
set(_TBB_COMPILER "cc4.0.1_os10.4.9") set(_TBB_COMPILER "cc4.0.1_os10.4.9")
elseif (NOT TBB_COMPILER) elseif (NOT TBB_COMPILER)
set(_TBB_COMPILER ${TBB_COMPILER}) set(_TBB_COMPILER ${TBB_COMPILER})
endif(NOT TBB_COMPILER) endif(NOT TBB_COMPILER)
if(NOT TBB_ARCHITECTURE) if(NOT TBB_ARCHITECTURE)
set(_TBB_ARCHITECTURE "ia32") set(_TBB_ARCHITECTURE "ia32")
elseif(NOT TBB_ARCHITECTURE) elseif(NOT TBB_ARCHITECTURE)
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE}) set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
endif(NOT TBB_ARCHITECTURE) endif(NOT TBB_ARCHITECTURE)
else (APPLE) else (APPLE)
# LINUX # LINUX
set(_TBB_DEFAULT_INSTALL_DIR "/usr") set(_TBB_DEFAULT_INSTALL_DIR "/usr")
set(_TBB_LIB_NAME "tbb") set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc") set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug") set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug") set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
# has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21 # has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21
# has ia32/* # has ia32/*
# has itanium/* # has itanium/*
set(_TBB_COMPILER ${TBB_COMPILER}) set(_TBB_COMPILER ${TBB_COMPILER})
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE}) set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
endif (APPLE) endif (APPLE)
endif (UNIX) endif (UNIX)
if (CMAKE_SYSTEM MATCHES "SunOS.*") if (CMAKE_SYSTEM MATCHES "SunOS.*")
# SUN # SUN
# not yet supported # not yet supported
# has em64t/cc3.4.3_kernel5.10 # has em64t/cc3.4.3_kernel5.10
# has ia32/* # has ia32/*
endif (CMAKE_SYSTEM MATCHES "SunOS.*") endif (CMAKE_SYSTEM MATCHES "SunOS.*")
#-- Clear the public variables #-- Clear the public variables
set (TBB_FOUND "NO") set (TBB_FOUND "NO")
#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR} #-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR}
# first: use CMake variable TBB_INSTALL_DIR # first: use CMake variable TBB_INSTALL_DIR
if (TBB_INSTALL_DIR) if (TBB_INSTALL_DIR)
set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR}) set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR})
endif (TBB_INSTALL_DIR) endif (TBB_INSTALL_DIR)
# second: use environment variable # second: use environment variable
if (NOT _TBB_INSTALL_DIR) if (NOT _TBB_INSTALL_DIR)
if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "") if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR}) set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR})
endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "") endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
# Intel recommends setting TBB21_INSTALL_DIR # Intel recommends setting TBB21_INSTALL_DIR
if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "") if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR}) set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR})
endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "") endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "") if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR}) set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR})
endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "") endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "") if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR}) set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR})
endif (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "") endif (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
endif (NOT _TBB_INSTALL_DIR) endif (NOT _TBB_INSTALL_DIR)
# third: try to find path automatically # third: try to find path automatically
if (NOT _TBB_INSTALL_DIR) if (NOT _TBB_INSTALL_DIR)
if (_TBB_DEFAULT_INSTALL_DIR) if (_TBB_DEFAULT_INSTALL_DIR)
set (_TBB_INSTALL_DIR ${_TBB_DEFAULT_INSTALL_DIR}) set (_TBB_INSTALL_DIR ${_TBB_DEFAULT_INSTALL_DIR})
endif (_TBB_DEFAULT_INSTALL_DIR) endif (_TBB_DEFAULT_INSTALL_DIR)
endif (NOT _TBB_INSTALL_DIR) endif (NOT _TBB_INSTALL_DIR)
# sanity check # sanity check
if (NOT _TBB_INSTALL_DIR) if (NOT _TBB_INSTALL_DIR)
message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}") message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
else (NOT _TBB_INSTALL_DIR) else (NOT _TBB_INSTALL_DIR)
# finally: set the cached CMake variable TBB_INSTALL_DIR # finally: set the cached CMake variable TBB_INSTALL_DIR
if (NOT TBB_INSTALL_DIR) if (NOT TBB_INSTALL_DIR)
set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory") set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory")
mark_as_advanced(TBB_INSTALL_DIR) mark_as_advanced(TBB_INSTALL_DIR)
endif (NOT TBB_INSTALL_DIR) endif (NOT TBB_INSTALL_DIR)
#-- A macro to rewrite the paths of the library. This is necessary, because #-- A macro to rewrite the paths of the library. This is necessary, because
# find_library() always found the em64t/vc9 version of the TBB libs # find_library() always found the em64t/vc9 version of the TBB libs
macro(TBB_CORRECT_LIB_DIR var_name) macro(TBB_CORRECT_LIB_DIR var_name)
# if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t") # if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}}) string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
# endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t") # endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}}) string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
string(REPLACE vc7.1 "${_TBB_COMPILER}" ${var_name} ${${var_name}}) string(REPLACE vc7.1 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
string(REPLACE vc8 "${_TBB_COMPILER}" ${var_name} ${${var_name}}) string(REPLACE vc8 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
string(REPLACE vc9 "${_TBB_COMPILER}" ${var_name} ${${var_name}}) string(REPLACE vc9 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
string(REPLACE vc10 "${_TBB_COMPILER}" ${var_name} ${${var_name}}) string(REPLACE vc10 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
endmacro(TBB_CORRECT_LIB_DIR var_content) endmacro(TBB_CORRECT_LIB_DIR var_content)
#-- Look for include directory and set ${TBB_INCLUDE_DIR} #-- Look for include directory and set ${TBB_INCLUDE_DIR}
set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include) set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include)
# Jiri: tbbvars now sets the CPATH environment variable to the directory # Jiri: tbbvars now sets the CPATH environment variable to the directory
# containing the headers. # containing the headers.
find_path(TBB_INCLUDE_DIR find_path(TBB_INCLUDE_DIR
tbb/task_scheduler_init.h tbb/task_scheduler_init.h
HINTS ${TBB_INC_SEARCH_DIR} ENV CPATH HINTS ${TBB_INC_SEARCH_DIR} ENV CPATH
) )
mark_as_advanced(TBB_INCLUDE_DIR) mark_as_advanced(TBB_INCLUDE_DIR)
#-- Look for libraries #-- Look for libraries
# GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh] # GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh]
if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "") if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
set (_TBB_LIBRARY_DIR set (_TBB_LIBRARY_DIR
${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM} ${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM}
${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib ${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib
) )
endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "") endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
# Jiri: This block isn't mutually exclusive with the previous one # Jiri: This block isn't mutually exclusive with the previous one
# (hence no else), instead I test if the user really specified # (hence no else), instead I test if the user really specified
# the variables in question. # the variables in question.
if ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL "")) if ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
# HH: deprecated # HH: deprecated
message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set \$ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).") message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set \$ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).")
# Jiri: It doesn't hurt to look in more places, so I store the hints from # Jiri: It doesn't hurt to look in more places, so I store the hints from
# ENV{TBB_ARCH_PLATFORM} and the TBB_ARCHITECTURE and TBB_COMPILER # ENV{TBB_ARCH_PLATFORM} and the TBB_ARCHITECTURE and TBB_COMPILER
# variables and search them both. # variables and search them both.
set (_TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib" ${_TBB_LIBRARY_DIR}) set (_TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib" ${_TBB_LIBRARY_DIR})
endif ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL "")) endif ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
# GvdB: Mac OS X distribution places libraries directly in lib directory. # GvdB: Mac OS X distribution places libraries directly in lib directory.
list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib) list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib)
if(EXISTS ${_TBB_INSTALL_DIR}/build) if(EXISTS ${_TBB_INSTALL_DIR}/build)
file(GLOB _TBB_BUILD_DIR_RELEASE ${_TBB_INSTALL_DIR}/build/*_release) file(GLOB _TBB_BUILD_DIR_RELEASE ${_TBB_INSTALL_DIR}/build/*_release)
file(GLOB _TBB_BUILD_DIR_DEBUG ${_TBB_INSTALL_DIR}/build/*_debug) file(GLOB _TBB_BUILD_DIR_DEBUG ${_TBB_INSTALL_DIR}/build/*_debug)
endif() endif()
# Jiri: No reason not to check the default paths. From recent versions, # Jiri: No reason not to check the default paths. From recent versions,
# tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH # tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH
# variables, which now point to the directories of the lib files. # variables, which now point to the directories of the lib files.
# It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS # It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS
# argument instead of the implicit PATHS as it isn't hard-coded # argument instead of the implicit PATHS as it isn't hard-coded
# but computed by system introspection. Searching the LIBRARY_PATH # but computed by system introspection. Searching the LIBRARY_PATH
# and LD_LIBRARY_PATH environment variables is now even more important # and LD_LIBRARY_PATH environment variables is now even more important
# that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates # that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates
# the use of TBB built from sources. # the use of TBB built from sources.
find_library(TBB_LIBRARY ${_TBB_LIB_NAME} HINTS ${_TBB_BUILD_DIR_RELEASE} ${_TBB_LIBRARY_DIR}) find_library(TBB_LIBRARY ${_TBB_LIB_NAME} HINTS ${_TBB_BUILD_DIR_RELEASE} ${_TBB_LIBRARY_DIR})
find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} HINTS ${_TBB_BUILD_DIR_RELEASE} ${_TBB_LIBRARY_DIR}) find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} HINTS ${_TBB_BUILD_DIR_RELEASE} ${_TBB_LIBRARY_DIR})
#Extract path from TBB_LIBRARY name #Extract path from TBB_LIBRARY name
get_filename_component(TBB_LIBRARY_DIR ${TBB_LIBRARY} PATH) get_filename_component(TBB_LIBRARY_DIR ${TBB_LIBRARY} PATH)
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY) #TBB_CORRECT_LIB_DIR(TBB_LIBRARY)
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY) #TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY)
mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY) mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY)
#-- Look for debug libraries #-- Look for debug libraries
# Jiri: Changed the same way as for the release libraries. # Jiri: Changed the same way as for the release libraries.
find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_BUILD_DIR_DEBUG} ${_TBB_LIBRARY_DIR} find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_BUILD_DIR_DEBUG} ${_TBB_LIBRARY_DIR}
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH) PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_BUILD_DIR_DEBUG} ${_TBB_LIBRARY_DIR} find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_BUILD_DIR_DEBUG} ${_TBB_LIBRARY_DIR}
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH) PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
# Jiri: Self-built TBB stores the debug libraries in a separate directory. # Jiri: Self-built TBB stores the debug libraries in a separate directory.
# Extract path from TBB_LIBRARY_DEBUG name # Extract path from TBB_LIBRARY_DEBUG name
get_filename_component(TBB_LIBRARY_DEBUG_DIR ${TBB_LIBRARY_DEBUG} PATH) get_filename_component(TBB_LIBRARY_DEBUG_DIR ${TBB_LIBRARY_DEBUG} PATH)
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY_DEBUG) #TBB_CORRECT_LIB_DIR(TBB_LIBRARY_DEBUG)
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY_DEBUG) #TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY_DEBUG)
mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG) mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG)
if (TBB_INCLUDE_DIR) if (TBB_INCLUDE_DIR)
if (TBB_LIBRARY) if (TBB_LIBRARY)
set (TBB_FOUND "YES") set (TBB_FOUND "YES")
set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES}) set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES})
set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES}) set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE) set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE) set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE)
# Jiri: Self-built TBB stores the debug libraries in a separate directory. # Jiri: Self-built TBB stores the debug libraries in a separate directory.
set (TBB_DEBUG_LIBRARY_DIRS ${TBB_LIBRARY_DEBUG_DIR} CACHE PATH "TBB debug library directory" FORCE) set (TBB_DEBUG_LIBRARY_DIRS ${TBB_LIBRARY_DEBUG_DIR} CACHE PATH "TBB debug library directory" FORCE)
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_DEBUG_LIBRARY_DIRS TBB_LIBRARIES TBB_DEBUG_LIBRARIES) mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_DEBUG_LIBRARY_DIRS TBB_LIBRARIES TBB_DEBUG_LIBRARIES)
message(STATUS "Found Intel TBB") message(STATUS "Found Intel TBB")
endif (TBB_LIBRARY) endif (TBB_LIBRARY)
endif (TBB_INCLUDE_DIR) endif (TBB_INCLUDE_DIR)
if (NOT TBB_FOUND) if (NOT TBB_FOUND)
message("ERROR: Intel TBB NOT found!") message("ERROR: Intel TBB NOT found!")
message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}") message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}")
# do only throw fatal, if this pkg is REQUIRED # do only throw fatal, if this pkg is REQUIRED
if (TBB_FIND_REQUIRED) if (TBB_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find TBB library.") message(FATAL_ERROR "Could NOT find TBB library.")
endif (TBB_FIND_REQUIRED) endif (TBB_FIND_REQUIRED)
endif (NOT TBB_FOUND) endif (NOT TBB_FOUND)
endif (NOT _TBB_INSTALL_DIR) endif (NOT _TBB_INSTALL_DIR)
if (TBB_FOUND) if (TBB_FOUND)
set(TBB_INTERFACE_VERSION 0) set(TBB_INTERFACE_VERSION 0)
FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS) FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS)
STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}") STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}")
set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}") set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}")
message(STATUS "TBB interface version: ${TBB_INTERFACE_VERSION}") message(STATUS "TBB interface version: ${TBB_INTERFACE_VERSION}")
endif (TBB_FOUND) endif (TBB_FOUND)

View File

@ -539,10 +539,10 @@ Annotation of the whole route leg with fine-grained information about each segme
**Properties** **Properties**
- `distance`: The distance, in metres, between each pair of coordinates - `distance`: The distance, in metres, between each pair of coordinates
- `duration`: The duration between each pair of coordinates, in seconds - `duration`: The duration between each pair of coordinates, in seconds. Does not include the duration of any turns.
- `datasources`: The index of the datasource for the speed between each pair of coordinates. `0` is the default profile, other values are supplied via `--segment-speed-file` to `osrm-contract` - `datasources`: The index of the datasource for the speed between each pair of coordinates. `0` is the default profile, other values are supplied via `--segment-speed-file` to `osrm-contract`
- `nodes`: The OSM node ID for each coordinate along the route, excluding the first/last user-supplied coordinates - `nodes`: The OSM node ID for each coordinate along the route, excluding the first/last user-supplied coordinates
- `weight`: The weights between each pair of coordinates - `weight`: The weights between each pair of coordinates. Does not include any turn costs.
- `speed`: Convenience field, calculation of `distance / duration` rounded to one decimal place - `speed`: Convenience field, calculation of `distance / duration` rounded to one decimal place
#### Example #### Example
@ -583,7 +583,6 @@ step.
- `destinations`: The destinations of the way. Will be `undefined` if there are no destinations. - `destinations`: The destinations of the way. Will be `undefined` if there are no destinations.
- `exits`: The exit numbers or names of the way. Will be `undefined` if there are no exit numbers or names. - `exits`: The exit numbers or names of the way. Will be `undefined` if there are no exit numbers or names.
- `mode`: A string signifying the mode of transportation. - `mode`: A string signifying the mode of transportation.
- `classes`: An array of strings signifying the classes of the road as specified in the profile.
- `maneuver`: A `StepManeuver` object representing the maneuver. - `maneuver`: A `StepManeuver` object representing the maneuver.
- `intersections`: A list of `Intersection` objects that are passed along the segment, the very first belonging to the StepManeuver - `intersections`: A list of `Intersection` objects that are passed along the segment, the very first belonging to the StepManeuver
- `rotary_name`: The name for the rotary. Optionally included, if the step is a rotary and a rotary name is available. - `rotary_name`: The name for the rotary. Optionally included, if the step is a rotary and a rotary name is available.
@ -597,7 +596,6 @@ step.
"mode" : "driving", "mode" : "driving",
"duration" : 15.6, "duration" : 15.6,
"weight" : 15.6, "weight" : 15.6,
"classes": ["toll", "restricted"],
"intersections" : [ "intersections" : [
{ "bearings" : [ 10, 92, 184, 270 ], { "bearings" : [ 10, 92, 184, 270 ],
"lanes" : [ "lanes" : [
@ -657,7 +655,7 @@ step.
| `off ramp` | take a ramp to exit a highway (direction given my `modifier`) | | `off ramp` | take a ramp to exit a highway (direction given my `modifier`) |
| `fork` | take the left/right side at a fork depending on `modifier` | | `fork` | take the left/right side at a fork depending on `modifier` |
| `end of road` | road ends in a T intersection turn in direction of `modifier`| | `end of road` | road ends in a T intersection turn in direction of `modifier`|
| `use lane` | going straight on a specific lane | | `use lane` | **Deprecated** replaced by lanes on all intersection entries |
| `continue` | Turn in direction of `modifier` to stay on the same road | | `continue` | Turn in direction of `modifier` to stay on the same road |
| `roundabout` | traverse roundabout, has additional property `exit` with NR if the roundabout is left. The modifier specifies the direction of entering the roundabout. | | `roundabout` | traverse roundabout, has additional property `exit` with NR if the roundabout is left. The modifier specifies the direction of entering the roundabout. |
| `rotary` | a traffic circle. While very similar to a larger version of a roundabout, it does not necessarily follow roundabout rules for right of way. It can offer `rotary_name` and/or `rotary_pronunciation` parameters (located in the RouteStep object) in addition to the `exit` parameter (located on the StepManeuver object). | | `rotary` | a traffic circle. While very similar to a larger version of a roundabout, it does not necessarily follow roundabout rules for right of way. It can offer `rotary_name` and/or `rotary_pronunciation` parameters (located in the RouteStep object) in addition to the `exit` parameter (located on the StepManeuver object). |
@ -735,6 +733,7 @@ location of the StepManeuver. Further intersections are listed for every cross-w
- `location`: A `[longitude, latitude]` pair describing the location of the turn. - `location`: A `[longitude, latitude]` pair describing the location of the turn.
- `bearings`: A list of bearing values (e.g. [0,90,180,270]) that are available at the intersection. The bearings describe all available roads at the intersection. Values are between 0-359 (0=true north) - `bearings`: A list of bearing values (e.g. [0,90,180,270]) that are available at the intersection. The bearings describe all available roads at the intersection. Values are between 0-359 (0=true north)
- `classes`: An array of strings signifying the classes (as specified in the profile) of the road exiting the intersection.
- `entry`: A list of entry flags, corresponding in a 1:1 relationship to the bearings. A value of `true` indicates that the respective road could be entered on a valid route. - `entry`: A list of entry flags, corresponding in a 1:1 relationship to the bearings. A value of `true` indicates that the respective road could be entered on a valid route.
`false` indicates that the turn onto the respective road would violate a restriction. `false` indicates that the turn onto the respective road would violate a restriction.
- `in`: index into bearings/entry array. Used to calculate the bearing just before the turn. Namely, the clockwise angle from true north to the - `in`: index into bearings/entry array. Used to calculate the bearing just before the turn. Namely, the clockwise angle from true north to the
@ -753,6 +752,7 @@ location of the StepManeuver. Further intersections are listed for every cross-w
"out":2, "out":2,
"bearings":[60,150,240,330], "bearings":[60,150,240,330],
"entry":["false","true","true","true"], "entry":["false","true","true","true"],
"classes": ["toll", "restricted"],
"lanes":{ "lanes":{
"indications": ["left", "straight"], "indications": ["left", "straight"],
"valid": "false" "valid": "false"

View File

@ -26,6 +26,12 @@ var osrm = new OSRM('network.osrm');
- `options.shared_memory` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Connects to the persistent shared memory datastore. - `options.shared_memory` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Connects to the persistent shared memory datastore.
This requires you to run `osrm-datastore` prior to creating an `OSRM` object. This requires you to run `osrm-datastore` prior to creating an `OSRM` object.
- `options.path` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** The path to the `.osrm` files. This is mutually exclusive with setting {options.shared_memory} to true. - `options.path` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** The path to the `.osrm` files. This is mutually exclusive with setting {options.shared_memory} to true.
- `options.max_locations_trip` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in trip query (default: unlimited).
- `options.max_locations_viaroute` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in viaroute query 9default: unlimited).
- `options.max_locations_distance_table` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in distance table query (default: unlimited).
- `options.max_locations_map_matching` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in map matching query (default: unlimited).
- `options.max_results_nearest` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. results supported in nearest query (default: unlimited).
- `options.max_alternatives` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. number of alternative routes supported (default: 3).
### route ### route

View File

@ -1,283 +1,283 @@
# Locate Intel Threading Building Blocks include paths and libraries # Locate Intel Threading Building Blocks include paths and libraries
# FindTBB.cmake can be found at https://code.google.com/p/findtbb/ # FindTBB.cmake can be found at https://code.google.com/p/findtbb/
# Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de> # Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de>
# Improvements by Gino van den Bergen <gino _at_ dtecta.com>, # Improvements by Gino van den Bergen <gino _at_ dtecta.com>,
# Florian Uhlig <F.Uhlig _at_ gsi.de>, # Florian Uhlig <F.Uhlig _at_ gsi.de>,
# Jiri Marsik <jiri.marsik89 _at_ gmail.com> # Jiri Marsik <jiri.marsik89 _at_ gmail.com>
# The MIT License # The MIT License
# #
# Copyright (c) 2011 Hannes Hofmann # Copyright (c) 2011 Hannes Hofmann
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights # in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is # copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions: # furnished to do so, subject to the following conditions:
# #
# The above copyright notice and this permission notice shall be included in # The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software. # all copies or substantial portions of the Software.
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
# GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler. # GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler.
# e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21" # e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21"
# TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found # TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found
# in the TBB installation directory (TBB_INSTALL_DIR). # in the TBB installation directory (TBB_INSTALL_DIR).
# #
# GvdB: Mac OS X distribution places libraries directly in lib directory. # GvdB: Mac OS X distribution places libraries directly in lib directory.
# #
# For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER. # For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER.
# TBB_ARCHITECTURE [ ia32 | em64t | itanium ] # TBB_ARCHITECTURE [ ia32 | em64t | itanium ]
# which architecture to use # which architecture to use
# TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9 # TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9
# which compiler to use (detected automatically on Windows) # which compiler to use (detected automatically on Windows)
# This module respects # This module respects
# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR} # TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR}
# This module defines # This module defines
# TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc. # TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc.
# TBB_LIBRARY_DIRS, where to find libtbb, libtbbmalloc # TBB_LIBRARY_DIRS, where to find libtbb, libtbbmalloc
# TBB_DEBUG_LIBRARY_DIRS, where to find libtbb_debug, libtbbmalloc_debug # TBB_DEBUG_LIBRARY_DIRS, where to find libtbb_debug, libtbbmalloc_debug
# TBB_INSTALL_DIR, the base TBB install directory # TBB_INSTALL_DIR, the base TBB install directory
# TBB_LIBRARIES, the libraries to link against to use TBB. # TBB_LIBRARIES, the libraries to link against to use TBB.
# TBB_DEBUG_LIBRARIES, the libraries to link against to use TBB with debug symbols. # TBB_DEBUG_LIBRARIES, the libraries to link against to use TBB with debug symbols.
# TBB_FOUND, If false, don't try to use TBB. # TBB_FOUND, If false, don't try to use TBB.
# TBB_INTERFACE_VERSION, as defined in tbb/tbb_stddef.h # TBB_INTERFACE_VERSION, as defined in tbb/tbb_stddef.h
if (WIN32) if (WIN32)
# has em64t/vc8 em64t/vc9 # has em64t/vc8 em64t/vc9
# has ia32/vc7.1 ia32/vc8 ia32/vc9 # has ia32/vc7.1 ia32/vc8 ia32/vc9
set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB") set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB")
set(_TBB_LIB_NAME "tbb") set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc") set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug") set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug") set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
if (MSVC71) if (MSVC71)
set (_TBB_COMPILER "vc7.1") set (_TBB_COMPILER "vc7.1")
endif(MSVC71) endif(MSVC71)
if (MSVC80) if (MSVC80)
set(_TBB_COMPILER "vc8") set(_TBB_COMPILER "vc8")
endif(MSVC80) endif(MSVC80)
if (MSVC90) if (MSVC90)
set(_TBB_COMPILER "vc9") set(_TBB_COMPILER "vc9")
endif(MSVC90) endif(MSVC90)
if(MSVC10) if(MSVC10)
set(_TBB_COMPILER "vc10") set(_TBB_COMPILER "vc10")
endif(MSVC10) endif(MSVC10)
# Todo: add other Windows compilers such as ICL. # Todo: add other Windows compilers such as ICL.
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE}) set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
endif (WIN32) endif (WIN32)
if (UNIX) if (UNIX)
if (APPLE) if (APPLE)
# MAC # MAC
set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions") set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions")
# libs: libtbb.dylib, libtbbmalloc.dylib, *_debug # libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
set(_TBB_LIB_NAME "tbb") set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc") set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug") set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug") set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
# default flavor on apple: ia32/cc4.0.1_os10.4.9 # default flavor on apple: ia32/cc4.0.1_os10.4.9
# Jiri: There is no reason to presume there is only one flavor and # Jiri: There is no reason to presume there is only one flavor and
# that user's setting of variables should be ignored. # that user's setting of variables should be ignored.
if(NOT TBB_COMPILER) if(NOT TBB_COMPILER)
set(_TBB_COMPILER "cc4.0.1_os10.4.9") set(_TBB_COMPILER "cc4.0.1_os10.4.9")
elseif (NOT TBB_COMPILER) elseif (NOT TBB_COMPILER)
set(_TBB_COMPILER ${TBB_COMPILER}) set(_TBB_COMPILER ${TBB_COMPILER})
endif(NOT TBB_COMPILER) endif(NOT TBB_COMPILER)
if(NOT TBB_ARCHITECTURE) if(NOT TBB_ARCHITECTURE)
set(_TBB_ARCHITECTURE "ia32") set(_TBB_ARCHITECTURE "ia32")
elseif(NOT TBB_ARCHITECTURE) elseif(NOT TBB_ARCHITECTURE)
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE}) set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
endif(NOT TBB_ARCHITECTURE) endif(NOT TBB_ARCHITECTURE)
else (APPLE) else (APPLE)
# LINUX # LINUX
set(_TBB_DEFAULT_INSTALL_DIR "/opt/intel/tbb" "/usr/local/include" "/usr/include") set(_TBB_DEFAULT_INSTALL_DIR "/opt/intel/tbb" "/usr/local/include" "/usr/include")
set(_TBB_LIB_NAME "tbb") set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc") set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug") set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug") set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
# has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21 # has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21
# has ia32/* # has ia32/*
# has itanium/* # has itanium/*
set(_TBB_COMPILER ${TBB_COMPILER}) set(_TBB_COMPILER ${TBB_COMPILER})
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE}) set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
endif (APPLE) endif (APPLE)
endif (UNIX) endif (UNIX)
if (CMAKE_SYSTEM MATCHES "SunOS.*") if (CMAKE_SYSTEM MATCHES "SunOS.*")
# SUN # SUN
# not yet supported # not yet supported
# has em64t/cc3.4.3_kernel5.10 # has em64t/cc3.4.3_kernel5.10
# has ia32/* # has ia32/*
endif (CMAKE_SYSTEM MATCHES "SunOS.*") endif (CMAKE_SYSTEM MATCHES "SunOS.*")
#-- Clear the public variables #-- Clear the public variables
set (TBB_FOUND "NO") set (TBB_FOUND "NO")
#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR} #-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR}
# first: use CMake variable TBB_INSTALL_DIR # first: use CMake variable TBB_INSTALL_DIR
if (TBB_INSTALL_DIR) if (TBB_INSTALL_DIR)
set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR}) set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR})
endif (TBB_INSTALL_DIR) endif (TBB_INSTALL_DIR)
# second: use environment variable # second: use environment variable
if (NOT _TBB_INSTALL_DIR) if (NOT _TBB_INSTALL_DIR)
if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "") if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR}) set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR})
endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "") endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
# Intel recommends setting TBB21_INSTALL_DIR # Intel recommends setting TBB21_INSTALL_DIR
if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "") if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR}) set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR})
endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "") endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "") if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR}) set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR})
endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "") endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "") if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR}) set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR})
endif (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "") endif (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
endif (NOT _TBB_INSTALL_DIR) endif (NOT _TBB_INSTALL_DIR)
# third: try to find path automatically # third: try to find path automatically
if (NOT _TBB_INSTALL_DIR) if (NOT _TBB_INSTALL_DIR)
if (_TBB_DEFAULT_INSTALL_DIR) if (_TBB_DEFAULT_INSTALL_DIR)
set (_TBB_INSTALL_DIR ${_TBB_DEFAULT_INSTALL_DIR}) set (_TBB_INSTALL_DIR ${_TBB_DEFAULT_INSTALL_DIR})
endif (_TBB_DEFAULT_INSTALL_DIR) endif (_TBB_DEFAULT_INSTALL_DIR)
endif (NOT _TBB_INSTALL_DIR) endif (NOT _TBB_INSTALL_DIR)
# sanity check # sanity check
if (NOT _TBB_INSTALL_DIR) if (NOT _TBB_INSTALL_DIR)
message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}") message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
else (NOT _TBB_INSTALL_DIR) else (NOT _TBB_INSTALL_DIR)
# finally: set the cached CMake variable TBB_INSTALL_DIR # finally: set the cached CMake variable TBB_INSTALL_DIR
if (NOT TBB_INSTALL_DIR) if (NOT TBB_INSTALL_DIR)
set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory") set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory")
mark_as_advanced(TBB_INSTALL_DIR) mark_as_advanced(TBB_INSTALL_DIR)
endif (NOT TBB_INSTALL_DIR) endif (NOT TBB_INSTALL_DIR)
#-- A macro to rewrite the paths of the library. This is necessary, because #-- A macro to rewrite the paths of the library. This is necessary, because
# find_library() always found the em64t/vc9 version of the TBB libs # find_library() always found the em64t/vc9 version of the TBB libs
macro(TBB_CORRECT_LIB_DIR var_name) macro(TBB_CORRECT_LIB_DIR var_name)
# if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t") # if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}}) string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
# endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t") # endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}}) string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
string(REPLACE vc7.1 "${_TBB_COMPILER}" ${var_name} ${${var_name}}) string(REPLACE vc7.1 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
string(REPLACE vc8 "${_TBB_COMPILER}" ${var_name} ${${var_name}}) string(REPLACE vc8 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
string(REPLACE vc9 "${_TBB_COMPILER}" ${var_name} ${${var_name}}) string(REPLACE vc9 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
string(REPLACE vc10 "${_TBB_COMPILER}" ${var_name} ${${var_name}}) string(REPLACE vc10 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
endmacro(TBB_CORRECT_LIB_DIR var_content) endmacro(TBB_CORRECT_LIB_DIR var_content)
#-- Look for include directory and set ${TBB_INCLUDE_DIR} #-- Look for include directory and set ${TBB_INCLUDE_DIR}
set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include) set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include)
# Jiri: tbbvars now sets the CPATH environment variable to the directory # Jiri: tbbvars now sets the CPATH environment variable to the directory
# containing the headers. # containing the headers.
find_path(TBB_INCLUDE_DIR find_path(TBB_INCLUDE_DIR
tbb/task_scheduler_init.h tbb/task_scheduler_init.h
PATHS ${TBB_INC_SEARCH_DIR} ENV CPATH PATHS ${TBB_INC_SEARCH_DIR} ENV CPATH
) )
mark_as_advanced(TBB_INCLUDE_DIR) mark_as_advanced(TBB_INCLUDE_DIR)
#-- Look for libraries #-- Look for libraries
# GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh] # GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh]
if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "") if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
set (_TBB_LIBRARY_DIR set (_TBB_LIBRARY_DIR
${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM} ${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM}
${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib ${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib
) )
endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "") endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
# Jiri: This block isn't mutually exclusive with the previous one # Jiri: This block isn't mutually exclusive with the previous one
# (hence no else), instead I test if the user really specified # (hence no else), instead I test if the user really specified
# the variables in question. # the variables in question.
if ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL "")) if ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
# HH: deprecated # HH: deprecated
message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set \$ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).") message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set \$ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).")
# Jiri: It doesn't hurt to look in more places, so I store the hints from # Jiri: It doesn't hurt to look in more places, so I store the hints from
# ENV{TBB_ARCH_PLATFORM} and the TBB_ARCHITECTURE and TBB_COMPILER # ENV{TBB_ARCH_PLATFORM} and the TBB_ARCHITECTURE and TBB_COMPILER
# variables and search them both. # variables and search them both.
set (_TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib" ${_TBB_LIBRARY_DIR}) set (_TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib" ${_TBB_LIBRARY_DIR})
endif ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL "")) endif ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
# GvdB: Mac OS X distribution places libraries directly in lib directory. # GvdB: Mac OS X distribution places libraries directly in lib directory.
list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib) list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib)
# Jiri: No reason not to check the default paths. From recent versions, # Jiri: No reason not to check the default paths. From recent versions,
# tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH # tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH
# variables, which now point to the directories of the lib files. # variables, which now point to the directories of the lib files.
# It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS # It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS
# argument instead of the implicit PATHS as it isn't hard-coded # argument instead of the implicit PATHS as it isn't hard-coded
# but computed by system introspection. Searching the LIBRARY_PATH # but computed by system introspection. Searching the LIBRARY_PATH
# and LD_LIBRARY_PATH environment variables is now even more important # and LD_LIBRARY_PATH environment variables is now even more important
# that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates # that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates
# the use of TBB built from sources. # the use of TBB built from sources.
find_library(TBB_LIBRARY ${_TBB_LIB_NAME} HINTS ${_TBB_LIBRARY_DIR} find_library(TBB_LIBRARY ${_TBB_LIB_NAME} HINTS ${_TBB_LIBRARY_DIR}
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH) PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} HINTS ${_TBB_LIBRARY_DIR} find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} HINTS ${_TBB_LIBRARY_DIR}
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH) PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
#Extract path from TBB_LIBRARY name #Extract path from TBB_LIBRARY name
get_filename_component(TBB_LIBRARY_DIR ${TBB_LIBRARY} PATH) get_filename_component(TBB_LIBRARY_DIR ${TBB_LIBRARY} PATH)
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY) #TBB_CORRECT_LIB_DIR(TBB_LIBRARY)
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY) #TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY)
mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY) mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY)
#-- Look for debug libraries #-- Look for debug libraries
# Jiri: Changed the same way as for the release libraries. # Jiri: Changed the same way as for the release libraries.
find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR} find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH) PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR} find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH) PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
# Jiri: Self-built TBB stores the debug libraries in a separate directory. # Jiri: Self-built TBB stores the debug libraries in a separate directory.
# Extract path from TBB_LIBRARY_DEBUG name # Extract path from TBB_LIBRARY_DEBUG name
get_filename_component(TBB_LIBRARY_DEBUG_DIR ${TBB_LIBRARY_DEBUG} PATH) get_filename_component(TBB_LIBRARY_DEBUG_DIR ${TBB_LIBRARY_DEBUG} PATH)
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY_DEBUG) #TBB_CORRECT_LIB_DIR(TBB_LIBRARY_DEBUG)
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY_DEBUG) #TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY_DEBUG)
mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG) mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG)
if (TBB_INCLUDE_DIR) if (TBB_INCLUDE_DIR)
if (TBB_LIBRARY) if (TBB_LIBRARY)
set (TBB_FOUND "YES") set (TBB_FOUND "YES")
set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES}) set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES})
set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES}) set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE) set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE) set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE)
# Jiri: Self-built TBB stores the debug libraries in a separate directory. # Jiri: Self-built TBB stores the debug libraries in a separate directory.
set (TBB_DEBUG_LIBRARY_DIRS ${TBB_LIBRARY_DEBUG_DIR} CACHE PATH "TBB debug library directory" FORCE) set (TBB_DEBUG_LIBRARY_DIRS ${TBB_LIBRARY_DEBUG_DIR} CACHE PATH "TBB debug library directory" FORCE)
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_DEBUG_LIBRARY_DIRS TBB_LIBRARIES TBB_DEBUG_LIBRARIES) mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_DEBUG_LIBRARY_DIRS TBB_LIBRARIES TBB_DEBUG_LIBRARIES)
message(STATUS "Found Intel TBB") message(STATUS "Found Intel TBB")
endif (TBB_LIBRARY) endif (TBB_LIBRARY)
endif (TBB_INCLUDE_DIR) endif (TBB_INCLUDE_DIR)
if (NOT TBB_FOUND) if (NOT TBB_FOUND)
message("ERROR: Intel TBB NOT found!") message("ERROR: Intel TBB NOT found!")
message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}") message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}")
# do only throw fatal, if this pkg is REQUIRED # do only throw fatal, if this pkg is REQUIRED
if (TBB_FIND_REQUIRED) if (TBB_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find TBB library.") message(FATAL_ERROR "Could NOT find TBB library.")
endif (TBB_FIND_REQUIRED) endif (TBB_FIND_REQUIRED)
endif (NOT TBB_FOUND) endif (NOT TBB_FOUND)
endif (NOT _TBB_INSTALL_DIR) endif (NOT _TBB_INSTALL_DIR)
if (TBB_FOUND) if (TBB_FOUND)
set(TBB_INTERFACE_VERSION 0) set(TBB_INTERFACE_VERSION 0)
FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS) FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS)
STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}") STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}")
set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}") set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}")
endif (TBB_FOUND) endif (TBB_FOUND)

View File

@ -17,13 +17,13 @@ Feature: Car - Mode flag
| cd | primary | | | cd | primary | |
When I route I should get When I route I should get
| from | to | route | turns | classes | | from | to | route | turns | classes |
| a | d | ab,bc,cd,cd | depart,notification right,notification left,arrive | ,ferry,, | | a | d | ab,bc,cd,cd | depart,notification right,notification left,arrive | [()],[(ferry)],[()],[()] |
| d | a | cd,bc,ab,ab | depart,notification right,notification left,arrive | ,ferry,, | | d | a | cd,bc,ab,ab | depart,notification right,notification left,arrive | [()],[(ferry)],[()],[()] |
| c | a | bc,ab,ab | depart,notification left,arrive | ferry,, | | c | a | bc,ab,ab | depart,notification left,arrive | [(ferry)],[()],[()] |
| d | b | cd,bc,bc | depart,notification right,arrive | ,ferry,ferry | | d | b | cd,bc,bc | depart,notification right,arrive | [()],[(ferry)],[()] |
| a | c | ab,bc,bc | depart,notification right,arrive | ,ferry,ferry | | a | c | ab,bc,bc | depart,notification right,arrive | [()],[(ferry)],[()] |
| b | d | bc,cd,cd | depart,notification left,arrive | ferry,, | | b | d | bc,cd,cd | depart,notification left,arrive | [(ferry)],[()],[()] |
Scenario: Car - We tag motorways with a class Scenario: Car - We tag motorways with a class
@ -40,10 +40,10 @@ Feature: Car - Mode flag
| cd | primary | | cd | primary |
When I route I should get When I route I should get
| from | to | route | turns | classes | # | | from | to | route | turns | classes |
| a | d | ab,bc,cd | depart,notification right,arrive | ,motorway, | | | a | d | ab,cd | depart,arrive | [(),(motorway),()],[()] |
| a | c | ab,bc,bc | depart,notification right,arrive | ,motorway,motorway | | | a | c | ab,bc | depart,arrive | [(),(motorway)],[()] |
| b | d | bc,cd | depart,arrive | motorway, | we don't announce when we leave the highway | | b | d | bc,cd | depart,arrive | [(motorway),()],[()] |
Scenario: Car - We tag motorway_link with a class Scenario: Car - We tag motorway_link with a class
Given the node map Given the node map
@ -59,10 +59,10 @@ Feature: Car - Mode flag
| cd | primary | | cd | primary |
When I route I should get When I route I should get
| from | to | route | turns | classes | # | | from | to | route | turns | classes | # |
| a | d | ab,bc,cd | depart,on ramp right,arrive | ,motorway, | notification replaced by on-ramp | | a | d | ab,bc,cd | depart,on ramp right,arrive | [()],[(motorway),()],[()] | on-ramp at class change |
| a | c | ab,bc,bc | depart,on ramp right,arrive | ,motorway,motorway | " " | | a | c | ab,bc,bc | depart,on ramp right,arrive | [()],[(motorway)],[()] | " " |
| b | d | bc,cd | depart,arrive | motorway, | no announcement | | b | d | bc,cd | depart,arrive | [(motorway),()],[()] | no announcement |
Scenario: Car - We tag restricted with a class Scenario: Car - We tag restricted with a class
@ -79,8 +79,8 @@ Feature: Car - Mode flag
| cd | primary | | | cd | primary | |
When I route I should get When I route I should get
| from | to | route | turns | classes | | from | to | route | turns | classes |
| a | d | ab,bc,cd | depart,notification right,arrive| restricted,motorway;restricted, | | a | d | ab,cd | depart,arrive| [(restricted),(motorway,restricted),()],[()] |
Scenario: Car - We toll restricted with a class Scenario: Car - We toll restricted with a class
Given the node map Given the node map
@ -96,6 +96,32 @@ Feature: Car - Mode flag
| cd | primary | | | cd | primary | |
When I route I should get When I route I should get
| from | to | route | turns | classes | | from | to | route | turns | classes |
| a | d | ab,bc,cd | depart,notification right,arrive | toll,motorway;toll, | | a | d | ab,cd | depart,arrive | [(toll),(motorway,toll),()],[()] |
Scenario: Car - From roundabout on toll road
Given the node map
"""
c
/ \
a---b d---f
\ /
e
|
g
"""
And the ways
| nodes | oneway | highway | junction | toll |
| ab | yes | primary | | |
| cb | yes | primary | roundabout | |
| dc | yes | primary | roundabout | |
| be | yes | primary | roundabout | |
| ed | yes | motorway| roundabout | |
| eg | yes | primary | | |
| df | yes | motorway| | yes |
When I route I should get
| from | to | route | turns | classes |
| a | f | ab,df,df | depart,roundabout-exit-2,arrive | [()],[(),(motorway),(toll,motorway)],[()] |

View File

@ -0,0 +1,17 @@
@routing @car @construction
Feature: Car - all construction tags the OpenStreetMap community could think of and then some
Background:
Given the profile "car"
Scenario: Various ways to tag construction and proposed roads
Then routability should be
| highway | construction | proposed | bothw |
| primary | | | x |
| construction | | | |
| proposed | | | |
| primary | yes | | |
| primary | | yes | |
| primary | no | | x |
| primary | widening | | x |
| primary | minor | | x |

View File

@ -23,11 +23,11 @@ Feature: Car - Destination only, no passing through
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| a | b | ab,ab | | a | b | ab,ab |
| a | c | ab,bcd,bcd | | a | c | ab,bcd |
| a | d | ab,bcd,bcd | | a | d | ab,bcd,bcd |
| a | e | axye,axye | | a | e | axye,axye |
| e | d | de,de | | e | d | de,de |
| e | c | de,bcd,bcd | | e | c | de,bcd |
| e | b | de,bcd,bcd | | e | b | de,bcd,bcd |
| e | a | axye,axye | | e | a | axye,axye |
@ -51,12 +51,12 @@ Feature: Car - Destination only, no passing through
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| a | b | ab,ab | | a | b | ab,ab |
| a | c | ab,bc,bc | | a | c | ab,bc |
| a | d | ab,bc,cd | | a | d | ab,cd |
| a | e | axye,axye | | a | e | axye,axye |
| e | d | de,de | | e | d | de,de |
| e | c | de,cd,cd | | e | c | de,cd |
| e | b | de,cd,bc | | e | b | de,bc |
| e | a | axye,axye | | e | a | axye,axye |
Scenario: Car - Routing inside a destination only area Scenario: Car - Routing inside a destination only area

View File

@ -35,10 +35,10 @@ Feature: Turn Lane Guidance
| restriction | bc | cd | c | no_right_turn | | restriction | bc | cd | c | no_right_turn |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,e | in,cross,cross | depart,turn left,arrive | ,left:true straight:false, | | a,e | in,cross,cross | depart,turn left,arrive | ;,left:true straight:false, |
| a,g | in,straight,straight | depart,new name straight,arrive | ,left:false straight:true, | | a,g | in,straight,straight | depart,new name straight,arrive | ;,left:false straight:true, |
| a,f | in,cross,cross | depart,continue right,arrive | ,, | | a,f | in,cross,cross | depart,continue right,arrive | ,;right:true, |
@sliproads @sliproads
Scenario: Separate Turn Lanes Scenario: Separate Turn Lanes
@ -68,10 +68,10 @@ Feature: Turn Lane Guidance
| restriction | bc | cd | c | no_right_turn | | restriction | bc | cd | c | no_right_turn |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,e | in,cross,cross | depart,turn left,arrive | ,left:true straight:false right:false, | | a,e | in,cross,cross | depart,turn left,arrive | ;,left:true straight:false right:false, |
| a,g | in,straight,straight | depart,new name straight,arrive | ,left:false straight:true right:false, | | a,g | in,straight,straight | depart,new name straight,arrive | ;,left:false straight:true right:false, |
| a,f | in,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true, | | a,f | in,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true;left:false straight:false right:true, |
@sliproads @sliproads
@ -109,12 +109,12 @@ Feature: Turn Lane Guidance
| restriction | bc | cd | c | no_right_turn | | restriction | bc | cd | c | no_right_turn |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,e | in,cross,cross | depart,turn left,arrive | ,left:true straight:false right:false, | | a,e | in,cross,cross | depart,turn left,arrive | ;,left:true straight:false right:false, |
| a,g | in,straight,straight | depart,new name straight,arrive | ,left:false straight:true right:false, | | a,g | in,straight,straight | depart,new name straight,arrive | ;,left:false straight:true right:false, |
| a,f | in,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true, | | a,f | in,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true;left:false straight:false right:true, |
| a,j | in,turn,other,other | depart,turn right,turn left,arrive | ,,left:true right:false, | | a,j | in,turn,other,other | depart,turn right,turn left,arrive | ,,left:true right:false, |
| a,i | in,turn,other,other | depart,turn right,turn right,arrive | ,,left:false right:true, | | a,i | in,turn,other,other | depart,turn right,turn right,arrive | ,,left:false right:true, |
@todo @2654 @none @todo @2654 @none

View File

@ -3,7 +3,7 @@ Feature: Turn Lane Guidance
Background: Background:
Given the profile "car" Given the profile "car"
Given a grid size of 20 meters Given a grid size of 100 meters
@anticipate @anticipate
Scenario: Anticipate Lane Change for subsequent multi-lane intersections Scenario: Anticipate Lane Change for subsequent multi-lane intersections
@ -151,9 +151,9 @@ Feature: Turn Lane Guidance
| cj | | 1 | motorway_link | yes | xbcj | | cj | | 1 | motorway_link | yes | xbcj |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,i | ab,ci,ci | depart,turn slight right,arrive | ,none:false slight right:true, | | a,i | ab,ci,ci | depart,turn slight right,arrive | ;,none:false slight right:true, |
| a,j | ab,xbcj | depart,arrive | , | | a,j | ab,xbcj | depart,arrive | ;;none:true slight right:false, |
@anticipate @anticipate
@ -308,8 +308,8 @@ Feature: Turn Lane Guidance
| di | | off | | yes | | di | | off | | yes |
When I route I should get When I route I should get
| waypoints | route | turns | destinations | lanes | locations | | waypoints | route | turns | destinations | locations | lanes |
| a,e | main,main,main | depart,use lane straight,arrive | One,Two,Three | ,left:false straight:false straight:true straight:false right:false, | a,c,e | | a,e | main,main | depart,arrive | One,Three | a,e | ;left:false straight:false straight:true straight:false right:false;left:false straight:true right:false, |
@anticipate @anticipate
Scenario: Anticipate Lanes for through and collapse multiple use lanes Scenario: Anticipate Lanes for through and collapse multiple use lanes
@ -335,9 +335,9 @@ Feature: Turn Lane Guidance
| dj | | off | | dj | | off |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,c | main,main | depart,arrive | , | | a,c | main,main | depart,arrive | ;left:false straight:true straight:true right:false, |
| a,d | main,main | depart,arrive | , | | a,d | main,main | depart,arrive | ;left:false straight:true straight:true right:false;left:false straight:true straight:true right:false, |
@anticipate @anticipate
Scenario: Anticipate Lanes for through followed by left/right Scenario: Anticipate Lanes for through followed by left/right
@ -363,17 +363,17 @@ Feature: Turn Lane Guidance
| ci | | off | | ci | | off |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,d | main,main,main,left,left | depart,use lane straight,use lane straight,turn left,arrive | ,left:false straight:false straight:true straight:false straight:false right:false,left:false straight:true straight:false right:false,left:true right:false, | | a,d | main,left,left | depart,end of road left,arrive | ;left:false straight:false straight:true straight:false straight:false right:false;left:false straight:true straight:false right:false,left:true right:false, |
| a,e | main,main,main,right,right | depart,use lane straight,use lane straight,turn right,arrive | ,left:false straight:false straight:false straight:true straight:false right:false,left:false straight:false straight:true right:false,left:false right:true, | | a,e | main,right,right | depart,end of road right,arrive | ;left:false straight:false straight:false straight:true straight:false right:false;left:false straight:false straight:true right:false,left:false right:true, |
@anticipate @anticipate
Scenario: Anticipate Lanes for through with turn before / after Scenario: Anticipate Lanes for through with turn before / after
Given the node map Given the node map
""" """
c g l c g l
b d e h - i b d e h i
a f j a f j
""" """
And the ways And the ways
@ -390,15 +390,15 @@ Feature: Turn Lane Guidance
| il | | il | | | il | | il | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | # | | waypoints | route | turns | lanes | # |
| a,f | ab,bdehi,ef,ef | depart,turn right,turn right,arrive | ,right:false right:false right:true right:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | | | a,f | ab,bdehi,ef,ef | depart,turn right,turn right,arrive | ,right:false right:false right:true right:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | |
| a,g | ab,bdehi,eg,eg | depart,turn right,turn left,arrive | ,right:true right:true right:false right:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | | | a,g | ab,bdehi,eg,eg | depart,turn right,turn left,arrive | ,right:true right:true right:false right:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | |
| a,j | ab,bdehi,bdehi,ij,ij | depart,turn right,use lane straight,turn right,arrive | ,right:true right:true right:false right:false,left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | | | a,j | ab,bdehi,ij,ij | depart,turn right,end of road right,arrive | ,right:true right:true right:false right:false;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | |
| a,l | ab,bdehi,bdehi,il,il | depart,turn right,use lane straight,turn left,arrive | ,right:false right:false right:true right:true,left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | not perfect | | a,l | ab,bdehi,il,il | depart,turn right,end of road left,arrive | ,right:false right:false right:true right:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | not perfect |
| c,g | cb,bdehi,eg,eg | depart,turn left,turn left,arrive | ,left:true left:true left:false left:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | | | c,g | cb,bdehi,eg,eg | depart,turn left,turn left,arrive | ,left:true left:true left:false left:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | |
| c,f | cb,bdehi,ef,ef | depart,turn left,turn right,arrive | ,left:false left:false left:true left:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | | | c,f | cb,bdehi,ef,ef | depart,turn left,turn right,arrive | ,left:false left:false left:true left:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | |
| c,l | cb,bdehi,bdehi,il,il | depart,turn left,use lane straight,turn left,arrive | ,left:false left:false left:true left:true,left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | | | c,l | cb,bdehi,il,il | depart,turn left,end of road left,arrive | ,left:false left:false left:true left:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | |
| c,j | cb,bdehi,bdehi,ij,ij | depart,turn left,use lane straight,turn right,arrive | ,left:true left:true left:false left:false,left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | not perfect | | c,j | cb,bdehi,ij,ij | depart,turn left,end of road right,arrive | ,left:true left:true left:false left:false;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | not perfect |
@anticipate @anticipate
Scenario: Anticipate Lanes for turns with through before and after Scenario: Anticipate Lanes for turns with through before and after
@ -431,11 +431,11 @@ Feature: Turn Lane Guidance
| jk | | bot | primary | yes | | jk | | bot | primary | yes |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,i | top,main,main,top,top | depart,turn right,use lane straight,turn left,arrive | ,straight:false right:false right:true right:true,left:false straight:true straight:true straight:false straight:false right:false,left:true left:true right:false right:false, | | a,i | top,main,top,top | depart,turn right,turn left,arrive | ,straight:false right:true right:true right:true;;left:false straight:true straight:true straight:false straight:false right:false,left:true left:true right:false right:false, |
| a,k | top,main,main,bot,bot | depart,turn right,use lane straight,turn right,arrive | ,straight:false right:true right:true right:false,left:false straight:false straight:false straight:true straight:true right:false,left:false left:false right:true right:true, | | a,k | top,main,bot,bot | depart,turn right,turn right,arrive | ,straight:false right:true right:true right:true;;left:false straight:false straight:false straight:true straight:true right:false,left:false left:false right:true right:true, |
| c,i | bot,main,main,top,top | depart,turn left,use lane straight,turn left,arrive | ,left:false left:true left:true straight:false,left:false straight:true straight:true straight:false straight:false right:false,left:true left:true right:false right:false, | | c,i | bot,main,top,top | depart,turn left,turn left,arrive | ,left:true left:true left:true straight:false;;left:false straight:true straight:true straight:false straight:false right:false,left:true left:true right:false right:false, |
| c,k | bot,main,main,bot,bot | depart,turn left,use lane straight,turn right,arrive | ,left:true left:true left:false straight:false,left:false straight:false straight:false straight:true straight:true right:false,left:false left:false right:true right:true, | | c,k | bot,main,bot,bot | depart,turn left,turn right,arrive | ,left:true left:true left:true straight:false;;left:false straight:false straight:false straight:true straight:true right:false,left:false left:false right:true right:true, |
@anticipate @anticipate
Scenario: Anticipate Lanes for turn between throughs Scenario: Anticipate Lanes for turn between throughs
@ -462,8 +462,8 @@ Feature: Turn Lane Guidance
| dt | | off | | dt | | off |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,e | main,main,main,main | depart,use lane straight,continue right,arrive | ,left:false straight:false straight:false straight:false straight:true straight:true right:false,straight:false straight:false right:false right:true right:true, | | a,e | main,main,main | depart,continue right,arrive | ;left:false straight:false straight:false straight:false straight:true straight:true right:false,straight:false straight:false right:false right:true right:true;left:false straight:true straight:true, |
@anticipate @todo @2661 @anticipate @todo @2661
Scenario: Anticipate with lanes in roundabout: roundabouts as the unit of anticipation Scenario: Anticipate with lanes in roundabout: roundabouts as the unit of anticipation
@ -520,8 +520,8 @@ Feature: Turn Lane Guidance
| df | | primary | | | df | | primary | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes | intersection_lanes |
| a,f | ab,df,df | depart,roundabout-exit-1,use lane slight right,arrive | ,,slight left:false slight left:false slight right:true, | | a,f | ab,df,df | depart,roundabout-exit-1,arrive | ,, | |
@anticipate @anticipate
Scenario: No Lanes for Roundabouts, see #2626 Scenario: No Lanes for Roundabouts, see #2626
@ -553,8 +553,8 @@ Feature: Turn Lane Guidance
| fy | | primary | | | fy | | primary | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,h | ab,gh,gh | depart,roundabout-exit-5,arrive | ,, | | a,h | ab,gh,gh | depart,roundabout-exit-5,arrive | ,;;;;;, |
@anticipate @anticipate
Scenario: No Lanes for Roundabouts, see #2626 Scenario: No Lanes for Roundabouts, see #2626
@ -576,9 +576,9 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| x,y | xb,dy,dy | depart,roundabout-exit-1,arrive | ,, | | x,y | xb,dy,dy | depart,roundabout-exit-1,arrive | ,;, |
| x,c | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, | | x,c | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, |
| x,a | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, | | x,a | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,;, |
@anticipate @anticipate
Scenario: No Lanes for Roundabouts, see #2626 Scenario: No Lanes for Roundabouts, see #2626
@ -614,8 +614,8 @@ Feature: Turn Lane Guidance
| fy | | primary | | | fy | | primary | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,h | ab,ch,ch | depart,roundabout-exit-5,arrive | ,, | | a,h | ab,ch,ch | depart,roundabout-exit-5,arrive | ,;;;;;, |
@anticipate @anticipate
Scenario: No Lanes for Roundabouts, see #2626 Scenario: No Lanes for Roundabouts, see #2626
@ -623,40 +623,11 @@ Feature: Turn Lane Guidance
""" """
/a\ /a\
x b d y x b d y
| |
| |
| |
| |
| |
| |
| |
| |
| | | |
| | | |
| | | |
| | | |
| | \ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
|
|
|
|
|
|
|
|
c c
""" """
@ -671,9 +642,9 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| x,y | xb,dy,dy | depart,roundabout-exit-1,arrive | ,, | | x,y | xb,dy,dy | depart,roundabout-exit-1,arrive | ,;, |
| x,c | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, | | x,c | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, |
| x,a | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, | | x,a | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,;, |
@anticipate @todo @2032 @anticipate @todo @2032
Scenario: No Lanes for Roundabouts, see #2626 Scenario: No Lanes for Roundabouts, see #2626
@ -789,13 +760,6 @@ Feature: Turn Lane Guidance
Given the node map Given the node map
""" """
a b x a b x
|
|
|
|
|
|
|
| |
| |
| |
@ -823,11 +787,9 @@ Feature: Turn Lane Guidance
Scenario: Don't Overdo It Scenario: Don't Overdo It
Given the node map Given the node map
""" """
q r s t u v q r s t u v
| | | | | | a - - b - - c - - d - - e - - f - g - h - i
a - - - - - - - - - - b - - - - - - - - - - c - - - - - - - - - - d - - - - - - - - - - e - - - - - - - - - - f - - - - - - - - - - g - h - i p o n m l k j
| | | | | | |
p o n m l k j
""" """
And the ways And the ways
@ -849,6 +811,6 @@ Feature: Turn Lane Guidance
| hj | 7th | | no | | hj | 7th | | no |
When I route I should get When I route I should get
| waypoints | route | turns | locations | lanes | | waypoints | route | turns | locations | lanes |
| a,i | road,road,road | depart,use lane straight,arrive | a,g,i | ,left:false none:true none:true none:false, | | a,i | road,road | depart,arrive | a,i | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:false;none:true none:true right:false, |
| a,j | road,road,7th,7th | depart,use lane straight,turn right,arrive | a,f,h,j | ,left:false none:false none:false none:true,none:false none:false right:true, | | a,j | road,7th,7th | depart,turn right,arrive | a,h,j | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:false none:false none:true;left:false none:false none:false none:true,none:false none:false right:true, |

View File

@ -807,8 +807,8 @@ Feature: Collapse
| di | | off | | di | | off |
When I route I should get When I route I should get
| waypoints | route | turns | locations | | waypoints | route | turns | locations | lanes |
| a,e | main,main,main | depart,use lane straight,arrive | a,c,e | | a,e | main,main | depart,arrive | a,e | ;left:false straight:false straight:true straight:false right:false;left:false straight:true right:false, |
Scenario: But _do_ collapse UseLane step when lanes stay the same Scenario: But _do_ collapse UseLane step when lanes stay the same
Given the node map Given the node map

View File

@ -41,8 +41,8 @@ Feature: Exit Numbers and Names
| ef | motorway_link | ExitRamp | | | ef | motorway_link | ExitRamp | |
When I route I should get When I route I should get
| waypoints | route | turns | exits | | waypoints | route | turns | exits |
| a,f | MainRoad,ExitRamp,ExitRamp | depart,off ramp slight right,arrive | ,10;12, | | a,f | MainRoad,ExitRamp,ExitRamp | depart,off ramp slight right,arrive | ,10; 12, |
Scenario: Exit number on the ways after the motorway junction, multiple exits Scenario: Exit number on the ways after the motorway junction, multiple exits

View File

@ -261,3 +261,23 @@ Feature: Motorway Guidance
When I route I should get When I route I should get
| waypoints | route | turns | | waypoints | route | turns |
| a,d | On,Hwy,Off,Off | depart,merge slight right,off ramp right,arrive | | a,d | On,Hwy,Off,Off | depart,merge slight right,off ramp right,arrive |
#http://0.0.0.0:9966/?z=18&center=38.893323%2C-77.055117&loc=38.893551%2C-77.054833&loc=38.893112%2C-77.055536&hl=en&alt=0
Scenario: Merging with same name
Given the node map
"""
a - - -
> c - d
b
"""
And the ways
| nodes | name | ref | highway | oneway |
| ac | | US 50 | motorway | yes |
| bc | | I 66 | motorway | yes |
| cd | | US 50; I 66 | motorway | yes |
When I route I should get
| waypoints | route | turns |
| a,d | , | depart,arrive |
| b,d | , | depart,arrive |

View File

@ -606,11 +606,11 @@ Feature: Basic Roundabout
| ob | trunk | yes | roundabout | Europaplatz | | | ob | trunk | yes | roundabout | Europaplatz | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns |
| a,d | ,Europastrasse,Europastrasse | depart,Europaplatz-exit-1,arrive | ,, | | a,d | ,Europastrasse,Europastrasse | depart,Europaplatz-exit-1,arrive |
| a,h | ,Allee Cite,Allee Cite | depart,Europaplatz-exit-2,arrive | ,, | | a,h | ,Allee Cite,Allee Cite | depart,Europaplatz-exit-2,arrive |
| a,l | ,Europastrasse,Europastrasse | depart,Europaplatz-exit-3,arrive | ,, | | a,l | ,Europastrasse,Europastrasse | depart,Europaplatz-exit-3,arrive |
| a,p | ,, | depart,Europaplatz-exit-4,arrive | ,, | | a,p | ,, | depart,Europaplatz-exit-4,arrive |
@turboroundabout @turboroundabout
# http://www.openstreetmap.org/?mlat=50.180039&mlon=8.474939&zoom=16#map=19/50.17999/8.47506 # http://www.openstreetmap.org/?mlat=50.180039&mlon=8.474939&zoom=16#map=19/50.17999/8.47506
@ -658,14 +658,14 @@ Feature: Basic Roundabout
| wb | primary | yes | roundabout | | through\|through;right | | wb | primary | yes | roundabout | | through\|through;right |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns |
| a,w | Le-Cannet-Rocheville-Strasse,, | depart,roundabout-exit-undefined,arrive | ,, | | a,w | Le-Cannet-Rocheville-Strasse,, | depart,roundabout-exit-undefined,arrive |
| a,r | Le-Cannet-Rocheville-Strasse,, | depart,roundabout-exit-4,arrive | ,, | | a,r | Le-Cannet-Rocheville-Strasse,, | depart,roundabout-exit-4,arrive |
| a,f | Le-Cannet-Rocheville-Strasse,Frankfurter Strasse,Frankfurter Strasse | depart,roundabout-exit-1,arrive | ,, | | a,f | Le-Cannet-Rocheville-Strasse,Frankfurter Strasse,Frankfurter Strasse | depart,roundabout-exit-1,arrive |
| a,h | Le-Cannet-Rocheville-Strasse,Bischof-Kaller-Strasse,Bischof-Kaller-Strasse | depart,roundabout-exit-2,arrive | ,, | | a,h | Le-Cannet-Rocheville-Strasse,Bischof-Kaller-Strasse,Bischof-Kaller-Strasse | depart,roundabout-exit-2,arrive |
| u,r | ,, | depart,roundabout-exit-5,arrive | ,, | | u,r | ,, | depart,roundabout-exit-5,arrive |
| j,h | Bischof-Kaller-Strasse,Bischof-Kaller-Strasse,Bischof-Kaller-Strasse | depart,roundabout-exit-5,arrive | ,, | | j,h | Bischof-Kaller-Strasse,Bischof-Kaller-Strasse,Bischof-Kaller-Strasse | depart,roundabout-exit-5,arrive |
| n,m | , | depart,arrive | , | | n,m | , | depart,arrive |
@turboroundabout @turboroundabout
# http://www.openstreetmap.org/?mlat=47.57723&mlon=7.796765&zoom=16#map=19/47.57720/7.79711 # http://www.openstreetmap.org/?mlat=47.57723&mlon=7.796765&zoom=16#map=19/47.57720/7.79711

View File

@ -156,7 +156,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,d | road,turn,turn | depart,turn right,arrive | ,straight:false right:true, | | a,d | road,turn,turn | depart,turn right,arrive | ,straight:false right:true, |
| a,c | road,road | depart,arrive | , | | a,c | road,road | depart,arrive | ;straight:true right:false, |
Scenario: Turn with Bus-Lane Left Scenario: Turn with Bus-Lane Left
Given the node map Given the node map
@ -178,7 +178,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,d | road,turn,turn | depart,turn left,arrive | ,left:true straight:false, | | a,d | road,turn,turn | depart,turn left,arrive | ,left:true straight:false, |
| a,c | road,road | depart,arrive | , | | a,c | road,road | depart,arrive | ;left:false straight:true, |
# This tests whether empty/invalid PSV tags cause osrm-extract to crash # This tests whether empty/invalid PSV tags cause osrm-extract to crash
Scenario: Turn with Bus-Lane Scenario: Turn with Bus-Lane
@ -248,23 +248,23 @@ Feature: Turn Lane Guidance
| fl | cross | | yes | | fl | cross | | yes |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes | intersection_lanes |
| a,j | road,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true | | a,j | road,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true | ,left:false straight:false right:true |
| a,d | road,road,road | depart,use lane straight,arrive | ,left:false straight:true right:false, | | a,d | road,road | depart,arrive | , | left:false straight:true right:false, |
| a,l | road,cross,cross | depart,turn left,arrive | ,left:true straight:false right:false, | | a,l | road,cross,cross | depart,turn left,arrive | ,left:true straight:false right:false, | ,left:true straight:false right:false, |
| a,h | road,road,road | depart,continue uturn,arrive | ,left:true straight:false right:false, | | a,h | road,road,road | depart,continue uturn,arrive | ,left:true straight:false right:false, | ,left:true straight:false right:false |
| k,d | cross,road,road | depart,turn right,arrive | ,left:false straight;right:true, | | k,d | cross,road,road | depart,turn right,arrive | ,left:false straight;right:true, | ,left:false straight;right:true, |
| k,l | cross,cross,cross | depart,use lane straight,arrive | ,left:false straight;right:true, | | k,l | cross,cross | depart,arrive | , | left:false straight;right:true, |
| k,h | cross,road,road | depart,turn left,arrive | ,left:true straight;right:false, | | k,h | cross,road,road | depart,turn left,arrive | ,left:true straight;right:false, | ,left:true straight;right:false, |
| k,j | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight;right:false, | | k,j | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight;right:false, | ,left:true straight;right:false, |
| e,l | road,cross,cross | depart,turn right,arrive | ,none:false straight:false straight;right:true, | | e,l | road,cross,cross | depart,turn right,arrive | ,none:false straight:false straight;right:true, | ,none:false straight:false straight;right:true, |
| e,h | road,road | depart,arrive | ,none:false straight:true straight;right:true | | e,h | road,road | depart,arrive | , | none:false straight:true straight;right:true, |
| e,j | road,cross,cross | depart,turn left,arrive | ,none:true straight:false straight;right:false, | | e,j | road,cross,cross | depart,turn left,arrive | ,none:true straight:false straight;right:false, | ,none:true straight:false straight;right:false, |
| e,d | road,road,road | depart,continue uturn,arrive | ,none:true straight:false straight;right:false, | | e,d | road,road,road | depart,continue uturn,arrive | ,none:true straight:false straight;right:false, | ,none:true straight:false straight;right:false, |
| i,h | cross,road,road | depart,turn right,arrive | ,, | | i,h | cross,road,road | depart,turn right,arrive | ,, | |
| i,j | cross,cross,cross | depart,use lane straight,arrive | ,left:false straight:true, | | i,j | cross,cross | depart,arrive | | left:false straight:true, |
| i,d | cross,road,road | depart,turn left,arrive | ,left:true straight:false, | | i,d | cross,road,road | depart,turn left,arrive | ,left:true straight:false, | ,left:true straight:false, |
| i,l | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight:false, | | i,l | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight:false, | ,left:true straight:false, |
#copy of former case to prevent further regression #copy of former case to prevent further regression
@collapse @partition-lanes @collapse @partition-lanes
@ -295,13 +295,13 @@ Feature: Turn Lane Guidance
| fl | cross | | yes | | fl | cross | | yes |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,j | road,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true, | | a,j | road,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true, |
| k,d | cross,road,road | depart,turn right,arrive | ,left:false straight;right:true, | | k,d | cross,road,road | depart,turn right,arrive | ,left:false straight;right:true, |
| e,l | road,cross,cross | depart,turn right,arrive | ,none:false straight:false straight;right:true, | | e,l | road,cross,cross | depart,turn right,arrive | ,none:false straight:false straight;right:true, |
| i,h | cross,road,road | depart,turn right,arrive | ,, | | i,h | cross,road,road | depart,turn right,arrive | ,, |
| i,j | cross,cross | depart,arrive | , | | i,j | cross,cross | depart,arrive | ;;left:false straight:true, |
| i,l | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight:false, | | i,l | cross,cross,cross | depart,continue uturn,arrive | ;,left:true straight:false;left:true straight:false;left:false straight:true, |
@partition-lanes @partition-lanes
Scenario: Turn Lanes at Segregated Road Scenario: Turn Lanes at Segregated Road
@ -347,7 +347,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,e | road,turn,turn | depart,turn right,arrive | ,none:false right:true, | | a,e | road,turn,turn | depart,turn right,arrive | ,none:false right:true, |
| a,d | road,road | depart,arrive | , | | a,d | road,road | depart,arrive | ;none:true right:false, |
@2654 @previous-lanes @2654 @previous-lanes
Scenario: Turn Lanes Given earlier than actual turn Scenario: Turn Lanes Given earlier than actual turn
@ -368,11 +368,11 @@ Feature: Turn Lane Guidance
| hk | second-turn | | | | hk | second-turn | | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,k | road,second-turn,second-turn | depart,turn right,arrive | ,none:false right:true, | | a,k | road,second-turn,second-turn | depart,turn right,arrive | ;,none:false right:true, |
| a,i | road,road | depart,arrive | , | | a,i | road,road | depart,arrive | ;;none:true right:false, |
| i,j | road,first-turn,first-turn | depart,turn left,arrive | ,left:true none:false, | | i,j | road,first-turn,first-turn | depart,turn left,arrive | ;,left:true none:false, |
| i,a | road,road | depart,arrive | , | | i,a | road,road | depart,arrive | ;;left:false none:true, |
@previous-lanes @previous-lanes
Scenario: Passing a one-way street Scenario: Passing a one-way street
@ -390,8 +390,8 @@ Feature: Turn Lane Guidance
| cf | turn | | | | cf | turn | | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,f | road,turn,turn | depart,turn left,arrive | ,left:true straight:false, | | a,f | road,turn,turn | depart,turn left,arrive | ;left:true straight:false,left:true straight:false, |
@partition-lanes @partition-lanes
Scenario: Passing a one-way street, partly pulled back lanes Scenario: Passing a one-way street, partly pulled back lanes
@ -411,10 +411,10 @@ Feature: Turn Lane Guidance
| bg | right | | no | | bg | right | | no |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,f | road,turn,turn | depart,turn left,arrive | ,left:true straight;right:false, | | a,f | road,turn,turn | depart,turn left,arrive | ;left:true straight;right:false,left:true straight;right:false, |
| a,d | road,road | depart,arrive | , | | a,d | road,road | depart,arrive | ;left:false straight;right:true;left:false straight;right:true, |
| a,g | road,right,right | depart,turn right,arrive | ,left:false straight;right:true, | | a,g | road,right,right | depart,turn right,arrive | ,left:false straight;right:true, |
@partition-lanes @previous-lanes @partition-lanes @previous-lanes
Scenario: Passing a one-way street, partly pulled back lanes, no through Scenario: Passing a one-way street, partly pulled back lanes, no through
@ -434,9 +434,9 @@ Feature: Turn Lane Guidance
| bg | right | | no | | bg | right | | no |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,f | road,turn,turn | depart,turn left,arrive | ,left:true right:false, | | a,f | road,turn,turn | depart,turn left,arrive | ,left:true right:false;left:true right:false, |
| a,g | road,right,right | depart,turn right,arrive | ,left:false right:true, | | a,g | road,right,right | depart,turn right,arrive | ,left:false right:true, |
@todo @partition-lanes @previous-lanes @todo @partition-lanes @previous-lanes
Scenario: Narrowing Turn Lanes Scenario: Narrowing Turn Lanes
@ -484,7 +484,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,d | road,road | depart,arrive | , | | a,d | road,road | depart,arrive | ;straight:true right:false, |
| a,e | road,turn,turn | depart,turn right,arrive | ,straight:false right:true, | | a,e | road,turn,turn | depart,turn right,arrive | ,straight:false right:true, |
@todo @roundabout @todo @roundabout
@ -554,9 +554,9 @@ Feature: Turn Lane Guidance
| restriction | bc | dc | c | no_right_turn | | restriction | bc | dc | c | no_right_turn |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,g | road,cross,cross | depart,turn left,arrive | ,left:true left:true straight:false straight:false right:false, | | a,g | road,cross,cross | depart,turn left,arrive | ,left:true left:true straight:false straight:false right:false;left:true left:true straight:false straight:false right:false, |
| a,e | road,road | depart,arrive | , | | a,e | road,road | depart,arrive | ;left:false left:false straight:true straight:true right:false;left:false left:false straight:true straight:true right:false, |
#NEEDS TO BE INVESTIGATED. Turn restriction shouldn't be here. See #2867 #NEEDS TO BE INVESTIGATED. Turn restriction shouldn't be here. See #2867
@reverse @previous-lanes @reverse @previous-lanes
@ -589,11 +589,11 @@ Feature: Turn Lane Guidance
| restriction | de | ef | e | no_left_turn | | restriction | de | ef | e | no_left_turn |
When I route I should get When I route I should get
| from | to | bearings | route | turns | lanes | | from | to | bearings | route | turns | lanes |
| a | g | 180,180 180,180 | road,cross,cross | depart,turn right,arrive | ,none:false straight:false right:true, | | a | g | 180,180 180,180 | road,cross,cross | depart,turn right,arrive | ;none:false straight:false right:true,none:false straight:false right:true, |
| a | h | 180,180 180,180 | road,cross,cross | depart,turn left,arrive | ,none:true straight:false right:false, | | a | h | 180,180 180,180 | road,cross,cross | depart,turn left,arrive | ;none:true straight:false right:false,none:true straight:false right:false;, |
| a | i | 180,180 180,180 | road,road | depart,arrive | , | | a | i | 180,180 180,180 | road,road | depart,arrive | ;none:true straight:true right:false;none:true straight:true right:false, |
| b | a | 90,2 270,2 | road,road,road | depart,continue uturn,arrive | ,none:true straight:false right:false, | | b | a | 90,2 270,2 | road,road,road | depart,continue uturn,arrive | ,none:true straight:false right:false;, |
@reverse @reverse
Scenario: Segregated Intersection Merges With Lanes Scenario: Segregated Intersection Merges With Lanes
@ -681,7 +681,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,d | road,road | depart,arrive | , | | a,d | road,road | depart,arrive | ;straight:true straight:true straight;slight right:true slight right:false, |
| a,e | road,cross,cross | depart,turn slight right,arrive | ,straight:false straight:false straight;slight right:true slight right:true, | | a,e | road,cross,cross | depart,turn slight right,arrive | ,straight:false straight:false straight;slight right:true slight right:true, |
@ramp @ramp
@ -700,7 +700,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,d | hwy,hwy | depart,arrive | , | | a,d | hwy,hwy | depart,arrive | ;straight:true straight:true straight;slight right:true slight right:false, |
| a,e | hwy,ramp,ramp | depart,off ramp slight right,arrive | ,straight:false straight:false straight;slight right:true slight right:true, | | a,e | hwy,ramp,ramp | depart,off ramp slight right,arrive | ,straight:false straight:false straight;slight right:true slight right:true, |
@todo @todo
@ -745,7 +745,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,c | hwy,hwy | depart,arrive | , | | a,c | hwy,hwy | depart,arrive | ;straight:true straight:true slight right:false, |
| a,d | hwy,ramp,ramp | depart,off ramp slight right,arrive | ,straight:false straight:false slight right:true, | | a,d | hwy,ramp,ramp | depart,off ramp slight right,arrive | ,straight:false straight:false slight right:true, |
@reverse @reverse
@ -766,8 +766,8 @@ Feature: Turn Lane Guidance
| fgh | road | | primary | yes | | fgh | road | | primary | yes |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false straight:false,| | a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false straight:false;,|
@reverse @reverse
Scenario: Reverse Lane in Segregated Road with none Scenario: Reverse Lane in Segregated Road with none
@ -787,8 +787,8 @@ Feature: Turn Lane Guidance
| fgh | road | | primary | yes | | fgh | road | | primary | yes |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false none:false, | | a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false none:false;, |
@reverse @reverse
Scenario: Reverse Lane in Segregated Road with none, Service Turn Prior Scenario: Reverse Lane in Segregated Road with none, Service Turn Prior
@ -810,8 +810,8 @@ Feature: Turn Lane Guidance
| ji | park | | service | no | | ji | park | | service | no |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false none:false, | | a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false none:false;, |
@simple @simple
Scenario: Don't collapse everything to u-turn / too wide Scenario: Don't collapse everything to u-turn / too wide
@ -873,9 +873,9 @@ Feature: Turn Lane Guidance
| ab | on | motorway_link | | | ab | on | motorway_link | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,j | on,xbcj | depart,arrive | , | | a,j | on,xbcj | depart,arrive | ;;none:true slight right:false, |
| a,i | on,off,off | depart,turn right,arrive | ,none:false slight right:true, | | a,i | on,off,off | depart,turn right,arrive | ;,none:false slight right:true, |
#http://www.openstreetmap.org/#map=17/52.47414/13.35712 #http://www.openstreetmap.org/#map=17/52.47414/13.35712
@todo @ramp @2645 @todo @ramp @2645
@ -929,8 +929,8 @@ Feature: Turn Lane Guidance
| cf | turn | primary | | | cf | turn | primary | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| x,d | road,road | depart,arrive | , | | x,d | road,road | depart,arrive | ;straight;right:true;straight;right:true, |
@partition-lanes @partition-lanes
Scenario: Partitioned turn, Slight Curve - maxspeed Scenario: Partitioned turn, Slight Curve - maxspeed
@ -952,9 +952,9 @@ Feature: Turn Lane Guidance
| dce | cross | primary | yes | | 1 | | dce | cross | primary | yes | | 1 |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | locations | | waypoints | route | turns | lanes | locations |
| a,g | road,cross,cross | depart,turn right,arrive | ,left:false right:true, | a,b,g | | a,g | road,cross,cross | depart,turn right,arrive | ,left:false right:true, | a,b,g |
| a,e | road,cross,cross | depart,end of road left,arrive | ,left:true right:false, | a,c,e | | a,e | road,cross,cross | depart,end of road left,arrive | ;left:true right:false,left:true right:false, | a,c,e |
Scenario: Partitioned turn, Slight Curve Scenario: Partitioned turn, Slight Curve
Given the node map Given the node map
@ -975,9 +975,9 @@ Feature: Turn Lane Guidance
| dce | cross | primary | yes | | | dce | cross | primary | yes | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | locations | | waypoints | route | turns | lanes | locations |
| a,g | road,cross,cross | depart,turn right,arrive | ,left:false right:true, | a,b,g | | a,g | road,cross,cross | depart,turn right,arrive | ,left:false right:true, | a,b,g |
| a,e | road,cross,cross | depart,end of road left,arrive | ,left:true right:false, | a,c,e | | a,e | road,cross,cross | depart,end of road left,arrive | ;left:true right:false,left:true right:false, | a,c,e |
Scenario: Lane Parsing Issue #2694 Scenario: Lane Parsing Issue #2694
Given the node map Given the node map
@ -1193,7 +1193,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,e | road,cross,cross | depart,turn right,arrive | ,left:false none:false none:true, | | a,e | road,cross,cross | depart,turn right,arrive | ,left:false none:false none:true, |
| a,c | road,road | depart,arrive | , | | a,c | road,road | depart,arrive | ;left:false none:true none:true, |
@3379 @3379
Scenario: Don't Turn through potential through lanes Scenario: Don't Turn through potential through lanes
@ -1214,7 +1214,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,d | road,cross,cross | depart,turn left,arrive | ,none:true none:false right:false, | | a,d | road,cross,cross | depart,turn left,arrive | ,none:true none:false right:false, |
| a,c | road,road | depart,arrive | , | | a,c | road,road | depart,arrive | ;none:true none:true right:false, |
@4189 @4189
Scenario: U-turn after a traffic light Scenario: U-turn after a traffic light
@ -1242,5 +1242,5 @@ Feature: Turn Lane Guidance
| mdhk | road2 | 2 | | yes | | mdhk | road2 | 2 | | yes |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | locations | | waypoints | route | turns | lanes | locations |
| a,f | road1,road1,road1 | depart,continue uturn,arrive | ,left:true straight:false straight;right:false, | a,d,f | | a,f | road1,road1,road1 | depart,continue uturn,arrive | ;left:false straight:true straight;right:false,left:true straight:false straight;right:false;;, | a,d,f |

View File

@ -171,6 +171,24 @@ module.exports = function () {
('out' in s.intersections[0] ? s.intersections[0].bearings[s.intersections[0].out] : 0)); ('out' in s.intersections[0] ? s.intersections[0].bearings[s.intersections[0].out] : 0));
}; };
this.lanesList = (instructions) => {
return this.extractInstructionList(instructions, s => {
return s.intersections.map( i => {
if(i.lanes)
{
return i.lanes.map( l => {
let indications = l.indications.join(';');
return indications + ':' + (l.valid ? 'true' : 'false');
}).join(' ');
}
else
{
return '';
}
}).join(';');
});
};
this.approachList = (instructions) => { this.approachList = (instructions) => {
return this.extractInstructionList(instructions, s => s.approaches || ''); return this.extractInstructionList(instructions, s => s.approaches || '');
}; };
@ -197,17 +215,6 @@ module.exports = function () {
return instructions.tracepoints.map(t => t.alternatives_count.toString()).join(','); return instructions.tracepoints.map(t => t.alternatives_count.toString()).join(',');
}; };
this.lanesList = (instructions) => {
return this.extractInstructionList(instructions, instruction => {
if( 'lanes' in instruction.intersections[0] )
{
return instruction.intersections[0].lanes.map( p => { return (p.indications).join(';') + ':' + p.valid; } ).join(' ');
} else
{
return '';
}});
};
this.turnList = (instructions) => { this.turnList = (instructions) => {
return instructions.legs.reduce((m, v) => m.concat(v.steps), []) return instructions.legs.reduce((m, v) => m.concat(v.steps), [])
.map(v => { .map(v => {
@ -261,7 +268,7 @@ module.exports = function () {
}; };
this.classesList = (instructions) => { this.classesList = (instructions) => {
return this.extractInstructionList(instructions, s => s.classes ? s.classes.join(';') : ''); return this.extractInstructionList(instructions, s => '[' + s.intersections.map(i => '(' + (i.classes ? i.classes.join(',') : '') + ')').join(',') + ']');
}; };
this.timeList = (instructions) => { this.timeList = (instructions) => {

View File

@ -0,0 +1,30 @@
@routing @speed @annotations @turn_penalty
Feature: Annotations
Background:
Given the profile "turnbot"
Given a grid size of 100 meters
Scenario: Ensure that turn penalties aren't included in annotations
Given the node map
"""
h i
j k l m
"""
And the query options
| annotations | duration,speed,weight |
And the ways
| nodes | highway |
| hk | residential |
| il | residential |
| jk | residential |
| lk | residential |
| lm | residential |
When I route I should get
| from | to | route | a:speed | a:weight |
| h | j | hk,jk,jk | 6.7:6.7 | 15:15 |
| i | m | il,lm,lm | 6.7:6.7 | 15:15 |
| j | m | jk,lm | 6.7:6.7:6.7 | 15:15:15 |

View File

@ -14,8 +14,6 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <stxxl/vector>
#include <tbb/enumerable_thread_specific.h> #include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h> #include <tbb/parallel_for.h>
#include <tbb/parallel_sort.h> #include <tbb/parallel_sort.h>
@ -25,6 +23,10 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#if USE_STXXL_LIBRARY
#include <stxxl/vector>
#endif
namespace osrm namespace osrm
{ {
namespace contractor namespace contractor
@ -33,6 +35,12 @@ namespace contractor
class GraphContractor class GraphContractor
{ {
private: private:
#if USE_STXXL_LIBRARY
template <typename T> using ExternalVector = stxxl::vector<T>;
#else
template <typename T> using ExternalVector = std::vector<T>;
#endif
struct ContractorThreadData struct ContractorThreadData
{ {
ContractorDijkstra dijkstra; ContractorDijkstra dijkstra;
@ -401,7 +409,7 @@ class GraphContractor
bool Bias(const NodeID a, const NodeID b) const; bool Bias(const NodeID a, const NodeID b) const;
std::shared_ptr<ContractorGraph> contractor_graph; std::shared_ptr<ContractorGraph> contractor_graph;
stxxl::vector<QueryEdge> external_edge_list; ExternalVector<QueryEdge> external_edge_list;
std::vector<NodeID> orig_node_id_from_new_node_id_map; std::vector<NodeID> orig_node_id_from_new_node_id_map;
std::vector<float> node_levels; std::vector<float> node_levels;

View File

@ -174,14 +174,13 @@ class RouteAPI : public BaseAPI
guidance::trimShortSegments(steps, leg_geometry); guidance::trimShortSegments(steps, leg_geometry);
leg.steps = guidance::postProcess(std::move(steps)); leg.steps = guidance::postProcess(std::move(steps));
leg.steps = guidance::collapseTurnInstructions(std::move(leg.steps)); leg.steps = guidance::collapseTurnInstructions(std::move(leg.steps));
leg.steps = guidance::anticipateLaneChange(std::move(leg.steps));
leg.steps = guidance::buildIntersections(std::move(leg.steps)); leg.steps = guidance::buildIntersections(std::move(leg.steps));
leg.steps = guidance::suppressShortNameSegments(std::move(leg.steps)); leg.steps = guidance::suppressShortNameSegments(std::move(leg.steps));
leg.steps = guidance::assignRelativeLocations(std::move(leg.steps), leg.steps = guidance::assignRelativeLocations(std::move(leg.steps),
leg_geometry, leg_geometry,
phantoms.source_phantom, phantoms.source_phantom,
phantoms.target_phantom); phantoms.target_phantom);
leg.steps = guidance::anticipateLaneChange(std::move(leg.steps));
leg.steps = guidance::collapseUseLane(std::move(leg.steps));
leg_geometry = guidance::resyncGeometry(std::move(leg_geometry), leg.steps); leg_geometry = guidance::resyncGeometry(std::move(leg_geometry), leg.steps);
} }

View File

@ -78,11 +78,19 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
} }
prev_coordinate = coordinate; prev_coordinate = coordinate;
geometry.annotations.emplace_back( geometry.annotations.emplace_back(LegGeometry::Annotation{
LegGeometry::Annotation{current_distance, current_distance,
path_point.duration_until_turn / 10., // NOTE: we want annotations to include only the duration/weight
path_point.weight_until_turn / facade.GetWeightMultiplier(), // of the segment itself. For segments immediately before
path_point.datasource_id}); // a turn, the duration_until_turn/weight_until_turn values
// include the turn cost. To counter this, we subtract
// the duration_of_turn/weight_of_turn value, which is 0 for
// non-preceeding-turn segments, but contains the turn value
// for segments before a turn.
(path_point.duration_until_turn - path_point.duration_of_turn) / 10.,
(path_point.weight_until_turn - path_point.weight_of_turn) /
facade.GetWeightMultiplier(),
path_point.datasource_id});
geometry.locations.push_back(std::move(coordinate)); geometry.locations.push_back(std::move(coordinate));
geometry.osm_node_ids.push_back(facade.GetOSMNodeIDOfNode(path_point.turn_via_node)); geometry.osm_node_ids.push_back(facade.GetOSMNodeIDOfNode(path_point.turn_via_node));
} }

View File

@ -63,7 +63,6 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
: target_node.forward_segment_id.id; : target_node.forward_segment_id.id;
const auto target_name_id = facade.GetNameIndex(target_node_id); const auto target_name_id = facade.GetNameIndex(target_node_id);
const auto target_mode = facade.GetTravelMode(target_node_id); const auto target_mode = facade.GetTravelMode(target_node_id);
auto target_classes = facade.GetClasses(facade.GetClassData(target_node_id));
const auto number_of_segments = leg_geometry.GetNumberOfSegments(); const auto number_of_segments = leg_geometry.GetNumberOfSegments();
@ -88,7 +87,8 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
IntermediateIntersection::NO_INDEX, IntermediateIntersection::NO_INDEX,
0, 0,
util::guidance::LaneTuple(), util::guidance::LaneTuple(),
{}}; {},
source_classes};
if (leg_data.size() > 0) if (leg_data.size() > 0)
{ {
@ -118,7 +118,8 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
const auto destinations = facade.GetDestinationsForID(step_name_id); const auto destinations = facade.GetDestinationsForID(step_name_id);
const auto exits = facade.GetExitsForID(step_name_id); const auto exits = facade.GetExitsForID(step_name_id);
const auto distance = leg_geometry.segment_distances[segment_index]; const auto distance = leg_geometry.segment_distances[segment_index];
auto classes = facade.GetClasses(path_point.classes); // intersections contain the classes of exiting road
intersection.classes = facade.GetClasses(path_point.classes);
steps.push_back(RouteStep{step_name_id, steps.push_back(RouteStep{step_name_id,
name.to_string(), name.to_string(),
@ -135,8 +136,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
maneuver, maneuver,
leg_geometry.FrontIndex(segment_index), leg_geometry.FrontIndex(segment_index),
leg_geometry.BackIndex(segment_index) + 1, leg_geometry.BackIndex(segment_index) + 1,
{intersection}, {intersection}});
std::move(classes)});
if (leg_data_index + 1 < leg_data.size()) if (leg_data_index + 1 < leg_data.size())
{ {
@ -196,6 +196,8 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
const auto distance = leg_geometry.segment_distances[segment_index]; const auto distance = leg_geometry.segment_distances[segment_index];
const EdgeWeight duration = segment_duration + target_duration; const EdgeWeight duration = segment_duration + target_duration;
const EdgeWeight weight = segment_weight + target_weight; const EdgeWeight weight = segment_weight + target_weight;
// intersections contain the classes of exiting road
intersection.classes = facade.GetClasses(facade.GetClassData(target_node_id));
BOOST_ASSERT(duration >= 0); BOOST_ASSERT(duration >= 0);
steps.push_back(RouteStep{step_name_id, steps.push_back(RouteStep{step_name_id,
facade.GetNameForID(step_name_id).to_string(), facade.GetNameForID(step_name_id).to_string(),
@ -212,8 +214,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
maneuver, maneuver,
leg_geometry.FrontIndex(segment_index), leg_geometry.FrontIndex(segment_index),
leg_geometry.BackIndex(segment_index) + 1, leg_geometry.BackIndex(segment_index) + 1,
{intersection}, {intersection}});
std::move(target_classes)});
} }
// In this case the source + target are on the same edge segment // In this case the source + target are on the same edge segment
else else
@ -255,8 +256,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
std::move(maneuver), std::move(maneuver),
leg_geometry.FrontIndex(segment_index), leg_geometry.FrontIndex(segment_index),
leg_geometry.BackIndex(segment_index) + 1, leg_geometry.BackIndex(segment_index) + 1,
{intersection}, {intersection}});
std::move(source_classes)});
} }
BOOST_ASSERT(segment_index == number_of_segments - 1); BOOST_ASSERT(segment_index == number_of_segments - 1);
@ -269,6 +269,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
0, 0,
IntermediateIntersection::NO_INDEX, IntermediateIntersection::NO_INDEX,
util::guidance::LaneTuple(), util::guidance::LaneTuple(),
{},
{}}; {}};
// This step has length zero, the only reason we need it is the target location // This step has length zero, the only reason we need it is the target location
@ -295,8 +296,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
std::move(maneuver), std::move(maneuver),
leg_geometry.locations.size() - 1, leg_geometry.locations.size() - 1,
leg_geometry.locations.size(), leg_geometry.locations.size(),
{intersection}, {intersection}});
std::move(target_classes)});
BOOST_ASSERT(steps.front().intersections.size() == 1); BOOST_ASSERT(steps.front().intersections.size() == 1);
BOOST_ASSERT(steps.front().intersections.front().bearings.size() == 1); BOOST_ASSERT(steps.front().intersections.front().bearings.size() == 1);

View File

@ -20,7 +20,7 @@ namespace guidance
// as separate maneuvers. // as separate maneuvers.
OSRM_ATTR_WARN_UNUSED OSRM_ATTR_WARN_UNUSED
std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps, std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
const double min_duration_needed_for_lane_change = 10); const double min_distance_needed_for_lane_change = 200);
} // namespace guidance } // namespace guidance
} // namespace engine } // namespace engine

View File

@ -38,8 +38,12 @@ struct LegGeometry
struct Annotation struct Annotation
{ {
double distance; // distance in meters double distance; // distance in meters
double duration; // duration in seconds
double weight; // weight value // Total duration of a segment, in seconds, NOT including
// the turn penalty if the segment preceeds a turn
double duration;
double weight; // weight value, NOT including the turn weight
DatasourceID datasource; DatasourceID datasource;
}; };
std::vector<Annotation> annotations; std::vector<Annotation> annotations;

View File

@ -42,6 +42,7 @@ struct IntermediateIntersection
// turn lane information // turn lane information
util::guidance::LaneTuple lanes; util::guidance::LaneTuple lanes;
extractor::guidance::TurnLaneDescription lane_description; extractor::guidance::TurnLaneDescription lane_description;
std::vector<std::string> classes;
}; };
inline IntermediateIntersection getInvalidIntersection() inline IntermediateIntersection getInvalidIntersection()
@ -52,6 +53,7 @@ inline IntermediateIntersection getInvalidIntersection()
IntermediateIntersection::NO_INDEX, IntermediateIntersection::NO_INDEX,
IntermediateIntersection::NO_INDEX, IntermediateIntersection::NO_INDEX,
util::guidance::LaneTuple(), util::guidance::LaneTuple(),
{},
{}}; {}};
} }
@ -74,7 +76,6 @@ struct RouteStep
std::size_t geometry_begin; std::size_t geometry_begin;
std::size_t geometry_end; std::size_t geometry_end;
std::vector<IntermediateIntersection> intersections; std::vector<IntermediateIntersection> intersections;
std::vector<std::string> classes;
// remove all information from the route step, marking it as invalid (used to indicate empty // remove all information from the route step, marking it as invalid (used to indicate empty
// steps to be removed). // steps to be removed).
@ -128,7 +129,6 @@ inline void RouteStep::Invalidate()
geometry_end = 0; geometry_end = 0;
intersections.clear(); intersections.clear();
intersections.push_back(getInvalidIntersection()); intersections.push_back(getInvalidIntersection());
classes.clear();
} }
// Elongate by another step in front // Elongate by another step in front

View File

@ -20,16 +20,6 @@ namespace guidance
OSRM_ATTR_WARN_UNUSED OSRM_ATTR_WARN_UNUSED
std::vector<RouteStep> suppressShortNameSegments(std::vector<RouteStep> steps); std::vector<RouteStep> suppressShortNameSegments(std::vector<RouteStep> steps);
// remove use lane information that is not actually a turn. For post-processing, we need to
// associate lanes with every turn. Some of these use-lane instructions are not required after lane
// anticipation anymore. This function removes all use lane instructions that are not actually used
// anymore since all lanes going straight are used anyhow.
// FIXME this is currently only a heuristic. We need knowledge on which lanes actually might become
// turn lanes. If a straight lane becomes a turn lane, this might be something to consider. Right
// now we bet on lane-anticipation to catch this.
OSRM_ATTR_WARN_UNUSED
std::vector<RouteStep> collapseUseLane(std::vector<RouteStep> steps);
} // namespace guidance } // namespace guidance
} // namespace engine } // namespace engine
} // namespace osrm } // namespace osrm

View File

@ -24,9 +24,17 @@ struct PathData
// name of the street that leads to the turn // name of the street that leads to the turn
unsigned name_id; unsigned name_id;
// weight that is traveled on the segment until the turn is reached // weight that is traveled on the segment until the turn is reached
// including the turn weight, if one exists
EdgeWeight weight_until_turn; EdgeWeight weight_until_turn;
// duration that is traveled on the segment until the turn is reached // If this segment immediately preceeds a turn, then duration_of_turn
// will contain the weight of the turn. Otherwise it will be 0.
EdgeWeight weight_of_turn;
// duration that is traveled on the segment until the turn is reached,
// including a turn if the segment preceeds one.
EdgeWeight duration_until_turn; EdgeWeight duration_until_turn;
// If this segment immediately preceeds a turn, then duration_of_turn
// will contain the duration of the turn. Otherwise it will be 0.
EdgeWeight duration_of_turn;
// instruction to execute at the turn // instruction to execute at the turn
extractor::guidance::TurnInstruction turn_instruction; extractor::guidance::TurnInstruction turn_instruction;
// turn lane data // turn lane data

View File

@ -186,7 +186,9 @@ void annotatePath(const FacadeT &facade,
unpacked_path.push_back(PathData{id_vector[segment_idx + 1], unpacked_path.push_back(PathData{id_vector[segment_idx + 1],
name_index, name_index,
weight_vector[segment_idx], weight_vector[segment_idx],
0,
duration_vector[segment_idx], duration_vector[segment_idx],
0,
extractor::guidance::TurnInstruction::NO_TURN(), extractor::guidance::TurnInstruction::NO_TURN(),
{{0, INVALID_LANEID}, INVALID_LANE_DESCRIPTIONID}, {{0, INVALID_LANEID}, INVALID_LANE_DESCRIPTIONID},
travel_mode, travel_mode,
@ -200,10 +202,15 @@ void annotatePath(const FacadeT &facade,
if (facade.HasLaneData(turn_id)) if (facade.HasLaneData(turn_id))
unpacked_path.back().lane_data = facade.GetLaneData(turn_id); unpacked_path.back().lane_data = facade.GetLaneData(turn_id);
const auto turn_duration = facade.GetDurationPenaltyForEdgeID(turn_id);
const auto turn_weight = facade.GetWeightPenaltyForEdgeID(turn_id);
unpacked_path.back().entry_class = facade.GetEntryClass(turn_id); unpacked_path.back().entry_class = facade.GetEntryClass(turn_id);
unpacked_path.back().turn_instruction = turn_instruction; unpacked_path.back().turn_instruction = turn_instruction;
unpacked_path.back().duration_until_turn += facade.GetDurationPenaltyForEdgeID(turn_id); unpacked_path.back().duration_until_turn += turn_duration;
unpacked_path.back().weight_until_turn += facade.GetWeightPenaltyForEdgeID(turn_id); unpacked_path.back().duration_of_turn = turn_duration;
unpacked_path.back().weight_until_turn += turn_weight;
unpacked_path.back().weight_of_turn = turn_weight;
unpacked_path.back().pre_turn_bearing = facade.PreTurnBearing(turn_id); unpacked_path.back().pre_turn_bearing = facade.PreTurnBearing(turn_id);
unpacked_path.back().post_turn_bearing = facade.PostTurnBearing(turn_id); unpacked_path.back().post_turn_bearing = facade.PostTurnBearing(turn_id);
} }
@ -262,7 +269,9 @@ void annotatePath(const FacadeT &facade,
PathData{id_vector[start_index < end_index ? segment_idx + 1 : segment_idx - 1], PathData{id_vector[start_index < end_index ? segment_idx + 1 : segment_idx - 1],
facade.GetNameIndex(target_node_id), facade.GetNameIndex(target_node_id),
weight_vector[segment_idx], weight_vector[segment_idx],
0,
duration_vector[segment_idx], duration_vector[segment_idx],
0,
extractor::guidance::TurnInstruction::NO_TURN(), extractor::guidance::TurnInstruction::NO_TURN(),
{{0, INVALID_LANEID}, INVALID_LANE_DESCRIPTIONID}, {{0, INVALID_LANEID}, INVALID_LANE_DESCRIPTIONID},
facade.GetTravelMode(target_node_id), facade.GetTravelMode(target_node_id),

View File

@ -10,31 +10,19 @@
#include "storage/io.hpp" #include "storage/io.hpp"
#include <cstdint>
#include <stxxl/vector>
#include <unordered_map>
namespace osrm namespace osrm
{ {
namespace extractor namespace extractor
{ {
/** /**
* Uses external memory containers from stxxl to store all the data that * Uses memory containers to store all the data that
* is collected by the extractor callbacks. * is collected by the extractor callbacks.
* *
* The data is the filtered, aggregated and finally written to disk. * The data is the filtered, aggregated and finally written to disk.
*/ */
class ExtractionContainers class ExtractionContainers
{ {
#ifndef _MSC_VER
constexpr static unsigned stxxl_memory =
((sizeof(std::size_t) == 4) ? std::numeric_limits<int>::max()
: std::numeric_limits<unsigned>::max());
#else
const static unsigned stxxl_memory = ((sizeof(std::size_t) == 4) ? INT_MAX : UINT_MAX);
#endif
void FlushVectors();
void PrepareNodes(); void PrepareNodes();
void PrepareRestrictions(); void PrepareRestrictions();
void PrepareEdges(ScriptingEnvironment &scripting_environment); void PrepareEdges(ScriptingEnvironment &scripting_environment);
@ -45,25 +33,24 @@ class ExtractionContainers
void WriteCharData(const std::string &file_name); void WriteCharData(const std::string &file_name);
public: public:
using STXXLNodeIDVector = stxxl::vector<OSMNodeID>; using NodeIDVector = std::vector<OSMNodeID>;
using STXXLNodeVector = stxxl::vector<QueryNode>; using NodeVector = std::vector<QueryNode>;
using STXXLEdgeVector = stxxl::vector<InternalExtractorEdge>; using EdgeVector = std::vector<InternalExtractorEdge>;
using RestrictionsVector = std::vector<InputRestrictionContainer>; using RestrictionsVector = std::vector<InputRestrictionContainer>;
using STXXLWayIDStartEndVector = stxxl::vector<FirstAndLastSegmentOfWay>; using WayIDStartEndVector = std::vector<FirstAndLastSegmentOfWay>;
using STXXLNameCharData = stxxl::vector<unsigned char>; using NameCharData = std::vector<unsigned char>;
using STXXLNameOffsets = stxxl::vector<unsigned>; using NameOffsets = std::vector<unsigned>;
std::vector<OSMNodeID> barrier_nodes; std::vector<OSMNodeID> barrier_nodes;
std::vector<OSMNodeID> traffic_lights; std::vector<OSMNodeID> traffic_lights;
STXXLNodeIDVector used_node_id_list; NodeIDVector used_node_id_list;
STXXLNodeVector all_nodes_list; NodeVector all_nodes_list;
STXXLEdgeVector all_edges_list; EdgeVector all_edges_list;
STXXLNameCharData name_char_data; NameCharData name_char_data;
STXXLNameOffsets name_offsets; NameOffsets name_offsets;
// an adjacency array containing all turn lane masks // an adjacency array containing all turn lane masks
RestrictionsVector restrictions_list; RestrictionsVector restrictions_list;
STXXLWayIDStartEndVector way_start_end_id_list; WayIDStartEndVector way_start_end_id_list;
std::unordered_map<OSMNodeID, NodeID> external_to_internal_node_id_map;
unsigned max_internal_node_id; unsigned max_internal_node_id;
std::vector<TurnRestriction> unconditional_turn_restrictions; std::vector<TurnRestriction> unconditional_turn_restrictions;

View File

@ -43,7 +43,7 @@ struct FirstAndLastSegmentOfWay
} }
}; };
struct FirstAndLastSegmentOfWayStxxlCompare struct FirstAndLastSegmentOfWayCompare
{ {
using value_type = FirstAndLastSegmentOfWay; using value_type = FirstAndLastSegmentOfWay;
bool operator()(const FirstAndLastSegmentOfWay &a, const FirstAndLastSegmentOfWay &b) const bool operator()(const FirstAndLastSegmentOfWay &a, const FirstAndLastSegmentOfWay &b) const

View File

@ -49,7 +49,7 @@ const constexpr Enum EnterRotary = 12; // Enter a rotary
const constexpr Enum EnterAndExitRotary = 13; // Touching a rotary const constexpr Enum EnterAndExitRotary = 13; // Touching a rotary
const constexpr Enum EnterRoundaboutIntersection = 14; // Entering a small Roundabout const constexpr Enum EnterRoundaboutIntersection = 14; // Entering a small Roundabout
const constexpr Enum EnterAndExitRoundaboutIntersection = 15; // Touching a roundabout const constexpr Enum EnterAndExitRoundaboutIntersection = 15; // Touching a roundabout
const constexpr Enum UseLane = 16; // No Turn, but you need to stay on a given lane! // depreacted: const constexpr Enum UseLane = 16; // No Turn, but you need to stay on a given lane!
// Values below here are silent instructions // Values below here are silent instructions
const constexpr Enum NoTurn = 17; // end of segment without turn/middle of a segment const constexpr Enum NoTurn = 17; // end of segment without turn/middle of a segment

View File

@ -24,7 +24,6 @@ struct TurnLaneData
// a temporary data entry that does not need to be assigned to an entry. // a temporary data entry that does not need to be assigned to an entry.
// This is the case in situations that use partition and require the entry to perform the // This is the case in situations that use partition and require the entry to perform the
// one-to-one mapping. // one-to-one mapping.
bool suppress_assignment;
bool operator<(const TurnLaneData &other) const; bool operator<(const TurnLaneData &other) const;
}; };
typedef std::vector<TurnLaneData> LaneDataVector; typedef std::vector<TurnLaneData> LaneDataVector;

View File

@ -176,6 +176,64 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
return engine_config_ptr(); return engine_config_ptr();
} }
// Set EngineConfig system-wide limits on construction, if requested
auto max_locations_trip = params->Get(Nan::New("max_locations_trip").ToLocalChecked());
auto max_locations_viaroute = params->Get(Nan::New("max_locations_viaroute").ToLocalChecked());
auto max_locations_distance_table =
params->Get(Nan::New("max_locations_distance_table").ToLocalChecked());
auto max_locations_map_matching =
params->Get(Nan::New("max_locations_map_matching").ToLocalChecked());
auto max_results_nearest = params->Get(Nan::New("max_results_nearest").ToLocalChecked());
auto max_alternatives = params->Get(Nan::New("max_alternatives").ToLocalChecked());
if (!max_locations_trip->IsUndefined() && !max_locations_trip->IsNumber())
{
Nan::ThrowError("max_locations_trip must be an integral number");
return engine_config_ptr();
}
if (!max_locations_viaroute->IsUndefined() && !max_locations_viaroute->IsNumber())
{
Nan::ThrowError("max_locations_viaroute must be an integral number");
return engine_config_ptr();
}
if (!max_locations_distance_table->IsUndefined() && !max_locations_distance_table->IsNumber())
{
Nan::ThrowError("max_locations_distance_table must be an integral number");
return engine_config_ptr();
}
if (!max_locations_map_matching->IsUndefined() && !max_locations_map_matching->IsNumber())
{
Nan::ThrowError("max_locations_map_matching must be an integral number");
return engine_config_ptr();
}
if (!max_results_nearest->IsUndefined() && !max_results_nearest->IsNumber())
{
Nan::ThrowError("max_results_nearest must be an integral number");
return engine_config_ptr();
}
if (!max_alternatives->IsUndefined() && !max_alternatives->IsNumber())
{
Nan::ThrowError("max_alternatives must be an integral number");
return engine_config_ptr();
}
if (max_locations_trip->IsNumber())
engine_config->max_locations_trip = static_cast<int>(max_locations_trip->NumberValue());
if (max_locations_viaroute->IsNumber())
engine_config->max_locations_viaroute =
static_cast<int>(max_locations_viaroute->NumberValue());
if (max_locations_distance_table->IsNumber())
engine_config->max_locations_distance_table =
static_cast<int>(max_locations_distance_table->NumberValue());
if (max_locations_map_matching->IsNumber())
engine_config->max_locations_map_matching =
static_cast<int>(max_locations_map_matching->NumberValue());
if (max_results_nearest->IsNumber())
engine_config->max_results_nearest = static_cast<int>(max_results_nearest->NumberValue());
if (max_alternatives->IsNumber())
engine_config->max_alternatives = static_cast<int>(max_alternatives->NumberValue());
return engine_config; return engine_config;
} }
@ -721,7 +779,7 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
if (value->IsBoolean()) if (value->IsBoolean())
{ {
params->alternatives = value->BooleanValue(); params->alternatives = value->BooleanValue();
params->number_of_alternatives = 1u; params->number_of_alternatives = value->BooleanValue() ? 1u : 0u;
} }
else if (value->IsNumber()) else if (value->IsNumber())
{ {

View File

@ -7,8 +7,13 @@
#include "storage/io.hpp" #include "storage/io.hpp"
#include <cmath>
#include <cstdint> #include <cstdint>
#if USE_STXXL_LIBRARY
#include <stxxl/vector>
#endif
namespace osrm namespace osrm
{ {
namespace storage namespace storage
@ -58,6 +63,7 @@ inline void write(storage::io::FileWriter &writer, const util::DeallocatingVecto
writer.WriteFrom(vec.bucket_list.back(), last_block_size); writer.WriteFrom(vec.bucket_list.back(), last_block_size);
} }
#if USE_STXXL_LIBRARY
template <typename T> inline void read(storage::io::FileReader &reader, stxxl::vector<T> &vec) template <typename T> inline void read(storage::io::FileReader &reader, stxxl::vector<T> &vec)
{ {
auto size = reader.ReadOne<std::uint64_t>(); auto size = reader.ReadOne<std::uint64_t>();
@ -78,6 +84,7 @@ inline void write(storage::io::FileWriter &writer, const stxxl::vector<T> &vec)
writer.WriteOne<T>(vec[idx]); writer.WriteOne<T>(vec[idx]);
} }
} }
#endif
template <typename T> void read(io::FileReader &reader, std::vector<T> &data) template <typename T> void read(io::FileReader &reader, std::vector<T> &data)
{ {

View File

@ -90,9 +90,7 @@ inline void print(const extractor::guidance::lanes::LaneDataVector &turn_lane_da
std::cout << "\t" << entry.tag << "(" std::cout << "\t" << entry.tag << "("
<< extractor::guidance::TurnLaneType::toString(entry.tag) << extractor::guidance::TurnLaneType::toString(entry.tag)
<< ") from: " << static_cast<int>(entry.from) << ") from: " << static_cast<int>(entry.from)
<< " to: " << static_cast<int>(entry.to) << " to: " << static_cast<int>(entry.to) << "\n";
<< " Can Be Suppresssed: " << (entry.suppress_assignment ? "true" : "false")
<< "\n";
std::cout << std::flush; std::cout << std::flush;
} }

View File

@ -3,11 +3,14 @@
#include "util/log.hpp" #include "util/log.hpp"
#include <stxxl/mng>
#ifndef _WIN32 #ifndef _WIN32
#include <sys/resource.h> #include <sys/resource.h>
#endif #endif
#if USE_STXXL_LIBRARY
#include <stxxl/mng>
#endif
namespace osrm namespace osrm
{ {
namespace util namespace util
@ -15,6 +18,7 @@ namespace util
inline void DumpSTXXLStats() inline void DumpSTXXLStats()
{ {
#if USE_STXXL_LIBRARY
#if STXXL_VERSION_MAJOR > 1 || (STXXL_VERSION_MAJOR == 1 && STXXL_VERSION_MINOR >= 4) #if STXXL_VERSION_MAJOR > 1 || (STXXL_VERSION_MAJOR == 1 && STXXL_VERSION_MINOR >= 4)
auto manager = stxxl::block_manager::get_instance(); auto manager = stxxl::block_manager::get_instance();
util::Log() << "STXXL: peak bytes used: " << manager->get_maximum_allocation(); util::Log() << "STXXL: peak bytes used: " << manager->get_maximum_allocation();
@ -23,6 +27,7 @@ inline void DumpSTXXLStats()
#warning STXXL 1.4+ recommended - STXXL memory summary will not be available #warning STXXL 1.4+ recommended - STXXL memory summary will not be available
util::Log() << "STXXL: memory summary not available, needs STXXL 1.4 or higher"; util::Log() << "STXXL: memory summary not available, needs STXXL 1.4 or higher";
#endif #endif
#endif
} }
inline void DumpMemoryStats() inline void DumpMemoryStats()

View File

@ -6,8 +6,6 @@
#include "storage/shared_memory_ownership.hpp" #include "storage/shared_memory_ownership.hpp"
#include <stxxl/vector>
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/iterator/iterator_facade.hpp> #include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/reverse_iterator.hpp> #include <boost/iterator/reverse_iterator.hpp>
@ -21,6 +19,10 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#if USE_STXXL_LIBRARY
#include <stxxl/vector>
#endif
namespace osrm namespace osrm
{ {
namespace util namespace util
@ -209,10 +211,16 @@ template <typename DataT> void swap(vector_view<DataT> &lhs, vector_view<DataT>
std::swap(lhs.m_size, rhs.m_size); std::swap(lhs.m_size, rhs.m_size);
} }
#if USE_STXXL_LIBRARY
template <typename T> using ExternalVector = stxxl::vector<T>;
#else
template <typename T> using ExternalVector = std::vector<T>;
#endif
template <typename DataT, storage::Ownership Ownership> template <typename DataT, storage::Ownership Ownership>
using InternalOrExternalVector = using InternalOrExternalVector =
typename std::conditional<Ownership == storage::Ownership::External, typename std::conditional<Ownership == storage::Ownership::External,
stxxl::vector<DataT>, ExternalVector<DataT>,
std::vector<DataT>>::type; std::vector<DataT>>::type;
template <typename DataT, storage::Ownership Ownership> template <typename DataT, storage::Ownership Ownership>

View File

@ -1,6 +1,6 @@
{ {
"name": "osrm", "name": "osrm",
"version": "5.9.0-latest.1", "version": "5.9.2",
"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": {

View File

@ -72,6 +72,12 @@ local profile = {
restricted_highway_whitelist = Set { }, restricted_highway_whitelist = Set { },
construction_whitelist = Set {
'no',
'widening',
'minor',
},
access_tags_hierarchy = Sequence { access_tags_hierarchy = Sequence {
'bicycle', 'bicycle',
'vehicle', 'vehicle',
@ -189,7 +195,8 @@ local profile = {
avoid = Set { avoid = Set {
'impassable', 'impassable',
'construction' 'construction',
'proposed'
} }
} }

View File

@ -94,6 +94,13 @@ local profile = {
'access' 'access'
}, },
construction_whitelist = Set {
'no',
'widening',
'minor',
},
service_tag_forbidden = Set { service_tag_forbidden = Set {
'emergency_access' 'emergency_access'
}, },
@ -110,7 +117,9 @@ local profile = {
'reversible', 'reversible',
'impassable', 'impassable',
'hov_lanes', 'hov_lanes',
'steps' 'steps',
'construction',
'proposed'
}, },
speeds = Sequence { speeds = Sequence {

View File

@ -61,6 +61,8 @@ local profile = {
restricted_highway_whitelist = Set { }, restricted_highway_whitelist = Set { },
construction_whitelist = Set {},
access_tags_hierarchy = Sequence { access_tags_hierarchy = Sequence {
'foot', 'foot',
'access' 'access'
@ -76,7 +78,9 @@ local profile = {
}, },
avoid = Set { avoid = Set {
'impassable' 'impassable',
'construction',
'proposed'
}, },
speeds = Sequence { speeds = Sequence {

View File

@ -48,7 +48,7 @@ function Handlers.handle_names(way,result,data,profile)
end end
if exits then if exits then
result.exits = exits result.exits = canonicalizeStringList(exits, ";")
end end
end end
@ -513,6 +513,25 @@ function Handlers.handle_blocked_ways(way,result,data,profile)
return false return false
end end
-- In addition to the highway=construction tag above handle the construction=* tag
-- http://wiki.openstreetmap.org/wiki/Key:construction
-- https://taginfo.openstreetmap.org/keys/construction#values
if profile.avoid.construction then
local construction = way:get_value_by_key('construction')
-- Of course there are negative tags to handle, too
if construction and not profile.construction_whitelist[construction] then
return false
end
end
-- Not only are there multiple construction tags there is also a proposed=* tag.
-- http://wiki.openstreetmap.org/wiki/Key:proposed
-- https://taginfo.openstreetmap.org/keys/proposed#values
if profile.avoid.proposed and way:get_value_by_key('proposed') then
return false
end
-- Reversible oneways change direction with low frequency (think twice a day): -- Reversible oneways change direction with low frequency (think twice a day):
-- do not route over these at all at the moment because of time dependence. -- do not route over these at all at the moment because of time dependence.
-- Note: alternating (high frequency) oneways are handled below with penalty. -- Note: alternating (high frequency) oneways are handled below with penalty.

View File

@ -10,9 +10,6 @@ local pprint = require('lib/pprint')
-- globals that are normally set from C++ -- globals that are normally set from C++
-- profiles code modifies this table
properties = {}
-- should match values defined in include/extractor/guidance/road_classification.hpp -- should match values defined in include/extractor/guidance/road_classification.hpp
road_priority_class = { road_priority_class = {
motorway = 0, motorway = 0,
@ -122,6 +119,8 @@ function Debug.way_function(way,result)
result.forward_speed = -1 result.forward_speed = -1
result.backward_speed = -1 result.backward_speed = -1
result.duration = 0 result.duration = 0
result.forward_classes = {}
result.backward_classes = {}
-- intercept tag function normally provided via C++ -- intercept tag function normally provided via C++
function way:get_value_by_key(k) function way:get_value_by_key(k)

View File

@ -234,6 +234,18 @@ util::json::Object makeIntersection(const guidance::IntermediateIntersection &in
if (detail::hasValidLanes(intersection)) if (detail::hasValidLanes(intersection))
result.values["lanes"] = detail::lanesFromIntersection(intersection); result.values["lanes"] = detail::lanesFromIntersection(intersection);
if (!intersection.classes.empty())
{
util::json::Array classes;
classes.values.reserve(intersection.classes.size());
std::transform(
intersection.classes.begin(),
intersection.classes.end(),
std::back_inserter(classes.values),
[](const std::string &class_name) { return util::json::String{class_name}; });
result.values["classes"] = std::move(classes);
}
return result; return result;
} }
@ -265,18 +277,6 @@ util::json::Object makeRouteStep(guidance::RouteStep step, util::json::Value geo
route_step.values["maneuver"] = makeStepManeuver(std::move(step.maneuver)); route_step.values["maneuver"] = makeStepManeuver(std::move(step.maneuver));
route_step.values["geometry"] = std::move(geometry); route_step.values["geometry"] = std::move(geometry);
if (!step.classes.empty())
{
util::json::Array classes;
classes.values.reserve(step.classes.size());
std::transform(
step.classes.begin(),
step.classes.end(),
std::back_inserter(classes.values),
[](const std::string &class_name) { return util::json::String{class_name}; });
route_step.values["classes"] = std::move(classes);
}
util::json::Array intersections; util::json::Array intersections;
intersections.values.reserve(step.intersections.size()); intersections.values.reserve(step.intersections.size());
std::transform(step.intersections.begin(), std::transform(step.intersections.begin(),

View File

@ -21,10 +21,10 @@ namespace guidance
{ {
std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps, std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
const double min_duration_needed_for_lane_change) const double min_distance_needed_for_lane_change)
{ {
// Lane anticipation works on contiguous ranges of quick steps that have lane information // Lane anticipation works on contiguous ranges of short steps that have lane information
const auto is_quick_has_lanes = [&](const RouteStep &step) { const auto is_short_has_lanes = [&](const RouteStep &step) {
const auto has_lanes = step.intersections.front().lanes.lanes_in_turn > 0; const auto has_lanes = step.intersections.front().lanes.lanes_in_turn > 0;
if (!has_lanes) if (!has_lanes)
@ -41,10 +41,10 @@ std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
// We do not have a source-target lane mapping, assume worst case for lanes to cross. // We do not have a source-target lane mapping, assume worst case for lanes to cross.
const auto to_cross = std::max(step.NumLanesToTheRight(), step.NumLanesToTheLeft()); const auto to_cross = std::max(step.NumLanesToTheRight(), step.NumLanesToTheLeft());
const auto scale = 1 + to_cross; const auto scale = 1 + to_cross;
const auto threshold = scale * min_duration_needed_for_lane_change; const auto threshold = scale * min_distance_needed_for_lane_change;
const auto is_quick = step.duration < threshold; const auto is_short = step.distance < threshold;
return is_quick; return is_short;
}; };
using StepIter = decltype(steps)::iterator; using StepIter = decltype(steps)::iterator;
@ -57,7 +57,7 @@ std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
quick_lanes_ranges.push_back(std::move(range)); quick_lanes_ranges.push_back(std::move(range));
}; };
util::group_by(begin(steps), end(steps), is_quick_has_lanes, range_back_inserter); util::group_by(begin(steps), end(steps), is_short_has_lanes, range_back_inserter);
// The lanes for a keep straight depend on the next left/right turn. Tag them in advance. // The lanes for a keep straight depend on the next left/right turn. Tag them in advance.
std::unordered_set<const RouteStep *> is_straight_left; std::unordered_set<const RouteStep *> is_straight_left;
@ -75,10 +75,11 @@ std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
// state for the lamda // state for the lamda
// the number of lanes we have to change depends on the number of lanes that are allowed for // the number of lanes we have to change depends on the number of lanes that are allowed for
// a turn (in general) and the set of lanes which would allow for us to do the turn without // a turn (in general) and the set of lanes which would allow for us to do the turn without
// a problem. In a sequence of turns, we have to look at how much time we need to switch the // a problem. In a sequence of turns, we have to look at how much distance we need to switch
// the
// sequence. Given the turns in between, we would expect a bit longer than on a straight // sequence. Given the turns in between, we would expect a bit longer than on a straight
// segment for a lane switch, but the total time shouldn't be unlimited. // segment for a lane switch, but the total distance shouldn't be unlimited.
double time_to_constrained = 0.0; double distance_to_constrained = 0.0;
util::for_each_pair(rev_first, rev_last, [&](RouteStep &current, RouteStep &previous) { util::for_each_pair(rev_first, rev_last, [&](RouteStep &current, RouteStep &previous) {
const auto current_inst = current.maneuver.instruction; const auto current_inst = current.maneuver.instruction;
@ -96,14 +97,14 @@ std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
// only prevent use lanes due to making all turns. don't make turns during curvy // only prevent use lanes due to making all turns. don't make turns during curvy
// segments // segments
if (previous_inst.type == TurnType::UseLane) if (previous_inst.type == TurnType::Suppressed)
time_to_constrained += previous.duration; distance_to_constrained += previous.distance;
else else
time_to_constrained = 0; distance_to_constrained = 0.;
const auto lane_delta = previous_lanes.lanes_in_turn - current_lanes.lanes_in_turn; const auto lane_delta = previous_lanes.lanes_in_turn - current_lanes.lanes_in_turn;
const auto can_make_all_turns = const auto can_make_all_turns =
time_to_constrained > lane_delta * min_duration_needed_for_lane_change; distance_to_constrained > lane_delta * min_distance_needed_for_lane_change;
if (!lanes_to_constrain || !lanes_fan_in || can_make_all_turns) if (!lanes_to_constrain || !lanes_fan_in || can_make_all_turns)
return; return;
@ -193,8 +194,9 @@ std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
anticipate_for_right_turn(); anticipate_for_right_turn();
} }
if (previous_inst.type == TurnType::UseLane && current_inst.type == TurnType::UseLane && if (previous_inst.type == TurnType::Suppressed &&
previous.mode == current.mode && previous_lanes == current_lanes) current_inst.type == TurnType::Suppressed && previous.mode == current.mode &&
previous_lanes == current_lanes)
{ {
previous.ElongateBy(current); previous.ElongateBy(current);
current.Invalidate(); current.Invalidate();

View File

@ -133,8 +133,7 @@ void closeOffRoundabout(const bool on_roundabout,
BOOST_ASSERT(leavesRoundabout(steps[1].maneuver.instruction) || BOOST_ASSERT(leavesRoundabout(steps[1].maneuver.instruction) ||
steps[1].maneuver.instruction.type == TurnType::StayOnRoundabout || steps[1].maneuver.instruction.type == TurnType::StayOnRoundabout ||
steps[1].maneuver.instruction.type == TurnType::Suppressed || steps[1].maneuver.instruction.type == TurnType::Suppressed ||
steps[1].maneuver.instruction.type == TurnType::NoTurn || steps[1].maneuver.instruction.type == TurnType::NoTurn);
steps[1].maneuver.instruction.type == TurnType::UseLane);
steps[0].geometry_end = 1; steps[0].geometry_end = 1;
steps[1].geometry_begin = 0; steps[1].geometry_begin = 0;
steps[1].AddInFront(steps[0]); steps[1].AddInFront(steps[0]);
@ -486,7 +485,6 @@ void trimShortSegments(std::vector<RouteStep> &steps, LegGeometry &geometry)
auto &new_next_to_last = *(steps.end() - 2); auto &new_next_to_last = *(steps.end() - 2);
next_to_last_step.AdaptStepSignage(new_next_to_last); next_to_last_step.AdaptStepSignage(new_next_to_last);
next_to_last_step.mode = new_next_to_last.mode; next_to_last_step.mode = new_next_to_last.mode;
next_to_last_step.classes = new_next_to_last.classes;
// the geometry indices of the last step are already correct; // the geometry indices of the last step are already correct;
} }
else if (util::coordinate_calculation::haversineDistance( else if (util::coordinate_calculation::haversineDistance(

View File

@ -82,52 +82,6 @@ std::vector<RouteStep> suppressShortNameSegments(std::vector<RouteStep> steps)
return removeNoTurnInstructions(std::move(steps)); return removeNoTurnInstructions(std::move(steps));
} }
// `useLane` steps are only returned on `straight` maneuvers when there
// are surrounding lanes also tagged as `straight`. If there are no other `straight`
// lanes, it is not an ambiguous maneuver, and we can collapse the `useLane` step.
std::vector<RouteStep> collapseUseLane(std::vector<RouteStep> steps)
{
const auto containsTag = [](const extractor::guidance::TurnLaneType::Mask mask,
const extractor::guidance::TurnLaneType::Mask tag) {
return (mask & tag) != extractor::guidance::TurnLaneType::empty;
};
const auto canCollapseUseLane = [containsTag](const RouteStep &step) {
// the lane description is given left to right, lanes are counted from the right.
// Therefore we access the lane description using the reverse iterator
auto right_most_lanes = step.LanesToTheRight();
if (!right_most_lanes.empty() && containsTag(right_most_lanes.front(),
(extractor::guidance::TurnLaneType::straight |
extractor::guidance::TurnLaneType::none)))
return false;
auto left_most_lanes = step.LanesToTheLeft();
if (!left_most_lanes.empty() && containsTag(left_most_lanes.back(),
(extractor::guidance::TurnLaneType::straight |
extractor::guidance::TurnLaneType::none)))
return false;
return true;
};
BOOST_ASSERT(steps.size() > 1);
for (auto step_itr = steps.begin() + 1; step_itr != steps.end(); ++step_itr)
{
if (step_itr->maneuver.instruction.type == TurnType::UseLane &&
canCollapseUseLane(*step_itr))
{
auto previous_turn_itr = findPreviousTurn(step_itr);
if (haveSameMode(*previous_turn_itr, *step_itr))
{
previous_turn_itr->ElongateBy(*step_itr);
step_itr->Invalidate();
}
}
}
return removeNoTurnInstructions(std::move(steps));
}
} // namespace guidance } // namespace guidance
} // namespace engine } // namespace engine
} // namespace osrm } // namespace osrm

View File

@ -121,9 +121,12 @@ ViaRoutePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFaca
routes = algorithms.ShortestPathSearch(start_end_nodes, route_parameters.continue_straight); routes = algorithms.ShortestPathSearch(start_end_nodes, route_parameters.continue_straight);
} }
// The post condition for all path searches is we have at least one route in our result.
// This route might be invalid by means of INVALID_EDGE_WEIGHT as shortest path weight.
BOOST_ASSERT(!routes.routes.empty());
// we can only know this after the fact, different SCC ids still // we can only know this after the fact, different SCC ids still
// allow for connection in one direction. // allow for connection in one direction.
BOOST_ASSERT(!routes.routes.empty());
if (routes.routes[0].is_valid()) if (routes.routes[0].is_valid())
{ {

View File

@ -792,8 +792,15 @@ InternalManyRoutesResult alternativePathSearch(SearchEngineData<Algorithm> &sear
shortest_path_via_it->node != SPECIAL_NODEID && shortest_path_via_it->node != SPECIAL_NODEID &&
shortest_path_via_it->weight != INVALID_EDGE_WEIGHT; shortest_path_via_it->weight != INVALID_EDGE_WEIGHT;
// Care needs to be taken to meet the call sites post condition.
// We must return at least one route, even if it's an invalid one.
if (!has_shortest_path) if (!has_shortest_path)
return InternalManyRoutesResult{}; {
InternalRouteResult invalid;
invalid.shortest_path_weight = INVALID_EDGE_WEIGHT;
invalid.segment_end_coordinates = {phantom_node_pair};
return invalid;
}
NodeID shortest_path_via = shortest_path_via_it->node; NodeID shortest_path_via = shortest_path_via_it->node;
EdgeWeight shortest_path_weight = shortest_path_via_it->weight; EdgeWeight shortest_path_weight = shortest_path_via_it->weight;

View File

@ -21,7 +21,7 @@
#include <boost/numeric/conversion/cast.hpp> #include <boost/numeric/conversion/cast.hpp>
#include <boost/ref.hpp> #include <boost/ref.hpp>
#include <stxxl/sort> #include <tbb/parallel_sort.h>
#include <chrono> #include <chrono>
#include <limits> #include <limits>
@ -32,16 +32,6 @@ namespace
{ {
namespace oe = osrm::extractor; namespace oe = osrm::extractor;
// Needed for STXXL comparison - STXXL requires max_value(), min_value(), so we can not use
// std::less<OSMNodeId>{}. Anonymous namespace to keep translation unit local.
struct OSMNodeIDSTXXLLess
{
using value_type = OSMNodeID;
bool operator()(const value_type left, const value_type right) const { return left < right; }
value_type max_value() { return MAX_OSM_NODEID; }
value_type min_value() { return MIN_OSM_NODEID; }
};
struct CmpEdgeByOSMStartID struct CmpEdgeByOSMStartID
{ {
using value_type = oe::InternalExtractorEdge; using value_type = oe::InternalExtractorEdge;
@ -49,9 +39,6 @@ struct CmpEdgeByOSMStartID
{ {
return lhs.result.osm_source_id < rhs.result.osm_source_id; return lhs.result.osm_source_id < rhs.result.osm_source_id;
} }
value_type max_value() { return value_type::max_osm_value(); }
value_type min_value() { return value_type::min_osm_value(); }
}; };
struct CmpEdgeByOSMTargetID struct CmpEdgeByOSMTargetID
@ -61,9 +48,6 @@ struct CmpEdgeByOSMTargetID
{ {
return lhs.result.osm_target_id < rhs.result.osm_target_id; return lhs.result.osm_target_id < rhs.result.osm_target_id;
} }
value_type max_value() { return value_type::max_osm_value(); }
value_type min_value() { return value_type::min_osm_value(); }
}; };
struct CmpEdgeByInternalSourceTargetAndName struct CmpEdgeByInternalSourceTargetAndName
@ -92,22 +76,25 @@ struct CmpEdgeByInternalSourceTargetAndName
if (rhs.result.name_id == EMPTY_NAMEID) if (rhs.result.name_id == EMPTY_NAMEID)
return true; return true;
std::lock_guard<std::mutex> lock(mutex);
BOOST_ASSERT(!name_offsets.empty() && name_offsets.back() == name_data.size()); BOOST_ASSERT(!name_offsets.empty() && name_offsets.back() == name_data.size());
const oe::ExtractionContainers::STXXLNameCharData::const_iterator data = name_data.begin(); const oe::ExtractionContainers::NameCharData::const_iterator data = name_data.begin();
return std::lexicographical_compare(data + name_offsets[lhs.result.name_id], return std::lexicographical_compare(data + name_offsets[lhs.result.name_id],
data + name_offsets[lhs.result.name_id + 1], data + name_offsets[lhs.result.name_id + 1],
data + name_offsets[rhs.result.name_id], data + name_offsets[rhs.result.name_id],
data + name_offsets[rhs.result.name_id + 1]); data + name_offsets[rhs.result.name_id + 1]);
} }
value_type max_value() { return value_type::max_internal_value(); } const oe::ExtractionContainers::NameCharData &name_data;
value_type min_value() { return value_type::min_internal_value(); } const oe::ExtractionContainers::NameOffsets &name_offsets;
std::mutex &mutex;
const oe::ExtractionContainers::STXXLNameCharData &name_data;
const oe::ExtractionContainers::STXXLNameOffsets &name_offsets;
}; };
template <typename Iter>
inline NodeID mapExternalToInternalNodeID(Iter first, Iter last, const OSMNodeID value)
{
const auto it = std::lower_bound(first, last, value);
return (it == last || value < *it) ? SPECIAL_NODEID
: static_cast<NodeID>(std::distance(first, it));
}
} }
namespace osrm namespace osrm
@ -117,9 +104,6 @@ namespace extractor
ExtractionContainers::ExtractionContainers() ExtractionContainers::ExtractionContainers()
{ {
// Check if stxxl can be instantiated
stxxl::vector<unsigned> dummy_vector;
// Insert four empty strings offsets for name, ref, destination, pronunciation, and exits // Insert four empty strings offsets for name, ref, destination, pronunciation, and exits
name_offsets.push_back(0); name_offsets.push_back(0);
name_offsets.push_back(0); name_offsets.push_back(0);
@ -130,16 +114,6 @@ ExtractionContainers::ExtractionContainers()
name_offsets.push_back(0); name_offsets.push_back(0);
} }
void ExtractionContainers::FlushVectors()
{
used_node_id_list.flush();
all_nodes_list.flush();
all_edges_list.flush();
name_char_data.flush();
name_offsets.flush();
way_start_end_id_list.flush();
}
/** /**
* Processes the collected data and serializes it. * Processes the collected data and serializes it.
* At this point nodes are still referenced by their OSM id. * At this point nodes are still referenced by their OSM id.
@ -158,11 +132,11 @@ void ExtractionContainers::PrepareData(ScriptingEnvironment &scripting_environme
storage::io::FileWriter file_out(output_file_name, storage::io::FileWriter file_out(output_file_name,
storage::io::FileWriter::GenerateFingerprint); storage::io::FileWriter::GenerateFingerprint);
FlushVectors();
PrepareNodes(); PrepareNodes();
WriteNodes(file_out); WriteNodes(file_out);
PrepareEdges(scripting_environment); PrepareEdges(scripting_environment);
all_nodes_list.clear(); // free all_nodes_list before allocation of normal_edges
all_nodes_list.shrink_to_fit();
WriteEdges(file_out); WriteEdges(file_out);
PrepareRestrictions(); PrepareRestrictions();
@ -190,8 +164,7 @@ void ExtractionContainers::PrepareNodes()
util::UnbufferedLog log; util::UnbufferedLog log;
log << "Sorting used nodes ... " << std::flush; log << "Sorting used nodes ... " << std::flush;
TIMER_START(sorting_used_nodes); TIMER_START(sorting_used_nodes);
stxxl::sort( tbb::parallel_sort(used_node_id_list.begin(), used_node_id_list.end());
used_node_id_list.begin(), used_node_id_list.end(), OSMNodeIDSTXXLLess(), stxxl_memory);
TIMER_STOP(sorting_used_nodes); TIMER_STOP(sorting_used_nodes);
log << "ok, after " << TIMER_SEC(sorting_used_nodes) << "s"; log << "ok, after " << TIMER_SEC(sorting_used_nodes) << "s";
} }
@ -207,23 +180,13 @@ void ExtractionContainers::PrepareNodes()
} }
{ {
struct QueryNodeSTXXLCompare
{
using value_type = QueryNode;
value_type max_value() { return value_type::max_value(); }
value_type min_value() { return value_type::min_value(); }
bool operator()(const value_type &left, const value_type &right) const
{
return left.node_id < right.node_id;
}
};
util::UnbufferedLog log; util::UnbufferedLog log;
log << "Sorting all nodes ... " << std::flush; log << "Sorting all nodes ... " << std::flush;
TIMER_START(sorting_nodes); TIMER_START(sorting_nodes);
stxxl::sort( tbb::parallel_sort(
all_nodes_list.begin(), all_nodes_list.end(), QueryNodeSTXXLCompare(), stxxl_memory); all_nodes_list.begin(), all_nodes_list.end(), [](const auto &left, const auto &right) {
return left.node_id < right.node_id;
});
TIMER_STOP(sorting_nodes); TIMER_STOP(sorting_nodes);
log << "ok, after " << TIMER_SEC(sorting_nodes) << "s"; log << "ok, after " << TIMER_SEC(sorting_nodes) << "s";
} }
@ -232,16 +195,11 @@ void ExtractionContainers::PrepareNodes()
util::UnbufferedLog log; util::UnbufferedLog log;
log << "Building node id map ... " << std::flush; log << "Building node id map ... " << std::flush;
TIMER_START(id_map); TIMER_START(id_map);
external_to_internal_node_id_map.reserve(used_node_id_list.size());
auto node_iter = all_nodes_list.begin(); auto node_iter = all_nodes_list.begin();
auto ref_iter = used_node_id_list.begin(); auto ref_iter = used_node_id_list.begin();
auto used_nodes_iter = used_node_id_list.begin();
const auto all_nodes_list_end = all_nodes_list.end(); const auto all_nodes_list_end = all_nodes_list.end();
const auto used_node_id_list_end = used_node_id_list.end(); const auto used_node_id_list_end = used_node_id_list.end();
// Note: despite being able to handle 64 bit OSM node ids, we can't
// handle > uint32_t actual usable nodes. This should be OK for a while
// because we usually route on a *lot* less than 2^32 of the OSM
// graph nodes.
std::uint64_t internal_id = 0;
// compute the intersection of nodes that were referenced and nodes we actually have // compute the intersection of nodes that were referenced and nodes we actually have
while (node_iter != all_nodes_list_end && ref_iter != used_node_id_list_end) while (node_iter != all_nodes_list_end && ref_iter != used_node_id_list_end)
@ -257,17 +215,21 @@ void ExtractionContainers::PrepareNodes()
continue; continue;
} }
BOOST_ASSERT(node_iter->node_id == *ref_iter); BOOST_ASSERT(node_iter->node_id == *ref_iter);
external_to_internal_node_id_map[*ref_iter] = static_cast<NodeID>(internal_id++); *used_nodes_iter = std::move(*ref_iter);
used_nodes_iter++;
node_iter++; node_iter++;
ref_iter++; ref_iter++;
} }
if (internal_id > std::numeric_limits<NodeID>::max())
// Remove unused nodes and check maximal internal node id
used_node_id_list.resize(std::distance(used_node_id_list.begin(), used_nodes_iter));
if (used_node_id_list.size() > std::numeric_limits<NodeID>::max())
{ {
throw util::exception("There are too many nodes remaining after filtering, OSRM only " throw util::exception("There are too many nodes remaining after filtering, OSRM only "
"supports 2^32 unique nodes, but there were " + "supports 2^32 unique nodes, but there were " +
std::to_string(internal_id) + SOURCE_REF); std::to_string(used_node_id_list.size()) + SOURCE_REF);
} }
max_internal_node_id = boost::numeric_cast<std::uint64_t>(internal_id); max_internal_node_id = boost::numeric_cast<std::uint64_t>(used_node_id_list.size());
TIMER_STOP(id_map); TIMER_STOP(id_map);
log << "ok, after " << TIMER_SEC(id_map) << "s"; log << "ok, after " << TIMER_SEC(id_map) << "s";
} }
@ -280,8 +242,7 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
util::UnbufferedLog log; util::UnbufferedLog log;
log << "Sorting edges by start ... " << std::flush; log << "Sorting edges by start ... " << std::flush;
TIMER_START(sort_edges_by_start); TIMER_START(sort_edges_by_start);
stxxl::sort( tbb::parallel_sort(all_edges_list.begin(), all_edges_list.end(), CmpEdgeByOSMStartID());
all_edges_list.begin(), all_edges_list.end(), CmpEdgeByOSMStartID(), stxxl_memory);
TIMER_STOP(sort_edges_by_start); TIMER_STOP(sort_edges_by_start);
log << "ok, after " << TIMER_SEC(sort_edges_by_start) << "s"; log << "ok, after " << TIMER_SEC(sort_edges_by_start) << "s";
} }
@ -325,9 +286,10 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
BOOST_ASSERT(edge_iterator->result.osm_source_id == node_iterator->node_id); BOOST_ASSERT(edge_iterator->result.osm_source_id == node_iterator->node_id);
// assign new node id // assign new node id
auto id_iter = external_to_internal_node_id_map.find(node_iterator->node_id); const auto node_id = mapExternalToInternalNodeID(
BOOST_ASSERT(id_iter != external_to_internal_node_id_map.end()); used_node_id_list.begin(), used_node_id_list.end(), node_iterator->node_id);
edge_iterator->result.source = id_iter->second; BOOST_ASSERT(node_id != SPECIAL_NODEID);
edge_iterator->result.source = node_id;
edge_iterator->source_coordinate.lat = node_iterator->lat; edge_iterator->source_coordinate.lat = node_iterator->lat;
edge_iterator->source_coordinate.lon = node_iterator->lon; edge_iterator->source_coordinate.lon = node_iterator->lon;
@ -351,8 +313,7 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
util::UnbufferedLog log; util::UnbufferedLog log;
log << "Sorting edges by target ... " << std::flush; log << "Sorting edges by target ... " << std::flush;
TIMER_START(sort_edges_by_target); TIMER_START(sort_edges_by_target);
stxxl::sort( tbb::parallel_sort(all_edges_list.begin(), all_edges_list.end(), CmpEdgeByOSMTargetID());
all_edges_list.begin(), all_edges_list.end(), CmpEdgeByOSMTargetID(), stxxl_memory);
TIMER_STOP(sort_edges_by_target); TIMER_STOP(sort_edges_by_target);
log << "ok, after " << TIMER_SEC(sort_edges_by_target) << "s"; log << "ok, after " << TIMER_SEC(sort_edges_by_target) << "s";
} }
@ -419,9 +380,10 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
edge.duration = std::max<EdgeWeight>(1, std::round(segment.duration * 10.)); edge.duration = std::max<EdgeWeight>(1, std::round(segment.duration * 10.));
// assign new node id // assign new node id
auto id_iter = external_to_internal_node_id_map.find(node_iterator->node_id); const auto node_id = mapExternalToInternalNodeID(
BOOST_ASSERT(id_iter != external_to_internal_node_id_map.end()); used_node_id_list.begin(), used_node_id_list.end(), node_iterator->node_id);
edge.target = id_iter->second; BOOST_ASSERT(node_id != SPECIAL_NODEID);
edge.target = node_id;
// orient edges consistently: source id < target id // orient edges consistently: source id < target id
// important for multi-edge removal // important for multi-edge removal
@ -454,11 +416,9 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
log << "Sorting edges by renumbered start ... "; log << "Sorting edges by renumbered start ... ";
TIMER_START(sort_edges_by_renumbered_start); TIMER_START(sort_edges_by_renumbered_start);
std::mutex name_data_mutex; std::mutex name_data_mutex;
stxxl::sort( tbb::parallel_sort(all_edges_list.begin(),
all_edges_list.begin(), all_edges_list.end(),
all_edges_list.end(), CmpEdgeByInternalSourceTargetAndName{name_char_data, name_offsets});
CmpEdgeByInternalSourceTargetAndName{name_data_mutex, name_char_data, name_offsets},
stxxl_memory);
TIMER_STOP(sort_edges_by_renumbered_start); TIMER_STOP(sort_edges_by_renumbered_start);
log << "ok, after " << TIMER_SEC(sort_edges_by_renumbered_start) << "s"; log << "ok, after " << TIMER_SEC(sort_edges_by_renumbered_start) << "s";
} }
@ -640,12 +600,13 @@ void ExtractionContainers::WriteNodes(storage::io::FileWriter &file_out) const
log << "Writing barrier nodes ... "; log << "Writing barrier nodes ... ";
TIMER_START(write_nodes); TIMER_START(write_nodes);
std::vector<NodeID> internal_barrier_nodes; std::vector<NodeID> internal_barrier_nodes;
for (const auto id : barrier_nodes) for (const auto osm_id : barrier_nodes)
{ {
auto iter = external_to_internal_node_id_map.find(id); const auto node_id = mapExternalToInternalNodeID(
if (iter != external_to_internal_node_id_map.end()) used_node_id_list.begin(), used_node_id_list.end(), osm_id);
if (node_id != SPECIAL_NODEID)
{ {
internal_barrier_nodes.push_back(iter->second); internal_barrier_nodes.push_back(node_id);
} }
} }
storage::serialization::write(file_out, internal_barrier_nodes); storage::serialization::write(file_out, internal_barrier_nodes);
@ -657,12 +618,13 @@ void ExtractionContainers::WriteNodes(storage::io::FileWriter &file_out) const
log << "Writing traffic light nodes ... "; log << "Writing traffic light nodes ... ";
TIMER_START(write_nodes); TIMER_START(write_nodes);
std::vector<NodeID> internal_traffic_lights; std::vector<NodeID> internal_traffic_lights;
for (const auto id : traffic_lights) for (const auto osm_id : traffic_lights)
{ {
auto iter = external_to_internal_node_id_map.find(id); const auto node_id = mapExternalToInternalNodeID(
if (iter != external_to_internal_node_id_map.end()) used_node_id_list.begin(), used_node_id_list.end(), osm_id);
if (node_id != SPECIAL_NODEID)
{ {
internal_traffic_lights.push_back(iter->second); internal_traffic_lights.push_back(node_id);
} }
} }
storage::serialization::write(file_out, internal_traffic_lights); storage::serialization::write(file_out, internal_traffic_lights);
@ -716,10 +678,9 @@ void ExtractionContainers::PrepareRestrictions()
util::UnbufferedLog log; util::UnbufferedLog log;
log << "Sorting used ways ... "; log << "Sorting used ways ... ";
TIMER_START(sort_ways); TIMER_START(sort_ways);
stxxl::sort(way_start_end_id_list.begin(), tbb::parallel_sort(way_start_end_id_list.begin(),
way_start_end_id_list.end(), way_start_end_id_list.end(),
FirstAndLastSegmentOfWayStxxlCompare(), FirstAndLastSegmentOfWayCompare());
stxxl_memory);
TIMER_STOP(sort_ways); TIMER_STOP(sort_ways);
log << "ok, after " << TIMER_SEC(sort_ways) << "s"; log << "ok, after " << TIMER_SEC(sort_ways) << "s";
} }
@ -728,7 +689,7 @@ void ExtractionContainers::PrepareRestrictions()
util::UnbufferedLog log; util::UnbufferedLog log;
log << "Sorting " << restrictions_list.size() << " restriction. by from... "; log << "Sorting " << restrictions_list.size() << " restriction. by from... ";
TIMER_START(sort_restrictions); TIMER_START(sort_restrictions);
std::sort( tbb::parallel_sort(
restrictions_list.begin(), restrictions_list.end(), CmpRestrictionContainerByFrom()); restrictions_list.begin(), restrictions_list.end(), CmpRestrictionContainerByFrom());
TIMER_STOP(sort_restrictions); TIMER_STOP(sort_restrictions);
log << "ok, after " << TIMER_SEC(sort_restrictions) << "s"; log << "ok, after " << TIMER_SEC(sort_restrictions) << "s";
@ -766,26 +727,30 @@ void ExtractionContainers::PrepareRestrictions()
BOOST_ASSERT( BOOST_ASSERT(
way_start_and_end_iterator->way_id == way_start_and_end_iterator->way_id ==
OSMWayID{static_cast<std::uint32_t>(restrictions_iterator->restriction.from.way)}); OSMWayID{static_cast<std::uint32_t>(restrictions_iterator->restriction.from.way)});
// we do not remap the via id yet, since we will need it for the to node as well // we do not remap the via id yet, since we will need it for the to node as well
const OSMNodeID via_node_id = OSMNodeID{restrictions_iterator->restriction.via.node}; const OSMNodeID via_osm_node_id =
OSMNodeID{restrictions_iterator->restriction.via.node};
// check if via is actually valid, if not invalidate // check if via is actually valid, if not invalidate
auto via_id_iter = external_to_internal_node_id_map.find(via_node_id); auto via_node_id = mapExternalToInternalNodeID(
if (via_id_iter == external_to_internal_node_id_map.end()) used_node_id_list.begin(), used_node_id_list.end(), via_osm_node_id);
if (via_node_id == SPECIAL_NODEID)
{ {
util::Log(logDEBUG) << "Restriction references invalid node: " util::Log(logDEBUG) << "Restriction references invalid node: " << via_osm_node_id;
<< restrictions_iterator->restriction.via.node;
restrictions_iterator->restriction.via.node = SPECIAL_NODEID; restrictions_iterator->restriction.via.node = SPECIAL_NODEID;
++restrictions_iterator; ++restrictions_iterator;
continue; continue;
} }
if (way_start_and_end_iterator->first_segment_source_id == via_node_id) if (way_start_and_end_iterator->first_segment_source_id == via_osm_node_id)
{ {
// assign new from node id // assign new from node id
auto id_iter = external_to_internal_node_id_map.find( const auto from_node_id = mapExternalToInternalNodeID(
used_node_id_list.begin(),
used_node_id_list.end(),
way_start_and_end_iterator->first_segment_target_id); way_start_and_end_iterator->first_segment_target_id);
if (id_iter == external_to_internal_node_id_map.end()) if (from_node_id == SPECIAL_NODEID)
{ {
util::Log(logDEBUG) << "Way references invalid node: " util::Log(logDEBUG) << "Way references invalid node: "
<< way_start_and_end_iterator->first_segment_target_id; << way_start_and_end_iterator->first_segment_target_id;
@ -794,14 +759,16 @@ void ExtractionContainers::PrepareRestrictions()
++way_start_and_end_iterator; ++way_start_and_end_iterator;
continue; continue;
} }
restrictions_iterator->restriction.from.node = id_iter->second; restrictions_iterator->restriction.from.node = from_node_id;
} }
else if (way_start_and_end_iterator->last_segment_target_id == via_node_id) else if (way_start_and_end_iterator->last_segment_target_id == via_osm_node_id)
{ {
// assign new from node id // assign new from node id
auto id_iter = external_to_internal_node_id_map.find( const auto from_node_id =
way_start_and_end_iterator->last_segment_source_id); mapExternalToInternalNodeID(used_node_id_list.begin(),
if (id_iter == external_to_internal_node_id_map.end()) used_node_id_list.end(),
way_start_and_end_iterator->last_segment_source_id);
if (from_node_id == SPECIAL_NODEID)
{ {
util::Log(logDEBUG) << "Way references invalid node: " util::Log(logDEBUG) << "Way references invalid node: "
<< way_start_and_end_iterator->last_segment_target_id; << way_start_and_end_iterator->last_segment_target_id;
@ -810,7 +777,7 @@ void ExtractionContainers::PrepareRestrictions()
++way_start_and_end_iterator; ++way_start_and_end_iterator;
continue; continue;
} }
restrictions_iterator->restriction.from.node = id_iter->second; restrictions_iterator->restriction.from.node = from_node_id;
} }
else else
{ {
@ -828,7 +795,7 @@ void ExtractionContainers::PrepareRestrictions()
util::UnbufferedLog log; util::UnbufferedLog log;
log << "Sorting restrictions. by to ... " << std::flush; log << "Sorting restrictions. by to ... " << std::flush;
TIMER_START(sort_restrictions_to); TIMER_START(sort_restrictions_to);
std::sort( tbb::parallel_sort(
restrictions_list.begin(), restrictions_list.end(), CmpRestrictionContainerByTo()); restrictions_list.begin(), restrictions_list.end(), CmpRestrictionContainerByTo());
TIMER_STOP(sort_restrictions_to); TIMER_STOP(sort_restrictions_to);
log << "ok, after " << TIMER_SEC(sort_restrictions_to) << "s"; log << "ok, after " << TIMER_SEC(sort_restrictions_to) << "s";
@ -870,18 +837,22 @@ void ExtractionContainers::PrepareRestrictions()
BOOST_ASSERT( BOOST_ASSERT(
way_start_and_end_iterator->way_id == way_start_and_end_iterator->way_id ==
OSMWayID{static_cast<std::uint32_t>(restrictions_iterator->restriction.to.way)}); OSMWayID{static_cast<std::uint32_t>(restrictions_iterator->restriction.to.way)});
const OSMNodeID via_node_id = OSMNodeID{restrictions_iterator->restriction.via.node}; const OSMNodeID via_osm_node_id =
OSMNodeID{restrictions_iterator->restriction.via.node};
// assign new via node id // assign new via node id
auto via_id_iter = external_to_internal_node_id_map.find(via_node_id); const auto via_node_id = mapExternalToInternalNodeID(
BOOST_ASSERT(via_id_iter != external_to_internal_node_id_map.end()); used_node_id_list.begin(), used_node_id_list.end(), via_osm_node_id);
restrictions_iterator->restriction.via.node = via_id_iter->second; BOOST_ASSERT(via_node_id != SPECIAL_NODEID);
restrictions_iterator->restriction.via.node = via_node_id;
if (way_start_and_end_iterator->first_segment_source_id == via_node_id) if (way_start_and_end_iterator->first_segment_source_id == via_osm_node_id)
{ {
auto to_id_iter = external_to_internal_node_id_map.find( const auto to_node_id = mapExternalToInternalNodeID(
used_node_id_list.begin(),
used_node_id_list.end(),
way_start_and_end_iterator->first_segment_target_id); way_start_and_end_iterator->first_segment_target_id);
if (to_id_iter == external_to_internal_node_id_map.end()) if (to_node_id == SPECIAL_NODEID)
{ {
util::Log(logDEBUG) << "Way references invalid node: " util::Log(logDEBUG) << "Way references invalid node: "
<< way_start_and_end_iterator->first_segment_source_id; << way_start_and_end_iterator->first_segment_source_id;
@ -890,13 +861,15 @@ void ExtractionContainers::PrepareRestrictions()
++way_start_and_end_iterator; ++way_start_and_end_iterator;
continue; continue;
} }
restrictions_iterator->restriction.to.node = to_id_iter->second; restrictions_iterator->restriction.to.node = to_node_id;
} }
else if (way_start_and_end_iterator->last_segment_target_id == via_node_id) else if (way_start_and_end_iterator->last_segment_target_id == via_osm_node_id)
{ {
auto to_id_iter = external_to_internal_node_id_map.find( const auto to_node_id =
way_start_and_end_iterator->last_segment_source_id); mapExternalToInternalNodeID(used_node_id_list.begin(),
if (to_id_iter == external_to_internal_node_id_map.end()) used_node_id_list.end(),
way_start_and_end_iterator->last_segment_source_id);
if (to_node_id == SPECIAL_NODEID)
{ {
util::Log(logDEBUG) << "Way references invalid node: " util::Log(logDEBUG) << "Way references invalid node: "
<< way_start_and_end_iterator->last_segment_source_id; << way_start_and_end_iterator->last_segment_source_id;
@ -905,7 +878,7 @@ void ExtractionContainers::PrepareRestrictions()
++way_start_and_end_iterator; ++way_start_and_end_iterator;
continue; continue;
} }
restrictions_iterator->restriction.to.node = to_id_iter->second; restrictions_iterator->restriction.to.node = to_node_id;
} }
else else
{ {

View File

@ -88,10 +88,7 @@ TurnInstruction IntersectionHandler::getInstructionForObvious(const std::size_t
// handle travel modes: // handle travel modes:
const auto in_mode = node_based_graph.GetEdgeData(via_edge).travel_mode; const auto in_mode = node_based_graph.GetEdgeData(via_edge).travel_mode;
const auto out_mode = node_based_graph.GetEdgeData(road.eid).travel_mode; const auto out_mode = node_based_graph.GetEdgeData(road.eid).travel_mode;
const auto in_classes = node_based_graph.GetEdgeData(via_edge).classes; const auto needs_notification = in_mode != out_mode;
const auto out_classes = node_based_graph.GetEdgeData(road.eid).classes;
// if we just lose class flags we don't want to notify
const auto needs_notification = in_mode != out_mode || !isSubset(out_classes, in_classes);
if (type == TurnType::Turn) if (type == TurnType::Turn)
{ {

View File

@ -118,6 +118,9 @@ Intersection MotorwayHandler::fromMotorway(const EdgeID via_eid, Intersection in
const auto getContinueAngle = [this, in_data](const Intersection &intersection) { const auto getContinueAngle = [this, in_data](const Intersection &intersection) {
for (const auto &road : intersection) for (const auto &road : intersection)
{ {
if (!road.entry_allowed)
continue;
const auto &out_data = node_based_graph.GetEdgeData(road.eid); const auto &out_data = node_based_graph.GetEdgeData(road.eid);
const auto same_name = !util::guidance::requiresNameAnnounced( const auto same_name = !util::guidance::requiresNameAnnounced(

View File

@ -129,19 +129,16 @@ LaneDataVector augmentMultiple(const std::size_t none_index,
{ {
lane_data.push_back({tag_by_modifier[itr->instruction.direction_modifier], lane_data.push_back({tag_by_modifier[itr->instruction.direction_modifier],
lane_data[none_index].from, lane_data[none_index].from,
lane_data[none_index].from, lane_data[none_index].from});
false});
} }
lane_data.push_back({tag_by_modifier[straight_itr->instruction.direction_modifier], lane_data.push_back({tag_by_modifier[straight_itr->instruction.direction_modifier],
lane_data[none_index].from, lane_data[none_index].from,
lane_data[none_index].to, lane_data[none_index].to});
false});
for (auto itr = straight_itr + 1; itr != intersection_range_end; ++itr) for (auto itr = straight_itr + 1; itr != intersection_range_end; ++itr)
{ {
lane_data.push_back({tag_by_modifier[itr->instruction.direction_modifier], lane_data.push_back({tag_by_modifier[itr->instruction.direction_modifier],
lane_data[none_index].to, lane_data[none_index].to,
lane_data[none_index].to, lane_data[none_index].to});
false});
} }
lane_data.erase(lane_data.begin() + none_index); lane_data.erase(lane_data.begin() + none_index);
@ -158,8 +155,7 @@ LaneDataVector augmentMultiple(const std::size_t none_index,
lane_data.push_back({tag_by_modifier[intersection[intersection_index] lane_data.push_back({tag_by_modifier[intersection[intersection_index]
.instruction.direction_modifier], .instruction.direction_modifier],
lane_data[none_index].from, lane_data[none_index].from,
lane_data[none_index].to, lane_data[none_index].to});
false});
} }
} }
lane_data.erase(lane_data.begin() + none_index); lane_data.erase(lane_data.begin() + none_index);

View File

@ -107,7 +107,7 @@ LaneDataVector laneDataFromDescription(TurnLaneDescription turn_lane_description
LaneDataVector lane_data; LaneDataVector lane_data;
lane_data.reserve(lane_map.size()); lane_data.reserve(lane_map.size());
for (const auto &tag : lane_map) for (const auto &tag : lane_map)
lane_data.push_back({tag.first, tag.second.first, tag.second.second, false}); lane_data.push_back({tag.first, tag.second.first, tag.second.second});
std::sort(lane_data.begin(), lane_data.end()); std::sort(lane_data.begin(), lane_data.end());

View File

@ -279,7 +279,7 @@ TurnLaneScenario TurnLaneHandler::deduceScenario(const NodeID at,
// FIXME the lane to add depends on the side of driving/u-turn rules in the country // FIXME the lane to add depends on the side of driving/u-turn rules in the country
if (!lane_data.empty() && canMatchTrivially(intersection, lane_data) && if (!lane_data.empty() && canMatchTrivially(intersection, lane_data) &&
is_missing_valid_u_turn && !hasTag(TurnLaneType::none, lane_data)) is_missing_valid_u_turn && !hasTag(TurnLaneType::none, lane_data))
lane_data.push_back({TurnLaneType::uturn, lane_data.back().to, lane_data.back().to, false}); lane_data.push_back({TurnLaneType::uturn, lane_data.back().to, lane_data.back().to});
bool is_simple = isSimpleIntersection(lane_data, intersection); bool is_simple = isSimpleIntersection(lane_data, intersection);
@ -644,8 +644,6 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
if (lane == straightmost_tag_index) if (lane == straightmost_tag_index)
{ {
augmentEntry(turn_lane_data[straightmost_tag_index]); augmentEntry(turn_lane_data[straightmost_tag_index]);
// disable this turn for assignment if it is a -use lane only
turn_lane_data[straightmost_tag_index].suppress_assignment = true;
} }
if (matched_at_first[lane]) if (matched_at_first[lane])
@ -657,7 +655,7 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
std::count(matched_at_second.begin(), matched_at_second.end(), true)) == std::count(matched_at_second.begin(), matched_at_second.end(), true)) ==
getNumberOfTurns(next_intersection)) getNumberOfTurns(next_intersection))
{ {
TurnLaneData data = {TurnLaneType::straight, 255, 0, true}; TurnLaneData data = {TurnLaneType::straight, 255, 0};
augmentEntry(data); augmentEntry(data);
first.push_back(data); first.push_back(data);
std::sort(first.begin(), first.end()); std::sort(first.begin(), first.end());

View File

@ -87,7 +87,7 @@ bool isValidMatch(const TurnLaneType::Mask tag, const TurnInstruction instructio
TurnType::Continue && // Forks can be experienced, even for straight segments TurnType::Continue && // Forks can be experienced, even for straight segments
(instruction.direction_modifier == DirectionModifier::SlightLeft || (instruction.direction_modifier == DirectionModifier::SlightLeft ||
instruction.direction_modifier == DirectionModifier::SlightRight)) || instruction.direction_modifier == DirectionModifier::SlightRight)) ||
instruction.type == TurnType::UseLane; instruction.type == TurnType::Suppressed;
} }
else if (tag == TurnLaneType::slight_left || tag == TurnLaneType::left || else if (tag == TurnLaneType::slight_left || tag == TurnLaneType::left ||
tag == TurnLaneType::sharp_left) tag == TurnLaneType::sharp_left)
@ -250,10 +250,6 @@ Intersection triviallyMatchLanesToTurns(Intersection intersection,
BOOST_ASSERT(findBestMatch(lane_data[lane].tag, intersection) == BOOST_ASSERT(findBestMatch(lane_data[lane].tag, intersection) ==
intersection.begin() + road_index); intersection.begin() + road_index);
if (TurnType::Suppressed == intersection[road_index].instruction.type &&
!lane_data[lane].suppress_assignment)
intersection[road_index].instruction.type = TurnType::UseLane;
matchRoad(intersection[road_index], lane_data[lane]); matchRoad(intersection[road_index], lane_data[lane]);
++lane; ++lane;
} }

View File

@ -176,7 +176,7 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
"enter_and_exit_roundabout_intersection", "enter_and_exit_roundabout_intersection",
extractor::guidance::TurnType::EnterAndExitRoundaboutIntersection, extractor::guidance::TurnType::EnterAndExitRoundaboutIntersection,
"use_lane", "use_lane",
extractor::guidance::TurnType::UseLane, extractor::guidance::TurnType::Suppressed,
"no_turn", "no_turn",
extractor::guidance::TurnType::NoTurn, extractor::guidance::TurnType::NoTurn,
"suppressed", "suppressed",

View File

@ -366,6 +366,16 @@
"value": "circular", "value": "circular",
"description": "A Roundabout where the traffic on the roundabout not always has right of way." "description": "A Roundabout where the traffic on the roundabout not always has right of way."
}, },
{
"key": "proposed",
"object_types": [ "way" ],
"description": "Proposed ways. Discarded for routing"
},
{
"key": "construction",
"object_types": [ "way" ],
"description": "Ways under construction. Discarded for routing except construction=no, construction=widening"
},
{ {
"key": "type", "key": "type",
"value": "restriction", "value": "restriction",

View File

@ -98,6 +98,37 @@ test('constructor: throws if data doesn\'t match algorithm', function(assert) {
assert.throws(function() { new OSRM({algorithm: 'MLD', path: monaco_path}); }); assert.throws(function() { new OSRM({algorithm: 'MLD', path: monaco_path}); });
}); });
test('constructor: parses custom limits', function(assert) {
assert.plan(1);
var osrm = new OSRM({
path: monaco_mld_path,
algorithm: 'MLD',
max_locations_trip: 1,
max_locations_viaroute: 1,
max_locations_distance_table: 1,
max_locations_map_matching: 1,
max_results_nearest: 1,
max_alternatives: 1,
});
assert.ok(osrm);
});
test('constructor: throws on invalid custom limits', function(assert) {
assert.plan(1);
assert.throws(function() {
var osrm = new OSRM({
path: monaco_mld_path,
algorithm: 'MLD',
max_locations_trip: 'unlimited',
max_locations_viaroute: true,
max_locations_distance_table: false,
max_locations_map_matching: 'a lot',
max_results_nearest: null,
max_alternatives: '10'
})
});
});
require('./route.js'); require('./route.js');
require('./trip.js'); require('./trip.js');
require('./match.js'); require('./match.js');

View File

@ -549,3 +549,30 @@ test('route: throws on bad approaches', function(assert) {
}, function(err, route) {}) }, }, function(err, route) {}) },
/Approach must be a string: \[curb, unrestricted\] or null/); /Approach must be a string: \[curb, unrestricted\] or null/);
}); });
test('route: routes Monaco with custom limits on MLD', function(assert) {
assert.plan(2);
var osrm = new OSRM({
path: monaco_mld_path,
algorithm: 'MLD',
max_alternatives: 10,
});
osrm.route({coordinates: two_test_coordinates, alternatives: 10}, function(err, route) {
assert.ifError(err);
assert.ok(Array.isArray(route.routes));
});
});
test('route: in Monaco with custom limits on MLD', function(assert) {
assert.plan(1);
var osrm = new OSRM({
path: monaco_mld_path,
algorithm: 'MLD',
max_alternatives: 10,
});
osrm.route({coordinates: two_test_coordinates, alternatives: 11}, function(err, route) {
console.log(err)
assert.equal(err.message, 'TooBig');
});
});

View File

@ -23,6 +23,7 @@ BOOST_AUTO_TEST_CASE(trim_short_segments)
IntermediateIntersection::NO_INDEX, IntermediateIntersection::NO_INDEX,
0, 0,
{0, 255}, {0, 255},
{},
{}}; {}};
IntermediateIntersection intersection2{{FloatLongitude{-73.981495}, FloatLatitude{40.768275}}, IntermediateIntersection intersection2{{FloatLongitude{-73.981495}, FloatLatitude{40.768275}},
{180}, {180},
@ -30,6 +31,7 @@ BOOST_AUTO_TEST_CASE(trim_short_segments)
0, 0,
IntermediateIntersection::NO_INDEX, IntermediateIntersection::NO_INDEX,
{0, 255}, {0, 255},
{},
{}}; {}};
// Check that duplicated coordinate in the end is removed // Check that duplicated coordinate in the end is removed
@ -53,8 +55,7 @@ BOOST_AUTO_TEST_CASE(trim_short_segments)
0}, 0},
0, 0,
3, 3,
{intersection1}, {intersection1}},
{}},
{324, {324,
"Central Park West", "Central Park West",
"", "",
@ -75,8 +76,7 @@ BOOST_AUTO_TEST_CASE(trim_short_segments)
0}, 0},
2, 2,
3, 3,
{intersection2}, {intersection2}}};
{}}};
LegGeometry geometry; LegGeometry geometry;
geometry.locations = {{FloatLongitude{-73.981492}, FloatLatitude{40.768258}}, geometry.locations = {{FloatLongitude{-73.981492}, FloatLatitude{40.768258}},

View File

@ -5,7 +5,7 @@
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <numeric> #include <numeric>
#include <stxxl/vector> #include <vector>
BOOST_AUTO_TEST_SUITE(range_table) BOOST_AUTO_TEST_SUITE(range_table)
@ -15,7 +15,7 @@ using namespace osrm::util;
constexpr unsigned BLOCK_SIZE = 16; constexpr unsigned BLOCK_SIZE = 16;
typedef RangeTable<BLOCK_SIZE, osrm::storage::Ownership::Container> TestRangeTable; typedef RangeTable<BLOCK_SIZE, osrm::storage::Ownership::Container> TestRangeTable;
void ConstructionTest(stxxl::vector<unsigned> lengths, std::vector<unsigned> offsets) void ConstructionTest(std::vector<unsigned> lengths, std::vector<unsigned> offsets)
{ {
BOOST_ASSERT(lengths.size() == offsets.size() - 1); BOOST_ASSERT(lengths.size() == offsets.size() - 1);
@ -29,7 +29,7 @@ void ConstructionTest(stxxl::vector<unsigned> lengths, std::vector<unsigned> off
} }
} }
void ComputeLengthsOffsets(stxxl::vector<unsigned> &lengths, void ComputeLengthsOffsets(std::vector<unsigned> &lengths,
std::vector<unsigned> &offsets, std::vector<unsigned> &offsets,
unsigned num) unsigned num)
{ {
@ -54,12 +54,12 @@ void ComputeLengthsOffsets(stxxl::vector<unsigned> &lengths,
BOOST_AUTO_TEST_CASE(construction_test) BOOST_AUTO_TEST_CASE(construction_test)
{ {
// only offset empty block // only offset empty block
stxxl::vector<unsigned> empty_lengths; std::vector<unsigned> empty_lengths;
empty_lengths.push_back(1); empty_lengths.push_back(1);
ConstructionTest(empty_lengths, {0, 1}); ConstructionTest(empty_lengths, {0, 1});
// first block almost full => sentinel is last element of block // first block almost full => sentinel is last element of block
// [0] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, (16)} // [0] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, (16)}
stxxl::vector<unsigned> almost_full_lengths; std::vector<unsigned> almost_full_lengths;
std::vector<unsigned> almost_full_offsets; std::vector<unsigned> almost_full_offsets;
ComputeLengthsOffsets(almost_full_lengths, almost_full_offsets, BLOCK_SIZE); ComputeLengthsOffsets(almost_full_lengths, almost_full_offsets, BLOCK_SIZE);
ConstructionTest(almost_full_lengths, almost_full_offsets); ConstructionTest(almost_full_lengths, almost_full_offsets);
@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE(construction_test)
// first block full => sentinel is offset of new block, next block empty // first block full => sentinel is offset of new block, next block empty
// [0] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} // [0] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
// [(153)] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} // [(153)] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
stxxl::vector<unsigned> full_lengths; std::vector<unsigned> full_lengths;
std::vector<unsigned> full_offsets; std::vector<unsigned> full_offsets;
ComputeLengthsOffsets(full_lengths, full_offsets, BLOCK_SIZE + 1); ComputeLengthsOffsets(full_lengths, full_offsets, BLOCK_SIZE + 1);
ConstructionTest(full_lengths, full_offsets); ConstructionTest(full_lengths, full_offsets);
@ -75,13 +75,13 @@ BOOST_AUTO_TEST_CASE(construction_test)
// first block full and offset of next block not sentinel, but the first differential value // first block full and offset of next block not sentinel, but the first differential value
// [0] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} // [0] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
// [153] {(17), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} // [153] {(17), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
stxxl::vector<unsigned> over_full_lengths; std::vector<unsigned> over_full_lengths;
std::vector<unsigned> over_full_offsets; std::vector<unsigned> over_full_offsets;
ComputeLengthsOffsets(over_full_lengths, over_full_offsets, BLOCK_SIZE + 2); ComputeLengthsOffsets(over_full_lengths, over_full_offsets, BLOCK_SIZE + 2);
ConstructionTest(over_full_lengths, over_full_offsets); ConstructionTest(over_full_lengths, over_full_offsets);
// test multiple blocks // test multiple blocks
stxxl::vector<unsigned> multiple_lengths; std::vector<unsigned> multiple_lengths;
std::vector<unsigned> multiple_offsets; std::vector<unsigned> multiple_offsets;
ComputeLengthsOffsets(multiple_lengths, multiple_offsets, (BLOCK_SIZE + 1) * 10); ComputeLengthsOffsets(multiple_lengths, multiple_offsets, (BLOCK_SIZE + 1) * 10);
ConstructionTest(multiple_lengths, multiple_offsets); ConstructionTest(multiple_lengths, multiple_offsets);