Compare commits

..

18 Commits

Author SHA1 Message Date
Patrick Niklaus 8e0b8e43d0 Bump verison to 5.8.1 2017-06-30 09:27:49 +00:00
Patrick Niklaus 43e67241a0 Update changelog 2017-06-30 09:27:08 +00:00
Moritz Kobitzsch 217d2afbb4 don't collapse u-turns into combined turns 2017-06-30 09:26:10 +00:00
Michael Krasnyk 6e9bb4ad75 Test case with incorrect u-turn collapsing
http://map.project-osrm.org/?z=18&center=52.169237%2C10.032722&loc=52.168628%2C10.030759&loc=52.168707%2C10.030952&loc=52.168457%2C10.030432&hl=en&alt=0
2017-06-30 09:26:01 +00:00
Daniel J. Hofmann 165dba8fcc Adapts obvious turn classification: no longer take entry_allowed into account, resolves #3987 2017-06-29 15:26:18 +00:00
Daniel J. Hofmann 2bd511f194 Adds a failing test case for obvious turn at the end of the road, see #3987 2017-06-29 15:26:09 +00:00
Patrick Niklaus 2d5ef1f4cf Update changelog 2017-06-29 15:25:27 +00:00
Michael Krasnyk 76457a423f Propagate lane data across traffic lights 2017-06-29 15:11:50 +00:00
Michael Krasnyk 9ec4348bd1 Test case for #4189 2017-06-29 15:11:41 +00:00
Michael Krasnyk 309d00c5e3 Correct condition for is_going_straight_and_turns_continue 2017-06-29 15:11:31 +00:00
Michael Krasnyk effc85fa07 Review adjustments for driveway handler, #4151 2017-06-29 15:08:36 +00:00
Michael Krasnyk e0eedbc5f6 Added driveway handler 2017-06-29 15:08:11 +00:00
Michael Krasnyk 655d03592f Use thread-safe lock-free assignment in PackedVector::set_value
PR uses TBB internal atomic's for atomic CAS on non-atomic data

Corresponding PR https://github.com/Project-OSRM/osrm-backend/pull/4199

Other options:

* use sequential update

* use an internal packed vector lock -> makes packed vector non-movable

* use boost.interprocess atomics implementation -> outdated and only 32 bit version

* use glib atomic's -> requires new dependency

*  wait for https://isocpp.org/blog/2014/05/n4013 as_atomic

*  use c11 _Atomic and atomic_compare_exchange_weak -> not possible to mix c++11 and c11

* use builtin functions gcc __sync_bool_compare_and_swap and msvc _InterlockedCompareExchange64 -> possible, but requires proper testing

boolean CompareAndSwapPointer(volatile * void * ptr,
                              void * new_value,
                              void * old_value) {
if defined(_MSC_VER)
   if (InterlockedCompareExchange(ptr, new_value, old_value) == old_value) return false;
   else return true;
elif (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100
   return __sync_bool_compare_and_swap(ptr, old_value, new_value);
else
  error No implementation
endif
}

* use Boost.Atomic -> requires new dependency

        WordT local_lower_word = lower_word, new_lower_word;
        do
        {
            new_lower_word = set_lower_value<WordT, T>(local_lower_word,
                                                       lower_mask[internal_index.element],
                                                       lower_offset[internal_index.element],
                                                       value);
        } while (!boost::atomics::detail::operations<sizeof(WordT), false>::compare_exchange_weak(
            lower_word,
            local_lower_word,
            new_lower_word,
            boost::memory_order_release,
            boost::memory_order_relaxed));
2017-06-27 13:05:31 +02:00
Patrick Niklaus 6fadc4d8b8 Enable travis 2017-06-19 16:03:36 +00:00
Patrick Niklaus 00230967af Change OSRM version to 5.8.0 2017-06-19 16:03:15 +00:00
Patrick Niklaus f4bf76c98e Refactor tile tests 2017-06-19 16:00:34 +00:00
Daniel Patterson 1142a9e49b Add layer to debug tiles to expose all OSM nodes in that area. 2017-06-19 16:00:25 +00:00
Patrick Niklaus b168eca6d5 Bump version 2017-06-15 16:10:37 +00:00
173 changed files with 2472 additions and 5754 deletions
-15
View File
@@ -1,15 +0,0 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.cpp text
*.hpp text
# Declare files that will always have CRLF line endings on checkout.
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf
# Declare files that will always have LF line endings on checkout.
*.sh text eol=lf
-5
View File
@@ -61,11 +61,6 @@ Thumbs.db
.cproject .cproject
.project .project
# Visual Studio (Code) related files #
######################################
/.vs*
/*.local.bat
# stxxl related files # # stxxl related files #
####################### #######################
.stxxl .stxxl
+9 -18
View File
@@ -17,9 +17,9 @@ notifications:
branches: branches:
only: only:
- master - master
- "5.8"
# enable building tags # enable building tags
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/ - /^v\d+\.\d+(\.\d+)?(-\S*)?$/
- "5.9"
cache: cache:
yarn: true yarn: true
@@ -73,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', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev'] 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']
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)
@@ -83,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', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev'] 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']
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
@@ -91,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', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev'] 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']
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
@@ -116,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', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev'] 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']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
- os: linux - os: linux
@@ -125,20 +125,12 @@ 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', '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', 'libstxxl-dev', 'libstxxl1', '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
@@ -155,7 +147,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', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev'] #- 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']
#- 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
@@ -164,7 +156,7 @@ matrix:
addons: &gcc6 addons: &gcc6
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev'] 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']
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
@@ -173,7 +165,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', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev'] #- 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']
#- 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.
@@ -332,7 +324,6 @@ 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}
+8 -35
View File
@@ -1,38 +1,11 @@
# 5.9.2 # 5.8.1
- API: - Changes from 5.8.0:
- `annotations=durations,weights,speeds` values no longer include turn penalty values ([#4330](https://github.com/Project-OSRM/osrm-backend/issues/4330)) - Bugfixes:
- Fixes #4152: Superflous turn left instruction, when crossing a service-road.
# 5.9.1 - Fixes #4189: Fixes missing turn lane information after a traffic light.
- Changes from 5.9.0: - Fixes #4199: Data race-condition when updating segment speeds.
- #4322: Deprecated `UseLane`. Use the intersections array if you require lanes between steps - Fixes #3987: Fixes obvious turn detection at T-intersections with slip-roads.
- #4321: Fixes a potential crash in the MLD alternative code path when not even a shortest path can be found - Fixes #4161: Don't collapse U-Turns with other steps.
- #4324: STXXL is not required by default
# 5.9.0
- Changes from 5.8:
- Algorithm:
- Multi-Level Dijkstra:
- Plugins supported: `table`
- Adds alternative routes support (see [#4047](https://github.com/Project-OSRM/osrm-backend/pull/4047) and [3905](https://github.com/Project-OSRM/osrm-backend/issues/3905)): provides reasonably looking alternative routes (many, if possible) with reasonable query times.
- API:
- 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
- `Intersection` now has new parameter `classes` that can be set in the profile on each way.
- 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)
- `ExtractionWay` now as new property `forward_classes` and `backward_classes` that can set in the `way_function`.
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:
- Exposes `alternatives=Number` parameter overload in addition to the boolean flag
- Expose `EngineConfig` options in the node bindings
- Tools:
- 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
+15 -31
View File
@@ -21,7 +21,6 @@ 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,8 +54,8 @@ if (POLICY CMP0048)
endif() 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 8)
set(OSRM_VERSION_PATCH 2) set(OSRM_VERSION_PATCH 1)
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}")
@@ -429,12 +428,9 @@ 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})
if (ENABLE_STXXL) mason_use(stxxl VERSION ${MASON_STXXL_VERSION})
mason_use(stxxl VERSION ${MASON_STXXL_VERSION}) add_dependency_includes(${MASON_PACKAGE_stxxl_INCLUDE_DIRS})
add_dependency_includes(${MASON_PACKAGE_stxxl_INCLUDE_DIRS}) set(STXXL_LIBRARY ${MASON_PACKAGE_stxxl_STATIC_LIBS})
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})
@@ -497,16 +493,8 @@ else()
find_package(EXPAT REQUIRED) find_package(EXPAT REQUIRED)
add_dependency_includes(${EXPAT_INCLUDE_DIRS}) add_dependency_includes(${EXPAT_INCLUDE_DIRS})
if (ENABLE_STXXL) find_package(STXXL REQUIRED)
find_package(STXXL) add_dependency_includes(${STXXL_INCLUDE_DIR})
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})
@@ -590,13 +578,11 @@ 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)
if (ENABLE_STXXL) set(OpenMP_FIND_QUIETLY ON)
set(OpenMP_FIND_QUIETLY ON) find_package(OpenMP)
find_package(OpenMP) if(OPENMP_FOUND)
if(OPENMP_FOUND) message(STATUS "OpenMP support found. Linking just in case for stxxl")
message(STATUS "OpenMP support found. Linking just in case for stxxl") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
endif() endif()
add_definitions(${OSRM_DEFINES}) add_definitions(${OSRM_DEFINES})
@@ -631,7 +617,7 @@ set(EXTRACTOR_LIBRARIES
${EXPAT_LIBRARIES} ${EXPAT_LIBRARIES}
${USED_LUA_LIBRARIES} ${USED_LUA_LIBRARIES}
${OSMIUM_LIBRARIES} ${OSMIUM_LIBRARIES}
${MAYBE_STXXL_LIBRARY} ${STXXL_LIBRARY}
${TBB_LIBRARIES} ${TBB_LIBRARIES}
${ZLIB_LIBRARY} ${ZLIB_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES}) ${MAYBE_COVERAGE_LIBRARIES})
@@ -659,7 +645,7 @@ set(CONTRACTOR_LIBRARIES
${BOOST_BASE_LIBRARIES} ${BOOST_BASE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${USED_LUA_LIBRARIES} ${USED_LUA_LIBRARIES}
${MAYBE_STXXL_LIBRARY} ${STXXL_LIBRARY}
${TBB_LIBRARIES} ${TBB_LIBRARIES}
${MAYBE_RT_LIBRARY} ${MAYBE_RT_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES}) ${MAYBE_COVERAGE_LIBRARIES})
@@ -679,7 +665,7 @@ set(STORAGE_LIBRARIES
set(UTIL_LIBRARIES set(UTIL_LIBRARIES
${BOOST_BASE_LIBRARIES} ${BOOST_BASE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${MAYBE_STXXL_LIBRARY} ${STXXL_LIBRARY}
${TBB_LIBRARIES} ${TBB_LIBRARIES}
${MAYBE_COVERAGE_LIBRARIES}) ${MAYBE_COVERAGE_LIBRARIES})
@@ -748,14 +734,12 @@ 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)
+3 -32
View File
@@ -16,10 +16,8 @@ The following services are available via HTTP API, C++ library interface and Nod
To quickly try OSRM use our [demo server](http://map.project-osrm.org) which comes with both the backend and a frontend on top. To quickly try OSRM use our [demo server](http://map.project-osrm.org) which comes with both the backend and a frontend on top.
For a quick introduction about how the road network is represented in OpenStreetMap and how to map specific road network features have a look at [this guide about mapping for navigation](https://www.mapbox.com/mapping/mapping-for-navigation/).
Related [Project-OSRM](https://github.com/Project-OSRM) repositories: Related [Project-OSRM](https://github.com/Project-OSRM) repositories:
- [node-osrm](https://www.npmjs.com/package/osrm) - Production-ready NodeJs bindings for the routing engine - [node-osrm](https://github.com/Project-OSRM/node-osrm) - Production-ready NodeJs bindings for the routing engine
- [osrm-frontend](https://github.com/Project-OSRM/osrm-frontend) - User-facing frontend with map. The demo server runs this on top of the backend - [osrm-frontend](https://github.com/Project-OSRM/osrm-frontend) - User-facing frontend with map. The demo server runs this on top of the backend
- [osrm-text-instructions](https://github.com/Project-OSRM/osrm-text-instructions) - Text instructions from OSRM route response - [osrm-text-instructions](https://github.com/Project-OSRM/osrm-text-instructions) - Text instructions from OSRM route response
- [osrm-backend-docker](https://hub.docker.com/r/osrm/osrm-backend/) - Ready to use Docker images - [osrm-backend-docker](https://hub.docker.com/r/osrm/osrm-backend/) - Ready to use Docker images
@@ -121,7 +119,7 @@ osrm-routed berlin-latest.osrm
Running Queries Running Queries
``` ```
curl "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true" curl http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true
``` ```
### Request Against the Demo Server ### Request Against the Demo Server
@@ -130,36 +128,9 @@ Read the [API usage policy](https://github.com/Project-OSRM/osrm-backend/wiki/Ap
Simple query with instructions and alternatives on Berlin: Simple query with instructions and alternatives on Berlin:
``` ```
curl "https://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true&alternatives=true" curl https://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true&alternatives=true
``` ```
### Using the Node.js Bindings
The Node.js bindings provide read-only access to the routing engine.
We provide API documentation and examples [here](docs/nodejs/api.md).
You will need a modern `libstdc++` toolchain (`>= GLIBCXX_3.4.20`) for binary compatibility if you want to use the pre-built binaries.
For older Ubuntu systems you can upgrade your standard library for example with:
```
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update -y
sudo apt-get install -y libstdc++-5-dev
```
You can install the Node.js bindings via `npm install osrm` or from this repository either via
npm install
which will check and use pre-built binaries if they're available for this release and your Node version, or via
npm install --build-from-source
to always force building the Node.js bindings from source.
For usage details have a look [these API docs](docs/nodejs/api.md).
## References in publications ## References in publications
When using the code in a (scientific) publication, please cite When using the code in a (scientific) publication, please cite
+286 -286
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)
+1 -1
View File
@@ -3,5 +3,5 @@ module.exports = {
verify: '--strict --tags ~@stress --tags ~@todo -f progress --require features/support --require features/step_definitions', verify: '--strict --tags ~@stress --tags ~@todo -f progress --require features/support --require features/step_definitions',
todo: '--strict --tags @todo --require features/support --require features/step_definitions', todo: '--strict --tags @todo --require features/support --require features/step_definitions',
all: '--strict --require features/support --require features/step_definitions', all: '--strict --require features/support --require features/step_definitions',
mld: '--strict --tags ~@stress --tags ~@todo --tags ~@alternative --require features/support --require features/step_definitions -f progress' mld: '--strict --tags ~@stress --tags ~@todo --tags ~@alternative --tags ~@matrix --tags ~@trip --require features/support --require features/step_definitions -f progress'
} }
+13 -16
View File
@@ -165,21 +165,21 @@ curl 'http://router.project-osrm.org/nearest/v1/driving/13.388860,52.517037?numb
Finds the fastest route between coordinates in the supplied order. Finds the fastest route between coordinates in the supplied order.
```endpoint ```endpoint
GET /route/v1/{profile}/{coordinates}?alternatives={true|false|number}&steps={true|false}&geometries={polyline|polyline6|geojson}&overview={full|simplified|false}&annotations={true|false} GET /route/v1/{profile}/{coordinates}?alternatives={true|false}&steps={true|false}&geometries={polyline|polyline6|geojson}&overview={full|simplified|false}&annotations={true|false}
``` ```
In addition to the [general options](#general-options) the following options are supported for this service: In addition to the [general options](#general-options) the following options are supported for this service:
|Option |Values |Description | |Option |Values |Description |
|------------|---------------------------------------------|-------------------------------------------------------------------------------| |------------|---------------------------------------------|-------------------------------------------------------------------------------|
|alternatives|`true`, `false` (default), or Number |Search for alternative routes. Passing a number `alternatives=n` searches for up to `n` alternative routes.\* | |alternatives|`true`, `false` (default) |Search for alternative routes and return as well.\* |
|steps |`true`, `false` (default) |Returned route steps for each route leg | |steps |`true`, `false` (default) |Return route steps for each route leg |
|annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. | |annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. |
|geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) | |geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) |
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.| |overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
|continue\_straight |`default` (default), `true`, `false` |Forces the route to keep going straight at waypoints constraining uturns there even if it would be faster. Default value depends on the profile. | |continue\_straight |`default` (default), `true`, `false` |Forces the route to keep going straight at waypoints constraining uturns there even if it would be faster. Default value depends on the profile. |
\* Please note that even if alternative routes are requested, a result cannot be guaranteed. \* Please note that even if an alternative route is requested, a result cannot be guaranteed.
**Response** **Response**
@@ -275,7 +275,7 @@ In addition to the [general options](#general-options) the following options are
|Option |Values |Description | |Option |Values |Description |
|------------|------------------------------------------------|------------------------------------------------------------------------------------------| |------------|------------------------------------------------|------------------------------------------------------------------------------------------|
|steps |`true`, `false` (default) |Returned route steps for each route | |steps |`true`, `false` (default) |Return route steps for each route |
|geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) | |geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) |
|annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. | |annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. |
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.| |overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
@@ -328,10 +328,10 @@ In addition to the [general options](#general-options) the following options are
|Option |Values |Description | |Option |Values |Description |
|------------|------------------------------------------------|---------------------------------------------------------------------------| |------------|------------------------------------------------|---------------------------------------------------------------------------|
|roundtrip |`true` (default), `false` |Returned route is a roundtrip (route returns to first location) | |roundtrip |`true` (default), `false` |Return route is a roundtrip (route returns to first location) |
|source |`any` (default), `first` |Returned route starts at `any` or `first` coordinate | |source |`any` (default), `first` |Return route starts at `any` or `first` coordinate |
|destination |`any` (default), `last` |Returned route ends at `any` or `last` coordinate | |destination |`any` (default), `last` |Return route ends at `any` or `last` coordinate |
|steps |`true`, `false` (default) |Returned route instructions for each trip | |steps |`true`, `false` (default) |Return route instructions for each trip |
|annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. | |annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. |
|geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) | |geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) |
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.| |overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
@@ -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. Does not include the duration of any turns. - `duration`: The duration between each pair of coordinates, in seconds
- `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. Does not include any turn costs. - `weight`: The weights between each pair of coordinates
- `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
@@ -581,7 +581,6 @@ step.
- `ref`: A reference number or code for the way. Optionally included, if ref data is available for the given way. - `ref`: A reference number or code for the way. Optionally included, if ref data is available for the given way.
- `pronunciation`: The pronunciation hint of the way name. Will be `undefined` if there is no pronunciation hit. - `pronunciation`: The pronunciation hint of the way name. Will be `undefined` if there is no pronunciation hit.
- `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.
- `mode`: A string signifying the mode of transportation. - `mode`: A string signifying the mode of transportation.
- `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
@@ -655,12 +654,12 @@ 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` | **Deprecated** replaced by lanes on all intersection entries | | `use lane` | going straight on a specific lane |
| `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). |
| `roundabout turn`| Describes a turn at a small roundabout that should be treated as normal turn. The `modifier` indicates the turn direciton. Example instruction: `At the roundabout turn left`. | | `roundabout turn`| Describes a turn at a small roundabout that should be treated as normal turn. The `modifier` indicates the turn direciton. Example instruction: `At the roundabout turn left`. |
| `notification` | not an actual turn but a change in the driving conditions. For example the travel mode or classes. If the road takes a turn itself, the `modifier` describes the direction | | `notification` | not an actual turn but a change in the driving conditions. For example the travel mode. If the road takes a turn itself, the `modifier` describes the direction |
Please note that even though there are `new name` and `notification` instructions, the `mode` and `name` can change Please note that even though there are `new name` and `notification` instructions, the `mode` and `name` can change
between all instructions. They only offer a fallback in case nothing else is to report. between all instructions. They only offer a fallback in case nothing else is to report.
@@ -733,7 +732,6 @@ 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
@@ -752,7 +750,6 @@ 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"
+21 -27
View File
@@ -26,12 +26,6 @@ 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
@@ -47,7 +41,7 @@ Returns the fastest route between two or more coordinates while visiting the way
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings. - `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.alternatives` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Search for alternative routes and return as well. - `options.alternatives` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Search for alternative routes and return as well.
_Please note that even if an alternative route is requested, a result cannot be guaranteed._ (optional, default `false`) _Please note that even if an alternative route is requested, a result cannot be guaranteed._ (optional, default `false`)
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returned route steps for each route leg. (optional, default `false`) - `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route leg. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`) - `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`) - `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`) - `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
@@ -194,7 +188,7 @@ if they can not be matched successfully.
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction. - `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`. Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings. - `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returned route steps for each route. (optional, default `false`) - `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`) - `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`) - `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`) - `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
@@ -235,25 +229,7 @@ The trip plugin solves the Traveling Salesman Problem using a greedy heuristic
waypoints. The returned path does not have to be the shortest path, _ as TSP is NP-hard it is waypoints. The returned path does not have to be the shortest path, _ as TSP is NP-hard it is
only an approximation. only an approximation.
**Parameters** Note that all input coordinates have to be connected for the trip service to work.
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the trip query.
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `double >= 0` or `null` (unlimited, default).
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returned route steps for each route. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` (optional, default `simplified`)
- `options.roundtrip` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returned route is a roundtrip (route returns to first location). (optional, default `true`)
- `options.source` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route starts at `any` or `first` coordinate. (optional, default `any`)
- `options.destination` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route ends at `any` or `last` coordinate. (optional, default `any`)
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
A requirement for computing trips is that all input coordinates are connected.
Currently, not all combinations of `roundtrip`, `source` and `destination` are supported. Currently, not all combinations of `roundtrip`, `source` and `destination` are supported.
Right now, the following combinations are possible: Right now, the following combinations are possible:
@@ -268,6 +244,24 @@ Right now, the following combinations are possible:
| false | any | last | no | | false | any | last | no |
| false | any | any | no | | false | any | any | no |
**Parameters**
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the trip query.
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `double >= 0` or `null` (unlimited, default).
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` (optional, default `simplified`)
- `options.roundtrip` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route is a roundtrip. (optional, default `true`)
- `options.source` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route starts at `any` or `first` coordinate. (optional, default `any`)
- `options.destination` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route ends at `any` or `last` coordinate. (optional, default `any`)
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
**Examples** **Examples**
```javascript ```javascript
+10 -14
View File
@@ -27,16 +27,16 @@ As you scroll down the file you'll see local variables, and then local functions
The following global properties can be set in your profile: The following global properties can be set in your profile:
Attribute | Type | Notes Attribute | Type | Notes
-------------------------------------|----------|---------------------------------------------------------------------------- ------------------------------|----------|----------------------------------------------------------------------------
weight_name | String | Name used in output for the routing weight property (default `'duration'`) weight_name | String | Name used in output for the routing weight property (default `'duration'`)
weight_precision | Unsigned | Decimal precision of edge weights (default `1`) weight_precision | Unsigned | Decimal precision of edge weights (default `1`)
left_hand_driving | Boolean | Are vehicles assumed to drive on the left? (used in guidance, default `false`) left_hand_driving | Boolean | Are vehicles assumed to drive on the left? (used in guidance, default `false`)
use_turn_restrictions | Boolean | Are turn instructions followed? (default `false`) use_turn_restrictions | Boolean | Are turn instructions followed? (default `false`)
continue_straight_at_waypoint | Boolean | Must the route continue straight on at a via point, or are U-turns allowed? (default `true`) continue_straight_at_waypoint | Boolean | Must the route continue straight on at a via point, or are U-turns allowed? (default `true`)
max_speed_for_map_matching | Float | Maximum vehicle speed to be assumed in matching (in m/s) max_speed_for_map_matching | Float | Maximum vehicle speed to be assumed in matching (in m/s)
max_turn_weight | Float | Maximum turn penalty weight max_turn_weight | Float | Maximum turn penalty weight
force_split_edges | Boolean | True value forces a split of forward and backward edges of extracted ways and guarantees that `segment_function` will be called for all segments (default `false`) force_split_edges | Boolean | True value forces a split of forward and backward edges of extracted ways and guarantees that `segment_function` will be called for all segments (default `false`)
## way_function ## way_function
@@ -56,8 +56,6 @@ forward_rate | Float | Routing weight, expressed a
backward_rate | Float | " " backward_rate | Float | " "
forward_mode | Enum | Mode of travel (e.g. `car`, `ferry`). Mandatory. Defined in `include/extractor/travel_mode.hpp`. forward_mode | Enum | Mode of travel (e.g. `car`, `ferry`). Mandatory. Defined in `include/extractor/travel_mode.hpp`.
backward_mode | Enum | " " backward_mode | Enum | " "
forward_classes | Table | Mark this way as being of a specific class, e.g. `result.classes["toll"] = true`. This will be exposed in the API as `classes` on each `RouteStep`.
backward_classes | Table | " "
duration | Float | Alternative setter for duration of the whole way in both directions duration | Float | Alternative setter for duration of the whole way in both directions
weight | Float | Alternative setter for weight of the whole way in both directions weight | Float | Alternative setter for weight of the whole way in both directions
turn_lanes_forward | String | Directions for individual lanes (normalised OSM `turn:lanes` value) turn_lanes_forward | String | Directions for individual lanes (normalised OSM `turn:lanes` value)
@@ -69,8 +67,6 @@ roundabout | Boolean | Is this part of a roundabou
circular | Boolean | Is this part of a non-roundabout circular junction? circular | Boolean | Is this part of a non-roundabout circular junction?
name | String | Name of the way name | String | Name of the way
ref | String | Road number ref | String | Road number
destinations | String | The road's destinations
exits | String | The ramp's exit numbers or names
pronunciation | String | Name pronunciation pronunciation | String | Name pronunciation
road_classification.motorway_class | Boolean | Guidance: way is a motorway road_classification.motorway_class | Boolean | Guidance: way is a motorway
road_classification.link_class | Boolean | Guidance: way is a slip/link road road_classification.link_class | Boolean | Guidance: way is a slip/link road
+283 -283
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)
+10 -10
View File
@@ -82,16 +82,16 @@ Feature: Bike - Cycle tracks/lanes
Scenario: Bike - Cycleway on oneways, modes Scenario: Bike - Cycleway on oneways, modes
Then routability should be Then routability should be
| highway | cycleway | oneway | forw | backw | | highway | cycleway | oneway | forw | backw |
| motorway | track | yes | cycling | | | motorway | track | yes | cycling | |
| residential | track | yes | cycling | pushing bike | | residential | track | yes | cycling | pushing bike |
| cycleway | track | yes | cycling | pushing bike | | cycleway | track | yes | cycling | pushing bike |
| footway | track | yes | cycling | pushing bike | | footway | track | yes | pushing bike | pushing bike |
Scenario: Bike - Cycleway on oneways, speeds Scenario: Bike - Cycleway on oneways, speeds
Then routability should be Then routability should be
| highway | cycleway | oneway | forw | backw | | highway | cycleway | oneway | forw | backw |
| motorway | track | yes | 15 km/h | | | motorway | track | yes | 15 km/h | |
| residential | track | yes | 15 km/h | 6 km/h +-1 | | residential | track | yes | 15 km/h | 6 km/h |
| cycleway | track | yes | 15 km/h | 6 km/h +-1 | | cycleway | track | yes | 15 km/h | 6 km/h |
| footway | track | yes | 15 km/h | 6 km/h +-1 | | footway | track | yes | 6 km/h +-1 | 6 km/h +-1 |
+2 -1
View File
@@ -53,7 +53,8 @@ Feature: Bike - Handle ferry routes
Scenario: Bike - Ferry duration, multiple nodes Scenario: Bike - Ferry duration, multiple nodes
Given the node map Given the node map
""" """
x a b c d y x y
a b c d
""" """
And the ways And the ways
-9
View File
@@ -134,12 +134,3 @@ Feature: Bike - Oneway streets
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| a | c | ab,bc,bc | | a | c | ab,bc,bc |
Scenario: Bike - Left/right cycleways on oneways
Then routability should be
| highway | oneway | cycleway:left | cycleway:right | forw | backw |
| primary | yes | | | cycling | pushing bike |
| primary | yes | | track | cycling | pushing bike |
| primary | yes | track | | cycling | cycling |
| primary | yes | track | track | cycling | cycling |
-105
View File
@@ -1,105 +0,0 @@
@routing @bicycle @safety
Feature: Bicycle - Adds penalties to unsafe roads
Background:
Given the profile file
"""
require 'bicycle'
properties.weight_name = 'cyclability'
"""
Scenario: Bike - Apply penalties to ways without cycleways
Then routability should be
| highway | cycleway | forw | backw | forw_rate | backw_rate |
| motorway | | | | | |
| primary | | 15 km/h | 15 km/h | 2.9 | 2.9 |
| secondary | | 15 km/h | 15 km/h | 3.1 | 3.1 |
| tertiary | | 15 km/h | 15 km/h | 3.3 | 3.3 |
| primary_link | | 15 km/h | 15 km/h | 2.9 | 2.9 |
| secondary_link | | 15 km/h | 15 km/h | 3.1 | 3.1 |
| tertiary_link | | 15 km/h | 15 km/h | 3.3 | 3.3 |
| residential | | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | | 6 km/h +-1 | 6 km/h +-1 | 1.7 | 1.7 |
Scenario: Bike - Apply no penalties to ways with cycleways
Then routability should be
| highway | cycleway | forw | backw | forw_rate | backw_rate |
| motorway | track | 15 km/h | | 4.2 | |
| primary | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| secondary | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| tertiary | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| primary_link | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| secondary_link | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| tertiary_link | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| residential | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| motorway | lane | 15 km/h | | 4.2 | |
| primary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| secondary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| tertiary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| primary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| secondary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| tertiary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| residential | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| motorway | shared_lane | 15 km/h | | 4.2 | |
| primary | shared_lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
Scenario: Bike - Apply no penalties to ways in direction of cycleways
Then routability should be
| highway | cycleway:right | cycleway:left | forw | backw | forw_rate | backw_rate |
| motorway | track | | 15 km/h | | 4.2 | |
| primary | track | | 15 km/h | 15 km/h | 4.2 | 2.9 |
| secondary | track | | 15 km/h | 15 km/h | 4.2 | 3.1 |
| tertiary | track | | 15 km/h | 15 km/h | 4.2 | 3.3 |
| primary_link | track | | 15 km/h | 15 km/h | 4.2 | 2.9 |
| secondary_link | track | | 15 km/h | 15 km/h | 4.2 | 3.1 |
| tertiary_link | track | | 15 km/h | 15 km/h | 4.2 | 3.3 |
| residential | track | | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | track | | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | track | | 15 km/h | 6 km/h +-1 | 4.2 | 1.7 |
| motorway | | track | | 15 km/h | | 4.2 |
| primary | | track | 15 km/h | 15 km/h | 2.9 | 4.2 |
| secondary | | track | 15 km/h | 15 km/h | 3.1 | 4.2 |
| tertiary | | track | 15 km/h | 15 km/h | 3.3 | 4.2 |
| primary_link | | track | 15 km/h | 15 km/h | 2.9 | 4.2 |
| secondary_link | | track | 15 km/h | 15 km/h | 3.1 | 4.2 |
| tertiary_link | | track | 15 km/h | 15 km/h | 3.3 | 4.2 |
| residential | | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | | track | 6 km/h +-1 | 15 km/h | 1.7 | 4.2 |
| motorway | lane | | 15 km/h | | 4.2 | |
| primary | lane | | 15 km/h | 15 km/h | 4.2 | 2.9 |
| secondary | lane | | 15 km/h | 15 km/h | 4.2 | 3.1 |
| tertiary | lane | | 15 km/h | 15 km/h | 4.2 | 3.3 |
| primary_link | lane | | 15 km/h | 15 km/h | 4.2 | 2.9 |
| secondary_link | lane | | 15 km/h | 15 km/h | 4.2 | 3.1 |
| tertiary_link | lane | | 15 km/h | 15 km/h | 4.2 | 3.3 |
| residential | lane | | 15 km/h +-1 | 15 km/h +-1 | 4.2 | 4.2 |
| cycleway | lane | | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | lane | | 15 km/h | 6 km/h +-1 | 4.2 | 1.7 |
| motorway | | lane | | 15 km/h | | 4.2 |
| primary | | lane | 15 km/h | 15 km/h | 2.9 | 4.2 |
| secondary | | lane | 15 km/h +-1 | 15 km/h +-1 | 3.1 | 4.2 |
| tertiary | | lane | 15 km/h | 15 km/h | 3.3 | 4.2 |
| primary_link | | lane | 15 km/h | 15 km/h | 2.9 | 4.2 |
| secondary_link | | lane | 15 km/h | 15 km/h | 3.1 | 4.2 |
| tertiary_link | | lane | 15 km/h | 15 km/h | 3.3 | 4.2 |
| residential | | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | | lane | 6 km/h +-1 | 15 km/h | 1.7 | 4.2 |
| motorway | shared_lane | | 15 km/h | | 4.2 | |
| primary | shared_lane | | 15 km/h | 15 km/h | 4.2 | 2.9 |
| motorway | | shared_lane | | 15 km/h | | 4.2 |
| primary | | shared_lane | 15 km/h | 15 km/h | 2.9 | 4.2 |
Scenario: Bike - Don't apply penalties for all kind of cycleways
Then routability should be
| highway | cycleway | forw | backw | forw_rate | backw_rate |
| tertiary | shared_lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| tertiary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| tertiary | opposite | 15 km/h | 15 km/h | 3.3 | 4.2 |
-53
View File
@@ -1,53 +0,0 @@
@routing @bicycle @startpoint
Feature: Bike - Allowed start/end modes
Background:
Given the profile "bicycle"
Scenario: Bike - Don't start/stop on ferries
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | route | bicycle |
| ab | primary | | |
| bc | | ferry | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | cycling,cycling |
| 2 | 1 | ab,ab | cycling,cycling |
Scenario: Bike - Don't start/stop on trains
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | railway | bicycle |
| ab | primary | | |
| bc | | train | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | cycling,cycling |
| 2 | 1 | ab,ab | cycling,cycling |
Scenario: Bike - OK to start pushing bike
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway |
| ab | primary |
| bc | steps |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,bc,bc | cycling,pushing bike,pushing bike |
| 2 | 1 | bc,ab,ab | pushing bike,cycling,cycling |
+28 -60
View File
@@ -1,71 +1,39 @@
@routing @bicycle @train @routing @bicycle @train
Feature: Bike - Handle ferry routes Feature: Bike - Handle ferry routes
# Bringing bikes on trains and subways # Bringing bikes on trains and subways
# We cannot currently use a 'routability' type test, since the bike
# profile does not allow starting/stopping on trains, and
# it's not possible to modify the bicycle profile table because it's
# defined as local.
Background: Background:
Given the profile "bicycle" Given the profile "bicycle"
Scenario: Bike - Bringing bikes on trains Scenario: Bike - Bringing bikes on trains
Given the node map Then routability should be
""" | highway | railway | bicycle | bothw |
a 1 b c 2 d e 3 f g 4 h | primary | | | cycling |
""" | (nil) | train | | |
| (nil) | train | no | |
And the ways | (nil) | train | yes | train |
| nodes | highway | railway | bicycle | | (nil) | railway | | |
| ab | primary | | | | (nil) | railway | no | |
| cd | primary | | | | (nil) | railway | yes | train |
| ef | primary | | | | (nil) | subway | | |
| gh | primary | | | | (nil) | subway | no | |
| bc | | train | | | (nil) | subway | yes | train |
| de | | train | yes | | (nil) | tram | | |
| fg | | train | no | | (nil) | tram | no | |
| (nil) | tram | yes | train |
When I route I should get | (nil) | light_rail | | |
| from | to | route | | (nil) | light_rail | no | |
| 1 | 2 | | | (nil) | light_rail | yes | train |
| 2 | 3 | cd,de,ef,ef | | (nil) | monorail | | |
| 3 | 4 | | | (nil) | monorail | no | |
| (nil) | monorail | yes | train |
Scenario: Bike - Bringing bikes on trains, invalid railway tag is accepted if access specified | (nil) | some_tag | | |
Given the node map | (nil) | some_tag | no | |
""" | (nil) | some_tag | yes | cycling |
a 1 b c 2 d e 3 f g 4 h
"""
And the ways
| nodes | highway | railway | bicycle |
| ab | primary | | |
| cd | primary | | |
| ef | primary | | |
| gh | primary | | |
| bc | | invalid_tag | |
| de | | invalid_tag | yes |
| fg | | invalid_tag | no |
When I route I should get
| from | to | route |
| 1 | 2 | |
| 2 | 3 | cd,de,ef|
| 3 | 4 | |
@construction @construction
Scenario: Bike - Don't route on railways under construction Scenario: Bike - Don't route on railways under construction
Given the node map Then routability should be
""" | highway | railway | bicycle | bothw |
a 1 b c 2 d | primary | | | cycling |
""" | (nil) | construction | yes | |
And the ways
| nodes | highway | railway | bicycle |
| ab | primary | | |
| cd | primary | | |
| bc | | construction | yes |
When I route I should get
| from | to | route |
| 1 | 2 | |
+20 -20
View File
@@ -183,9 +183,9 @@ Feature: Car - Restricted access
Scenario: Car - designated HOV ways are rated low Scenario: Car - designated HOV ways are rated low
Then routability should be Then routability should be
| highway | hov | bothw | forw_rate | backw_rate | | highway | hov | bothw | forw_rate | backw_rate |
| primary | designated | x | 18.2 | 18.2 | | primary | designated | x | 18 | 18 |
| primary | yes | x | 18.2 | 18.2 | | primary | yes | x | 18 | 18 |
| primary | no | x | 18.2 | 18.2 | | primary | no | x | 18 | 18 |
# Models: # Models:
# https://www.openstreetmap.org/way/124891268 # https://www.openstreetmap.org/way/124891268
@@ -201,24 +201,24 @@ Feature: Car - Restricted access
Scenario: Car - a way with all lanes HOV-designated is highly penalized by default (similar to hov=designated) Scenario: Car - a way with all lanes HOV-designated is highly penalized by default (similar to hov=designated)
Then routability should be Then routability should be
| highway | hov:lanes:forward | hov:lanes:backward | hov:lanes | oneway | forw | backw | forw_rate | backw_rate | | highway | hov:lanes:forward | hov:lanes:backward | hov:lanes | oneway | forw | backw | forw_rate | backw_rate |
| primary | designated | designated | | | x | x | 18.2 | 18.2 | | primary | designated | designated | | | x | x | 18 | 18 |
# This test is flaky because non-deterministic turn generation sometimes emits a NoTurn here that is marked as restricted. #3769 # This test is flaky because non-deterministic turn generation sometimes emits a NoTurn here that is marked as restricted. #3769
#| primary | | designated | | | x | x | 18.2 | 18.2 | #| primary | | designated | | | x | x | 18 | 18 |
#| primary | designated | | | | x | x | 18.2 | 18.2 | #| primary | designated | | | | x | x | 18 | 18 |
| primary | designated\|designated | designated\|designated | | | x | x | 18.2 | 18.2 | | primary | designated\|designated | designated\|designated | | | x | x | 18 | 18 |
| primary | designated\|no | designated\|no | | | x | x | 18.2 | 18.2 | | primary | designated\|no | designated\|no | | | x | x | 18 | 18 |
| primary | yes\|no | yes\|no | | | x | x | 18.2 | 18.2 | | primary | yes\|no | yes\|no | | | x | x | 18 | 18 |
| primary | | | | | x | x | 18.2 | 18.2 | | primary | | | | | x | x | 18 | 18 |
| primary | designated | | | -1 | | x | | 18.2 | | primary | designated | | | -1 | | x | | 18 |
| primary | | designated | | -1 | | x | | 18.2 | | primary | | designated | | -1 | | x | | 18 |
| primary | | | designated | yes | x | | 18.2 | | | primary | | | designated | yes | x | | 18 | |
| primary | | | designated | -1 | | x | | 18.2 | | primary | | | designated | -1 | | x | | 18 |
| primary | | | designated\| | yes | x | | 18.2 | | | primary | | | designated\| | yes | x | | 18 | |
| primary | | | designated\| | -1 | | x | | 18.2 | | primary | | | designated\| | -1 | | x | | 18 |
| primary | | | designated\|designated | yes | x | | 18.2 | | | primary | | | designated\|designated | yes | x | | 18 | |
| primary | | | designated\|designated | -1 | | x | | 18.2 | | primary | | | designated\|designated | -1 | | x | | 18 |
| primary | | | designated\|yes | yes | x | | 18.2 | | | primary | | | designated\|yes | yes | x | | 18 | |
| primary | | | designated\|no | -1 | | x | | 18.2 | | primary | | | designated\|no | -1 | | x | | 18 |
Scenario: Car - these toll roads always work Scenario: Car - these toll roads always work
Then routability should be Then routability should be
@@ -1,8 +1,8 @@
@routing @approach @testbot @routing @approach
Feature: Approach parameter Feature: Approach parameter
Background: Background:
Given the profile "testbot" Given the profile "car"
And a grid size of 10 meters And a grid size of 10 meters
Scenario: Start End same approach, option unrestricted for Start and End Scenario: Start End same approach, option unrestricted for Start and End
-127
View File
@@ -1,127 +0,0 @@
@routing @car @mode
Feature: Car - Mode flag
Background:
Given the profile "car"
Scenario: Car - We tag ferries with a class
Given the node map
"""
a b
c d
"""
And the ways
| nodes | highway | route |
| ab | primary | |
| bc | | ferry |
| cd | primary | |
When I route I should get
| from | to | route | turns | classes |
| 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)],[()],[()] |
| c | a | bc,ab,ab | depart,notification left,arrive | [(ferry)],[()],[()] |
| d | b | cd,bc,bc | depart,notification right,arrive | [()],[(ferry)],[()] |
| a | c | ab,bc,bc | depart,notification right,arrive | [()],[(ferry)],[()] |
| b | d | bc,cd,cd | depart,notification left,arrive | [(ferry)],[()],[()] |
Scenario: Car - We tag motorways with a class
Given the node map
"""
a b
c d
"""
And the ways
| nodes | highway |
| ab | primary |
| bc | motorway|
| cd | primary |
When I route I should get
| from | to | route | turns | classes |
| a | d | ab,cd | depart,arrive | [(),(motorway),()],[()] |
| a | c | ab,bc | depart,arrive | [(),(motorway)],[()] |
| b | d | bc,cd | depart,arrive | [(motorway),()],[()] |
Scenario: Car - We tag motorway_link with a class
Given the node map
"""
a b
c d
"""
And the ways
| nodes | highway |
| ab | primary |
| bc | motorway_link |
| cd | primary |
When I route I should get
| from | to | route | turns | classes | # |
| 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)],[()] | " " |
| b | d | bc,cd | depart,arrive | [(motorway),()],[()] | no announcement |
Scenario: Car - We tag restricted with a class
Given the node map
"""
a b
c d
"""
And the ways
| nodes | highway | access |
| ab | primary | private |
| bc | motorway| private |
| cd | primary | |
When I route I should get
| from | to | route | turns | classes |
| a | d | ab,cd | depart,arrive| [(restricted),(motorway,restricted),()],[()] |
Scenario: Car - We toll restricted with a class
Given the node map
"""
a b
c d
"""
And the ways
| nodes | highway | toll |
| ab | primary | yes |
| bc | motorway| yes |
| cd | primary | |
When I route I should get
| from | to | route | turns | classes |
| 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)],[()] |
-17
View File
@@ -1,17 +0,0 @@
@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 |
+32 -32
View File
@@ -88,18 +88,18 @@ OSRM will use 4/5 of the projected free-flow speed.
| highway | maxspeed | width | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate | | highway | maxspeed | width | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate |
| primary | | | | | 64 km/h | 64 km/h | 18 | 18 | | primary | | | | | 64 km/h | 64 km/h | 18 | 18 |
| primary | | 3 | | | 64 km/h | 64 km/h | 9 | 9 | | primary | | 3 | | | 64 km/h | 64 km/h | 9 | 9 |
| primary | 60 | | | | 47 km/h | 47 km/h | 13.3 | 13.3 | | primary | 60 | | | | 47 km/h | 47 km/h | 13 | 13 |
| primary | 60 | 3 | | | 47 km/h | 47 km/h | 6.7 | 6.7 | | primary | 60 | 3 | | | 47 km/h | 47 km/h | 7 | 7 |
| primary | | | 60 | | 47 km/h | 64 km/h | 13.3 | 18 | | primary | | | 60 | | 47 km/h | 64 km/h | 13 | 18 |
| primary | | 3 | 60 | | 47 km/h | 64 km/h | 6.7 | 9 | | primary | | 3 | 60 | | 47 km/h | 64 km/h | 7 | 9 |
| primary | | | | 60 | 64 km/h | 47 km/h | 18 | 13.3 | | primary | | | | 60 | 64 km/h | 47 km/h | 18 | 13 |
| primary | | 3 | | 60 | 64 km/h | 47 km/h | 9 | 6.7 | | primary | | 3 | | 60 | 64 km/h | 47 km/h | 9 | 7 |
| primary | 15 | | 60 | | 47 km/h | 11 km/h | 13.3 | 3.3 | | primary | 15 | | 60 | | 47 km/h | 11 km/h | 13 | 3 |
| primary | 15 | 3 | 60 | | 48 km/h | 12 km/h | 6.7 | 1.7 | | primary | 15 | 3 | 60 | | 48 km/h | 12 km/h | 7 | 2 |
| primary | 15 | | | 60 | 12 km/h | 47 km/h | 3.3 | 13.3 | | primary | 15 | | | 60 | 12 km/h | 47 km/h | 3 | 13 |
| primary | 15 | 3 | | 60 | 12 km/h | 47 km/h | 1.7 | 6.7 | | primary | 15 | 3 | | 60 | 12 km/h | 47 km/h | 2 | 7 |
| primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | 6.7 | 13.3 | | primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | 7 | 13 |
| primary | 15 | 3 | 30 | 60 | 23 km/h | 47 km/h | 3.3 | 6.7 | | primary | 15 | 3 | 30 | 60 | 23 km/h | 47 km/h | 3 | 7 |
Scenario: Car - Single lane streets be ignored or incur a penalty Scenario: Car - Single lane streets be ignored or incur a penalty
Then routability should be Then routability should be
@@ -107,33 +107,33 @@ OSRM will use 4/5 of the projected free-flow speed.
| highway | maxspeed | lanes | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate | | highway | maxspeed | lanes | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate |
| primary | | | | | 64 km/h | 64 km/h | 18 | 18 | | primary | | | | | 64 km/h | 64 km/h | 18 | 18 |
| primary | | 1 | | | 64 km/h | 64 km/h | 9 | 9 | | primary | | 1 | | | 64 km/h | 64 km/h | 9 | 9 |
| primary | 60 | | | | 47 km/h | 47 km/h | 13.3 | 13.3 | | primary | 60 | | | | 47 km/h | 47 km/h | 13 | 13 |
| primary | 60 | 1 | | | 47 km/h | 47 km/h | 6.7 | 6.7 | | primary | 60 | 1 | | | 47 km/h | 47 km/h | 7 | 7 |
| primary | | | 60 | | 47 km/h | 64 km/h | 13.3 | 18 | | primary | | | 60 | | 47 km/h | 64 km/h | 13 | 18 |
| primary | | 1 | 60 | | 47 km/h | 64 km/h | 6.7 | 9 | | primary | | 1 | 60 | | 47 km/h | 64 km/h | 7 | 9 |
| primary | | | | 60 | 64 km/h | 47 km/h | 18 | 13.3 | | primary | | | | 60 | 64 km/h | 47 km/h | 18 | 13 |
| primary | | 1 | | 60 | 64 km/h | 47 km/h | 9 | 6.7 | | primary | | 1 | | 60 | 64 km/h | 47 km/h | 9 | 7 |
| primary | 15 | | 60 | | 47 km/h | 11 km/h | 13.3 | 3.3 | | primary | 15 | | 60 | | 47 km/h | 11 km/h | 13 | 3 |
| primary | 15 | 1 | 60 | | 48 km/h | 12 km/h | 6.7 | 1.7 | | primary | 15 | 1 | 60 | | 48 km/h | 12 km/h | 7 | 2 |
| primary | 15 | | | 60 | 12 km/h | 47 km/h | 3.3 | 13.3 | | primary | 15 | | | 60 | 12 km/h | 47 km/h | 3 | 13 |
| primary | 15 | 1 | | 60 | 12 km/h | 47 km/h | 1.7 | 6.7 | | primary | 15 | 1 | | 60 | 12 km/h | 47 km/h | 2 | 7 |
| primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | 6.7 | 13.3 | | primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | 7 | 13 |
| primary | 15 | 1 | 30 | 60 | 23 km/h | 47 km/h | 3.3 | 6.7 | | primary | 15 | 1 | 30 | 60 | 23 km/h | 47 km/h | 3 | 7 |
Scenario: Car - Single lane streets only incur a penalty for two-way streets Scenario: Car - Single lane streets only incur a penalty for two-way streets
Then routability should be Then routability should be
| highway | maxspeed | lanes | oneway | forw | backw | forw_rate | backw_rate | | highway | maxspeed | lanes | oneway | forw | backw | forw_rate | backw_rate |
| primary | 30 | 1 | yes | 23 km/h | | 6.7 | | | primary | 30 | 1 | yes | 23 km/h | | 7 | |
| primary | 30 | 1 | -1 | | 23 km/h | | 6.7 | | primary | 30 | 1 | -1 | | 23 km/h | | 7 |
| primary | 30 | 1 | | 23 km/h | 23 km/h | 3.3 | 3.3 | | primary | 30 | 1 | | 23 km/h | 23 km/h | 3 | 3 |
| primary | 30 | 2 | | 23 km/h | 23 km/h | 6.7 | 6.7 | | primary | 30 | 2 | | 23 km/h | 23 km/h | 7 | 7 |
Scenario: Car - Forward/backward maxspeed on reverse oneways Scenario: Car - Forward/backward maxspeed on reverse oneways
Then routability should be Then routability should be
| highway | maxspeed | maxspeed:forward | maxspeed:backward | oneway | forw | backw | forw_rate | backw_rate | | highway | maxspeed | maxspeed:forward | maxspeed:backward | oneway | forw | backw | forw_rate | backw_rate |
| primary | | | | -1 | | 64 km/h | | 18 | | primary | | | | -1 | | 64 km/h | | 18 |
| primary | 30 | | | -1 | | 23 km/h | | 6.7 | | primary | 30 | | | -1 | | 23 km/h | | 7 |
| primary | | 30 | | -1 | | 64 km/h | | 18 | | primary | | 30 | | -1 | | 64 km/h | | 18 |
| primary | | | 30 | -1 | | 23 km/h | | 6.7 | | primary | | | 30 | -1 | | 23 km/h | | 7 |
| primary | 20 | 30 | | -1 | | 15 km/h | | 4.4 | | primary | 20 | 30 | | -1 | | 15 km/h | | 4 |
| primary | 20 | | 30 | -1 | | 23 km/h | | 6.7 | | primary | 20 | | 30 | -1 | | 23 km/h | | 7 |
+4 -4
View File
@@ -7,8 +7,8 @@ Feature: Car - Surfaces
Scenario: Car - Ways tagged service should reduce speed Scenario: Car - Ways tagged service should reduce speed
Then routability should be Then routability should be
| highway | service | forw | backw | forw_rate | | highway | service | forw | backw | forw_rate |
| service | alley | 15 km/h +-1 | 15 km/h +-1 | 2.1 | | service | alley | 15 km/h +-1 | 15 km/h +-1 | 2 |
| service | emergency_access | | | | | service | emergency_access | | | |
| service | driveway | 15 km/h +-1 | 15 km/h +-1 | 2.1 | | service | driveway | 15 km/h +-1 | 15 km/h +-1 | 2 |
| service | drive-through | 15 km/h +-1 | 15 km/h +-1 | 2.1 | | service | drive-through | 15 km/h +-1 | 15 km/h +-1 | 2 |
| service | parking | 15 km/h +-1 | 15 km/h +-1 | 2.1 | | service | parking | 15 km/h +-1 | 15 km/h +-1 | 2 |
+1 -1
View File
@@ -50,4 +50,4 @@ Feature: Car - speeds
Then routability should be Then routability should be
| highway | side_road | forw | backw | forw_rate | backw_rate | | highway | side_road | forw | backw | forw_rate | backw_rate |
| primary | yes | 64 km/h | 64 km/h | 14.4 | 14.4 | | primary | yes | 64 km/h | 64 km/h | 14 | 14 |
-37
View File
@@ -1,37 +0,0 @@
@routing @car @startpoint
Feature: Car - Allowed start/end modes
Background:
Given the profile "car"
Scenario: Car - Don't start/stop on ferries
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | route | bicycle |
| ab | primary | | |
| bc | | ferry | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | driving,driving |
| 2 | 1 | ab,ab | driving,driving |
Scenario: Car - Don't start/stop on trains
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | railway | bicycle |
| ab | primary | | |
| bc | | train | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | driving,driving |
| 2 | 1 | ab,ab | driving,driving |
-37
View File
@@ -1,37 +0,0 @@
@routing @foot @startpoint
Feature: Foot - Allowed start/end modes
Background:
Given the profile "foot"
Scenario: Foot - Don't start/stop on ferries
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | route | bicycle |
| ab | primary | | |
| bc | | ferry | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | walking,walking |
| 2 | 1 | ab,ab | walking,walking |
Scenario: Foot - Don't start/stop on trains
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | railway | bicycle |
| ab | primary | | |
| bc | | train | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | walking,walking |
| 2 | 1 | ab,ab | walking,walking |
+14 -14
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 | ,;right:true, | | a,f | in,cross,cross | depart,continue right,arrive | ,, |
@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;left:false straight:false right:true, | | a,f | in,cross,cross | depart,turn right,arrive | ,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;left:false straight:false right:true, | | a,f | in,cross,cross | depart,turn right,arrive | ,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
+86 -48
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 100 meters Given a grid size of 20 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 | ;;none:true slight right:false, | | a,j | ab,xbcj | depart,arrive | , |
@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 | locations | lanes | | waypoints | route | turns | destinations | lanes | locations |
| 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, | | 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 |
@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 | ;left:false straight:true straight:true right:false, | | a,c | 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, | | a,d | main,main | depart,arrive | , |
@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,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,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,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, | | 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, |
@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,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,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,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 | | 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 |
| 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,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,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,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 | | 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 |
@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,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,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,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, | | 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, |
| 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,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,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, | | 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, |
@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 | 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, | | 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, |
@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 | intersection_lanes | | waypoints | route | turns | lanes |
| a,f | ab,df,df | depart,roundabout-exit-1,arrive | ,, | | | a,f | ab,df,df | depart,roundabout-exit-1,use lane slight right,arrive | ,,slight left:false slight left:false slight right:true, |
@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,11 +623,40 @@ Feature: Turn Lane Guidance
""" """
/a\ /a\
x b d y x b d y
| |
| |
| |
| |
| |
| |
| |
| |
| | | |
| | | |
| | | |
| | | |
\ / | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
|
|
|
|
|
|
|
|
c c
""" """
@@ -642,9 +671,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
@@ -760,6 +789,13 @@ Feature: Turn Lane Guidance
Given the node map Given the node map
""" """
a b x a b x
|
|
|
|
|
|
|
| |
| |
| |
@@ -787,9 +823,11 @@ 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 | | | | | |
p o n m l k j a - - - - - - - - - - b - - - - - - - - - - c - - - - - - - - - - d - - - - - - - - - - e - - - - - - - - - - f - - - - - - - - - - g - h - i
| | | | | | |
p o n m l k j
""" """
And the ways And the ways
@@ -811,6 +849,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 | 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,i | road,road,road | depart,use lane straight,arrive | a,g,i | ,left:false none:true none:true none:false, |
| 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, | | 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, |
+2 -2
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 | lanes | | waypoints | route | turns | locations |
| a,e | main,main | depart,arrive | a,e | ;left:false straight:false straight:true straight:false right:false;left:false straight:true right:false, | | a,e | main,main,main | depart,use lane straight,arrive | a,c,e |
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
@@ -1,98 +0,0 @@
@routing @guidance
Feature: Exit Numbers and Names
Background:
Given the profile "car"
Given a grid size of 10 meters
Scenario: Exit number on the way after the motorway junction
Given the node map
"""
a . . b . c . . d
` e . . f
"""
And the nodes
| node | highway |
| b | motorway_junction |
And the ways
| nodes | highway | name | junction:ref |
| abcd | motorway | MainRoad | |
| be | motorway_link | ExitRamp | 3 |
| ef | motorway_link | ExitRamp | |
When I route I should get
| waypoints | route | turns | exits |
| a,f | MainRoad,ExitRamp,ExitRamp | depart,off ramp slight right,arrive | ,3, |
Scenario: Exit number on the way, motorway junction node tag missing, multiple numbers
Given the node map
"""
a . . b . c . . d
` e . . f
"""
And the ways
| nodes | highway | name | junction:ref |
| abcd | motorway | MainRoad | |
| be | motorway_link | ExitRamp | 10;12 |
| ef | motorway_link | ExitRamp | |
When I route I should get
| waypoints | route | turns | exits |
| 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
Given the node map
"""
a . . b . c . . d
` e . . f
` g . . h
"""
And the nodes
| node | highway |
| b | motorway_junction |
And the ways
| nodes | highway | name | junction:ref |
| abcd | motorway | MainRoad | |
| be | motorway_link | ExitRamp | 3 |
| ef | motorway_link | ExitRamp | |
| bg | motorway_link | ExitRamp | 3 |
| gh | motorway_link | ExitRamp | |
When I route I should get
| waypoints | route | turns | exits |
| a,f | MainRoad,ExitRamp,ExitRamp | depart,off ramp slight right,arrive | ,3, |
| a,h | MainRoad,ExitRamp,ExitRamp | depart,off ramp right,arrive | ,3, |
# http://www.openstreetmap.org/way/417524818#map=17/37.38663/-121.97972
Scenario: Exit 393 on Bayshore Freeway
Given the node map
"""
a
` b
` c
. ` d
f ` e
"""
And the nodes
| node | highway |
| c | motorway_junction |
And the ways
| nodes | highway | name | junction:ref | oneway | destination |
| abcde | motorway | Bayshore Freeway | | yes | |
| cf | motorway_link | | 393 | yes | Great America Parkway;Bowers Avenue |
When I route I should get
| waypoints | route | turns | exits | destinations |
| a,e | Bayshore Freeway,Bayshore Freeway | depart,arrive | , | , |
| a,f | Bayshore Freeway,, | depart,off ramp slight right,arrive | ,393,393 | ,Great America Parkway, Bowers Avenue,Great America Parkway, Bowers Avenue |
-20
View File
@@ -261,23 +261,3 @@ 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 |
+13 -13
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 | | waypoints | route | turns | lanes |
| 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 | | waypoints | route | turns | lanes |
| 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
-73
View File
@@ -1371,76 +1371,3 @@ Feature: Simple Turns
When I route I should get When I route I should get
| waypoints | route | | waypoints | route |
| g,e | abcde,abcde | | g,e | abcde,abcde |
# 4205
# https://www.openstreetmap.org/node/36153635#map=19/51.97548/7.61795
Scenario: merging onto a through street
Given the node map
"""
e
`
`
`
`
d
c
a - - - - - - - b``
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
f
"""
And the ways
| nodes | oneway | name |
| abc | yes | fww |
| fcde | no | jahn |
When I route I should get
| waypoints | route | turns |
| a,f | fww,jahn,jahn | depart,turn right,arrive |
| a,e | fww,jahn,jahn | depart,turn left,arrive |
+74 -74
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 | ;straight:true right:false, | | a,c | road,road | depart,arrive | , |
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 | ;left:false straight:true, | | a,c | road,road | depart,arrive | , |
# 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 | intersection_lanes | | waypoints | route | turns | lanes |
| a,j | road,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true | ,left:false straight:false right:true | | a,j | road,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true |
| a,d | road,road | depart,arrive | , | left:false straight:true right:false, | | a,d | road,road,road | depart,use lane straight,arrive | ,left:false straight:true right:false, |
| a,l | road,cross,cross | depart,turn left,arrive | ,left:true straight:false right:false, | ,left:true straight:false right:false, | | a,l | road,cross,cross | depart,turn left,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 | | a,h | road,road,road | depart,continue uturn,arrive | ,left:true straight:false right:false, |
| k,d | cross,road,road | depart,turn right,arrive | ,left:false straight;right:true, | ,left:false straight;right:true, | | k,d | cross,road,road | depart,turn right,arrive | ,left:false straight;right:true, |
| k,l | cross,cross | depart,arrive | , | left:false straight;right:true, | | k,l | cross,cross,cross | depart,use lane straight,arrive | ,left:false straight;right:true, |
| k,h | cross,road,road | depart,turn left,arrive | ,left:true straight;right:false, | ,left:true straight;right:false, | | k,h | cross,road,road | depart,turn left,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, | | k,j | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight;right:false, |
| e,l | road,cross,cross | depart,turn right,arrive | ,none:false straight:false straight;right:true, | ,none:false straight:false straight;right:true, | | e,l | road,cross,cross | depart,turn right,arrive | ,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, | ,none:true straight:false straight;right:false, | | e,j | road,cross,cross | depart,turn left,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, | | e,d | road,road,road | depart,continue uturn,arrive | ,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 | depart,arrive | | left:false straight:true, | | i,j | cross,cross,cross | depart,use lane straight,arrive | ,left:false straight:true, |
| i,d | cross,road,road | depart,turn left,arrive | ,left:true straight:false, | ,left:true straight:false, | | i,d | cross,road,road | depart,turn left,arrive | ,left:true straight:false, |
| i,l | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight:false, | ,left:true straight:false, | | i,l | cross,cross,cross | depart,continue uturn,arrive | ,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 | ;;left:false straight:true, | | i,j | cross,cross | depart,arrive | , |
| i,l | cross,cross,cross | depart,continue uturn,arrive | ;,left:true straight:false;left:true straight:false;left:false straight:true, | | i,l | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight:false, |
@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 | ;none:true right:false, | | a,d | road,road | depart,arrive | , |
@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 | ;;none:true right:false, | | a,i | road,road | depart,arrive | , |
| 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 | ;;left:false none:true, | | i,a | road,road | depart,arrive | , |
@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,left:true straight:false, | | a,f | road,turn,turn | depart,turn left,arrive | ,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,left:true straight;right:false, | | a,f | road,turn,turn | depart,turn left,arrive | ,left:true straight;right:false, |
| a,d | road,road | depart,arrive | ;left:false straight;right:true;left:false straight;right:true, | | a,d | road,road | depart,arrive | , |
| 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;left:true right:false, | | a,f | road,turn,turn | depart,turn left,arrive | ,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 | ;straight:true right:false, | | a,d | road,road | depart,arrive | , |
| 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;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, |
| 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, | | a,e | road,road | depart,arrive | , |
#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,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, |
| 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 | h | 180,180 180,180 | road,cross,cross | depart,turn left,arrive | ,none:true straight:false right:false, |
| a | i | 180,180 180,180 | road,road | depart,arrive | ;none:true straight:true right:false;none:true straight:true right:false, | | a | i | 180,180 180,180 | road,road | depart,arrive | , |
| 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 | ;straight:true straight:true straight;slight right:true slight right:false, | | a,d | road,road | depart,arrive | , |
| 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 | ;straight:true straight:true straight;slight right:true slight right:false, | | a,d | hwy,hwy | depart,arrive | , |
| 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 | ;straight:true straight:true slight right:false, | | a,c | hwy,hwy | depart,arrive | , |
| 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 | ;;none:true slight right:false, | | a,j | on,xbcj | depart,arrive | , |
| 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 | ;straight;right:true;straight;right:true, | | x,d | road,road | depart,arrive | , |
@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,left:true right:false, | a,c,e | | a,e | road,cross,cross | depart,end of road left,arrive | ,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,left:true right:false, | a,c,e | | a,e | road,cross,cross | depart,end of road left,arrive | ,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 | ;left:false none:true none:true, | | a,c | road,road | depart,arrive | , |
@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 | ;none:true none:true right:false, | | a,c | road,road | depart,arrive | , |
@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:false straight:true straight;right:false,left:true straight:false straight;right:false;;, | a,d,f | | a,f | road1,road1,road1 | depart,continue uturn,arrive | ,left:true straight:false straight;right:false, | a,d,f |
@@ -1,4 +1,5 @@
@contract @options @edge-weight-updates-over-factor # Broken see issue #4065
@contract @options @edge-weight-updates-over-factor @todo
Feature: osrm-contract command line option: edge-weight-updates-over-factor Feature: osrm-contract command line option: edge-weight-updates-over-factor
Background: Log edge weight updates over given factor Background: Log edge weight updates over given factor
@@ -21,7 +22,6 @@ Feature: osrm-contract command line option: edge-weight-updates-over-factor
Scenario: Logging weight with updates over factor of 2, long segment Scenario: Logging weight with updates over factor of 2, long segment
When I run "osrm-extract --profile {profile_file} {osm_file}" When I run "osrm-extract --profile {profile_file} {osm_file}"
And the data has been partitioned
When I run "osrm-contract --edge-weight-updates-over-factor 2 --segment-speed-file {speeds_file} {processed_file}" When I run "osrm-contract --edge-weight-updates-over-factor 2 --segment-speed-file {speeds_file} {processed_file}"
Then stderr should not contain "Speed values were used to update 2 segment(s)" Then stderr should not contain "Speed values were used to update 2 segment(s)"
And stderr should contain "Segment: 1,2" And stderr should contain "Segment: 1,2"
+2 -2
View File
@@ -34,7 +34,7 @@ module.exports = function () {
outputRow[rate] = result[direction].status ? outputRow[rate] = result[direction].status ?
result[direction].status.toString() : ''; result[direction].status.toString() : '';
break; break;
case /^\d+(\.\d+){0,1}$/.test(want): case /^\d+$/.test(want):
if (result[direction].rate !== undefined && !isNaN(result[direction].rate)) { if (result[direction].rate !== undefined && !isNaN(result[direction].rate)) {
outputRow[rate] = result[direction].rate.toString(); outputRow[rate] = result[direction].rate.toString();
} else { } else {
@@ -135,7 +135,7 @@ module.exports = function () {
if (r.route.split(',')[0] === util.format('w%d', i)) { if (r.route.split(',')[0] === util.format('w%d', i)) {
r.time = r.json.routes[0].duration; r.time = r.json.routes[0].duration;
r.distance = r.json.routes[0].distance; r.distance = r.json.routes[0].distance;
r.rate = Math.round(r.distance / r.json.routes[0].weight * 10) / 10.; r.rate = Math.round(r.distance / r.json.routes[0].weight);
r.speed = r.time > 0 ? parseInt(3.6 * r.distance / r.time) : null; r.speed = r.time > 0 ? parseInt(3.6 * r.distance / r.time) : null;
// use the mode of the first step of the route // use the mode of the first step of the route
+4 -1
View File
@@ -85,7 +85,8 @@ module.exports = function () {
} }
var ok = true, var ok = true,
encodedResult = ''; encodedResult = '',
extendedTarget = '';
if (json.trips) row.trips.split(',').forEach((sub, si) => { if (json.trips) row.trips.split(',').forEach((sub, si) => {
if (si >= subTrips.length) { if (si >= subTrips.length) {
@@ -97,9 +98,11 @@ module.exports = function () {
outNode = subTrips[si][ni]; outNode = subTrips[si][ni];
if (this.FuzzyMatch.matchLocation(outNode, node)) { if (this.FuzzyMatch.matchLocation(outNode, node)) {
encodedResult += sub[ni]; encodedResult += sub[ni];
extendedTarget += sub[ni];
} else { } else {
ok = false; ok = false;
encodedResult += util.format('? [%s,%s]', outNode[0], outNode[1]); encodedResult += util.format('? [%s,%s]', outNode[0], outNode[1]);
extendedTarget += util.format('%s [%d,%d]', sub[ni], node.lat, node.lon);
} }
} }
} }
+3 -3
View File
@@ -238,9 +238,9 @@ module.exports = function () {
// a shallow copy of scenario parameters to avoid data inconsistency // a shallow copy of scenario parameters to avoid data inconsistency
// if a cucumber timeout occurs during deferred jobs // if a cucumber timeout occurs during deferred jobs
let p = {extractArgs: this.extractArgs, contractArgs: this.contractArgs, let p = {extractArgs: this.extractArgs, contractArgs: this.contractArgs,
partitionArgs: this.partitionArgs, customizeArgs: this.customizeArgs, partitionArgs: this.partitionArgs, customizeArgs: this.customizeArgs,
profileFile: this.profileFile, inputCacheFile: this.inputCacheFile, profileFile: this.profileFile, inputCacheFile: this.inputCacheFile,
processedCacheFile: this.processedCacheFile, environment: this.environment}; processedCacheFile: this.processedCacheFile, environment: this.environment};
let queue = d3.queue(1); let queue = d3.queue(1);
queue.defer(this.extractData.bind(this), p); queue.defer(this.extractData.bind(this), p);
queue.defer(this.partitionData.bind(this), p); queue.defer(this.partitionData.bind(this), p);
+11 -26
View File
@@ -155,10 +155,6 @@ module.exports = function () {
return this.extractInstructionList(instructions, s => s.destinations || ''); return this.extractInstructionList(instructions, s => s.destinations || '');
}; };
this.exitsList = (instructions) => {
return this.extractInstructionList(instructions, s => s.exits || '');
};
this.reverseBearing = (bearing) => { this.reverseBearing = (bearing) => {
if (bearing >= 180) if (bearing >= 180)
return bearing - 180.; return bearing - 180.;
@@ -171,24 +167,6 @@ 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 || '');
}; };
@@ -215,6 +193,17 @@ 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 => {
@@ -267,10 +256,6 @@ module.exports = function () {
return this.extractInstructionList(instructions, s => s.mode); return this.extractInstructionList(instructions, s => s.mode);
}; };
this.classesList = (instructions) => {
return this.extractInstructionList(instructions, s => '[' + s.intersections.map(i => '(' + (i.classes ? i.classes.join(',') : '') + ')').join(',') + ']');
};
this.timeList = (instructions) => { this.timeList = (instructions) => {
return this.extractInstructionList(instructions, s => s.duration + 's'); return this.extractInstructionList(instructions, s => s.duration + 's');
}; };
+2 -6
View File
@@ -34,7 +34,7 @@ module.exports = function () {
var afterRequest = (err, res, body) => { var afterRequest = (err, res, body) => {
if (err) return cb(err); if (err) return cb(err);
if (body && body.length) { if (body && body.length) {
let destinations, exits, pronunciations, instructions, refs, bearings, turns, modes, times, classes, let destinations, pronunciations, instructions, refs, bearings, turns, modes, times,
distances, summary, intersections, lanes, locations, annotation, weight_name, weights, approaches; distances, summary, intersections, lanes, locations, annotation, weight_name, weights, approaches;
let json = JSON.parse(body); let json = JSON.parse(body);
@@ -48,12 +48,10 @@ module.exports = function () {
pronunciations = this.pronunciationList(json.routes[0]); pronunciations = this.pronunciationList(json.routes[0]);
refs = this.refList(json.routes[0]); refs = this.refList(json.routes[0]);
destinations = this.destinationsList(json.routes[0]); destinations = this.destinationsList(json.routes[0]);
exits = this.exitsList(json.routes[0]);
bearings = this.bearingList(json.routes[0]); bearings = this.bearingList(json.routes[0]);
turns = this.turnList(json.routes[0]); turns = this.turnList(json.routes[0]);
intersections = this.intersectionList(json.routes[0]); intersections = this.intersectionList(json.routes[0]);
modes = this.modeList(json.routes[0]); modes = this.modeList(json.routes[0]);
classes = this.classesList(json.routes[0]);
times = this.timeList(json.routes[0]); times = this.timeList(json.routes[0]);
distances = this.distanceList(json.routes[0]); distances = this.distanceList(json.routes[0]);
lanes = this.lanesList(json.routes[0]); lanes = this.lanesList(json.routes[0]);
@@ -175,12 +173,10 @@ module.exports = function () {
putValue('bearing', bearings); putValue('bearing', bearings);
putValue('turns', turns); putValue('turns', turns);
putValue('modes', modes); putValue('modes', modes);
putValue('classes', classes);
putValue('times', times); putValue('times', times);
putValue('distances', distances); putValue('distances', distances);
putValue('pronunciations', pronunciations); putValue('pronunciations', pronunciations);
putValue('destinations', destinations); putValue('destinations', destinations);
putValue('exits', exits);
putValue('weight_name', weight_name); putValue('weight_name', weight_name);
putValue('weights', weights); putValue('weights', weights);
putValue('weight', weight); putValue('weight', weight);
@@ -247,7 +243,7 @@ module.exports = function () {
} else if (row.waypoints) { } else if (row.waypoints) {
row.waypoints.split(',').forEach((n) => { row.waypoints.split(',').forEach((n) => {
var node = this.findNodeByName(n.trim()); var node = this.findNodeByName(n.trim());
if (!node) return cb(new Error(util.format('*** unknown waypoint node "%s"', n.trim()))); if (!node) return cb(new Error('*** unknown waypoint node "%s"', n.trim()));
waypoints.push(node); waypoints.push(node);
}); });
got.waypoints = row.waypoints; got.waypoints = row.waypoints;
-30
View File
@@ -1,30 +0,0 @@
@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 |
+4 -26
View File
@@ -358,8 +358,8 @@ Feature: Basic Map Matching
| trace | matchings | alternatives | | trace | matchings | alternatives |
| abcdef | abcde | 0,0,0,0,1,1 | | abcdef | abcde | 0,0,0,0,1,1 |
Scenario: Testbot - Speed greater than speed threshold Scenario: Testbot - Speed greater than speed threshhold
Given a grid size of 100 meters Given a grid size of 10 meters
Given the query options Given the query options
| geometries | geojson | | geometries | geojson |
@@ -379,8 +379,8 @@ Feature: Basic Map Matching
| trace | timestamps | matchings | | trace | timestamps | matchings |
| abcd | 0 1 2 3 | ab,cd | | abcd | 0 1 2 3 | ab,cd |
Scenario: Testbot - Speed less than speed threshold Scenario: Testbot - Speed less than speed threshhold
Given a grid size of 100 meters Given a grid size of 10 meters
Given the query options Given the query options
| geometries | geojson | | geometries | geojson |
@@ -397,28 +397,6 @@ Feature: Basic Map Matching
| trace | timestamps | matchings | | trace | timestamps | matchings |
| abcd | 0 1 2 3 | abcd | | abcd | 0 1 2 3 | abcd |
Scenario: Testbot - Huge gap in the coordinates
Given a grid size of 100 meters
Given the query options
| geometries | geojson |
| gaps | ignore |
Given the node map
"""
a b c d ---- x
|
|
y ---- z ---- efjk
"""
And the ways
| nodes | oneway |
| abcdxyzefjk | no |
When I match I should get
| trace | timestamps | matchings |
| abcdefjk | 0 1 2 3 50 51 52 53 | abcdefjk |
# Regression test 1 for issue 3176 # Regression test 1 for issue 3176
Scenario: Testbot - multiple segments: properly expose OSM IDs Scenario: Testbot - multiple segments: properly expose OSM IDs
Given the query options Given the query options
+5 -65
View File
@@ -48,40 +48,21 @@ Feature: Multi level routing
lkpo lkpo
""" """
And the nodes
| node | highway |
| i | traffic_signals |
| n | traffic_signals |
And the ways And the ways
| nodes | highway | | nodes | highway |
| abcda | primary | | abcda | primary |
| efghe | primary | | efghe | primary |
| ijkli | primary | | ijkli | primary |
| mnopm | primary | | nmop | primary |
| cm | primary | | cm | primary |
| hj | primary | | hj | primary |
| kp | primary | | kp | primary |
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
| a | b | abcda,abcda | 20s | | a | b | abcda,abcda | 20s |
| a | f | abcda,cm,mnopm,kp,ijkli,hj,efghe,efghe | 229.4s | | a | f | abcda,cm,nmop,kp,ijkli,hj,efghe,efghe | 257.7s |
| a | l | abcda,cm,mnopm,kp,ijkli,ijkli | 144.7s | | c | m | cm,cm | 44.7s |
| a | o | abcda,cm,mnopm,mnopm,mnopm | 124.7s |
| f | l | efghe,hj,ijkli,ijkli,ijkli | 124.7s |
| f | o | efghe,hj,ijkli,kp,mnopm,mnopm | 144.7s |
| l | o | ijkli,kp,mnopm,mnopm | 60s |
| c | m | cm,cm | 44.7s |
When I request a travel time matrix I should get
| | a | f | l | o |
| a | 0 | 229.4 | 144.7 | 124.7 |
| f | 229.4 | 0 | 124.7 | 144.7 |
| l | 144.7 | 124.7 | 0 | 60 |
| o | 124.7 | 144.7 | 60 | 0 |
Scenario: Testbot - Multi level routing: horizontal road Scenario: Testbot - Multi level routing: horizontal road
Given the node map Given the node map
@@ -146,44 +127,3 @@ Feature: Multi level routing
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
| a | k | abcda,ch,hf,fi,ijkli,ijkli | 724.3s | | a | k | abcda,ch,hf,fi,ijkli,ijkli | 724.3s |
Scenario: Testbot - Edge case for matrix plugin with
Given the node map
"""
ab
dc
e f
h gi
"""
And the partition extra arguments "--small-component-size 1 --max-cell-sizes 5,16,64"
And the nodes
| node | highway |
| e | traffic_signals |
| g | traffic_signals |
And the ways
| nodes | highway | maxspeed |
| abcda | primary | |
| ac | primary | |
| db | primary | |
| deh | primary | |
| cfg | primary | |
| ef | primary | 1 |
| eg | primary | 1 |
| hf | primary | 1 |
| hg | primary | 1 |
| gi | primary | |
When I route I should get
| from | to | route | time |
| h | i | deh,abcda,cfg,gi,gi | 134s |
When I request a travel time matrix I should get
| | h | i |
| h | 0 | 134 |
| i | 134 | 0 |
-1
View File
@@ -14,7 +14,6 @@ Feature: Testbot - Check assigning nil values
result.name = nil result.name = nil
result.ref = nil result.ref = nil
result.destinations = nil result.destinations = nil
result.exits = nil
result.pronunciation = nil result.pronunciation = nil
result.turn_lanes_forward = nil result.turn_lanes_forward = nil
result.turn_lanes_backward = nil result.turn_lanes_backward = nil
+7
View File
@@ -65,9 +65,16 @@ class Contractor
std::vector<EdgeWeight> &&node_weights, std::vector<EdgeWeight> &&node_weights,
std::vector<bool> &is_core_node, std::vector<bool> &is_core_node,
std::vector<float> &inout_node_levels) const; std::vector<float> &inout_node_levels) const;
void WriteCoreNodeMarker(std::vector<bool> &&is_core_node) const;
void WriteContractedGraph(unsigned number_of_edge_based_nodes,
util::DeallocatingVector<QueryEdge> contracted_edge_list);
private: private:
ContractorConfig config; ContractorConfig config;
EdgeID LoadEdgeExpandedGraph(const ContractorConfig &config,
std::vector<extractor::EdgeBasedEdge> &edge_based_edge_list,
std::vector<EdgeWeight> &node_weights);
}; };
} }
} }
-21
View File
@@ -14,27 +14,6 @@ namespace contractor
{ {
namespace files namespace files
{ {
// reads .osrm.core
template <typename CoreVectorT>
void readCoreMarker(const boost::filesystem::path &path, CoreVectorT &is_core_node)
{
static_assert(util::is_view_or_vector<bool, CoreVectorT>::value,
"is_core_node must be a vector");
storage::io::FileReader reader(path, storage::io::FileReader::VerifyFingerprint);
storage::serialization::read(reader, is_core_node);
}
// writes .osrm.core
template <typename CoreVectorT>
void writeCoreMarker(const boost::filesystem::path &path, const CoreVectorT &is_core_node)
{
static_assert(util::is_view_or_vector<bool, CoreVectorT>::value,
"is_core_node must be a vector");
storage::io::FileWriter writer(path, storage::io::FileWriter::GenerateFingerprint);
storage::serialization::write(writer, is_core_node);
}
// reads .osrm.hsgr file // reads .osrm.hsgr file
template <typename QueryGraphT> template <typename QueryGraphT>
+8 -25
View File
@@ -14,6 +14,8 @@
#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>
@@ -23,10 +25,6 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#if USE_STXXL_LIBRARY
#include <stxxl/vector>
#endif
namespace osrm namespace osrm
{ {
namespace contractor namespace contractor
@@ -35,12 +33,6 @@ 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;
@@ -99,8 +91,8 @@ class GraphContractor
GraphContractor(int nodes, GraphContractor(int nodes,
std::vector<ContractorEdge> edges, std::vector<ContractorEdge> edges,
std::vector<float> node_levels_, std::vector<float> &&node_levels_,
std::vector<EdgeWeight> node_weights_); std::vector<EdgeWeight> &&node_weights_);
/* Flush all data from the contraction to disc and reorder stuff for better locality */ /* Flush all data from the contraction to disc and reorder stuff for better locality */
void FlushDataAndRebuildContractorGraph(ThreadDataContainer &thread_data_list, void FlushDataAndRebuildContractorGraph(ThreadDataContainer &thread_data_list,
@@ -109,14 +101,12 @@ class GraphContractor
void Run(double core_factor = 1.0); void Run(double core_factor = 1.0);
std::vector<bool> GetCoreMarker(); void GetCoreMarker(std::vector<bool> &out_is_core_node);
std::vector<float> GetNodeLevels(); void GetNodeLevels(std::vector<float> &out_node_levels);
template <class Edge> inline util::DeallocatingVector<Edge> GetEdges() template <class Edge> inline void GetEdges(util::DeallocatingVector<Edge> &edges)
{ {
util::DeallocatingVector<Edge> edges;
util::UnbufferedLog log; util::UnbufferedLog log;
log << "Getting edges of minimized graph "; log << "Getting edges of minimized graph ";
util::Percent p(log, contractor_graph->GetNumberOfNodes()); util::Percent p(log, contractor_graph->GetNumberOfNodes());
@@ -171,13 +161,6 @@ class GraphContractor
edges.append(external_edge_list.begin(), external_edge_list.end()); edges.append(external_edge_list.begin(), external_edge_list.end());
external_edge_list.clear(); external_edge_list.clear();
// sort and remove duplicates
tbb::parallel_sort(edges.begin(), edges.end());
auto new_end = std::unique(edges.begin(), edges.end());
edges.resize(new_end - edges.begin());
return edges;
} }
private: private:
@@ -409,7 +392,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;
ExternalVector<QueryEdge> external_edge_list; stxxl::vector<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;
+16 -30
View File
@@ -20,7 +20,6 @@ class CellCustomizer
struct HeapData struct HeapData
{ {
bool from_clique; bool from_clique;
EdgeDuration duration;
}; };
public: public:
@@ -42,41 +41,31 @@ class CellCustomizer
{ {
std::unordered_set<NodeID> destinations_set(destinations.begin(), destinations.end()); std::unordered_set<NodeID> destinations_set(destinations.begin(), destinations.end());
heap.Clear(); heap.Clear();
heap.Insert(source, 0, {false, 0}); heap.Insert(source, 0, {false});
// explore search space // explore search space
while (!heap.Empty() && !destinations_set.empty()) while (!heap.Empty() && !destinations_set.empty())
{ {
const NodeID node = heap.DeleteMin(); const NodeID node = heap.DeleteMin();
const EdgeWeight weight = heap.GetKey(node); const EdgeWeight weight = heap.GetKey(node);
const EdgeDuration duration = heap.GetData(node).duration;
if (level == 1) if (level == 1)
RelaxNode<true>(graph, cells, heap, level, node, weight, duration); RelaxNode<true>(graph, cells, heap, level, node, weight);
else else
RelaxNode<false>(graph, cells, heap, level, node, weight, duration); RelaxNode<false>(graph, cells, heap, level, node, weight);
destinations_set.erase(node); destinations_set.erase(node);
} }
// fill a map of destination nodes to placeholder pointers // fill a map of destination nodes to placeholder pointers
auto weights = cell.GetOutWeight(source); auto destination_iter = destinations.begin();
auto durations = cell.GetOutDuration(source); for (auto &weight : cell.GetOutWeight(source))
for (auto &destination : destinations)
{ {
BOOST_ASSERT(!weights.empty()); BOOST_ASSERT(destination_iter != destinations.end());
BOOST_ASSERT(!durations.empty()); const auto destination = *destination_iter++;
weight =
const bool inserted = heap.WasInserted(destination); heap.WasInserted(destination) ? heap.GetKey(destination) : INVALID_EDGE_WEIGHT;
weights.front() = inserted ? heap.GetKey(destination) : INVALID_EDGE_WEIGHT;
durations.front() =
inserted ? heap.GetData(destination).duration : MAXIMAL_EDGE_DURATION;
weights.advance_begin(1);
durations.advance_begin(1);
} }
BOOST_ASSERT(weights.empty());
BOOST_ASSERT(durations.empty());
} }
} }
@@ -105,8 +94,7 @@ class CellCustomizer
Heap &heap, Heap &heap,
LevelID level, LevelID level,
NodeID node, NodeID node,
EdgeWeight weight, EdgeWeight weight) const
EdgeDuration duration) const
{ {
BOOST_ASSERT(heap.WasInserted(node)); BOOST_ASSERT(heap.WasInserted(node));
@@ -125,26 +113,24 @@ class CellCustomizer
auto subcell_id = partition.GetCell(level - 1, node); auto subcell_id = partition.GetCell(level - 1, node);
auto subcell = cells.GetCell(level - 1, subcell_id); auto subcell = cells.GetCell(level - 1, subcell_id);
auto subcell_destination = subcell.GetDestinationNodes().begin(); auto subcell_destination = subcell.GetDestinationNodes().begin();
auto subcell_duration = subcell.GetOutDuration(node).begin();
for (auto subcell_weight : subcell.GetOutWeight(node)) for (auto subcell_weight : subcell.GetOutWeight(node))
{ {
if (subcell_weight != INVALID_EDGE_WEIGHT) if (subcell_weight != INVALID_EDGE_WEIGHT)
{ {
const NodeID to = *subcell_destination; const NodeID to = *subcell_destination;
const EdgeWeight to_weight = weight + subcell_weight; const EdgeWeight to_weight = subcell_weight + weight;
if (!heap.WasInserted(to)) if (!heap.WasInserted(to))
{ {
heap.Insert(to, to_weight, {true, duration + *subcell_duration}); heap.Insert(to, to_weight, {true});
} }
else if (to_weight < heap.GetKey(to)) else if (to_weight < heap.GetKey(to))
{ {
heap.DecreaseKey(to, to_weight); heap.DecreaseKey(to, to_weight);
heap.GetData(to) = {true, duration + *subcell_duration}; heap.GetData(to).from_clique = true;
} }
} }
++subcell_destination; ++subcell_destination;
++subcell_duration;
} }
} }
} }
@@ -158,15 +144,15 @@ class CellCustomizer
(first_level || (first_level ||
partition.GetCell(level - 1, node) != partition.GetCell(level - 1, to))) partition.GetCell(level - 1, node) != partition.GetCell(level - 1, to)))
{ {
const EdgeWeight to_weight = weight + data.weight; const EdgeWeight to_weight = data.weight + weight;
if (!heap.WasInserted(to)) if (!heap.WasInserted(to))
{ {
heap.Insert(to, to_weight, {false, duration + data.duration}); heap.Insert(to, to_weight, {false});
} }
else if (to_weight < heap.GetKey(to)) else if (to_weight < heap.GetKey(to))
{ {
heap.DecreaseKey(to, to_weight); heap.DecreaseKey(to, to_weight);
heap.GetData(to) = {false, duration + data.duration}; heap.GetData(to).from_clique = false;
} }
} }
} }
-6
View File
@@ -93,9 +93,6 @@ template <> struct HasGetTileTurns<corech::Algorithm> final : std::true_type
}; };
// Algorithms supported by Multi-Level Dijkstra // Algorithms supported by Multi-Level Dijkstra
template <> struct HasAlternativePathSearch<mld::Algorithm> final : std::true_type
{
};
template <> struct HasDirectShortestPathSearch<mld::Algorithm> final : std::true_type template <> struct HasDirectShortestPathSearch<mld::Algorithm> final : std::true_type
{ {
}; };
@@ -105,9 +102,6 @@ template <> struct HasShortestPathSearch<mld::Algorithm> final : std::true_type
template <> struct HasMapMatching<mld::Algorithm> final : std::true_type template <> struct HasMapMatching<mld::Algorithm> final : std::true_type
{ {
}; };
template <> struct HasManyToManySearch<mld::Algorithm> final : std::true_type
{
};
template <> struct HasGetTileTurns<mld::Algorithm> final : std::true_type template <> struct HasGetTileTurns<mld::Algorithm> final : std::true_type
{ {
}; };
+2 -1
View File
@@ -174,13 +174,14 @@ 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);
} }
+4 -13
View File
@@ -89,9 +89,8 @@ struct RouteParameters : public BaseParameters
const boost::optional<bool> continue_straight_, const boost::optional<bool> continue_straight_,
Args... args_) Args... args_)
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_}, : BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{false}, annotations{false}, annotations_type{AnnotationsType::None}, geometries{geometries_},
annotations_type{AnnotationsType::None}, geometries{geometries_}, overview{overview_}, overview{overview_}, continue_straight{continue_straight_}
continue_straight{continue_straight_}
// Once we perfectly-forward `args` (see #2990) this constructor can delegate to the one below. // Once we perfectly-forward `args` (see #2990) this constructor can delegate to the one below.
{ {
} }
@@ -106,7 +105,7 @@ struct RouteParameters : public BaseParameters
const boost::optional<bool> continue_straight_, const boost::optional<bool> continue_straight_,
Args... args_) Args... args_)
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_}, : BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_}, annotations{annotations_},
annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None}, annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None},
geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_} geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_}
{ {
@@ -122,7 +121,6 @@ struct RouteParameters : public BaseParameters
const boost::optional<bool> continue_straight_, const boost::optional<bool> continue_straight_,
Args... args_) Args... args_)
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_}, : BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
number_of_alternatives{alternatives_ ? 1u : 0u},
annotations{annotations_ == AnnotationsType::None ? false : true}, annotations{annotations_ == AnnotationsType::None ? false : true},
annotations_type{annotations_}, geometries{geometries_}, overview{overview_}, annotations_type{annotations_}, geometries{geometries_}, overview{overview_},
continue_straight{continue_straight_} continue_straight{continue_straight_}
@@ -130,21 +128,14 @@ struct RouteParameters : public BaseParameters
} }
bool steps = false; bool steps = false;
// TODO: in v6 we should remove the boolean and only keep the number parameter; for compat.
bool alternatives = false; bool alternatives = false;
unsigned number_of_alternatives = 0;
bool annotations = false; bool annotations = false;
AnnotationsType annotations_type = AnnotationsType::None; AnnotationsType annotations_type = AnnotationsType::None;
GeometriesType geometries = GeometriesType::Polyline; GeometriesType geometries = GeometriesType::Polyline;
OverviewType overview = OverviewType::Simplified; OverviewType overview = OverviewType::Simplified;
boost::optional<bool> continue_straight; boost::optional<bool> continue_straight;
bool IsValid() const bool IsValid() const { return coordinates.size() >= 2 && BaseParameters::IsValid(); }
{
const auto coordinates_ok = coordinates.size() >= 2;
const auto base_params_ok = BaseParameters::IsValid();
return coordinates_ok && base_params_ok;
}
}; };
inline bool operator&(RouteParameters::AnnotationsType lhs, RouteParameters::AnnotationsType rhs) inline bool operator&(RouteParameters::AnnotationsType lhs, RouteParameters::AnnotationsType rhs)
+1
View File
@@ -42,6 +42,7 @@ class TableAPI final : public BaseAPI
{ {
auto number_of_sources = parameters.sources.size(); auto number_of_sources = parameters.sources.size();
auto number_of_destinations = parameters.destinations.size(); auto number_of_destinations = parameters.destinations.size();
;
// symmetric case // symmetric case
if (parameters.sources.empty()) if (parameters.sources.empty())
@@ -14,7 +14,6 @@
#include "extractor/datasources.hpp" #include "extractor/datasources.hpp"
#include "extractor/guidance/turn_instruction.hpp" #include "extractor/guidance/turn_instruction.hpp"
#include "extractor/guidance/turn_lane_types.hpp" #include "extractor/guidance/turn_lane_types.hpp"
#include "extractor/intersection_bearings_container.hpp"
#include "extractor/node_data_container.hpp" #include "extractor/node_data_container.hpp"
#include "extractor/packed_osm_ids.hpp" #include "extractor/packed_osm_ids.hpp"
#include "extractor/profile_properties.hpp" #include "extractor/profile_properties.hpp"
@@ -219,6 +218,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
unsigned m_check_sum; unsigned m_check_sum;
util::vector_view<util::Coordinate> m_coordinate_list; util::vector_view<util::Coordinate> m_coordinate_list;
extractor::PackedOSMIDsView m_osmnodeid_list; extractor::PackedOSMIDsView m_osmnodeid_list;
util::NameTable m_names_table;
util::vector_view<std::uint32_t> m_lane_description_offsets; util::vector_view<std::uint32_t> m_lane_description_offsets;
util::vector_view<extractor::guidance::TurnLaneType::Mask> m_lane_description_masks; util::vector_view<extractor::guidance::TurnLaneType::Mask> m_lane_description_masks;
util::vector_view<TurnPenalty> m_turn_weight_penalties; util::vector_view<TurnPenalty> m_turn_weight_penalties;
@@ -236,12 +236,19 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
std::unique_ptr<SharedGeospatialQuery> m_geospatial_query; std::unique_ptr<SharedGeospatialQuery> m_geospatial_query;
boost::filesystem::path file_index_path; boost::filesystem::path file_index_path;
extractor::IntersectionBearingsView intersection_bearings_view;
util::NameTable m_name_table; util::NameTable m_name_table;
// bearing classes by node based node
util::vector_view<BearingClassID> m_bearing_class_id_table;
// entry class IDs
util::vector_view<EntryClassID> m_entry_class_id_list;
// the look-up table for entry classes. An entry class lists the possibility of entry for all // the look-up table for entry classes. An entry class lists the possibility of entry for all
// available turns. Such a class id is stored with every edge. // available turns. Such a class id is stored with every edge.
util::vector_view<util::guidance::EntryClass> m_entry_class_table; util::vector_view<util::guidance::EntryClass> m_entry_class_table;
// the look-up table for distinct bearing classes. A bearing class lists the available bearings
// at an intersection
std::shared_ptr<util::RangeTable<16, storage::Ownership::View>> m_bearing_ranges_table;
util::vector_view<DiscreteBearing> m_bearing_values_table;
// allocator that keeps the allocation data // allocator that keeps the allocation data
std::shared_ptr<ContiguousBlockAllocator> allocator; std::shared_ptr<ContiguousBlockAllocator> allocator;
@@ -318,7 +325,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
void InitializeEdgeBasedNodeDataInformationPointers(storage::DataLayout &layout, void InitializeEdgeBasedNodeDataInformationPointers(storage::DataLayout &layout,
char *memory_ptr) char *memory_ptr)
{ {
const auto via_geometry_list_ptr = auto via_geometry_list_ptr =
layout.GetBlockPtr<GeometryID>(memory_ptr, storage::DataLayout::GEOMETRY_ID_LIST); layout.GetBlockPtr<GeometryID>(memory_ptr, storage::DataLayout::GEOMETRY_ID_LIST);
util::vector_view<GeometryID> geometry_ids( util::vector_view<GeometryID> geometry_ids(
via_geometry_list_ptr, layout.num_entries[storage::DataLayout::GEOMETRY_ID_LIST]); via_geometry_list_ptr, layout.num_entries[storage::DataLayout::GEOMETRY_ID_LIST]);
@@ -338,16 +345,10 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
util::vector_view<extractor::TravelMode> travel_modes( util::vector_view<extractor::TravelMode> travel_modes(
travel_mode_list_ptr, layout.num_entries[storage::DataLayout::TRAVEL_MODE_LIST]); travel_mode_list_ptr, layout.num_entries[storage::DataLayout::TRAVEL_MODE_LIST]);
const auto classes_list_ptr =
layout.GetBlockPtr<extractor::ClassData>(memory_ptr, storage::DataLayout::CLASSES_LIST);
util::vector_view<extractor::ClassData> classes(
classes_list_ptr, layout.num_entries[storage::DataLayout::CLASSES_LIST]);
edge_based_node_data = extractor::EdgeBasedNodeDataView(std::move(geometry_ids), edge_based_node_data = extractor::EdgeBasedNodeDataView(std::move(geometry_ids),
std::move(name_ids), std::move(name_ids),
std::move(component_ids), std::move(component_ids),
std::move(travel_modes), std::move(travel_modes));
std::move(classes));
} }
void InitializeEdgeInformationPointers(storage::DataLayout &layout, char *memory_ptr) void InitializeEdgeInformationPointers(storage::DataLayout &layout, char *memory_ptr)
@@ -501,13 +502,15 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
{ {
auto bearing_class_id_ptr = data_layout.GetBlockPtr<BearingClassID>( auto bearing_class_id_ptr = data_layout.GetBlockPtr<BearingClassID>(
memory_block, storage::DataLayout::BEARING_CLASSID); memory_block, storage::DataLayout::BEARING_CLASSID);
util::vector_view<BearingClassID> bearing_class_id( typename util::vector_view<BearingClassID> bearing_class_id_table(
bearing_class_id_ptr, data_layout.num_entries[storage::DataLayout::BEARING_CLASSID]); bearing_class_id_ptr, data_layout.num_entries[storage::DataLayout::BEARING_CLASSID]);
m_bearing_class_id_table = std::move(bearing_class_id_table);
auto bearing_values_ptr = data_layout.GetBlockPtr<DiscreteBearing>( auto bearing_class_ptr = data_layout.GetBlockPtr<DiscreteBearing>(
memory_block, storage::DataLayout::BEARING_VALUES); memory_block, storage::DataLayout::BEARING_VALUES);
util::vector_view<DiscreteBearing> bearing_values( typename util::vector_view<DiscreteBearing> bearing_class_table(
bearing_values_ptr, data_layout.num_entries[storage::DataLayout::BEARING_VALUES]); bearing_class_ptr, data_layout.num_entries[storage::DataLayout::BEARING_VALUES]);
m_bearing_values_table = std::move(bearing_class_table);
auto offsets_ptr = auto offsets_ptr =
data_layout.GetBlockPtr<unsigned>(memory_block, storage::DataLayout::BEARING_OFFSETS); data_layout.GetBlockPtr<unsigned>(memory_block, storage::DataLayout::BEARING_OFFSETS);
@@ -518,15 +521,12 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
util::vector_view<IndexBlock> bearing_blocks( util::vector_view<IndexBlock> bearing_blocks(
blocks_ptr, data_layout.num_entries[storage::DataLayout::BEARING_BLOCKS]); blocks_ptr, data_layout.num_entries[storage::DataLayout::BEARING_BLOCKS]);
util::RangeTable<16, storage::Ownership::View> bearing_range_table( m_bearing_ranges_table = std::make_unique<util::RangeTable<16, storage::Ownership::View>>(
bearing_offsets, bearing_blocks, static_cast<unsigned>(bearing_values.size())); bearing_offsets, bearing_blocks, static_cast<unsigned>(m_bearing_values_table.size()));
intersection_bearings_view = extractor::IntersectionBearingsView{
std::move(bearing_values), std::move(bearing_class_id), std::move(bearing_range_table)};
auto entry_class_ptr = data_layout.GetBlockPtr<util::guidance::EntryClass>( auto entry_class_ptr = data_layout.GetBlockPtr<util::guidance::EntryClass>(
memory_block, storage::DataLayout::ENTRY_CLASS); memory_block, storage::DataLayout::ENTRY_CLASS);
util::vector_view<util::guidance::EntryClass> entry_class_table( typename util::vector_view<util::guidance::EntryClass> entry_class_table(
entry_class_ptr, data_layout.num_entries[storage::DataLayout::ENTRY_CLASS]); entry_class_ptr, data_layout.num_entries[storage::DataLayout::ENTRY_CLASS]);
m_entry_class_table = std::move(entry_class_table); m_entry_class_table = std::move(entry_class_table);
} }
@@ -789,22 +789,6 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
return edge_based_node_data.GetTravelMode(id); return edge_based_node_data.GetTravelMode(id);
} }
extractor::ClassData GetClassData(const NodeID id) const override final
{
return edge_based_node_data.GetClassData(id);
}
std::vector<std::string> GetClasses(const extractor::ClassData class_data) const override final
{
auto indexes = extractor::getClassIndexes(class_data);
std::vector<std::string> classes(indexes.size());
std::transform(indexes.begin(), indexes.end(), classes.begin(), [this](const auto index) {
return m_profile_properties->GetClassName(index);
});
return classes;
}
NameID GetNameIndex(const NodeID id) const override final NameID GetNameIndex(const NodeID id) const override final
{ {
return edge_based_node_data.GetNameID(id); return edge_based_node_data.GetNameID(id);
@@ -830,11 +814,6 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
return m_name_table.GetDestinationsForID(id); return m_name_table.GetDestinationsForID(id);
} }
StringView GetExitsForID(const NameID id) const override final
{
return m_name_table.GetExitsForID(id);
}
StringView GetDatasourceName(const DatasourceID id) const override final StringView GetDatasourceName(const DatasourceID id) const override final
{ {
return m_datasources->GetSourceName(id); return m_datasources->GetSourceName(id);
@@ -864,9 +843,27 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
return m_profile_properties->GetWeightMultiplier(); return m_profile_properties->GetWeightMultiplier();
} }
util::guidance::BearingClass GetBearingClass(const NodeID node) const override final BearingClassID GetBearingClassID(const NodeID id) const override final
{ {
return intersection_bearings_view.GetBearingClass(node); return m_bearing_class_id_table.at(id);
}
util::guidance::BearingClass
GetBearingClass(const BearingClassID bearing_class_id) const override final
{
BOOST_ASSERT(bearing_class_id != INVALID_BEARING_CLASSID);
auto range = m_bearing_ranges_table->GetRange(bearing_class_id);
util::guidance::BearingClass result;
for (auto itr = m_bearing_values_table.begin() + range.front();
itr != m_bearing_values_table.begin() + range.back() + 1;
++itr)
result.add(*itr);
return result;
}
EntryClassID GetEntryClassID(const EdgeID eid) const override final
{
return turn_data.GetEntryClassID(eid);
} }
util::guidance::TurnBearing PreTurnBearing(const EdgeID eid) const override final util::guidance::TurnBearing PreTurnBearing(const EdgeID eid) const override final
@@ -878,9 +875,8 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
return turn_data.GetPostTurnBearing(eid); return turn_data.GetPostTurnBearing(eid);
} }
util::guidance::EntryClass GetEntryClass(const EdgeID turn_id) const override final util::guidance::EntryClass GetEntryClass(const EntryClassID entry_class_id) const override final
{ {
auto entry_class_id = turn_data.GetEntryClassID(turn_id);
return m_entry_class_table.at(entry_class_id); return m_entry_class_table.at(entry_class_id);
} }
@@ -991,8 +987,6 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : public Algo
auto mld_cell_weights_ptr = data_layout.GetBlockPtr<EdgeWeight>( auto mld_cell_weights_ptr = data_layout.GetBlockPtr<EdgeWeight>(
memory_block, storage::DataLayout::MLD_CELL_WEIGHTS); memory_block, storage::DataLayout::MLD_CELL_WEIGHTS);
auto mld_cell_durations_ptr = data_layout.GetBlockPtr<EdgeDuration>(
memory_block, storage::DataLayout::MLD_CELL_DURATIONS);
auto mld_source_boundary_ptr = data_layout.GetBlockPtr<NodeID>( auto mld_source_boundary_ptr = data_layout.GetBlockPtr<NodeID>(
memory_block, storage::DataLayout::MLD_CELL_SOURCE_BOUNDARY); memory_block, storage::DataLayout::MLD_CELL_SOURCE_BOUNDARY);
auto mld_destination_boundary_ptr = data_layout.GetBlockPtr<NodeID>( auto mld_destination_boundary_ptr = data_layout.GetBlockPtr<NodeID>(
@@ -1004,8 +998,6 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : public Algo
auto weight_entries_count = auto weight_entries_count =
data_layout.GetBlockEntries(storage::DataLayout::MLD_CELL_WEIGHTS); data_layout.GetBlockEntries(storage::DataLayout::MLD_CELL_WEIGHTS);
auto duration_entries_count =
data_layout.GetBlockEntries(storage::DataLayout::MLD_CELL_DURATIONS);
auto source_boundary_entries_count = auto source_boundary_entries_count =
data_layout.GetBlockEntries(storage::DataLayout::MLD_CELL_SOURCE_BOUNDARY); data_layout.GetBlockEntries(storage::DataLayout::MLD_CELL_SOURCE_BOUNDARY);
auto destination_boundary_entries_count = auto destination_boundary_entries_count =
@@ -1014,11 +1006,7 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : public Algo
auto cell_level_offsets_entries_count = auto cell_level_offsets_entries_count =
data_layout.GetBlockEntries(storage::DataLayout::MLD_CELL_LEVEL_OFFSETS); data_layout.GetBlockEntries(storage::DataLayout::MLD_CELL_LEVEL_OFFSETS);
BOOST_ASSERT(weight_entries_count == duration_entries_count);
util::vector_view<EdgeWeight> weights(mld_cell_weights_ptr, weight_entries_count); util::vector_view<EdgeWeight> weights(mld_cell_weights_ptr, weight_entries_count);
util::vector_view<EdgeDuration> durations(mld_cell_durations_ptr,
duration_entries_count);
util::vector_view<NodeID> source_boundary(mld_source_boundary_ptr, util::vector_view<NodeID> source_boundary(mld_source_boundary_ptr,
source_boundary_entries_count); source_boundary_entries_count);
util::vector_view<NodeID> destination_boundary(mld_destination_boundary_ptr, util::vector_view<NodeID> destination_boundary(mld_destination_boundary_ptr,
@@ -1029,7 +1017,6 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : public Algo
cell_level_offsets_entries_count); cell_level_offsets_entries_count);
mld_cell_storage = partition::CellStorageView{std::move(weights), mld_cell_storage = partition::CellStorageView{std::move(weights),
std::move(durations),
std::move(source_boundary), std::move(source_boundary),
std::move(destination_boundary), std::move(destination_boundary),
std::move(cells), std::move(cells),
+10 -16
View File
@@ -3,19 +3,14 @@
// Exposes all data access interfaces to the algorithms via base class ptr // Exposes all data access interfaces to the algorithms via base class ptr
#include "engine/approach.hpp"
#include "engine/phantom_node.hpp"
#include "contractor/query_edge.hpp" #include "contractor/query_edge.hpp"
#include "extractor/class_data.hpp"
#include "extractor/edge_based_node_segment.hpp" #include "extractor/edge_based_node_segment.hpp"
#include "extractor/external_memory_node.hpp"
#include "extractor/guidance/turn_instruction.hpp" #include "extractor/guidance/turn_instruction.hpp"
#include "extractor/guidance/turn_lane_types.hpp" #include "extractor/guidance/turn_lane_types.hpp"
#include "extractor/original_edge_data.hpp" #include "extractor/original_edge_data.hpp"
#include "extractor/query_node.hpp" #include "engine/approach.hpp"
#include "extractor/travel_mode.hpp" #include "engine/phantom_node.hpp"
#include "util/exception.hpp" #include "util/exception.hpp"
#include "util/guidance/bearing_class.hpp" #include "util/guidance/bearing_class.hpp"
#include "util/guidance/entry_class.hpp" #include "util/guidance/entry_class.hpp"
@@ -92,10 +87,6 @@ class BaseDataFacade
virtual extractor::TravelMode GetTravelMode(const NodeID id) const = 0; virtual extractor::TravelMode GetTravelMode(const NodeID id) const = 0;
virtual extractor::ClassData GetClassData(const NodeID id) const = 0;
virtual std::vector<std::string> GetClasses(const extractor::ClassData class_data) const = 0;
virtual std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate south_west, virtual std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate south_west,
const util::Coordinate north_east) const = 0; const util::Coordinate north_east) const = 0;
@@ -167,8 +158,6 @@ class BaseDataFacade
virtual StringView GetDestinationsForID(const NameID id) const = 0; virtual StringView GetDestinationsForID(const NameID id) const = 0;
virtual StringView GetExitsForID(const NameID id) const = 0;
virtual std::string GetTimestamp() const = 0; virtual std::string GetTimestamp() const = 0;
virtual bool GetContinueStraightDefault() const = 0; virtual bool GetContinueStraightDefault() const = 0;
@@ -181,12 +170,17 @@ class BaseDataFacade
virtual double GetWeightMultiplier() const = 0; virtual double GetWeightMultiplier() const = 0;
virtual BearingClassID GetBearingClassID(const NodeID id) const = 0;
virtual util::guidance::TurnBearing PreTurnBearing(const EdgeID eid) const = 0; virtual util::guidance::TurnBearing PreTurnBearing(const EdgeID eid) const = 0;
virtual util::guidance::TurnBearing PostTurnBearing(const EdgeID eid) const = 0; virtual util::guidance::TurnBearing PostTurnBearing(const EdgeID eid) const = 0;
virtual util::guidance::BearingClass GetBearingClass(const NodeID node) const = 0; virtual util::guidance::BearingClass
GetBearingClass(const BearingClassID bearing_class_id) const = 0;
virtual util::guidance::EntryClass GetEntryClass(const EdgeID turn_id) const = 0; virtual EntryClassID GetEntryClassID(const EdgeID eid) const = 0;
virtual util::guidance::EntryClass GetEntryClass(const EntryClassID entry_class_id) const = 0;
virtual bool IsLeftHandDriving() const = 0; virtual bool IsLeftHandDriving() const = 0;
}; };
+7 -6
View File
@@ -11,6 +11,7 @@
#include "engine/datafacade/contiguous_block_allocator.hpp" #include "engine/datafacade/contiguous_block_allocator.hpp"
#include "engine/datafacade_provider.hpp" #include "engine/datafacade_provider.hpp"
#include "engine/engine_config.hpp" #include "engine/engine_config.hpp"
#include "engine/engine_config.hpp"
#include "engine/plugins/match.hpp" #include "engine/plugins/match.hpp"
#include "engine/plugins/nearest.hpp" #include "engine/plugins/nearest.hpp"
#include "engine/plugins/table.hpp" #include "engine/plugins/table.hpp"
@@ -53,12 +54,12 @@ template <typename Algorithm> class Engine final : public EngineInterface
{ {
public: public:
explicit Engine(const EngineConfig &config) explicit Engine(const EngineConfig &config)
: route_plugin(config.max_locations_viaroute, config.max_alternatives), // : route_plugin(config.max_locations_viaroute), //
table_plugin(config.max_locations_distance_table), // table_plugin(config.max_locations_distance_table), //
nearest_plugin(config.max_results_nearest), // nearest_plugin(config.max_results_nearest), //
trip_plugin(config.max_locations_trip), // trip_plugin(config.max_locations_trip), //
match_plugin(config.max_locations_map_matching), // match_plugin(config.max_locations_map_matching), //
tile_plugin() // tile_plugin() //
{ {
if (config.use_shared_memory) if (config.use_shared_memory)
-1
View File
@@ -87,7 +87,6 @@ struct EngineConfig final
int max_locations_distance_table = -1; int max_locations_distance_table = -1;
int max_locations_map_matching = -1; int max_locations_map_matching = -1;
int max_results_nearest = -1; int max_results_nearest = -1;
int max_alternatives = 3; // set an arbitrary upper bound; can be adjusted by user
bool use_shared_memory = true; bool use_shared_memory = true;
Algorithm algorithm = Algorithm::CH; Algorithm algorithm = Algorithm::CH;
}; };
+5 -13
View File
@@ -78,19 +78,11 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
} }
prev_coordinate = coordinate; prev_coordinate = coordinate;
geometry.annotations.emplace_back(LegGeometry::Annotation{ geometry.annotations.emplace_back(
current_distance, LegGeometry::Annotation{current_distance,
// NOTE: we want annotations to include only the duration/weight path_point.duration_until_turn / 10.,
// of the segment itself. For segments immediately before path_point.weight_until_turn / facade.GetWeightMultiplier(),
// a turn, the duration_until_turn/weight_until_turn values path_point.datasource_id});
// 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));
} }
+5 -15
View File
@@ -53,7 +53,6 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
: source_node.forward_segment_id.id; : source_node.forward_segment_id.id;
const auto source_name_id = facade.GetNameIndex(source_node_id); const auto source_name_id = facade.GetNameIndex(source_node_id);
const auto source_mode = facade.GetTravelMode(source_node_id); const auto source_mode = facade.GetTravelMode(source_node_id);
auto source_classes = facade.GetClasses(facade.GetClassData(source_node_id));
const EdgeWeight target_duration = const EdgeWeight target_duration =
target_traversed_in_reverse ? target_node.reverse_duration : target_node.forward_duration; target_traversed_in_reverse ? target_node.reverse_duration : target_node.forward_duration;
@@ -87,8 +86,7 @@ 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)
{ {
@@ -116,17 +114,13 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
const auto ref = facade.GetRefForID(step_name_id); const auto ref = facade.GetRefForID(step_name_id);
const auto pronunciation = facade.GetPronunciationForID(step_name_id); const auto pronunciation = facade.GetPronunciationForID(step_name_id);
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 distance = leg_geometry.segment_distances[segment_index]; const auto distance = leg_geometry.segment_distances[segment_index];
// 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(),
ref.to_string(), ref.to_string(),
pronunciation.to_string(), pronunciation.to_string(),
destinations.to_string(), destinations.to_string(),
exits.to_string(),
NO_ROTARY_NAME, NO_ROTARY_NAME,
NO_ROTARY_NAME, NO_ROTARY_NAME,
segment_duration / 10., segment_duration / 10.,
@@ -150,7 +144,9 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
// extract bearings // extract bearings
bearings = std::make_pair<std::uint16_t, std::uint16_t>( bearings = std::make_pair<std::uint16_t, std::uint16_t>(
path_point.pre_turn_bearing.Get(), path_point.post_turn_bearing.Get()); path_point.pre_turn_bearing.Get(), path_point.post_turn_bearing.Get());
const auto bearing_class = facade.GetBearingClass(path_point.turn_via_node); const auto entry_class = facade.GetEntryClass(path_point.entry_classid);
const auto bearing_class =
facade.GetBearingClass(facade.GetBearingClassID(path_point.turn_via_node));
auto bearing_data = bearing_class.getAvailableBearings(); auto bearing_data = bearing_class.getAvailableBearings();
intersection.in = bearing_class.findMatchingBearing(bearings.first); intersection.in = bearing_class.findMatchingBearing(bearings.first);
intersection.out = bearing_class.findMatchingBearing(bearings.second); intersection.out = bearing_class.findMatchingBearing(bearings.second);
@@ -178,7 +174,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
intersection.entry.clear(); intersection.entry.clear();
for (auto idx : util::irange<std::size_t>(0, intersection.bearings.size())) for (auto idx : util::irange<std::size_t>(0, intersection.bearings.size()))
{ {
intersection.entry.push_back(path_point.entry_class.allowsEntry(idx)); intersection.entry.push_back(entry_class.allowsEntry(idx));
} }
std::int16_t bearing_in_driving_direction = std::int16_t bearing_in_driving_direction =
util::bearing::reverse(std::round(bearings.first)); util::bearing::reverse(std::round(bearings.first));
@@ -196,15 +192,12 @@ 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(),
facade.GetRefForID(step_name_id).to_string(), facade.GetRefForID(step_name_id).to_string(),
facade.GetPronunciationForID(step_name_id).to_string(), facade.GetPronunciationForID(step_name_id).to_string(),
facade.GetDestinationsForID(step_name_id).to_string(), facade.GetDestinationsForID(step_name_id).to_string(),
facade.GetExitsForID(step_name_id).to_string(),
NO_ROTARY_NAME, NO_ROTARY_NAME,
NO_ROTARY_NAME, NO_ROTARY_NAME,
duration / 10., duration / 10.,
@@ -246,7 +239,6 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
facade.GetRefForID(source_name_id).to_string(), facade.GetRefForID(source_name_id).to_string(),
facade.GetPronunciationForID(source_name_id).to_string(), facade.GetPronunciationForID(source_name_id).to_string(),
facade.GetDestinationsForID(source_name_id).to_string(), facade.GetDestinationsForID(source_name_id).to_string(),
facade.GetExitsForID(source_name_id).to_string(),
NO_ROTARY_NAME, NO_ROTARY_NAME,
NO_ROTARY_NAME, NO_ROTARY_NAME,
duration / 10., duration / 10.,
@@ -269,7 +261,6 @@ 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
@@ -286,7 +277,6 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
facade.GetRefForID(target_name_id).to_string(), facade.GetRefForID(target_name_id).to_string(),
facade.GetPronunciationForID(target_name_id).to_string(), facade.GetPronunciationForID(target_name_id).to_string(),
facade.GetDestinationsForID(target_name_id).to_string(), facade.GetDestinationsForID(target_name_id).to_string(),
facade.GetExitsForID(target_name_id).to_string(),
NO_ROTARY_NAME, NO_ROTARY_NAME,
NO_ROTARY_NAME, NO_ROTARY_NAME,
ZERO_DURATION, ZERO_DURATION,
@@ -130,14 +130,8 @@ inline bool haveSameName(const RouteStep &lhs, const RouteStep &rhs)
// ok, bite the sour grape and check the strings already // ok, bite the sour grape and check the strings already
else else
return !util::guidance::requiresNameAnnounced(lhs.name, return !util::guidance::requiresNameAnnounced(
lhs.ref, lhs.name, lhs.ref, lhs.pronunciation, rhs.name, rhs.ref, rhs.pronunciation);
lhs.pronunciation,
lhs.exits,
rhs.name,
rhs.ref,
rhs.pronunciation,
rhs.exits);
} }
// alias for readability, both turn right | left // alias for readability, both turn right | left
+1 -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_distance_needed_for_lane_change = 200); const double min_duration_needed_for_lane_change = 10);
} // namespace guidance } // namespace guidance
} // namespace engine } // namespace engine
+2 -6
View File
@@ -38,12 +38,8 @@ struct LegGeometry
struct Annotation struct Annotation
{ {
double distance; // distance in meters double distance; // distance in meters
double duration; // duration in seconds
// Total duration of a segment, in seconds, NOT including double weight; // weight value
// 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;
-5
View File
@@ -42,7 +42,6 @@ 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()
@@ -53,7 +52,6 @@ inline IntermediateIntersection getInvalidIntersection()
IntermediateIntersection::NO_INDEX, IntermediateIntersection::NO_INDEX,
IntermediateIntersection::NO_INDEX, IntermediateIntersection::NO_INDEX,
util::guidance::LaneTuple(), util::guidance::LaneTuple(),
{},
{}}; {}};
} }
@@ -64,7 +62,6 @@ struct RouteStep
std::string ref; std::string ref;
std::string pronunciation; std::string pronunciation;
std::string destinations; std::string destinations;
std::string exits;
std::string rotary_name; std::string rotary_name;
std::string rotary_pronunciation; std::string rotary_pronunciation;
double duration; // duration in seconds double duration; // duration in seconds
@@ -117,7 +114,6 @@ inline void RouteStep::Invalidate()
ref.clear(); ref.clear();
pronunciation.clear(); pronunciation.clear();
destinations.clear(); destinations.clear();
exits.clear();
rotary_name.clear(); rotary_name.clear();
rotary_pronunciation.clear(); rotary_pronunciation.clear();
duration = 0; duration = 0;
@@ -182,7 +178,6 @@ inline RouteStep &RouteStep::AdaptStepSignage(const RouteStep &origin)
name = origin.name; name = origin.name;
pronunciation = origin.pronunciation; pronunciation = origin.pronunciation;
destinations = origin.destinations; destinations = origin.destinations;
exits = origin.exits;
ref = origin.ref; ref = origin.ref;
return *this; return *this;
@@ -20,6 +20,16 @@ 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
+2 -25
View File
@@ -5,7 +5,6 @@
#include "extractor/travel_mode.hpp" #include "extractor/travel_mode.hpp"
#include "engine/phantom_node.hpp" #include "engine/phantom_node.hpp"
#include "osrm/coordinate.hpp" #include "osrm/coordinate.hpp"
#include "util/guidance/entry_class.hpp"
#include "util/guidance/turn_bearing.hpp" #include "util/guidance/turn_bearing.hpp"
#include "util/guidance/turn_lanes.hpp" #include "util/guidance/turn_lanes.hpp"
#include "util/typedefs.hpp" #include "util/typedefs.hpp"
@@ -24,27 +23,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;
// If this segment immediately preceeds a turn, then duration_of_turn // duration that is traveled on the segment until the turn is reached
// 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
util::guidance::LaneTupleIdPair lane_data; util::guidance::LaneTupleIdPair lane_data;
// travel mode of the street that leads to the turn // travel mode of the street that leads to the turn
extractor::TravelMode travel_mode : 4; extractor::TravelMode travel_mode : 4;
// user defined classed of the street that leads to the turn
extractor::ClassData classes;
// entry class of the turn, indicating possibility of turns // entry class of the turn, indicating possibility of turns
util::guidance::EntryClass entry_class; EntryClassID entry_classid;
// Source of the speed value on this road segment // Source of the speed value on this road segment
DatasourceID datasource_id; DatasourceID datasource_id;
@@ -69,18 +58,6 @@ struct InternalRouteResult
{ {
return (leg != unpacked_path_segments.size() - 1); return (leg != unpacked_path_segments.size() - 1);
} }
// Note: includes duration for turns, except for at start and end node.
EdgeWeight duration() const
{
EdgeWeight ret{0};
for (const auto &leg : unpacked_path_segments)
for (const auto &segment : leg)
ret += segment.duration_until_turn;
return ret;
}
}; };
struct InternalManyRoutesResult struct InternalManyRoutesResult
+1 -2
View File
@@ -27,10 +27,9 @@ class ViaRoutePlugin final : public BasePlugin
{ {
private: private:
const int max_locations_viaroute; const int max_locations_viaroute;
const int max_alternatives;
public: public:
explicit ViaRoutePlugin(int max_locations_viaroute, int max_alternatives); explicit ViaRoutePlugin(int max_locations_viaroute);
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade, Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
const RoutingAlgorithmsInterface &algorithms, const RoutingAlgorithmsInterface &algorithms,
+26 -13
View File
@@ -20,8 +20,7 @@ class RoutingAlgorithmsInterface
{ {
public: public:
virtual InternalManyRoutesResult virtual InternalManyRoutesResult
AlternativePathSearch(const PhantomNodes &phantom_node_pair, AlternativePathSearch(const PhantomNodes &phantom_node_pair) const = 0;
unsigned number_of_alternatives) const = 0;
virtual InternalRouteResult virtual InternalRouteResult
ShortestPathSearch(const std::vector<PhantomNodes> &phantom_node_pair, ShortestPathSearch(const std::vector<PhantomNodes> &phantom_node_pair,
@@ -67,8 +66,7 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
virtual ~RoutingAlgorithms() = default; virtual ~RoutingAlgorithms() = default;
InternalManyRoutesResult InternalManyRoutesResult
AlternativePathSearch(const PhantomNodes &phantom_node_pair, AlternativePathSearch(const PhantomNodes &phantom_node_pair) const final override;
unsigned number_of_alternatives) const final override;
InternalRouteResult ShortestPathSearch( InternalRouteResult ShortestPathSearch(
const std::vector<PhantomNodes> &phantom_node_pair, const std::vector<PhantomNodes> &phantom_node_pair,
@@ -132,11 +130,9 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
template <typename Algorithm> template <typename Algorithm>
InternalManyRoutesResult InternalManyRoutesResult
RoutingAlgorithms<Algorithm>::AlternativePathSearch(const PhantomNodes &phantom_node_pair, RoutingAlgorithms<Algorithm>::AlternativePathSearch(const PhantomNodes &phantom_node_pair) const
unsigned number_of_alternatives) const
{ {
return routing_algorithms::alternativePathSearch( return routing_algorithms::ch::alternativePathSearch(heaps, facade, phantom_node_pair);
heaps, facade, phantom_node_pair, number_of_alternatives);
} }
template <typename Algorithm> template <typename Algorithm>
@@ -161,7 +157,7 @@ RoutingAlgorithms<Algorithm>::ManyToManySearch(const std::vector<PhantomNode> &p
const std::vector<std::size_t> &source_indices, const std::vector<std::size_t> &source_indices,
const std::vector<std::size_t> &target_indices) const const std::vector<std::size_t> &target_indices) const
{ {
return routing_algorithms::manyToManySearch( return routing_algorithms::ch::manyToManySearch(
heaps, facade, phantom_nodes, source_indices, target_indices); heaps, facade, phantom_nodes, source_indices, target_indices);
} }
@@ -193,8 +189,7 @@ inline std::vector<routing_algorithms::TurnData> RoutingAlgorithms<Algorithm>::G
// CoreCH overrides // CoreCH overrides
template <> template <>
InternalManyRoutesResult inline RoutingAlgorithms< InternalManyRoutesResult inline RoutingAlgorithms<
routing_algorithms::corech::Algorithm>::AlternativePathSearch(const PhantomNodes &, routing_algorithms::corech::Algorithm>::AlternativePathSearch(const PhantomNodes &) const
unsigned) const
{ {
throw util::exception("AlternativePathSearch is disabled due to performance reasons"); throw util::exception("AlternativePathSearch is disabled due to performance reasons");
} }
@@ -208,7 +203,25 @@ RoutingAlgorithms<routing_algorithms::corech::Algorithm>::ManyToManySearch(
{ {
throw util::exception("ManyToManySearch is disabled due to performance reasons"); throw util::exception("ManyToManySearch is disabled due to performance reasons");
} }
} // ns engine
} // ns osrm // MLD overrides for not implemented
template <>
InternalManyRoutesResult inline RoutingAlgorithms<
routing_algorithms::mld::Algorithm>::AlternativePathSearch(const PhantomNodes &) const
{
throw util::exception("AlternativePathSearch is not implemented");
}
template <>
inline std::vector<EdgeWeight>
RoutingAlgorithms<routing_algorithms::mld::Algorithm>::ManyToManySearch(
const std::vector<PhantomNode> &,
const std::vector<std::size_t> &,
const std::vector<std::size_t> &) const
{
throw util::exception("ManyToManySearch is not implemented");
}
}
}
#endif #endif
@@ -15,19 +15,13 @@ namespace engine
{ {
namespace routing_algorithms namespace routing_algorithms
{ {
namespace ch
{
InternalManyRoutesResult InternalManyRoutesResult
alternativePathSearch(SearchEngineData<ch::Algorithm> &search_engine_data, alternativePathSearch(SearchEngineData<Algorithm> &search_engine_data,
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade, const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const PhantomNodes &phantom_node_pair, const PhantomNodes &phantom_node_pair);
unsigned number_of_alternatives); } // namespace ch
InternalManyRoutesResult
alternativePathSearch(SearchEngineData<mld::Algorithm> &search_engine_data,
const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade,
const PhantomNodes &phantom_node_pair,
unsigned number_of_alternatives);
} // namespace routing_algorithms } // namespace routing_algorithms
} // namespace engine } // namespace engine
} // namespace osrm } // namespace osrm
@@ -21,11 +21,20 @@ namespace routing_algorithms
/// by the previous route. /// by the previous route.
/// This variation is only an optimazation for graphs with slow queries, for example /// This variation is only an optimazation for graphs with slow queries, for example
/// not fully contracted graphs. /// not fully contracted graphs.
template <typename Algorithm> InternalRouteResult directShortestPathSearch(
InternalRouteResult SearchEngineData<ch::Algorithm> &engine_working_data,
directShortestPathSearch(SearchEngineData<Algorithm> &engine_working_data, const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade, const PhantomNodes &phantom_nodes);
const PhantomNodes &phantom_nodes);
InternalRouteResult directShortestPathSearch(
SearchEngineData<corech::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
const PhantomNodes &phantom_nodes);
InternalRouteResult directShortestPathSearch(
SearchEngineData<mld::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade,
const PhantomNodes &phantom_nodes);
} // namespace routing_algorithms } // namespace routing_algorithms
} // namespace engine } // namespace engine
@@ -16,13 +16,15 @@ namespace engine
namespace routing_algorithms namespace routing_algorithms
{ {
template <typename Algorithm> namespace ch
{
std::vector<EdgeWeight> std::vector<EdgeWeight>
manyToManySearch(SearchEngineData<Algorithm> &engine_working_data, manyToManySearch(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade, const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const std::vector<PhantomNode> &phantom_nodes, const std::vector<PhantomNode> &phantom_nodes,
const std::vector<std::size_t> &source_indices, const std::vector<std::size_t> &source_indices,
const std::vector<std::size_t> &target_indices); const std::vector<std::size_t> &target_indices);
} // namespace ch
} // namespace routing_algorithms } // namespace routing_algorithms
} // namespace engine } // namespace engine
@@ -6,7 +6,6 @@
#include "engine/algorithm.hpp" #include "engine/algorithm.hpp"
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp" #include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
#include "engine/internal_route_result.hpp" #include "engine/internal_route_result.hpp"
#include "engine/phantom_node.hpp"
#include "engine/search_engine_data.hpp" #include "engine/search_engine_data.hpp"
#include "util/coordinate_calculation.hpp" #include "util/coordinate_calculation.hpp"
@@ -39,10 +38,14 @@ static constexpr bool REVERSE_DIRECTION = false;
static constexpr bool DO_NOT_FORCE_LOOPS = false; static constexpr bool DO_NOT_FORCE_LOOPS = false;
bool needsLoopForward(const PhantomNode &source_phantom, const PhantomNode &target_phantom); bool needsLoopForward(const PhantomNode &source_phantom, const PhantomNode &target_phantom);
bool needsLoopBackwards(const PhantomNode &source_phantom, const PhantomNode &target_phantom); bool needsLoopBackwards(const PhantomNode &source_phantom, const PhantomNode &target_phantom);
bool needsLoopForward(const PhantomNodes &phantoms); void insertSourceInHeap(SearchEngineData<ch::Algorithm>::ManyToManyQueryHeap &heap,
bool needsLoopBackwards(const PhantomNodes &phantoms); const PhantomNode &phantom_node);
void insertTargetInHeap(SearchEngineData<ch::Algorithm>::ManyToManyQueryHeap &heap,
const PhantomNode &phantom_node);
template <typename Heap> template <typename Heap>
void insertNodesInHeaps(Heap &forward_heap, Heap &reverse_heap, const PhantomNodes &nodes) void insertNodesInHeaps(Heap &forward_heap, Heap &reverse_heap, const PhantomNodes &nodes)
@@ -78,40 +81,6 @@ void insertNodesInHeaps(Heap &forward_heap, Heap &reverse_heap, const PhantomNod
} }
} }
template <typename ManyToManyQueryHeap>
void insertSourceInHeap(ManyToManyQueryHeap &heap, const PhantomNode &phantom_node)
{
if (phantom_node.IsValidForwardSource())
{
heap.Insert(phantom_node.forward_segment_id.id,
-phantom_node.GetForwardWeightPlusOffset(),
{phantom_node.forward_segment_id.id, -phantom_node.GetForwardDuration()});
}
if (phantom_node.IsValidReverseSource())
{
heap.Insert(phantom_node.reverse_segment_id.id,
-phantom_node.GetReverseWeightPlusOffset(),
{phantom_node.reverse_segment_id.id, -phantom_node.GetReverseDuration()});
}
}
template <typename ManyToManyQueryHeap>
void insertTargetInHeap(ManyToManyQueryHeap &heap, const PhantomNode &phantom_node)
{
if (phantom_node.IsValidForwardTarget())
{
heap.Insert(phantom_node.forward_segment_id.id,
phantom_node.GetForwardWeightPlusOffset(),
{phantom_node.forward_segment_id.id, phantom_node.GetForwardDuration()});
}
if (phantom_node.IsValidReverseTarget())
{
heap.Insert(phantom_node.reverse_segment_id.id,
phantom_node.GetReverseWeightPlusOffset(),
{phantom_node.reverse_segment_id.id, phantom_node.GetReverseDuration()});
}
}
template <typename FacadeT> template <typename FacadeT>
void annotatePath(const FacadeT &facade, void annotatePath(const FacadeT &facade,
const PhantomNodes &phantom_node_pair, const PhantomNodes &phantom_node_pair,
@@ -143,7 +112,6 @@ void annotatePath(const FacadeT &facade,
const auto name_index = facade.GetNameIndex(node_id); const auto name_index = facade.GetNameIndex(node_id);
const auto turn_instruction = facade.GetTurnInstructionForEdgeID(turn_id); const auto turn_instruction = facade.GetTurnInstructionForEdgeID(turn_id);
const extractor::TravelMode travel_mode = facade.GetTravelMode(node_id); const extractor::TravelMode travel_mode = facade.GetTravelMode(node_id);
const auto classes = facade.GetClassData(node_id);
const auto geometry_index = facade.GetGeometryIndex(node_id); const auto geometry_index = facade.GetGeometryIndex(node_id);
std::vector<NodeID> id_vector; std::vector<NodeID> id_vector;
@@ -186,14 +154,11 @@ 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,
classes, INVALID_ENTRY_CLASSID,
EMPTY_ENTRY_CLASS,
datasource_vector[segment_idx], datasource_vector[segment_idx],
util::guidance::TurnBearing(0), util::guidance::TurnBearing(0),
util::guidance::TurnBearing(0)}); util::guidance::TurnBearing(0)});
@@ -202,15 +167,10 @@ 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); unpacked_path.back().entry_classid = facade.GetEntryClassID(turn_id);
const auto turn_weight = facade.GetWeightPenaltyForEdgeID(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 += turn_duration; unpacked_path.back().duration_until_turn += facade.GetDurationPenaltyForEdgeID(turn_id);
unpacked_path.back().duration_of_turn = turn_duration; unpacked_path.back().weight_until_turn += facade.GetWeightPenaltyForEdgeID(turn_id);
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);
} }
@@ -269,14 +229,11 @@ 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),
facade.GetClassData(target_node_id), INVALID_ENTRY_CLASSID,
EMPTY_ENTRY_CLASS,
datasource_vector[segment_idx], datasource_vector[segment_idx],
util::guidance::TurnBearing(0), util::guidance::TurnBearing(0),
util::guidance::TurnBearing(0)}); util::guidance::TurnBearing(0)});
@@ -381,39 +338,6 @@ double getPathDistance(const datafacade::ContiguousInternalMemoryDataFacade<Algo
return distance; return distance;
} }
template <typename AlgorithmT>
InternalRouteResult
extractRoute(const datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT> &facade,
const EdgeWeight weight,
const PhantomNodes &phantom_nodes,
const std::vector<NodeID> &unpacked_nodes,
const std::vector<EdgeID> &unpacked_edges)
{
InternalRouteResult raw_route_data;
raw_route_data.segment_end_coordinates = {phantom_nodes};
// No path found for both target nodes?
if (INVALID_EDGE_WEIGHT == weight)
{
return raw_route_data;
}
raw_route_data.shortest_path_weight = weight;
raw_route_data.unpacked_path_segments.resize(1);
raw_route_data.source_traversed_in_reverse.push_back(
(unpacked_nodes.front() != phantom_nodes.source_phantom.forward_segment_id.id));
raw_route_data.target_traversed_in_reverse.push_back(
(unpacked_nodes.back() != phantom_nodes.target_phantom.forward_segment_id.id));
annotatePath(facade,
phantom_nodes,
unpacked_nodes,
unpacked_edges,
raw_route_data.unpacked_path_segments.front());
return raw_route_data;
}
} // namespace routing_algorithms } // namespace routing_algorithms
} // namespace engine } // namespace engine
} // namespace osrm } // namespace osrm
@@ -10,12 +10,6 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <algorithm>
#include <iterator>
#include <limits>
#include <tuple>
#include <vector>
namespace osrm namespace osrm
{ {
namespace engine namespace engine
@@ -30,7 +24,7 @@ namespace
// Unrestricted search (Args is const PhantomNodes &): // Unrestricted search (Args is const PhantomNodes &):
// * use partition.GetQueryLevel to find the node query level based on source and target phantoms // * use partition.GetQueryLevel to find the node query level based on source and target phantoms
// * allow to traverse all cells // * allow to traverse all cells
inline LevelID getNodeQueryLevel(const partition::MultiLevelPartitionView &partition, inline LevelID getNodeQureyLevel(const partition::MultiLevelPartitionView &partition,
NodeID node, NodeID node,
const PhantomNodes &phantom_nodes) const PhantomNodes &phantom_nodes)
{ {
@@ -55,7 +49,7 @@ inline bool checkParentCellRestriction(CellID, const PhantomNodes &) { return tr
// * use the fixed level for queries // * use the fixed level for queries
// * check if the node cell is the same as the specified parent onr // * check if the node cell is the same as the specified parent onr
inline LevelID inline LevelID
getNodeQueryLevel(const partition::MultiLevelPartitionView &, NodeID, LevelID level, CellID) getNodeQureyLevel(const partition::MultiLevelPartitionView &, NodeID, LevelID level, CellID)
{ {
return level; return level;
} }
@@ -66,70 +60,6 @@ inline bool checkParentCellRestriction(CellID cell, LevelID, CellID parent)
} }
} }
// Heaps only record for each node its predecessor ("parent") on the shortest path.
// For re-constructing the actual path we need to trace back all parent "pointers".
// In contrast to the CH code MLD needs to know the edges (with clique arc property).
using PackedEdge = std::tuple</*from*/ NodeID, /*to*/ NodeID, /*from_clique_arc*/ bool>;
using PackedPath = std::vector<PackedEdge>;
template <bool DIRECTION, typename OutIter>
inline void retrievePackedPathFromSingleHeap(const SearchEngineData<Algorithm>::QueryHeap &heap,
const NodeID middle,
OutIter out)
{
NodeID current = middle;
NodeID parent = heap.GetData(current).parent;
while (current != parent)
{
const auto &data = heap.GetData(current);
if (DIRECTION == FORWARD_DIRECTION)
{
*out = std::make_tuple(parent, current, data.from_clique_arc);
++out;
}
else if (DIRECTION == REVERSE_DIRECTION)
{
*out = std::make_tuple(current, parent, data.from_clique_arc);
++out;
}
current = parent;
parent = heap.GetData(parent).parent;
}
}
template <bool DIRECTION>
inline PackedPath
retrievePackedPathFromSingleHeap(const SearchEngineData<Algorithm>::QueryHeap &heap,
const NodeID middle)
{
PackedPath packed_path;
retrievePackedPathFromSingleHeap<DIRECTION>(heap, middle, std::back_inserter(packed_path));
return packed_path;
}
// Trace path from middle to start in the forward search space (in reverse)
// and from middle to end in the reverse search space. Middle connects paths.
inline PackedPath
retrievePackedPathFromHeap(const SearchEngineData<Algorithm>::QueryHeap &forward_heap,
const SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
const NodeID middle)
{
// Retrieve start -> middle. Is in reverse order since tracing back starts from middle.
auto packed_path = retrievePackedPathFromSingleHeap<FORWARD_DIRECTION>(forward_heap, middle);
std::reverse(begin(packed_path), end(packed_path));
// Retrieve middle -> end. Is already in correct order, tracing starts from middle.
auto into = std::back_inserter(packed_path);
retrievePackedPathFromSingleHeap<REVERSE_DIRECTION>(reverse_heap, middle, into);
return packed_path;
}
template <bool DIRECTION, typename... Args> template <bool DIRECTION, typename... Args>
void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade, void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap, SearchEngineData<Algorithm>::QueryHeap &forward_heap,
@@ -166,7 +96,7 @@ void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm>
} }
} }
const auto level = getNodeQueryLevel(partition, node, args...); const auto level = getNodeQureyLevel(partition, node, args...);
if (level >= 1 && !forward_heap.GetData(node).from_clique_arc) if (level >= 1 && !forward_heap.GetData(node).from_clique_arc)
{ {
@@ -182,7 +112,6 @@ void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm>
if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to) if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to)
{ {
const EdgeWeight to_weight = weight + shortcut_weight; const EdgeWeight to_weight = weight + shortcut_weight;
BOOST_ASSERT(to_weight >= weight);
if (!forward_heap.WasInserted(to)) if (!forward_heap.WasInserted(to))
{ {
forward_heap.Insert(to, to_weight, {node, true}); forward_heap.Insert(to, to_weight, {node, true});
@@ -208,7 +137,6 @@ void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm>
if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to) if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to)
{ {
const EdgeWeight to_weight = weight + shortcut_weight; const EdgeWeight to_weight = weight + shortcut_weight;
BOOST_ASSERT(to_weight >= weight);
if (!forward_heap.WasInserted(to)) if (!forward_heap.WasInserted(to))
{ {
forward_heap.Insert(to, to_weight, {node, true}); forward_heap.Insert(to, to_weight, {node, true});
@@ -251,24 +179,16 @@ void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm>
} }
} }
// With (s, middle, t) we trace back the paths middle -> s and middle -> t.
// This gives us a packed path (node ids) from the base graph around s and t,
// and overlay node ids otherwise. We then have to unpack the overlay clique
// edges by recursively descending unpacking the path down to the base graph.
using UnpackedNodes = std::vector<NodeID>;
using UnpackedEdges = std::vector<EdgeID>;
using UnpackedPath = std::tuple<EdgeWeight, UnpackedNodes, UnpackedEdges>;
template <typename... Args> template <typename... Args>
UnpackedPath search(SearchEngineData<Algorithm> &engine_working_data, std::tuple<EdgeWeight, std::vector<NodeID>, std::vector<EdgeID>>
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade, search(SearchEngineData<Algorithm> &engine_working_data,
SearchEngineData<Algorithm>::QueryHeap &forward_heap, const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap, SearchEngineData<Algorithm>::QueryHeap &forward_heap,
const bool force_loop_forward, SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
const bool force_loop_reverse, const bool force_loop_forward,
EdgeWeight weight_upper_bound, const bool force_loop_reverse,
Args... args) EdgeWeight weight_upper_bound,
Args... args)
{ {
if (forward_heap.Empty() || reverse_heap.Empty()) if (forward_heap.Empty() || reverse_heap.Empty())
{ {
@@ -322,12 +242,27 @@ UnpackedPath search(SearchEngineData<Algorithm> &engine_working_data,
return std::make_tuple(INVALID_EDGE_WEIGHT, std::vector<NodeID>(), std::vector<EdgeID>()); return std::make_tuple(INVALID_EDGE_WEIGHT, std::vector<NodeID>(), std::vector<EdgeID>());
} }
// Get packed path as edges {from node ID, to node ID, from_clique_arc} // Get packed path as edges {from node ID, to node ID, edge ID}
auto packed_path = retrievePackedPathFromHeap(forward_heap, reverse_heap, middle); std::vector<std::tuple<NodeID, NodeID, bool>> packed_path;
NodeID current_node = middle, parent_node = forward_heap.GetData(middle).parent;
while (parent_node != current_node)
{
const auto &data = forward_heap.GetData(current_node);
packed_path.push_back(std::make_tuple(parent_node, current_node, data.from_clique_arc));
current_node = parent_node;
parent_node = forward_heap.GetData(parent_node).parent;
}
std::reverse(std::begin(packed_path), std::end(packed_path));
const NodeID source_node = current_node;
// Beware the edge case when start, middle, end are all the same. current_node = middle, parent_node = reverse_heap.GetData(middle).parent;
// In this case we return a single node, no edges. We also don't unpack. while (parent_node != current_node)
const NodeID source_node = !packed_path.empty() ? std::get<0>(packed_path.front()) : middle; {
const auto &data = reverse_heap.GetData(current_node);
packed_path.push_back(std::make_tuple(current_node, parent_node, data.from_clique_arc));
current_node = parent_node;
parent_node = reverse_heap.GetData(parent_node).parent;
}
// Unpack path // Unpack path
std::vector<NodeID> unpacked_nodes; std::vector<NodeID> unpacked_nodes;
@@ -336,7 +271,6 @@ UnpackedPath search(SearchEngineData<Algorithm> &engine_working_data,
unpacked_edges.reserve(packed_path.size()); unpacked_edges.reserve(packed_path.size());
unpacked_nodes.push_back(source_node); unpacked_nodes.push_back(source_node);
for (auto const &packed_edge : packed_path) for (auto const &packed_edge : packed_path)
{ {
NodeID source, target; NodeID source, target;
@@ -349,7 +283,7 @@ UnpackedPath search(SearchEngineData<Algorithm> &engine_working_data,
} }
else else
{ // an overlay graph edge { // an overlay graph edge
LevelID level = getNodeQueryLevel(partition, source, args...); LevelID level = getNodeQureyLevel(partition, source, args...);
CellID parent_cell_id = partition.GetCell(level, source); CellID parent_cell_id = partition.GetCell(level, source);
BOOST_ASSERT(parent_cell_id == partition.GetCell(level, target)); BOOST_ASSERT(parent_cell_id == partition.GetCell(level, target));
-24
View File
@@ -78,19 +78,6 @@ struct MultiLayerDijkstraHeapData
MultiLayerDijkstraHeapData(NodeID p, bool from) : parent(p), from_clique_arc(from) {} MultiLayerDijkstraHeapData(NodeID p, bool from) : parent(p), from_clique_arc(from) {}
}; };
struct ManyToManyMultiLayerDijkstraHeapData : MultiLayerDijkstraHeapData
{
EdgeWeight duration;
ManyToManyMultiLayerDijkstraHeapData(NodeID p, EdgeWeight duration)
: MultiLayerDijkstraHeapData(p), duration(duration)
{
}
ManyToManyMultiLayerDijkstraHeapData(NodeID p, bool from, EdgeWeight duration)
: MultiLayerDijkstraHeapData(p, from), duration(duration)
{
}
};
template <> struct SearchEngineData<routing_algorithms::mld::Algorithm> template <> struct SearchEngineData<routing_algorithms::mld::Algorithm>
{ {
using QueryHeap = util::QueryHeap<NodeID, using QueryHeap = util::QueryHeap<NodeID,
@@ -99,23 +86,12 @@ template <> struct SearchEngineData<routing_algorithms::mld::Algorithm>
MultiLayerDijkstraHeapData, MultiLayerDijkstraHeapData,
util::UnorderedMapStorage<NodeID, int>>; util::UnorderedMapStorage<NodeID, int>>;
using ManyToManyQueryHeap = util::QueryHeap<NodeID,
NodeID,
EdgeWeight,
ManyToManyMultiLayerDijkstraHeapData,
util::UnorderedMapStorage<NodeID, int>>;
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>; using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
using ManyToManyHeapPtr = boost::thread_specific_ptr<ManyToManyQueryHeap>;
static SearchEngineHeapPtr forward_heap_1; static SearchEngineHeapPtr forward_heap_1;
static SearchEngineHeapPtr reverse_heap_1; static SearchEngineHeapPtr reverse_heap_1;
static ManyToManyHeapPtr many_to_many_heap;
void InitializeOrClearFirstThreadLocalStorage(unsigned number_of_nodes); void InitializeOrClearFirstThreadLocalStorage(unsigned number_of_nodes);
void InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes);
}; };
} }
} }
-22
View File
@@ -1,22 +0,0 @@
#ifndef OSRM_EXTRACTOR_CLASSES_DATA_HPP
#define OSRM_EXTRACTOR_CLASSES_DATA_HPP
#include "util/bit_range.hpp"
#include <cstdint>
namespace osrm
{
namespace extractor
{
using ClassData = std::uint8_t;
static const std::uint8_t MAX_CLASS_INDEX = 8 - 1;
inline bool isSubset(const ClassData lhs, const ClassData rhs) { return (lhs & rhs) == lhs; }
inline auto getClassIndexes(const ClassData data) { return util::makeBitRange<ClassData>(data); }
}
}
#endif
@@ -83,6 +83,8 @@ class EdgeBasedGraphFactory
const extractor::PackedOSMIDs &osm_node_ids, const extractor::PackedOSMIDs &osm_node_ids,
ProfileProperties profile_properties, ProfileProperties profile_properties,
const util::NameTable &name_table, const util::NameTable &name_table,
std::vector<std::uint32_t> &turn_lane_offsets,
std::vector<guidance::TurnLaneType::Mask> &turn_lane_masks,
guidance::LaneDescriptionMap &lane_description_map); guidance::LaneDescriptionMap &lane_description_map);
void Run(ScriptingEnvironment &scripting_environment, void Run(ScriptingEnvironment &scripting_environment,
@@ -148,6 +150,8 @@ class EdgeBasedGraphFactory
ProfileProperties profile_properties; ProfileProperties profile_properties;
const util::NameTable &name_table; const util::NameTable &name_table;
std::vector<std::uint32_t> &turn_lane_offsets;
std::vector<guidance::TurnLaneType::Mask> &turn_lane_masks;
guidance::LaneDescriptionMap &lane_description_map; guidance::LaneDescriptionMap &lane_description_map;
unsigned RenumberEdges(); unsigned RenumberEdges();
@@ -0,0 +1,60 @@
#ifndef EXTERNAL_MEMORY_NODE_HPP_
#define EXTERNAL_MEMORY_NODE_HPP_
#include "extractor/query_node.hpp"
#include "util/typedefs.hpp"
#include <cstdint>
namespace osrm
{
namespace extractor
{
struct ExternalMemoryNode : QueryNode
{
ExternalMemoryNode(const util::FixedLongitude lon_,
const util::FixedLatitude lat_,
OSMNodeID node_id_,
bool barrier_,
bool traffic_lights_)
: QueryNode(lon_, lat_, node_id_), barrier(barrier_), traffic_lights(traffic_lights_)
{
}
ExternalMemoryNode() : barrier(false), traffic_lights(false) {}
static ExternalMemoryNode min_value()
{
return ExternalMemoryNode(
util::FixedLongitude{0}, util::FixedLatitude{0}, MIN_OSM_NODEID, false, false);
}
static ExternalMemoryNode max_value()
{
return ExternalMemoryNode(util::FixedLongitude{std::numeric_limits<std::int32_t>::max()},
util::FixedLatitude{std::numeric_limits<std::int32_t>::max()},
MAX_OSM_NODEID,
false,
false);
}
bool barrier;
bool traffic_lights;
};
struct ExternalMemoryNodeSTXXLCompare
{
using value_type = ExternalMemoryNode;
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;
}
};
}
}
#endif /* EXTERNAL_MEMORY_NODE_HPP_ */
+27 -16
View File
@@ -1,28 +1,40 @@
#ifndef EXTRACTION_CONTAINERS_HPP #ifndef EXTRACTION_CONTAINERS_HPP
#define EXTRACTION_CONTAINERS_HPP #define EXTRACTION_CONTAINERS_HPP
#include "extractor/external_memory_node.hpp"
#include "extractor/first_and_last_segment_of_way.hpp" #include "extractor/first_and_last_segment_of_way.hpp"
#include "extractor/guidance/turn_lane_types.hpp" #include "extractor/guidance/turn_lane_types.hpp"
#include "extractor/internal_extractor_edge.hpp" #include "extractor/internal_extractor_edge.hpp"
#include "extractor/query_node.hpp"
#include "extractor/restriction.hpp" #include "extractor/restriction.hpp"
#include "extractor/scripting_environment.hpp" #include "extractor/scripting_environment.hpp"
#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 memory containers to store all the data that * Uses external memory containers from stxxl 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);
@@ -33,24 +45,23 @@ class ExtractionContainers
void WriteCharData(const std::string &file_name); void WriteCharData(const std::string &file_name);
public: public:
using NodeIDVector = std::vector<OSMNodeID>; using STXXLNodeIDVector = stxxl::vector<OSMNodeID>;
using NodeVector = std::vector<QueryNode>; using STXXLNodeVector = stxxl::vector<ExternalMemoryNode>;
using EdgeVector = std::vector<InternalExtractorEdge>; using STXXLEdgeVector = stxxl::vector<InternalExtractorEdge>;
using RestrictionsVector = std::vector<InputRestrictionContainer>; using RestrictionsVector = std::vector<InputRestrictionContainer>;
using WayIDStartEndVector = std::vector<FirstAndLastSegmentOfWay>; using STXXLWayIDStartEndVector = stxxl::vector<FirstAndLastSegmentOfWay>;
using NameCharData = std::vector<unsigned char>; using STXXLNameCharData = stxxl::vector<unsigned char>;
using NameOffsets = std::vector<unsigned>; using STXXLNameOffsets = stxxl::vector<unsigned>;
std::vector<OSMNodeID> barrier_nodes; STXXLNodeIDVector used_node_id_list;
std::vector<OSMNodeID> traffic_lights; STXXLNodeVector all_nodes_list;
NodeIDVector used_node_id_list; STXXLEdgeVector all_edges_list;
NodeVector all_nodes_list; STXXLNameCharData name_char_data;
EdgeVector all_edges_list; STXXLNameOffsets name_offsets;
NameCharData name_char_data;
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;
WayIDStartEndVector way_start_end_id_list; STXXLWayIDStartEndVector 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;
-8
View File
@@ -53,7 +53,6 @@ struct ExtractionWay
ref.clear(); ref.clear();
pronunciation.clear(); pronunciation.clear();
destinations.clear(); destinations.clear();
exits.clear();
forward_travel_mode = TRAVEL_MODE_INACCESSIBLE; forward_travel_mode = TRAVEL_MODE_INACCESSIBLE;
backward_travel_mode = TRAVEL_MODE_INACCESSIBLE; backward_travel_mode = TRAVEL_MODE_INACCESSIBLE;
turn_lanes_forward.clear(); turn_lanes_forward.clear();
@@ -70,8 +69,6 @@ struct ExtractionWay
const char *GetRef() const { return ref.c_str(); } const char *GetRef() const { return ref.c_str(); }
void SetDestinations(const char *value) { detail::maybeSetString(destinations, value); } void SetDestinations(const char *value) { detail::maybeSetString(destinations, value); }
const char *GetDestinations() const { return destinations.c_str(); } const char *GetDestinations() const { return destinations.c_str(); }
void SetExits(const char *value) { detail::maybeSetString(exits, value); }
const char *GetExits() const { return exits.c_str(); }
void SetPronunciation(const char *value) { detail::maybeSetString(pronunciation, value); } void SetPronunciation(const char *value) { detail::maybeSetString(pronunciation, value); }
const char *GetPronunciation() const { return pronunciation.c_str(); } const char *GetPronunciation() const { return pronunciation.c_str(); }
void SetTurnLanesForward(const char *value) void SetTurnLanesForward(const char *value)
@@ -85,10 +82,6 @@ struct ExtractionWay
} }
const char *GetTurnLanesBackward() const { return turn_lanes_backward.c_str(); } const char *GetTurnLanesBackward() const { return turn_lanes_backward.c_str(); }
// markers for determining user-defined classes for each way
std::unordered_map<std::string, bool> forward_classes;
std::unordered_map<std::string, bool> backward_classes;
// speed in km/h // speed in km/h
double forward_speed; double forward_speed;
double backward_speed; double backward_speed;
@@ -103,7 +96,6 @@ struct ExtractionWay
std::string ref; std::string ref;
std::string pronunciation; std::string pronunciation;
std::string destinations; std::string destinations;
std::string exits;
std::string turn_lanes_forward; std::string turn_lanes_forward;
std::string turn_lanes_backward; std::string turn_lanes_backward;
guidance::RoadClassification road_classification; guidance::RoadClassification road_classification;
+15 -4
View File
@@ -56,8 +56,8 @@ class Extractor
private: private:
ExtractorConfig config; ExtractorConfig config;
std::tuple<guidance::LaneDescriptionMap, std::vector<TurnRestriction>> std::vector<TurnRestriction> ParseOSMData(ScriptingEnvironment &scripting_environment,
ParseOSMData(ScriptingEnvironment &scripting_environment, const unsigned number_of_threads); const unsigned number_of_threads);
std::pair<std::size_t, EdgeID> std::pair<std::size_t, EdgeID>
BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment, BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment,
@@ -69,8 +69,9 @@ class Extractor
std::vector<EdgeWeight> &edge_based_node_weights, std::vector<EdgeWeight> &edge_based_node_weights,
util::DeallocatingVector<EdgeBasedEdge> &edge_based_edge_list, util::DeallocatingVector<EdgeBasedEdge> &edge_based_edge_list,
const std::string &intersection_class_output_file, const std::string &intersection_class_output_file,
std::vector<TurnRestriction> &turn_restrictions, std::vector<TurnRestriction> &turn_restrictions);
guidance::LaneDescriptionMap &turn_lane_map); void WriteProfileProperties(const std::string &output_path,
const ProfileProperties &properties) const;
void FindComponents(unsigned max_edge_id, void FindComponents(unsigned max_edge_id,
const util::DeallocatingVector<EdgeBasedEdge> &input_edge_list, const util::DeallocatingVector<EdgeBasedEdge> &input_edge_list,
const std::vector<EdgeBasedNodeSegment> &input_node_segments, const std::vector<EdgeBasedNodeSegment> &input_node_segments,
@@ -91,10 +92,20 @@ class Extractor
const std::vector<util::guidance::BearingClass> &bearing_classes, const std::vector<util::guidance::BearingClass> &bearing_classes,
const std::vector<util::guidance::EntryClass> &entry_classes) const; const std::vector<util::guidance::EntryClass> &entry_classes) const;
void WriteTurnLaneData(const std::string &turn_lane_file) const;
// Writes compressed node based graph and its embedding into a file for osrm-partition to use. // Writes compressed node based graph and its embedding into a file for osrm-partition to use.
static void WriteCompressedNodeBasedGraph(const std::string &path, static void WriteCompressedNodeBasedGraph(const std::string &path,
const util::NodeBasedDynamicGraph &graph, const util::NodeBasedDynamicGraph &graph,
const std::vector<util::Coordinate> &coordiantes); const std::vector<util::Coordinate> &coordiantes);
// globals persisting during the extraction process and the graph generation process
// during turn lane analysis, we might have to combine lanes for roads that are modelled as two
// but are more or less experienced as one. This can be due to solid lines in between lanes, for
// example, that genereate a small separation between them. As a result, we might have to
// augment the turn lane map during processing, further adding more types.
guidance::LaneDescriptionMap turn_lane_map;
}; };
} }
} }
+10 -14
View File
@@ -1,7 +1,6 @@
#ifndef EXTRACTOR_CALLBACKS_HPP #ifndef EXTRACTOR_CALLBACKS_HPP
#define EXTRACTOR_CALLBACKS_HPP #define EXTRACTOR_CALLBACKS_HPP
#include "extractor/class_data.hpp"
#include "extractor/guidance/turn_lane_types.hpp" #include "extractor/guidance/turn_lane_types.hpp"
#include "util/typedefs.hpp" #include "util/typedefs.hpp"
@@ -19,10 +18,10 @@ class Way;
namespace std namespace std
{ {
template <> struct hash<std::tuple<std::string, std::string, std::string, std::string, std::string>> template <> struct hash<std::tuple<std::string, std::string, std::string, std::string>>
{ {
std::size_t operator()( std::size_t
const std::tuple<std::string, std::string, std::string, std::string, std::string> &mk) const operator()(const std::tuple<std::string, std::string, std::string, std::string> &mk) const
noexcept noexcept
{ {
std::size_t seed = 0; std::size_t seed = 0;
@@ -30,7 +29,6 @@ template <> struct hash<std::tuple<std::string, std::string, std::string, std::s
boost::hash_combine(seed, std::get<1>(mk)); boost::hash_combine(seed, std::get<1>(mk));
boost::hash_combine(seed, std::get<2>(mk)); boost::hash_combine(seed, std::get<2>(mk));
boost::hash_combine(seed, std::get<3>(mk)); boost::hash_combine(seed, std::get<3>(mk));
boost::hash_combine(seed, std::get<4>(mk));
return seed; return seed;
} }
}; };
@@ -57,23 +55,18 @@ struct ProfileProperties;
class ExtractorCallbacks class ExtractorCallbacks
{ {
private: private:
// used to deduplicate street names, refs, destinations, pronunciation, exits: // used to deduplicate street names, refs, destinations, pronunciation: actually maps to name
// actually maps to name ids // ids
using MapKey = std::tuple<std::string, std::string, std::string, std::string, std::string>; using MapKey = std::tuple<std::string, std::string, std::string, std::string>;
using MapVal = unsigned; using MapVal = unsigned;
std::unordered_map<MapKey, MapVal> string_map; std::unordered_map<MapKey, MapVal> string_map;
guidance::LaneDescriptionMap lane_description_map;
ExtractionContainers &external_memory; ExtractionContainers &external_memory;
std::unordered_map<std::string, ClassData> &classes_map;
guidance::LaneDescriptionMap &lane_description_map;
bool fallback_to_duration; bool fallback_to_duration;
bool force_split_edges; bool force_split_edges;
public: public:
using ClassesMap = std::unordered_map<std::string, ClassData>;
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers, explicit ExtractorCallbacks(ExtractionContainers &extraction_containers,
std::unordered_map<std::string, ClassData> &classes_map,
guidance::LaneDescriptionMap &lane_description_map,
const ProfileProperties &properties); const ProfileProperties &properties);
ExtractorCallbacks(const ExtractorCallbacks &) = delete; ExtractorCallbacks(const ExtractorCallbacks &) = delete;
@@ -87,6 +80,9 @@ class ExtractorCallbacks
// warning: caller needs to take care of synchronization! // warning: caller needs to take care of synchronization!
void ProcessWay(const osmium::Way &current_way, const ExtractionWay &result_way); void ProcessWay(const osmium::Way &current_way, const ExtractionWay &result_way);
// destroys the internal laneDescriptionMap
guidance::LaneDescriptionMap &&moveOutLaneDescriptionMap();
}; };
} }
} }
-56
View File
@@ -4,15 +4,11 @@
#include "extractor/edge_based_edge.hpp" #include "extractor/edge_based_edge.hpp"
#include "extractor/guidance/turn_lane_types.hpp" #include "extractor/guidance/turn_lane_types.hpp"
#include "extractor/node_data_container.hpp" #include "extractor/node_data_container.hpp"
#include "extractor/profile_properties.hpp"
#include "extractor/serialization.hpp" #include "extractor/serialization.hpp"
#include "extractor/turn_data_container.hpp" #include "extractor/turn_data_container.hpp"
#include "util/coordinate.hpp" #include "util/coordinate.hpp"
#include "util/guidance/bearing_class.hpp"
#include "util/guidance/entry_class.hpp"
#include "util/packed_vector.hpp" #include "util/packed_vector.hpp"
#include "util/range_table.hpp"
#include "util/serialization.hpp" #include "util/serialization.hpp"
#include <boost/assert.hpp> #include <boost/assert.hpp>
@@ -24,58 +20,6 @@ namespace extractor
namespace files namespace files
{ {
// writes the .osrm.icd file
template <typename IntersectionBearingsT, typename EntryClassVectorT>
inline void writeIntersections(const boost::filesystem::path &path,
const IntersectionBearingsT &intersection_bearings,
const EntryClassVectorT &entry_classes)
{
static_assert(std::is_same<IntersectionBearingsContainer, IntersectionBearingsT>::value ||
std::is_same<IntersectionBearingsView, IntersectionBearingsT>::value,
"");
storage::io::FileWriter writer(path, storage::io::FileWriter::GenerateFingerprint);
serialization::write(writer, intersection_bearings);
storage::serialization::write(writer, entry_classes);
}
// read the .osrm.icd file
template <typename IntersectionBearingsT, typename EntryClassVectorT>
inline void readIntersections(const boost::filesystem::path &path,
IntersectionBearingsT &intersection_bearings,
EntryClassVectorT &entry_classes)
{
static_assert(std::is_same<IntersectionBearingsContainer, IntersectionBearingsT>::value ||
std::is_same<IntersectionBearingsView, IntersectionBearingsT>::value,
"");
storage::io::FileReader reader(path, storage::io::FileReader::VerifyFingerprint);
serialization::read(reader, intersection_bearings);
storage::serialization::read(reader, entry_classes);
}
// reads .osrm.properties
inline void readProfileProperties(const boost::filesystem::path &path,
ProfileProperties &properties)
{
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
storage::io::FileReader reader{path, fingerprint};
serialization::read(reader, properties);
}
// writes .osrm.properties
inline void writeProfileProperties(const boost::filesystem::path &path,
const ProfileProperties &properties)
{
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
storage::io::FileWriter writer{path, fingerprint};
serialization::write(writer, properties);
}
template <typename EdgeBasedEdgeVector> template <typename EdgeBasedEdgeVector>
void writeEdgeBasedGraph(const boost::filesystem::path &path, void writeEdgeBasedGraph(const boost::filesystem::path &path,
EdgeID const max_edge_id, EdgeID const max_edge_id,
@@ -1,6 +1,7 @@
#ifndef FIRST_AND_LAST_SEGMENT_OF_WAY_HPP #ifndef FIRST_AND_LAST_SEGMENT_OF_WAY_HPP
#define FIRST_AND_LAST_SEGMENT_OF_WAY_HPP #define FIRST_AND_LAST_SEGMENT_OF_WAY_HPP
#include "extractor/external_memory_node.hpp"
#include "util/typedefs.hpp" #include "util/typedefs.hpp"
#include <limits> #include <limits>
@@ -43,7 +44,7 @@ struct FirstAndLastSegmentOfWay
} }
}; };
struct FirstAndLastSegmentOfWayCompare struct FirstAndLastSegmentOfWayStxxlCompare
{ {
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
@@ -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
// depreacted: const constexpr Enum UseLane = 16; // No Turn, but you need to stay on a given lane! 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
@@ -24,6 +24,7 @@ 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;
@@ -73,6 +73,8 @@ class TurnLaneHandler
typedef std::vector<TurnLaneData> LaneDataVector; typedef std::vector<TurnLaneData> LaneDataVector;
TurnLaneHandler(const util::NodeBasedDynamicGraph &node_based_graph, TurnLaneHandler(const util::NodeBasedDynamicGraph &node_based_graph,
const std::vector<std::uint32_t> &turn_lane_offsets,
const std::vector<TurnLaneType::Mask> &turn_lane_masks,
LaneDescriptionMap &lane_description_map, LaneDescriptionMap &lane_description_map,
const TurnAnalysis &turn_analysis, const TurnAnalysis &turn_analysis,
util::guidance::LaneDataIdMap &id_map); util::guidance::LaneDataIdMap &id_map);
@@ -88,8 +90,8 @@ class TurnLaneHandler
// we need to be able to look at previous intersections to, in some cases, find the correct turn // we need to be able to look at previous intersections to, in some cases, find the correct turn
// lanes for a turn // lanes for a turn
const util::NodeBasedDynamicGraph &node_based_graph; const util::NodeBasedDynamicGraph &node_based_graph;
std::vector<std::uint32_t> turn_lane_offsets; const std::vector<std::uint32_t> &turn_lane_offsets;
std::vector<TurnLaneType::Mask> turn_lane_masks; const std::vector<TurnLaneType::Mask> &turn_lane_masks;
LaneDescriptionMap &lane_description_map; LaneDescriptionMap &lane_description_map;
const TurnAnalysis &turn_analysis; const TurnAnalysis &turn_analysis;
util::guidance::LaneDataIdMap &id_map; util::guidance::LaneDataIdMap &id_map;
@@ -4,7 +4,6 @@
#include <bitset> #include <bitset>
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <numeric> //partial_sum
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
@@ -100,34 +99,6 @@ typedef util::ConcurrentIDMap<guidance::TurnLaneDescription,
guidance::TurnLaneDescription_hash> guidance::TurnLaneDescription_hash>
LaneDescriptionMap; LaneDescriptionMap;
inline std::tuple<std::vector<std::uint32_t>, std::vector<TurnLaneType::Mask>>
transformTurnLaneMapIntoArrays(const LaneDescriptionMap &turn_lane_map)
{
// could use some additional capacity? To avoid a copy during processing, though small data so
// probably not that important.
//
// From the map, we construct an adjacency array that allows access from all IDs to the list of
// associated Turn Lane Masks.
//
// turn lane offsets points into the locations of the turn_lane_masks array. We use a standard
// adjacency array like structure to store the turn lane masks.
std::vector<std::uint32_t> turn_lane_offsets(turn_lane_map.data.size() +
2); // empty ID + sentinel
for (auto entry = turn_lane_map.data.begin(); entry != turn_lane_map.data.end(); ++entry)
turn_lane_offsets[entry->second + 1] = entry->first.size();
// inplace prefix sum
std::partial_sum(turn_lane_offsets.begin(), turn_lane_offsets.end(), turn_lane_offsets.begin());
// allocate the current masks
std::vector<guidance::TurnLaneType::Mask> turn_lane_masks(turn_lane_offsets.back());
for (auto entry = turn_lane_map.data.begin(); entry != turn_lane_map.data.end(); ++entry)
std::copy(entry->first.begin(),
entry->first.end(),
turn_lane_masks.begin() + turn_lane_offsets[entry->second]);
return std::make_tuple(std::move(turn_lane_offsets), std::move(turn_lane_masks));
}
} // guidance } // guidance
} // extractor } // extractor
} // osrm } // osrm
@@ -72,7 +72,6 @@ struct InternalExtractorEdge
false, // local access only false, // local access only
false, // split edge false, // split edge
TRAVEL_MODE_INACCESSIBLE, TRAVEL_MODE_INACCESSIBLE,
0,
guidance::TurnLaneType::empty, guidance::TurnLaneType::empty,
guidance::RoadClassification()), guidance::RoadClassification()),
weight_data(), duration_data() weight_data(), duration_data()
@@ -92,7 +91,6 @@ struct InternalExtractorEdge
bool restricted, bool restricted,
bool is_split, bool is_split,
TravelMode travel_mode, TravelMode travel_mode,
ClassData classes,
LaneDescriptionID lane_description, LaneDescriptionID lane_description,
guidance::RoadClassification road_classification, guidance::RoadClassification road_classification,
util::Coordinate source_coordinate) util::Coordinate source_coordinate)
@@ -109,7 +107,6 @@ struct InternalExtractorEdge
restricted, restricted,
is_split, is_split,
travel_mode, travel_mode,
classes,
lane_description, lane_description,
std::move(road_classification)), std::move(road_classification)),
weight_data(std::move(weight_data)), duration_data(std::move(duration_data)), weight_data(std::move(weight_data)), duration_data(std::move(duration_data)),
@@ -142,7 +139,6 @@ struct InternalExtractorEdge
false, // local access only false, // local access only
false, // split edge false, // split edge
TRAVEL_MODE_INACCESSIBLE, TRAVEL_MODE_INACCESSIBLE,
0,
INVALID_LANE_DESCRIPTIONID, INVALID_LANE_DESCRIPTIONID,
guidance::RoadClassification(), guidance::RoadClassification(),
util::Coordinate()); util::Coordinate());
@@ -162,7 +158,6 @@ struct InternalExtractorEdge
false, // local access only false, // local access only
false, // split edge false, // split edge
TRAVEL_MODE_INACCESSIBLE, TRAVEL_MODE_INACCESSIBLE,
0,
INVALID_LANE_DESCRIPTIONID, INVALID_LANE_DESCRIPTIONID,
guidance::RoadClassification(), guidance::RoadClassification(),
util::Coordinate()); util::Coordinate());
@@ -1,105 +0,0 @@
#ifndef OSRM_EXTRACTOR_BEARING_CONTAINER_HPP
#define OSRM_EXTRACTOR_BEARING_CONTAINER_HPP
#include "storage/shared_memory_ownership.hpp"
#include "util/guidance/bearing_class.hpp"
#include "util/range_table.hpp"
#include "util/vector_view.hpp"
#include <numeric>
namespace osrm
{
namespace extractor
{
namespace detail
{
template <storage::Ownership Ownership> class IntersectionBearingsContainer;
}
namespace serialization
{
template <storage::Ownership Ownership>
void read(storage::io::FileReader &reader,
detail::IntersectionBearingsContainer<Ownership> &turn_data);
template <storage::Ownership Ownership>
void write(storage::io::FileWriter &writer,
const detail::IntersectionBearingsContainer<Ownership> &turn_data);
}
namespace detail
{
template <storage::Ownership Ownership> class IntersectionBearingsContainer
{
template <typename T> using Vector = util::ViewOrVector<T, Ownership>;
template <unsigned size> using RangeTable = util::RangeTable<size, Ownership>;
public:
IntersectionBearingsContainer() = default;
IntersectionBearingsContainer(IntersectionBearingsContainer &&) = default;
IntersectionBearingsContainer(const IntersectionBearingsContainer &) = default;
IntersectionBearingsContainer &operator=(IntersectionBearingsContainer &&) = default;
IntersectionBearingsContainer &operator=(const IntersectionBearingsContainer &) = default;
IntersectionBearingsContainer(std::vector<BearingClassID> node_to_class_id_,
const std::vector<util::guidance::BearingClass> &bearing_classes)
: node_to_class_id(std::move(node_to_class_id_))
{
std::vector<unsigned> bearing_counts(bearing_classes.size());
std::transform(bearing_classes.begin(),
bearing_classes.end(),
bearing_counts.begin(),
[](const auto &bearings) { return bearings.getAvailableBearings().size(); });
auto total_bearings = std::accumulate(bearing_counts.begin(), bearing_counts.end(), 0);
class_id_to_ranges_table = RangeTable<16>{bearing_counts};
values.reserve(total_bearings);
for (const auto &bearing_class : bearing_classes)
{
const auto &bearings = bearing_class.getAvailableBearings();
values.insert(values.end(), bearings.begin(), bearings.end());
}
}
IntersectionBearingsContainer(Vector<DiscreteBearing> values_,
Vector<BearingClassID> node_to_class_id_,
RangeTable<16> class_id_to_ranges_table_)
: values(std::move(values_)), node_to_class_id(std::move(node_to_class_id_)),
class_id_to_ranges_table(std::move(class_id_to_ranges_table_))
{
}
// Returns the bearing class for an intersection node
util::guidance::BearingClass GetBearingClass(const NodeID node) const
{
auto class_id = node_to_class_id[node];
auto range = class_id_to_ranges_table.GetRange(class_id);
util::guidance::BearingClass result;
std::for_each(values.begin() + range.front(),
values.begin() + range.back() + 1,
[&](const DiscreteBearing &bearing) { result.add(bearing); });
return result;
}
friend void serialization::read<Ownership>(storage::io::FileReader &reader,
IntersectionBearingsContainer &turn_data_container);
friend void
serialization::write<Ownership>(storage::io::FileWriter &writer,
const IntersectionBearingsContainer &turn_data_container);
private:
Vector<DiscreteBearing> values;
Vector<BearingClassID> node_to_class_id;
RangeTable<16> class_id_to_ranges_table;
};
}
using IntersectionBearingsContainer =
detail::IntersectionBearingsContainer<storage::Ownership::Container>;
using IntersectionBearingsView = detail::IntersectionBearingsContainer<storage::Ownership::View>;
}
}
#endif
+1 -9
View File
@@ -1,7 +1,6 @@
#ifndef NODE_BASED_EDGE_HPP #ifndef NODE_BASED_EDGE_HPP
#define NODE_BASED_EDGE_HPP #define NODE_BASED_EDGE_HPP
#include "extractor/class_data.hpp"
#include "extractor/travel_mode.hpp" #include "extractor/travel_mode.hpp"
#include "util/typedefs.hpp" #include "util/typedefs.hpp"
@@ -29,7 +28,6 @@ struct NodeBasedEdge
bool restricted, bool restricted,
bool is_split, bool is_split,
TravelMode travel_mode, TravelMode travel_mode,
ClassData classes,
const LaneDescriptionID lane_description_id, const LaneDescriptionID lane_description_id,
guidance::RoadClassification road_classification); guidance::RoadClassification road_classification);
@@ -48,7 +46,6 @@ struct NodeBasedEdge
std::uint8_t restricted : 1; // 1 std::uint8_t restricted : 1; // 1
std::uint8_t is_split : 1; // 1 std::uint8_t is_split : 1; // 1
TravelMode travel_mode : 4; // 4 TravelMode travel_mode : 4; // 4
ClassData classes; // 8 1
LaneDescriptionID lane_description_id; // 16 2 LaneDescriptionID lane_description_id; // 16 2
guidance::RoadClassification road_classification; // 16 2 guidance::RoadClassification road_classification; // 16 2
}; };
@@ -68,7 +65,6 @@ struct NodeBasedEdgeWithOSM : NodeBasedEdge
bool restricted, bool restricted,
bool is_split, bool is_split,
TravelMode travel_mode, TravelMode travel_mode,
ClassData classes,
const LaneDescriptionID lane_description_id, const LaneDescriptionID lane_description_id,
guidance::RoadClassification road_classification); guidance::RoadClassification road_classification);
@@ -99,14 +95,12 @@ inline NodeBasedEdge::NodeBasedEdge(NodeID source,
bool restricted, bool restricted,
bool is_split, bool is_split,
TravelMode travel_mode, TravelMode travel_mode,
ClassData classes,
const LaneDescriptionID lane_description_id, const LaneDescriptionID lane_description_id,
guidance::RoadClassification road_classification) guidance::RoadClassification road_classification)
: source(source), target(target), name_id(name_id), weight(weight), duration(duration), : source(source), target(target), name_id(name_id), weight(weight), duration(duration),
forward(forward), backward(backward), roundabout(roundabout), circular(circular), forward(forward), backward(backward), roundabout(roundabout), circular(circular),
startpoint(startpoint), restricted(restricted), is_split(is_split), travel_mode(travel_mode), startpoint(startpoint), restricted(restricted), is_split(is_split), travel_mode(travel_mode),
classes(classes), lane_description_id(lane_description_id), lane_description_id(lane_description_id), road_classification(std::move(road_classification))
road_classification(std::move(road_classification))
{ {
} }
@@ -140,7 +134,6 @@ inline NodeBasedEdgeWithOSM::NodeBasedEdgeWithOSM(OSMNodeID source,
bool restricted, bool restricted,
bool is_split, bool is_split,
TravelMode travel_mode, TravelMode travel_mode,
ClassData classes,
const LaneDescriptionID lane_description_id, const LaneDescriptionID lane_description_id,
guidance::RoadClassification road_classification) guidance::RoadClassification road_classification)
: NodeBasedEdge(SPECIAL_NODEID, : NodeBasedEdge(SPECIAL_NODEID,
@@ -156,7 +149,6 @@ inline NodeBasedEdgeWithOSM::NodeBasedEdgeWithOSM(OSMNodeID source,
restricted, restricted,
is_split, is_split,
travel_mode, travel_mode,
classes,
lane_description_id, lane_description_id,
std::move(road_classification)), std::move(road_classification)),
osm_source_id(std::move(source)), osm_target_id(std::move(target)) osm_source_id(std::move(source)), osm_target_id(std::move(target))
+4 -16
View File
@@ -1,7 +1,6 @@
#ifndef OSRM_EXTRACTOR_NODE_DATA_CONTAINER_HPP #ifndef OSRM_EXTRACTOR_NODE_DATA_CONTAINER_HPP
#define OSRM_EXTRACTOR_NODE_DATA_CONTAINER_HPP #define OSRM_EXTRACTOR_NODE_DATA_CONTAINER_HPP
#include "extractor/class_data.hpp"
#include "extractor/travel_mode.hpp" #include "extractor/travel_mode.hpp"
#include "storage/io_fwd.hpp" #include "storage/io_fwd.hpp"
@@ -42,18 +41,16 @@ template <storage::Ownership Ownership> class EdgeBasedNodeDataContainerImpl
EdgeBasedNodeDataContainerImpl() = default; EdgeBasedNodeDataContainerImpl() = default;
EdgeBasedNodeDataContainerImpl(std::size_t size) EdgeBasedNodeDataContainerImpl(std::size_t size)
: geometry_ids(size), name_ids(size), component_ids(size), travel_modes(size), classes(size) : geometry_ids(size), name_ids(size), component_ids(size), travel_modes(size)
{ {
} }
EdgeBasedNodeDataContainerImpl(Vector<GeometryID> geometry_ids, EdgeBasedNodeDataContainerImpl(Vector<GeometryID> geometry_ids,
Vector<NameID> name_ids, Vector<NameID> name_ids,
Vector<ComponentID> component_ids, Vector<ComponentID> component_ids,
Vector<TravelMode> travel_modes, Vector<TravelMode> travel_modes)
Vector<ClassData> classes)
: geometry_ids(std::move(geometry_ids)), name_ids(std::move(name_ids)), : geometry_ids(std::move(geometry_ids)), name_ids(std::move(name_ids)),
component_ids(std::move(component_ids)), travel_modes(std::move(travel_modes)), component_ids(std::move(component_ids)), travel_modes(std::move(travel_modes))
classes(std::move(classes))
{ {
} }
@@ -65,20 +62,13 @@ template <storage::Ownership Ownership> class EdgeBasedNodeDataContainerImpl
ComponentID GetComponentID(const NodeID node_id) const { return component_ids[node_id]; } ComponentID GetComponentID(const NodeID node_id) const { return component_ids[node_id]; }
ClassData GetClassData(const NodeID node_id) const { return classes[node_id]; }
// Used by EdgeBasedGraphFactory to fill data structure // Used by EdgeBasedGraphFactory to fill data structure
template <typename = std::enable_if<Ownership == storage::Ownership::Container>> template <typename = std::enable_if<Ownership == storage::Ownership::Container>>
void SetData(NodeID node_id, void SetData(NodeID node_id, GeometryID geometry_id, NameID name_id, TravelMode travel_mode)
GeometryID geometry_id,
NameID name_id,
TravelMode travel_mode,
ClassData class_data)
{ {
geometry_ids[node_id] = geometry_id; geometry_ids[node_id] = geometry_id;
name_ids[node_id] = name_id; name_ids[node_id] = name_id;
travel_modes[node_id] = travel_mode; travel_modes[node_id] = travel_mode;
classes[node_id] = class_data;
} }
// Used by EdgeBasedGraphFactory to fill data structure // Used by EdgeBasedGraphFactory to fill data structure
@@ -101,7 +91,6 @@ template <storage::Ownership Ownership> class EdgeBasedNodeDataContainerImpl
util::inplacePermutation(name_ids.begin(), name_ids.end(), permutation); util::inplacePermutation(name_ids.begin(), name_ids.end(), permutation);
util::inplacePermutation(component_ids.begin(), component_ids.end(), permutation); util::inplacePermutation(component_ids.begin(), component_ids.end(), permutation);
util::inplacePermutation(travel_modes.begin(), travel_modes.end(), permutation); util::inplacePermutation(travel_modes.begin(), travel_modes.end(), permutation);
util::inplacePermutation(classes.begin(), classes.end(), permutation);
} }
private: private:
@@ -109,7 +98,6 @@ template <storage::Ownership Ownership> class EdgeBasedNodeDataContainerImpl
Vector<NameID> name_ids; Vector<NameID> name_ids;
Vector<ComponentID> component_ids; Vector<ComponentID> component_ids;
Vector<TravelMode> travel_modes; Vector<TravelMode> travel_modes;
Vector<ClassData> classes;
}; };
} }
+1 -22
View File
@@ -1,14 +1,11 @@
#ifndef PROFILE_PROPERTIES_HPP #ifndef PROFILE_PROPERTIES_HPP
#define PROFILE_PROPERTIES_HPP #define PROFILE_PROPERTIES_HPP
#include "extractor/class_data.hpp"
#include "util/typedefs.hpp" #include "util/typedefs.hpp"
#include <algorithm> #include <algorithm>
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/numeric/conversion/cast.hpp> #include <boost/numeric/conversion/cast.hpp>
#include <cstdint>
namespace osrm namespace osrm
{ {
@@ -20,7 +17,6 @@ const constexpr auto DEFAULT_MAX_SPEED = 180 / 3.6; // 180kmph -> m/s
struct ProfileProperties struct ProfileProperties
{ {
static constexpr int MAX_WEIGHT_NAME_LENGTH = 255; static constexpr int MAX_WEIGHT_NAME_LENGTH = 255;
static constexpr int MAX_CLASS_NAME_LENGTH = 255;
ProfileProperties() ProfileProperties()
: traffic_signal_penalty(0), u_turn_penalty(0), : traffic_signal_penalty(0), u_turn_penalty(0),
@@ -70,22 +66,6 @@ struct ProfileProperties
return std::string(weight_name); return std::string(weight_name);
} }
void SetClassName(std::size_t index, const std::string &name)
{
char *name_ptr = class_names[index];
auto count = std::min<std::size_t>(name.length(), MAX_CLASS_NAME_LENGTH) + 1;
std::copy_n(name.c_str(), count, name_ptr);
// Make sure this is always zero terminated
BOOST_ASSERT(class_names[index][count - 1] == '\0');
BOOST_ASSERT(class_names[index][MAX_CLASS_NAME_LENGTH] == '\0');
}
std::string GetClassName(std::size_t index) const
{
BOOST_ASSERT(index <= MAX_CLASS_INDEX);
return std::string(class_names[index]);
}
double GetWeightMultiplier() const { return std::pow(10., weight_precision); } double GetWeightMultiplier() const { return std::pow(10., weight_precision); }
double GetMaxTurnWeight() const double GetMaxTurnWeight() const
@@ -106,10 +86,9 @@ struct ProfileProperties
bool fallback_to_duration; bool fallback_to_duration;
//! stores the name of the weight (e.g. 'duration', 'distance', 'safety') //! stores the name of the weight (e.g. 'duration', 'distance', 'safety')
char weight_name[MAX_WEIGHT_NAME_LENGTH + 1]; char weight_name[MAX_WEIGHT_NAME_LENGTH + 1];
//! stores the names of each class
std::array<char[MAX_CLASS_NAME_LENGTH + 1], MAX_CLASS_INDEX + 1> class_names;
unsigned weight_precision = 1; unsigned weight_precision = 1;
bool force_split_edges = false; bool force_split_edges = false;
bool call_tagless_node_function = true; bool call_tagless_node_function = true;
}; };
} }
-34
View File
@@ -2,10 +2,8 @@
#define OSRM_EXTRACTOR_IO_HPP #define OSRM_EXTRACTOR_IO_HPP
#include "extractor/datasources.hpp" #include "extractor/datasources.hpp"
#include "extractor/intersection_bearings_container.hpp"
#include "extractor/nbg_to_ebg.hpp" #include "extractor/nbg_to_ebg.hpp"
#include "extractor/node_data_container.hpp" #include "extractor/node_data_container.hpp"
#include "extractor/profile_properties.hpp"
#include "extractor/restriction.hpp" #include "extractor/restriction.hpp"
#include "extractor/segment_data_container.hpp" #include "extractor/segment_data_container.hpp"
#include "extractor/turn_data_container.hpp" #include "extractor/turn_data_container.hpp"
@@ -22,36 +20,6 @@ namespace extractor
namespace serialization namespace serialization
{ {
// read/write for bearing data
template <storage::Ownership Ownership>
inline void read(storage::io::FileReader &reader,
detail::IntersectionBearingsContainer<Ownership> &intersection_bearings)
{
storage::serialization::read(reader, intersection_bearings.values);
storage::serialization::read(reader, intersection_bearings.node_to_class_id);
util::serialization::read(reader, intersection_bearings.class_id_to_ranges_table);
}
template <storage::Ownership Ownership>
inline void write(storage::io::FileWriter &writer,
const detail::IntersectionBearingsContainer<Ownership> &intersection_bearings)
{
storage::serialization::write(writer, intersection_bearings.values);
storage::serialization::write(writer, intersection_bearings.node_to_class_id);
util::serialization::write(writer, intersection_bearings.class_id_to_ranges_table);
}
// read/write for properties file
inline void read(storage::io::FileReader &reader, ProfileProperties &properties)
{
reader.ReadInto(properties);
}
inline void write(storage::io::FileWriter &writer, const ProfileProperties &properties)
{
writer.WriteFrom(properties);
}
// read/write for datasources file // read/write for datasources file
inline void read(storage::io::FileReader &reader, Datasources &sources) inline void read(storage::io::FileReader &reader, Datasources &sources)
{ {
@@ -121,7 +89,6 @@ inline void read(storage::io::FileReader &reader,
storage::serialization::read(reader, node_data_container.name_ids); storage::serialization::read(reader, node_data_container.name_ids);
storage::serialization::read(reader, node_data_container.component_ids); storage::serialization::read(reader, node_data_container.component_ids);
storage::serialization::read(reader, node_data_container.travel_modes); storage::serialization::read(reader, node_data_container.travel_modes);
storage::serialization::read(reader, node_data_container.classes);
} }
template <storage::Ownership Ownership> template <storage::Ownership Ownership>
@@ -132,7 +99,6 @@ inline void write(storage::io::FileWriter &writer,
storage::serialization::write(writer, node_data_container.name_ids); storage::serialization::write(writer, node_data_container.name_ids);
storage::serialization::write(writer, node_data_container.component_ids); storage::serialization::write(writer, node_data_container.component_ids);
storage::serialization::write(writer, node_data_container.travel_modes); storage::serialization::write(writer, node_data_container.travel_modes);
storage::serialization::write(writer, node_data_container.classes);
} }
// read/write for conditional turn restrictions file // read/write for conditional turn restrictions file
+4 -71
View File
@@ -176,64 +176,6 @@ 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;
} }
@@ -761,7 +703,7 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
if (!value->IsBoolean() && !value->IsNull()) if (!value->IsBoolean() && !value->IsNull())
{ {
Nan::ThrowError("'continue_straight' param must be boolean or null"); Nan::ThrowError("'continue_straight' parama must be boolean or null");
return route_parameters_ptr(); return route_parameters_ptr();
} }
if (value->IsBoolean()) if (value->IsBoolean())
@@ -776,21 +718,12 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
if (value.IsEmpty()) if (value.IsEmpty())
return route_parameters_ptr(); return route_parameters_ptr();
if (value->IsBoolean()) if (!value->IsBoolean())
{ {
params->alternatives = value->BooleanValue(); Nan::ThrowError("'alternatives' parama must be boolean");
params->number_of_alternatives = value->BooleanValue() ? 1u : 0u;
}
else if (value->IsNumber())
{
params->alternatives = value->BooleanValue();
params->number_of_alternatives = static_cast<unsigned>(value->NumberValue());
}
else
{
Nan::ThrowError("'alternatives' param must be boolean or number");
return route_parameters_ptr(); return route_parameters_ptr();
} }
params->alternatives = value->BooleanValue();
} }
bool parsedSuccessfully = parseCommonParameters(obj, params); bool parsedSuccessfully = parseCommonParameters(obj, params);
+25 -45
View File
@@ -46,18 +46,18 @@ namespace detail
template <storage::Ownership Ownership> class CellStorageImpl template <storage::Ownership Ownership> class CellStorageImpl
{ {
public: public:
using ValueOffset = std::uint32_t; using WeightOffset = std::uint32_t;
using BoundaryOffset = std::uint32_t; using BoundaryOffset = std::uint32_t;
using BoundarySize = std::uint32_t; using BoundarySize = std::uint32_t;
using SourceIndex = std::uint32_t; using SourceIndex = std::uint32_t;
using DestinationIndex = std::uint32_t; using DestinationIndex = std::uint32_t;
static constexpr auto INVALID_VALUE_OFFSET = std::numeric_limits<ValueOffset>::max(); static constexpr auto INVALID_WEIGHT_OFFSET = std::numeric_limits<WeightOffset>::max();
static constexpr auto INVALID_BOUNDARY_OFFSET = std::numeric_limits<BoundaryOffset>::max(); static constexpr auto INVALID_BOUNDARY_OFFSET = std::numeric_limits<BoundaryOffset>::max();
struct CellData struct CellData
{ {
ValueOffset value_offset = INVALID_VALUE_OFFSET; WeightOffset weight_offset = INVALID_WEIGHT_OFFSET;
BoundaryOffset source_boundary_offset = INVALID_BOUNDARY_OFFSET; BoundaryOffset source_boundary_offset = INVALID_BOUNDARY_OFFSET;
BoundaryOffset destination_boundary_offset = INVALID_BOUNDARY_OFFSET; BoundaryOffset destination_boundary_offset = INVALID_BOUNDARY_OFFSET;
BoundarySize num_source_nodes = 0; BoundarySize num_source_nodes = 0;
@@ -69,16 +69,15 @@ template <storage::Ownership Ownership> class CellStorageImpl
// Implementation of the cell view. We need a template parameter here // Implementation of the cell view. We need a template parameter here
// because we need to derive a read-only and read-write view from this. // because we need to derive a read-only and read-write view from this.
template <typename WeightValueT, typename DurationValueT> class CellImpl template <typename WeightValueT> class CellImpl
{ {
private: private:
using WeightPtrT = WeightValueT *; using WeightPtrT = WeightValueT *;
using DurationPtrT = DurationValueT *; using WeightRefT = WeightValueT &;
BoundarySize num_source_nodes; BoundarySize num_source_nodes;
BoundarySize num_destination_nodes; BoundarySize num_destination_nodes;
WeightPtrT const weights; WeightPtrT const weights;
DurationPtrT const durations;
const NodeID *const source_boundary; const NodeID *const source_boundary;
const NodeID *const destination_boundary; const NodeID *const destination_boundary;
@@ -124,19 +123,20 @@ template <storage::Ownership Ownership> class CellStorageImpl
const std::size_t stride; const std::size_t stride;
}; };
template <typename ValuePtr> auto GetOutRange(const ValuePtr ptr, const NodeID node) const public:
auto GetOutWeight(NodeID node) const
{ {
auto iter = std::find(source_boundary, source_boundary + num_source_nodes, node); auto iter = std::find(source_boundary, source_boundary + num_source_nodes, node);
if (iter == source_boundary + num_source_nodes) if (iter == source_boundary + num_source_nodes)
return boost::make_iterator_range(ptr, ptr); return boost::make_iterator_range(weights, weights);
auto row = std::distance(source_boundary, iter); auto row = std::distance(source_boundary, iter);
auto begin = ptr + num_destination_nodes * row; auto begin = weights + num_destination_nodes * row;
auto end = begin + num_destination_nodes; auto end = begin + num_destination_nodes;
return boost::make_iterator_range(begin, end); return boost::make_iterator_range(begin, end);
} }
template <typename ValuePtr> auto GetInRange(const ValuePtr ptr, const NodeID node) const auto GetInWeight(NodeID node) const
{ {
auto iter = auto iter =
std::find(destination_boundary, destination_boundary + num_destination_nodes, node); std::find(destination_boundary, destination_boundary + num_destination_nodes, node);
@@ -144,21 +144,12 @@ template <storage::Ownership Ownership> class CellStorageImpl
return boost::make_iterator_range(ColumnIterator{}, ColumnIterator{}); return boost::make_iterator_range(ColumnIterator{}, ColumnIterator{});
auto column = std::distance(destination_boundary, iter); auto column = std::distance(destination_boundary, iter);
auto begin = ColumnIterator{ptr + column, num_destination_nodes}; auto begin = ColumnIterator{weights + column, num_destination_nodes};
auto end = ColumnIterator{ptr + column + num_source_nodes * num_destination_nodes, auto end = ColumnIterator{weights + column + num_source_nodes * num_destination_nodes,
num_destination_nodes}; num_destination_nodes};
return boost::make_iterator_range(begin, end); return boost::make_iterator_range(begin, end);
} }
public:
auto GetOutWeight(NodeID node) const { return GetOutRange(weights, node); }
auto GetInWeight(NodeID node) const { return GetInRange(weights, node); }
auto GetOutDuration(NodeID node) const { return GetOutRange(durations, node); }
auto GetInDuration(NodeID node) const { return GetInRange(durations, node); }
auto GetSourceNodes() const auto GetSourceNodes() const
{ {
return boost::make_iterator_range(source_boundary, source_boundary + num_source_nodes); return boost::make_iterator_range(source_boundary, source_boundary + num_source_nodes);
@@ -171,19 +162,16 @@ template <storage::Ownership Ownership> class CellStorageImpl
} }
CellImpl(const CellData &data, CellImpl(const CellData &data,
WeightPtrT const all_weights, WeightPtrT const all_weight,
DurationPtrT const all_durations,
const NodeID *const all_sources, const NodeID *const all_sources,
const NodeID *const all_destinations) const NodeID *const all_destinations)
: num_source_nodes{data.num_source_nodes}, : num_source_nodes{data.num_source_nodes},
num_destination_nodes{data.num_destination_nodes}, num_destination_nodes{data.num_destination_nodes},
weights{all_weights + data.value_offset}, weights{all_weight + data.weight_offset},
durations{all_durations + data.value_offset},
source_boundary{all_sources + data.source_boundary_offset}, source_boundary{all_sources + data.source_boundary_offset},
destination_boundary{all_destinations + data.destination_boundary_offset} destination_boundary{all_destinations + data.destination_boundary_offset}
{ {
BOOST_ASSERT(all_weights != nullptr); BOOST_ASSERT(all_weight != nullptr);
BOOST_ASSERT(all_durations != nullptr);
BOOST_ASSERT(num_source_nodes == 0 || all_sources != nullptr); BOOST_ASSERT(num_source_nodes == 0 || all_sources != nullptr);
BOOST_ASSERT(num_destination_nodes == 0 || all_destinations != nullptr); BOOST_ASSERT(num_destination_nodes == 0 || all_destinations != nullptr);
} }
@@ -192,8 +180,8 @@ template <storage::Ownership Ownership> class CellStorageImpl
std::size_t LevelIDToIndex(LevelID level) const { return level - 1; } std::size_t LevelIDToIndex(LevelID level) const { return level - 1; }
public: public:
using Cell = CellImpl<EdgeWeight, EdgeDuration>; using Cell = CellImpl<EdgeWeight>;
using ConstCell = CellImpl<const EdgeWeight, const EdgeDuration>; using ConstCell = CellImpl<const EdgeWeight>;
CellStorageImpl() {} CellStorageImpl() {}
@@ -316,27 +304,24 @@ template <storage::Ownership Ownership> class CellStorageImpl
<< " Number of unconnected nodes is " << number_of_unconneced; << " Number of unconnected nodes is " << number_of_unconneced;
} }
// Set cell values offsets and calculate total storage size // Set weight offsets and calculate total storage size
ValueOffset value_offset = 0; WeightOffset weight_offset = 0;
for (auto &cell : cells) for (auto &cell : cells)
{ {
cell.value_offset = value_offset; cell.weight_offset = weight_offset;
value_offset += cell.num_source_nodes * cell.num_destination_nodes; weight_offset += cell.num_source_nodes * cell.num_destination_nodes;
} }
weights.resize(value_offset + 1, INVALID_EDGE_WEIGHT); weights.resize(weight_offset + 1, INVALID_EDGE_WEIGHT);
durations.resize(value_offset + 1, MAXIMAL_EDGE_DURATION);
} }
template <typename = std::enable_if<Ownership == storage::Ownership::View>> template <typename = std::enable_if<Ownership == storage::Ownership::View>>
CellStorageImpl(Vector<EdgeWeight> weights_, CellStorageImpl(Vector<EdgeWeight> weights_,
Vector<EdgeDuration> durations_,
Vector<NodeID> source_boundary_, Vector<NodeID> source_boundary_,
Vector<NodeID> destination_boundary_, Vector<NodeID> destination_boundary_,
Vector<CellData> cells_, Vector<CellData> cells_,
Vector<std::uint64_t> level_to_cell_offset_) Vector<std::uint64_t> level_to_cell_offset_)
: weights(std::move(weights_)), durations(std::move(durations_)), : weights(std::move(weights_)), source_boundary(std::move(source_boundary_)),
source_boundary(std::move(source_boundary_)),
destination_boundary(std::move(destination_boundary_)), cells(std::move(cells_)), destination_boundary(std::move(destination_boundary_)), cells(std::move(cells_)),
level_to_cell_offset(std::move(level_to_cell_offset_)) level_to_cell_offset(std::move(level_to_cell_offset_))
{ {
@@ -351,7 +336,6 @@ template <storage::Ownership Ownership> class CellStorageImpl
BOOST_ASSERT(cell_index < cells.size()); BOOST_ASSERT(cell_index < cells.size());
return ConstCell{cells[cell_index], return ConstCell{cells[cell_index],
weights.data(), weights.data(),
durations.data(),
source_boundary.empty() ? nullptr : source_boundary.data(), source_boundary.empty() ? nullptr : source_boundary.data(),
destination_boundary.empty() ? nullptr : destination_boundary.data()}; destination_boundary.empty() ? nullptr : destination_boundary.data()};
} }
@@ -364,11 +348,8 @@ template <storage::Ownership Ownership> class CellStorageImpl
const auto offset = level_to_cell_offset[level_index]; const auto offset = level_to_cell_offset[level_index];
const auto cell_index = offset + id; const auto cell_index = offset + id;
BOOST_ASSERT(cell_index < cells.size()); BOOST_ASSERT(cell_index < cells.size());
return Cell{cells[cell_index], return Cell{
weights.data(), cells[cell_index], weights.data(), source_boundary.data(), destination_boundary.data()};
durations.data(),
source_boundary.data(),
destination_boundary.data()};
} }
friend void serialization::read<Ownership>(storage::io::FileReader &reader, friend void serialization::read<Ownership>(storage::io::FileReader &reader,
@@ -378,7 +359,6 @@ template <storage::Ownership Ownership> class CellStorageImpl
private: private:
Vector<EdgeWeight> weights; Vector<EdgeWeight> weights;
Vector<EdgeDuration> durations;
Vector<NodeID> source_boundary; Vector<NodeID> source_boundary;
Vector<NodeID> destination_boundary; Vector<NodeID> destination_boundary;
Vector<CellData> cells; Vector<CellData> cells;
-2
View File
@@ -55,7 +55,6 @@ template <storage::Ownership Ownership>
inline void read(storage::io::FileReader &reader, detail::CellStorageImpl<Ownership> &storage) inline void read(storage::io::FileReader &reader, detail::CellStorageImpl<Ownership> &storage)
{ {
storage::serialization::read(reader, storage.weights); storage::serialization::read(reader, storage.weights);
storage::serialization::read(reader, storage.durations);
storage::serialization::read(reader, storage.source_boundary); storage::serialization::read(reader, storage.source_boundary);
storage::serialization::read(reader, storage.destination_boundary); storage::serialization::read(reader, storage.destination_boundary);
storage::serialization::read(reader, storage.cells); storage::serialization::read(reader, storage.cells);
@@ -67,7 +66,6 @@ inline void write(storage::io::FileWriter &writer,
const detail::CellStorageImpl<Ownership> &storage) const detail::CellStorageImpl<Ownership> &storage)
{ {
storage::serialization::write(writer, storage.weights); storage::serialization::write(writer, storage.weights);
storage::serialization::write(writer, storage.durations);
storage::serialization::write(writer, storage.source_boundary); storage::serialization::write(writer, storage.source_boundary);
storage::serialization::write(writer, storage.destination_boundary); storage::serialization::write(writer, storage.destination_boundary);
storage::serialization::write(writer, storage.cells); storage::serialization::write(writer, storage.cells);
@@ -30,13 +30,7 @@ struct RouteParametersGrammar : public BaseParametersGrammar<Iterator, Signature
{ {
route_rule = route_rule =
(qi::lit("alternatives=") > (qi::lit("alternatives=") >
(qi::uint_[ph::bind(&engine::api::RouteParameters::number_of_alternatives, qi::_r1) = qi::bool_[ph::bind(&engine::api::RouteParameters::alternatives, qi::_r1) = qi::_1]) |
qi::_1,
ph::bind(&engine::api::RouteParameters::alternatives, qi::_r1) =
qi::_1 > 0] |
qi::bool_[ph::bind(&engine::api::RouteParameters::number_of_alternatives, qi::_r1) =
qi::_1,
ph::bind(&engine::api::RouteParameters::alternatives, qi::_r1) = qi::_1])) |
(qi::lit("continue_straight=") > (qi::lit("continue_straight=") >
(qi::lit("default") | (qi::lit("default") |
qi::bool_[ph::bind(&engine::api::RouteParameters::continue_straight, qi::_r1) = qi::bool_[ph::bind(&engine::api::RouteParameters::continue_straight, qi::_r1) =
+1
View File
@@ -14,6 +14,7 @@
#include <cerrno> #include <cerrno>
#include <cstring> #include <cstring>
#include <cstring>
#include <tuple> #include <tuple>
#include <type_traits> #include <type_traits>
+1 -48
View File
@@ -7,13 +7,8 @@
#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
@@ -63,7 +58,6 @@ 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>();
@@ -84,7 +78,6 @@ 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)
{ {
@@ -111,47 +104,7 @@ template <typename T> void write(io::FileWriter &writer, const util::vector_view
{ {
const auto count = data.size(); const auto count = data.size();
writer.WriteElementCount64(count); writer.WriteElementCount64(count);
writer.WriteFrom(data.data(), count); return writer.WriteFrom(data.data(), count);
}
template <> inline void read<bool>(io::FileReader &reader, util::vector_view<bool> &data)
{
const auto count = reader.ReadElementCount64();
BOOST_ASSERT(data.size() == count);
for (const auto index : util::irange<std::uint64_t>(0, count))
{
data[index] = reader.ReadOne<bool>();
}
}
template <> inline void write<bool>(io::FileWriter &writer, const util::vector_view<bool> &data)
{
const auto count = data.size();
writer.WriteElementCount64(count);
for (const auto index : util::irange<std::uint64_t>(0, count))
{
writer.WriteOne<bool>(data[index]);
}
}
template <> inline void read<bool>(io::FileReader &reader, std::vector<bool> &data)
{
const auto count = reader.ReadElementCount64();
BOOST_ASSERT(data.size() == count);
for (const auto index : util::irange<std::uint64_t>(0, count))
{
data[index] = reader.ReadOne<bool>();
}
}
template <> inline void write<bool>(io::FileWriter &writer, const std::vector<bool> &data)
{
const auto count = data.size();
writer.WriteElementCount64(count);
for (const auto index : util::irange<std::uint64_t>(0, count))
{
writer.WriteOne<bool>(data[index]);
}
} }
} }
} }
-4
View File
@@ -23,7 +23,6 @@ const constexpr char *block_id_to_name[] = {"NAME_CHAR_DATA",
"NAME_ID_LIST", "NAME_ID_LIST",
"COMPONENT_ID_LIST", "COMPONENT_ID_LIST",
"TRAVEL_MODE_LIST", "TRAVEL_MODE_LIST",
"CLASSES_LIST",
"CH_GRAPH_NODE_LIST", "CH_GRAPH_NODE_LIST",
"CH_GRAPH_EDGE_LIST", "CH_GRAPH_EDGE_LIST",
"COORDINATE_LIST", "COORDINATE_LIST",
@@ -62,7 +61,6 @@ const constexpr char *block_id_to_name[] = {"NAME_CHAR_DATA",
"MLD_PARTITION", "MLD_PARTITION",
"MLD_CELL_TO_CHILDREN", "MLD_CELL_TO_CHILDREN",
"MLD_CELL_WEIGHTS", "MLD_CELL_WEIGHTS",
"MLD_CELL_DURATIONS",
"MLD_CELL_SOURCE_BOUNDARY", "MLD_CELL_SOURCE_BOUNDARY",
"MLD_CELL_DESTINATION_BOUNDARY", "MLD_CELL_DESTINATION_BOUNDARY",
"MLD_CELLS", "MLD_CELLS",
@@ -80,7 +78,6 @@ struct DataLayout
NAME_ID_LIST, NAME_ID_LIST,
COMPONENT_ID_LIST, COMPONENT_ID_LIST,
TRAVEL_MODE_LIST, TRAVEL_MODE_LIST,
CLASSES_LIST,
CH_GRAPH_NODE_LIST, CH_GRAPH_NODE_LIST,
CH_GRAPH_EDGE_LIST, CH_GRAPH_EDGE_LIST,
COORDINATE_LIST, COORDINATE_LIST,
@@ -119,7 +116,6 @@ struct DataLayout
MLD_PARTITION, MLD_PARTITION,
MLD_CELL_TO_CHILDREN, MLD_CELL_TO_CHILDREN,
MLD_CELL_WEIGHTS, MLD_CELL_WEIGHTS,
MLD_CELL_DURATIONS,
MLD_CELL_SOURCE_BOUNDARY, MLD_CELL_SOURCE_BOUNDARY,
MLD_CELL_DESTINATION_BOUNDARY, MLD_CELL_DESTINATION_BOUNDARY,
MLD_CELLS, MLD_CELLS,
-99
View File
@@ -1,99 +0,0 @@
#ifndef OSRM_UTIL_BIT_RANGE_HPP
#define OSRM_UTIL_BIT_RANGE_HPP
#include "util/msb.hpp"
#include <boost/iterator/iterator_facade.hpp>
#include <boost/range/iterator_range.hpp>
namespace osrm
{
namespace util
{
namespace detail
{
template <typename T> std::size_t countOnes(T value)
{
static_assert(std::is_unsigned<T>::value, "Only unsigned types allowed");
std::size_t number_of_ones = 0;
while (value > 0)
{
auto index = msb(value);
value = value & ~(T{1} << index);
number_of_ones++;
}
return number_of_ones;
}
#if (defined(__clang__) || defined(__GNUC__) || defined(__GNUG__))
inline std::size_t countOnes(std::uint8_t value)
{
return __builtin_popcount(std::uint32_t{value});
}
inline std::size_t countOnes(std::uint16_t value)
{
return __builtin_popcount(std::uint32_t{value});
}
inline std::size_t countOnes(unsigned int value) { return __builtin_popcount(value); }
inline std::size_t countOnes(unsigned long value) { return __builtin_popcountl(value); }
inline std::size_t countOnes(unsigned long long value) { return __builtin_popcountll(value); }
#endif
}
// Investigate if we can replace this with
// http://www.boost.org/doc/libs/1_64_0/libs/dynamic_bitset/dynamic_bitset.html
template <typename DataT>
class BitIterator : public boost::iterator_facade<BitIterator<DataT>,
const std::size_t,
boost::forward_traversal_tag,
const std::size_t>
{
typedef boost::iterator_facade<BitIterator<DataT>,
const std::size_t,
boost::forward_traversal_tag,
const std::size_t>
base_t;
public:
typedef typename base_t::value_type value_type;
typedef typename base_t::difference_type difference_type;
typedef typename base_t::reference reference;
typedef std::random_access_iterator_tag iterator_category;
explicit BitIterator() : m_value(0) {}
explicit BitIterator(const DataT x) : m_value(std::move(x)) {}
private:
void increment()
{
auto index = msb(m_value);
m_value = m_value & ~(DataT{1} << index);
}
difference_type distance_to(const BitIterator &other) const
{
return detail::countOnes(m_value) - detail::countOnes(other.m_value);
}
bool equal(const BitIterator &other) const { return m_value == other.m_value; }
reference dereference() const
{
BOOST_ASSERT(m_value > 0);
return msb(m_value);
}
friend class ::boost::iterator_core_access;
DataT m_value;
};
// Returns range over all 1 bits of value
template <typename T> auto makeBitRange(const T value)
{
return boost::make_iterator_range(BitIterator<T>{value}, BitIterator<T>{});
}
}
}
#endif

Some files were not shown because too many files have changed in this diff Show More