Compare commits
171 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 851ae2ce4f | |||
| 577801ad38 | |||
| 7a86b7985f | |||
| 41551119f2 | |||
| 521636c854 | |||
| 6172dffd35 | |||
| 57099e4a85 | |||
| 6be468bdb4 | |||
| 29ce651493 | |||
| 1b53b90eec | |||
| 5f84032261 | |||
| 9c73e42f5f | |||
| c638499c0f | |||
| 7c5977daf6 | |||
| 253522c406 | |||
| 1e2d3882d1 | |||
| fd43586b60 | |||
| fd13ffe7ba | |||
| 37774a331a | |||
| 8719821363 | |||
| 0cc4c4380a | |||
| 553310fb31 | |||
| 404c275101 | |||
| 088d4edc6b | |||
| bf03dcd1e6 | |||
| 456b198702 | |||
| dc81c7b926 | |||
| 90b3be8d10 | |||
| ba2a2ff5e8 | |||
| 9b87b8b7b1 | |||
| 69db219423 | |||
| 17ac731772 | |||
| b6db39e69c | |||
| d22b37961f | |||
| f9c7e1e55e | |||
| 4b8daac104 | |||
| 4e5f74aebe | |||
| 6b357a7783 | |||
| fc9a89ea8b | |||
| 832cdbf566 | |||
| 0dfec13c0a | |||
| a2b8698bca | |||
| c42e247d87 | |||
| 7851de9af8 | |||
| 3fd961a551 | |||
| 3634aa9a3c | |||
| a05e9c4932 | |||
| 5fd77aebb5 | |||
| 9a660e3c18 | |||
| 1d4c5b2e4d | |||
| c718f140fa | |||
| 1b819bfcc3 | |||
| e385f6352e | |||
| 4f3414c4cc | |||
| df79b5b4cc | |||
| 2d1ea7a3de | |||
| 2a13f9d10b | |||
| 7cf7c46939 | |||
| 031ce72db1 | |||
| fe8a2251cd | |||
| 59f8330db4 | |||
| 999211ed9c | |||
| dba825d829 | |||
| ee6e7dab3b | |||
| 2a51ce131b | |||
| 7ce3ffd3cc | |||
| 40d9aec71f | |||
| d405331447 | |||
| e781e06a17 | |||
| 33742532f6 | |||
| f2fbe16979 | |||
| 5af05631c2 | |||
| 8300a6c57e | |||
| 29d4bca9ba | |||
| fd52c80573 | |||
| 74e1d1c27a | |||
| 884ce4025b | |||
| 2ddd98ee6d | |||
| 9b044aaa42 | |||
| fe88d7fcd1 | |||
| 7923fdcaef | |||
| 837dba2191 | |||
| a7ea6e5327 | |||
| 38ab22ee7c | |||
| 7f8e467523 | |||
| fbb2970044 | |||
| d23a5fcfc4 | |||
| db83b186cf | |||
| 7d9b17fd41 | |||
| a900f5229e | |||
| de72a8adb6 | |||
| 5010084fb0 | |||
| 11e7b6e911 | |||
| 545097cf06 | |||
| 476bc347b4 | |||
| 095b345713 | |||
| 0f498d13f5 | |||
| 2059f7234a | |||
| 12b2242ad5 | |||
| fec2b602a2 | |||
| a7c1967ca0 | |||
| 20ff138f08 | |||
| 421115200b | |||
| b15288e0ea | |||
| 4eac861eae | |||
| 7ad9e13f1e | |||
| fc39e0ce1a | |||
| fb02a4c674 | |||
| 6468f55627 | |||
| f40b7975f2 | |||
| 55a38c9e01 | |||
| 3c399e5c28 | |||
| fca00fa09e | |||
| de942155bf | |||
| af3f0a4782 | |||
| c9673741de | |||
| 9a482ff828 | |||
| 020c17d19a | |||
| d0936dc7fd | |||
| 708b47938d | |||
| 79d07ef45c | |||
| 5d33a387e0 | |||
| b3b6e16940 | |||
| f9fb0b84a8 | |||
| 83acb46390 | |||
| f36b3fb4bc | |||
| e7be271c43 | |||
| 790b574114 | |||
| b3f59ab92c | |||
| f2333eb31a | |||
| a862e5fb3a | |||
| 2715e5758b | |||
| 454487dd41 | |||
| 2ed4f6eb0c | |||
| d7bcafcb59 | |||
| c37a8ddd83 | |||
| fc3f96abcb | |||
| c37ea441fc | |||
| fa1a4e8bf6 | |||
| 2532d56b85 | |||
| 00fd869224 | |||
| 5661726e2e | |||
| cfa5d7e172 | |||
| fd7791a0e2 | |||
| e32b8bae00 | |||
| 966139cde9 | |||
| ee19383f4d | |||
| 172a8bdcdb | |||
| 543048efcc | |||
| 67c85ffa4c | |||
| c065335882 | |||
| f6313fcbfb | |||
| 6a3ea876b5 | |||
| 64ad308e9d | |||
| 94169a20de | |||
| 5ca38eee3a | |||
| f4f65f62ee | |||
| f89ada7f61 | |||
| ff3b398e23 | |||
| 84cb7865ab | |||
| 75bdf114be | |||
| c2fd64d3cc | |||
| 580c5e39ae | |||
| 8da6281dcd | |||
| f79bcc6b8d | |||
| f2b63ba0aa | |||
| a253111cbe | |||
| a5776288f6 | |||
| dbcf4cab16 | |||
| 4ea3f33376 | |||
| e4cdfb50cd |
+38
-24
@@ -13,9 +13,9 @@ notifications:
|
|||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
- "5.13"
|
||||||
# enable building tags
|
# enable building tags
|
||||||
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
|
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
|
||||||
- 5.12
|
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
yarn: true
|
yarn: true
|
||||||
@@ -69,25 +69,34 @@ 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', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev', 'lcov']
|
||||||
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
|
||||||
|
before_script:
|
||||||
|
- cd ${TRAVIS_BUILD_DIR}
|
||||||
|
- lcov --directory . --zerocounters # clean cached da files
|
||||||
after_success:
|
after_success:
|
||||||
- bash <(curl -s https://codecov.io/bash)
|
# Creating report
|
||||||
|
- cd ${TRAVIS_BUILD_DIR}
|
||||||
|
- lcov --directory . --capture --output-file coverage.info # capture coverage info
|
||||||
|
- lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
|
||||||
|
- lcov --list coverage.info #debug info
|
||||||
|
# Uploading report to CodeCov
|
||||||
|
- bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: "gcc-6-debug-asan"
|
compiler: "gcc-6-debug-asan"
|
||||||
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', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
||||||
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_SANITIZER=ON CUCUMBER_TIMEOUT=20000
|
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_SANITIZER=ON CUCUMBER_TIMEOUT=20000 LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/scripts/travis/leaksanitizer.conf"
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: "clang-4.0-debug"
|
compiler: "clang-4.0-debug"
|
||||||
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', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
||||||
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000
|
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
@@ -95,8 +104,8 @@ matrix:
|
|||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['libstdc++-5-dev']
|
packages: ['libstdc++-4.9-dev']
|
||||||
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON
|
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/scripts/travis/leaksanitizer.conf"
|
||||||
|
|
||||||
# Release Builds
|
# Release Builds
|
||||||
- os: linux
|
- os: linux
|
||||||
@@ -104,7 +113,7 @@ matrix:
|
|||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['libstdc++-5-dev']
|
packages: ['libstdc++-4.9-dev']
|
||||||
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON
|
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
@@ -112,7 +121,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', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
||||||
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
|
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
@@ -126,7 +135,7 @@ matrix:
|
|||||||
addons: &gcc6
|
addons: &gcc6
|
||||||
apt:
|
apt:
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
||||||
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' ENABLE_STXXL=On
|
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' ENABLE_STXXL=On
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
@@ -134,7 +143,7 @@ matrix:
|
|||||||
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', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libgdal-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
|
||||||
@@ -159,7 +168,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', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
||||||
#- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release'
|
#- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release'
|
||||||
|
|
||||||
# Shared Library
|
# Shared Library
|
||||||
@@ -168,7 +177,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', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
||||||
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
|
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
|
||||||
|
|
||||||
# Disabled because CI slowness
|
# Disabled because CI slowness
|
||||||
@@ -177,7 +186,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', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
||||||
#- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
|
#- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
|
||||||
|
|
||||||
# Node build jobs. These skip running the tests.
|
# Node build jobs. These skip running the tests.
|
||||||
@@ -187,7 +196,7 @@ matrix:
|
|||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['libstdc++-5-dev']
|
packages: ['libstdc++-4.9-dev']
|
||||||
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3
|
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3
|
||||||
install:
|
install:
|
||||||
- pushd ${OSRM_BUILD_DIR}
|
- pushd ${OSRM_BUILD_DIR}
|
||||||
@@ -196,7 +205,8 @@ matrix:
|
|||||||
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
|
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
|
||||||
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
||||||
-DENABLE_CCACHE=ON \
|
-DENABLE_CCACHE=ON \
|
||||||
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
|
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
|
||||||
|
-DENABLE_GLIBC_WORKAROUND=ON
|
||||||
- make --jobs=${JOBS}
|
- make --jobs=${JOBS}
|
||||||
- popd
|
- popd
|
||||||
script:
|
script:
|
||||||
@@ -210,7 +220,7 @@ matrix:
|
|||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['libstdc++-5-dev']
|
packages: ['libstdc++-4.9-dev']
|
||||||
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3
|
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3
|
||||||
install:
|
install:
|
||||||
- pushd ${OSRM_BUILD_DIR}
|
- pushd ${OSRM_BUILD_DIR}
|
||||||
@@ -219,7 +229,8 @@ matrix:
|
|||||||
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
|
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
|
||||||
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
||||||
-DENABLE_CCACHE=ON \
|
-DENABLE_CCACHE=ON \
|
||||||
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
|
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
|
||||||
|
-DENABLE_GLIBC_WORKAROUND=ON
|
||||||
- make --jobs=${JOBS}
|
- make --jobs=${JOBS}
|
||||||
- popd
|
- popd
|
||||||
script:
|
script:
|
||||||
@@ -233,7 +244,7 @@ matrix:
|
|||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['libstdc++-5-dev']
|
packages: ['libstdc++-4.9-dev']
|
||||||
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="6"
|
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="6"
|
||||||
install:
|
install:
|
||||||
- pushd ${OSRM_BUILD_DIR}
|
- pushd ${OSRM_BUILD_DIR}
|
||||||
@@ -242,7 +253,8 @@ matrix:
|
|||||||
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
|
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
|
||||||
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
||||||
-DENABLE_CCACHE=ON \
|
-DENABLE_CCACHE=ON \
|
||||||
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
|
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
|
||||||
|
-DENABLE_GLIBC_WORKAROUND=ON
|
||||||
- make --jobs=${JOBS}
|
- make --jobs=${JOBS}
|
||||||
- popd
|
- popd
|
||||||
script:
|
script:
|
||||||
@@ -256,7 +268,7 @@ matrix:
|
|||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['libstdc++-5-dev']
|
packages: ['libstdc++-4.9-dev']
|
||||||
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="6"
|
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="6"
|
||||||
install:
|
install:
|
||||||
- pushd ${OSRM_BUILD_DIR}
|
- pushd ${OSRM_BUILD_DIR}
|
||||||
@@ -265,7 +277,8 @@ matrix:
|
|||||||
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
|
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
|
||||||
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
||||||
-DENABLE_CCACHE=ON \
|
-DENABLE_CCACHE=ON \
|
||||||
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
|
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
|
||||||
|
-DENABLE_GLIBC_WORKAROUND=ON
|
||||||
- make --jobs=${JOBS}
|
- make --jobs=${JOBS}
|
||||||
- popd
|
- popd
|
||||||
script:
|
script:
|
||||||
@@ -339,7 +352,8 @@ install:
|
|||||||
-DENABLE_STXXL=${ENABLE_STXXL:-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} \
|
||||||
|
-DENABLE_GLIBC_WORKAROUND=${ENABLE_GLIBC_WORKAROUND:-OFF}
|
||||||
- echo "travis_fold:start:MAKE"
|
- echo "travis_fold:start:MAKE"
|
||||||
- make --jobs=${JOBS}
|
- make --jobs=${JOBS}
|
||||||
- make tests --jobs=${JOBS}
|
- make tests --jobs=${JOBS}
|
||||||
|
|||||||
+32
-2
@@ -1,5 +1,35 @@
|
|||||||
|
# 5.13.0
|
||||||
|
- Changes from 5.12:
|
||||||
|
- Profile:
|
||||||
|
- Append cardinal directions from route relations to ref fields to improve instructions; off by default see `profile.cardinal_directions`
|
||||||
|
- Support of `distance` weight in foot and bicycle profiles
|
||||||
|
- Support of relations processing
|
||||||
|
- Added `way:get_location_tag(key)` method to get location-dependent tags https://github.com/Project-OSRM/osrm-backend/wiki/Using-location-dependent-data-in-profiles
|
||||||
|
- Added `forward_ref` and `backward_ref` support
|
||||||
|
- Left-side driving mode is specified by a local Boolean flag `is_left_hand_driving` in `ExtractionWay` and `ExtractionTurn`
|
||||||
|
- Support literal values for maxspeeds in NO, PL and ZA
|
||||||
|
- Infrastructure:
|
||||||
|
- Lua 5.1 support is removed due to lack of support in sol2 https://github.com/ThePhD/sol2/issues/302
|
||||||
|
- Fixed pkg-config version of OSRM
|
||||||
|
- Removed `.osrm.core` file since CoreCH is deprecated now.
|
||||||
|
- Tools:
|
||||||
|
- Because of boost/program_options#32 with boost 1.65+ we needed to change the behavior of the following flags to not accept `={true|false}` anymore:
|
||||||
|
- `--use-locations-cache=false` becomes `--disable-location-cache`
|
||||||
|
- `--parse-conditional-restrictions=true` becomes `--parse-conditional-restrictions`
|
||||||
|
- The deprecated options `--use-level-cache` and `--generate-edge-lookup`
|
||||||
|
- Bugfixes:
|
||||||
|
- Fixed #4348: Some cases of sliproads pre-processing were broken
|
||||||
|
- Fixed #4331: Correctly compute left/right modifiers of forks in case the fork is curved.
|
||||||
|
- Fixed #4472: Correctly count the number of lanes using the delimter in `turn:lanes` tag.
|
||||||
|
- Fixed #4214: Multiple runs of `osrm-partition` lead to crash.
|
||||||
|
- Fixed #4348: Fix assorted problems around slip roads.
|
||||||
|
- Fixed #4420: A bug that would result in unnecessary instructions, due to problems in suffix/prefix detection
|
||||||
|
- Algorithm
|
||||||
|
- Deprecate CoreCH functionality. Usage of CoreCH specific options will fall back to using CH with core_factor of 1.0
|
||||||
|
- MLD uses a unidirectional Dijkstra for 1-to-N and N-to-1 matrices which yields speedup.
|
||||||
|
|
||||||
# 5.12.0
|
# 5.12.0
|
||||||
- Changes from 5.11.0
|
- Changes from 5.11:
|
||||||
- Guidance
|
- Guidance
|
||||||
- now announcing turning onto oneways at the end of a road (e.g. onto dual carriageways)
|
- now announcing turning onto oneways at the end of a road (e.g. onto dual carriageways)
|
||||||
- Adds new instruction types at the exit of roundabouts and rotaries `exit roundabout` and `exit rotary`.
|
- Adds new instruction types at the exit of roundabouts and rotaries `exit roundabout` and `exit rotary`.
|
||||||
@@ -62,7 +92,7 @@
|
|||||||
- Bugfixes
|
- Bugfixes
|
||||||
- Properly save/retrieve datasource annotations for road segments ([#4346](https://github.com/Project-OSRM/osrm-backend/issues/4346)
|
- Properly save/retrieve datasource annotations for road segments ([#4346](https://github.com/Project-OSRM/osrm-backend/issues/4346)
|
||||||
- Fix conditional restriction grammer parsing so it works for single-day-of-week restrictions ([#4357](https://github.com/Project-OSRM/osrm-backend/pull/4357))
|
- Fix conditional restriction grammer parsing so it works for single-day-of-week restrictions ([#4357](https://github.com/Project-OSRM/osrm-backend/pull/4357))
|
||||||
- Algorithm)
|
- Algorithm
|
||||||
- BREAKING: the file format requires re-processing due to the changes on via-ways
|
- BREAKING: the file format requires re-processing due to the changes on via-ways
|
||||||
- Added support for via-way restrictions
|
- Added support for via-way restrictions
|
||||||
|
|
||||||
|
|||||||
+27
-40
@@ -31,12 +31,13 @@ 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)
|
||||||
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
|
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
|
||||||
|
option(ENABLE_GLIBC_WORKAROUND "Workaround GLIBC symbol exports" OFF)
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
if(ENABLE_MASON)
|
if(ENABLE_MASON)
|
||||||
# versions in use
|
# versions in use
|
||||||
set(MASON_BOOST_VERSION "1.63.0")
|
set(MASON_BOOST_VERSION "1.65.1")
|
||||||
set(MASON_STXXL_VERSION "1.4.1-1")
|
set(MASON_STXXL_VERSION "1.4.1-1")
|
||||||
set(MASON_EXPAT_VERSION "2.2.0")
|
set(MASON_EXPAT_VERSION "2.2.0")
|
||||||
set(MASON_LUA_VERSION "5.2.4")
|
set(MASON_LUA_VERSION "5.2.4")
|
||||||
@@ -60,7 +61,7 @@ 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 12)
|
set(OSRM_VERSION_MINOR 13)
|
||||||
set(OSRM_VERSION_PATCH 0)
|
set(OSRM_VERSION_PATCH 0)
|
||||||
set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}")
|
set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}")
|
||||||
|
|
||||||
@@ -211,19 +212,19 @@ endif()
|
|||||||
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
||||||
message(STATUS "Configuring debug mode flags")
|
message(STATUS "Configuring debug mode flags")
|
||||||
set(ENABLE_ASSERTIONS ON)
|
set(ENABLE_ASSERTIONS ON)
|
||||||
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-inline -fno-omit-frame-pointer")
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|
||||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ggdb")
|
|
||||||
else()
|
|
||||||
# Don't override the -O parameter for RelWithDebInfo, we want an optimized build
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fno-inline -fno-omit-frame-pointer")
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-inline -fno-omit-frame-pointer")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||||
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb")
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og -ggdb")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
||||||
message(STATUS "Configuring release mode optimizations")
|
message(STATUS "Configuring release mode optimizations")
|
||||||
# Check if LTO is available
|
# Check if LTO is available
|
||||||
@@ -303,10 +304,11 @@ if (ENABLE_COVERAGE)
|
|||||||
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||||
message(ERROR "ENABLE_COVERAGE=ON only make sense with a Debug build")
|
message(ERROR "ENABLE_COVERAGE=ON only make sense with a Debug build")
|
||||||
endif()
|
endif()
|
||||||
message(INFO "Enabling coverage")
|
message(STATUS "Enabling coverage")
|
||||||
set(MAYBE_COVERAGE_LIBRARIES "-lgcov")
|
set(MAYBE_COVERAGE_LIBRARIES "-lgcov")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ftest-coverage -fprofile-arcs")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ENABLE_SANITIZER)
|
if (ENABLE_SANITIZER)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
|
||||||
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -fsanitize=address")
|
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -fsanitize=address")
|
||||||
@@ -379,8 +381,8 @@ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")
|
|||||||
|
|
||||||
# Activate C++1y
|
# Activate C++1y
|
||||||
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
||||||
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -std=c++1y")
|
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -std=c++14")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Configuring other platform dependencies
|
# Configuring other platform dependencies
|
||||||
@@ -517,29 +519,10 @@ else()
|
|||||||
find_package(BZip2 REQUIRED)
|
find_package(BZip2 REQUIRED)
|
||||||
add_dependency_includes(${BZIP2_INCLUDE_DIR})
|
add_dependency_includes(${BZIP2_INCLUDE_DIR})
|
||||||
|
|
||||||
FIND_PACKAGE(Lua 5.2 EXACT)
|
find_package(Lua 5.2 REQUIRED)
|
||||||
IF (LUA_FOUND)
|
if (LUA_FOUND)
|
||||||
MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}")
|
message(STATUS "Using Lua ${LUA_VERSION_STRING}")
|
||||||
ELSE()
|
endif()
|
||||||
FIND_PACKAGE(Lua 5.1 EXACT)
|
|
||||||
IF (LUA_FOUND)
|
|
||||||
MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}")
|
|
||||||
ELSE()
|
|
||||||
# Now fall back to a lua verison without exact
|
|
||||||
# in case this cmake version also forces patch versions
|
|
||||||
FIND_PACKAGE(Lua 5.2)
|
|
||||||
IF (LUA_FOUND)
|
|
||||||
MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}")
|
|
||||||
ELSE()
|
|
||||||
FIND_PACKAGE(Lua 5.1)
|
|
||||||
IF (LUA_FOUND)
|
|
||||||
MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}")
|
|
||||||
ELSE()
|
|
||||||
MESSAGE(FATAL_ERROR "Lua 5.1 or 5.2 was not found.")
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
set(USED_LUA_LIBRARIES ${LUA_LIBRARIES})
|
set(USED_LUA_LIBRARIES ${LUA_LIBRARIES})
|
||||||
add_dependency_includes(${LUA_INCLUDE_DIR})
|
add_dependency_includes(${LUA_INCLUDE_DIR})
|
||||||
@@ -829,6 +812,10 @@ add_custom_target(uninstall
|
|||||||
add_subdirectory(unit_tests)
|
add_subdirectory(unit_tests)
|
||||||
add_subdirectory(src/benchmarks)
|
add_subdirectory(src/benchmarks)
|
||||||
|
|
||||||
|
if (ENABLE_GLIBC_WORKAROUND)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLIBC_WORKAROUND")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (ENABLE_NODE_BINDINGS)
|
if (ENABLE_NODE_BINDINGS)
|
||||||
add_subdirectory(src/nodejs)
|
add_subdirectory(src/nodejs)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
@@ -41,6 +41,14 @@ Related [Project-OSRM](https://github.com/Project-OSRM) repositories:
|
|||||||
|
|
||||||
The easiest and quickest way to setup your own routing engine is to use Docker images we provide.
|
The easiest and quickest way to setup your own routing engine is to use Docker images we provide.
|
||||||
|
|
||||||
|
There are two pre-processing pipelines available:
|
||||||
|
- Contraction Hierarchies (CH)
|
||||||
|
- Multi-Level Dijkstra (MLD)
|
||||||
|
|
||||||
|
we recommend using MLD by default except for special use-cases such as very large distance matrices where CH is still a better fit for the time being.
|
||||||
|
In the following we explain the MLD pipeline.
|
||||||
|
If you want to use the CH pipeline instead replace `osrm-partition` and `osrm-customize` with a single `osrm-contract` and change the algorithm option for `osrm-routed` to `--algorithm ch`.
|
||||||
|
|
||||||
### Using Docker
|
### Using Docker
|
||||||
|
|
||||||
We base our Docker images ([backend](https://hub.docker.com/r/osrm/osrm-backend/), [frontend](https://hub.docker.com/r/osrm/osrm-frontend/)) on Alpine Linux and make sure they are as lightweight as possible.
|
We base our Docker images ([backend](https://hub.docker.com/r/osrm/osrm-backend/), [frontend](https://hub.docker.com/r/osrm/osrm-frontend/)) on Alpine Linux and make sure they are as lightweight as possible.
|
||||||
@@ -52,9 +60,10 @@ Download OpenStreetMap extracts for example from [Geofabrik](http://download.geo
|
|||||||
Pre-process the extract with the car profile and start a routing engine HTTP server on port 5000
|
Pre-process the extract with the car profile and start a routing engine HTTP server on port 5000
|
||||||
|
|
||||||
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf
|
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf
|
||||||
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-contract /data/berlin-latest.osrm
|
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-partition /data/berlin-latest.osrm
|
||||||
|
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-customize /data/berlin-latest.osrm
|
||||||
|
|
||||||
docker run -t -i -p 5000:5000 -v $(pwd):/data osrm/osrm-backend osrm-routed /data/berlin-latest.osrm
|
docker run -t -i -p 5000:5000 -v $(pwd):/data osrm/osrm-backend osrm-routed --algorithm mld /data/berlin-latest.osrm
|
||||||
|
|
||||||
Make requests against the HTTP server
|
Make requests against the HTTP server
|
||||||
|
|
||||||
@@ -90,8 +99,8 @@ Install dependencies
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt install build-essential git cmake pkg-config \
|
sudo apt install build-essential git cmake pkg-config \
|
||||||
libbz2-dev libstxxl-dev libstxxl1v5 libxml2-dev \
|
libbz2-dev libxml2-dev libzip-dev libboost-all-dev \
|
||||||
libzip-dev libboost-all-dev lua5.2 liblua5.2-dev libtbb-dev
|
lua5.2 liblua5.2-dev libtbb-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
Compile and install OSRM binaries
|
Compile and install OSRM binaries
|
||||||
@@ -104,26 +113,6 @@ cmake --build .
|
|||||||
sudo cmake --build . --target install
|
sudo cmake --build . --target install
|
||||||
```
|
```
|
||||||
|
|
||||||
Grab a `.osm.pbf` extract from [Geofabrik](http://download.geofabrik.de/index.html) or [Mapzen's Metro Extracts](https://mapzen.com/data/metro-extracts/)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
|
|
||||||
```
|
|
||||||
|
|
||||||
Pre-process the extract and start the HTTP server
|
|
||||||
|
|
||||||
```
|
|
||||||
osrm-extract berlin-latest.osm.pbf -p profiles/car.lua
|
|
||||||
osrm-contract berlin-latest.osrm
|
|
||||||
osrm-routed berlin-latest.osrm
|
|
||||||
```
|
|
||||||
|
|
||||||
Running Queries
|
|
||||||
|
|
||||||
```
|
|
||||||
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
|
||||||
|
|
||||||
Read the [API usage policy](https://github.com/Project-OSRM/osrm-backend/wiki/Api-usage-policy).
|
Read the [API usage policy](https://github.com/Project-OSRM/osrm-backend/wiki/Api-usage-policy).
|
||||||
@@ -157,7 +146,9 @@ which will check and use pre-built binaries if they're available for this releas
|
|||||||
|
|
||||||
to always force building the Node.js bindings 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).
|
For usage details have a look [these API docs](docs/nodejs/api.md).
|
||||||
|
|
||||||
|
An exemplary implementation by a 3rd party with Docker and Node.js can be found [here](https://github.com/door2door-io/osrm-express-server-demo).
|
||||||
|
|
||||||
|
|
||||||
## References in publications
|
## References in publications
|
||||||
|
|||||||
+8
-5
@@ -7,19 +7,22 @@ ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|||||||
SET PROJECT_DIR=%CD%
|
SET PROJECT_DIR=%CD%
|
||||||
ECHO PROJECT_DIR^: %PROJECT_DIR%
|
ECHO PROJECT_DIR^: %PROJECT_DIR%
|
||||||
ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS%
|
ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS%
|
||||||
|
|
||||||
|
|
||||||
|
:: Check CMake version
|
||||||
|
SET CMAKE_VERSION=3.9.2
|
||||||
|
SET PATH=%PROJECT_DIR%\cmake-%CMAKE_VERSION%-win32-x86\bin;%PATH%
|
||||||
ECHO cmake^: && cmake --version
|
ECHO cmake^: && cmake --version
|
||||||
IF %ERRORLEVEL% NEQ 0 ECHO CMAKE not found && GOTO CMAKE_NOT_OK
|
IF %ERRORLEVEL% NEQ 0 ECHO CMAKE not found && GOTO CMAKE_NOT_OK
|
||||||
|
|
||||||
cmake --version | findstr /C:"3.7.1" && GOTO CMAKE_OK
|
cmake --version | findstr /C:%CMAKE_VERSION% && GOTO CMAKE_OK
|
||||||
|
|
||||||
:CMAKE_NOT_OK
|
:CMAKE_NOT_OK
|
||||||
SET CMAKE_VERSION=3.7.1
|
|
||||||
ECHO CMAKE NOT OK - downloading new CMake %CMAKE_VERSION%
|
ECHO CMAKE NOT OK - downloading new CMake %CMAKE_VERSION%
|
||||||
IF NOT EXIST cm.zip powershell Invoke-WebRequest https://cmake.org/files/v3.7/cmake-%CMAKE_VERSION%-win32-x86.zip -OutFile $env:PROJECT_DIR\cm.zip
|
powershell Invoke-WebRequest https://cmake.org/files/v3.9/cmake-%CMAKE_VERSION%-win32-x86.zip -OutFile $env:PROJECT_DIR\cm.zip
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
IF NOT EXIST cmake-%CMAKE_VERSION%-win32-x86 7z -y x cm.zip | %windir%\system32\FIND "ing archive"
|
IF NOT EXIST cmake-%CMAKE_VERSION%-win32-x86 7z -y x cm.zip | %windir%\system32\FIND "ing archive"
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
SET PATH=%PROJECT_DIR%\cmake-%CMAKE_VERSION%-win32-x86\bin;%PATH%
|
|
||||||
|
|
||||||
:CMAKE_OK
|
:CMAKE_OK
|
||||||
ECHO CMAKE_OK
|
ECHO CMAKE_OK
|
||||||
@@ -37,7 +40,7 @@ ECHO msbuild version
|
|||||||
msbuild /version
|
msbuild /version
|
||||||
|
|
||||||
:: HARDCODE "x64" as it is uppercase on AppVeyor and download from S3 is case sensitive
|
:: HARDCODE "x64" as it is uppercase on AppVeyor and download from S3 is case sensitive
|
||||||
SET DEPSPKG=osrm-deps-win-x64-14.0.7z
|
SET DEPSPKG=osrm-deps-win-x64-14.0-2017.09.7z
|
||||||
|
|
||||||
:: local development
|
:: local development
|
||||||
ECHO.
|
ECHO.
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
# This is because, the lua location is not standardized and may exist in
|
# This is because, the lua location is not standardized and may exist in
|
||||||
# locations other than lua/
|
# locations other than lua/
|
||||||
|
|
||||||
|
include(FindPkgConfig)
|
||||||
|
|
||||||
unset(_lua_include_subdirs)
|
unset(_lua_include_subdirs)
|
||||||
unset(_lua_library_names)
|
unset(_lua_library_names)
|
||||||
unset(_lua_append_versions)
|
unset(_lua_append_versions)
|
||||||
@@ -81,6 +83,7 @@ function(_lua_set_version_vars)
|
|||||||
lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
|
lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
|
||||||
lua.${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
|
lua.${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
|
||||||
)
|
)
|
||||||
|
pkg_check_modules(LUA QUIET "lua${ver}")
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE)
|
set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE)
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ libdir=@PKGCONFIG_LIBRARY_DIR@
|
|||||||
|
|
||||||
Name: libOSRM
|
Name: libOSRM
|
||||||
Description: Project OSRM library
|
Description: Project OSRM library
|
||||||
Version: v@OSRM_VERSION@
|
Version: @OSRM_VERSION@
|
||||||
Requires:
|
Requires:
|
||||||
Libs: -L${libdir} -losrm @PKGCONFIG_OSRM_LDFLAGS@
|
Libs: -L${libdir} -losrm @PKGCONFIG_OSRM_LDFLAGS@
|
||||||
Libs.private: @PKGCONFIG_OSRM_DEPENDENT_LIBRARIES@
|
Libs.private: @PKGCONFIG_OSRM_DEPENDENT_LIBRARIES@
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
default: '--strict --tags ~@stress --tags ~@mld --tags ~@todo --require features/support --require features/step_definitions',
|
default: '--strict --tags ~@stress --tags ~@todo --require features/support --require features/step_definitions',
|
||||||
verify: '--strict --tags ~@stress --tags ~@mld --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 --tags ~@ch --require features/support --require features/step_definitions -f progress'
|
mld: '--strict --tags ~@stress --tags ~@todo --require features/support --require features/step_definitions -f progress'
|
||||||
};
|
};
|
||||||
|
|||||||
+3
-3
@@ -7,7 +7,7 @@ RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
|
|||||||
echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
|
echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
|
||||||
apk update && \
|
apk update && \
|
||||||
apk upgrade && \
|
apk upgrade && \
|
||||||
apk add git cmake wget make libc-dev gcc g++ bzip2-dev boost-dev zlib-dev expat-dev lua5.1-dev libtbb@testing libtbb-dev@testing && \
|
apk add git cmake wget make libc-dev gcc g++ bzip2-dev boost-dev zlib-dev expat-dev lua5.2-dev libtbb@testing libtbb-dev@testing && \
|
||||||
\
|
\
|
||||||
echo "Building libstxxl" && \
|
echo "Building libstxxl" && \
|
||||||
cd /opt && \
|
cd /opt && \
|
||||||
@@ -46,8 +46,8 @@ RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
|
|||||||
rm /usr/local/lib/libstxxl* && \
|
rm /usr/local/lib/libstxxl* && \
|
||||||
cd /opt && \
|
cd /opt && \
|
||||||
apk del boost-dev && \
|
apk del boost-dev && \
|
||||||
apk del g++ cmake libc-dev expat-dev zlib-dev bzip2-dev lua5.1-dev git make gcc && \
|
apk del g++ cmake libc-dev expat-dev zlib-dev bzip2-dev lua5.2-dev git make gcc && \
|
||||||
apk add boost-filesystem boost-program_options boost-regex boost-iostreams boost-thread libgomp lua5.1 expat && \
|
apk add boost-filesystem boost-program_options boost-regex boost-iostreams boost-thread libgomp lua5.2 expat && \
|
||||||
rm -rf /src /opt/stxxl /usr/local/bin/stxxl_tool /usr/local/lib/libosrm*
|
rm -rf /src /opt/stxxl /usr/local/bin/stxxl_tool /usr/local/lib/libosrm*
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|||||||
+14
-8
@@ -47,7 +47,7 @@ Profiles can also define a `process_segment` function to handle differences in s
|
|||||||
|
|
||||||
At the end of the file, a table if returned with references to the setup and processing functions the profile has defined.
|
At the end of the file, a table if returned with references to the setup and processing functions the profile has defined.
|
||||||
|
|
||||||
## Understanding speed, weight and rate
|
## Understanding speed, weight and rate
|
||||||
When computing a route from A to B there can be different measure of what is the best route. That's why there's a need for different profiles.
|
When computing a route from A to B there can be different measure of what is the best route. That's why there's a need for different profiles.
|
||||||
|
|
||||||
Because speeds very on different types of roads, the shortest and the fastest route are typically different. But there are many other possible preferences. For example a user might prefer a bicycle route that follow parks or other green areas, even though both duration and distance are a bit longer.
|
Because speeds very on different types of roads, the shortest and the fastest route are typically different. But there are many other possible preferences. For example a user might prefer a bicycle route that follow parks or other green areas, even though both duration and distance are a bit longer.
|
||||||
@@ -91,7 +91,7 @@ The `setup` function is called once when the profile is loaded and must return a
|
|||||||
|
|
||||||
Note that processing of data is parallelized and several unconnected LUA interpreters will be running at the same time. The `setup` function will be called once for each. Each LUA iinterpreter will have it's own set of globals.
|
Note that processing of data is parallelized and several unconnected LUA interpreters will be running at the same time. The `setup` function will be called once for each. Each LUA iinterpreter will have it's own set of globals.
|
||||||
|
|
||||||
The following global properties can be set under `properties` in the hash you return in the `setup` function:
|
The following global properties can be set under `properties` in the hash you return in the `setup` function:
|
||||||
|
|
||||||
Attribute | Type | Notes
|
Attribute | Type | Notes
|
||||||
-------------------------------------|----------|----------------------------------------------------------------------------
|
-------------------------------------|----------|----------------------------------------------------------------------------
|
||||||
@@ -104,6 +104,7 @@ max_speed_for_map_matching | Float | Maximum vehicle speed to be as
|
|||||||
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 `process_segment` 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 `process_segment` will be called for all segments (default `false`)
|
||||||
|
|
||||||
|
|
||||||
The following additional global properties can be set in the hash you return in the `setup` function:
|
The following additional global properties can be set in the hash you return in the `setup` function:
|
||||||
|
|
||||||
Attribute | Type | Notes
|
Attribute | Type | Notes
|
||||||
@@ -113,8 +114,9 @@ excludable | Sequence of Sets | Determines which class
|
|||||||
classes | Sequence | Determines the allowed classes that can be referenced using `{forward,backward}_classes` on the way in the `process_way` function.
|
classes | Sequence | Determines the allowed classes that can be referenced using `{forward,backward}_classes` on the way in the `process_way` function.
|
||||||
restrictions | Sequence | Determines which turn restrictions will be used for this profile.
|
restrictions | Sequence | Determines which turn restrictions will be used for this profile.
|
||||||
suffix_list | Set | List of name suffixes needed for determining if "Highway 101 NW" the same road as "Highway 101 ES".
|
suffix_list | Set | List of name suffixes needed for determining if "Highway 101 NW" the same road as "Highway 101 ES".
|
||||||
|
relation_types | Sequence | Determines wich relations should be cached for processing in this profile. It contains relations types
|
||||||
|
|
||||||
### process_node(profile, node, result)
|
### process_node(profile, node, result, relations)
|
||||||
Process an OSM node to determine whether this node is a barrier or can be passed and whether passing it incurs a delay.
|
Process an OSM node to determine whether this node is a barrier or can be passed and whether passing it incurs a delay.
|
||||||
|
|
||||||
Argument | Description
|
Argument | Description
|
||||||
@@ -122,6 +124,7 @@ Argument | Description
|
|||||||
profile | The configuration table you returned in `setup`.
|
profile | The configuration table you returned in `setup`.
|
||||||
node | The input node to process (read-only).
|
node | The input node to process (read-only).
|
||||||
result | The output that you will modify.
|
result | The output that you will modify.
|
||||||
|
relations| Storage of relations to access relations, where `node` is a member.
|
||||||
|
|
||||||
The following attributes can be set on `result`:
|
The following attributes can be set on `result`:
|
||||||
|
|
||||||
@@ -130,7 +133,7 @@ Attribute | Type | Notes
|
|||||||
barrier | Boolean | Is it an impassable barrier?
|
barrier | Boolean | Is it an impassable barrier?
|
||||||
traffic_lights | Boolean | Is it a traffic light (incurs delay in `process_turn`)?
|
traffic_lights | Boolean | Is it a traffic light (incurs delay in `process_turn`)?
|
||||||
|
|
||||||
## process_way(profile, way, result)
|
### process_way(profile, way, result, relations)
|
||||||
Given an OpenStreetMap way, the `process_way` function will either return nothing (meaning we are not going to route over this way at all), or it will set up a result hash.
|
Given an OpenStreetMap way, the `process_way` function will either return nothing (meaning we are not going to route over this way at all), or it will set up a result hash.
|
||||||
|
|
||||||
Argument | Description
|
Argument | Description
|
||||||
@@ -138,6 +141,7 @@ Argument | Description
|
|||||||
profile | The configuration table you returned in `setup`.
|
profile | The configuration table you returned in `setup`.
|
||||||
node | The input way to process (read-only).
|
node | The input way to process (read-only).
|
||||||
result | The output that you will modify.
|
result | The output that you will modify.
|
||||||
|
relations| Storage of relations to access relations, where `way` is a member.
|
||||||
|
|
||||||
Importantly it will set `result.forward_mode` and `result.backward_mode` to indicate the travel mode in each direction, as well as set `result.forward_speed` and `result.backward_speed` to integer values representing the speed for traversing the way.
|
Importantly it will set `result.forward_mode` and `result.backward_mode` to indicate the travel mode in each direction, as well as set `result.forward_speed` and `result.backward_speed` to integer values representing the speed for traversing the way.
|
||||||
|
|
||||||
@@ -167,7 +171,9 @@ is_startpoint | Boolean | Can a journey start on this
|
|||||||
roundabout | Boolean | Is this part of a roundabout?
|
roundabout | Boolean | Is this part of a roundabout?
|
||||||
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 (equal to set `forward_ref` and `backward_ref` with one value)
|
||||||
|
forward_ref | String | Road number in forward way direction
|
||||||
|
backward_ref | String | Road number in backward way direction
|
||||||
destinations | String | The road's destinations
|
destinations | String | The road's destinations
|
||||||
exits | String | The ramp's exit numbers or names
|
exits | String | The ramp's exit numbers or names
|
||||||
pronunciation | String | Name pronunciation
|
pronunciation | String | Name pronunciation
|
||||||
@@ -178,9 +184,9 @@ road_classification.may_be_ignored | Boolean | Guidance: way is non-highwa
|
|||||||
road_classification.num_lanes | Unsigned | Guidance: total number of lanes in way
|
road_classification.num_lanes | Unsigned | Guidance: total number of lanes in way
|
||||||
|
|
||||||
### process_segment(profile, segment)
|
### process_segment(profile, segment)
|
||||||
The `process_segment` function is called for every segment of OSM ways. A segment is a straight line between two OSM nodes.
|
The `process_segment` function is called for every segment of OSM ways. A segment is a straight line between two OSM nodes.
|
||||||
|
|
||||||
On OpenStreetMap way cannot have different tags on different parts of a way. Instead you would split the way into several smaller ways. However many ways are long. For example, many ways pass hills without any change in tags.
|
On OpenStreetMap way cannot have different tags on different parts of a way. Instead you would split the way into several smaller ways. However many ways are long. For example, many ways pass hills without any change in tags.
|
||||||
|
|
||||||
Processing each segment of an OSM way makes it possible to have different speeds on different parts of a way based on external data like data about elevation, pollution, noise or scenic value and adjust weight and duration of the segment.
|
Processing each segment of an OSM way makes it possible to have different speeds on different parts of a way based on external data like data about elevation, pollution, noise or scenic value and adjust weight and duration of the segment.
|
||||||
|
|
||||||
@@ -265,7 +271,7 @@ Example:
|
|||||||
function process_segment (profile, segment)
|
function process_segment (profile, segment)
|
||||||
local sourceData = raster:query(profile.raster_source, segment.source.lon, segment.source.lat)
|
local sourceData = raster:query(profile.raster_source, segment.source.lon, segment.source.lat)
|
||||||
local targetData = raster:query(profile.raster_source, segment.target.lon, segment.target.lat)
|
local targetData = raster:query(profile.raster_source, segment.target.lon, segment.target.lat)
|
||||||
|
|
||||||
local invalid = sourceData.invalid_data()
|
local invalid = sourceData.invalid_data()
|
||||||
if sourceData.datum ~= invalid and targetData.datum ~= invalid then
|
if sourceData.datum ~= invalid and targetData.datum ~= invalid then
|
||||||
-- use values to adjust weight and duration
|
-- use values to adjust weight and duration
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
@routing @bicycle
|
||||||
|
Feature: Bike - Use distance weight
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given a grid size of 200 meters
|
||||||
|
|
||||||
|
Scenario: Bike - Check distance weight
|
||||||
|
Given the profile file
|
||||||
|
"""
|
||||||
|
local functions = require('bicycle')
|
||||||
|
functions.setup_testbot = functions.setup
|
||||||
|
|
||||||
|
functions.setup = function()
|
||||||
|
local profile = functions.setup_testbot()
|
||||||
|
profile.properties.weight_name = 'distance'
|
||||||
|
return profile
|
||||||
|
end
|
||||||
|
|
||||||
|
return functions
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a-b-c
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway |
|
||||||
|
| abc | residential |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | weight | time | distance |
|
||||||
|
| a | b | abc,abc | 200 | 48s | 200m +-1 |
|
||||||
|
| a | c | abc,abc | 400 | 96s | 400m +-1 |
|
||||||
@@ -157,15 +157,16 @@ Feature: Car - Restricted access
|
|||||||
|
|
||||||
Scenario: Car - Access combinations
|
Scenario: Car - Access combinations
|
||||||
Then routability should be
|
Then routability should be
|
||||||
| highway | access | vehicle | motor_vehicle | motorcar | forw | backw | # |
|
| highway | access | vehicle | motor_vehicle | motorcar | forw | backw | # |
|
||||||
| runway | private | | | permissive | x | x | |
|
| runway | private | | | permissive | x | x | |
|
||||||
| primary | forestry | | yes | | x | x | |
|
| primary | forestry | | yes | | x | x | |
|
||||||
| cycleway | | | designated | | x | x | |
|
| cycleway | | | designated | | x | x | |
|
||||||
| residential | | yes | no | | | | |
|
| unclassified | | | destination | destination | x | x | |
|
||||||
| motorway | yes | permissive | | private | x | | implied oneway |
|
| residential | | yes | no | | | | |
|
||||||
| trunk | agricultural | designated | permissive | no | | | |
|
| motorway | yes | permissive | | private | x | | implied oneway |
|
||||||
| pedestrian | | | | | | | |
|
| trunk | agricultural | designated | permissive | no | | | |
|
||||||
| pedestrian | | | | destination | | | temporary disabled #3773 |
|
| pedestrian | | | | | | | |
|
||||||
|
| pedestrian | | | | destination | | | temporary disabled #3773 |
|
||||||
|
|
||||||
Scenario: Car - Ignore access tags for other modes
|
Scenario: Car - Ignore access tags for other modes
|
||||||
Then routability should be
|
Then routability should be
|
||||||
|
|||||||
@@ -17,27 +17,27 @@ Feature: Car - Turn restrictions
|
|||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| ej | yes |
|
| bj | yes |
|
||||||
| jp | yes |
|
| jd | yes |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | ej | nj | j | only_right_turn @ (has_pygmies > 10 p) |
|
| restriction | bj | aj | j | only_right_turn @ (has_pygmies > 10 p) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| e | s | ej,js,js |
|
| b | c | bj,jc,jc |
|
||||||
| e | n | ej,nj,nj |
|
| b | a | bj,aj,aj |
|
||||||
| e | p | ej,jp,jp |
|
| b | d | bj,jd,jd |
|
||||||
|
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
Scenario: Car - Restriction would be on, but the restriction was badly tagged
|
Scenario: Car - Restriction would be on, but the restriction was badly tagged
|
||||||
@@ -48,29 +48,29 @@ Feature: Car - Turn restrictions
|
|||||||
|
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p |
|
p |
|
||||||
\ |
|
\ |
|
||||||
j
|
j
|
||||||
| \
|
| \
|
||||||
s m
|
c m
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes |
|
| nodes |
|
||||||
| nj |
|
| aj |
|
||||||
| js |
|
| jc |
|
||||||
| pjm |
|
| pjm |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | nj | pjm | j | no_left_turn @ (Mo-Fr 07:00-10:30) |
|
| restriction | aj | pjm | j | no_left_turn @ (Mo-Fr 07:00-10:30) |
|
||||||
| restriction | js | pjm | j | no_right_turn @ (Mo-Fr 07:00-10:30) |
|
| restriction | jc | pjm | j | no_right_turn @ (Mo-Fr 07:00-10:30) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| n | m | nj,pjm,pjm |
|
| a | m | aj,pjm,pjm |
|
||||||
| s | m | js,pjm,pjm |
|
| c | m | jc,pjm,pjm |
|
||||||
|
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
Scenario: Car - Restriction With Compressed Geometry
|
Scenario: Car - Restriction With Compressed Geometry
|
||||||
@@ -149,29 +149,29 @@ Feature: Car - Turn restrictions
|
|||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| ej | no |
|
| bj | no |
|
||||||
| jp | no |
|
| jd | no |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional | except |
|
| type | way:from | way:to | node:via | restriction:conditional | except |
|
||||||
| restriction | ej | nj | j | only_right_turn @ (Mo-Su 08:00-12:00) | motorcar |
|
| restriction | bj | aj | j | only_right_turn @ (Mo-Su 08:00-12:00) | motorcar |
|
||||||
| restriction | jp | nj | j | only_left_turn @ (Mo-Su 08:00-12:00) | bus |
|
| restriction | jd | aj | j | only_left_turn @ (Mo-Su 08:00-12:00) | bus |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | # |
|
| from | to | route | # |
|
||||||
| e | s | ej,js,js | |
|
| b | c | bj,jc,jc | |
|
||||||
| e | n | ej,nj,nj | restriction does not apply to cars |
|
| b | a | bj,aj,aj | restriction does not apply to cars |
|
||||||
| e | p | ej,jp,jp | |
|
| b | d | bj,jd,jd | |
|
||||||
| p | s | jp,nj,nj,js,js | restriction excepting busses still applies to cars |
|
| d | c | jd,aj,aj,jc,jc | restriction excepting busses still applies to cars |
|
||||||
|
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
Scenario: Car - only_right_turn
|
Scenario: Car - only_right_turn
|
||||||
@@ -181,27 +181,27 @@ Feature: Car - Turn restrictions
|
|||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| ej | yes |
|
| bj | yes |
|
||||||
| jp | yes |
|
| jd | yes |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | ej | nj | j | only_right_turn @ (Mo-Su 07:00-14:00) |
|
| restriction | bj | aj | j | only_right_turn @ (Mo-Su 07:00-14:00) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| e | s | ej,nj,nj,js,js |
|
| b | c | bj,aj,aj,jc,jc |
|
||||||
| e | n | ej,nj,nj |
|
| b | a | bj,aj,aj |
|
||||||
| e | p | ej,nj,nj,jp,jp |
|
| b | d | bj,aj,aj,jd,jd |
|
||||||
|
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
Scenario: Car - No right turn
|
Scenario: Car - No right turn
|
||||||
@@ -211,27 +211,27 @@ Feature: Car - Turn restrictions
|
|||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| ej | yes |
|
| bj | yes |
|
||||||
| jp | yes |
|
| jd | yes |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-13:00) |
|
| restriction | bj | aj | j | no_right_turn @ (Mo-Fr 07:00-13:00) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | # |
|
| from | to | route | # |
|
||||||
| e | s | ej,js,js | normal turn |
|
| b | c | bj,jc,jc | normal turn |
|
||||||
| e | n | ej,js,js,nj,nj | avoids right turn |
|
| b | a | bj,jc,jc,aj,aj | avoids right turn |
|
||||||
| e | p | ej,jp,jp | normal maneuver |
|
| b | d | bj,jd,jd | normal maneuver |
|
||||||
|
|
||||||
@only_turning @conditionals
|
@only_turning @conditionals
|
||||||
Scenario: Car - only_left_turn
|
Scenario: Car - only_left_turn
|
||||||
@@ -241,27 +241,27 @@ Feature: Car - Turn restrictions
|
|||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| ej | yes |
|
| bj | yes |
|
||||||
| jp | yes |
|
| jd | yes |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | ej | js | j | only_left_turn @ (Mo-Fr 07:00-16:00) |
|
| restriction | bj | jc | j | only_left_turn @ (Mo-Fr 07:00-16:00) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| e | s | ej,js,js |
|
| b | c | bj,jc,jc |
|
||||||
| e | n | ej,js,js,nj,nj |
|
| b | a | bj,jc,jc,aj,aj |
|
||||||
| e | p | ej,js,js,jp,jp |
|
| b | d | bj,jc,jc,jd,jd |
|
||||||
|
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
Scenario: Car - No left turn
|
Scenario: Car - No left turn
|
||||||
@@ -271,27 +271,27 @@ Feature: Car - Turn restrictions
|
|||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| ej | yes |
|
| bj | yes |
|
||||||
| jp | yes |
|
| jd | yes |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | ej | js | j | no_left_turn @ (Mo-Su 00:00-23:59) |
|
| restriction | bj | jc | j | no_left_turn @ (Mo-Su 00:00-23:59) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| e | s | ej,nj,nj,js,js |
|
| b | c | bj,aj,aj,jc,jc |
|
||||||
| e | n | ej,nj,nj |
|
| b | a | bj,aj,aj |
|
||||||
| e | p | ej,jp,jp |
|
| b | d | bj,jd,jd |
|
||||||
|
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
Scenario: Car - Conditional restriction is off
|
Scenario: Car - Conditional restriction is off
|
||||||
@@ -301,27 +301,27 @@ Feature: Car - Turn restrictions
|
|||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| ej | yes |
|
| bj | yes |
|
||||||
| jp | yes |
|
| jd | yes |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | ej | nj | j | no_right_turn @ (Mo-Su 16:00-20:00) |
|
| restriction | bj | aj | j | no_right_turn @ (Mo-Su 16:00-20:00) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| e | s | ej,js,js |
|
| b | c | bj,jc,jc |
|
||||||
| e | n | ej,nj,nj |
|
| b | a | bj,aj,aj |
|
||||||
| e | p | ej,jp,jp |
|
| b | d | bj,jd,jd |
|
||||||
|
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
Scenario: Car - Conditional restriction is on
|
Scenario: Car - Conditional restriction is on
|
||||||
@@ -331,27 +331,27 @@ Feature: Car - Turn restrictions
|
|||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| ej | yes |
|
| bj | yes |
|
||||||
| jp | yes |
|
| jd | yes |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-14:00) |
|
| restriction | bj | aj | j | no_right_turn @ (Mo-Fr 07:00-14:00) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| e | s | ej,js,js |
|
| b | c | bj,jc,jc |
|
||||||
| e | n | ej,js,js,nj,nj |
|
| b | a | bj,jc,jc,aj,aj |
|
||||||
| e | p | ej,jp,jp |
|
| b | d | bj,jd,jd |
|
||||||
|
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
Scenario: Car - Conditional restriction with multiple time windows
|
Scenario: Car - Conditional restriction with multiple time windows
|
||||||
@@ -362,28 +362,28 @@ Feature: Car - Turn restrictions
|
|||||||
|
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p |
|
p |
|
||||||
\ |
|
\ |
|
||||||
j
|
j
|
||||||
| \
|
| \
|
||||||
s m
|
c m
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| jp | yes |
|
| jp | yes |
|
||||||
| mj | yes |
|
| mj | yes |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | nj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
|
| restriction | aj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| n | p | nj,js,js,jp,jp |
|
| a | p | aj,jc,jc,jp,jp |
|
||||||
| m | p | mj,jp,jp |
|
| m | p | mj,jp,jp |
|
||||||
|
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
@@ -394,27 +394,27 @@ Feature: Car - Turn restrictions
|
|||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| ej | yes |
|
| bj | yes |
|
||||||
| jp | yes |
|
| jd | yes |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | ej | nj | j | only_right_turn @ (Mo-Su 07:00-14:00) |
|
| restriction | bj | aj | j | only_right_turn @ (Mo-Su 07:00-14:00) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| e | s | ej,nj,nj,js,js |
|
| b | c | bj,aj,aj,jc,jc |
|
||||||
| e | n | ej,nj,nj |
|
| b | a | bj,aj,aj |
|
||||||
| e | p | ej,nj,nj,jp,jp |
|
| b | d | bj,aj,aj,jd,jd |
|
||||||
|
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
Scenario: Car - No right turn
|
Scenario: Car - No right turn
|
||||||
@@ -424,27 +424,27 @@ Feature: Car - Turn restrictions
|
|||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| ej | yes |
|
| bj | yes |
|
||||||
| jp | yes |
|
| jd | yes |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-13:00) |
|
| restriction | bj | aj | j | no_right_turn @ (Mo-Fr 07:00-13:00) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | # |
|
| from | to | route | # |
|
||||||
| e | s | ej,js,js | normal turn |
|
| b | c | bj,jc,jc | normal turn |
|
||||||
| e | n | ej,js,js,nj,nj | avoids right turn |
|
| b | a | bj,jc,jc,aj,aj | avoids right turn |
|
||||||
| e | p | ej,jp,jp | normal maneuver |
|
| b | d | bj,jd,jd | normal maneuver |
|
||||||
|
|
||||||
@only_turning @conditionals
|
@only_turning @conditionals
|
||||||
Scenario: Car - only_left_turn
|
Scenario: Car - only_left_turn
|
||||||
@@ -454,27 +454,27 @@ Feature: Car - Turn restrictions
|
|||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| ej | yes |
|
| bj | yes |
|
||||||
| jp | yes |
|
| jd | yes |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | ej | js | j | only_left_turn @ (Mo-Fr 07:00-16:00) |
|
| restriction | bj | jc | j | only_left_turn @ (Mo-Fr 07:00-16:00) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| e | s | ej,js,js |
|
| b | c | bj,jc,jc |
|
||||||
| e | n | ej,js,js,nj,nj |
|
| b | a | bj,jc,jc,aj,aj |
|
||||||
| e | p | ej,js,js,jp,jp |
|
| b | d | bj,jc,jc,jd,jd |
|
||||||
|
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
Scenario: Car - No left turn
|
Scenario: Car - No left turn
|
||||||
@@ -484,27 +484,27 @@ Feature: Car - Turn restrictions
|
|||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| ej | yes |
|
| bj | yes |
|
||||||
| jp | yes |
|
| jd | yes |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | ej | js | j | no_left_turn @ (Mo-Su 00:00-23:59) |
|
| restriction | bj | jc | j | no_left_turn @ (Mo-Su 00:00-23:59) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| e | s | ej,nj,nj,js,js |
|
| b | c | bj,aj,aj,jc,jc |
|
||||||
| e | n | ej,nj,nj |
|
| b | a | bj,aj,aj |
|
||||||
| e | p | ej,jp,jp |
|
| b | d | bj,jd,jd |
|
||||||
|
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
Scenario: Car - Conditional restriction is off
|
Scenario: Car - Conditional restriction is off
|
||||||
@@ -514,27 +514,27 @@ Feature: Car - Turn restrictions
|
|||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| ej | yes |
|
| bj | yes |
|
||||||
| jp | yes |
|
| jd | yes |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | ej | nj | j | no_right_turn @ (Mo-Su 16:00-20:00) |
|
| restriction | bj | aj | j | no_right_turn @ (Mo-Su 16:00-20:00) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| e | s | ej,js,js |
|
| b | c | bj,jc,jc |
|
||||||
| e | n | ej,nj,nj |
|
| b | a | bj,aj,aj |
|
||||||
| e | p | ej,jp,jp |
|
| b | d | bj,jd,jd |
|
||||||
|
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
Scenario: Car - Conditional restriction is on
|
Scenario: Car - Conditional restriction is on
|
||||||
@@ -544,27 +544,27 @@ Feature: Car - Turn restrictions
|
|||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| ej | yes |
|
| bj | yes |
|
||||||
| jp | yes |
|
| jd | yes |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-14:00) |
|
| restriction | jb | aj | j | no_right_turn @ (Mo-Fr 07:00-14:00) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| e | s | ej,js,js |
|
| b | c | bj,jc,jc |
|
||||||
| e | n | ej,js,js,nj,nj |
|
| b | a | bj,jc,jc,aj,aj |
|
||||||
| e | p | ej,jp,jp |
|
| b | d | bj,jd,jd |
|
||||||
|
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
Scenario: Car - Conditional restriction with multiple time windows
|
Scenario: Car - Conditional restriction with multiple time windows
|
||||||
@@ -575,28 +575,28 @@ Feature: Car - Turn restrictions
|
|||||||
|
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
p |
|
p |
|
||||||
\ |
|
\ |
|
||||||
j
|
j
|
||||||
| \
|
| \
|
||||||
s m
|
c m
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| nj | no |
|
| aj | no |
|
||||||
| js | no |
|
| jc | no |
|
||||||
| jp | yes |
|
| jp | yes |
|
||||||
| mj | yes |
|
| mj | yes |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:conditional |
|
| type | way:from | way:to | node:via | restriction:conditional |
|
||||||
| restriction | nj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
|
| restriction | aj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| n | p | nj,js,js,jp,jp |
|
| a | p | aj,jc,jc,jp,jp |
|
||||||
| m | p | mj,jp,jp |
|
| m | p | mj,jp,jp |
|
||||||
|
|
||||||
@restriction-way
|
@restriction-way
|
||||||
@@ -677,7 +677,7 @@ Feature: Car - Turn restrictions
|
|||||||
# https://www.openstreetmap.org/#map=18/38.91099/-77.00888
|
# https://www.openstreetmap.org/#map=18/38.91099/-77.00888
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
Scenario: Car - DC North capitol situation, two on one off
|
Scenario: Car - DC North capitol situation, two on one off
|
||||||
Given the extract extra arguments "--parse-conditional-restrictions=1"
|
Given the extract extra arguments "--parse-conditional-restrictions"
|
||||||
# 9pm Wed 02 May, 2017 UTC, 5pm EDT
|
# 9pm Wed 02 May, 2017 UTC, 5pm EDT
|
||||||
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493845200"
|
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493845200"
|
||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493845200"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493845200"
|
||||||
@@ -724,7 +724,7 @@ Feature: Car - Turn restrictions
|
|||||||
|
|
||||||
@no_turning @conditionals
|
@no_turning @conditionals
|
||||||
Scenario: Car - DC North capitol situation, one on two off
|
Scenario: Car - DC North capitol situation, one on two off
|
||||||
Given the extract extra arguments "--parse-conditional-restrictions=1"
|
Given the extract extra arguments "--parse-conditional-restrictions"
|
||||||
# 10:30am utc, wed, 6:30am est
|
# 10:30am utc, wed, 6:30am est
|
||||||
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493807400"
|
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493807400"
|
||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493807400"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493807400"
|
||||||
@@ -848,7 +848,7 @@ Feature: Car - Turn restrictions
|
|||||||
|
|
||||||
@only_turning @conditionals
|
@only_turning @conditionals
|
||||||
Scenario: Car - Somewhere in London, the UK, GMT timezone
|
Scenario: Car - Somewhere in London, the UK, GMT timezone
|
||||||
Given the extract extra arguments "--parse-conditional-restrictions=1"
|
Given the extract extra arguments "--parse-conditional-restrictions"
|
||||||
# 9am UTC, 10am BST
|
# 9am UTC, 10am BST
|
||||||
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/london.geojson --parse-conditionals-from-now=1493802000"
|
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/london.geojson --parse-conditionals-from-now=1493802000"
|
||||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/london.geojson --parse-conditionals-from-now=1493802000"
|
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/london.geojson --parse-conditionals-from-now=1493802000"
|
||||||
|
|||||||
+134
-128
@@ -11,27 +11,27 @@ Feature: Car - Turn restrictions
|
|||||||
Scenario: Car - No left turn
|
Scenario: Car - No left turn
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
w j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| sj | yes |
|
| cj | yes |
|
||||||
| nj | -1 |
|
| aj | -1 |
|
||||||
| wj | -1 |
|
| dj | -1 |
|
||||||
| ej | -1 |
|
| bj | -1 |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction |
|
| type | way:from | way:to | node:via | restriction |
|
||||||
| restriction | sj | wj | j | no_left_turn |
|
| restriction | cj | dj | j | no_left_turn |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| s | w | |
|
| c | d | |
|
||||||
| s | n | sj,nj,nj |
|
| c | a | cj,aj,aj |
|
||||||
| s | e | sj,ej,ej |
|
| c | b | cj,bj,bj |
|
||||||
|
|
||||||
@no_turning
|
@no_turning
|
||||||
Scenario: Car - No straight on
|
Scenario: Car - No straight on
|
||||||
@@ -67,253 +67,259 @@ Feature: Car - Turn restrictions
|
|||||||
Scenario: Car - No right turn
|
Scenario: Car - No right turn
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
w j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| sj | yes |
|
| cj | yes |
|
||||||
| nj | -1 |
|
| aj | -1 |
|
||||||
| wj | -1 |
|
| dj | -1 |
|
||||||
| ej | -1 |
|
| bj | -1 |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction |
|
| type | way:from | way:to | node:via | restriction |
|
||||||
| restriction | sj | ej | j | no_right_turn |
|
| restriction | cj | bj | j | no_right_turn |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| s | w | sj,wj,wj |
|
| c | d | cj,dj,dj |
|
||||||
| s | n | sj,nj,nj |
|
| c | a | cj,aj,aj |
|
||||||
| s | e | |
|
| c | b | |
|
||||||
|
|
||||||
@no_turning
|
@no_turning
|
||||||
Scenario: Car - No u-turn
|
Scenario: Car - No u-turn
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
w j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| sj | yes |
|
| cj | yes |
|
||||||
| nj | -1 |
|
| aj | -1 |
|
||||||
| wj | -1 |
|
| dj | -1 |
|
||||||
| ej | -1 |
|
| bj | -1 |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction |
|
| type | way:from | way:to | node:via | restriction |
|
||||||
| restriction | sj | wj | j | no_u_turn |
|
| restriction | cj | dj | j | no_u_turn |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| s | w | |
|
| c | d | |
|
||||||
| s | n | sj,nj,nj |
|
| c | a | cj,aj,aj |
|
||||||
| s | e | sj,ej,ej |
|
| c | b | cj,bj,bj |
|
||||||
|
|
||||||
@no_turning
|
@no_turning
|
||||||
Scenario: Car - Handle any no_* relation
|
Scenario: Car - Handle any no_* relation
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
w j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| sj | yes |
|
| cj | yes |
|
||||||
| nj | -1 |
|
| aj | -1 |
|
||||||
| wj | -1 |
|
| dj | -1 |
|
||||||
| ej | -1 |
|
| bj | -1 |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction |
|
| type | way:from | way:to | node:via | restriction |
|
||||||
| restriction | sj | wj | j | no_weird_zigzags |
|
| restriction | cj | dj | j | no_weird_zigzags |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| s | w | |
|
| c | d | |
|
||||||
| s | n | sj,nj,nj |
|
| c | a | cj,aj,aj |
|
||||||
| s | e | sj,ej,ej |
|
| c | b | cj,bj,bj |
|
||||||
|
|
||||||
@only_turning
|
@only_turning
|
||||||
Scenario: Car - Only left turn
|
Scenario: Car - Only left turn
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
w j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| sj | yes |
|
| cj | yes |
|
||||||
| nj | -1 |
|
| aj | -1 |
|
||||||
| wj | -1 |
|
| dj | -1 |
|
||||||
| ej | -1 |
|
| bj | -1 |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction |
|
| type | way:from | way:to | node:via | restriction |
|
||||||
| restriction | sj | wj | j | only_left_turn |
|
| restriction | cj | dj | j | only_left_turn |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route |
|
||||||
|
| c | a | |
|
||||||
|
| c | b | |
|
||||||
|
| c | d | cj,dj,dj |
|
||||||
|
|
||||||
Scenario: Car - Only right turn, invalid
|
Scenario: Car - Only right turn, invalid
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
w j e r
|
d j b r
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| sj | yes |
|
| cj | yes |
|
||||||
| nj | -1 |
|
| aj | -1 |
|
||||||
| wj | -1 |
|
| dj | -1 |
|
||||||
| ej | -1 |
|
| bj | -1 |
|
||||||
| re | -1 |
|
| rb | -1 |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction |
|
| type | way:from | way:to | node:via | restriction |
|
||||||
| restriction | sj | er | j | only_right_on |
|
| restriction | cj | br | j | only_right_on |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| s | r | sj,ej,re,re |
|
| c | r | cj,bj,rb,rb |
|
||||||
|
|
||||||
@only_turning
|
@only_turning
|
||||||
Scenario: Car - Only right turn
|
Scenario: Car - Only right turn
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
w j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| sj | yes |
|
| cj | yes |
|
||||||
| nj | -1 |
|
| aj | -1 |
|
||||||
| wj | -1 |
|
| dj | -1 |
|
||||||
| ej | -1 |
|
| bj | -1 |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction |
|
| type | way:from | way:to | node:via | restriction |
|
||||||
| restriction | sj | ej | j | only_right_turn |
|
| restriction | cj | bj | j | only_right_turn |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| s | w | |
|
| c | d | |
|
||||||
| s | n | |
|
| c | a | |
|
||||||
| s | e | sj,ej,ej |
|
| c | b | cj,bj,bj |
|
||||||
|
|
||||||
@only_turning
|
@only_turning
|
||||||
Scenario: Car - Only straight on
|
Scenario: Car - Only straight on
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
w j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| sj | yes |
|
| cj | yes |
|
||||||
| nj | -1 |
|
| aj | -1 |
|
||||||
| wj | -1 |
|
| dj | -1 |
|
||||||
| ej | -1 |
|
| bj | -1 |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction |
|
| type | way:from | way:to | node:via | restriction |
|
||||||
| restriction | sj | nj | j | only_straight_on |
|
| restriction | cj | aj | j | only_straight_on |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| s | w | |
|
| c | d | |
|
||||||
| s | n | sj,nj,nj |
|
| c | a | cj,aj,aj |
|
||||||
| s | e | |
|
| c | b | |
|
||||||
|
|
||||||
@no_turning
|
@no_turning
|
||||||
Scenario: Car - Handle any only_* restriction
|
Scenario: Car - Handle any only_* restriction
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
w j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| sj | yes |
|
| cj | yes |
|
||||||
| nj | -1 |
|
| aj | -1 |
|
||||||
| wj | -1 |
|
| dj | -1 |
|
||||||
| ej | -1 |
|
| bj | -1 |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction |
|
| type | way:from | way:to | node:via | restriction |
|
||||||
| restriction | sj | nj | j | only_weird_zigzags |
|
| restriction | cj | aj | j | only_weird_zigzags |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| s | w | |
|
| c | d | |
|
||||||
| s | n | sj,nj,nj |
|
| c | a | cj,aj,aj |
|
||||||
| s | e | |
|
| c | b | |
|
||||||
|
|
||||||
@specific
|
@specific
|
||||||
Scenario: Car - :hgv-qualified on a standard turn restriction
|
Scenario: Car - :hgv-qualified on a standard turn restriction
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
w j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| sj | yes |
|
| cj | yes |
|
||||||
| nj | -1 |
|
| aj | -1 |
|
||||||
| wj | -1 |
|
| dj | -1 |
|
||||||
| ej | -1 |
|
| bj | -1 |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:hgv |
|
| type | way:from | way:to | node:via | restriction:hgv |
|
||||||
| restriction | sj | nj | j | no_straight_on |
|
| restriction | cj | aj | j | no_straight_on |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| s | w | sj,wj,wj |
|
| c | d | cj,dj,dj |
|
||||||
| s | n | sj,nj,nj |
|
| c | a | cj,aj,aj |
|
||||||
| s | e | sj,ej,ej |
|
| c | b | cj,bj,bj |
|
||||||
|
|
||||||
@specific
|
@specific
|
||||||
Scenario: Car - :motorcar-qualified on a standard turn restriction
|
Scenario: Car - :motorcar-qualified on a standard turn restriction
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
w j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| sj | yes |
|
| cj | yes |
|
||||||
| nj | -1 |
|
| aj | -1 |
|
||||||
| wj | -1 |
|
| dj | -1 |
|
||||||
| ej | -1 |
|
| bj | -1 |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction:motorcar |
|
| type | way:from | way:to | node:via | restriction:motorcar |
|
||||||
| restriction | sj | nj | j | no_straight_on |
|
| restriction | cj | aj | j | no_straight_on |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| s | w | sj,wj,wj |
|
| c | d | cj,dj,dj |
|
||||||
| s | n | |
|
| c | a | |
|
||||||
| s | e | sj,ej,ej |
|
| c | b | cj,bj,bj |
|
||||||
|
|
||||||
@except
|
@except
|
||||||
Scenario: Car - Except tag and on no_ restrictions
|
Scenario: Car - Except tag and on no_ restrictions
|
||||||
@@ -484,27 +490,27 @@ Feature: Car - Turn restrictions
|
|||||||
Scenario: Car - Ignore unrecognized restriction
|
Scenario: Car - Ignore unrecognized restriction
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
n
|
a
|
||||||
w j e
|
d j b
|
||||||
s
|
c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway |
|
| nodes | oneway |
|
||||||
| sj | yes |
|
| cj | yes |
|
||||||
| nj | -1 |
|
| aj | -1 |
|
||||||
| wj | -1 |
|
| dj | -1 |
|
||||||
| ej | -1 |
|
| bj | -1 |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction |
|
| type | way:from | way:to | node:via | restriction |
|
||||||
| restriction | sj | wj | j | yield |
|
| restriction | cj | dj | j | yield |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| s | w | sj,wj,wj |
|
| c | d | cj,dj,dj |
|
||||||
| s | n | sj,nj,nj |
|
| c | a | cj,aj,aj |
|
||||||
| s | e | sj,ej,ej |
|
| c | b | cj,bj,bj |
|
||||||
|
|
||||||
@restriction @compression
|
@restriction @compression
|
||||||
Scenario: Restriction On Compressed Geometry
|
Scenario: Restriction On Compressed Geometry
|
||||||
|
|||||||
@@ -0,0 +1,329 @@
|
|||||||
|
@routing @car @relations
|
||||||
|
Feature: Car - route relations
|
||||||
|
Background:
|
||||||
|
Given the profile "car"
|
||||||
|
|
||||||
|
Scenario: Assignment using relation membership roles
|
||||||
|
Given the profile file "car" initialized with
|
||||||
|
"""
|
||||||
|
profile.cardinal_directions = true
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a----------------b
|
||||||
|
c----------------d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name | highway | ref |
|
||||||
|
| ba | westbound | motorway | I 80 |
|
||||||
|
| cd | eastbound | motorway | I 80;CO 93 |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:east | way:west | route | ref | network |
|
||||||
|
| route | cd | ba | road | 80 | US:I |
|
||||||
|
| route | cd | ba | road | 93 | US:CO |
|
||||||
|
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | ref |
|
||||||
|
| b,a | westbound,westbound | I 80 $west,I 80 $west |
|
||||||
|
| c,d | eastbound,eastbound | I 80 $east; CO 93 $east,I 80 $east; CO 93 $east |
|
||||||
|
|
||||||
|
Scenario: No cardinal directions by default
|
||||||
|
Given the profile file "car" initialized with
|
||||||
|
"""
|
||||||
|
profile.cardinal_directions = false
|
||||||
|
"""
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a----------------b
|
||||||
|
c----------------d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name | highway | ref |
|
||||||
|
| ba | westbound | motorway | I 80 |
|
||||||
|
| cd | eastbound | motorway | I 80;CO 93 |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:east | way:west | route | ref | network |
|
||||||
|
| route | cd | ba | road | 80 | US:I |
|
||||||
|
| route | cd | ba | road | 93 | US:CO |
|
||||||
|
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | ref |
|
||||||
|
| b,a | westbound,westbound | I 80,I 80 |
|
||||||
|
| c,d | eastbound,eastbound | I 80; CO 93,I 80; CO 93 |
|
||||||
|
|
||||||
|
Scenario: No cardinal directions by default
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a----------------b
|
||||||
|
c----------------d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name | highway | ref |
|
||||||
|
| ba | westbound | motorway | I 80 |
|
||||||
|
| cd | eastbound | motorway | I 80;CO 93 |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:east | way:west | route | ref | network |
|
||||||
|
| route | cd | ba | road | 80 | US:I |
|
||||||
|
| route | cd | ba | road | 93 | US:CO |
|
||||||
|
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | ref |
|
||||||
|
| b,a | westbound,westbound | I 80,I 80 |
|
||||||
|
| c,d | eastbound,eastbound | I 80; CO 93,I 80; CO 93 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Assignment using relation direction property (no role on members)
|
||||||
|
Given the profile file "car" initialized with
|
||||||
|
"""
|
||||||
|
profile.cardinal_directions = true
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a----------------b
|
||||||
|
c----------------d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name | highway | ref |
|
||||||
|
| ba | westbound | motorway | I 80 |
|
||||||
|
| cd | eastbound | motorway | I 80;CO 93 |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | direction | way | route | ref | network |
|
||||||
|
| route | west | ba | road | 80 | US:I |
|
||||||
|
| route | east | cd | road | 80 | US:I |
|
||||||
|
| route | east | cd | road | 93 | US:CO |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | ref |
|
||||||
|
| b,a | westbound,westbound | I 80 $west,I 80 $west |
|
||||||
|
| c,d | eastbound,eastbound | I 80 $east; CO 93 $east,I 80 $east; CO 93 $east |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Forward assignment on one-way roads using relation direction property
|
||||||
|
Given the profile file "car" initialized with
|
||||||
|
"""
|
||||||
|
profile.cardinal_directions = true
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a----------------b
|
||||||
|
c----------------d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name | highway | ref |
|
||||||
|
| ba | westbound | motorway | I 80 |
|
||||||
|
| cd | eastbound | motorway | I 80;CO 93 |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | direction | way:forward | route | ref | network |
|
||||||
|
| route | west | ba | road | 80 | US:I |
|
||||||
|
| route | east | cd | road | 80 | US:I |
|
||||||
|
| route | east | cd | road | 93 | US:CO |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | ref |
|
||||||
|
| b,a | westbound,westbound | I 80 $west,I 80 $west |
|
||||||
|
| c,d | eastbound,eastbound | I 80 $east; CO 93 $east,I 80 $east; CO 93 $east |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Forward/backward assignment on non-divided roads with role direction tag
|
||||||
|
Given the profile file "car" initialized with
|
||||||
|
"""
|
||||||
|
profile.cardinal_directions = true
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a----------------b
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name | highway | ref | oneway |
|
||||||
|
| ab | mainroad | motorway | I 80 | no |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | direction | way:forward | route | ref | network |
|
||||||
|
| route | west | ab | road | 80 | US:I |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | direction | way:backward | route | ref | network |
|
||||||
|
| route | east | ab | road | 80 | US:I |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | ref |
|
||||||
|
| a,b | mainroad,mainroad | I 80 $west,I 80 $west |
|
||||||
|
| b,a | mainroad,mainroad | I 80 $east,I 80 $east |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Conflict between role and direction
|
||||||
|
Given the profile file "car" initialized with
|
||||||
|
"""
|
||||||
|
profile.cardinal_directions = true
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a----------------b
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name | highway | ref |
|
||||||
|
| ab | eastbound | motorway | I 80 |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | direction | way:east | route | ref | network |
|
||||||
|
| route | west | ab | road | 80 | US:I |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | ref |
|
||||||
|
| a,b | eastbound,eastbound | I 80,I 80 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Conflict between role and superrelation direction
|
||||||
|
Given the profile file "car" initialized with
|
||||||
|
"""
|
||||||
|
profile.cardinal_directions = true
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a----------------b
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name | highway | ref |
|
||||||
|
| ab | eastbound | motorway | I 80 |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:east | route | ref | network | name |
|
||||||
|
| route | ab | road | 80 | US:I | baserelation |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | direction | relation | route | ref | network | name |
|
||||||
|
| route | west | baserelation | road | 80 | US:I | superrelation |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | ref |
|
||||||
|
| a,b | eastbound,eastbound | I 80,I 80 |
|
||||||
|
|
||||||
|
Scenario: Conflict between role and superrelation role
|
||||||
|
Given the profile file "car" initialized with
|
||||||
|
"""
|
||||||
|
profile.cardinal_directions = true
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a----------------b
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name | highway | ref |
|
||||||
|
| ab | eastbound | motorway | I 80 |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:east | route | ref | network | name |
|
||||||
|
| route | ab | road | 80 | US:I | baserelation |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | relation:west | route | ref | network | name |
|
||||||
|
| route | baserelation | road | 80 | US:I | superrelation |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | ref |
|
||||||
|
| a,b | eastbound,eastbound | I 80,I 80 |
|
||||||
|
|
||||||
|
Scenario: Direction only available via superrelation role
|
||||||
|
Given the profile file "car" initialized with
|
||||||
|
"""
|
||||||
|
profile.cardinal_directions = true
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a----------------b
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name | highway | ref |
|
||||||
|
| ab | eastbound | motorway | I 80 |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:forward | route | ref | network | name |
|
||||||
|
| route | ab | road | 80 | US:I | baserelation |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | relation:east | route | ref | network | name |
|
||||||
|
| route | baserelation | road | 80 | US:I | superrelation |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | ref |
|
||||||
|
| a,b | eastbound,eastbound | I 80 $east,I 80 $east |
|
||||||
|
|
||||||
|
Scenario: Direction only available via superrelation direction
|
||||||
|
Given the profile file "car" initialized with
|
||||||
|
"""
|
||||||
|
profile.cardinal_directions = true
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a----------------b
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name | highway | ref |
|
||||||
|
| ab | eastbound | motorway | I 80 |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:forward | route | ref | network | name |
|
||||||
|
| route | ab | road | 80 | US:I | baserelation |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | direction | relation | route | ref | network | name |
|
||||||
|
| route | east | baserelation | road | 80 | US:I | superrelation |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | ref |
|
||||||
|
| a,b | eastbound,eastbound | I 80 $east,I 80 $east |
|
||||||
|
|
||||||
|
|
||||||
|
# Scenario: Three levels of indirection
|
||||||
|
# Given the node map
|
||||||
|
# """
|
||||||
|
# a----------------b
|
||||||
|
# """
|
||||||
|
#
|
||||||
|
# And the ways
|
||||||
|
# | nodes | name | highway | ref |
|
||||||
|
# | ab | eastbound | motorway | I 80 |
|
||||||
|
#
|
||||||
|
# And the relations
|
||||||
|
# | type | way:forward | route | ref | network | name |
|
||||||
|
# | route | ab | road | 80 | US:I | baserelation |
|
||||||
|
#
|
||||||
|
# And the relations
|
||||||
|
# | type | relation | route | ref | network | name |
|
||||||
|
# | route | baserelation | road | 80 | US:I | superrelation1 |
|
||||||
|
#
|
||||||
|
# And the relations
|
||||||
|
# | type | direction | relation | route | ref | network | name |
|
||||||
|
# | route | east | superrelation1 | road | 80 | US:I | superrelation2 |
|
||||||
|
#
|
||||||
|
# When I route I should get
|
||||||
|
# | waypoints | route | ref |
|
||||||
|
# | a,b | eastbound,eastbound | I 80 $east,I 80 $east |
|
||||||
@@ -5,9 +5,9 @@ Feature: Testbot - side bias
|
|||||||
Given the profile file "car" initialized with
|
Given the profile file "car" initialized with
|
||||||
"""
|
"""
|
||||||
profile.left_hand_driving = true
|
profile.left_hand_driving = true
|
||||||
profile.turn_bias = 1/1.075
|
profile.turn_bias = 1.075
|
||||||
"""
|
"""
|
||||||
Given the node map
|
And the node map
|
||||||
"""
|
"""
|
||||||
a b c
|
a b c
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ Feature: Testbot - side bias
|
|||||||
Given the profile file "car" initialized with
|
Given the profile file "car" initialized with
|
||||||
"""
|
"""
|
||||||
profile.left_hand_driving = true
|
profile.left_hand_driving = true
|
||||||
profile.turn_bias = 1.075
|
profile.turn_bias = 1 / 1.075
|
||||||
"""
|
"""
|
||||||
And the node map
|
And the node map
|
||||||
"""
|
"""
|
||||||
@@ -42,8 +42,77 @@ Feature: Testbot - side bias
|
|||||||
| bc |
|
| bc |
|
||||||
| bd |
|
| bd |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time | # |
|
||||||
|
| d | a | bd,ab,ab | 27s +-1 | should be inverse of left hand bias |
|
||||||
|
| d | c | bd,bc,bc | 24s +-1 | |
|
||||||
|
|
||||||
|
Scenario: Roundabout exit counting for left sided driving
|
||||||
|
Given the profile file "testbot" initialized with
|
||||||
|
"""
|
||||||
|
profile.left_hand_driving = true
|
||||||
|
"""
|
||||||
|
And a grid size of 10 meters
|
||||||
|
And the node map
|
||||||
|
"""
|
||||||
|
a
|
||||||
|
b
|
||||||
|
h g c d
|
||||||
|
e
|
||||||
|
f
|
||||||
|
"""
|
||||||
|
And the ways
|
||||||
|
| nodes | junction |
|
||||||
|
| ab | |
|
||||||
|
| cd | |
|
||||||
|
| ef | |
|
||||||
|
| gh | |
|
||||||
|
| bcegb | roundabout |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | turns |
|
||||||
|
| a,d | ab,cd,cd | depart,roundabout turn left exit-1,arrive |
|
||||||
|
| a,f | ab,ef,ef | depart,roundabout turn straight exit-2,arrive |
|
||||||
|
| a,h | ab,gh,gh | depart,roundabout turn right exit-3,arrive |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Left-hand bias via location-dependent tags
|
||||||
|
Given the profile "car"
|
||||||
|
And the node map
|
||||||
|
"""
|
||||||
|
a b c
|
||||||
|
|
||||||
|
d
|
||||||
|
"""
|
||||||
|
And the ways with locations
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
| bc |
|
||||||
|
| bd |
|
||||||
|
And the extract extra arguments "--location-dependent-data test/data/regions/null-island.geojson"
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| d | a | bd,ab,ab | 24s +-1 |
|
||||||
|
| d | c | bd,bc,bc | 27s +-1 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Left-hand bias via OSM tags
|
||||||
|
Given the profile "car"
|
||||||
|
And the node map
|
||||||
|
"""
|
||||||
|
a b c
|
||||||
|
|
||||||
|
d
|
||||||
|
"""
|
||||||
|
And the ways with locations
|
||||||
|
| nodes | driving_side |
|
||||||
|
| ab | right |
|
||||||
|
| bc | right |
|
||||||
|
| bd | right |
|
||||||
|
And the extract extra arguments "--location-dependent-data test/data/regions/null-island.geojson"
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | time |
|
| from | to | route | time |
|
||||||
| d | a | bd,ab,ab | 27s +-1 |
|
| d | a | bd,ab,ab | 27s +-1 |
|
||||||
# should be inverse of left hand bias
|
|
||||||
| d | c | bd,bc,bc | 24s +-1 |
|
| d | c | bd,bc,bc | 24s +-1 |
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
@routing @foot
|
||||||
|
Feature: Foot - Use distance weight
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given a grid size of 200 meters
|
||||||
|
|
||||||
|
Scenario: Foot - Check distance weight
|
||||||
|
Given the profile file
|
||||||
|
"""
|
||||||
|
local functions = require('foot')
|
||||||
|
functions.setup_testbot = functions.setup
|
||||||
|
|
||||||
|
functions.setup = function()
|
||||||
|
local profile = functions.setup_testbot()
|
||||||
|
profile.properties.weight_name = 'distance'
|
||||||
|
return profile
|
||||||
|
end
|
||||||
|
|
||||||
|
return functions
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a-b-c
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway |
|
||||||
|
| abc | residential |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | weight | time | distance |
|
||||||
|
| a | b | abc,abc | 200 | 144s | 200m +-1 |
|
||||||
|
| a | c | abc,abc | 400 | 288s | 400m +-1 |
|
||||||
@@ -147,3 +147,32 @@ Feature: Collapse
|
|||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| a,d | road,left,left | depart,turn left,arrive |
|
| a,d | road,left,left | depart,turn left,arrive |
|
||||||
| a,e | road,right,right | depart,turn right,arrive |
|
| a,e | road,right,right | depart,turn right,arrive |
|
||||||
|
|
||||||
|
# https://www.openstreetmap.org/#map=18/53.89755/27.54306
|
||||||
|
Scenario: Wide turn into invalid u-turn
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
g
|
||||||
|
|
|
||||||
|
|
|
||||||
|
f - - - - e
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
h - - d
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
a - - - - b - - - - c
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | name |
|
||||||
|
| abc | secondary | road |
|
||||||
|
| bdfg | service | |
|
||||||
|
| hd | service | |
|
||||||
|
| fe | service | |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | turns |
|
||||||
|
| c,e | road,,, | depart,turn right,turn right,arrive |
|
||||||
|
|||||||
@@ -22,6 +22,40 @@ Feature: Continue Instructions
|
|||||||
| a,c | abc,abc,abc | depart,continue left,arrive |
|
| a,c | abc,abc,abc | depart,continue left,arrive |
|
||||||
| a,d | abc,bd,bd | depart,turn straight,arrive |
|
| a,d | abc,bd,bd | depart,turn straight,arrive |
|
||||||
|
|
||||||
|
Scenario: Road turning left, Suffix changes
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
c
|
||||||
|
a - b-d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | name |
|
||||||
|
| ab | primary | North Capitol Northeast |
|
||||||
|
| bc | primary | North Capitol Northwest |
|
||||||
|
| bd | primary | some random street |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | turns |
|
||||||
|
| a,c | North Capitol Northeast,North Capitol Northwest,North Capitol Northwest | depart,continue left,arrive |
|
||||||
|
|
||||||
|
Scenario: Road turning left, Suffix changes, no-spaces
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
c
|
||||||
|
a - b-d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | name |
|
||||||
|
| ab | primary | North CapitolNortheast |
|
||||||
|
| bc | primary | North CapitolNorthwest |
|
||||||
|
| bd | primary | some random street |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | turns |
|
||||||
|
| a,c | North CapitolNortheast,North CapitolNorthwest,North CapitolNorthwest | depart,continue left,arrive |
|
||||||
|
|
||||||
Scenario: Road turning left and straight
|
Scenario: Road turning left and straight
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -995,4 +995,59 @@ Feature: Slipways and Dedicated Turn Lanes
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns | locations |
|
| waypoints | route | turns | locations |
|
||||||
| s,f | sabc,dbef,dbef | depart,turn right,arrive | s,a,f |
|
| s,f | sabc,dbef,dbef | depart,turn right,arrive | s,a,f |
|
||||||
|
|
||||||
|
|
||||||
|
@sliproads
|
||||||
|
Scenario: Sliproad from link via link to primary
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
d
|
||||||
|
.
|
||||||
|
s . a . b
|
||||||
|
` .
|
||||||
|
` .
|
||||||
|
'.
|
||||||
|
c
|
||||||
|
.
|
||||||
|
f
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | name | oneway |
|
||||||
|
| sab | primary_link | sab | |
|
||||||
|
| dbcf | primary | dbcf | |
|
||||||
|
| ac | primary_link | ae | yes |
|
||||||
|
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | turns | locations |
|
||||||
|
| s,f | sab,dbcf,dbcf | depart,turn right,arrive | s,a,f |
|
||||||
|
|
||||||
|
|
||||||
|
@sliproads
|
||||||
|
Scenario: Sliproad with a single intersection in a cross-road
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
d
|
||||||
|
.
|
||||||
|
s . a . b
|
||||||
|
` .
|
||||||
|
' c . g
|
||||||
|
..
|
||||||
|
e
|
||||||
|
.
|
||||||
|
f
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | name | oneway |
|
||||||
|
| sab | primary | sab | |
|
||||||
|
| dbcef | primary | dbcef | |
|
||||||
|
| ae | primary_link | sab | yes |
|
||||||
|
| cg | primary | cg | |
|
||||||
|
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | turns | locations |
|
||||||
|
| s,f | sab,dbcef,dbcef | depart,turn right,arrive | s,a,f |
|
||||||
|
|||||||
@@ -523,3 +523,42 @@ Feature: Merge Segregated Roads
|
|||||||
| a,d | horiz,horiz | true:90,false:0 true:60 true:90 true:180 false:270,false:0 true:90 false:180 false:270 true:300;true:270 |
|
| a,d | horiz,horiz | true:90,false:0 true:60 true:90 true:180 false:270,false:0 true:90 false:180 false:270 true:300;true:270 |
|
||||||
| j,h | vert,horiz,horiz | true:0;true:0 true:90 false:180 false:270 true:300,false:60 false:120 false:240 true:300,false:0 false:90 false:120 true:180 true:270;true:90 |
|
| j,h | vert,horiz,horiz | true:0;true:0 true:90 false:180 false:270 true:300,false:60 false:120 false:240 true:300,false:0 false:90 false:120 true:180 true:270;true:90 |
|
||||||
| j,l | vert,vert | true:0,true:0 true:90 false:180 false:270 true:300,true:0 false:90 false:180 true:240 false:270;true:180 |
|
| j,l | vert,vert | true:0,true:0 true:90 false:180 false:270 true:300,true:0 false:90 false:180 true:240 false:270;true:180 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Square Area - Don't merge almost circular roads
|
||||||
|
Given a grid size of 2 meters
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
i
|
||||||
|
/
|
||||||
|
/
|
||||||
|
/
|
||||||
|
b---- g .
|
||||||
|
/ p .
|
||||||
|
a / \ f
|
||||||
|
\ / o /
|
||||||
|
\ / \ /
|
||||||
|
c n /
|
||||||
|
/ \ \/
|
||||||
|
/ k e
|
||||||
|
/ \ /
|
||||||
|
h l /
|
||||||
|
\ /
|
||||||
|
m . d
|
||||||
|
/
|
||||||
|
j
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name | oneway |
|
||||||
|
| ac | Halenseestraße | yes |
|
||||||
|
| gb | Halenseestraße | yes |
|
||||||
|
| cklmdenopgc | Rathenauplatz | yes |
|
||||||
|
| ig | Kurfürstendamm | yes |
|
||||||
|
| ef | Kurfürstendamm | yes |
|
||||||
|
| ch | Hubertusallee | yes |
|
||||||
|
| jd | Hubertusallee | yes |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | turns |
|
||||||
|
| i,h | Kurfürstendamm,Hubertusallee,Hubertusallee | depart,turn straight,arrive |
|
||||||
|
|||||||
@@ -274,8 +274,8 @@ Feature: New-Name Instructions
|
|||||||
| bc | Central Expressway | US 75 | motorway |
|
| bc | Central Expressway | US 75 | motorway |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| a,c | North Central Expressway,Central Expressway,Central Expressway | depart,new name straight,arrive |
|
| a,c | North Central Expressway,Central Expressway | depart,arrive |
|
||||||
|
|
||||||
Scenario: Prefix Change
|
Scenario: Prefix Change
|
||||||
Given the node map
|
Given the node map
|
||||||
@@ -289,8 +289,8 @@ Feature: New-Name Instructions
|
|||||||
| cb | Central Expressway | US 75 | motorway |
|
| cb | Central Expressway | US 75 | motorway |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| c,a | Central Expressway,North Central Expressway,North Central Expressway | depart,new name straight,arrive |
|
| c,a | Central Expressway,North Central Expressway | depart,arrive |
|
||||||
|
|
||||||
Scenario: No Name, Same Reference
|
Scenario: No Name, Same Reference
|
||||||
Given the node map
|
Given the node map
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Feature: Basic Roundabout
|
|||||||
Given a grid size of 10 meters
|
Given a grid size of 10 meters
|
||||||
Given the profile file "car" initialized with
|
Given the profile file "car" initialized with
|
||||||
"""
|
"""
|
||||||
profile.properties.left_hand_driving = true
|
profile.left_hand_driving = true
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Scenario: Roundabout exit counting for left sided driving
|
Scenario: Roundabout exit counting for left sided driving
|
||||||
|
|||||||
@@ -829,16 +829,16 @@ Feature: Basic Roundabout
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | highway | junction | oneway | # |
|
| nodes | highway | junction | oneway | # |
|
||||||
| abcda | tertiary | roundabout | | circle |
|
| abcda | tertiary | roundabout | | circle |
|
||||||
| ebds | tertiary | | | road |
|
| ebds | tertiary | | | road |
|
||||||
| cm | tertiary | | | |
|
| cm | tertiary | | | |
|
||||||
| ds | tertiary | | | road |
|
| ds | tertiary | | | road |
|
||||||
| rstur | tertiary | roundabout | | circle2 |
|
| rstur | tertiary | roundabout | | circle2 |
|
||||||
| ufghl | tertiary | | | road |
|
| ufghl | tertiary | | | road |
|
||||||
| tv | tertiary | | | |
|
| tv | tertiary | | | |
|
||||||
| gi | tertiary | | yes | sliproad |
|
| gi | tertiary_link | | yes | sliproad |
|
||||||
| jhik | tertiary | | | crossroad |
|
| jhik | tertiary | | | crossroad |
|
||||||
|
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
|
|||||||
@@ -280,6 +280,35 @@ Feature: Simple Turns
|
|||||||
| a,d | road,road | depart,arrive |
|
| a,d | road,road | depart,arrive |
|
||||||
| e,a | road,road | depart,arrive |
|
| e,a | road,road | depart,arrive |
|
||||||
|
|
||||||
|
Scenario: Splitting Road with many lanes; same as above makes sure len(turn:lanes) work as expected
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
f - - - - - - - - - - - - - - - - - - - - e
|
||||||
|
'
|
||||||
|
'
|
||||||
|
'
|
||||||
|
'
|
||||||
|
'
|
||||||
|
a - - - - - b
|
||||||
|
'
|
||||||
|
'
|
||||||
|
'
|
||||||
|
'
|
||||||
|
'
|
||||||
|
c - - - - - - - - - - - - - - - - - - - - d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | name | turn:lanes | oneway |
|
||||||
|
| ab | primary | road | left\|left\|right\|right | no |
|
||||||
|
| bcd | primary | road | through\|through | yes |
|
||||||
|
| efb | primary | road | through\|through | yes |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | turns |
|
||||||
|
| a,d | road,road | depart,arrive |
|
||||||
|
| e,a | road,road | depart,arrive |
|
||||||
|
|
||||||
@todo
|
@todo
|
||||||
# currently the intersections don't match up do to the `merging` process.
|
# currently the intersections don't match up do to the `merging` process.
|
||||||
# The intermediate intersection is technically no-turn at all, since the road continues.
|
# The intermediate intersection is technically no-turn at all, since the road continues.
|
||||||
|
|||||||
@@ -1349,3 +1349,24 @@ Feature: Simple Turns
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| a,d | ab,dc,dc | depart,turn left,arrive |
|
| a,d | ab,dc,dc | depart,turn left,arrive |
|
||||||
|
|
||||||
|
|
||||||
|
# https://www.openstreetmap.org/node/1332083066
|
||||||
|
Scenario: Turns ordering must respect initial bearings
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a . be .
|
||||||
|
\ c.
|
||||||
|
d/ .f . g
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | oneway |
|
||||||
|
| ab | primary | yes |
|
||||||
|
| bcd | primary | yes |
|
||||||
|
| befg | primary | yes |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | turns |
|
||||||
|
| a,d | ab,bcd,bcd | depart,fork slight right,arrive |
|
||||||
|
| a,g | ab,befg,befg | depart,fork slight left,arrive |
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
hashOfFile: (path, cb) => {
|
hashOfFile: (path, additional_content, cb) => {
|
||||||
fs.readFile(path, (err, result) => {
|
fs.readFile(path, (err, result) => {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
let checksum = crypto.createHash('md5');
|
let checksum = crypto.createHash('md5');
|
||||||
checksum.update(result);
|
checksum.update(result + (additional_content || "") );
|
||||||
cb(null, checksum.digest('hex'));
|
cb(null, checksum.digest('hex'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-6
@@ -61,8 +61,13 @@ class DB {
|
|||||||
});
|
});
|
||||||
|
|
||||||
w.nodes.forEach((k) => {
|
w.nodes.forEach((k) => {
|
||||||
way.ele('nd')
|
|
||||||
|
let nd = way.ele('nd')
|
||||||
.att('ref', k.id);
|
.att('ref', k.id);
|
||||||
|
if (w.add_locations) {
|
||||||
|
nd.att('lon', k.lon);
|
||||||
|
nd.att('lat', k.lat);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for (var k in w.tags) {
|
for (var k in w.tags) {
|
||||||
@@ -81,11 +86,12 @@ class DB {
|
|||||||
});
|
});
|
||||||
|
|
||||||
r.members.forEach((m) => {
|
r.members.forEach((m) => {
|
||||||
relation.ele('member', {
|
var d = {
|
||||||
type: m.type,
|
type: m.type,
|
||||||
ref: m.id,
|
ref: m.id
|
||||||
role: m.role
|
};
|
||||||
});
|
if (m.role) d.role = m.role;
|
||||||
|
relation.ele('member', d);
|
||||||
});
|
});
|
||||||
|
|
||||||
for (var k in r.tags) {
|
for (var k in r.tags) {
|
||||||
@@ -120,13 +126,14 @@ class Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Way {
|
class Way {
|
||||||
constructor (id, OSM_USER, OSM_TIMESTAMP, OSM_UID) {
|
constructor (id, OSM_USER, OSM_TIMESTAMP, OSM_UID, add_locations) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.OSM_USER = OSM_USER;
|
this.OSM_USER = OSM_USER;
|
||||||
this.OSM_TIMESTAMP = OSM_TIMESTAMP;
|
this.OSM_TIMESTAMP = OSM_TIMESTAMP;
|
||||||
this.OSM_UID = OSM_UID;
|
this.OSM_UID = OSM_UID;
|
||||||
this.tags = {};
|
this.tags = {};
|
||||||
this.nodes = [];
|
this.nodes = [];
|
||||||
|
this.add_locations = add_locations;
|
||||||
}
|
}
|
||||||
|
|
||||||
addNode (node) {
|
addNode (node) {
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ Feature: osrm-contract command line options: help
|
|||||||
And stdout should contain "Configuration:"
|
And stdout should contain "Configuration:"
|
||||||
And stdout should contain "--threads"
|
And stdout should contain "--threads"
|
||||||
And stdout should contain "--core"
|
And stdout should contain "--core"
|
||||||
And stdout should contain "--level-cache"
|
|
||||||
And stdout should contain "--segment-speed-file"
|
And stdout should contain "--segment-speed-file"
|
||||||
And it should exit with an error
|
And it should exit with an error
|
||||||
|
|
||||||
@@ -27,7 +26,6 @@ Feature: osrm-contract command line options: help
|
|||||||
And stdout should contain "Configuration:"
|
And stdout should contain "Configuration:"
|
||||||
And stdout should contain "--threads"
|
And stdout should contain "--threads"
|
||||||
And stdout should contain "--core"
|
And stdout should contain "--core"
|
||||||
And stdout should contain "--level-cache"
|
|
||||||
And stdout should contain "--segment-speed-file"
|
And stdout should contain "--segment-speed-file"
|
||||||
And it should exit successfully
|
And it should exit successfully
|
||||||
|
|
||||||
@@ -42,6 +40,5 @@ Feature: osrm-contract command line options: help
|
|||||||
And stdout should contain "Configuration:"
|
And stdout should contain "Configuration:"
|
||||||
And stdout should contain "--threads"
|
And stdout should contain "--threads"
|
||||||
And stdout should contain "--core"
|
And stdout should contain "--core"
|
||||||
And stdout should contain "--level-cache"
|
|
||||||
And stdout should contain "--segment-speed-file"
|
And stdout should contain "--segment-speed-file"
|
||||||
And it should exit successfully
|
And it should exit successfully
|
||||||
|
|||||||
@@ -1,8 +1,22 @@
|
|||||||
@extract
|
@extract
|
||||||
Feature: osrm-extract lua ways:get_nodes()
|
Feature: osrm-extract lua ways:get_nodes()
|
||||||
|
|
||||||
Background:
|
Scenario: osrm-extract - Passing base file
|
||||||
Given the node map
|
Given the profile file
|
||||||
|
"""
|
||||||
|
functions = require('testbot')
|
||||||
|
|
||||||
|
functions.process_way = function(profile, way, result)
|
||||||
|
for _, node in ipairs(way:get_nodes()) do
|
||||||
|
print('node id ' .. node:id())
|
||||||
|
end
|
||||||
|
result.forward_mode = mode.driving
|
||||||
|
result.forward_speed = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
return functions
|
||||||
|
"""
|
||||||
|
And the node map
|
||||||
"""
|
"""
|
||||||
a b
|
a b
|
||||||
"""
|
"""
|
||||||
@@ -11,23 +25,127 @@ Feature: osrm-extract lua ways:get_nodes()
|
|||||||
| ab |
|
| ab |
|
||||||
And the data has been saved to disk
|
And the data has been saved to disk
|
||||||
|
|
||||||
Scenario: osrm-extract - Passing base file
|
|
||||||
Given the profile file
|
|
||||||
"""
|
|
||||||
functions = require('testbot')
|
|
||||||
|
|
||||||
function way_function(profile, way, result)
|
|
||||||
for _, node in ipairs(way:get_nodes()) do
|
|
||||||
print('node id ' .. node:id())
|
|
||||||
end
|
|
||||||
result.forward_mode = mode.driving
|
|
||||||
result.forward_speed = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
functions.process_way = way_function
|
|
||||||
return functions
|
|
||||||
"""
|
|
||||||
When I run "osrm-extract --profile {profile_file} {osm_file}"
|
When I run "osrm-extract --profile {profile_file} {osm_file}"
|
||||||
Then it should exit successfully
|
Then it should exit successfully
|
||||||
And stdout should contain "node id 1"
|
And stdout should contain "node id 1"
|
||||||
And stdout should contain "node id 2"
|
And stdout should contain "node id 2"
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: osrm-extract location-dependent data without add-locations-to-ways preprocessing and node locations cache
|
||||||
|
Given the profile file
|
||||||
|
"""
|
||||||
|
functions = require('testbot')
|
||||||
|
|
||||||
|
functions.process_way = function(profile, way, result, relations)
|
||||||
|
print(way:get_location_tag('driving_side'))
|
||||||
|
end
|
||||||
|
|
||||||
|
return functions
|
||||||
|
"""
|
||||||
|
And the node map
|
||||||
|
"""
|
||||||
|
a b
|
||||||
|
"""
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
And the data has been saved to disk
|
||||||
|
|
||||||
|
When I try to run "osrm-extract --profile {profile_file} {osm_file} --location-dependent-data test/data/regions/null-island.geojson --disable-location-cache"
|
||||||
|
Then it should exit with an error
|
||||||
|
And stderr should contain "invalid location"
|
||||||
|
|
||||||
|
Scenario: osrm-extract location-dependent data
|
||||||
|
Given the profile file
|
||||||
|
"""
|
||||||
|
functions = require('testbot')
|
||||||
|
|
||||||
|
functions.process_way = function(profile, way, result, relations)
|
||||||
|
for _, key in ipairs({'answer', 'boolean', 'object', 'array'}) do
|
||||||
|
print (key .. ' ' .. tostring(way:get_location_tag(key)))
|
||||||
|
end
|
||||||
|
result.forward_mode = mode.driving
|
||||||
|
result.forward_speed = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
return functions
|
||||||
|
"""
|
||||||
|
And the node map
|
||||||
|
"""
|
||||||
|
a b
|
||||||
|
"""
|
||||||
|
And the ways with locations
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
And the data has been saved to disk
|
||||||
|
|
||||||
|
When I run "osrm-extract --profile {profile_file} {osm_file} --location-dependent-data test/data/regions/null-island.geojson --disable-location-cache"
|
||||||
|
Then it should exit successfully
|
||||||
|
And stdout should contain "answer 42"
|
||||||
|
And stdout should contain "boolean true"
|
||||||
|
And stdout should contain "array nil"
|
||||||
|
And stdout should contain "object nil"
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: osrm-extract location-dependent data with multi-polygons
|
||||||
|
Given the profile file
|
||||||
|
"""
|
||||||
|
functions = require('testbot')
|
||||||
|
|
||||||
|
functions.process_way = function(profile, way, result, relations)
|
||||||
|
print('ISO3166-1 ' .. (way:get_location_tag('ISO3166-1') or 'none'))
|
||||||
|
print('answer ' .. (way:get_location_tag('answer') or 'none'))
|
||||||
|
result.forward_mode = mode.driving
|
||||||
|
result.forward_speed = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
return functions
|
||||||
|
"""
|
||||||
|
And the node locations
|
||||||
|
| node | lat | lon | id |
|
||||||
|
| a | 22.4903670 | 113.9455227 | 1 |
|
||||||
|
| b | 22.4901701 | 113.9455899 | 2 |
|
||||||
|
| c | 22.4901852 | 113.9458608 | 3 |
|
||||||
|
| d | 22.4904033 | 113.9456999 | 4 |
|
||||||
|
| e | 1.1 | 1 | 5 |
|
||||||
|
| f | 1.2 | 1 | 6 |
|
||||||
|
And the ways with locations
|
||||||
|
| nodes | # |
|
||||||
|
| ab | Hong Kong |
|
||||||
|
| cd | China Mainland |
|
||||||
|
| ef | Null Island |
|
||||||
|
And the data has been saved to disk
|
||||||
|
|
||||||
|
When I run "osrm-extract --profile {profile_file} {osm_file} --location-dependent-data test/data/regions/null-island.geojson --location-dependent-data test/data/regions/hong-kong.geojson --disable-location-cache"
|
||||||
|
Then it should exit successfully
|
||||||
|
And stdout should not contain "1 GeoJSON polygon"
|
||||||
|
And stdout should contain "2 GeoJSON polygons"
|
||||||
|
And stdout should contain "ISO3166-1 HK"
|
||||||
|
And stdout should contain "ISO3166-1 none"
|
||||||
|
And stdout should contain "answer 42"
|
||||||
|
|
||||||
|
Scenario: osrm-extract location-dependent data via locations cache
|
||||||
|
Given the profile file
|
||||||
|
"""
|
||||||
|
functions = require('testbot')
|
||||||
|
|
||||||
|
functions.process_way = function(profile, way, result, relations)
|
||||||
|
print ('answer ' .. tostring(way:get_location_tag('answer')))
|
||||||
|
result.forward_mode = mode.driving
|
||||||
|
result.forward_speed = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
return functions
|
||||||
|
"""
|
||||||
|
And the node map
|
||||||
|
"""
|
||||||
|
a b
|
||||||
|
"""
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
And the data has been saved to disk
|
||||||
|
|
||||||
|
When I run "osrm-extract --profile {profile_file} {osm_file} --location-dependent-data test/data/regions/null-island.geojson"
|
||||||
|
Then it should exit successfully
|
||||||
|
And stdout should contain "answer 42"
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
@extract
|
||||||
|
Feature: osrm-extract must be silent with NONE
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a b
|
||||||
|
"""
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
And the data has been saved to disk
|
||||||
|
|
||||||
|
Scenario: osrm-extract - Passing base file with verbosity NONE
|
||||||
|
Given the profile file
|
||||||
|
"""
|
||||||
|
functions = require('testbot')
|
||||||
|
|
||||||
|
function way_function(profile, way, result)
|
||||||
|
result.forward_mode = mode.driving
|
||||||
|
result.forward_speed = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
functions.process_way = way_function
|
||||||
|
return functions
|
||||||
|
"""
|
||||||
|
When I run "osrm-extract --profile {profile_file} {osm_file} --verbosity NONE"
|
||||||
|
Then it should exit successfully
|
||||||
|
And stdout should not contain "[info]"
|
||||||
|
And stdout should not contain "[error]"
|
||||||
|
And stdout should not contain "10%"
|
||||||
|
And stderr should be empty
|
||||||
@@ -24,7 +24,7 @@ Feature: Invalid profile API versions
|
|||||||
Scenario: Profile API version too high
|
Scenario: Profile API version too high
|
||||||
Given the profile file
|
Given the profile file
|
||||||
"""
|
"""
|
||||||
api_version = 3
|
api_version = 4
|
||||||
"""
|
"""
|
||||||
And the node map
|
And the node map
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
Feature: Profile API version 3
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given a grid size of 100 meters
|
||||||
|
|
||||||
|
Scenario: Basic profile function calls and property values
|
||||||
|
Given the profile file
|
||||||
|
"""
|
||||||
|
api_version = 3
|
||||||
|
|
||||||
|
Set = require('lib/set')
|
||||||
|
Sequence = require('lib/sequence')
|
||||||
|
Handlers = require("lib/way_handlers")
|
||||||
|
find_access_tag = require("lib/access").find_access_tag
|
||||||
|
limit = require("lib/maxspeed").limit
|
||||||
|
|
||||||
|
function setup()
|
||||||
|
return {
|
||||||
|
properties = {
|
||||||
|
max_speed_for_map_matching = 180/3.6,
|
||||||
|
use_turn_restrictions = true,
|
||||||
|
continue_straight_at_waypoint = true,
|
||||||
|
weight_name = 'test_version2',
|
||||||
|
weight_precision = 2
|
||||||
|
},
|
||||||
|
relation_types = Sequence { "route" }
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function process_node(profile, node, result, relations)
|
||||||
|
print ('process_node ' .. node:id())
|
||||||
|
end
|
||||||
|
|
||||||
|
function process_way(profile, way, result, relations)
|
||||||
|
result.name = way:get_value_by_key('name')
|
||||||
|
result.weight = 10
|
||||||
|
result.forward_mode = mode.driving
|
||||||
|
result.backward_mode = mode.driving
|
||||||
|
result.forward_speed = 36
|
||||||
|
result.backward_speed = 36
|
||||||
|
|
||||||
|
local rel_id_list = relations:get_relations(way)
|
||||||
|
for i, rel_id in ipairs(rel_id_list) do
|
||||||
|
local rel = relations:relation(rel_id)
|
||||||
|
local role = rel:get_role(way)
|
||||||
|
print('role_' .. role)
|
||||||
|
end
|
||||||
|
print ('process_way ' .. way:id() .. ' ' .. result.name)
|
||||||
|
end
|
||||||
|
|
||||||
|
function process_turn (profile, turn)
|
||||||
|
print('process_turn', turn.angle, turn.turn_type, turn.direction_modifier, turn.has_traffic_light)
|
||||||
|
turn.weight = turn.angle == 0 and 0 or 4.2
|
||||||
|
turn.duration = turn.weight
|
||||||
|
end
|
||||||
|
|
||||||
|
function process_segment (profile, segment)
|
||||||
|
print ('process_segment ' .. segment.source.lon .. ' ' .. segment.source.lat)
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
setup = setup,
|
||||||
|
process_node = process_node,
|
||||||
|
process_way = process_way,
|
||||||
|
process_relation = process_relation,
|
||||||
|
process_segment = process_segment,
|
||||||
|
process_turn = process_turn
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
And the node map
|
||||||
|
"""
|
||||||
|
a
|
||||||
|
bcd
|
||||||
|
e
|
||||||
|
"""
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ac |
|
||||||
|
| cb |
|
||||||
|
| cd |
|
||||||
|
| ce |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:north | route |
|
||||||
|
| route | ac | road |
|
||||||
|
|
||||||
|
And the data has been saved to disk
|
||||||
|
|
||||||
|
When I run "osrm-extract --profile {profile_file} {osm_file}"
|
||||||
|
Then it should exit successfully
|
||||||
|
And stdout should contain "process_node"
|
||||||
|
And stdout should contain "process_way"
|
||||||
|
And stdout should contain "process_turn"
|
||||||
|
And stdout should contain "process_segment"
|
||||||
|
And stdout should contain "role_north"
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| a | b | ac,cb,cb | 19.2s |
|
||||||
|
| a | d | ac,cd,cd | 19.2s |
|
||||||
|
| a | e | ac,ce | 20s |
|
||||||
@@ -8,7 +8,7 @@ var OSM = require('../lib/osm');
|
|||||||
|
|
||||||
module.exports = function () {
|
module.exports = function () {
|
||||||
this.Given(/^the profile "([^"]*)"$/, (profile, callback) => {
|
this.Given(/^the profile "([^"]*)"$/, (profile, callback) => {
|
||||||
this.profile = profile;
|
this.profile = this.OSRM_PROFILE || profile;
|
||||||
this.profileFile = path.join(this.PROFILES_PATH, this.profile + '.lua');
|
this.profileFile = path.join(this.PROFILES_PATH, this.profile + '.lua');
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
@@ -129,13 +129,13 @@ module.exports = function () {
|
|||||||
q.awaitAll(callback);
|
q.awaitAll(callback);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.Given(/^the ways$/, (table, callback) => {
|
this.Given(/^the ways( with locations)?$/, (add_locations, table, callback) => {
|
||||||
if (this.osm_str) throw new Error('*** Map data already defined - did you pass an input file in this scenario?');
|
if (this.osm_str) throw new Error('*** Map data already defined - did you pass an input file in this scenario?');
|
||||||
|
|
||||||
let q = d3.queue();
|
let q = d3.queue();
|
||||||
|
|
||||||
let addWay = (row, cb) => {
|
let addWay = (row, cb) => {
|
||||||
let way = new OSM.Way(this.makeOSMId(), this.OSM_USER, this.OSM_TIMESTAMP, this.OSM_UID);
|
let way = new OSM.Way(this.makeOSMId(), this.OSM_USER, this.OSM_TIMESTAMP, this.OSM_UID, !!add_locations);
|
||||||
|
|
||||||
let nodes = row.nodes;
|
let nodes = row.nodes;
|
||||||
if (this.nameWayHash.nodes) throw new Error(util.format('*** duplicate way %s', nodes));
|
if (this.nameWayHash.nodes) throw new Error(util.format('*** duplicate way %s', nodes));
|
||||||
@@ -188,9 +188,12 @@ module.exports = function () {
|
|||||||
let addRelation = (row, cb) => {
|
let addRelation = (row, cb) => {
|
||||||
let relation = new OSM.Relation(this.makeOSMId(), this.OSM_USER, this.OSM_TIMESTAMP, this.OSM_UID);
|
let relation = new OSM.Relation(this.makeOSMId(), this.OSM_USER, this.OSM_TIMESTAMP, this.OSM_UID);
|
||||||
|
|
||||||
|
|
||||||
|
var name = null;
|
||||||
for (let key in row) {
|
for (let key in row) {
|
||||||
let isNode = key.match(/^node:(.*)/),
|
let isNode = key.match(/^node:?(.*)/),
|
||||||
isWay = key.match(/^way:(.*)/),
|
isWay = key.match(/^way:?(.*)/),
|
||||||
|
isRelation = key.match(/^relation:?(.*)/),
|
||||||
isColonSeparated = key.match(/^(.*):(.*)/);
|
isColonSeparated = key.match(/^(.*):(.*)/);
|
||||||
if (isNode) {
|
if (isNode) {
|
||||||
row[key].split(',').map(function(v) { return v.trim(); }).forEach((nodeName) => {
|
row[key].split(',').map(function(v) { return v.trim(); }).forEach((nodeName) => {
|
||||||
@@ -205,14 +208,26 @@ module.exports = function () {
|
|||||||
if (!way) throw new Error(util.format('*** unknown relation way member "%s"', wayName));
|
if (!way) throw new Error(util.format('*** unknown relation way member "%s"', wayName));
|
||||||
relation.addMember('way', way.id, isWay[1]);
|
relation.addMember('way', way.id, isWay[1]);
|
||||||
});
|
});
|
||||||
|
} else if (isRelation) {
|
||||||
|
row[key].split(',').map(function(v) { return v.trim(); }).forEach((relName) => {
|
||||||
|
let otherrelation = this.findRelationByName(relName);
|
||||||
|
if (!otherrelation) throw new Error(util.format('*** unknown relation relation member "%s"', relName));
|
||||||
|
relation.addMember('relation', otherrelation.id, isRelation[1]);
|
||||||
|
});
|
||||||
} else if (isColonSeparated && isColonSeparated[1] !== 'restriction') {
|
} else if (isColonSeparated && isColonSeparated[1] !== 'restriction') {
|
||||||
throw new Error(util.format('*** unknown relation member type "%s:%s", must be either "node" or "way"', isColonSeparated[1], isColonSeparated[2]));
|
throw new Error(util.format('*** unknown relation member type "%s:%s", must be either "node" or "way"', isColonSeparated[1], isColonSeparated[2]));
|
||||||
} else {
|
} else {
|
||||||
relation.addTag(key, row[key]);
|
relation.addTag(key, row[key]);
|
||||||
|
if (key.match(/name/)) name = row[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
relation.uid = this.OSM_UID;
|
relation.uid = this.OSM_UID;
|
||||||
|
|
||||||
|
|
||||||
|
if (name) {
|
||||||
|
this.nameRelationHash[name] = relation;
|
||||||
|
}
|
||||||
|
|
||||||
this.OSMDB.addRelation(relation);
|
this.OSMDB.addRelation(relation);
|
||||||
|
|
||||||
cb();
|
cb();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ module.exports = function () {
|
|||||||
var waypoints = [],
|
var waypoints = [],
|
||||||
columnHeaders = tableRows[0].slice(1),
|
columnHeaders = tableRows[0].slice(1),
|
||||||
rowHeaders = tableRows.map((h) => h[0]).slice(1),
|
rowHeaders = tableRows.map((h) => h[0]).slice(1),
|
||||||
symmetric = columnHeaders.every((ele, i) => ele === rowHeaders[i]);
|
symmetric = columnHeaders.length == rowHeaders.length && columnHeaders.every((ele, i) => ele === rowHeaders[i]);
|
||||||
|
|
||||||
if (symmetric) {
|
if (symmetric) {
|
||||||
columnHeaders.forEach((nodeName) => {
|
columnHeaders.forEach((nodeName) => {
|
||||||
|
|||||||
@@ -54,12 +54,14 @@ module.exports = function () {
|
|||||||
|
|
||||||
this.Then(/^stdout should( not)? contain "(.*?)"$/, (not, str) => {
|
this.Then(/^stdout should( not)? contain "(.*?)"$/, (not, str) => {
|
||||||
const contains = this.stdout.indexOf(str) > -1;
|
const contains = this.stdout.indexOf(str) > -1;
|
||||||
assert.ok(typeof not === 'undefined' ? contains : !contains);
|
assert.ok(typeof not === 'undefined' ? contains : !contains,
|
||||||
|
'stdout ' + (typeof not === 'undefined' ? 'does not contain' : 'contains') + ' "' + str + '"');
|
||||||
});
|
});
|
||||||
|
|
||||||
this.Then(/^stderr should( not)? contain "(.*?)"$/, (not, str) => {
|
this.Then(/^stderr should( not)? contain "(.*?)"$/, (not, str) => {
|
||||||
const contains = this.stderr.indexOf(str) > -1;
|
const contains = this.stderr.indexOf(str) > -1;
|
||||||
assert.ok(typeof not === 'undefined' ? contains : !contains);
|
assert.ok(typeof not === 'undefined' ? contains : !contains,
|
||||||
|
'stderr ' + (typeof not === 'undefined' ? 'does not contain' : 'contains') + ' "' + str + '"');
|
||||||
});
|
});
|
||||||
|
|
||||||
this.Then(/^stdout should contain \/(.*)\/$/, (regexStr) => {
|
this.Then(/^stdout should contain \/(.*)\/$/, (regexStr) => {
|
||||||
|
|||||||
@@ -28,13 +28,16 @@ module.exports = function() {
|
|||||||
let uri = feature.getUri();
|
let uri = feature.getUri();
|
||||||
|
|
||||||
// setup cache for feature data
|
// setup cache for feature data
|
||||||
hash.hashOfFile(uri, (err, hash) => {
|
// if OSRM_PROFILE is set to force a specific profile, then
|
||||||
|
// include the profile name in the hash of the profile file
|
||||||
|
hash.hashOfFile(uri, this.OSRM_PROFILE, (err, hash) => {
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
|
|
||||||
// shorten uri to be realtive to 'features/'
|
// shorten uri to be realtive to 'features/'
|
||||||
let featurePath = path.relative(path.resolve('./features'), uri);
|
let featurePath = path.relative(path.resolve('./features'), uri);
|
||||||
// bicycle/bollards/{HASH}/
|
// bicycle/bollards/{HASH}/
|
||||||
let featureID = path.join(featurePath, hash);
|
let featureID = path.join(featurePath, hash);
|
||||||
|
|
||||||
let featureCacheDirectory = this.getFeatureCacheDirectory(featureID);
|
let featureCacheDirectory = this.getFeatureCacheDirectory(featureID);
|
||||||
let featureProcessedCacheDirectory = this.getFeatureProcessedCacheDirectory(featureCacheDirectory, this.osrmHash);
|
let featureProcessedCacheDirectory = this.getFeatureProcessedCacheDirectory(featureCacheDirectory, this.osrmHash);
|
||||||
this.featureIDs[uri] = featureID;
|
this.featureIDs[uri] = featureID;
|
||||||
|
|||||||
@@ -144,6 +144,10 @@ module.exports = function () {
|
|||||||
return this.nameWayHash[s.toString()] || this.nameWayHash[s.toString().split('').reverse().join('')];
|
return this.nameWayHash[s.toString()] || this.nameWayHash[s.toString().split('').reverse().join('')];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.findRelationByName = (s) => {
|
||||||
|
return this.nameRelationHash[s.toString()] || this.nameRelationHash[s.toString().split('').reverse().join('')];
|
||||||
|
};
|
||||||
|
|
||||||
this.makeOSMId = () => {
|
this.makeOSMId = () => {
|
||||||
this.osmID = this.osmID + 1;
|
this.osmID = this.osmID + 1;
|
||||||
return this.osmID;
|
return this.osmID;
|
||||||
@@ -155,6 +159,7 @@ module.exports = function () {
|
|||||||
this.locationHash = {};
|
this.locationHash = {};
|
||||||
this.shortcutsHash = {};
|
this.shortcutsHash = {};
|
||||||
this.nameWayHash = {};
|
this.nameWayHash = {};
|
||||||
|
this.nameRelationHash = {};
|
||||||
this.osmID = 0;
|
this.osmID = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ module.exports = function () {
|
|||||||
|
|
||||||
this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000;
|
this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000;
|
||||||
this.HOST = 'http://127.0.0.1:' + this.OSRM_PORT;
|
this.HOST = 'http://127.0.0.1:' + this.OSRM_PORT;
|
||||||
|
|
||||||
|
this.OSRM_PROFILE = process.env.OSRM_PROFILE;
|
||||||
|
|
||||||
if (this.PLATFORM_WINDOWS) {
|
if (this.PLATFORM_WINDOWS) {
|
||||||
this.TERMSIGNAL = 9;
|
this.TERMSIGNAL = 9;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ module.exports = function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.BeforeFeature((feature, callback) => {
|
this.BeforeFeature((feature, callback) => {
|
||||||
this.profile = this.DEFAULT_PROFILE;
|
this.profile = this.OSRM_PROFILE || this.DEFAULT_PROFILE;
|
||||||
this.profileFile = path.join(this.PROFILES_PATH, this.profile + '.lua');
|
this.profileFile = path.join(this.PROFILES_PATH, this.profile + '.lua');
|
||||||
this.setupFeatureCache(feature);
|
this.setupFeatureCache(feature);
|
||||||
callback();
|
callback();
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ Feature: Alternative route
|
|||||||
g h i j
|
g h i j
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# enforce multiple cells for filterUnpackedPathsBySharing check
|
||||||
|
And the partition extra arguments "--small-component-size 1 --max-cell-sizes 2,4,8,16"
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes |
|
| nodes |
|
||||||
| ab |
|
| ab |
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
Feature: Approach parameter
|
Feature: Approach parameter
|
||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given the profile "testbot"
|
Given 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
|
||||||
Given the node map
|
Given the profile "testbot"
|
||||||
|
And the node map
|
||||||
"""
|
"""
|
||||||
s e
|
s e
|
||||||
a------b------c
|
a------b------c
|
||||||
@@ -22,7 +22,8 @@ Feature: Approach parameter
|
|||||||
| s | e | unrestricted unrestricted | ab,bc |
|
| s | e | unrestricted unrestricted | ab,bc |
|
||||||
|
|
||||||
Scenario: Start End same approach, option unrestricted for Start and curb for End
|
Scenario: Start End same approach, option unrestricted for Start and curb for End
|
||||||
Given the node map
|
Given the profile "testbot"
|
||||||
|
And the node map
|
||||||
"""
|
"""
|
||||||
s e
|
s e
|
||||||
a------b------c
|
a------b------c
|
||||||
@@ -38,7 +39,8 @@ Feature: Approach parameter
|
|||||||
| s | e | unrestricted curb | ab,bc,bc |
|
| s | e | unrestricted curb | ab,bc,bc |
|
||||||
|
|
||||||
Scenario: Start End opposite approach, option unrestricted for Start and End
|
Scenario: Start End opposite approach, option unrestricted for Start and End
|
||||||
Given the node map
|
Given the profile "testbot"
|
||||||
|
And the node map
|
||||||
"""
|
"""
|
||||||
s
|
s
|
||||||
a------b------c
|
a------b------c
|
||||||
@@ -55,7 +57,8 @@ Feature: Approach parameter
|
|||||||
| s | e | unrestricted unrestricted | ab,bc |
|
| s | e | unrestricted unrestricted | ab,bc |
|
||||||
|
|
||||||
Scenario: Start End opposite approach, option unrestricted for Start and curb for End
|
Scenario: Start End opposite approach, option unrestricted for Start and curb for End
|
||||||
Given the node map
|
Given the profile "testbot"
|
||||||
|
And the node map
|
||||||
"""
|
"""
|
||||||
s
|
s
|
||||||
a------b------c
|
a------b------c
|
||||||
@@ -77,7 +80,8 @@ Feature: Approach parameter
|
|||||||
|
|
||||||
|
|
||||||
Scenario: Test on oneway segment, Start End same approach, option unrestricted for Start and End
|
Scenario: Test on oneway segment, Start End same approach, option unrestricted for Start and End
|
||||||
Given the node map
|
Given the profile "testbot"
|
||||||
|
And the node map
|
||||||
"""
|
"""
|
||||||
s e
|
s e
|
||||||
a------b------c
|
a------b------c
|
||||||
@@ -93,7 +97,8 @@ Feature: Approach parameter
|
|||||||
| s | e | unrestricted unrestricted | ab,bc |
|
| s | e | unrestricted unrestricted | ab,bc |
|
||||||
|
|
||||||
Scenario: Test on oneway segment, Start End same approach, option unrestricted for Start and curb for End
|
Scenario: Test on oneway segment, Start End same approach, option unrestricted for Start and curb for End
|
||||||
Given the node map
|
Given the profile "testbot"
|
||||||
|
And the node map
|
||||||
"""
|
"""
|
||||||
s e
|
s e
|
||||||
a------b------c
|
a------b------c
|
||||||
@@ -109,7 +114,8 @@ Feature: Approach parameter
|
|||||||
| s | e | unrestricted curb | ab,bc |
|
| s | e | unrestricted curb | ab,bc |
|
||||||
|
|
||||||
Scenario: Test on oneway segment, Start End opposite approach, option unrestricted for Start and End
|
Scenario: Test on oneway segment, Start End opposite approach, option unrestricted for Start and End
|
||||||
Given the node map
|
Given the profile "testbot"
|
||||||
|
And the node map
|
||||||
"""
|
"""
|
||||||
s
|
s
|
||||||
a------b------c
|
a------b------c
|
||||||
@@ -126,7 +132,8 @@ Feature: Approach parameter
|
|||||||
| s | e | unrestricted unrestricted | ab,bc |
|
| s | e | unrestricted unrestricted | ab,bc |
|
||||||
|
|
||||||
Scenario: Test on oneway segment, Start End opposite approach, option unrestricted for Start and curb for End
|
Scenario: Test on oneway segment, Start End opposite approach, option unrestricted for Start and curb for End
|
||||||
Given the node map
|
Given the profile "testbot"
|
||||||
|
And the node map
|
||||||
"""
|
"""
|
||||||
s
|
s
|
||||||
a------b------c
|
a------b------c
|
||||||
@@ -147,7 +154,8 @@ Feature: Approach parameter
|
|||||||
##############
|
##############
|
||||||
|
|
||||||
Scenario: UTurn test, router can't found a route because uturn unauthorized on the segment selected
|
Scenario: UTurn test, router can't found a route because uturn unauthorized on the segment selected
|
||||||
Given the node map
|
Given the profile "testbot"
|
||||||
|
And the node map
|
||||||
"""
|
"""
|
||||||
s e
|
s e
|
||||||
a------b------c
|
a------b------c
|
||||||
@@ -168,7 +176,8 @@ Feature: Approach parameter
|
|||||||
|
|
||||||
|
|
||||||
Scenario: UTurn test, router can find a route because he can use the roundabout
|
Scenario: UTurn test, router can find a route because he can use the roundabout
|
||||||
Given the node map
|
Given the profile "testbot"
|
||||||
|
And the node map
|
||||||
"""
|
"""
|
||||||
h
|
h
|
||||||
s e / \
|
s e / \
|
||||||
@@ -190,3 +199,30 @@ Feature: Approach parameter
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | approaches | route |
|
| from | to | approaches | route |
|
||||||
| s | e | unrestricted curb | ab,bc,bc |
|
| s | e | unrestricted curb | ab,bc,bc |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Start End same approach, option unrestricted for Start and curb for End, left-hand driving
|
||||||
|
Given the profile file
|
||||||
|
"""
|
||||||
|
local functions = require('testbot')
|
||||||
|
local testbot_process_way = functions.process_way
|
||||||
|
functions.process_way = function(profile, way, result)
|
||||||
|
testbot_process_way(profile, way, result)
|
||||||
|
result.is_left_hand_driving = true
|
||||||
|
end
|
||||||
|
return functions
|
||||||
|
"""
|
||||||
|
And the node map
|
||||||
|
"""
|
||||||
|
s e
|
||||||
|
a------b------c
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
| bc |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | approaches | route |
|
||||||
|
| s | e | unrestricted curb | ab,bc |
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given the profile "testbot"
|
Given the profile "testbot"
|
||||||
|
And the partition extra arguments "--small-component-size 1 --max-cell-sizes 2,4,8,16"
|
||||||
|
|
||||||
Scenario: Testbot - Travel time matrix of minimal network
|
Scenario: Testbot - Travel time matrix of minimal network
|
||||||
Given the node map
|
Given the node map
|
||||||
@@ -41,6 +42,17 @@ Feature: Basic Distance Matrix
|
|||||||
| c | 30 | 20 | 0 | 30 |
|
| c | 30 | 20 | 0 | 30 |
|
||||||
| d | 60 | 50 | 30 | 0 |
|
| d | 60 | 50 | 30 | 0 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | b | c | d |
|
||||||
|
| a | 0 | 10 | 30 | 60 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a |
|
||||||
|
| a | 0 |
|
||||||
|
| b | 10 |
|
||||||
|
| c | 30 |
|
||||||
|
| d | 60 |
|
||||||
|
|
||||||
Scenario: Testbot - Travel time matrix with fuzzy match
|
Scenario: Testbot - Travel time matrix with fuzzy match
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
@@ -113,7 +125,7 @@ Feature: Basic Distance Matrix
|
|||||||
| d | 20 | 30 | 0 | 30 |
|
| d | 20 | 30 | 0 | 30 |
|
||||||
| e | 30 | 40 | 10 | 0 |
|
| e | 30 | 40 | 10 | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Travel time matrix and with only one source
|
Scenario: Testbot - Rectangular travel time matrix
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
a b c
|
a b c
|
||||||
@@ -132,6 +144,46 @@ Feature: Basic Distance Matrix
|
|||||||
| | a | b | e | f |
|
| | a | b | e | f |
|
||||||
| a | 0 | 10 | 20 | 30 |
|
| a | 0 | 10 | 20 | 30 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a |
|
||||||
|
| a | 0 |
|
||||||
|
| b | 10 |
|
||||||
|
| e | 20 |
|
||||||
|
| f | 30 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | b | e | f |
|
||||||
|
| a | 0 | 10 | 20 | 30 |
|
||||||
|
| b | 10 | 0 | 10 | 20 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | b |
|
||||||
|
| a | 0 | 10 |
|
||||||
|
| b | 10 | 0 |
|
||||||
|
| e | 20 | 10 |
|
||||||
|
| f | 30 | 20 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | b | e | f |
|
||||||
|
| a | 0 | 10 | 20 | 30 |
|
||||||
|
| b | 10 | 0 | 10 | 20 |
|
||||||
|
| e | 20 | 10 | 0 | 10 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | b | e |
|
||||||
|
| a | 0 | 10 | 20 |
|
||||||
|
| b | 10 | 0 | 10 |
|
||||||
|
| e | 20 | 10 | 0 |
|
||||||
|
| f | 30 | 20 | 10 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | b | e | f |
|
||||||
|
| a | 0 | 10 | 20 | 30 |
|
||||||
|
| b | 10 | 0 | 10 | 20 |
|
||||||
|
| e | 20 | 10 | 0 | 10 |
|
||||||
|
| f | 30 | 20 | 10 | 0 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Testbot - Travel time 3x2 matrix
|
Scenario: Testbot - Travel time 3x2 matrix
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
@@ -308,3 +360,52 @@ Feature: Basic Distance Matrix
|
|||||||
| 6 | 7 | 6 | 10 | 9 | 1 | 0 | 3.9 | 2.9 |
|
| 6 | 7 | 6 | 10 | 9 | 1 | 0 | 3.9 | 2.9 |
|
||||||
| 7 | 3.1 | 2.1 | 6.1 | 5.1 | 9.1 | 8.1 | 0 | 11 |
|
| 7 | 3.1 | 2.1 | 6.1 | 5.1 | 9.1 | 8.1 | 0 | 11 |
|
||||||
| 8 | 4.1 | 3.1 | 7.1 | 6.1 | 10.1 | 9.1 | 1 | 0 |
|
| 8 | 4.1 | 3.1 | 7.1 | 6.1 | 10.1 | 9.1 | 1 | 0 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Testbot - Travel time matrix with ties
|
||||||
|
Given the profile file
|
||||||
|
"""
|
||||||
|
local functions = require('testbot')
|
||||||
|
functions.process_segment = function(profile, segment)
|
||||||
|
segment.weight = 1
|
||||||
|
segment.duration = 1
|
||||||
|
end
|
||||||
|
functions.process_turn = function(profile, turn)
|
||||||
|
if turn.angle >= 0 then
|
||||||
|
turn.duration = 16
|
||||||
|
else
|
||||||
|
turn.duration = 4
|
||||||
|
end
|
||||||
|
turn.weight = 0
|
||||||
|
end
|
||||||
|
return functions
|
||||||
|
"""
|
||||||
|
And the node map
|
||||||
|
"""
|
||||||
|
a b
|
||||||
|
|
||||||
|
c d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
| ac |
|
||||||
|
| bd |
|
||||||
|
| dc |
|
||||||
|
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | distance | time | weight |
|
||||||
|
| a | c | ac,ac | 200m | 5s | 5 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | b | c | d |
|
||||||
|
| a | 0 | 1 | 5 | 10 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a |
|
||||||
|
| a | 0 |
|
||||||
|
| b | 1 |
|
||||||
|
| c | 15 |
|
||||||
|
| d | 10 |
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ Feature: Multi level routing
|
|||||||
| cm | primary |
|
| cm | primary |
|
||||||
| hj | primary |
|
| hj | primary |
|
||||||
| kp | primary |
|
| kp | primary |
|
||||||
|
And the partition extra arguments "--small-component-size 1 --max-cell-sizes 4,16"
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | time |
|
| from | to | route | time |
|
||||||
@@ -82,6 +83,28 @@ Feature: Multi level routing
|
|||||||
| l | 144.7 | 124.7 | 0 | 60 |
|
| l | 144.7 | 124.7 | 0 | 60 |
|
||||||
| o | 124.7 | 144.7 | 60 | 0 |
|
| o | 124.7 | 144.7 | 60 | 0 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | f | l | o |
|
||||||
|
| a | 0 | 229.4 | 144.7 | 124.7 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a |
|
||||||
|
| a | 0 |
|
||||||
|
| f | 229.4 |
|
||||||
|
| l | 144.7 |
|
||||||
|
| o | 124.7 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | f | l | o |
|
||||||
|
| a | 0 | 229.4 | 144.7 | 124.7 |
|
||||||
|
| o | 124.7 | 144.7 | 60 | 0 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | o |
|
||||||
|
| a | 0 | 124.7 |
|
||||||
|
| f | 229.4 | 144.7 |
|
||||||
|
| l | 144.7 | 60 |
|
||||||
|
| o | 124.7 | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Multi level routing: horizontal road
|
Scenario: Testbot - Multi level routing: horizontal road
|
||||||
Given the node map
|
Given the node map
|
||||||
|
|||||||
@@ -12,14 +12,32 @@ namespace osrm
|
|||||||
namespace contractor
|
namespace contractor
|
||||||
{
|
{
|
||||||
|
|
||||||
using GraphFilterAndCore =
|
using GraphAndFilter = std::tuple<QueryGraph, std::vector<std::vector<bool>>>;
|
||||||
std::tuple<QueryGraph, std::vector<std::vector<bool>>, std::vector<std::vector<bool>>>;
|
|
||||||
|
inline auto contractFullGraph(ContractorGraph contractor_graph,
|
||||||
|
std::vector<EdgeWeight> node_weights)
|
||||||
|
{
|
||||||
|
auto num_nodes = contractor_graph.GetNumberOfNodes();
|
||||||
|
contractGraph(contractor_graph, node_weights);
|
||||||
|
|
||||||
|
auto edges = toEdges<QueryEdge>(std::move(contractor_graph));
|
||||||
|
std::vector<bool> edge_filter(edges.size(), true);
|
||||||
|
|
||||||
|
return GraphAndFilter{QueryGraph{num_nodes, std::move(edges)}, {std::move(edge_filter)}};
|
||||||
|
}
|
||||||
|
|
||||||
inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
|
inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
|
||||||
std::vector<EdgeWeight> node_weights,
|
std::vector<EdgeWeight> node_weights,
|
||||||
const std::vector<std::vector<bool>> &filters,
|
const std::vector<std::vector<bool>> &filters)
|
||||||
const float core_factor = 1.0)
|
|
||||||
{
|
{
|
||||||
|
if (filters.size() == 1)
|
||||||
|
{
|
||||||
|
if (std::all_of(filters.front().begin(), filters.front().end(), [](auto v) { return v; }))
|
||||||
|
{
|
||||||
|
return contractFullGraph(std::move(contractor_graph_), std::move(node_weights));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto num_nodes = contractor_graph_.GetNumberOfNodes();
|
auto num_nodes = contractor_graph_.GetNumberOfNodes();
|
||||||
ContractedEdgeContainer edge_container;
|
ContractedEdgeContainer edge_container;
|
||||||
ContractorGraph shared_core_graph;
|
ContractorGraph shared_core_graph;
|
||||||
@@ -39,10 +57,8 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
|
|||||||
// a very dense core. This increases the overall graph sizes a little bit
|
// a very dense core. This increases the overall graph sizes a little bit
|
||||||
// but increases the final CH quality and contraction speed.
|
// but increases the final CH quality and contraction speed.
|
||||||
constexpr float BASE_CORE = 0.9;
|
constexpr float BASE_CORE = 0.9;
|
||||||
is_shared_core = contractGraph(contractor_graph,
|
is_shared_core =
|
||||||
std::move(always_allowed),
|
contractGraph(contractor_graph, std::move(always_allowed), node_weights, BASE_CORE);
|
||||||
node_weights,
|
|
||||||
std::min<float>(BASE_CORE, core_factor));
|
|
||||||
|
|
||||||
// Add all non-core edges to container
|
// Add all non-core edges to container
|
||||||
{
|
{
|
||||||
@@ -60,26 +76,18 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
|
|||||||
[&is_shared_core](const NodeID node) { return is_shared_core[node]; });
|
[&is_shared_core](const NodeID node) { return is_shared_core[node]; });
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::vector<bool>> cores;
|
|
||||||
for (const auto &filter : filters)
|
for (const auto &filter : filters)
|
||||||
{
|
{
|
||||||
auto filtered_core_graph =
|
auto filtered_core_graph =
|
||||||
shared_core_graph.Filter([&filter](const NodeID node) { return filter[node]; });
|
shared_core_graph.Filter([&filter](const NodeID node) { return filter[node]; });
|
||||||
|
|
||||||
auto core = contractGraph(
|
contractGraph(filtered_core_graph, is_shared_core, is_shared_core, node_weights);
|
||||||
filtered_core_graph, is_shared_core, is_shared_core, node_weights, core_factor);
|
|
||||||
if (core_factor == 1.0)
|
|
||||||
{
|
|
||||||
core.clear();
|
|
||||||
}
|
|
||||||
cores.push_back(std::move(core));
|
|
||||||
|
|
||||||
edge_container.Merge(toEdges<QueryEdge>(std::move(filtered_core_graph)));
|
edge_container.Merge(toEdges<QueryEdge>(std::move(filtered_core_graph)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return GraphFilterAndCore{QueryGraph{num_nodes, std::move(edge_container.edges)},
|
return GraphAndFilter{QueryGraph{num_nodes, std::move(edge_container.edges)},
|
||||||
edge_container.MakeEdgeFilters(),
|
edge_container.MakeEdgeFilters()};
|
||||||
std::move(cores)};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,17 @@
|
|||||||
#define OSRM_CONTRACTOR_CONTRACTED_EDGE_CONTAINER_HPP
|
#define OSRM_CONTRACTOR_CONTRACTED_EDGE_CONTAINER_HPP
|
||||||
|
|
||||||
#include "contractor/query_edge.hpp"
|
#include "contractor/query_edge.hpp"
|
||||||
#include "util/deallocating_vector.hpp"
|
|
||||||
|
|
||||||
|
#include "util/integer_range.hpp"
|
||||||
|
#include "util/permutation.hpp"
|
||||||
|
|
||||||
|
#include <tbb/parallel_sort.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <numeric>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
@@ -43,7 +51,7 @@ struct ContractedEdgeContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Insert(util::DeallocatingVector<QueryEdge> new_edges)
|
void Insert(std::vector<QueryEdge> new_edges)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(edges.size() == 0);
|
BOOST_ASSERT(edges.size() == 0);
|
||||||
BOOST_ASSERT(flags.empty());
|
BOOST_ASSERT(flags.empty());
|
||||||
@@ -52,80 +60,70 @@ struct ContractedEdgeContainer
|
|||||||
flags.resize(edges.size(), ALL_FLAGS);
|
flags.resize(edges.size(), ALL_FLAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Merge(util::DeallocatingVector<QueryEdge> new_edges)
|
void Merge(std::vector<QueryEdge> new_edges)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(index < sizeof(MergedFlags) * CHAR_BIT);
|
BOOST_ASSERT(index < sizeof(MergedFlags) * CHAR_BIT);
|
||||||
|
|
||||||
const MergedFlags flag = 1 << index++;
|
const MergedFlags flag = 1 << index++;
|
||||||
|
|
||||||
std::vector<MergedFlags> merged_flags;
|
auto edge_iter = edges.cbegin();
|
||||||
merged_flags.reserve(flags.size() * 1.1);
|
auto edge_end = edges.cend();
|
||||||
util::DeallocatingVector<QueryEdge> merged_edges;
|
|
||||||
merged_edges.reserve(edges.size() * 1.1);
|
|
||||||
|
|
||||||
auto flags_iter = flags.begin();
|
auto flags_iter = flags.begin();
|
||||||
// destructive iterators, this is single-pass only
|
|
||||||
// FIXME using dbegin() dend() will result in segfaults.
|
|
||||||
auto edges_iter = edges.dbegin();
|
|
||||||
auto edges_end = edges.dend();
|
|
||||||
auto new_edges_iter = new_edges.dbegin();
|
|
||||||
auto new_edges_end = new_edges.dend();
|
|
||||||
|
|
||||||
while (edges_iter != edges_end && new_edges_iter != new_edges_end)
|
// Remove all edges that are contained in the old set of edges and set the appropriate flag.
|
||||||
{
|
auto new_end =
|
||||||
while (edges_iter != edges_end && mergeCompare(*edges_iter, *new_edges_iter))
|
std::remove_if(new_edges.begin(), new_edges.end(), [&](const QueryEdge &edge) {
|
||||||
{
|
// check if the new edge would be sorted before the currend old edge
|
||||||
merged_edges.push_back(*edges_iter);
|
// if so it is not contained yet in the set of old edges
|
||||||
merged_flags.push_back(*flags_iter);
|
if (edge_iter == edge_end || mergeCompare(edge, *edge_iter))
|
||||||
edges_iter++;
|
{
|
||||||
flags_iter++;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (edges_iter == edges_end)
|
// find the first old edge that is equal or greater then the new edge
|
||||||
{
|
while (edge_iter != edge_end && mergeCompare(*edge_iter, edge))
|
||||||
break;
|
{
|
||||||
}
|
BOOST_ASSERT(flags_iter != flags.end());
|
||||||
|
edge_iter++;
|
||||||
|
flags_iter++;
|
||||||
|
}
|
||||||
|
|
||||||
while (new_edges_iter != new_edges_end && mergeCompare(*new_edges_iter, *edges_iter))
|
// all new edges will be sorted after the old edges
|
||||||
{
|
if (edge_iter == edge_end)
|
||||||
merged_edges.push_back(*new_edges_iter);
|
{
|
||||||
merged_flags.push_back(flag);
|
return false;
|
||||||
new_edges_iter++;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (new_edges_iter == new_edges_end)
|
BOOST_ASSERT(edge_iter != edge_end);
|
||||||
{
|
if (mergable(edge, *edge_iter))
|
||||||
break;
|
{
|
||||||
}
|
*flags_iter = *flags_iter | flag;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
BOOST_ASSERT(mergeCompare(edge, *edge_iter));
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
while (edges_iter != edges_end && new_edges_iter != new_edges_end &&
|
// append new edges
|
||||||
mergable(*edges_iter, *new_edges_iter))
|
edges.insert(edges.end(), new_edges.begin(), new_end);
|
||||||
{
|
auto edges_size = edges.size();
|
||||||
merged_edges.push_back(*edges_iter);
|
auto new_edges_size = std::distance(new_edges.begin(), new_end);
|
||||||
merged_flags.push_back(*flags_iter | flag);
|
BOOST_ASSERT(edges_size >= new_edges_size);
|
||||||
|
flags.resize(edges_size);
|
||||||
|
std::fill(flags.begin() + edges_size - new_edges_size, flags.end(), flag);
|
||||||
|
|
||||||
edges_iter++;
|
// enforce sorting for next merge step
|
||||||
flags_iter++;
|
std::vector<unsigned> ordering(edges_size);
|
||||||
new_edges_iter++;
|
std::iota(ordering.begin(), ordering.end(), 0);
|
||||||
}
|
tbb::parallel_sort(
|
||||||
}
|
ordering.begin(), ordering.end(), [&](const auto lhs_idx, const auto rhs_idx) {
|
||||||
|
return mergeCompare(edges[lhs_idx], edges[rhs_idx]);
|
||||||
|
});
|
||||||
|
auto permutation = util::orderingToPermutation(ordering);
|
||||||
|
|
||||||
while (edges_iter != edges_end)
|
util::inplacePermutation(edges.begin(), edges.end(), permutation);
|
||||||
{
|
util::inplacePermutation(flags.begin(), flags.end(), permutation);
|
||||||
BOOST_ASSERT(new_edges_iter == new_edges_end);
|
BOOST_ASSERT(std::is_sorted(edges.begin(), edges.end(), mergeCompare));
|
||||||
merged_edges.push_back(*edges_iter++);
|
|
||||||
merged_flags.push_back(*flags_iter++);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (new_edges_iter != new_edges_end)
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(edges_iter == edges_end);
|
|
||||||
merged_edges.push_back(*new_edges_iter++);
|
|
||||||
merged_flags.push_back(flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
flags = std::move(merged_flags);
|
|
||||||
edges = std::move(merged_edges);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto MakeEdgeFilters() const
|
auto MakeEdgeFilters() const
|
||||||
@@ -145,7 +143,7 @@ struct ContractedEdgeContainer
|
|||||||
|
|
||||||
std::size_t index = 0;
|
std::size_t index = 0;
|
||||||
std::vector<MergedFlags> flags;
|
std::vector<MergedFlags> flags;
|
||||||
util::DeallocatingVector<QueryEdge> edges;
|
std::vector<QueryEdge> edges;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
@@ -29,16 +29,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#define CONTRACTOR_CONTRACTOR_HPP
|
#define CONTRACTOR_CONTRACTOR_HPP
|
||||||
|
|
||||||
#include "contractor/contractor_config.hpp"
|
#include "contractor/contractor_config.hpp"
|
||||||
#include "contractor/query_edge.hpp"
|
|
||||||
#include "extractor/edge_based_edge.hpp"
|
|
||||||
#include "extractor/edge_based_node_segment.hpp"
|
|
||||||
#include "util/deallocating_vector.hpp"
|
|
||||||
#include "util/typedefs.hpp"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
@@ -49,8 +39,6 @@ namespace contractor
|
|||||||
class Contractor
|
class Contractor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using EdgeData = QueryEdge::EdgeData;
|
|
||||||
|
|
||||||
explicit Contractor(const ContractorConfig &config_) : config{config_} {}
|
explicit Contractor(const ContractorConfig &config_) : config{config_} {}
|
||||||
|
|
||||||
Contractor(const Contractor &) = delete;
|
Contractor(const Contractor &) = delete;
|
||||||
@@ -58,14 +46,6 @@ class Contractor
|
|||||||
|
|
||||||
int Run();
|
int Run();
|
||||||
|
|
||||||
protected:
|
|
||||||
void ContractGraph(const unsigned max_edge_id,
|
|
||||||
util::DeallocatingVector<extractor::EdgeBasedEdge> &edge_based_edge_list,
|
|
||||||
util::DeallocatingVector<QueryEdge> &contracted_edge_list,
|
|
||||||
std::vector<EdgeWeight> &&node_weights,
|
|
||||||
std::vector<bool> &is_core_node,
|
|
||||||
std::vector<float> &inout_node_levels) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ContractorConfig config;
|
ContractorConfig config;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
@@ -45,7 +45,7 @@ struct ContractorConfig final : storage::IOConfig
|
|||||||
ContractorConfig()
|
ContractorConfig()
|
||||||
: IOConfig({".osrm.ebg", ".osrm.ebg_nodes", ".osrm.properties"},
|
: IOConfig({".osrm.ebg", ".osrm.ebg_nodes", ".osrm.properties"},
|
||||||
{},
|
{},
|
||||||
{".osrm.level", ".osrm.core", ".osrm.hsgr", ".osrm.enw"}),
|
{".osrm.hsgr", ".osrm.enw"}),
|
||||||
requested_num_threads(0)
|
requested_num_threads(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -61,10 +61,12 @@ struct ContractorConfig final : storage::IOConfig
|
|||||||
|
|
||||||
updater::UpdaterConfig updater_config;
|
updater::UpdaterConfig updater_config;
|
||||||
|
|
||||||
|
// DEPRECATED to be removed in v6.0
|
||||||
bool use_cached_priority;
|
bool use_cached_priority;
|
||||||
|
|
||||||
unsigned requested_num_threads;
|
unsigned requested_num_threads;
|
||||||
|
|
||||||
|
// DEPRECATED to be removed in v6.0
|
||||||
// A percentage of vertices that will be contracted for the hierarchy.
|
// A percentage of vertices that will be contracted for the hierarchy.
|
||||||
// Offers a trade-off between preprocessing and query time.
|
// Offers a trade-off between preprocessing and query time.
|
||||||
// The remaining vertices form the core of the hierarchy
|
// The remaining vertices form the core of the hierarchy
|
||||||
|
|||||||
@@ -14,37 +14,6 @@ namespace contractor
|
|||||||
{
|
{
|
||||||
namespace files
|
namespace files
|
||||||
{
|
{
|
||||||
// reads .osrm.core
|
|
||||||
template <typename CoreVectorT>
|
|
||||||
void readCoreMarker(const boost::filesystem::path &path, std::vector<CoreVectorT> &cores)
|
|
||||||
{
|
|
||||||
static_assert(util::is_view_or_vector<bool, CoreVectorT>::value,
|
|
||||||
"cores must be a vector of boolean vectors");
|
|
||||||
storage::io::FileReader reader(path, storage::io::FileReader::VerifyFingerprint);
|
|
||||||
|
|
||||||
auto num_cores = reader.ReadElementCount64();
|
|
||||||
cores.resize(num_cores);
|
|
||||||
for (const auto index : util::irange<std::size_t>(0, num_cores))
|
|
||||||
{
|
|
||||||
storage::serialization::read(reader, cores[index]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// writes .osrm.core
|
|
||||||
template <typename CoreVectorT>
|
|
||||||
void writeCoreMarker(const boost::filesystem::path &path, const std::vector<CoreVectorT> &cores)
|
|
||||||
{
|
|
||||||
static_assert(util::is_view_or_vector<bool, CoreVectorT>::value,
|
|
||||||
"cores must be a vector of boolean vectors");
|
|
||||||
storage::io::FileWriter writer(path, storage::io::FileWriter::GenerateFingerprint);
|
|
||||||
|
|
||||||
writer.WriteElementCount64(cores.size());
|
|
||||||
for (const auto &core : cores)
|
|
||||||
{
|
|
||||||
storage::serialization::write(writer, core);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// reads .osrm.hsgr file
|
// reads .osrm.hsgr file
|
||||||
template <typename QueryGraphT, typename EdgeFilterT>
|
template <typename QueryGraphT, typename EdgeFilterT>
|
||||||
inline void readGraph(const boost::filesystem::path &path,
|
inline void readGraph(const boost::filesystem::path &path,
|
||||||
@@ -96,24 +65,6 @@ inline void writeGraph(const boost::filesystem::path &path,
|
|||||||
storage::serialization::write(writer, filter);
|
storage::serialization::write(writer, filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// reads .levels file
|
|
||||||
inline void readLevels(const boost::filesystem::path &path, std::vector<float> &node_levels)
|
|
||||||
{
|
|
||||||
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
|
|
||||||
storage::io::FileReader reader{path, fingerprint};
|
|
||||||
|
|
||||||
storage::serialization::read(reader, node_levels);
|
|
||||||
}
|
|
||||||
|
|
||||||
// writes .levels file
|
|
||||||
inline void writeLevels(const boost::filesystem::path &path, const std::vector<float> &node_levels)
|
|
||||||
{
|
|
||||||
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
|
|
||||||
storage::io::FileWriter writer{path, fingerprint};
|
|
||||||
|
|
||||||
storage::serialization::write(writer, node_levels);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define OSRM_CONTRACTOR_GRAPH_CONTRACTION_ADAPTORS_HPP_
|
#define OSRM_CONTRACTOR_GRAPH_CONTRACTION_ADAPTORS_HPP_
|
||||||
|
|
||||||
#include "contractor/contractor_graph.hpp"
|
#include "contractor/contractor_graph.hpp"
|
||||||
|
|
||||||
#include "util/log.hpp"
|
#include "util/log.hpp"
|
||||||
#include "util/percent.hpp"
|
#include "util/percent.hpp"
|
||||||
|
|
||||||
@@ -125,9 +126,10 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
|
|||||||
return ContractorGraph{number_of_nodes, edges};
|
return ContractorGraph{number_of_nodes, edges};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Edge, typename GraphT> inline util::DeallocatingVector<Edge> toEdges(GraphT graph)
|
template <class Edge, typename GraphT> inline std::vector<Edge> toEdges(GraphT graph)
|
||||||
{
|
{
|
||||||
util::DeallocatingVector<Edge> edges;
|
std::vector<Edge> edges;
|
||||||
|
edges.reserve(graph.GetNumberOfEdges());
|
||||||
|
|
||||||
util::UnbufferedLog log;
|
util::UnbufferedLog log;
|
||||||
log << "Getting edges of minimized graph ";
|
log << "Getting edges of minimized graph ";
|
||||||
@@ -163,6 +165,7 @@ template <class Edge, typename GraphT> inline util::DeallocatingVector<Edge> toE
|
|||||||
tbb::parallel_sort(edges.begin(), edges.end());
|
tbb::parallel_sort(edges.begin(), edges.end());
|
||||||
auto new_end = std::unique(edges.begin(), edges.end());
|
auto new_end = std::unique(edges.begin(), edges.end());
|
||||||
edges.resize(new_end - edges.begin());
|
edges.resize(new_end - edges.begin());
|
||||||
|
edges.shrink_to_fit();
|
||||||
|
|
||||||
return edges;
|
return edges;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,14 +159,16 @@ class CellCustomizer
|
|||||||
}
|
}
|
||||||
|
|
||||||
const EdgeWeight to_weight = weight + subcell_weight;
|
const EdgeWeight to_weight = weight + subcell_weight;
|
||||||
|
const EdgeDuration to_duration = duration + *subcell_duration;
|
||||||
if (!heap.WasInserted(to))
|
if (!heap.WasInserted(to))
|
||||||
{
|
{
|
||||||
heap.Insert(to, to_weight, {true, duration + *subcell_duration});
|
heap.Insert(to, to_weight, {true, to_duration});
|
||||||
}
|
}
|
||||||
else if (to_weight < heap.GetKey(to))
|
else if (std::tie(to_weight, to_duration) <
|
||||||
|
std::tie(heap.GetKey(to), heap.GetData(to).duration))
|
||||||
{
|
{
|
||||||
heap.DecreaseKey(to, to_weight);
|
heap.DecreaseKey(to, to_weight);
|
||||||
heap.GetData(to) = {true, duration + *subcell_duration};
|
heap.GetData(to) = {true, to_duration};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,14 +193,16 @@ class CellCustomizer
|
|||||||
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 = weight + data.weight;
|
||||||
|
const EdgeDuration to_duration = duration + data.duration;
|
||||||
if (!heap.WasInserted(to))
|
if (!heap.WasInserted(to))
|
||||||
{
|
{
|
||||||
heap.Insert(to, to_weight, {false, duration + data.duration});
|
heap.Insert(to, to_weight, {false, duration + data.duration});
|
||||||
}
|
}
|
||||||
else if (to_weight < heap.GetKey(to))
|
else if (std::tie(to_weight, to_duration) <
|
||||||
|
std::tie(heap.GetKey(to), heap.GetData(to).duration))
|
||||||
{
|
{
|
||||||
heap.DecreaseKey(to, to_weight);
|
heap.DecreaseKey(to, to_weight);
|
||||||
heap.GetData(to) = {false, duration + data.duration};
|
heap.GetData(to) = {false, to_duration};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,13 +17,6 @@ struct Algorithm final
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// Contraction Hiearchy with core
|
|
||||||
namespace corech
|
|
||||||
{
|
|
||||||
struct Algorithm final
|
|
||||||
{
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// Multi-Level Dijkstra
|
// Multi-Level Dijkstra
|
||||||
namespace mld
|
namespace mld
|
||||||
{
|
{
|
||||||
@@ -35,7 +28,6 @@ struct Algorithm final
|
|||||||
// Algorithm names
|
// Algorithm names
|
||||||
template <typename AlgorithmT> const char *name();
|
template <typename AlgorithmT> const char *name();
|
||||||
template <> inline const char *name<ch::Algorithm>() { return "CH"; }
|
template <> inline const char *name<ch::Algorithm>() { return "CH"; }
|
||||||
template <> inline const char *name<corech::Algorithm>() { return "CoreCH"; }
|
|
||||||
template <> inline const char *name<mld::Algorithm>() { return "MLD"; }
|
template <> inline const char *name<mld::Algorithm>() { return "MLD"; }
|
||||||
|
|
||||||
template <typename AlgorithmT> struct HasAlternativePathSearch final : std::false_type
|
template <typename AlgorithmT> struct HasAlternativePathSearch final : std::false_type
|
||||||
@@ -83,24 +75,6 @@ template <> struct HasExcludeFlags<ch::Algorithm> final : std::true_type
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
// Algorithms supported by Contraction Hierarchies with core
|
|
||||||
// the rest is disabled because of performance reasons
|
|
||||||
template <> struct HasShortestPathSearch<corech::Algorithm> final : std::true_type
|
|
||||||
{
|
|
||||||
};
|
|
||||||
template <> struct HasDirectShortestPathSearch<corech::Algorithm> final : std::true_type
|
|
||||||
{
|
|
||||||
};
|
|
||||||
template <> struct HasMapMatching<corech::Algorithm> final : std::true_type
|
|
||||||
{
|
|
||||||
};
|
|
||||||
template <> struct HasGetTileTurns<corech::Algorithm> final : std::true_type
|
|
||||||
{
|
|
||||||
};
|
|
||||||
template <> struct HasExcludeFlags<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 HasAlternativePathSearch<mld::Algorithm> final : std::true_type
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ namespace datafacade
|
|||||||
|
|
||||||
// Namespace local aliases for algorithms
|
// Namespace local aliases for algorithms
|
||||||
using CH = routing_algorithms::ch::Algorithm;
|
using CH = routing_algorithms::ch::Algorithm;
|
||||||
using CoreCH = routing_algorithms::corech::Algorithm;
|
|
||||||
using MLD = routing_algorithms::mld::Algorithm;
|
using MLD = routing_algorithms::mld::Algorithm;
|
||||||
|
|
||||||
template <typename AlgorithmT> class AlgorithmDataFacade;
|
template <typename AlgorithmT> class AlgorithmDataFacade;
|
||||||
@@ -57,14 +56,6 @@ template <> class AlgorithmDataFacade<CH>
|
|||||||
const std::function<bool(EdgeData)> filter) const = 0;
|
const std::function<bool(EdgeData)> filter) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> class AlgorithmDataFacade<CoreCH>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
using EdgeData = contractor::QueryEdge::EdgeData;
|
|
||||||
|
|
||||||
virtual bool IsCoreNode(const NodeID id) const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> class AlgorithmDataFacade<MLD>
|
template <> class AlgorithmDataFacade<MLD>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "customizer/edge_based_graph.hpp"
|
#include "customizer/edge_based_graph.hpp"
|
||||||
|
|
||||||
#include "extractor/datasources.hpp"
|
#include "extractor/datasources.hpp"
|
||||||
|
#include "extractor/edge_based_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/intersection_bearings_container.hpp"
|
#include "extractor/intersection_bearings_container.hpp"
|
||||||
@@ -165,50 +166,6 @@ class ContiguousInternalMemoryAlgorithmDataFacade<CH> : public datafacade::Algor
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
|
||||||
class ContiguousInternalMemoryAlgorithmDataFacade<CoreCH>
|
|
||||||
: public datafacade::AlgorithmDataFacade<CoreCH>
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
util::vector_view<bool> m_is_core_node;
|
|
||||||
|
|
||||||
// allocator that keeps the allocation data
|
|
||||||
std::shared_ptr<ContiguousBlockAllocator> allocator;
|
|
||||||
|
|
||||||
void InitializeCoreInformationPointer(storage::DataLayout &data_layout,
|
|
||||||
char *memory_block,
|
|
||||||
const std::size_t exclude_index)
|
|
||||||
{
|
|
||||||
auto core_block_id = static_cast<storage::DataLayout::BlockID>(
|
|
||||||
storage::DataLayout::CH_CORE_MARKER_0 + exclude_index);
|
|
||||||
auto core_marker_ptr = data_layout.GetBlockPtr<unsigned>(memory_block, core_block_id);
|
|
||||||
util::vector_view<bool> is_core_node(core_marker_ptr,
|
|
||||||
data_layout.num_entries[core_block_id]);
|
|
||||||
m_is_core_node = std::move(is_core_node);
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
ContiguousInternalMemoryAlgorithmDataFacade(
|
|
||||||
std::shared_ptr<ContiguousBlockAllocator> allocator_, const std::size_t exclude_index)
|
|
||||||
: allocator(std::move(allocator_))
|
|
||||||
{
|
|
||||||
InitializeInternalPointers(allocator->GetLayout(), allocator->GetMemory(), exclude_index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void InitializeInternalPointers(storage::DataLayout &data_layout,
|
|
||||||
char *memory_block,
|
|
||||||
const std::size_t exclude_index)
|
|
||||||
{
|
|
||||||
InitializeCoreInformationPointer(data_layout, memory_block, exclude_index);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsCoreNode(const NodeID id) const override final
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(m_is_core_node.empty() || id < m_is_core_node.size());
|
|
||||||
return !m_is_core_node.empty() || m_is_core_node[id];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This base class implements the Datafacade interface for accessing
|
* This base class implements the Datafacade interface for accessing
|
||||||
* data that's stored in a single large block of memory (RAM).
|
* data that's stored in a single large block of memory (RAM).
|
||||||
@@ -337,36 +294,21 @@ 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 =
|
const auto edge_based_node_list_ptr = layout.GetBlockPtr<extractor::EdgeBasedNode>(
|
||||||
layout.GetBlockPtr<GeometryID>(memory_ptr, storage::DataLayout::GEOMETRY_ID_LIST);
|
memory_ptr, storage::DataLayout::EDGE_BASED_NODE_DATA_LIST);
|
||||||
util::vector_view<GeometryID> geometry_ids(
|
util::vector_view<extractor::EdgeBasedNode> edge_based_node_data_list(
|
||||||
via_geometry_list_ptr, layout.num_entries[storage::DataLayout::GEOMETRY_ID_LIST]);
|
edge_based_node_list_ptr,
|
||||||
|
layout.num_entries[storage::DataLayout::EDGE_BASED_NODE_DATA_LIST]);
|
||||||
|
|
||||||
const auto name_id_list_ptr =
|
const auto annotation_data_list_ptr =
|
||||||
layout.GetBlockPtr<NameID>(memory_ptr, storage::DataLayout::NAME_ID_LIST);
|
layout.GetBlockPtr<extractor::NodeBasedEdgeAnnotation>(
|
||||||
util::vector_view<NameID> name_ids(name_id_list_ptr,
|
memory_ptr, storage::DataLayout::ANNOTATION_DATA_LIST);
|
||||||
layout.num_entries[storage::DataLayout::NAME_ID_LIST]);
|
util::vector_view<extractor::NodeBasedEdgeAnnotation> annotation_data(
|
||||||
|
annotation_data_list_ptr,
|
||||||
|
layout.num_entries[storage::DataLayout::ANNOTATION_DATA_LIST]);
|
||||||
|
|
||||||
const auto component_id_list_ptr =
|
edge_based_node_data = extractor::EdgeBasedNodeDataView(
|
||||||
layout.GetBlockPtr<ComponentID>(memory_ptr, storage::DataLayout::COMPONENT_ID_LIST);
|
std::move(edge_based_node_data_list), std::move(annotation_data));
|
||||||
util::vector_view<ComponentID> component_ids(
|
|
||||||
component_id_list_ptr, layout.num_entries[storage::DataLayout::COMPONENT_ID_LIST]);
|
|
||||||
|
|
||||||
const auto travel_mode_list_ptr = layout.GetBlockPtr<extractor::TravelMode>(
|
|
||||||
memory_ptr, storage::DataLayout::TRAVEL_MODE_LIST);
|
|
||||||
util::vector_view<extractor::TravelMode> travel_modes(
|
|
||||||
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),
|
|
||||||
std::move(name_ids),
|
|
||||||
std::move(component_ids),
|
|
||||||
std::move(travel_modes),
|
|
||||||
std::move(classes));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeEdgeInformationPointers(storage::DataLayout &layout, char *memory_ptr)
|
void InitializeEdgeInformationPointers(storage::DataLayout &layout, char *memory_ptr)
|
||||||
@@ -458,7 +400,6 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
geometries_index_ptr, data_layout.num_entries[storage::DataLayout::GEOMETRIES_INDEX]);
|
geometries_index_ptr, data_layout.num_entries[storage::DataLayout::GEOMETRIES_INDEX]);
|
||||||
|
|
||||||
auto num_entries = data_layout.num_entries[storage::DataLayout::GEOMETRIES_NODE_LIST];
|
auto num_entries = data_layout.num_entries[storage::DataLayout::GEOMETRIES_NODE_LIST];
|
||||||
|
|
||||||
auto geometries_node_list_ptr = data_layout.GetBlockPtr<NodeID>(
|
auto geometries_node_list_ptr = data_layout.GetBlockPtr<NodeID>(
|
||||||
memory_block, storage::DataLayout::GEOMETRIES_NODE_LIST);
|
memory_block, storage::DataLayout::GEOMETRIES_NODE_LIST);
|
||||||
util::vector_view<NodeID> geometry_node_list(geometries_node_list_ptr, num_entries);
|
util::vector_view<NodeID> geometry_node_list(geometries_node_list_ptr, num_entries);
|
||||||
@@ -939,9 +880,10 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
m_lane_description_offsets[lane_description_id + 1]);
|
m_lane_description_offsets[lane_description_id + 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsLeftHandDriving() const override final
|
bool IsLeftHandDriving(const NodeID id) const override final
|
||||||
{
|
{
|
||||||
return m_profile_properties->left_hand_driving;
|
// TODO: can be moved to a data block indexed by GeometryID
|
||||||
|
return edge_based_node_data.IsLeftHandDriving(id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -962,21 +904,6 @@ class ContiguousInternalMemoryDataFacade<CH>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
|
||||||
class ContiguousInternalMemoryDataFacade<CoreCH> final
|
|
||||||
: public ContiguousInternalMemoryDataFacade<CH>,
|
|
||||||
public ContiguousInternalMemoryAlgorithmDataFacade<CoreCH>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator,
|
|
||||||
const std::size_t exclude_index)
|
|
||||||
: ContiguousInternalMemoryDataFacade<CH>(allocator, exclude_index),
|
|
||||||
ContiguousInternalMemoryAlgorithmDataFacade<CoreCH>(allocator, exclude_index)
|
|
||||||
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : public AlgorithmDataFacade<MLD>
|
template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : public AlgorithmDataFacade<MLD>
|
||||||
{
|
{
|
||||||
// MLD data
|
// MLD data
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ class BaseDataFacade
|
|||||||
|
|
||||||
virtual util::guidance::EntryClass GetEntryClass(const EdgeID turn_id) const = 0;
|
virtual util::guidance::EntryClass GetEntryClass(const EdgeID turn_id) const = 0;
|
||||||
|
|
||||||
virtual bool IsLeftHandDriving() const = 0;
|
virtual bool IsLeftHandDriving(const NodeID id) const = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-37
@@ -116,7 +116,7 @@ template <typename Algorithm> class Engine final : public EngineInterface
|
|||||||
return tile_plugin.HandleRequest(GetAlgorithms(params), params, result);
|
return tile_plugin.HandleRequest(GetAlgorithms(params), params, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool CheckCompability(const EngineConfig &config);
|
static bool CheckCompatibility(const EngineConfig &config);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename ParametersT> auto GetAlgorithms(const ParametersT ¶ms) const
|
template <typename ParametersT> auto GetAlgorithms(const ParametersT ¶ms) const
|
||||||
@@ -135,7 +135,7 @@ template <typename Algorithm> class Engine final : public EngineInterface
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool Engine<routing_algorithms::ch::Algorithm>::CheckCompability(const EngineConfig &config)
|
bool Engine<routing_algorithms::ch::Algorithm>::CheckCompatibility(const EngineConfig &config)
|
||||||
{
|
{
|
||||||
if (config.use_shared_memory)
|
if (config.use_shared_memory)
|
||||||
{
|
{
|
||||||
@@ -161,39 +161,7 @@ bool Engine<routing_algorithms::ch::Algorithm>::CheckCompability(const EngineCon
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool Engine<routing_algorithms::corech::Algorithm>::CheckCompability(const EngineConfig &config)
|
bool Engine<routing_algorithms::mld::Algorithm>::CheckCompatibility(const EngineConfig &config)
|
||||||
{
|
|
||||||
if (!Engine<routing_algorithms::ch::Algorithm>::CheckCompability(config))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.use_shared_memory)
|
|
||||||
{
|
|
||||||
storage::SharedMonitor<storage::SharedDataTimestamp> barrier;
|
|
||||||
using mutex_type = typename decltype(barrier)::mutex_type;
|
|
||||||
boost::interprocess::scoped_lock<mutex_type> current_region_lock(barrier.get_mutex());
|
|
||||||
|
|
||||||
auto mem = storage::makeSharedMemory(barrier.data().region);
|
|
||||||
auto layout = reinterpret_cast<storage::DataLayout *>(mem->Ptr());
|
|
||||||
return layout->GetBlockSize(storage::DataLayout::CH_CORE_MARKER_0) >
|
|
||||||
sizeof(std::uint64_t) + sizeof(util::FingerPrint);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!boost::filesystem::exists(config.storage_config.GetPath(".osrm.core")))
|
|
||||||
return false;
|
|
||||||
storage::io::FileReader in(config.storage_config.GetPath(".osrm.core"),
|
|
||||||
storage::io::FileReader::VerifyFingerprint);
|
|
||||||
in.ReadElementCount64(); // number of core markers
|
|
||||||
const auto number_of_core_markers = in.ReadElementCount64();
|
|
||||||
|
|
||||||
return number_of_core_markers > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
bool Engine<routing_algorithms::mld::Algorithm>::CheckCompability(const EngineConfig &config)
|
|
||||||
{
|
{
|
||||||
if (config.use_shared_memory)
|
if (config.use_shared_memory)
|
||||||
{
|
{
|
||||||
@@ -203,11 +171,28 @@ bool Engine<routing_algorithms::mld::Algorithm>::CheckCompability(const EngineCo
|
|||||||
|
|
||||||
auto mem = storage::makeSharedMemory(barrier.data().region);
|
auto mem = storage::makeSharedMemory(barrier.data().region);
|
||||||
auto layout = reinterpret_cast<storage::DataLayout *>(mem->Ptr());
|
auto layout = reinterpret_cast<storage::DataLayout *>(mem->Ptr());
|
||||||
return layout->GetBlockSize(storage::DataLayout::MLD_PARTITION) > 0;
|
// checks that all the needed memory blocks are populated
|
||||||
|
// DataLayout::MLD_CELL_SOURCE_BOUNDARY and DataLayout::MLD_CELL_DESTINATION_BOUNDARY
|
||||||
|
// are not checked, because in situations where there are so few nodes in the graph that
|
||||||
|
// they all fit into one cell, they can be empty.
|
||||||
|
bool empty_data = layout->GetBlockSize(storage::DataLayout::MLD_LEVEL_DATA) > 0 &&
|
||||||
|
layout->GetBlockSize(storage::DataLayout::MLD_PARTITION) > 0 &&
|
||||||
|
layout->GetBlockSize(storage::DataLayout::MLD_CELL_TO_CHILDREN) > 0 &&
|
||||||
|
layout->GetBlockSize(storage::DataLayout::MLD_CELLS) > 0 &&
|
||||||
|
layout->GetBlockSize(storage::DataLayout::MLD_CELL_LEVEL_OFFSETS) > 0 &&
|
||||||
|
layout->GetBlockSize(storage::DataLayout::MLD_GRAPH_NODE_LIST) > 0 &&
|
||||||
|
layout->GetBlockSize(storage::DataLayout::MLD_GRAPH_EDGE_LIST) > 0 &&
|
||||||
|
layout->GetBlockSize(storage::DataLayout::MLD_CELL_WEIGHTS_0) > 0 &&
|
||||||
|
layout->GetBlockSize(storage::DataLayout::MLD_CELL_DURATIONS_0) > 0 &&
|
||||||
|
layout->GetBlockSize(storage::DataLayout::MLD_GRAPH_NODE_TO_OFFSET) > 0;
|
||||||
|
return empty_data;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!boost::filesystem::exists(config.storage_config.GetPath(".osrm.partition")))
|
if (!boost::filesystem::exists(config.storage_config.GetPath(".osrm.partition")) ||
|
||||||
|
!boost::filesystem::exists(config.storage_config.GetPath(".osrm.cells")) ||
|
||||||
|
!boost::filesystem::exists(config.storage_config.GetPath(".osrm.mldgr")) ||
|
||||||
|
!boost::filesystem::exists(config.storage_config.GetPath(".osrm.cell_metrics")))
|
||||||
return false;
|
return false;
|
||||||
storage::io::FileReader in(config.storage_config.GetPath(".osrm.partition"),
|
storage::io::FileReader in(config.storage_config.GetPath(".osrm.partition"),
|
||||||
storage::io::FileReader::VerifyFingerprint);
|
storage::io::FileReader::VerifyFingerprint);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
@@ -57,16 +57,14 @@ namespace engine
|
|||||||
*
|
*
|
||||||
* You can chose between three algorithms:
|
* You can chose between three algorithms:
|
||||||
* - Algorithm::CH
|
* - Algorithm::CH
|
||||||
* Contraction Hierarchies, extremely fast queries but slow pre-processing. The default right
|
* Contraction Hierarchies, extremely fast queries but slow pre-processing. The default right
|
||||||
* now.
|
* now.
|
||||||
* - Algorithm::CoreCH
|
* - Algorithm::CoreCH
|
||||||
* Contractoin Hierachies with partial contraction for faster pre-processing but slower queries.
|
* Deprecated, to be removed in v6.0
|
||||||
|
* Contraction Hierachies with partial contraction for faster pre-processing but slower
|
||||||
|
* queries.
|
||||||
* - Algorithm::MLD
|
* - Algorithm::MLD
|
||||||
* Multi Level Dijkstra which is experimental and moderately fast in both pre-processing and
|
* Multi Level Dijkstra, moderately fast in both pre-processing and query.
|
||||||
* query.
|
|
||||||
*
|
|
||||||
* Algorithm::CH is specified we will automatically upgrade to CoreCH if we find the data for it.
|
|
||||||
* If Algorithm::CoreCH is specified and we don't find the speedup data, we fail hard.
|
|
||||||
*
|
*
|
||||||
* \see OSRM, StorageConfig
|
* \see OSRM, StorageConfig
|
||||||
*/
|
*/
|
||||||
@@ -76,8 +74,8 @@ struct EngineConfig final
|
|||||||
|
|
||||||
enum class Algorithm
|
enum class Algorithm
|
||||||
{
|
{
|
||||||
CH, // will upgrade to CoreCH if it finds core data
|
CH,
|
||||||
CoreCH, // will fail hard if there is no core data
|
CoreCH, // Deprecated, will be removed in v6.0
|
||||||
MLD
|
MLD
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -90,6 +88,7 @@ struct EngineConfig final
|
|||||||
int max_alternatives = 3; // set an arbitrary upper bound; can be adjusted by user
|
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;
|
||||||
|
std::string verbosity;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -650,7 +650,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
bool input_coordinate_is_at_right = !util::coordinate_calculation::isCCW(
|
bool input_coordinate_is_at_right = !util::coordinate_calculation::isCCW(
|
||||||
coordinates[segment.data.u], coordinates[segment.data.v], input_coordinate);
|
coordinates[segment.data.u], coordinates[segment.data.v], input_coordinate);
|
||||||
|
|
||||||
if (datafacade.IsLeftHandDriving())
|
if (datafacade.IsLeftHandDriving(segment.data.forward_segment_id.id))
|
||||||
input_coordinate_is_at_right = !input_coordinate_is_at_right;
|
input_coordinate_is_at_right = !input_coordinate_is_at_right;
|
||||||
|
|
||||||
return std::make_pair(input_coordinate_is_at_right, (!input_coordinate_is_at_right));
|
return std::make_pair(input_coordinate_is_at_right, (!input_coordinate_is_at_right));
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "extractor/guidance/turn_instruction.hpp"
|
#include "extractor/guidance/turn_instruction.hpp"
|
||||||
#include "engine/guidance/route_step.hpp"
|
#include "engine/guidance/route_step.hpp"
|
||||||
#include "util/attributes.hpp"
|
#include "util/attributes.hpp"
|
||||||
|
#include "util/bearing.hpp"
|
||||||
#include "util/guidance/name_announcements.hpp"
|
#include "util/guidance/name_announcements.hpp"
|
||||||
|
|
||||||
#include <boost/range/algorithm_ext/erase.hpp>
|
#include <boost/range/algorithm_ext/erase.hpp>
|
||||||
@@ -189,6 +190,27 @@ inline std::vector<RouteStep> removeNoTurnInstructions(std::vector<RouteStep> st
|
|||||||
return steps;
|
return steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline double totalTurnAngle(const RouteStep &entry_step, const RouteStep &exit_step)
|
||||||
|
{
|
||||||
|
if (entry_step.geometry_begin > exit_step.geometry_begin)
|
||||||
|
return totalTurnAngle(exit_step, entry_step);
|
||||||
|
|
||||||
|
const auto exit_intersection = exit_step.intersections.front();
|
||||||
|
const auto entry_intersection = entry_step.intersections.front();
|
||||||
|
if ((exit_intersection.out >= exit_intersection.bearings.size()) ||
|
||||||
|
(entry_intersection.in >= entry_intersection.bearings.size()))
|
||||||
|
return entry_intersection.bearings[entry_intersection.out];
|
||||||
|
|
||||||
|
const auto exit_step_exit_bearing = exit_intersection.bearings[exit_intersection.out];
|
||||||
|
const auto entry_step_entry_bearing =
|
||||||
|
util::bearing::reverse(entry_intersection.bearings[entry_intersection.in]);
|
||||||
|
|
||||||
|
const double total_angle =
|
||||||
|
util::bearing::angleBetween(entry_step_entry_bearing, exit_step_exit_bearing);
|
||||||
|
|
||||||
|
return total_angle;
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace guidance */
|
} /* namespace guidance */
|
||||||
} /* namespace engine */
|
} /* namespace engine */
|
||||||
} /* namespace osrm */
|
} /* namespace osrm */
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
@@ -181,8 +181,7 @@ struct PhantomNode
|
|||||||
unsigned short is_valid_forward_target : 1;
|
unsigned short is_valid_forward_target : 1;
|
||||||
unsigned short is_valid_reverse_source : 1;
|
unsigned short is_valid_reverse_source : 1;
|
||||||
unsigned short is_valid_reverse_target : 1;
|
unsigned short is_valid_reverse_target : 1;
|
||||||
unsigned short bearing : 9;
|
unsigned short bearing : 12;
|
||||||
unsigned short : 3; // Unused padding out to 16 bits (2 bytes)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(PhantomNode) == 64, "PhantomNode has more padding then expected");
|
static_assert(sizeof(PhantomNode) == 64, "PhantomNode has more padding then expected");
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class RoutingAlgorithmsInterface
|
|||||||
virtual InternalRouteResult
|
virtual InternalRouteResult
|
||||||
DirectShortestPathSearch(const PhantomNodes &phantom_node_pair) const = 0;
|
DirectShortestPathSearch(const PhantomNodes &phantom_node_pair) const = 0;
|
||||||
|
|
||||||
virtual std::vector<EdgeWeight>
|
virtual std::vector<EdgeDuration>
|
||||||
ManyToManySearch(const std::vector<PhantomNode> &phantom_nodes,
|
ManyToManySearch(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 = 0;
|
const std::vector<std::size_t> &target_indices) const = 0;
|
||||||
@@ -81,7 +81,7 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
|
|||||||
InternalRouteResult
|
InternalRouteResult
|
||||||
DirectShortestPathSearch(const PhantomNodes &phantom_nodes) const final override;
|
DirectShortestPathSearch(const PhantomNodes &phantom_nodes) const final override;
|
||||||
|
|
||||||
std::vector<EdgeWeight>
|
std::vector<EdgeDuration>
|
||||||
ManyToManySearch(const std::vector<PhantomNode> &phantom_nodes,
|
ManyToManySearch(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 final override;
|
const std::vector<std::size_t> &target_indices) const final override;
|
||||||
@@ -166,16 +166,6 @@ RoutingAlgorithms<Algorithm>::DirectShortestPathSearch(const PhantomNodes &phant
|
|||||||
return routing_algorithms::directShortestPathSearch(heaps, *facade, phantom_nodes);
|
return routing_algorithms::directShortestPathSearch(heaps, *facade, phantom_nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Algorithm>
|
|
||||||
std::vector<EdgeWeight>
|
|
||||||
RoutingAlgorithms<Algorithm>::ManyToManySearch(const std::vector<PhantomNode> &phantom_nodes,
|
|
||||||
const std::vector<std::size_t> &source_indices,
|
|
||||||
const std::vector<std::size_t> &target_indices) const
|
|
||||||
{
|
|
||||||
return routing_algorithms::manyToManySearch(
|
|
||||||
heaps, *facade, phantom_nodes, source_indices, target_indices);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Algorithm>
|
template <typename Algorithm>
|
||||||
inline routing_algorithms::SubMatchingList RoutingAlgorithms<Algorithm>::MapMatching(
|
inline routing_algorithms::SubMatchingList RoutingAlgorithms<Algorithm>::MapMatching(
|
||||||
const routing_algorithms::CandidateLists &candidates_list,
|
const routing_algorithms::CandidateLists &candidates_list,
|
||||||
@@ -193,6 +183,32 @@ inline routing_algorithms::SubMatchingList RoutingAlgorithms<Algorithm>::MapMatc
|
|||||||
allow_splitting);
|
allow_splitting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Algorithm>
|
||||||
|
std::vector<EdgeDuration> RoutingAlgorithms<Algorithm>::ManyToManySearch(
|
||||||
|
const std::vector<PhantomNode> &phantom_nodes,
|
||||||
|
const std::vector<std::size_t> &_source_indices,
|
||||||
|
const std::vector<std::size_t> &_target_indices) const
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(!phantom_nodes.empty());
|
||||||
|
|
||||||
|
auto source_indices = _source_indices;
|
||||||
|
auto target_indices = _target_indices;
|
||||||
|
|
||||||
|
if (source_indices.empty())
|
||||||
|
{
|
||||||
|
source_indices.resize(phantom_nodes.size());
|
||||||
|
std::iota(source_indices.begin(), source_indices.end(), 0);
|
||||||
|
}
|
||||||
|
if (target_indices.empty())
|
||||||
|
{
|
||||||
|
target_indices.resize(phantom_nodes.size());
|
||||||
|
std::iota(target_indices.begin(), target_indices.end(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return routing_algorithms::manyToManySearch(
|
||||||
|
heaps, *facade, phantom_nodes, std::move(source_indices), std::move(target_indices));
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Algorithm>
|
template <typename Algorithm>
|
||||||
inline std::vector<routing_algorithms::TurnData> RoutingAlgorithms<Algorithm>::GetTileTurns(
|
inline std::vector<routing_algorithms::TurnData> RoutingAlgorithms<Algorithm>::GetTileTurns(
|
||||||
const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &edges,
|
const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &edges,
|
||||||
@@ -201,24 +217,6 @@ inline std::vector<routing_algorithms::TurnData> RoutingAlgorithms<Algorithm>::G
|
|||||||
return routing_algorithms::getTileTurns(*facade, edges, sorted_edge_indexes);
|
return routing_algorithms::getTileTurns(*facade, edges, sorted_edge_indexes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CoreCH overrides
|
|
||||||
template <>
|
|
||||||
InternalManyRoutesResult inline RoutingAlgorithms<
|
|
||||||
routing_algorithms::corech::Algorithm>::AlternativePathSearch(const PhantomNodes &,
|
|
||||||
unsigned) const
|
|
||||||
{
|
|
||||||
throw util::exception("AlternativePathSearch is disabled due to performance reasons");
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
inline std::vector<EdgeWeight>
|
|
||||||
RoutingAlgorithms<routing_algorithms::corech::Algorithm>::ManyToManySearch(
|
|
||||||
const std::vector<PhantomNode> &,
|
|
||||||
const std::vector<std::size_t> &,
|
|
||||||
const std::vector<std::size_t> &) const
|
|
||||||
{
|
|
||||||
throw util::exception("ManyToManySearch is disabled due to performance reasons");
|
|
||||||
}
|
|
||||||
} // ns engine
|
} // ns engine
|
||||||
} // ns osrm
|
} // ns osrm
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ namespace engine
|
|||||||
namespace routing_algorithms
|
namespace routing_algorithms
|
||||||
{
|
{
|
||||||
|
|
||||||
/// This is a striped down version of the general shortest path algorithm.
|
/// This is a stripped down version of the general shortest path algorithm.
|
||||||
/// The general algorithm always computes two queries for each leg. This is only
|
/// The general algorithm always computes two queries for each leg. This is only
|
||||||
/// necessary in case of vias, where the directions of the start node is constrainted
|
/// necessary in case of vias, where the directions of the start node is constrained
|
||||||
/// 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 optimization for graphs with slow queries, for example
|
||||||
/// not fully contracted graphs.
|
/// not fully contracted graphs.
|
||||||
template <typename Algorithm>
|
template <typename Algorithm>
|
||||||
InternalRouteResult directShortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
|
InternalRouteResult directShortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
|
||||||
|
|||||||
@@ -16,12 +16,45 @@ namespace engine
|
|||||||
namespace routing_algorithms
|
namespace routing_algorithms
|
||||||
{
|
{
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
struct NodeBucket
|
||||||
|
{
|
||||||
|
NodeID middle_node;
|
||||||
|
unsigned column_index; // a column in the weight/duration matrix
|
||||||
|
EdgeWeight weight;
|
||||||
|
EdgeDuration duration;
|
||||||
|
|
||||||
|
NodeBucket(NodeID middle_node, unsigned column_index, EdgeWeight weight, EdgeDuration duration)
|
||||||
|
: middle_node(middle_node), column_index(column_index), weight(weight), duration(duration)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// partial order comparison
|
||||||
|
bool operator<(const NodeBucket &rhs) const { return middle_node < rhs.middle_node; }
|
||||||
|
|
||||||
|
// functor for equal_range
|
||||||
|
struct Compare
|
||||||
|
{
|
||||||
|
bool operator()(const NodeBucket &lhs, const NodeID &rhs) const
|
||||||
|
{
|
||||||
|
return lhs.middle_node < rhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator()(const NodeID &lhs, const NodeBucket &rhs) const
|
||||||
|
{
|
||||||
|
return lhs < rhs.middle_node;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Algorithm>
|
template <typename Algorithm>
|
||||||
std::vector<EdgeWeight> manyToManySearch(SearchEngineData<Algorithm> &engine_working_data,
|
std::vector<EdgeDuration> manyToManySearch(SearchEngineData<Algorithm> &engine_working_data,
|
||||||
const DataFacade<Algorithm> &facade,
|
const DataFacade<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 routing_algorithms
|
} // namespace routing_algorithms
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|||||||
@@ -375,52 +375,6 @@ double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
|
|||||||
int duration_upper_bound = INVALID_EDGE_WEIGHT);
|
int duration_upper_bound = INVALID_EDGE_WEIGHT);
|
||||||
|
|
||||||
} // namespace ch
|
} // namespace ch
|
||||||
|
|
||||||
namespace corech
|
|
||||||
{
|
|
||||||
// assumes that heaps are already setup correctly.
|
|
||||||
// A forced loop might be necessary, if source and target are on the same segment.
|
|
||||||
// If this is the case and the offsets of the respective direction are larger for the source
|
|
||||||
// than the target
|
|
||||||
// then a force loop is required (e.g. source_phantom.forward_segment_id ==
|
|
||||||
// target_phantom.forward_segment_id
|
|
||||||
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
|
|
||||||
// requires
|
|
||||||
// a force loop, if the heaps have been initialized with positive offsets.
|
|
||||||
void search(SearchEngineData<Algorithm> &engine_working_data,
|
|
||||||
const DataFacade<corech::Algorithm> &facade,
|
|
||||||
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
|
|
||||||
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
|
|
||||||
int &weight,
|
|
||||||
std::vector<NodeID> &packed_leg,
|
|
||||||
const bool force_loop_forward,
|
|
||||||
const bool force_loop_reverse,
|
|
||||||
const PhantomNodes &phantom_nodes,
|
|
||||||
int duration_upper_bound = INVALID_EDGE_WEIGHT);
|
|
||||||
|
|
||||||
// Requires the heaps for be empty
|
|
||||||
// If heaps should be adjusted to be initialized outside of this function,
|
|
||||||
// the addition of force_loop parameters might be required
|
|
||||||
double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
|
|
||||||
const DataFacade<corech::Algorithm> &facade,
|
|
||||||
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
|
|
||||||
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
|
|
||||||
const PhantomNode &source_phantom,
|
|
||||||
const PhantomNode &target_phantom,
|
|
||||||
int duration_upper_bound = INVALID_EDGE_WEIGHT);
|
|
||||||
|
|
||||||
template <typename RandomIter, typename FacadeT>
|
|
||||||
void unpackPath(const FacadeT &facade,
|
|
||||||
RandomIter packed_path_begin,
|
|
||||||
RandomIter packed_path_end,
|
|
||||||
const PhantomNodes &phantom_nodes,
|
|
||||||
std::vector<PathData> &unpacked_path)
|
|
||||||
{
|
|
||||||
return ch::unpackPath(facade, packed_path_begin, packed_path_end, phantom_nodes, unpacked_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace corech
|
|
||||||
|
|
||||||
} // namespace routing_algorithms
|
} // namespace routing_algorithms
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|||||||
@@ -132,44 +132,16 @@ retrievePackedPathFromHeap(const SearchEngineData<Algorithm>::QueryHeap &forward
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <bool DIRECTION, typename Algorithm, typename... Args>
|
template <bool DIRECTION, typename Algorithm, typename... Args>
|
||||||
void routingStep(const DataFacade<Algorithm> &facade,
|
void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
||||||
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||||
typename SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
const NodeID node,
|
||||||
NodeID &middle_node,
|
const EdgeWeight weight,
|
||||||
EdgeWeight &path_upper_bound,
|
Args... args)
|
||||||
const bool force_loop_forward,
|
|
||||||
const bool force_loop_reverse,
|
|
||||||
Args... args)
|
|
||||||
{
|
{
|
||||||
const auto &partition = facade.GetMultiLevelPartition();
|
const auto &partition = facade.GetMultiLevelPartition();
|
||||||
const auto &cells = facade.GetCellStorage();
|
const auto &cells = facade.GetCellStorage();
|
||||||
const auto &metric = facade.GetCellMetric();
|
const auto &metric = facade.GetCellMetric();
|
||||||
|
|
||||||
const auto node = forward_heap.DeleteMin();
|
|
||||||
const auto weight = forward_heap.GetKey(node);
|
|
||||||
|
|
||||||
BOOST_ASSERT(!facade.ExcludeNode(node));
|
|
||||||
|
|
||||||
// Upper bound for the path source -> target with
|
|
||||||
// weight(source -> node) = weight weight(to -> target) ≤ reverse_weight
|
|
||||||
// is weight + reverse_weight
|
|
||||||
// More tighter upper bound requires additional condition reverse_heap.WasRemoved(to)
|
|
||||||
// with weight(to -> target) = reverse_weight and all weights ≥ 0
|
|
||||||
if (reverse_heap.WasInserted(node))
|
|
||||||
{
|
|
||||||
auto reverse_weight = reverse_heap.GetKey(node);
|
|
||||||
auto path_weight = weight + reverse_weight;
|
|
||||||
|
|
||||||
// if loops are forced, they are so at the source
|
|
||||||
if (!(force_loop_forward && forward_heap.GetData(node).parent == node) &&
|
|
||||||
!(force_loop_reverse && reverse_heap.GetData(node).parent == node) &&
|
|
||||||
(path_weight >= 0) && (path_weight < path_upper_bound))
|
|
||||||
{
|
|
||||||
middle_node = node;
|
|
||||||
path_upper_bound = path_weight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto level = getNodeQueryLevel(partition, node, args...);
|
const auto level = getNodeQueryLevel(partition, node, args...);
|
||||||
|
|
||||||
if (level >= 1 && !forward_heap.GetData(node).from_clique_arc)
|
if (level >= 1 && !forward_heap.GetData(node).from_clique_arc)
|
||||||
@@ -258,6 +230,46 @@ void routingStep(const DataFacade<Algorithm> &facade,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <bool DIRECTION, typename Algorithm, typename... Args>
|
||||||
|
void routingStep(const DataFacade<Algorithm> &facade,
|
||||||
|
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||||
|
typename SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||||
|
NodeID &middle_node,
|
||||||
|
EdgeWeight &path_upper_bound,
|
||||||
|
const bool force_loop_forward,
|
||||||
|
const bool force_loop_reverse,
|
||||||
|
Args... args)
|
||||||
|
{
|
||||||
|
const auto node = forward_heap.DeleteMin();
|
||||||
|
const auto weight = forward_heap.GetKey(node);
|
||||||
|
|
||||||
|
BOOST_ASSERT(!facade.ExcludeNode(node));
|
||||||
|
|
||||||
|
// Upper bound for the path source -> target with
|
||||||
|
// weight(source -> node) = weight weight(to -> target) ≤ reverse_weight
|
||||||
|
// is weight + reverse_weight
|
||||||
|
// More tighter upper bound requires additional condition reverse_heap.WasRemoved(to)
|
||||||
|
// with weight(to -> target) = reverse_weight and all weights ≥ 0
|
||||||
|
if (reverse_heap.WasInserted(node))
|
||||||
|
{
|
||||||
|
auto reverse_weight = reverse_heap.GetKey(node);
|
||||||
|
auto path_weight = weight + reverse_weight;
|
||||||
|
|
||||||
|
// MLD uses loops forcing only to prune single node paths in forward and/or
|
||||||
|
// backward direction (there is no need to force loops in MLD but in CH)
|
||||||
|
if (!(force_loop_forward && forward_heap.GetData(node).parent == node) &&
|
||||||
|
!(force_loop_reverse && reverse_heap.GetData(node).parent == node) &&
|
||||||
|
(path_weight >= 0) && (path_weight < path_upper_bound))
|
||||||
|
{
|
||||||
|
middle_node = node;
|
||||||
|
path_upper_bound = path_weight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Relax outgoing edges from node
|
||||||
|
relaxOutgoingEdges<DIRECTION>(facade, forward_heap, node, weight, args...);
|
||||||
|
}
|
||||||
|
|
||||||
// With (s, middle, t) we trace back the paths middle -> s and middle -> t.
|
// 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,
|
// 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
|
// and overlay node ids otherwise. We then have to unpack the overlay clique
|
||||||
|
|||||||
@@ -64,12 +64,6 @@ template <> struct SearchEngineData<routing_algorithms::ch::Algorithm>
|
|||||||
void InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes);
|
void InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
|
||||||
struct SearchEngineData<routing_algorithms::corech::Algorithm>
|
|
||||||
: public SearchEngineData<routing_algorithms::ch::Algorithm>
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MultiLayerDijkstraHeapData
|
struct MultiLayerDijkstraHeapData
|
||||||
{
|
{
|
||||||
NodeID parent;
|
NodeID parent;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
#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/original_edge_data.hpp"
|
#include "extractor/original_edge_data.hpp"
|
||||||
#include "extractor/packed_osm_ids.hpp"
|
|
||||||
#include "extractor/profile_properties.hpp"
|
|
||||||
#include "extractor/query_node.hpp"
|
#include "extractor/query_node.hpp"
|
||||||
#include "extractor/restriction_index.hpp"
|
#include "extractor/restriction_index.hpp"
|
||||||
#include "extractor/way_restriction_map.hpp"
|
#include "extractor/way_restriction_map.hpp"
|
||||||
@@ -26,7 +24,6 @@
|
|||||||
#include "util/guidance/entry_class.hpp"
|
#include "util/guidance/entry_class.hpp"
|
||||||
#include "util/name_table.hpp"
|
#include "util/name_table.hpp"
|
||||||
#include "util/node_based_graph.hpp"
|
#include "util/node_based_graph.hpp"
|
||||||
#include "util/packed_vector.hpp"
|
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
|
|
||||||
#include "storage/io.hpp"
|
#include "storage/io.hpp"
|
||||||
@@ -71,13 +68,12 @@ class EdgeBasedGraphFactory
|
|||||||
EdgeBasedGraphFactory(const EdgeBasedGraphFactory &) = delete;
|
EdgeBasedGraphFactory(const EdgeBasedGraphFactory &) = delete;
|
||||||
EdgeBasedGraphFactory &operator=(const EdgeBasedGraphFactory &) = delete;
|
EdgeBasedGraphFactory &operator=(const EdgeBasedGraphFactory &) = delete;
|
||||||
|
|
||||||
explicit EdgeBasedGraphFactory(std::shared_ptr<util::NodeBasedDynamicGraph> node_based_graph,
|
explicit EdgeBasedGraphFactory(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
CompressedEdgeContainer &compressed_edge_container,
|
EdgeBasedNodeDataContainer &node_data_container,
|
||||||
|
const CompressedEdgeContainer &compressed_edge_container,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const std::unordered_set<NodeID> &traffic_lights,
|
const std::unordered_set<NodeID> &traffic_lights,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const extractor::PackedOSMIDs &osm_node_ids,
|
|
||||||
ProfileProperties profile_properties,
|
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
guidance::LaneDescriptionMap &lane_description_map);
|
guidance::LaneDescriptionMap &lane_description_map);
|
||||||
|
|
||||||
@@ -95,7 +91,6 @@ class EdgeBasedGraphFactory
|
|||||||
|
|
||||||
// The following get access functions destroy the content in the factory
|
// The following get access functions destroy the content in the factory
|
||||||
void GetEdgeBasedEdges(util::DeallocatingVector<EdgeBasedEdge> &edges);
|
void GetEdgeBasedEdges(util::DeallocatingVector<EdgeBasedEdge> &edges);
|
||||||
void GetEdgeBasedNodes(EdgeBasedNodeDataContainer &data_container);
|
|
||||||
void GetEdgeBasedNodeSegments(std::vector<EdgeBasedNodeSegment> &nodes);
|
void GetEdgeBasedNodeSegments(std::vector<EdgeBasedNodeSegment> &nodes);
|
||||||
void GetStartPointMarkers(std::vector<bool> &node_is_startpoint);
|
void GetStartPointMarkers(std::vector<bool> &node_is_startpoint);
|
||||||
void GetEdgeBasedNodeWeights(std::vector<EdgeWeight> &output_node_weights);
|
void GetEdgeBasedNodeWeights(std::vector<EdgeWeight> &output_node_weights);
|
||||||
@@ -144,7 +139,7 @@ class EdgeBasedGraphFactory
|
|||||||
|
|
||||||
//! list of edge based nodes (compressed segments)
|
//! list of edge based nodes (compressed segments)
|
||||||
std::vector<EdgeBasedNodeSegment> m_edge_based_node_segments;
|
std::vector<EdgeBasedNodeSegment> m_edge_based_node_segments;
|
||||||
EdgeBasedNodeDataContainer m_edge_based_node_container;
|
EdgeBasedNodeDataContainer &m_edge_based_node_container;
|
||||||
util::DeallocatingVector<EdgeBasedEdge> m_edge_based_edge_list;
|
util::DeallocatingVector<EdgeBasedEdge> m_edge_based_edge_list;
|
||||||
|
|
||||||
// The number of edge-based nodes is mostly made up out of the edges in the node-based graph.
|
// The number of edge-based nodes is mostly made up out of the edges in the node-based graph.
|
||||||
@@ -155,19 +150,20 @@ class EdgeBasedGraphFactory
|
|||||||
std::uint64_t m_number_of_edge_based_nodes;
|
std::uint64_t m_number_of_edge_based_nodes;
|
||||||
|
|
||||||
const std::vector<util::Coordinate> &m_coordinates;
|
const std::vector<util::Coordinate> &m_coordinates;
|
||||||
const extractor::PackedOSMIDs &m_osm_node_ids;
|
const util::NodeBasedDynamicGraph &m_node_based_graph;
|
||||||
std::shared_ptr<util::NodeBasedDynamicGraph> m_node_based_graph;
|
|
||||||
|
|
||||||
const std::unordered_set<NodeID> &m_barrier_nodes;
|
const std::unordered_set<NodeID> &m_barrier_nodes;
|
||||||
const std::unordered_set<NodeID> &m_traffic_lights;
|
const std::unordered_set<NodeID> &m_traffic_lights;
|
||||||
CompressedEdgeContainer &m_compressed_edge_container;
|
const CompressedEdgeContainer &m_compressed_edge_container;
|
||||||
|
|
||||||
ProfileProperties profile_properties;
|
|
||||||
|
|
||||||
const util::NameTable &name_table;
|
const util::NameTable &name_table;
|
||||||
guidance::LaneDescriptionMap &lane_description_map;
|
guidance::LaneDescriptionMap &lane_description_map;
|
||||||
|
|
||||||
unsigned RenumberEdges();
|
// In the edge based graph, any traversable (non reversed) edge of the node-based graph forms a
|
||||||
|
// node of the edge-based graph. To be able to name these nodes, we loop over the node-based
|
||||||
|
// graph and create a mapping from edges (node-based) to nodes (edge-based). The mapping is
|
||||||
|
// essentially a prefix-sum over all previous non-reversed edges of the node-based graph.
|
||||||
|
unsigned LabelEdgeBasedNodes();
|
||||||
|
|
||||||
// During the generation of the edge-expanded nodes, we need to also generate duplicates that
|
// During the generation of the edge-expanded nodes, we need to also generate duplicates that
|
||||||
// represent state during via-way restrictions (see
|
// represent state during via-way restrictions (see
|
||||||
@@ -194,6 +190,8 @@ class EdgeBasedGraphFactory
|
|||||||
std::size_t skipped_uturns_counter;
|
std::size_t skipped_uturns_counter;
|
||||||
std::size_t skipped_barrier_turns_counter;
|
std::size_t skipped_barrier_turns_counter;
|
||||||
|
|
||||||
|
// mapping of node-based edges to edge-based nodes
|
||||||
|
std::vector<NodeID> nbe_to_ebn_mapping;
|
||||||
util::ConcurrentIDMap<util::guidance::BearingClass, BearingClassID> bearing_class_hash;
|
util::ConcurrentIDMap<util::guidance::BearingClass, BearingClassID> bearing_class_hash;
|
||||||
std::vector<BearingClassID> bearing_class_by_node_based_node;
|
std::vector<BearingClassID> bearing_class_by_node_based_node;
|
||||||
util::ConcurrentIDMap<util::guidance::EntryClass, EntryClassID> entry_class_hash;
|
util::ConcurrentIDMap<util::guidance::EntryClass, EntryClassID> entry_class_hash;
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#ifndef OSRM_EXTRACTOR_EDGE_BASED_NODE_HPP_
|
||||||
|
#define OSRM_EXTRACTOR_EDGE_BASED_NODE_HPP_
|
||||||
|
|
||||||
|
#include "util/typedefs.hpp"
|
||||||
|
|
||||||
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace extractor
|
||||||
|
{
|
||||||
|
|
||||||
|
struct EdgeBasedNode
|
||||||
|
{
|
||||||
|
GeometryID geometry_id;
|
||||||
|
ComponentID component_id;
|
||||||
|
AnnotationID annotation_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace extractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
|
#endif // OSRM_EXTRACTOR_EDGE_BASED_NODE_HPP_
|
||||||
@@ -28,12 +28,14 @@ class ExtractionContainers
|
|||||||
|
|
||||||
void WriteNodes(storage::io::FileWriter &file_out) const;
|
void WriteNodes(storage::io::FileWriter &file_out) const;
|
||||||
void WriteEdges(storage::io::FileWriter &file_out) const;
|
void WriteEdges(storage::io::FileWriter &file_out) const;
|
||||||
|
void WriteMetadata(storage::io::FileWriter &file_out) const;
|
||||||
void WriteCharData(const std::string &file_name);
|
void WriteCharData(const std::string &file_name);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using NodeIDVector = std::vector<OSMNodeID>;
|
using NodeIDVector = std::vector<OSMNodeID>;
|
||||||
using NodeVector = std::vector<QueryNode>;
|
using NodeVector = std::vector<QueryNode>;
|
||||||
using EdgeVector = std::vector<InternalExtractorEdge>;
|
using EdgeVector = std::vector<InternalExtractorEdge>;
|
||||||
|
using AnnotationDataVector = std::vector<NodeBasedEdgeAnnotation>;
|
||||||
using WayIDStartEndVector = std::vector<FirstAndLastSegmentOfWay>;
|
using WayIDStartEndVector = std::vector<FirstAndLastSegmentOfWay>;
|
||||||
using NameCharData = std::vector<unsigned char>;
|
using NameCharData = std::vector<unsigned char>;
|
||||||
using NameOffsets = std::vector<unsigned>;
|
using NameOffsets = std::vector<unsigned>;
|
||||||
@@ -43,6 +45,7 @@ class ExtractionContainers
|
|||||||
NodeIDVector used_node_id_list;
|
NodeIDVector used_node_id_list;
|
||||||
NodeVector all_nodes_list;
|
NodeVector all_nodes_list;
|
||||||
EdgeVector all_edges_list;
|
EdgeVector all_edges_list;
|
||||||
|
AnnotationDataVector all_edges_annotation_data_list;
|
||||||
NameCharData name_char_data;
|
NameCharData name_char_data;
|
||||||
NameOffsets name_offsets;
|
NameOffsets name_offsets;
|
||||||
// an adjacency array containing all turn lane masks
|
// an adjacency array containing all turn lane masks
|
||||||
|
|||||||
@@ -0,0 +1,201 @@
|
|||||||
|
#ifndef EXTRACTION_RELATION_HPP
|
||||||
|
#define EXTRACTION_RELATION_HPP
|
||||||
|
|
||||||
|
#include "util/exception.hpp"
|
||||||
|
|
||||||
|
#include <osmium/osm/relation.hpp>
|
||||||
|
|
||||||
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace extractor
|
||||||
|
{
|
||||||
|
|
||||||
|
struct ExtractionRelation
|
||||||
|
{
|
||||||
|
class OsmIDTyped
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OsmIDTyped(osmium::object_id_type _id, osmium::item_type _type) : id(_id), type(_type) {}
|
||||||
|
|
||||||
|
std::uint64_t GetID() const { return std::uint64_t(id); }
|
||||||
|
osmium::item_type GetType() const { return type; }
|
||||||
|
|
||||||
|
std::uint64_t Hash() const { return id ^ (static_cast<std::uint64_t>(type) << 56); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
osmium::object_id_type id;
|
||||||
|
osmium::item_type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
using AttributesList = std::vector<std::pair<std::string, std::string>>;
|
||||||
|
using MembersRolesList = std::vector<std::pair<std::uint64_t, std::string>>;
|
||||||
|
|
||||||
|
explicit ExtractionRelation(const OsmIDTyped &_id) : id(_id) {}
|
||||||
|
|
||||||
|
void Clear()
|
||||||
|
{
|
||||||
|
attributes.clear();
|
||||||
|
members_role.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *GetAttr(const std::string &attr) const
|
||||||
|
{
|
||||||
|
auto it = std::lower_bound(
|
||||||
|
attributes.begin(), attributes.end(), std::make_pair(attr, std::string()));
|
||||||
|
|
||||||
|
if (it != attributes.end() && (*it).first == attr)
|
||||||
|
return (*it).second.c_str();
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Prepare()
|
||||||
|
{
|
||||||
|
std::sort(attributes.begin(), attributes.end());
|
||||||
|
std::sort(members_role.begin(), members_role.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddMember(const OsmIDTyped &member_id, const char *role)
|
||||||
|
{
|
||||||
|
members_role.emplace_back(std::make_pair(member_id.Hash(), std::string(role)));
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *GetRole(const OsmIDTyped &member_id) const
|
||||||
|
{
|
||||||
|
const auto hash = member_id.Hash();
|
||||||
|
auto it = std::lower_bound(
|
||||||
|
members_role.begin(), members_role.end(), std::make_pair(hash, std::string()));
|
||||||
|
|
||||||
|
if (it != members_role.end() && (*it).first == hash)
|
||||||
|
return (*it).second.c_str();
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
OsmIDTyped id;
|
||||||
|
AttributesList attributes;
|
||||||
|
MembersRolesList members_role;
|
||||||
|
};
|
||||||
|
|
||||||
|
// It contains data of all parsed relations for each node/way element
|
||||||
|
class ExtractionRelationContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using AttributesMap = ExtractionRelation::AttributesList;
|
||||||
|
using OsmIDTyped = ExtractionRelation::OsmIDTyped;
|
||||||
|
using RelationList = std::vector<AttributesMap>;
|
||||||
|
using RelationIDList = std::vector<ExtractionRelation::OsmIDTyped>;
|
||||||
|
using RelationRefMap = std::unordered_map<std::uint64_t, RelationIDList>;
|
||||||
|
|
||||||
|
void AddRelation(ExtractionRelation &&rel)
|
||||||
|
{
|
||||||
|
rel.Prepare();
|
||||||
|
|
||||||
|
BOOST_ASSERT(relations_data.find(rel.id.GetID()) == relations_data.end());
|
||||||
|
relations_data.insert(std::make_pair(rel.id.GetID(), std::move(rel)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddRelationMember(const OsmIDTyped &relation_id, const OsmIDTyped &member_id)
|
||||||
|
{
|
||||||
|
switch (member_id.GetType())
|
||||||
|
{
|
||||||
|
case osmium::item_type::node:
|
||||||
|
node_refs[member_id.GetID()].push_back(relation_id);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case osmium::item_type::way:
|
||||||
|
way_refs[member_id.GetID()].push_back(relation_id);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case osmium::item_type::relation:
|
||||||
|
rel_refs[member_id.GetID()].push_back(relation_id);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
void Merge(ExtractionRelationContainer &&other)
|
||||||
|
{
|
||||||
|
for (auto it : other.relations_data)
|
||||||
|
{
|
||||||
|
const auto res = relations_data.insert(std::make_pair(it.first, std::move(it.second)));
|
||||||
|
BOOST_ASSERT(res.second);
|
||||||
|
(void)res; // prevent unused warning in release
|
||||||
|
}
|
||||||
|
|
||||||
|
auto MergeRefMap = [&](RelationRefMap &source, RelationRefMap &target) {
|
||||||
|
for (auto it : source)
|
||||||
|
{
|
||||||
|
auto &v = target[it.first];
|
||||||
|
v.insert(v.end(), it.second.begin(), it.second.end());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
MergeRefMap(other.way_refs, way_refs);
|
||||||
|
MergeRefMap(other.node_refs, node_refs);
|
||||||
|
MergeRefMap(other.rel_refs, rel_refs);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::size_t GetRelationsNum() const { return relations_data.size(); }
|
||||||
|
|
||||||
|
const RelationIDList &GetRelations(const OsmIDTyped &member_id) const
|
||||||
|
{
|
||||||
|
auto getFromMap = [this](std::uint64_t id,
|
||||||
|
const RelationRefMap &map) -> const RelationIDList & {
|
||||||
|
auto it = map.find(id);
|
||||||
|
if (it != map.end())
|
||||||
|
return it->second;
|
||||||
|
|
||||||
|
return empty_rel_list;
|
||||||
|
};
|
||||||
|
|
||||||
|
switch (member_id.GetType())
|
||||||
|
{
|
||||||
|
case osmium::item_type::node:
|
||||||
|
return getFromMap(member_id.GetID(), node_refs);
|
||||||
|
|
||||||
|
case osmium::item_type::way:
|
||||||
|
return getFromMap(member_id.GetID(), way_refs);
|
||||||
|
|
||||||
|
case osmium::item_type::relation:
|
||||||
|
return getFromMap(member_id.GetID(), rel_refs);
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return empty_rel_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ExtractionRelation &GetRelationData(const ExtractionRelation::OsmIDTyped &rel_id) const
|
||||||
|
{
|
||||||
|
auto it = relations_data.find(rel_id.GetID());
|
||||||
|
if (it == relations_data.end())
|
||||||
|
throw osrm::util::exception("Can't find relation data for " +
|
||||||
|
std::to_string(rel_id.GetID()));
|
||||||
|
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
RelationIDList empty_rel_list;
|
||||||
|
std::unordered_map<std::uint64_t, ExtractionRelation> relations_data;
|
||||||
|
|
||||||
|
// each map contains list of relation id's, that has keyed id as a member
|
||||||
|
RelationRefMap way_refs;
|
||||||
|
RelationRefMap node_refs;
|
||||||
|
RelationRefMap rel_refs;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace extractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
|
#endif // EXTRACTION_RELATION_HPP
|
||||||
@@ -14,19 +14,28 @@ namespace extractor
|
|||||||
|
|
||||||
struct ExtractionTurn
|
struct ExtractionTurn
|
||||||
{
|
{
|
||||||
ExtractionTurn(const guidance::ConnectedRoad &turn, bool has_traffic_light)
|
ExtractionTurn(const guidance::ConnectedRoad &turn,
|
||||||
|
bool has_traffic_light,
|
||||||
|
bool source_restricted,
|
||||||
|
bool target_restricted,
|
||||||
|
bool is_left_hand_driving)
|
||||||
: angle(180. - turn.angle), turn_type(turn.instruction.type),
|
: angle(180. - turn.angle), turn_type(turn.instruction.type),
|
||||||
direction_modifier(turn.instruction.direction_modifier),
|
direction_modifier(turn.instruction.direction_modifier),
|
||||||
has_traffic_light(has_traffic_light), weight(0.), duration(0.), source_restricted(false),
|
has_traffic_light(has_traffic_light), source_restricted(source_restricted),
|
||||||
target_restricted(false)
|
target_restricted(target_restricted), is_left_hand_driving(is_left_hand_driving),
|
||||||
|
weight(0.), duration(0.)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtractionTurn(const bool has_traffic_light = false)
|
ExtractionTurn(bool has_traffic_light,
|
||||||
|
bool source_restricted,
|
||||||
|
bool target_restricted,
|
||||||
|
bool is_left_hand_driving)
|
||||||
: angle(0), turn_type(guidance::TurnType::NoTurn),
|
: angle(0), turn_type(guidance::TurnType::NoTurn),
|
||||||
direction_modifier(guidance::DirectionModifier::Straight),
|
direction_modifier(guidance::DirectionModifier::Straight),
|
||||||
has_traffic_light(has_traffic_light), weight(0.), duration(0.), source_restricted(false),
|
has_traffic_light(has_traffic_light), source_restricted(source_restricted),
|
||||||
target_restricted(false)
|
target_restricted(target_restricted), is_left_hand_driving(is_left_hand_driving),
|
||||||
|
weight(0.), duration(0.)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,10 +43,12 @@ struct ExtractionTurn
|
|||||||
const guidance::TurnType::Enum turn_type;
|
const guidance::TurnType::Enum turn_type;
|
||||||
const guidance::DirectionModifier::Enum direction_modifier;
|
const guidance::DirectionModifier::Enum direction_modifier;
|
||||||
const bool has_traffic_light;
|
const bool has_traffic_light;
|
||||||
|
const bool source_restricted;
|
||||||
|
const bool target_restricted;
|
||||||
|
const bool is_left_hand_driving;
|
||||||
|
|
||||||
double weight;
|
double weight;
|
||||||
double duration;
|
double duration;
|
||||||
bool source_restricted;
|
|
||||||
bool target_restricted;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,28 +46,32 @@ struct ExtractionWay
|
|||||||
backward_rate = -1;
|
backward_rate = -1;
|
||||||
duration = -1;
|
duration = -1;
|
||||||
weight = -1;
|
weight = -1;
|
||||||
roundabout = false;
|
|
||||||
circular = false;
|
|
||||||
is_startpoint = true;
|
|
||||||
name.clear();
|
name.clear();
|
||||||
ref.clear();
|
forward_ref.clear();
|
||||||
|
backward_ref.clear();
|
||||||
pronunciation.clear();
|
pronunciation.clear();
|
||||||
destinations.clear();
|
destinations.clear();
|
||||||
exits.clear();
|
exits.clear();
|
||||||
forward_travel_mode = TRAVEL_MODE_INACCESSIBLE;
|
|
||||||
backward_travel_mode = TRAVEL_MODE_INACCESSIBLE;
|
|
||||||
turn_lanes_forward.clear();
|
turn_lanes_forward.clear();
|
||||||
turn_lanes_backward.clear();
|
turn_lanes_backward.clear();
|
||||||
road_classification = guidance::RoadClassification();
|
road_classification = guidance::RoadClassification();
|
||||||
backward_restricted = false;
|
forward_travel_mode = TRAVEL_MODE_INACCESSIBLE;
|
||||||
|
backward_travel_mode = TRAVEL_MODE_INACCESSIBLE;
|
||||||
|
roundabout = false;
|
||||||
|
circular = false;
|
||||||
|
is_startpoint = true;
|
||||||
forward_restricted = false;
|
forward_restricted = false;
|
||||||
|
backward_restricted = false;
|
||||||
|
is_left_hand_driving = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// wrappers to allow assigning nil (nullptr) to string values
|
// wrappers to allow assigning nil (nullptr) to string values
|
||||||
void SetName(const char *value) { detail::maybeSetString(name, value); }
|
void SetName(const char *value) { detail::maybeSetString(name, value); }
|
||||||
const char *GetName() const { return name.c_str(); }
|
const char *GetName() const { return name.c_str(); }
|
||||||
void SetRef(const char *value) { detail::maybeSetString(ref, value); }
|
void SetForwardRef(const char *value) { detail::maybeSetString(forward_ref, value); }
|
||||||
const char *GetRef() const { return ref.c_str(); }
|
const char *GetForwardRef() const { return forward_ref.c_str(); }
|
||||||
|
void SetBackwardRef(const char *value) { detail::maybeSetString(backward_ref, value); }
|
||||||
|
const char *GetBackwardRef() const { return backward_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); }
|
void SetExits(const char *value) { detail::maybeSetString(exits, value); }
|
||||||
@@ -100,7 +104,8 @@ struct ExtractionWay
|
|||||||
// weight of the whole way in both directions
|
// weight of the whole way in both directions
|
||||||
double weight;
|
double weight;
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string ref;
|
std::string forward_ref;
|
||||||
|
std::string backward_ref;
|
||||||
std::string pronunciation;
|
std::string pronunciation;
|
||||||
std::string destinations;
|
std::string destinations;
|
||||||
std::string exits;
|
std::string exits;
|
||||||
@@ -109,11 +114,15 @@ struct ExtractionWay
|
|||||||
guidance::RoadClassification road_classification;
|
guidance::RoadClassification road_classification;
|
||||||
TravelMode forward_travel_mode : 4;
|
TravelMode forward_travel_mode : 4;
|
||||||
TravelMode backward_travel_mode : 4;
|
TravelMode backward_travel_mode : 4;
|
||||||
|
|
||||||
|
// Boolean flags
|
||||||
bool roundabout : 1;
|
bool roundabout : 1;
|
||||||
bool circular : 1;
|
bool circular : 1;
|
||||||
bool is_startpoint : 1;
|
bool is_startpoint : 1;
|
||||||
bool forward_restricted : 1;
|
bool forward_restricted : 1;
|
||||||
bool backward_restricted : 1;
|
bool backward_restricted : 1;
|
||||||
|
bool is_left_hand_driving : 1;
|
||||||
|
bool : 2;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
@@ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "extractor/edge_based_graph_factory.hpp"
|
#include "extractor/edge_based_graph_factory.hpp"
|
||||||
#include "extractor/extractor_config.hpp"
|
#include "extractor/extractor_config.hpp"
|
||||||
#include "extractor/graph_compressor.hpp"
|
#include "extractor/graph_compressor.hpp"
|
||||||
|
#include "extractor/packed_osm_ids.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"
|
||||||
@@ -61,19 +62,27 @@ class Extractor
|
|||||||
std::vector<ConditionalTurnRestriction>>
|
std::vector<ConditionalTurnRestriction>>
|
||||||
ParseOSMData(ScriptingEnvironment &scripting_environment, const unsigned number_of_threads);
|
ParseOSMData(ScriptingEnvironment &scripting_environment, const unsigned number_of_threads);
|
||||||
|
|
||||||
std::pair<std::size_t, EdgeID>
|
EdgeID BuildEdgeExpandedGraph(
|
||||||
BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment,
|
// input data
|
||||||
std::vector<util::Coordinate> &coordinates,
|
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
extractor::PackedOSMIDs &osm_node_ids,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
EdgeBasedNodeDataContainer &edge_based_nodes_container,
|
const CompressedEdgeContainer &compressed_edge_container,
|
||||||
std::vector<EdgeBasedNodeSegment> &edge_based_node_segments,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
std::vector<bool> &node_is_startpoint,
|
const std::unordered_set<NodeID> &traffic_lights,
|
||||||
std::vector<EdgeWeight> &edge_based_node_weights,
|
const std::vector<TurnRestriction> &turn_restrictions,
|
||||||
util::DeallocatingVector<EdgeBasedEdge> &edge_based_edge_list,
|
const std::vector<ConditionalTurnRestriction> &conditional_turn_restrictions,
|
||||||
const std::string &intersection_class_output_file,
|
// might have to be updated to add new lane combinations
|
||||||
std::vector<TurnRestriction> &turn_restrictions,
|
guidance::LaneDescriptionMap &turn_lane_map,
|
||||||
std::vector<ConditionalTurnRestriction> &conditional_turn_restrictions,
|
// for calculating turn penalties
|
||||||
guidance::LaneDescriptionMap &turn_lane_map);
|
ScriptingEnvironment &scripting_environment,
|
||||||
|
// output data
|
||||||
|
EdgeBasedNodeDataContainer &edge_based_nodes_container,
|
||||||
|
std::vector<EdgeBasedNodeSegment> &edge_based_node_segments,
|
||||||
|
std::vector<bool> &node_is_startpoint,
|
||||||
|
std::vector<EdgeWeight> &edge_based_node_weights,
|
||||||
|
util::DeallocatingVector<EdgeBasedEdge> &edge_based_edge_list,
|
||||||
|
const std::string &intersection_class_output_file);
|
||||||
|
|
||||||
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,
|
||||||
@@ -82,11 +91,6 @@ class Extractor
|
|||||||
std::vector<bool> node_is_startpoint,
|
std::vector<bool> node_is_startpoint,
|
||||||
const std::vector<util::Coordinate> &coordinates);
|
const std::vector<util::Coordinate> &coordinates);
|
||||||
std::shared_ptr<RestrictionMap> LoadRestrictionMap();
|
std::shared_ptr<RestrictionMap> LoadRestrictionMap();
|
||||||
std::shared_ptr<util::NodeBasedDynamicGraph>
|
|
||||||
LoadNodeBasedGraph(std::unordered_set<NodeID> &barrier_nodes,
|
|
||||||
std::unordered_set<NodeID> &traffic_lights,
|
|
||||||
std::vector<util::Coordinate> &coordinates,
|
|
||||||
extractor::PackedOSMIDs &osm_node_ids);
|
|
||||||
|
|
||||||
// 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,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace osmium
|
|||||||
{
|
{
|
||||||
class Node;
|
class Node;
|
||||||
class Way;
|
class Way;
|
||||||
|
class Relation;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
@@ -44,6 +45,7 @@ namespace extractor
|
|||||||
class ExtractionContainers;
|
class ExtractionContainers;
|
||||||
struct ExtractionNode;
|
struct ExtractionNode;
|
||||||
struct ExtractionWay;
|
struct ExtractionWay;
|
||||||
|
struct ExtractionRelation;
|
||||||
struct ProfileProperties;
|
struct ProfileProperties;
|
||||||
struct InputConditionalTurnRestriction;
|
struct InputConditionalTurnRestriction;
|
||||||
|
|
||||||
@@ -61,7 +63,8 @@ class ExtractorCallbacks
|
|||||||
// actually maps to name ids
|
// actually maps to name 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, std::string>;
|
||||||
using MapVal = unsigned;
|
using MapVal = unsigned;
|
||||||
std::unordered_map<MapKey, MapVal> string_map;
|
using StringMap = std::unordered_map<MapKey, MapVal>;
|
||||||
|
StringMap string_map;
|
||||||
ExtractionContainers &external_memory;
|
ExtractionContainers &external_memory;
|
||||||
std::unordered_map<std::string, ClassData> &classes_map;
|
std::unordered_map<std::string, ClassData> &classes_map;
|
||||||
guidance::LaneDescriptionMap &lane_description_map;
|
guidance::LaneDescriptionMap &lane_description_map;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2016, Project OSRM contributors
|
Copyright (c) 2017, Project OSRM contributors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
@@ -68,7 +68,8 @@ struct ExtractorConfig final : storage::IOConfig
|
|||||||
".osrm.icd",
|
".osrm.icd",
|
||||||
".osrm.cnbg",
|
".osrm.cnbg",
|
||||||
".osrm.cnbg_to_ebg"}),
|
".osrm.cnbg_to_ebg"}),
|
||||||
requested_num_threads(0)
|
requested_num_threads(0),
|
||||||
|
use_locations_cache(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +80,7 @@ struct ExtractorConfig final : storage::IOConfig
|
|||||||
|
|
||||||
boost::filesystem::path input_path;
|
boost::filesystem::path input_path;
|
||||||
boost::filesystem::path profile_path;
|
boost::filesystem::path profile_path;
|
||||||
|
std::vector<boost::filesystem::path> location_dependent_data_paths;
|
||||||
|
|
||||||
unsigned requested_num_threads;
|
unsigned requested_num_threads;
|
||||||
unsigned small_component_size;
|
unsigned small_component_size;
|
||||||
@@ -87,6 +89,7 @@ struct ExtractorConfig final : storage::IOConfig
|
|||||||
|
|
||||||
bool use_metadata;
|
bool use_metadata;
|
||||||
bool parse_conditionals;
|
bool parse_conditionals;
|
||||||
|
bool use_locations_cache;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,27 +78,27 @@ inline void writeProfileProperties(const boost::filesystem::path &path,
|
|||||||
|
|
||||||
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 number_of_edge_based_nodes,
|
||||||
const EdgeBasedEdgeVector &edge_based_edge_list)
|
const EdgeBasedEdgeVector &edge_based_edge_list)
|
||||||
{
|
{
|
||||||
static_assert(std::is_same<typename EdgeBasedEdgeVector::value_type, EdgeBasedEdge>::value, "");
|
static_assert(std::is_same<typename EdgeBasedEdgeVector::value_type, EdgeBasedEdge>::value, "");
|
||||||
|
|
||||||
storage::io::FileWriter writer(path, storage::io::FileWriter::GenerateFingerprint);
|
storage::io::FileWriter writer(path, storage::io::FileWriter::GenerateFingerprint);
|
||||||
|
|
||||||
writer.WriteElementCount64(max_edge_id);
|
writer.WriteElementCount64(number_of_edge_based_nodes);
|
||||||
storage::serialization::write(writer, edge_based_edge_list);
|
storage::serialization::write(writer, edge_based_edge_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename EdgeBasedEdgeVector>
|
template <typename EdgeBasedEdgeVector>
|
||||||
void readEdgeBasedGraph(const boost::filesystem::path &path,
|
void readEdgeBasedGraph(const boost::filesystem::path &path,
|
||||||
EdgeID &max_edge_id,
|
EdgeID &number_of_edge_based_nodes,
|
||||||
EdgeBasedEdgeVector &edge_based_edge_list)
|
EdgeBasedEdgeVector &edge_based_edge_list)
|
||||||
{
|
{
|
||||||
static_assert(std::is_same<typename EdgeBasedEdgeVector::value_type, EdgeBasedEdge>::value, "");
|
static_assert(std::is_same<typename EdgeBasedEdgeVector::value_type, EdgeBasedEdge>::value, "");
|
||||||
|
|
||||||
storage::io::FileReader reader(path, storage::io::FileReader::VerifyFingerprint);
|
storage::io::FileReader reader(path, storage::io::FileReader::VerifyFingerprint);
|
||||||
|
|
||||||
max_edge_id = reader.ReadElementCount64();
|
number_of_edge_based_nodes = reader.ReadElementCount64();
|
||||||
storage::serialization::read(reader, edge_based_edge_list);
|
storage::serialization::read(reader, edge_based_edge_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class GraphCompressor
|
|||||||
std::vector<TurnRestriction> &turn_restrictions,
|
std::vector<TurnRestriction> &turn_restrictions,
|
||||||
std::vector<ConditionalTurnRestriction> &conditional_turn_restrictions,
|
std::vector<ConditionalTurnRestriction> &conditional_turn_restrictions,
|
||||||
util::NodeBasedDynamicGraph &graph,
|
util::NodeBasedDynamicGraph &graph,
|
||||||
|
const std::vector<NodeBasedEdgeAnnotation> &node_data_container,
|
||||||
CompressedEdgeContainer &geometry_compressor);
|
CompressedEdgeContainer &geometry_compressor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -153,6 +153,14 @@ class CoordinateExtractor
|
|||||||
const double length,
|
const double length,
|
||||||
const double rate) const;
|
const double rate) const;
|
||||||
|
|
||||||
|
// find the coordinate at a specific distance in the vector
|
||||||
|
util::Coordinate
|
||||||
|
ExtractCoordinateAtLength(const double distance,
|
||||||
|
const std::vector<util::Coordinate> &coordinates) const;
|
||||||
|
util::Coordinate ExtractCoordinateAtLength(const double distance,
|
||||||
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
|
const std::vector<double> &length_cache) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph;
|
const util::NodeBasedDynamicGraph &node_based_graph;
|
||||||
const extractor::CompressedEdgeContainer &compressed_geometries;
|
const extractor::CompressedEdgeContainer &compressed_geometries;
|
||||||
@@ -217,7 +225,7 @@ class CoordinateExtractor
|
|||||||
const std::vector<double> &segment_distances,
|
const std::vector<double> &segment_distances,
|
||||||
const double segment_length,
|
const double segment_length,
|
||||||
const double considered_lane_width,
|
const double considered_lane_width,
|
||||||
const util::NodeBasedEdgeData &edge_data) const;
|
const extractor::NodeBasedEdgeClassification &edge_data) const;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the very first coordinate is within lane offsets and the rest offers a near straight line,
|
* If the very first coordinate is within lane offsets and the rest offers a near straight line,
|
||||||
@@ -241,14 +249,6 @@ class CoordinateExtractor
|
|||||||
const double segment_length,
|
const double segment_length,
|
||||||
const std::vector<double> &segment_distances,
|
const std::vector<double> &segment_distances,
|
||||||
const std::uint8_t considered_lanes) const;
|
const std::uint8_t considered_lanes) const;
|
||||||
|
|
||||||
// find the coordinate at a specific location in the vector
|
|
||||||
util::Coordinate ExtractCoordinateAtLength(const double distance,
|
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
|
||||||
const std::vector<double> &length_cache) const;
|
|
||||||
util::Coordinate
|
|
||||||
ExtractCoordinateAtLength(const double distance,
|
|
||||||
const std::vector<util::Coordinate> &coordinates) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class DrivewayHandler final : public IntersectionHandler
|
|||||||
public:
|
public:
|
||||||
DrivewayHandler(const IntersectionGenerator &intersection_generator,
|
DrivewayHandler(const IntersectionGenerator &intersection_generator,
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph,
|
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table);
|
const SuffixTable &street_name_suffix_table);
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class IntersectionGenerator
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IntersectionGenerator(const util::NodeBasedDynamicGraph &node_based_graph,
|
IntersectionGenerator(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const RestrictionMap &restriction_map,
|
const RestrictionMap &restriction_map,
|
||||||
const std::unordered_set<NodeID> &barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
@@ -110,6 +111,7 @@ class IntersectionGenerator
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph;
|
const util::NodeBasedDynamicGraph &node_based_graph;
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container;
|
||||||
const RestrictionMap &restriction_map;
|
const RestrictionMap &restriction_map;
|
||||||
const std::unordered_set<NodeID> &barrier_nodes;
|
const std::unordered_set<NodeID> &barrier_nodes;
|
||||||
const std::vector<util::Coordinate> &coordinates;
|
const std::vector<util::Coordinate> &coordinates;
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class IntersectionHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IntersectionHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
IntersectionHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table,
|
const SuffixTable &street_name_suffix_table,
|
||||||
@@ -50,6 +51,7 @@ class IntersectionHandler
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph;
|
const util::NodeBasedDynamicGraph &node_based_graph;
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container;
|
||||||
const std::vector<util::Coordinate> &coordinates;
|
const std::vector<util::Coordinate> &coordinates;
|
||||||
const util::NameTable &name_table;
|
const util::NameTable &name_table;
|
||||||
const SuffixTable &street_name_suffix_table;
|
const SuffixTable &street_name_suffix_table;
|
||||||
@@ -124,7 +126,6 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
const IntersectionType &intersection) const
|
const IntersectionType &intersection) const
|
||||||
{
|
{
|
||||||
using Road = typename IntersectionType::value_type;
|
using Road = typename IntersectionType::value_type;
|
||||||
using EdgeData = osrm::util::NodeBasedDynamicGraph::EdgeData;
|
|
||||||
using osrm::util::angularDeviation;
|
using osrm::util::angularDeviation;
|
||||||
|
|
||||||
// no obvious road
|
// no obvious road
|
||||||
@@ -135,7 +136,8 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
if (intersection.size() == 2)
|
if (intersection.size() == 2)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
const EdgeData &in_way_data = node_based_graph.GetEdgeData(via_edge);
|
const auto &in_way_edge = node_based_graph.GetEdgeData(via_edge);
|
||||||
|
const auto &in_way_data = node_data_container.GetAnnotation(in_way_edge.annotation_data);
|
||||||
|
|
||||||
// the strategy for picking the most obvious turn involves deciding between
|
// the strategy for picking the most obvious turn involves deciding between
|
||||||
// an overall best candidate and a best candidate that shares the same name
|
// an overall best candidate and a best candidate that shares the same name
|
||||||
@@ -146,35 +148,35 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
double best_continue_deviation = 180;
|
double best_continue_deviation = 180;
|
||||||
|
|
||||||
/* helper functions */
|
/* helper functions */
|
||||||
const auto IsContinueRoad = [&](const EdgeData &way_data) {
|
const auto IsContinueRoad = [&](const NodeBasedEdgeAnnotation &way_data) {
|
||||||
return !util::guidance::requiresNameAnnounced(
|
return !util::guidance::requiresNameAnnounced(
|
||||||
in_way_data.name_id, way_data.name_id, name_table, street_name_suffix_table);
|
in_way_data.name_id, way_data.name_id, name_table, street_name_suffix_table);
|
||||||
};
|
};
|
||||||
auto sameOrHigherPriority = [&in_way_data](const auto &way_data) {
|
auto sameOrHigherPriority = [&](const auto &way_data) {
|
||||||
return way_data.road_classification.GetPriority() <=
|
return way_data.flags.road_classification.GetPriority() <=
|
||||||
in_way_data.road_classification.GetPriority();
|
in_way_edge.flags.road_classification.GetPriority();
|
||||||
};
|
};
|
||||||
auto IsLowPriority = [](const auto &way_data) {
|
auto IsLowPriority = [](const auto &way_data) {
|
||||||
return way_data.road_classification.IsLowPriorityRoadClass();
|
return way_data.flags.road_classification.IsLowPriorityRoadClass();
|
||||||
};
|
};
|
||||||
// These two Compare functions are used for sifting out best option and continue
|
// These two Compare functions are used for sifting out best option and continue
|
||||||
// candidates by evaluating all the ways in an intersection by what they share
|
// candidates by evaluating all the ways in an intersection by what they share
|
||||||
// with the in way. Ideal candidates are of similar road class with the in way
|
// with the in way. Ideal candidates are of similar road class with the in way
|
||||||
// and are require relatively straight turns.
|
// and are require relatively straight turns.
|
||||||
const auto RoadCompare = [&](const auto &lhs, const auto &rhs) {
|
const auto RoadCompare = [&](const auto &lhs, const auto &rhs) {
|
||||||
const EdgeData &lhs_data = node_based_graph.GetEdgeData(lhs.eid);
|
const auto &lhs_edge = node_based_graph.GetEdgeData(lhs.eid);
|
||||||
const EdgeData &rhs_data = node_based_graph.GetEdgeData(rhs.eid);
|
const auto &rhs_edge = node_based_graph.GetEdgeData(rhs.eid);
|
||||||
const auto lhs_deviation = angularDeviation(lhs.angle, STRAIGHT_ANGLE);
|
const auto lhs_deviation = angularDeviation(lhs.angle, STRAIGHT_ANGLE);
|
||||||
const auto rhs_deviation = angularDeviation(rhs.angle, STRAIGHT_ANGLE);
|
const auto rhs_deviation = angularDeviation(rhs.angle, STRAIGHT_ANGLE);
|
||||||
|
|
||||||
const bool rhs_same_classification =
|
const bool rhs_same_classification =
|
||||||
rhs_data.road_classification == in_way_data.road_classification;
|
rhs_edge.flags.road_classification == in_way_edge.flags.road_classification;
|
||||||
const bool lhs_same_classification =
|
const bool lhs_same_classification =
|
||||||
lhs_data.road_classification == in_way_data.road_classification;
|
lhs_edge.flags.road_classification == in_way_edge.flags.road_classification;
|
||||||
const bool rhs_same_or_higher_priority = sameOrHigherPriority(rhs_data);
|
const bool rhs_same_or_higher_priority = sameOrHigherPriority(rhs_edge);
|
||||||
const bool rhs_low_priority = IsLowPriority(rhs_data);
|
const bool rhs_low_priority = IsLowPriority(rhs_edge);
|
||||||
const bool lhs_same_or_higher_priority = sameOrHigherPriority(lhs_data);
|
const bool lhs_same_or_higher_priority = sameOrHigherPriority(lhs_edge);
|
||||||
const bool lhs_low_priority = IsLowPriority(lhs_data);
|
const bool lhs_low_priority = IsLowPriority(lhs_edge);
|
||||||
auto left_tie = std::tie(lhs.entry_allowed,
|
auto left_tie = std::tie(lhs.entry_allowed,
|
||||||
lhs_same_or_higher_priority,
|
lhs_same_or_higher_priority,
|
||||||
rhs_low_priority,
|
rhs_low_priority,
|
||||||
@@ -188,8 +190,10 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
return left_tie > right_tie;
|
return left_tie > right_tie;
|
||||||
};
|
};
|
||||||
const auto RoadCompareSameName = [&](const auto &lhs, const auto &rhs) {
|
const auto RoadCompareSameName = [&](const auto &lhs, const auto &rhs) {
|
||||||
const EdgeData &lhs_data = node_based_graph.GetEdgeData(lhs.eid);
|
const auto &lhs_data = node_data_container.GetAnnotation(
|
||||||
const EdgeData &rhs_data = node_based_graph.GetEdgeData(rhs.eid);
|
node_based_graph.GetEdgeData(lhs.eid).annotation_data);
|
||||||
|
const auto &rhs_data = node_data_container.GetAnnotation(
|
||||||
|
node_based_graph.GetEdgeData(rhs.eid).annotation_data);
|
||||||
const auto lhs_continues = IsContinueRoad(lhs_data);
|
const auto lhs_continues = IsContinueRoad(lhs_data);
|
||||||
const auto rhs_continues = IsContinueRoad(rhs_data);
|
const auto rhs_continues = IsContinueRoad(rhs_data);
|
||||||
const auto left_tie = std::tie(lhs.entry_allowed, lhs_continues);
|
const auto left_tie = std::tie(lhs.entry_allowed, lhs_continues);
|
||||||
@@ -204,12 +208,14 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
|
|
||||||
best_option = std::distance(begin(intersection), best_option_it);
|
best_option = std::distance(begin(intersection), best_option_it);
|
||||||
best_option_deviation = angularDeviation(intersection[best_option].angle, STRAIGHT_ANGLE);
|
best_option_deviation = angularDeviation(intersection[best_option].angle, STRAIGHT_ANGLE);
|
||||||
const auto &best_option_data = node_based_graph.GetEdgeData(intersection[best_option].eid);
|
const auto &best_option_edge = node_based_graph.GetEdgeData(intersection[best_option].eid);
|
||||||
|
const auto &best_option_data =
|
||||||
|
node_data_container.GetAnnotation(best_option_edge.annotation_data);
|
||||||
|
|
||||||
// Unless the in way is also low priority, it is generally undesirable to
|
// Unless the in way is also low priority, it is generally undesirable to
|
||||||
// indicate that a low priority road is obvious
|
// indicate that a low priority road is obvious
|
||||||
if (IsLowPriority(best_option_data) &&
|
if (IsLowPriority(best_option_edge) &&
|
||||||
best_option_data.road_classification != in_way_data.road_classification)
|
best_option_edge.flags.road_classification != in_way_edge.flags.road_classification)
|
||||||
{
|
{
|
||||||
best_option = 0;
|
best_option = 0;
|
||||||
best_option_deviation = 180;
|
best_option_deviation = 180;
|
||||||
@@ -219,13 +225,13 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
const auto straightest = intersection.findClosestTurn(STRAIGHT_ANGLE);
|
const auto straightest = intersection.findClosestTurn(STRAIGHT_ANGLE);
|
||||||
if (straightest != best_option_it)
|
if (straightest != best_option_it)
|
||||||
{
|
{
|
||||||
const EdgeData &straightest_data = node_based_graph.GetEdgeData(straightest->eid);
|
const auto &straightest_edge = node_based_graph.GetEdgeData(straightest->eid);
|
||||||
double straightest_data_deviation = angularDeviation(straightest->angle, STRAIGHT_ANGLE);
|
double straightest_data_deviation = angularDeviation(straightest->angle, STRAIGHT_ANGLE);
|
||||||
const auto deviation_diff =
|
const auto deviation_diff =
|
||||||
std::abs(best_option_deviation - straightest_data_deviation) > FUZZY_ANGLE_DIFFERENCE;
|
std::abs(best_option_deviation - straightest_data_deviation) > FUZZY_ANGLE_DIFFERENCE;
|
||||||
const auto not_ramp_class = !straightest_data.road_classification.IsRampClass();
|
const auto not_ramp_class = !straightest_edge.flags.road_classification.IsRampClass();
|
||||||
const auto not_link_class = !straightest_data.road_classification.IsLinkClass();
|
const auto not_link_class = !straightest_edge.flags.road_classification.IsLinkClass();
|
||||||
if (deviation_diff && !IsLowPriority(straightest_data) && not_ramp_class &&
|
if (deviation_diff && !IsLowPriority(straightest_edge) && not_ramp_class &&
|
||||||
not_link_class && !IsContinueRoad(best_option_data))
|
not_link_class && !IsContinueRoad(best_option_data))
|
||||||
{
|
{
|
||||||
best_option = std::distance(begin(intersection), straightest);
|
best_option = std::distance(begin(intersection), straightest);
|
||||||
@@ -240,7 +246,9 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
|
|
||||||
auto best_continue_it =
|
auto best_continue_it =
|
||||||
std::min_element(begin(intersection), end(intersection), RoadCompareSameName);
|
std::min_element(begin(intersection), end(intersection), RoadCompareSameName);
|
||||||
const auto best_continue_data = node_based_graph.GetEdgeData(best_continue_it->eid);
|
const auto best_continue_edge = node_based_graph.GetEdgeData(best_continue_it->eid);
|
||||||
|
const auto best_continue_data =
|
||||||
|
node_data_container.GetAnnotation(best_continue_edge.annotation_data);
|
||||||
if (IsContinueRoad(best_continue_data) ||
|
if (IsContinueRoad(best_continue_data) ||
|
||||||
(in_way_data.name_id == EMPTY_NAMEID && best_continue_data.name_id == EMPTY_NAMEID))
|
(in_way_data.name_id == EMPTY_NAMEID && best_continue_data.name_id == EMPTY_NAMEID))
|
||||||
{
|
{
|
||||||
@@ -252,8 +260,7 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
// if the best angle is going straight but the road is turning, declare no obvious turn
|
// if the best angle is going straight but the road is turning, declare no obvious turn
|
||||||
if (0 != best_continue && best_option != best_continue &&
|
if (0 != best_continue && best_option != best_continue &&
|
||||||
best_option_deviation < MAXIMAL_ALLOWED_NO_TURN_DEVIATION &&
|
best_option_deviation < MAXIMAL_ALLOWED_NO_TURN_DEVIATION &&
|
||||||
node_based_graph.GetEdgeData(intersection[best_continue].eid).road_classification ==
|
best_continue_edge.flags.road_classification == best_option_edge.flags.road_classification)
|
||||||
best_option_data.road_classification)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -262,17 +269,21 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
// continue instruction because they share a name with the approaching way
|
// continue instruction because they share a name with the approaching way
|
||||||
const std::int64_t continue_count =
|
const std::int64_t continue_count =
|
||||||
count_if(++begin(intersection), end(intersection), [&](const auto &way) {
|
count_if(++begin(intersection), end(intersection), [&](const auto &way) {
|
||||||
return IsContinueRoad(node_based_graph.GetEdgeData(way.eid));
|
return IsContinueRoad(node_data_container.GetAnnotation(
|
||||||
|
node_based_graph.GetEdgeData(way.eid).annotation_data));
|
||||||
});
|
});
|
||||||
const std::int64_t continue_count_valid =
|
const std::int64_t continue_count_valid =
|
||||||
count_if(++begin(intersection), end(intersection), [&](const auto &way) {
|
count_if(++begin(intersection), end(intersection), [&](const auto &way) {
|
||||||
return IsContinueRoad(node_based_graph.GetEdgeData(way.eid)) && way.entry_allowed;
|
return IsContinueRoad(node_data_container.GetAnnotation(
|
||||||
|
node_based_graph.GetEdgeData(way.eid).annotation_data)) &&
|
||||||
|
way.entry_allowed;
|
||||||
});
|
});
|
||||||
|
|
||||||
// checks if continue candidates are sharp turns
|
// checks if continue candidates are sharp turns
|
||||||
const bool all_continues_are_narrow = [&]() {
|
const bool all_continues_are_narrow = [&]() {
|
||||||
return std::count_if(begin(intersection), end(intersection), [&](const Road &road) {
|
return std::count_if(begin(intersection), end(intersection), [&](const Road &road) {
|
||||||
const EdgeData &road_data = node_based_graph.GetEdgeData(road.eid);
|
const auto &road_data = node_data_container.GetAnnotation(
|
||||||
|
node_based_graph.GetEdgeData(road.eid).annotation_data);
|
||||||
const double &road_angle = angularDeviation(road.angle, STRAIGHT_ANGLE);
|
const double &road_angle = angularDeviation(road.angle, STRAIGHT_ANGLE);
|
||||||
return IsContinueRoad(road_data) && (road_angle < NARROW_TURN_ANGLE);
|
return IsContinueRoad(road_data) && (road_angle < NARROW_TURN_ANGLE);
|
||||||
}) == continue_count;
|
}) == continue_count;
|
||||||
@@ -296,32 +307,32 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// continue data now most certainly exists
|
// continue data now most certainly exists
|
||||||
const auto &continue_data = node_based_graph.GetEdgeData(intersection[best_continue].eid);
|
const auto &continue_edge = node_based_graph.GetEdgeData(intersection[best_continue].eid);
|
||||||
|
|
||||||
// best_continue is obvious by road class
|
// best_continue is obvious by road class
|
||||||
if (obviousByRoadClass(in_way_data.road_classification,
|
if (obviousByRoadClass(in_way_edge.flags.road_classification,
|
||||||
continue_data.road_classification,
|
continue_edge.flags.road_classification,
|
||||||
best_option_data.road_classification))
|
best_option_edge.flags.road_classification))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// best_option is obvious by road class
|
// best_option is obvious by road class
|
||||||
if (obviousByRoadClass(in_way_data.road_classification,
|
if (obviousByRoadClass(in_way_edge.flags.road_classification,
|
||||||
best_option_data.road_classification,
|
best_option_edge.flags.road_classification,
|
||||||
continue_data.road_classification))
|
continue_edge.flags.road_classification))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// the best_option deviation is very straight and not a ramp
|
// the best_option deviation is very straight and not a ramp
|
||||||
if (best_option_deviation < best_continue_deviation &&
|
if (best_option_deviation < best_continue_deviation &&
|
||||||
best_option_deviation < FUZZY_ANGLE_DIFFERENCE &&
|
best_option_deviation < FUZZY_ANGLE_DIFFERENCE &&
|
||||||
!best_option_data.road_classification.IsRampClass())
|
!best_option_edge.flags.road_classification.IsRampClass())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// the continue road is of a lower priority, while the road continues on the same priority
|
// the continue road is of a lower priority, while the road continues on the same priority
|
||||||
// with a better angle
|
// with a better angle
|
||||||
if (best_option_deviation < best_continue_deviation &&
|
if (best_option_deviation < best_continue_deviation &&
|
||||||
in_way_data.road_classification == best_option_data.road_classification &&
|
in_way_edge.flags.road_classification == best_option_edge.flags.road_classification &&
|
||||||
continue_data.road_classification.GetPriority() >
|
continue_edge.flags.road_classification.GetPriority() >
|
||||||
best_option_data.road_classification.GetPriority())
|
best_option_edge.flags.road_classification.GetPriority())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -335,24 +346,25 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
const auto in_through_candidate =
|
const auto in_through_candidate =
|
||||||
intersection.FindClosestBearing(util::bearing::reverse(road.bearing));
|
intersection.FindClosestBearing(util::bearing::reverse(road.bearing));
|
||||||
|
|
||||||
const auto &in_data = node_based_graph.GetEdgeData(in_through_candidate->eid);
|
const auto &in_edge = node_based_graph.GetEdgeData(in_through_candidate->eid);
|
||||||
const auto &out_data = node_based_graph.GetEdgeData(road.eid);
|
const auto &out_edge = node_based_graph.GetEdgeData(road.eid);
|
||||||
|
|
||||||
// by asking for the same class, we ensure that we do not overrule obvious by road-class
|
// by asking for the same class, we ensure that we do not overrule obvious by road-class
|
||||||
// decisions
|
// decisions
|
||||||
const auto same_class = in_data.road_classification == out_data.road_classification;
|
const auto same_class =
|
||||||
|
in_edge.flags.road_classification == out_edge.flags.road_classification;
|
||||||
|
|
||||||
// only if the entry is allowed for one of the two, but not the other, we need to check.
|
// only if the entry is allowed for one of the two, but not the other, we need to check.
|
||||||
// Otherwise other handlers do it better
|
// Otherwise other handlers do it better
|
||||||
const bool is_oneway = !in_through_candidate->entry_allowed && road.entry_allowed;
|
const bool is_oneway = !in_through_candidate->entry_allowed && road.entry_allowed;
|
||||||
|
|
||||||
const bool not_roundabout =
|
const bool not_roundabout = !(in_edge.flags.roundabout || in_edge.flags.circular ||
|
||||||
!(in_data.roundabout || in_data.circular || out_data.roundabout || out_data.circular);
|
out_edge.flags.roundabout || out_edge.flags.circular);
|
||||||
|
|
||||||
// for the purpose of this check, we do not care about low-priority roads (parking lots,
|
// for the purpose of this check, we do not care about low-priority roads (parking lots,
|
||||||
// mostly). Since we postulate both classes to be the same, checking one of the two is
|
// mostly). Since we postulate both classes to be the same, checking one of the two is
|
||||||
// enough
|
// enough
|
||||||
const bool not_low_priority = !in_data.road_classification.IsLowPriorityRoadClass();
|
const bool not_low_priority = !in_edge.flags.road_classification.IsLowPriorityRoadClass();
|
||||||
|
|
||||||
const auto in_deviation = angularDeviation(in_through_candidate->angle, STRAIGHT_ANGLE);
|
const auto in_deviation = angularDeviation(in_through_candidate->angle, STRAIGHT_ANGLE);
|
||||||
const auto out_deviaiton = angularDeviation(road.angle, STRAIGHT_ANGLE);
|
const auto out_deviaiton = angularDeviation(road.angle, STRAIGHT_ANGLE);
|
||||||
@@ -371,11 +383,11 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
const auto index_candidate = (best_option + 1) % intersection.size();
|
const auto index_candidate = (best_option + 1) % intersection.size();
|
||||||
if (index_candidate == 0)
|
if (index_candidate == 0)
|
||||||
return index_candidate;
|
return index_candidate;
|
||||||
const auto &candidate_data =
|
const auto &candidate_edge =
|
||||||
node_based_graph.GetEdgeData(intersection[index_candidate].eid);
|
node_based_graph.GetEdgeData(intersection[index_candidate].eid);
|
||||||
if (obviousByRoadClass(in_way_data.road_classification,
|
if (obviousByRoadClass(in_way_edge.flags.road_classification,
|
||||||
best_option_data.road_classification,
|
best_option_edge.flags.road_classification,
|
||||||
candidate_data.road_classification))
|
candidate_edge.flags.road_classification))
|
||||||
return (index_candidate + 1) % intersection.size();
|
return (index_candidate + 1) % intersection.size();
|
||||||
else
|
else
|
||||||
return index_candidate;
|
return index_candidate;
|
||||||
@@ -386,11 +398,11 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
const auto index_candidate = best_option - 1;
|
const auto index_candidate = best_option - 1;
|
||||||
if (index_candidate == 0)
|
if (index_candidate == 0)
|
||||||
return index_candidate;
|
return index_candidate;
|
||||||
const auto candidate_data =
|
const auto &candidate_edge =
|
||||||
node_based_graph.GetEdgeData(intersection[index_candidate].eid);
|
node_based_graph.GetEdgeData(intersection[index_candidate].eid);
|
||||||
if (obviousByRoadClass(in_way_data.road_classification,
|
if (obviousByRoadClass(in_way_edge.flags.road_classification,
|
||||||
best_option_data.road_classification,
|
best_option_edge.flags.road_classification,
|
||||||
candidate_data.road_classification))
|
candidate_edge.flags.road_classification))
|
||||||
return index_candidate - 1;
|
return index_candidate - 1;
|
||||||
else
|
else
|
||||||
return index_candidate;
|
return index_candidate;
|
||||||
@@ -407,17 +419,17 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
std::min(left_deviation, right_deviation) > FUZZY_ANGLE_DIFFERENCE)
|
std::min(left_deviation, right_deviation) > FUZZY_ANGLE_DIFFERENCE)
|
||||||
return best_option;
|
return best_option;
|
||||||
|
|
||||||
const auto &left_data = node_based_graph.GetEdgeData(intersection[left_index].eid);
|
const auto &left_edge = node_based_graph.GetEdgeData(intersection[left_index].eid);
|
||||||
const auto &right_data = node_based_graph.GetEdgeData(intersection[right_index].eid);
|
const auto &right_edge = node_based_graph.GetEdgeData(intersection[right_index].eid);
|
||||||
|
|
||||||
const bool obvious_to_left =
|
const bool obvious_to_left =
|
||||||
left_index == 0 || obviousByRoadClass(in_way_data.road_classification,
|
left_index == 0 || obviousByRoadClass(in_way_edge.flags.road_classification,
|
||||||
best_option_data.road_classification,
|
best_option_edge.flags.road_classification,
|
||||||
left_data.road_classification);
|
left_edge.flags.road_classification);
|
||||||
const bool obvious_to_right =
|
const bool obvious_to_right =
|
||||||
right_index == 0 || obviousByRoadClass(in_way_data.road_classification,
|
right_index == 0 || obviousByRoadClass(in_way_edge.flags.road_classification,
|
||||||
best_option_data.road_classification,
|
best_option_edge.flags.road_classification,
|
||||||
right_data.road_classification);
|
right_edge.flags.road_classification);
|
||||||
|
|
||||||
// if the best_option turn isn't narrow, but there is a nearly straight turn, we don't
|
// if the best_option turn isn't narrow, but there is a nearly straight turn, we don't
|
||||||
// consider the turn obvious
|
// consider the turn obvious
|
||||||
@@ -447,14 +459,15 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
distinction rate. If the road category is smaller, its also adjusted. Only
|
distinction rate. If the road category is smaller, its also adjusted. Only
|
||||||
roads of the same priority require the full distinction ratio.
|
roads of the same priority require the full distinction ratio.
|
||||||
*/
|
*/
|
||||||
const auto &best_option_data =
|
const auto &best_option_edge =
|
||||||
node_based_graph.GetEdgeData(intersection[best_option].eid);
|
node_based_graph.GetEdgeData(intersection[best_option].eid);
|
||||||
const auto adjusted_distinction_ratio = [&]() {
|
const auto adjusted_distinction_ratio = [&]() {
|
||||||
// obviousness by road classes
|
// obviousness by road classes
|
||||||
if (in_way_data.road_classification == best_option_data.road_classification &&
|
if (in_way_edge.flags.road_classification ==
|
||||||
best_option_data.road_classification.GetPriority() <
|
best_option_edge.flags.road_classification &&
|
||||||
|
best_option_edge.flags.road_classification.GetPriority() <
|
||||||
node_based_graph.GetEdgeData(intersection[index].eid)
|
node_based_graph.GetEdgeData(intersection[index].eid)
|
||||||
.road_classification.GetPriority())
|
.flags.road_classification.GetPriority())
|
||||||
return 0.8 * DISTINCTION_RATIO;
|
return 0.8 * DISTINCTION_RATIO;
|
||||||
// if road classes are the same, we use the full ratio
|
// if road classes are the same, we use the full ratio
|
||||||
else
|
else
|
||||||
@@ -472,7 +485,9 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto &continue_data = node_based_graph.GetEdgeData(intersection[best_continue].eid);
|
const auto &continue_edge = node_based_graph.GetEdgeData(intersection[best_continue].eid);
|
||||||
|
const auto &continue_data =
|
||||||
|
node_data_container.GetAnnotation(continue_edge.annotation_data);
|
||||||
if (std::abs(best_continue_deviation) < 1)
|
if (std::abs(best_continue_deviation) < 1)
|
||||||
return best_continue;
|
return best_continue;
|
||||||
|
|
||||||
@@ -488,11 +503,12 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
if (i == best_continue || !intersection[i].entry_allowed)
|
if (i == best_continue || !intersection[i].entry_allowed)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const auto &turn_data = node_based_graph.GetEdgeData(intersection[i].eid);
|
const auto &turn_edge = node_based_graph.GetEdgeData(intersection[i].eid);
|
||||||
|
const auto &turn_data = node_data_container.GetAnnotation(turn_edge.annotation_data);
|
||||||
const bool is_obvious_by_road_class =
|
const bool is_obvious_by_road_class =
|
||||||
obviousByRoadClass(in_way_data.road_classification,
|
obviousByRoadClass(in_way_edge.flags.road_classification,
|
||||||
continue_data.road_classification,
|
continue_edge.flags.road_classification,
|
||||||
turn_data.road_classification);
|
turn_edge.flags.road_classification);
|
||||||
|
|
||||||
// if the main road is obvious by class, we ignore the current road as a potential
|
// if the main road is obvious by class, we ignore the current road as a potential
|
||||||
// prevention of obviousness
|
// prevention of obviousness
|
||||||
@@ -500,9 +516,9 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// continuation could be grouped with a straight turn and the turning road is a ramp
|
// continuation could be grouped with a straight turn and the turning road is a ramp
|
||||||
if (turn_data.road_classification.IsRampClass() &&
|
if (turn_edge.flags.road_classification.IsRampClass() &&
|
||||||
best_continue_deviation < GROUP_ANGLE &&
|
best_continue_deviation < GROUP_ANGLE &&
|
||||||
!continue_data.road_classification.IsRampClass())
|
!continue_edge.flags.road_classification.IsRampClass())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// perfectly straight turns prevent obviousness
|
// perfectly straight turns prevent obviousness
|
||||||
@@ -567,11 +583,13 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
// actually represents a near 180 degree different in bearings between the two
|
// actually represents a near 180 degree different in bearings between the two
|
||||||
// roads. So if there is a road that is enterable in the opposite direction just
|
// roads. So if there is a road that is enterable in the opposite direction just
|
||||||
// prior, a turn is not obvious
|
// prior, a turn is not obvious
|
||||||
const auto &turn_data = node_based_graph.GetEdgeData(comparison_road.eid);
|
const auto &turn_edge_data = node_based_graph.GetEdgeData(comparison_road.eid);
|
||||||
|
const auto &turn_data =
|
||||||
|
node_data_container.GetAnnotation(turn_edge_data.annotation_data);
|
||||||
if (angularDeviation(comparison_road.angle, STRAIGHT_ANGLE) > GROUP_ANGLE &&
|
if (angularDeviation(comparison_road.angle, STRAIGHT_ANGLE) > GROUP_ANGLE &&
|
||||||
angularDeviation(comparison_road.angle, continue_road.angle) <
|
angularDeviation(comparison_road.angle, continue_road.angle) <
|
||||||
FUZZY_ANGLE_DIFFERENCE &&
|
FUZZY_ANGLE_DIFFERENCE &&
|
||||||
!turn_data.reversed && continue_data.CanCombineWith(turn_data))
|
!turn_edge_data.reversed && continue_data.CanCombineWith(turn_data))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class IntersectionNormalizer
|
|||||||
std::vector<IntersectionNormalizationOperation> performed_merges;
|
std::vector<IntersectionNormalizationOperation> performed_merges;
|
||||||
};
|
};
|
||||||
IntersectionNormalizer(const util::NodeBasedDynamicGraph &node_based_graph,
|
IntersectionNormalizer(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table,
|
const SuffixTable &street_name_suffix_table,
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ class MergableRoadDetector
|
|||||||
using MergableRoadData = IntersectionShapeData;
|
using MergableRoadData = IntersectionShapeData;
|
||||||
|
|
||||||
MergableRoadDetector(const util::NodeBasedDynamicGraph &node_based_graph,
|
MergableRoadDetector(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &node_coordinates,
|
const std::vector<util::Coordinate> &node_coordinates,
|
||||||
const IntersectionGenerator &intersection_generator,
|
const IntersectionGenerator &intersection_generator,
|
||||||
const CoordinateExtractor &coordinate_extractor,
|
const CoordinateExtractor &coordinate_extractor,
|
||||||
@@ -77,8 +78,10 @@ class MergableRoadDetector
|
|||||||
|
|
||||||
// When it comes to merging roads, we need to find out if two ways actually represent the
|
// When it comes to merging roads, we need to find out if two ways actually represent the
|
||||||
// same road. This check tries to identify roads which are the same road in opposite directions
|
// same road. This check tries to identify roads which are the same road in opposite directions
|
||||||
bool EdgeDataSupportsMerge(const util::NodeBasedEdgeData &lhs_edge_data,
|
bool EdgeDataSupportsMerge(const NodeBasedEdgeClassification &lhs_flags,
|
||||||
const util::NodeBasedEdgeData &rhs_edge_data) const;
|
const NodeBasedEdgeClassification &rhs_flags,
|
||||||
|
const NodeBasedEdgeAnnotation &lhs_edge_annotation,
|
||||||
|
const NodeBasedEdgeAnnotation &rhs_edge_annotation) const;
|
||||||
|
|
||||||
// Detect traffic loops.
|
// Detect traffic loops.
|
||||||
// Since OSRM cannot handle loop edges, we cannot directly see a connection between a node and
|
// Since OSRM cannot handle loop edges, we cannot directly see a connection between a node and
|
||||||
@@ -138,6 +141,7 @@ class MergableRoadDetector
|
|||||||
bool IsLinkRoad(const NodeID intersection_node, const MergableRoadData &road) const;
|
bool IsLinkRoad(const NodeID intersection_node, const MergableRoadData &road) const;
|
||||||
|
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph;
|
const util::NodeBasedDynamicGraph &node_based_graph;
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container;
|
||||||
const std::vector<util::Coordinate> &node_coordinates;
|
const std::vector<util::Coordinate> &node_coordinates;
|
||||||
const IntersectionGenerator &intersection_generator;
|
const IntersectionGenerator &intersection_generator;
|
||||||
const CoordinateExtractor &coordinate_extractor;
|
const CoordinateExtractor &coordinate_extractor;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class MotorwayHandler : public IntersectionHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MotorwayHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
MotorwayHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table,
|
const SuffixTable &street_name_suffix_table,
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class NodeBasedGraphWalker
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NodeBasedGraphWalker(const util::NodeBasedDynamicGraph &node_based_graph,
|
NodeBasedGraphWalker(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const IntersectionGenerator &intersection_generator);
|
const IntersectionGenerator &intersection_generator);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -46,6 +47,7 @@ class NodeBasedGraphWalker
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph;
|
const util::NodeBasedDynamicGraph &node_based_graph;
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container;
|
||||||
const IntersectionGenerator &intersection_generator;
|
const IntersectionGenerator &intersection_generator;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -106,7 +108,8 @@ struct SelectRoadByNameOnlyChoiceAndStraightness
|
|||||||
boost::optional<EdgeID> operator()(const NodeID nid,
|
boost::optional<EdgeID> operator()(const NodeID nid,
|
||||||
const EdgeID via_edge_id,
|
const EdgeID via_edge_id,
|
||||||
const IntersectionView &intersection,
|
const IntersectionView &intersection,
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph) const;
|
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const NameID desired_name_id;
|
const NameID desired_name_id;
|
||||||
@@ -131,7 +134,8 @@ struct SelectStraightmostRoadByNameAndOnlyChoice
|
|||||||
boost::optional<EdgeID> operator()(const NodeID nid,
|
boost::optional<EdgeID> operator()(const NodeID nid,
|
||||||
const EdgeID via_edge_id,
|
const EdgeID via_edge_id,
|
||||||
const IntersectionView &intersection,
|
const IntersectionView &intersection,
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph) const;
|
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const NameID desired_name_id;
|
const NameID desired_name_id;
|
||||||
@@ -201,8 +205,11 @@ NodeBasedGraphWalker::TraverseRoad(NodeID current_node_id,
|
|||||||
if (next_intersection.size() <= 1)
|
if (next_intersection.size() <= 1)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
auto next_edge_id =
|
auto next_edge_id = selector(current_node_id,
|
||||||
selector(current_node_id, current_edge_id, next_intersection, node_based_graph);
|
current_edge_id,
|
||||||
|
next_intersection,
|
||||||
|
node_based_graph,
|
||||||
|
node_data_container);
|
||||||
|
|
||||||
if (!next_edge_id)
|
if (!next_edge_id)
|
||||||
return {};
|
return {};
|
||||||
@@ -224,7 +231,8 @@ struct SkipTrafficSignalBarrierRoadSelector
|
|||||||
boost::optional<EdgeID> operator()(const NodeID,
|
boost::optional<EdgeID> operator()(const NodeID,
|
||||||
const EdgeID,
|
const EdgeID,
|
||||||
const IntersectionView &intersection,
|
const IntersectionView &intersection,
|
||||||
const util::NodeBasedDynamicGraph &) const
|
const util::NodeBasedDynamicGraph &,
|
||||||
|
const EdgeBasedNodeDataContainer &) const
|
||||||
{
|
{
|
||||||
if (intersection.isTrafficSignalOrBarrier())
|
if (intersection.isTrafficSignalOrBarrier())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include "extractor/guidance/intersection_generator.hpp"
|
#include "extractor/guidance/intersection_generator.hpp"
|
||||||
#include "extractor/guidance/intersection_handler.hpp"
|
#include "extractor/guidance/intersection_handler.hpp"
|
||||||
#include "extractor/guidance/roundabout_type.hpp"
|
#include "extractor/guidance/roundabout_type.hpp"
|
||||||
#include "extractor/profile_properties.hpp"
|
|
||||||
#include "extractor/query_node.hpp"
|
#include "extractor/query_node.hpp"
|
||||||
|
|
||||||
#include "util/name_table.hpp"
|
#include "util/name_table.hpp"
|
||||||
@@ -41,11 +40,11 @@ class RoundaboutHandler : public IntersectionHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RoundaboutHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
RoundaboutHandler(const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const CompressedEdgeContainer &compressed_edge_container,
|
const CompressedEdgeContainer &compressed_edge_container,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table,
|
const SuffixTable &street_name_suffix_table,
|
||||||
const ProfileProperties &profile_properties,
|
|
||||||
const IntersectionGenerator &intersection_generator);
|
const IntersectionGenerator &intersection_generator);
|
||||||
|
|
||||||
~RoundaboutHandler() override final = default;
|
~RoundaboutHandler() override final = default;
|
||||||
@@ -86,8 +85,6 @@ class RoundaboutHandler : public IntersectionHandler
|
|||||||
qualifiesAsRoundaboutIntersection(const std::unordered_set<NodeID> &roundabout_nodes) const;
|
qualifiesAsRoundaboutIntersection(const std::unordered_set<NodeID> &roundabout_nodes) const;
|
||||||
|
|
||||||
const CompressedEdgeContainer &compressed_edge_container;
|
const CompressedEdgeContainer &compressed_edge_container;
|
||||||
const ProfileProperties &profile_properties;
|
|
||||||
|
|
||||||
const CoordinateExtractor coordinate_extractor;
|
const CoordinateExtractor coordinate_extractor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class SliproadHandler final : public IntersectionHandler
|
|||||||
public:
|
public:
|
||||||
SliproadHandler(const IntersectionGenerator &intersection_generator,
|
SliproadHandler(const IntersectionGenerator &intersection_generator,
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph,
|
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table);
|
const SuffixTable &street_name_suffix_table);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class SuppressModeHandler final : public IntersectionHandler
|
|||||||
public:
|
public:
|
||||||
SuppressModeHandler(const IntersectionGenerator &intersection_generator,
|
SuppressModeHandler(const IntersectionGenerator &intersection_generator,
|
||||||
const util::NodeBasedDynamicGraph &node_based_graph,
|
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||||
|
const EdgeBasedNodeDataContainer &node_data_container,
|
||||||
const std::vector<util::Coordinate> &coordinates,
|
const std::vector<util::Coordinate> &coordinates,
|
||||||
const util::NameTable &name_table,
|
const util::NameTable &name_table,
|
||||||
const SuffixTable &street_name_suffix_table);
|
const SuffixTable &street_name_suffix_table);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user