Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 723e49474d | |||
| 288fa59fec |
@@ -42,15 +42,12 @@ Checks: >
|
|||||||
-llvm-twine-local,
|
-llvm-twine-local,
|
||||||
misc-*,
|
misc-*,
|
||||||
-misc-argument-comment,
|
-misc-argument-comment,
|
||||||
-misc-const-correctness,
|
|
||||||
-misc-non-private-member-variables-in-classes,
|
-misc-non-private-member-variables-in-classes,
|
||||||
-misc-unconventional-assign-operator,
|
-misc-unconventional-assign-operator,
|
||||||
-misc-no-recursion,
|
-misc-no-recursion,
|
||||||
-misc-misplaced-const,
|
-misc-misplaced-const,
|
||||||
-misc-definitions-in-headers,
|
-misc-definitions-in-headers,
|
||||||
-misc-unused-parameters,
|
-misc-unused-parameters,
|
||||||
modernize-concat-nested-namespaces,
|
|
||||||
modernize-use-using,
|
|
||||||
performance-*,
|
performance-*,
|
||||||
-performance-noexcept-move-constructor,
|
-performance-noexcept-move-constructor,
|
||||||
-performance-no-int-to-ptr,
|
-performance-no-int-to-ptr,
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
name: Question
|
||||||
|
about: Ask a question about OSRM
|
||||||
|
labels: question
|
||||||
|
---
|
||||||
+355
-205
@@ -19,25 +19,22 @@ env:
|
|||||||
CMAKE_VERSION: 3.21.2
|
CMAKE_VERSION: 3.21.2
|
||||||
ENABLE_NODE_BINDINGS: "ON"
|
ENABLE_NODE_BINDINGS: "ON"
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
windows-release-node:
|
windows:
|
||||||
needs: format-taginfo-docs
|
needs: format-taginfo-docs
|
||||||
runs-on: windows-2022
|
runs-on: windows-2022
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
env:
|
env:
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
|
ENABLE_APPLE_SILICON: "OFF"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- run: pip install "conan<2.0.0"
|
- run: pip install conan==1.51.3
|
||||||
- run: conan --version
|
- run: conan --version
|
||||||
- run: cmake --version
|
- run: cmake --version
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 16
|
||||||
- run: node --version
|
- run: node --version
|
||||||
- run: npm --version
|
- run: npm --version
|
||||||
- name: Prepare environment
|
- name: Prepare environment
|
||||||
@@ -74,15 +71,15 @@ jobs:
|
|||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
format-taginfo-docs:
|
format-taginfo-docs:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js
|
- name: Use Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 12
|
||||||
- name: Enable Node.js cache
|
- name: Enable Node.js cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/.npm
|
path: ~/.npm
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
@@ -91,14 +88,13 @@ jobs:
|
|||||||
- name: Prepare environment
|
- name: Prepare environment
|
||||||
run: |
|
run: |
|
||||||
npm ci --ignore-scripts
|
npm ci --ignore-scripts
|
||||||
clang-format-15 --version
|
clang-format-10 --version
|
||||||
- name: Run checks
|
- name: Run checks
|
||||||
run: |
|
run: |
|
||||||
./scripts/check_taginfo.py taginfo.json profiles/car.lua
|
./scripts/check_taginfo.py taginfo.json profiles/car.lua
|
||||||
./scripts/format.sh && ./scripts/error_on_dirty.sh
|
./scripts/format.sh && ./scripts/error_on_dirty.sh
|
||||||
node ./scripts/validate_changelog.js
|
node ./scripts/validate_changelog.js
|
||||||
npm run docs && ./scripts/error_on_dirty.sh
|
npm run docs && ./scripts/error_on_dirty.sh
|
||||||
npm audit --production
|
|
||||||
|
|
||||||
docker-image:
|
docker-image:
|
||||||
needs: format-taginfo-docs
|
needs: format-taginfo-docs
|
||||||
@@ -108,7 +104,7 @@ jobs:
|
|||||||
- name: Check out the repo
|
- name: Check out the repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Enable osm.pbf cache
|
- name: Enable osm.pbf cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: berlin-latest.osm.pbf
|
path: berlin-latest.osm.pbf
|
||||||
key: v1-berlin-osm-pbf
|
key: v1-berlin-osm-pbf
|
||||||
@@ -148,172 +144,269 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- name: gcc-13-debug-cov
|
- name: gcc-9-debug-cov
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 20
|
node: 12
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
BUILD_TOOLS: ON
|
BUILD_TOOLS: ON
|
||||||
BUILD_TYPE: Debug
|
BUILD_TYPE: Debug
|
||||||
CCOMPILER: gcc-13
|
CCOMPILER: gcc-9
|
||||||
CUCUMBER_TIMEOUT: 20000
|
CUCUMBER_TIMEOUT: 20000
|
||||||
CXXCOMPILER: g++-13
|
CXXCOMPILER: g++-9
|
||||||
ENABLE_COVERAGE: ON
|
ENABLE_COVERAGE: ON
|
||||||
|
|
||||||
- name: clang-15-debug-asan-ubsan
|
- name: gcc-9-debug-asan-ubsan
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 20
|
node: 12
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
BUILD_TOOLS: ON
|
BUILD_TOOLS: ON
|
||||||
BUILD_TYPE: Debug
|
BUILD_TYPE: Debug
|
||||||
CCOMPILER: clang-15
|
CCOMPILER: gcc-9
|
||||||
CUCUMBER_TIMEOUT: 20000
|
CUCUMBER_TIMEOUT: 20000
|
||||||
CXXCOMPILER: clang++-15
|
CXXCOMPILER: g++-9
|
||||||
ENABLE_SANITIZER: ON
|
ENABLE_SANITIZER: ON
|
||||||
TARGET_ARCH: x86_64-asan-ubsan
|
TARGET_ARCH: x86_64-asan-ubsan
|
||||||
OSRM_CONNECTION_RETRIES: 10
|
OSRM_CONNECTION_RETRIES: 10
|
||||||
OSRM_CONNECTION_EXP_BACKOFF_COEF: 1.5
|
OSRM_CONNECTION_EXP_BACKOFF_COEF: 1.5
|
||||||
|
|
||||||
- name: clang-15-release
|
- name: clang-6.0-debug
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 18
|
node: 12
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
BUILD_TOOLS: ON
|
BUILD_TOOLS: ON
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Debug
|
||||||
CCOMPILER: clang-15
|
CCOMPILER: clang-6.0
|
||||||
CXXCOMPILER: clang++-15
|
CXXCOMPILER: clang++-6.0
|
||||||
CUCUMBER_TIMEOUT: 60000
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
|
||||||
- name: clang-15-debug
|
- name: clang-11.0-debug-clang-tidy
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 18
|
node: 12
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
BUILD_TOOLS: ON
|
BUILD_TOOLS: ON
|
||||||
BUILD_TYPE: Debug
|
BUILD_TYPE: Debug
|
||||||
CCOMPILER: clang-15
|
|
||||||
CXXCOMPILER: clang++-15
|
|
||||||
CUCUMBER_TIMEOUT: 60000
|
|
||||||
|
|
||||||
- name: clang-15-debug-clang-tidy
|
|
||||||
continue-on-error: false
|
|
||||||
node: 18
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Debug
|
|
||||||
CCOMPILER: clang-15
|
|
||||||
CXXCOMPILER: clang++-15
|
|
||||||
CUCUMBER_TIMEOUT: 60000
|
|
||||||
ENABLE_CLANG_TIDY: ON
|
|
||||||
|
|
||||||
- name: clang-14-release
|
|
||||||
continue-on-error: false
|
|
||||||
node: 18
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
|
||||||
CCOMPILER: clang-14
|
CCOMPILER: clang-14
|
||||||
CXXCOMPILER: clang++-14
|
CXXCOMPILER: clang++-14
|
||||||
CUCUMBER_TIMEOUT: 60000
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_CLANG_TIDY: ON
|
||||||
- name: clang-13-release
|
|
||||||
continue-on-error: false
|
|
||||||
node: 18
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
|
||||||
CCOMPILER: clang-13
|
|
||||||
CXXCOMPILER: clang++-13
|
|
||||||
CUCUMBER_TIMEOUT: 60000
|
|
||||||
|
|
||||||
- name: conan-linux-debug-asan-ubsan
|
- name: conan-linux-debug-asan-ubsan
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 18
|
node: 12
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
BUILD_TOOLS: ON
|
BUILD_TOOLS: ON
|
||||||
BUILD_TYPE: Debug
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: clang-15
|
CCOMPILER: clang-11
|
||||||
CXXCOMPILER: clang++-15
|
CXXCOMPILER: clang++-11
|
||||||
ENABLE_CONAN: ON
|
ENABLE_CONAN: ON
|
||||||
ENABLE_SANITIZER: ON
|
ENABLE_SANITIZER: ON
|
||||||
|
|
||||||
- name: conan-linux-release
|
- name: conan-linux-release
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 18
|
node: 12
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
BUILD_TOOLS: ON
|
BUILD_TOOLS: ON
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: clang-15
|
CCOMPILER: clang-6.0
|
||||||
CXXCOMPILER: clang++-15
|
CXXCOMPILER: clang++-6.0
|
||||||
ENABLE_CONAN: ON
|
ENABLE_CONAN: ON
|
||||||
|
|
||||||
- name: conan-linux-debug
|
|
||||||
continue-on-error: false
|
|
||||||
node: 18
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Debug
|
|
||||||
CCOMPILER: clang-15
|
|
||||||
CXXCOMPILER: clang++-15
|
|
||||||
ENABLE_CONAN: ON
|
|
||||||
|
|
||||||
- name: gcc-13-release
|
|
||||||
continue-on-error: false
|
|
||||||
node: 20
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
|
||||||
CCOMPILER: gcc-13
|
|
||||||
CXXCOMPILER: g++-13
|
|
||||||
ENABLE_BENCHMARKS: ON
|
|
||||||
CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized'
|
|
||||||
|
|
||||||
- name: gcc-12-release
|
|
||||||
continue-on-error: false
|
|
||||||
node: 20
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
|
||||||
CCOMPILER: gcc-12
|
|
||||||
CXXCOMPILER: g++-12
|
|
||||||
ENABLE_BENCHMARKS: ON
|
|
||||||
CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized'
|
|
||||||
|
|
||||||
- name: gcc-11-release
|
- name: gcc-11-release
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 20
|
node: 12
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
BUILD_TOOLS: ON
|
BUILD_TOOLS: ON
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: gcc-11
|
CCOMPILER: gcc-11
|
||||||
CXXCOMPILER: g++-11
|
CXXCOMPILER: g++-11
|
||||||
ENABLE_BENCHMARKS: ON
|
ENABLE_BENCHMARKS: ON
|
||||||
|
|
||||||
- name: conan-linux-release-node
|
- name: gcc-10-release
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: gcc-10
|
||||||
|
CXXCOMPILER: g++-10
|
||||||
|
|
||||||
|
- name: gcc-9-release
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: gcc-9
|
||||||
|
CXXCOMPILER: g++-9
|
||||||
|
CXXFLAGS: -Wno-cast-function-type
|
||||||
|
|
||||||
|
- name: gcc-9-conan-release-i686
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: gcc-9
|
||||||
|
CFLAGS: "-m32 -msse2 -mfpmath=sse"
|
||||||
|
CXXCOMPILER: g++-9
|
||||||
|
CXXFLAGS: "-m32 -msse2 -mfpmath=sse"
|
||||||
|
TARGET_ARCH: i686
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
|
||||||
|
- name: gcc-8-release
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: gcc-8
|
||||||
|
CXXCOMPILER: g++-8
|
||||||
|
CXXFLAGS: -Wno-cast-function-type
|
||||||
|
|
||||||
|
- name: gcc-7-release
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: gcc-7
|
||||||
|
CXXCOMPILER: g++-7
|
||||||
|
|
||||||
|
- name: conan-macos-x64-release-node-12
|
||||||
build_node_package: true
|
build_node_package: true
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 20
|
node: 12
|
||||||
runs-on: ubuntu-22.04
|
runs-on: macos-11
|
||||||
|
BUILD_TOOLS: ON
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: clang-13
|
CCOMPILER: clang
|
||||||
CXXCOMPILER: clang++-13
|
CXXCOMPILER: clang++
|
||||||
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_ASSERTIONS: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
|
||||||
|
- name: conan-macos-x64-release-node-14
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 14
|
||||||
|
runs-on: macos-11
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: clang
|
||||||
|
CXXCOMPILER: clang++
|
||||||
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_ASSERTIONS: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
|
||||||
|
- name: conan-macos-x64-release-node-16
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 16
|
||||||
|
runs-on: macos-11
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: clang
|
||||||
|
CXXCOMPILER: clang++
|
||||||
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_ASSERTIONS: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
|
||||||
|
- name: conan-macos-arm64-release-node-16
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 16
|
||||||
|
runs-on: macos-11
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: clang
|
||||||
|
CXXCOMPILER: clang++
|
||||||
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_ASSERTIONS: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
ENABLE_APPLE_SILICON: ON
|
||||||
|
|
||||||
|
- name: gcc-7-release-shared
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
BUILD_SHARED_LIBS: ON
|
||||||
|
CCOMPILER: gcc-7
|
||||||
|
CXXCOMPILER: g++-7
|
||||||
|
|
||||||
|
- name: node-12-conan-linux-release
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: clang-6.0
|
||||||
|
CXXCOMPILER: clang++-6.0
|
||||||
ENABLE_CONAN: ON
|
ENABLE_CONAN: ON
|
||||||
NODE_PACKAGE_TESTS_ONLY: ON
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
- name: conan-linux-debug-node
|
- name: node-12-conan-linux-debug
|
||||||
build_node_package: true
|
build_node_package: true
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 20
|
node: 12
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
BUILD_TYPE: Debug
|
BUILD_TYPE: Debug
|
||||||
CCOMPILER: clang-13
|
CCOMPILER: clang-6.0
|
||||||
CXXCOMPILER: clang++-13
|
CXXCOMPILER: clang++-6.0
|
||||||
ENABLE_CONAN: ON
|
ENABLE_CONAN: ON
|
||||||
NODE_PACKAGE_TESTS_ONLY: ON
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
- name: conan-macos-x64-release-node
|
- name: node-14-conan-linux-release
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 14
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: clang-6.0
|
||||||
|
CXXCOMPILER: clang++-6.0
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
- name: node-14-conan-linux-debug
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 14
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
CCOMPILER: clang-6.0
|
||||||
|
CXXCOMPILER: clang++-6.0
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
|
||||||
|
- name: node-16-conan-linux-release
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 16
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: clang-6.0
|
||||||
|
CXXCOMPILER: clang++-6.0
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
- name: node-16-conan-linux-debug
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 16
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
CCOMPILER: clang-6.0
|
||||||
|
CXXCOMPILER: clang++-6.0
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
- name: conan-macos-x64-release-node-latest
|
||||||
build_node_package: true
|
build_node_package: true
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
node: 20
|
node: latest
|
||||||
runs-on: macos-13 # x86_64
|
runs-on: macos-11
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: clang
|
CCOMPILER: clang
|
||||||
CXXCOMPILER: clang++
|
CXXCOMPILER: clang++
|
||||||
@@ -321,17 +414,87 @@ jobs:
|
|||||||
ENABLE_ASSERTIONS: ON
|
ENABLE_ASSERTIONS: ON
|
||||||
ENABLE_CONAN: ON
|
ENABLE_CONAN: ON
|
||||||
|
|
||||||
- name: conan-macos-arm64-release-node
|
- name: conan-macos-arm64-release-node-latest
|
||||||
build_node_package: true
|
build_node_package: true
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
node: 20
|
node: latest
|
||||||
runs-on: macos-14 # arm64
|
runs-on: macos-11
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: clang
|
CCOMPILER: clang
|
||||||
CXXCOMPILER: clang++
|
CXXCOMPILER: clang++
|
||||||
CUCUMBER_TIMEOUT: 60000
|
CUCUMBER_TIMEOUT: 60000
|
||||||
ENABLE_ASSERTIONS: ON
|
ENABLE_ASSERTIONS: ON
|
||||||
ENABLE_CONAN: ON
|
ENABLE_CONAN: ON
|
||||||
|
ENABLE_APPLE_SILICON: ON
|
||||||
|
|
||||||
|
- name: node-latest-conan-linux-release
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: true
|
||||||
|
node: latest
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: clang-6.0
|
||||||
|
CXXCOMPILER: clang++-6.0
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
- name: node-latest-conan-linux-debug
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: true
|
||||||
|
node: latest
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
CCOMPILER: clang-6.0
|
||||||
|
CXXCOMPILER: clang++-6.0
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
- name: conan-macos-x64-release-node-lts
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: true
|
||||||
|
node: "lts/*"
|
||||||
|
runs-on: macos-11
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: clang
|
||||||
|
CXXCOMPILER: clang++
|
||||||
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_ASSERTIONS: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
|
||||||
|
- name: conan-macos-arm64-release-node-lts
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: true
|
||||||
|
node: "lts/*"
|
||||||
|
runs-on: macos-11
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: clang
|
||||||
|
CXXCOMPILER: clang++
|
||||||
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_ASSERTIONS: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
ENABLE_APPLE_SILICON: ON
|
||||||
|
|
||||||
|
- name: node-lts-conan-linux-release
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: true
|
||||||
|
node: "lts/*"
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: clang-6.0
|
||||||
|
CXXCOMPILER: clang++-6.0
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
- name: node-lts-conan-linux-debug
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: true
|
||||||
|
node: "lts/*"
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
CCOMPILER: clang-6.0
|
||||||
|
CXXCOMPILER: clang++-6.0
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
name: ${{ matrix.name}}
|
name: ${{ matrix.name}}
|
||||||
continue-on-error: ${{ matrix.continue-on-error }}
|
continue-on-error: ${{ matrix.continue-on-error }}
|
||||||
@@ -351,46 +514,46 @@ jobs:
|
|||||||
ENABLE_CONAN: ${{ matrix.ENABLE_CONAN }}
|
ENABLE_CONAN: ${{ matrix.ENABLE_CONAN }}
|
||||||
ENABLE_SANITIZER: ${{ matrix.ENABLE_SANITIZER }}
|
ENABLE_SANITIZER: ${{ matrix.ENABLE_SANITIZER }}
|
||||||
NODE_PACKAGE_TESTS_ONLY: ${{ matrix.NODE_PACKAGE_TESTS_ONLY }}
|
NODE_PACKAGE_TESTS_ONLY: ${{ matrix.NODE_PACKAGE_TESTS_ONLY }}
|
||||||
|
ENABLE_APPLE_SILICON: ${{ matrix.ENABLE_APPLE_SILICON }}
|
||||||
TARGET_ARCH: ${{ matrix.TARGET_ARCH }}
|
TARGET_ARCH: ${{ matrix.TARGET_ARCH }}
|
||||||
OSRM_CONNECTION_RETRIES: ${{ matrix.OSRM_CONNECTION_RETRIES }}
|
OSRM_CONNECTION_RETRIES: ${{ matrix.OSRM_CONNECTION_RETRIES }}
|
||||||
OSRM_CONNECTION_EXP_BACKOFF_COEF: ${{ matrix.OSRM_CONNECTION_EXP_BACKOFF_COEF }}
|
OSRM_CONNECTION_EXP_BACKOFF_COEF: ${{ matrix.OSRM_CONNECTION_EXP_BACKOFF_COEF }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
- name: Build machine architecture
|
|
||||||
run: uname -m
|
|
||||||
- name: Use Node.js
|
- name: Use Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ matrix.node }}
|
||||||
- name: Enable Node.js cache
|
- name: Enable Node.js cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/.npm
|
path: ~/.npm
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-node-
|
${{ runner.os }}-node-
|
||||||
- name: Enable compiler cache
|
- name: Enable compiler cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/.ccache
|
path: ~/.ccache
|
||||||
key: ccache-${{ matrix.name }}-${{ github.sha }}
|
key: ccache-${{ matrix.name }}-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
ccache-${{ matrix.name }}-
|
ccache-${{ matrix.name }}-
|
||||||
- name: Enable Conan cache
|
- name: Enable Conan cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/.conan
|
path: ~/.conan
|
||||||
key: v9-conan-${{ matrix.name }}-${{ github.sha }}
|
key: v6-conan-${{ matrix.name }}-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
v9-conan-${{ matrix.name }}-
|
v6-conan-${{ matrix.name }}-
|
||||||
- name: Enable test cache
|
- name: Enable test cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{github.workspace}}/test/cache
|
path: ${{github.workspace}}/test/cache
|
||||||
key: v4-test-${{ matrix.name }}-${{ github.sha }}
|
key: v3-test-${{ matrix.name }}-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
v4-test-${{ matrix.name }}-
|
v3-test-${{ matrix.name }}-
|
||||||
|
|
||||||
- name: Prepare environment
|
- name: Prepare environment
|
||||||
run: |
|
run: |
|
||||||
PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
|
PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
|
||||||
@@ -401,7 +564,6 @@ jobs:
|
|||||||
# We can only set this after checkout once we know the workspace directory
|
# We can only set this after checkout once we know the workspace directory
|
||||||
echo "LSAN_OPTIONS=print_suppressions=0:suppressions=${GITHUB_WORKSPACE}/scripts/ci/leaksanitizer.conf" >> $GITHUB_ENV
|
echo "LSAN_OPTIONS=print_suppressions=0:suppressions=${GITHUB_WORKSPACE}/scripts/ci/leaksanitizer.conf" >> $GITHUB_ENV
|
||||||
echo "UBSAN_OPTIONS=symbolize=1:halt_on_error=1:print_stacktrace=1:suppressions=${GITHUB_WORKSPACE}/scripts/ci/undefinedsanitizer.conf" >> $GITHUB_ENV
|
echo "UBSAN_OPTIONS=symbolize=1:halt_on_error=1:print_stacktrace=1:suppressions=${GITHUB_WORKSPACE}/scripts/ci/undefinedsanitizer.conf" >> $GITHUB_ENV
|
||||||
echo "ASAN_OPTIONS=print_suppressions=0:suppressions=${GITHUB_WORKSPACE}/scripts/ci/addresssanitizer.conf" >> $GITHUB_ENV
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${RUNNER_OS}" == "Linux" ]]; then
|
if [[ "${RUNNER_OS}" == "Linux" ]]; then
|
||||||
@@ -412,13 +574,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install dev dependencies
|
- name: Install dev dependencies
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install "conan<2.0.0" || python3 -m pip install "conan<2.0.0" --break-system-packages
|
python3 -m pip install conan==1.51.3
|
||||||
|
|
||||||
# workaround for issue that GitHub Actions seems to not adding it to PATH after https://github.com/actions/runner-images/pull/6499
|
|
||||||
# and that's why CI cannot find conan executable installed above
|
|
||||||
if [[ "${RUNNER_OS}" == "macOS" ]]; then
|
|
||||||
echo "/Library/Frameworks/Python.framework/Versions/Current/bin" >> $GITHUB_PATH
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ccache
|
# ccache
|
||||||
if [[ "${RUNNER_OS}" == "Linux" ]]; then
|
if [[ "${RUNNER_OS}" == "Linux" ]]; then
|
||||||
@@ -426,9 +582,14 @@ jobs:
|
|||||||
elif [[ "${RUNNER_OS}" == "macOS" ]]; then
|
elif [[ "${RUNNER_OS}" == "macOS" ]]; then
|
||||||
brew install ccache
|
brew install ccache
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# clang
|
||||||
|
if [[ "${CCOMPILER}" == "clang-6.0" ]]; then
|
||||||
|
sudo apt-get update -y && sudo apt-get install clang++-6
|
||||||
|
fi
|
||||||
|
|
||||||
# Linux dev packages
|
# Linux dev packages
|
||||||
if [ "${ENABLE_CONAN}" != "ON" ]; then
|
if [ "${TARGET_ARCH}" != "i686" ] && [ "${ENABLE_CONAN}" != "ON" ]; then
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev libboost-all-dev
|
sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev libboost-all-dev
|
||||||
if [[ "${CCOMPILER}" != clang-* ]]; then
|
if [[ "${CCOMPILER}" != clang-* ]]; then
|
||||||
@@ -437,6 +598,9 @@ jobs:
|
|||||||
if [[ "${ENABLE_COVERAGE}" == "ON" ]]; then
|
if [[ "${ENABLE_COVERAGE}" == "ON" ]]; then
|
||||||
sudo apt-get install -y lcov
|
sudo apt-get install -y lcov
|
||||||
fi
|
fi
|
||||||
|
elif [[ $TARGET_ARCH == "i686" ]]; then
|
||||||
|
source ./scripts/ci/before_install.${TARGET_ARCH}.sh
|
||||||
|
echo "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TBB
|
# TBB
|
||||||
@@ -450,6 +614,7 @@ jobs:
|
|||||||
tar zxvf onetbb.tgz
|
tar zxvf onetbb.tgz
|
||||||
sudo cp -a oneapi-tbb-${TBB_VERSION}/lib/. /usr/local/lib/
|
sudo cp -a oneapi-tbb-${TBB_VERSION}/lib/. /usr/local/lib/
|
||||||
sudo cp -a oneapi-tbb-${TBB_VERSION}/include/. /usr/local/include/
|
sudo cp -a oneapi-tbb-${TBB_VERSION}/include/. /usr/local/include/
|
||||||
|
|
||||||
- name: Prepare build
|
- name: Prepare build
|
||||||
run: |
|
run: |
|
||||||
mkdir ${OSRM_BUILD_DIR}
|
mkdir ${OSRM_BUILD_DIR}
|
||||||
@@ -460,18 +625,22 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
echo "CC=${CCOMPILER}" >> $GITHUB_ENV
|
echo "CC=${CCOMPILER}" >> $GITHUB_ENV
|
||||||
echo "CXX=${CXXCOMPILER}" >> $GITHUB_ENV
|
echo "CXX=${CXXCOMPILER}" >> $GITHUB_ENV
|
||||||
if [[ "${RUNNER_OS}" == "macOS" ]]; then
|
|
||||||
# missing from GCC path, needed for conan builds of libiconv, for example.
|
|
||||||
sudo xcode-select --switch /Library/Developer/CommandLineTools
|
|
||||||
echo "LIBRARY_PATH=${LIBRARY_PATH}:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib" >> $GITHUB_ENV
|
|
||||||
echo "CPATH=${CPATH}:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build and install OSRM
|
- name: Build and install OSRM
|
||||||
run: |
|
run: |
|
||||||
echo "Using ${JOBS} jobs"
|
echo "Using ${JOBS} jobs"
|
||||||
pushd ${OSRM_BUILD_DIR}
|
pushd ${OSRM_BUILD_DIR}
|
||||||
|
|
||||||
|
# handle Apple Silicon cross compilation
|
||||||
|
if [[ "${ENABLE_APPLE_SILICON}" == "ON" ]]; then
|
||||||
|
ARCH=arm64
|
||||||
|
TARGET="${ARCH}-apple-darwin"
|
||||||
|
CFLAGS="$CFLAGS --target=$TARGET"
|
||||||
|
CXXFLAGS="$CXXFLAGS --target=$TARGET"
|
||||||
|
APPLE_SILICON_FLAGS=(-DCMAKE_C_COMPILER_TARGET="$TARGET" -DCMAKE_CXX_COMPILER_TARGET="$TARGET" -DCMAKE_SYSTEM_PROCESSOR="${ARCH}" -DCMAKE_SYSTEM_NAME="Darwin" -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS")
|
||||||
|
else
|
||||||
|
APPLE_SILICON_FLAGS=()
|
||||||
|
fi
|
||||||
|
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
||||||
-DENABLE_CONAN=${ENABLE_CONAN:-OFF} \
|
-DENABLE_CONAN=${ENABLE_CONAN:-OFF} \
|
||||||
@@ -483,10 +652,12 @@ jobs:
|
|||||||
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
|
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
|
||||||
-DBUILD_TOOLS=${BUILD_TOOLS:-OFF} \
|
-DBUILD_TOOLS=${BUILD_TOOLS:-OFF} \
|
||||||
-DENABLE_CCACHE=ON \
|
-DENABLE_CCACHE=ON \
|
||||||
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
|
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
|
||||||
|
"${APPLE_SILICON_FLAGS[@]}"
|
||||||
|
|
||||||
make --jobs=${JOBS}
|
make --jobs=${JOBS}
|
||||||
|
|
||||||
if [[ "${NODE_PACKAGE_TESTS_ONLY}" != "ON" ]]; then
|
if [[ "${NODE_PACKAGE_TESTS_ONLY}" != "ON" && "${ENABLE_APPLE_SILICON}" != "ON" ]]; then
|
||||||
make tests --jobs=${JOBS}
|
make tests --jobs=${JOBS}
|
||||||
make benchmarks --jobs=${JOBS}
|
make benchmarks --jobs=${JOBS}
|
||||||
ccache -s
|
ccache -s
|
||||||
@@ -498,14 +669,14 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
popd
|
popd
|
||||||
- name: Build example
|
- name: Build example
|
||||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }}
|
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
||||||
run: |
|
run: |
|
||||||
mkdir example/build && pushd example/build
|
mkdir example/build && pushd example/build
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
|
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
|
||||||
make --jobs=${JOBS}
|
make --jobs=${JOBS}
|
||||||
popd
|
popd
|
||||||
- name: Run all tests
|
- name: Run all tests
|
||||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }}
|
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
||||||
run: |
|
run: |
|
||||||
make -C test/data benchmark
|
make -C test/data benchmark
|
||||||
|
|
||||||
@@ -516,7 +687,7 @@ jobs:
|
|||||||
# All tests assume to be run from the build directory
|
# All tests assume to be run from the build directory
|
||||||
pushd ${OSRM_BUILD_DIR}
|
pushd ${OSRM_BUILD_DIR}
|
||||||
for i in ./unit_tests/*-tests ; do echo Running $i ; $i ; done
|
for i in ./unit_tests/*-tests ; do echo Running $i ; $i ; done
|
||||||
if [ -z "${ENABLE_SANITIZER}" ]; then
|
if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then
|
||||||
npm run nodejs-tests
|
npm run nodejs-tests
|
||||||
fi
|
fi
|
||||||
popd
|
popd
|
||||||
@@ -526,45 +697,16 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
pushd ${OSRM_BUILD_DIR}
|
pushd ${OSRM_BUILD_DIR}
|
||||||
make --jobs=${JOBS} benchmarks
|
make --jobs=${JOBS} benchmarks
|
||||||
./src/benchmarks/alias-bench
|
./src/benchmarks/alias-bench
|
||||||
./src/benchmarks/json-render-bench ../src/benchmarks/portugal_to_korea.json
|
./src/benchmarks/json-render-bench ../src/benchmarks/portugal_to_korea.json
|
||||||
./src/benchmarks/match-bench ../test/data/ch/monaco.osrm ch
|
./src/benchmarks/match-bench ../test/data/ch/monaco.osrm
|
||||||
./src/benchmarks/match-bench ../test/data/mld/monaco.osrm mld
|
|
||||||
./src/benchmarks/packedvector-bench
|
./src/benchmarks/packedvector-bench
|
||||||
./src/benchmarks/rtree-bench ../test/data/monaco.osrm.ramIndex ../test/data/monaco.osrm.fileIndex ../test/data/monaco.osrm.nbg_nodes
|
./src/benchmarks/rtree-bench ../test/data/monaco.osrm.ramIndex ../test/data/monaco.osrm.fileIndex ../test/data/monaco.osrm.nbg_nodes
|
||||||
popd
|
popd
|
||||||
|
- name: Run Node package tests only
|
||||||
- name: Use Node 18
|
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
||||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
- name: Run Node package tests on Node 18
|
|
||||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
|
|
||||||
run: |
|
run: |
|
||||||
node --version
|
|
||||||
npm run nodejs-tests
|
npm run nodejs-tests
|
||||||
- name: Use Node 20
|
|
||||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- name: Run Node package tests on Node 20
|
|
||||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
|
|
||||||
run: |
|
|
||||||
node --version
|
|
||||||
npm run nodejs-tests
|
|
||||||
- name: Use Node latest
|
|
||||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: latest
|
|
||||||
- name: Run Node package tests on Node-latest
|
|
||||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
|
|
||||||
run: |
|
|
||||||
node --version
|
|
||||||
npm run nodejs-tests
|
|
||||||
|
|
||||||
- name: Upload test logs
|
- name: Upload test logs
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
if: failure()
|
if: failure()
|
||||||
@@ -572,22 +714,30 @@ jobs:
|
|||||||
name: logs
|
name: logs
|
||||||
path: test/logs/
|
path: test/logs/
|
||||||
|
|
||||||
# - name: Generate code coverage
|
- name: Generate code coverage
|
||||||
# if: ${{ matrix.ENABLE_COVERAGE == 'ON' }}
|
if: ${{ matrix.ENABLE_COVERAGE == 'ON' }}
|
||||||
# run: |
|
run: |
|
||||||
# lcov --directory . --capture --output-file coverage.info # capture coverage info
|
lcov --directory . --capture --output-file coverage.info # capture coverage info
|
||||||
# lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
|
lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
|
||||||
# lcov --list coverage.info #debug info
|
lcov --list coverage.info #debug info
|
||||||
|
# Uploading report to CodeCov
|
||||||
# # Uploading report to CodeCov
|
- name: Upload code coverage
|
||||||
# - name: Upload code coverage
|
if: ${{ matrix.ENABLE_COVERAGE == 'ON' }}
|
||||||
# if: ${{ matrix.ENABLE_COVERAGE == 'ON' }}
|
uses: codecov/codecov-action@v1
|
||||||
# uses: codecov/codecov-action@v1
|
with:
|
||||||
# with:
|
files: coverage.info
|
||||||
# files: coverage.info
|
name: codecov-osrm-backend
|
||||||
# name: codecov-osrm-backend
|
fail_ci_if_error: true
|
||||||
# fail_ci_if_error: true
|
verbose: true
|
||||||
# verbose: true
|
- name: Check Apple Silicon binary
|
||||||
|
if: ${{ matrix.ENABLE_APPLE_SILICON == 'ON' }}
|
||||||
|
run: |
|
||||||
|
ARCH=$(file ./lib/binding/node_osrm.node | awk '{printf $NF}')
|
||||||
|
if [[ "$ARCH" != "arm64" ]]; then
|
||||||
|
file ./lib/binding/node_osrm.node
|
||||||
|
>&2 echo "Wrong architecture!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
- name: Build Node package
|
- name: Build Node package
|
||||||
if: ${{ matrix.build_node_package }}
|
if: ${{ matrix.build_node_package }}
|
||||||
run: ./scripts/ci/node_package.sh
|
run: ./scripts/ci/node_package.sh
|
||||||
@@ -607,6 +757,6 @@ jobs:
|
|||||||
|
|
||||||
ci-complete:
|
ci-complete:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
needs: [build-test-publish, docker-image, windows-release-node]
|
needs: [build-test-publish, docker-image, windows]
|
||||||
steps:
|
steps:
|
||||||
- run: echo "CI complete"
|
- run: echo "CI complete"
|
||||||
|
|||||||
@@ -105,4 +105,3 @@ debug.lua
|
|||||||
|
|
||||||
# node-osrm artifacts
|
# node-osrm artifacts
|
||||||
lib/binding
|
lib/binding
|
||||||
|
|
||||||
|
|||||||
+1
-63
@@ -1,66 +1,4 @@
|
|||||||
# Unreleased
|
# 5.27.0-rc.1
|
||||||
- Changes from 5.27.1
|
|
||||||
- Features
|
|
||||||
- ADDED: Add support for a keepalive_timeout flag. [#6674](https://github.com/Project-OSRM/osrm-backend/pull/6674)
|
|
||||||
- ADDED: Add support for a default_radius flag. [#6575](https://github.com/Project-OSRM/osrm-backend/pull/6575)
|
|
||||||
- ADDED: Add support for disabling feature datasets. [#6666](https://github.com/Project-OSRM/osrm-backend/pull/6666)
|
|
||||||
- ADDED: Add support for opposite approach request parameter. [#6842](https://github.com/Project-OSRM/osrm-backend/pull/6842)
|
|
||||||
- ADDED: Add support for accessing edge flags in `process_segment` [#6658](https://github.com/Project-OSRM/osrm-backend/pull/6658)
|
|
||||||
- Build:
|
|
||||||
- ADDED: Add CI job which builds OSRM with gcc 12. [#6455](https://github.com/Project-OSRM/osrm-backend/pull/6455)
|
|
||||||
- CHANGED: Upgrade to clang-tidy 15. [#6439](https://github.com/Project-OSRM/osrm-backend/pull/6439)
|
|
||||||
- CHANGED: Update actions/cache to v3. [#6420](https://github.com/Project-OSRM/osrm-backend/pull/6420)
|
|
||||||
- REMOVED: Drop support of Node 12 & 14. [#6431](https://github.com/Project-OSRM/osrm-backend/pull/6431)
|
|
||||||
- ADDED: Add 'load directly' mode to default Cucumber test suite. [#6663](https://github.com/Project-OSRM/osrm-backend/pull/6663)
|
|
||||||
- CHANGED: Fix compilation for Boost 1.85.0 [#6856](https://github.com/Project-OSRM/osrm-backend/pull/6856)
|
|
||||||
- CHANGED: Drop support for Node 16 [#6855](https://github.com/Project-OSRM/osrm-backend/pull/6855)
|
|
||||||
- REMOVED: Remove unused AppVeyor files [#6860](https://github.com/Project-OSRM/osrm-backend/pull/6860)
|
|
||||||
- CHANGED: Upgrade clang-format to version 15 [#6859](https://github.com/Project-OSRM/osrm-backend/pull/6859)
|
|
||||||
- NodeJS:
|
|
||||||
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
|
|
||||||
- Misc:
|
|
||||||
- CHANGED: Update Conan Boost version to 1.85.0. [#6868](https://github.com/Project-OSRM/osrm-backend/pull/6868)
|
|
||||||
- FIXED: Fix an error in a RouteParameters AnnotationsType operator overload. [#6646](https://github.com/Project-OSRM/osrm-backend/pull/6646)
|
|
||||||
- ADDED: Add support for "unlimited" to be passed as a value for the default-radius and max-matching-radius flags. [#6599](https://github.com/Project-OSRM/osrm-backend/pull/6599)
|
|
||||||
- CHANGED: Allow -1.0 as unlimited for default_radius value. [#6599](https://github.com/Project-OSRM/osrm-backend/pull/6599)
|
|
||||||
- CHANGED: keep libosrm* in the docker image for downstream linking [#6602](https://github.com/Project-OSRM/osrm-backend/pull/6602)
|
|
||||||
- CHANGED: Move vector in CSVFilesParser instead copying it. [#6470](https://github.com/Project-OSRM/osrm-backend/pull/6470)
|
|
||||||
- REMOVED: Get rid of unused functions in util/json_util.hpp. [#6446](https://github.com/Project-OSRM/osrm-backend/pull/6446)
|
|
||||||
- FIXED: Apply workaround for Conan installation issue on CI. [#6442](https://github.com/Project-OSRM/osrm-backend/pull/6442)
|
|
||||||
- FIXED: Fix `npm audit` warnings in NPM package. [#6437](https://github.com/Project-OSRM/osrm-backend/pull/6437)
|
|
||||||
- FIXED: Handle snapping parameter for all plugins in NodeJs bindings, but not for Route only. [#6417](https://github.com/Project-OSRM/osrm-backend/pull/6417)
|
|
||||||
- FIXED: Fix annotations=true handling in NodeJS bindings & libosrm. [#6415](https://github.com/Project-OSRM/osrm-backend/pull/6415/)
|
|
||||||
- FIXED: Fix bindings compilation issue on the latest Node. Update NAN to 2.17.0. [#6416](https://github.com/Project-OSRM/osrm-backend/pull/6416)
|
|
||||||
- CHANGED: Make edge metrics strongly typed [#6420](https://github.com/Project-OSRM/osrm-backend/pull/6420)
|
|
||||||
- FIXED: Typo in file name src/util/timed_historgram.cpp -> src/util/timed_histogram.cpp [#6428](https://github.com/Project-OSRM/osrm-backend/issues/6428)
|
|
||||||
- CHANGED: Replace boost::string_ref with std::string_view [#6433](https://github.com/Project-OSRM/osrm-backend/pull/6433)
|
|
||||||
- ADDED: Print tracebacks for Lua runtime errors [#6564](https://github.com/Project-OSRM/osrm-backend/pull/6564)
|
|
||||||
- FIXED: Added a variable to preprocessor guard in file osrm-backend/include/util/range_table.hpp to solve build error. [#6596](https://github.com/Project-OSRM/osrm-backend/pull/6596)
|
|
||||||
- FIXED: Ensure required file check in osrm-routed is correctly enforced. [#6655](https://github.com/Project-OSRM/osrm-backend/pull/6655)
|
|
||||||
- FIXED: Correct HTTP docs to reflect summary output dependency on steps parameter. [#6655](https://github.com/Project-OSRM/osrm-backend/pull/6655)
|
|
||||||
- ADDED: Extract prerelease/build information from package semver [#6839](https://github.com/Project-OSRM/osrm-backend/pull/6839)
|
|
||||||
- Profiles:
|
|
||||||
- FIXED: Bicycle and foot profiles now don't route on proposed ways [#6615](https://github.com/Project-OSRM/osrm-backend/pull/6615)
|
|
||||||
- Routing:
|
|
||||||
- FIXED: Fix adding traffic signal penalties during compression [#6419](https://github.com/Project-OSRM/osrm-backend/pull/6419)
|
|
||||||
- FIXED: Correctly handle compressed traffic signals. [#6724](https://github.com/Project-OSRM/osrm-backend/pull/6724)
|
|
||||||
- FIXED: Fix bug when searching for maneuver overrides [#6739](https://github.com/Project-OSRM/osrm-backend/pull/6739)
|
|
||||||
- FIXED: Remove force-loop checks for routes with u-turns [#6858](https://github.com/Project-OSRM/osrm-backend/pull/6858)
|
|
||||||
- FIXED: Correctly check runtime search conditions for forcing routing steps [#6866](https://github.com/Project-OSRM/osrm-backend/pull/6866)
|
|
||||||
- Map Matching:
|
|
||||||
- CHANGED: Optimise path distance calculation in MLD map matching. [#6876](https://github.com/Project-OSRM/osrm-backend/pull/6876)
|
|
||||||
- Debug tiles:
|
|
||||||
- FIXED: Ensure speed layer features have unique ids. [#6726](https://github.com/Project-OSRM/osrm-backend/pull/6726)
|
|
||||||
|
|
||||||
# 5.27.1
|
|
||||||
- Changes from 5.27.0
|
|
||||||
- Misc:
|
|
||||||
- FIXED: Revert back to using custom HTTP parser instead of Boost.Beast. [#6407](https://github.com/Project-OSRM/osrm-backend/pull/6407)
|
|
||||||
- FIXED: Fix bug with large HTTP requests leading to Bad Request in osrm-routed. [#6403](https://github.com/Project-OSRM/osrm-backend/pull/6403)
|
|
||||||
- Routing:
|
|
||||||
- CHANGED: Add support for surface=metal,grass_paver,woodchips in bicyle profile. [#6395](https://github.com/Project-OSRM/osrm-backend/pull/6395)
|
|
||||||
|
|
||||||
# 5.27.0
|
|
||||||
- Changes from 5.26.0
|
- Changes from 5.26.0
|
||||||
- API:
|
- API:
|
||||||
- ADDED: Add Flatbuffers support to NodeJS bindings. [#6338](https://github.com/Project-OSRM/osrm-backend/pull/6338)
|
- ADDED: Add Flatbuffers support to NodeJS bindings. [#6338](https://github.com/Project-OSRM/osrm-backend/pull/6338)
|
||||||
|
|||||||
+212
-75
@@ -1,8 +1,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.18)
|
cmake_minimum_required(VERSION 3.2)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
||||||
|
|
||||||
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
|
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
|
||||||
message(FATAL_ERROR "In-source builds are not allowed.
|
message(FATAL_ERROR "In-source builds are not allowed.
|
||||||
@@ -33,6 +33,7 @@ option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
|
|||||||
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
|
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
|
||||||
option(ENABLE_LTO "Use LTO if available" OFF)
|
option(ENABLE_LTO "Use LTO if available" OFF)
|
||||||
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
|
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
|
||||||
|
option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON)
|
||||||
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
|
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
|
||||||
option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF)
|
option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF)
|
||||||
|
|
||||||
@@ -42,13 +43,16 @@ if (ENABLE_CLANG_TIDY)
|
|||||||
message(FATAL_ERROR "ENABLE_CLANG_TIDY is ON but clang-tidy is not found!")
|
message(FATAL_ERROR "ENABLE_CLANG_TIDY is ON but clang-tidy is not found!")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Found clang-tidy at ${CLANG_TIDY_COMMAND}")
|
message(STATUS "Found clang-tidy at ${CLANG_TIDY_COMMAND}")
|
||||||
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND};--warnings-as-errors=*;--header-filter=.*")
|
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND};--warnings-as-errors=*")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
# be compatible with version handling before cmake 3.x
|
# be compatible with version handling before cmake 3.x
|
||||||
|
if (POLICY CMP0048)
|
||||||
|
cmake_policy(SET CMP0048 OLD)
|
||||||
|
endif()
|
||||||
if (POLICY CMP0057)
|
if (POLICY CMP0057)
|
||||||
cmake_policy(SET CMP0057 NEW)
|
cmake_policy(SET CMP0057 NEW)
|
||||||
endif()
|
endif()
|
||||||
@@ -70,17 +74,14 @@ include(JSONParser)
|
|||||||
file(READ "package.json" packagejsonraw)
|
file(READ "package.json" packagejsonraw)
|
||||||
sbeParseJson(packagejson packagejsonraw)
|
sbeParseJson(packagejson packagejsonraw)
|
||||||
|
|
||||||
# This regex is not strict enough, but the correct one is too complicated for cmake matching.
|
if (packagejson.version MATCHES "^([0-9]+)\.([0-9]+)\.([0-9]+)")
|
||||||
# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
|
set(OSRM_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||||
if (packagejson.version MATCHES "^([0-9]+)\.([0-9]+)\.([0-9]+)([-+][0-9a-zA-Z.-]+)?$")
|
set(OSRM_VERSION_MINOR ${CMAKE_MATCH_2})
|
||||||
set(OSRM_VERSION_MAJOR ${CMAKE_MATCH_1})
|
set(OSRM_VERSION_PATCH ${CMAKE_MATCH_3})
|
||||||
set(OSRM_VERSION_MINOR ${CMAKE_MATCH_2})
|
|
||||||
set(OSRM_VERSION_PATCH ${CMAKE_MATCH_3})
|
|
||||||
set(OSRM_VERSION_PRERELEASE_BUILD ${CMAKE_MATCH_4})
|
|
||||||
|
|
||||||
set(OSRM_VERSION packagejson.version)
|
set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}")
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Version from package.json cannot be parsed, expected semver compatible label, but found ${packagejson.version}")
|
message(FATAL_ERROR "Version from package.json cannot be parsed, expected semver compatible X.Y.Z, but found ${packagejson.version}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
@@ -112,10 +113,27 @@ include(CheckCXXCompilerFlag)
|
|||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
set(bitness 32)
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
set(bitness 64)
|
||||||
message(STATUS "Building on a 64 bit system")
|
message(STATUS "Building on a 64 bit system")
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Building on a 32 bit system is not supported")
|
message(STATUS "Building on a 32 bit system")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WIN32 AND MSVC_VERSION LESS 1900)
|
||||||
|
message(FATAL_ERROR "Building with Microsoft compiler needs Latest Visual Studio 2015 (Community or better)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Strictly require GCC>=5.0 and Clang>=3.4 - GCC 4.8 is already too old for C++14.
|
||||||
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||||
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
||||||
|
message(FATAL_ERROR "GCC>=5.0 required. In case you are on Ubuntu upgrade via ppa:ubuntu-toolchain-r/test")
|
||||||
|
endif()
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
|
||||||
|
message(FATAL_ERROR "Clang>=3.4 required. In case you are on Ubuntu upgrade via http://apt.llvm.org")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
||||||
@@ -151,7 +169,7 @@ add_library(UPDATER OBJECT ${UpdaterGlob})
|
|||||||
add_library(STORAGE OBJECT ${StorageGlob})
|
add_library(STORAGE OBJECT ${StorageGlob})
|
||||||
add_library(ENGINE OBJECT ${EngineGlob})
|
add_library(ENGINE OBJECT ${EngineGlob})
|
||||||
|
|
||||||
if (BUILD_ROUTED)
|
if (BUILD_ROUTED)
|
||||||
add_library(SERVER OBJECT ${ServerGlob})
|
add_library(SERVER OBJECT ${ServerGlob})
|
||||||
add_executable(osrm-routed src/tools/routed.cpp $<TARGET_OBJECTS:SERVER> $<TARGET_OBJECTS:UTIL>)
|
add_executable(osrm-routed src/tools/routed.cpp $<TARGET_OBJECTS:SERVER> $<TARGET_OBJECTS:UTIL>)
|
||||||
endif()
|
endif()
|
||||||
@@ -172,6 +190,26 @@ add_library(osrm_customize src/osrm/customizer.cpp $<TARGET_OBJECTS:CUSTOMIZER>
|
|||||||
add_library(osrm_update $<TARGET_OBJECTS:UPDATER> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
|
add_library(osrm_update $<TARGET_OBJECTS:UPDATER> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
|
||||||
add_library(osrm_store $<TARGET_OBJECTS:STORAGE> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
|
add_library(osrm_store $<TARGET_OBJECTS:STORAGE> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
|
||||||
|
|
||||||
|
if(ENABLE_GOLD_LINKER)
|
||||||
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
||||||
|
if("${LD_VERSION}" MATCHES "GNU gold")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
|
||||||
|
set(OSRM_LDFLAGS "${OSRM_LDFLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
|
||||||
|
message(STATUS "Using GNU gold as linker.")
|
||||||
|
|
||||||
|
# Issue 2785: check gold binutils version and don't use gc-sections for versions prior 2.25
|
||||||
|
string(REGEX REPLACE ".*\\(GNU Binutils[^\\)0-9]+([0-9]+\\.[0-9]+)[^\\)]*\\).*" "\\1" GOLD_BINUTILS_VERSION "${LD_VERSION}")
|
||||||
|
if ("${GOLD_BINUTILS_VERSION}" VERSION_LESS "2.26")
|
||||||
|
message(STATUS "Disabling gc-sections on gold binutils < 2.26, see: https://sourceware.org/bugzilla/show_bug.cgi?id=17639")
|
||||||
|
set(LD_AVOID_GC_SECTIONS TRUE)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(WARNING "GNU gold linker isn't available.")
|
||||||
|
set(ENABLE_GOLD_LINKER OFF)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Explicitly set the build type to Release if no other type is specified
|
# Explicitly set the build type to Release if no other type is specified
|
||||||
# on the command line. Without this, cmake defaults to an unoptimized,
|
# on the command line. Without this, cmake defaults to an unoptimized,
|
||||||
# non-debug build, which almost nobody wants.
|
# non-debug build, which almost nobody wants.
|
||||||
@@ -209,21 +247,78 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og -ggdb")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og -ggdb")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_LTO AND (CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo))
|
|
||||||
include(CheckIPOSupported)
|
if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
||||||
check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT error)
|
message(STATUS "Configuring release mode optimizations")
|
||||||
if(LTO_SUPPORTED)
|
# Check if LTO is available
|
||||||
message(STATUS "IPO / LTO enabled")
|
check_cxx_compiler_flag("-Wl,-flto" LTO_AVAILABLE)
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
|
||||||
else()
|
if(ENABLE_LTO AND LTO_AVAILABLE)
|
||||||
message(WARNING "IPO / LTO not supported: <${error}>")
|
set(OLD_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||||
|
# GCC in addition allows parallelizing LTO
|
||||||
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||||
|
include(ProcessorCount)
|
||||||
|
ProcessorCount(NPROC)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto=${NPROC}")
|
||||||
|
else()
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
|
||||||
|
endif()
|
||||||
|
set(CHECK_LTO_SRC "int main(){return 0;}")
|
||||||
|
check_cxx_source_compiles("${CHECK_LTO_SRC}" LTO_WORKS)
|
||||||
|
if(LTO_WORKS)
|
||||||
|
message(STATUS "LTO working")
|
||||||
|
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -flto")
|
||||||
|
set(OSRM_LDFLAGS "${OSRM_LDFLAGS} -flto")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -flto")
|
||||||
|
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -flto")
|
||||||
|
else()
|
||||||
|
message(STATUS "LTO broken")
|
||||||
|
set(CMAKE_CXX_FLAGS "${OLD_CXX_FLAGS}")
|
||||||
|
set(ENABLE_LTO Off)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Since gcc 4.9 the LTO format is non-standart ('slim'), so we need to use the build-in tools
|
||||||
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT MINGW)
|
||||||
|
find_program(GCC_AR gcc-ar)
|
||||||
|
find_program(GCC_RANLIB gcc-ranlib)
|
||||||
|
if ("${GCC_AR}" STREQUAL "GCC_AR-NOTFOUND" OR "${GCC_RANLIB}" STREQUAL "GCC_RANLIB-NOTFOUND")
|
||||||
|
message(WARNING "GCC specific binutils not found. In case of linker issues export env vars: AR=gcc-ar, NM=gcc-nm, RANLIB=gcc-ranlib")
|
||||||
|
else()
|
||||||
|
message(STATUS "Using GCC specific binutils for LTO:")
|
||||||
|
message(STATUS " ${GCC_AR}")
|
||||||
|
message(STATUS " ${GCC_RANLIB}")
|
||||||
|
set(CMAKE_AR ${GCC_AR})
|
||||||
|
set(CMAKE_RANLIB ${GCC_RANLIB})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Same for clang LTO requires their own toolchain
|
||||||
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
find_program(LLVM_AR llvm-ar)
|
||||||
|
find_program(LLVM_RANLIB llvm-ranlib)
|
||||||
|
if ("${LLVM_AR}" STREQUAL "LLVM_AR-NOTFOUND" OR "${LLVM_RANLIB}" STREQUAL "LLVM_RANLIB-NOTFOUND")
|
||||||
|
message(WARNING "LLVM specific binutils not found.")
|
||||||
|
else()
|
||||||
|
message(STATUS "Using LLVM specific binutils for LTO:")
|
||||||
|
message(STATUS " ${LLVM_AR}")
|
||||||
|
message(STATUS " ${LLVM_RANLIB}")
|
||||||
|
set(CMAKE_AR ${LLVM_AR})
|
||||||
|
set(CMAKE_RANLIB ${LLVM_RANLIB})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# TODO: this was added for Mason, we are not sure if it is true after migration to Conan
|
||||||
|
if(UNIX AND NOT APPLE AND ENABLE_CONAN AND (LTO_WORKS OR ENABLE_GOLD_LINKER))
|
||||||
|
message(WARNING "ENABLE_CONAN and ENABLE_LTO/ENABLE_GOLD_LINKER may not work on all linux systems currently")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(MAYBE_COVERAGE_LIBRARIES "")
|
set(MAYBE_COVERAGE_LIBRARIES "")
|
||||||
if (ENABLE_COVERAGE)
|
if (ENABLE_COVERAGE)
|
||||||
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||||
message(ERROR "ENABLE_COVERAGE=ON only makes sense with a Debug build")
|
message(ERROR "ENABLE_COVERAGE=ON only make sense with a Debug build")
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "Enabling coverage")
|
message(STATUS "Enabling coverage")
|
||||||
set(MAYBE_COVERAGE_LIBRARIES "-lgcov")
|
set(MAYBE_COVERAGE_LIBRARIES "-lgcov")
|
||||||
@@ -257,6 +352,14 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|||||||
add_dependency_defines(-DWIN32)
|
add_dependency_defines(-DWIN32)
|
||||||
set(OPTIONAL_SOCKET_LIBS ws2_32 wsock32)
|
set(OPTIONAL_SOCKET_LIBS ws2_32 wsock32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# -fpermissive is required for parallel_do Intel TBB internal issue with GCC < 5
|
||||||
|
# https://github.com/Project-OSRM/osrm-backend/pull/3603#issuecomment-277688589
|
||||||
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
||||||
|
message(STATUS "Adding -fpermissive for GCC version < 5 bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51048). See #3603.")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
|
||||||
|
endif()
|
||||||
|
|
||||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||||
# using Intel C++
|
# using Intel C++
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-intel -wd10237 -Wall -ipo -fPIC")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-intel -wd10237 -Wall -ipo -fPIC")
|
||||||
@@ -274,11 +377,50 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|||||||
target_link_libraries(osrm-extract wsock32 ws2_32)
|
target_link_libraries(osrm-extract wsock32 ws2_32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
# Configuring linker
|
||||||
find_library(RT_LIB rt)
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} "-Wl,--version" ERROR_QUIET OUTPUT_VARIABLE LINKER_VERSION)
|
||||||
if (RT_LIB)
|
# For ld.gold and ld.bfs (the GNU linkers) we optimize hard
|
||||||
set(MAYBE_RT_LIBRARY -lrt)
|
if("${LINKER_VERSION}" MATCHES "GNU gold" OR "${LINKER_VERSION}" MATCHES "GNU ld")
|
||||||
|
message(STATUS "Setting linker optimizations")
|
||||||
|
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR "${LD_AVOID_GC_SECTIONS}"))
|
||||||
|
# Tell compiler to put every function in separate section, linker can then match sections and functions
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
|
||||||
|
# Tell linker to do dead code and data eminination during link time discarding sections
|
||||||
|
set(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--gc-sections")
|
||||||
endif()
|
endif()
|
||||||
|
# Default linker optimization flags
|
||||||
|
set(LINKER_FLAGS "${LINKER_FLAGS} -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common")
|
||||||
|
|
||||||
|
else()
|
||||||
|
message(STATUS "Using unknown linker, not setting linker optimizations")
|
||||||
|
endif ()
|
||||||
|
set(OSRM_LDFLAGS "${OSRM_LDFLAGS} ${LINKER_FLAGS}")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}")
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}")
|
||||||
|
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")
|
||||||
|
|
||||||
|
# Activate C++1y
|
||||||
|
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
|
||||||
|
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -std=c++17")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Configuring other platform dependencies
|
||||||
|
if(APPLE)
|
||||||
|
execute_process(COMMAND xcrun --sdk macosx --show-sdk-path OUTPUT_VARIABLE CMAKE_OSX_SYSROOT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
|
||||||
|
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
|
||||||
|
if(OSXLIBSTD)
|
||||||
|
message(STATUS "linking against ${OSXLIBSTD}")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=${OSXLIBSTD}")
|
||||||
|
elseif(DARWIN_VERSION GREATER 12)
|
||||||
|
message(STATUS "linking against libc++")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(UNIX AND NOT APPLE)
|
||||||
|
set(MAYBE_RT_LIBRARY -lrt)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
@@ -290,6 +432,11 @@ include_directories(SYSTEM ${RAPIDJSON_INCLUDE_DIR})
|
|||||||
set(MICROTAR_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src")
|
set(MICROTAR_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src")
|
||||||
include_directories(SYSTEM ${MICROTAR_INCLUDE_DIR})
|
include_directories(SYSTEM ${MICROTAR_INCLUDE_DIR})
|
||||||
|
|
||||||
|
set(MBXGEOM_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/geometry.hpp-0.9.2/include")
|
||||||
|
include_directories(SYSTEM ${MBXGEOM_INCLUDE_DIR})
|
||||||
|
set(CHEAPRULER_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/cheap-ruler-cpp-2778eb8/include")
|
||||||
|
include_directories(SYSTEM ${CHEAPRULER_INCLUDE_DIR})
|
||||||
|
|
||||||
add_library(MICROTAR OBJECT "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src/microtar.c")
|
add_library(MICROTAR OBJECT "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src/microtar.c")
|
||||||
set_property(TARGET MICROTAR PROPERTY POSITION_INDEPENDENT_CODE ON)
|
set_property(TARGET MICROTAR PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
target_no_warning(MICROTAR unused-variable)
|
target_no_warning(MICROTAR unused-variable)
|
||||||
@@ -309,10 +456,10 @@ add_subdirectory(${FLATBUFFERS_SRC_DIR}
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-build
|
${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-build
|
||||||
EXCLUDE_FROM_ALL)
|
EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
set(FMT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/fmt/include")
|
set(FMT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/fmt-9.1.0/include")
|
||||||
add_compile_definitions(FMT_HEADER_ONLY)
|
add_compile_definitions(FMT_HEADER_ONLY)
|
||||||
include_directories(SYSTEM ${FMT_INCLUDE_DIR})
|
include_directories(SYSTEM ${FMT_INCLUDE_DIR})
|
||||||
|
|
||||||
|
|
||||||
# see https://stackoverflow.com/questions/70898030/boost-link-error-using-conan-find-package
|
# see https://stackoverflow.com/questions/70898030/boost-link-error-using-conan-find-package
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
@@ -322,24 +469,22 @@ endif()
|
|||||||
if(ENABLE_CONAN)
|
if(ENABLE_CONAN)
|
||||||
message(STATUS "Installing dependencies via Conan")
|
message(STATUS "Installing dependencies via Conan")
|
||||||
|
|
||||||
# Conan will generate Find*.cmake files to build directory, so we use them with the highest priority
|
# Conan will generate Find*.cmake files to build directory, so we use them with the highest priority
|
||||||
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_BINARY_DIR})
|
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_BINARY_DIR})
|
||||||
list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_BINARY_DIR})
|
list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/cmake/conan.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/cmake/conan.cmake)
|
||||||
|
|
||||||
conan_check(REQUIRED)
|
set(CONAN_BOOST_VERSION "1.79.0#96e4902111a2e343a8ba0aa95391bb58")
|
||||||
|
set(CONAN_BZIP2_VERSION "1.0.8#d1b2d5816f25865acf978501dff1f897")
|
||||||
set(CONAN_BOOST_VERSION "1.85.0@#14265ec82b25d91305bbb3b30d3357f8")
|
set(CONAN_EXPAT_VERSION "2.2.10#916908d4a570ad839edd25322c3268cd")
|
||||||
set(CONAN_BZIP2_VERSION "1.0.8@#d1b2d5816f25865acf978501dff1f897")
|
set(CONAN_LUA_VERSION "5.4.4#3ec62efc37cd0a5d80b9e5cb35277360")
|
||||||
set(CONAN_EXPAT_VERSION "2.2.10@#916908d4a570ad839edd25322c3268cd")
|
set(CONAN_TBB_VERSION "2021.3.0#507ec17cbd51a84167e143b20d170eea")
|
||||||
set(CONAN_LUA_VERSION "5.4.4@#3ec62efc37cd0a5d80b9e5cb35277360")
|
|
||||||
set(CONAN_TBB_VERSION "2021.3.0@#507ec17cbd51a84167e143b20d170eea")
|
|
||||||
|
|
||||||
set(CONAN_SYSTEM_INCLUDES ON)
|
set(CONAN_SYSTEM_INCLUDES ON)
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
# if we link TBB dynamically osrm-extract.exe finishes on the first access to any TBB symbol
|
# if we link TBB dynamically osrm-extract.exe finishes on the first access to any TBB symbol
|
||||||
# with exit code = -1073741515, which means that program cannot load required DLL.
|
# with exit code = -1073741515, which means that program cannot load required DLL.
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set(TBB_SHARED False)
|
set(TBB_SHARED False)
|
||||||
@@ -347,14 +492,14 @@ if(ENABLE_CONAN)
|
|||||||
set(TBB_SHARED True)
|
set(TBB_SHARED True)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CONAN_ARGS
|
set(CONAN_ARGS
|
||||||
REQUIRES
|
REQUIRES
|
||||||
"boost/${CONAN_BOOST_VERSION}"
|
"boost/${CONAN_BOOST_VERSION}"
|
||||||
"bzip2/${CONAN_BZIP2_VERSION}"
|
"bzip2/${CONAN_BZIP2_VERSION}"
|
||||||
"expat/${CONAN_EXPAT_VERSION}"
|
"expat/${CONAN_EXPAT_VERSION}"
|
||||||
"lua/${CONAN_LUA_VERSION}"
|
"lua/${CONAN_LUA_VERSION}"
|
||||||
"onetbb/${CONAN_TBB_VERSION}"
|
"onetbb/${CONAN_TBB_VERSION}"
|
||||||
BASIC_SETUP
|
BASIC_SETUP
|
||||||
GENERATORS cmake_find_package json # json generator generates a conanbuildinfo.json in the build folder so (non-CMake) projects can easily parse OSRM's dependencies
|
GENERATORS cmake_find_package json # json generator generates a conanbuildinfo.json in the build folder so (non-CMake) projects can easily parse OSRM's dependencies
|
||||||
KEEP_RPATHS
|
KEEP_RPATHS
|
||||||
NO_OUTPUT_DIRS
|
NO_OUTPUT_DIRS
|
||||||
@@ -363,13 +508,6 @@ if(ENABLE_CONAN)
|
|||||||
boost:without_stacktrace=True # Apple Silicon cross-compilation fails without it
|
boost:without_stacktrace=True # Apple Silicon cross-compilation fails without it
|
||||||
BUILD missing
|
BUILD missing
|
||||||
)
|
)
|
||||||
|
|
||||||
# Enable revisions in the conan config
|
|
||||||
execute_process(COMMAND ${CONAN_CMD} config set general.revisions_enabled=1 RESULT_VARIABLE RET_CODE)
|
|
||||||
if(NOT "${RET_CODE}" STREQUAL "0")
|
|
||||||
message(FATAL_ERROR "Error setting revisions for Conan: '${RET_CODE}'")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# explicitly say Conan to use x86 dependencies if build for x86 platforms (https://github.com/conan-io/cmake-conan/issues/141)
|
# explicitly say Conan to use x86 dependencies if build for x86 platforms (https://github.com/conan-io/cmake-conan/issues/141)
|
||||||
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
conan_cmake_run("${CONAN_ARGS};ARCH;x86")
|
conan_cmake_run("${CONAN_ARGS};ARCH;x86")
|
||||||
@@ -398,7 +536,7 @@ if(ENABLE_CONAN)
|
|||||||
set(Boost_ZLIB_LIBRARY "${Boost_zlib_LIB_TARGETS}")
|
set(Boost_ZLIB_LIBRARY "${Boost_zlib_LIB_TARGETS}")
|
||||||
set(Boost_REGEX_LIBRARY "${Boost_regex_LIB_TARGETS}")
|
set(Boost_REGEX_LIBRARY "${Boost_regex_LIB_TARGETS}")
|
||||||
set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY "${Boost_unit_test_framework_LIB_TARGETS}")
|
set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY "${Boost_unit_test_framework_LIB_TARGETS}")
|
||||||
|
|
||||||
|
|
||||||
find_package(BZip2 REQUIRED)
|
find_package(BZip2 REQUIRED)
|
||||||
find_package(EXPAT REQUIRED)
|
find_package(EXPAT REQUIRED)
|
||||||
@@ -412,7 +550,12 @@ if(ENABLE_CONAN)
|
|||||||
# expat and bzip2 are used from conan rather than the system
|
# expat and bzip2 are used from conan rather than the system
|
||||||
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include)
|
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include)
|
||||||
else()
|
else()
|
||||||
find_package(Boost 1.70 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
if (BUILD_ROUTED)
|
||||||
|
# osrm-routed requires newer boost:asio
|
||||||
|
find_package(Boost 1.70 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||||
|
else()
|
||||||
|
find_package(Boost 1.60 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||||
|
endif()
|
||||||
add_dependency_includes(${Boost_INCLUDE_DIRS})
|
add_dependency_includes(${Boost_INCLUDE_DIRS})
|
||||||
|
|
||||||
find_package(TBB REQUIRED)
|
find_package(TBB REQUIRED)
|
||||||
@@ -459,6 +602,7 @@ if(ENABLE_CCACHE AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILE
|
|||||||
message(STATUS "Using ccache to speed up incremental builds")
|
message(STATUS "Using ccache to speed up incremental builds")
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
||||||
|
set(ENV{CCACHE_CPP2} "true")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -471,9 +615,6 @@ add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3)
|
|||||||
add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE)
|
add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE)
|
||||||
add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED)
|
add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED)
|
||||||
|
|
||||||
# Workaround for https://github.com/boostorg/phoenix/issues/111
|
|
||||||
add_dependency_defines(-DBOOST_PHOENIX_STL_TUPLE_H_)
|
|
||||||
|
|
||||||
add_definitions(${OSRM_DEFINES})
|
add_definitions(${OSRM_DEFINES})
|
||||||
include_directories(SYSTEM ${DEPENDENCIES_INCLUDE_DIRS})
|
include_directories(SYSTEM ${DEPENDENCIES_INCLUDE_DIRS})
|
||||||
|
|
||||||
@@ -651,10 +792,6 @@ install(TARGETS osrm_guidance DESTINATION lib)
|
|||||||
set(DefaultProfilesDir profiles)
|
set(DefaultProfilesDir profiles)
|
||||||
install(DIRECTORY ${DefaultProfilesDir} DESTINATION share/osrm)
|
install(DIRECTORY ${DefaultProfilesDir} DESTINATION share/osrm)
|
||||||
|
|
||||||
# Install data geojson files to /usr/local/share/osrm/data by default
|
|
||||||
set(DefaultProfilesDir data)
|
|
||||||
install(DIRECTORY ${DefaultProfilesDir} DESTINATION share/osrm)
|
|
||||||
|
|
||||||
# Setup exporting variables for pkgconfig and subproject
|
# Setup exporting variables for pkgconfig and subproject
|
||||||
#
|
#
|
||||||
|
|
||||||
@@ -749,23 +886,23 @@ if (ENABLE_FUZZING)
|
|||||||
add_subdirectory(fuzz)
|
add_subdirectory(fuzz)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# add headers sanity check target that includes all headers independently
|
# add headers sanity check target that includes all headers independently
|
||||||
set(check_headers_dir "${PROJECT_BINARY_DIR}/check-headers")
|
set(check_headers_dir "${PROJECT_BINARY_DIR}/check-headers")
|
||||||
file(GLOB_RECURSE headers_to_check
|
file(GLOB_RECURSE headers_to_check
|
||||||
${PROJECT_BINARY_DIR}/*.hpp
|
${PROJECT_BINARY_DIR}/*.hpp
|
||||||
${PROJECT_SOURCE_DIR}/include/*.hpp)
|
${PROJECT_SOURCE_DIR}/include/*.hpp)
|
||||||
foreach(header ${headers_to_check})
|
foreach(header ${headers_to_check})
|
||||||
if ("${header}" MATCHES ".*/include/nodejs/.*")
|
if ("${header}" MATCHES ".*/include/nodejs/.*")
|
||||||
# we do not check NodeJS bindings headers
|
# we do not check NodeJS bindings headers
|
||||||
continue()
|
continue()
|
||||||
endif()
|
endif()
|
||||||
get_filename_component(filename ${header} NAME_WE)
|
get_filename_component(filename ${header} NAME_WE)
|
||||||
set(filename "${check_headers_dir}/${filename}.cpp")
|
set(filename "${check_headers_dir}/${filename}.cpp")
|
||||||
if (NOT EXISTS ${filename})
|
if (NOT EXISTS ${filename})
|
||||||
file(WRITE ${filename} "#include \"${header}\"\n")
|
file(WRITE ${filename} "#include \"${header}\"\n")
|
||||||
endif()
|
endif()
|
||||||
list(APPEND sources ${filename})
|
list(APPEND sources ${filename})
|
||||||
endforeach()
|
endforeach()
|
||||||
add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources})
|
add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources})
|
||||||
set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir})
|
set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir})
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ You can add a :+1: emoji reaction to the issue if you want to express interest i
|
|||||||
|
|
||||||
# Developer
|
# Developer
|
||||||
|
|
||||||
We use `clang-format` version `15` to consistently format the code base. There is a helper script under `scripts/format.sh`.
|
We use `clang-format` version `3.8` to consistently format the code base. There is a helper script under `scripts/format.sh`.
|
||||||
The format is automatically checked by the `mason-linux-release` job of a Travis CI build.
|
The format is automatically checked by the `mason-linux-release` job of a Travis CI build.
|
||||||
To save development time a local hook `.git/hooks/pre-push`
|
To save development time a local hook `.git/hooks/pre-push`
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
## Open Source Routing Machine
|
## Open Source Routing Machine
|
||||||
|
|
||||||
|
| Linux / macOS / Windows | Code Coverage |
|
||||||
|
| ----------------------- | ------------- |
|
||||||
|
| [](https://github.com/Project-OSRM/osrm-backend/actions/workflows/osrm-backend.yml) | [](https://codecov.io/gh/Project-OSRM/osrm-backend) |
|
||||||
|
|
||||||
[](https://github.com/Project-OSRM/osrm-backend/actions/workflows/osrm-backend.yml) [](https://codecov.io/gh/Project-OSRM/osrm-backend) [](https://discord.gg/es9CdcCXcb)
|
High performance routing engine written in C++14 designed to run on OpenStreetMap data.
|
||||||
|
|
||||||
High performance routing engine written in C++ designed to run on OpenStreetMap data.
|
|
||||||
|
|
||||||
The following services are available via HTTP API, C++ library interface and NodeJs wrapper:
|
The following services are available via HTTP API, C++ library interface and NodeJs wrapper:
|
||||||
- Nearest - Snaps coordinates to the street network and returns the nearest matches
|
- Nearest - Snaps coordinates to the street network and returns the nearest matches
|
||||||
@@ -20,7 +21,7 @@ For a quick introduction about how the road network is represented in OpenStreet
|
|||||||
Related [Project-OSRM](https://github.com/Project-OSRM) repositories:
|
Related [Project-OSRM](https://github.com/Project-OSRM) repositories:
|
||||||
- [osrm-frontend](https://github.com/Project-OSRM/osrm-frontend) - User-facing frontend with map. The demo server runs this on top of the backend
|
- [osrm-frontend](https://github.com/Project-OSRM/osrm-frontend) - User-facing frontend with map. The demo server runs this on top of the backend
|
||||||
- [osrm-text-instructions](https://github.com/Project-OSRM/osrm-text-instructions) - Text instructions from OSRM route response
|
- [osrm-text-instructions](https://github.com/Project-OSRM/osrm-text-instructions) - Text instructions from OSRM route response
|
||||||
- [osrm-backend-docker](https://github.com/project-osrm/osrm-backend/pkgs/container/osrm-backend) - Ready to use Docker images
|
- [osrm-backend-docker](https://hub.docker.com/r/osrm/osrm-backend/) - Ready to use Docker images
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
@@ -32,7 +33,6 @@ Related [Project-OSRM](https://github.com/Project-OSRM) repositories:
|
|||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
|
||||||
- Discord: [join](https://discord.gg/es9CdcCXcb)
|
|
||||||
- IRC: `irc.oftc.net`, channel: `#osrm` ([Webchat](https://webchat.oftc.net))
|
- IRC: `irc.oftc.net`, channel: `#osrm` ([Webchat](https://webchat.oftc.net))
|
||||||
- Mailinglist: `https://lists.openstreetmap.org/listinfo/osrm-talk`
|
- Mailinglist: `https://lists.openstreetmap.org/listinfo/osrm-talk`
|
||||||
|
|
||||||
@@ -58,16 +58,16 @@ 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" ghcr.io/project-osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf || echo "osrm-extract failed"
|
docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf
|
||||||
|
|
||||||
The flag `-v "${PWD}:/data"` creates the directory `/data` inside the docker container and makes the current working directory `"${PWD}"` available there. The file `/data/berlin-latest.osm.pbf` inside the container is referring to `"${PWD}/berlin-latest.osm.pbf"` on the host.
|
The flag `-v "${PWD}:/data"` creates the directory `/data` inside the docker container and makes the current working directory `"${PWD}"` available there. The file `/data/berlin-latest.osm.pbf` inside the container is referring to `"${PWD}/berlin-latest.osm.pbf"` on the host.
|
||||||
|
|
||||||
docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-partition /data/berlin-latest.osrm || echo "osrm-partition failed"
|
docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-partition /data/berlin-latest.osrm
|
||||||
docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-customize /data/berlin-latest.osrm || echo "osrm-customize failed"
|
docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-customize /data/berlin-latest.osrm
|
||||||
|
|
||||||
Note there is no `berlin-latest.osrm` file, but multiple `berlin-latest.osrm.*` files, i.e. `berlin-latest.osrm` is not file path, but "base" path referring to set of files and there is an option to omit this `.osrm` suffix completely(e.g. `osrm-partition /data/berlin-latest`).
|
Note there is no `berlin-latest.osrm` file, but multiple `berlin-latest.osrm.*` files, i.e. `berlin-latest.osrm` is not file path, but "base" path referring to set of files and there is an option to omit this `.osrm` suffix completely(e.g. `osrm-partition /data/berlin-latest`).
|
||||||
|
|
||||||
docker run -t -i -p 5000:5000 -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-routed --algorithm mld /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
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
os: Visual Studio 2019
|
||||||
|
|
||||||
|
# clone directory
|
||||||
|
clone_folder: c:\projects\osrm
|
||||||
|
|
||||||
|
platform: x64
|
||||||
|
|
||||||
|
# no-op for the time being until someone with access to GitHub checks settings will remove integration with AppVeyor
|
||||||
|
# https://github.com/Project-OSRM/osrm-backend/pull/6312#issuecomment-1217237055
|
||||||
|
build_script:
|
||||||
|
- EXIT 0
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
SETLOCAL
|
||||||
|
SET EL=0
|
||||||
|
|
||||||
|
ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
SET PLATFORM=x64
|
||||||
|
SET CONFIGURATION=Release
|
||||||
|
::SET LOCAL_DEV=1
|
||||||
|
|
||||||
|
FOR /F "tokens=*" %%i in ('git rev-parse --abbrev-ref HEAD') do SET APPVEYOR_REPO_BRANCH=%%i
|
||||||
|
ECHO APPVEYOR_REPO_BRANCH^: %APPVEYOR_REPO_BRANCH%
|
||||||
|
|
||||||
|
SET PATH=C:\Program Files\7-Zip;%PATH%
|
||||||
|
|
||||||
|
powershell Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
CALL appveyor-build.bat
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
|
GOTO DONE
|
||||||
|
|
||||||
|
|
||||||
|
:ERROR
|
||||||
|
ECHO ~~~~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
ECHO ERRORLEVEL^: %ERRORLEVEL%
|
||||||
|
SET EL=%ERRORLEVEL%
|
||||||
|
|
||||||
|
:DONE
|
||||||
|
ECHO ~~~~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
EXIT /b %EL%
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
"AWSTemplateFormatVersion": "2010-09-09",
|
||||||
|
"Description": "user for publishing to s3://mapbox-node-binary/osrm",
|
||||||
|
"Resources": {
|
||||||
|
"User": {
|
||||||
|
"Type": "AWS::IAM::User",
|
||||||
|
"Properties": {
|
||||||
|
"Policies": [
|
||||||
|
{
|
||||||
|
"PolicyName": "list",
|
||||||
|
"PolicyDocument": {
|
||||||
|
"Statement": [
|
||||||
|
{
|
||||||
|
"Action": [
|
||||||
|
"s3:ListBucket"
|
||||||
|
],
|
||||||
|
"Effect": "Allow",
|
||||||
|
"Resource": "arn:aws:s3:::mapbox-node-binary",
|
||||||
|
"Condition": {
|
||||||
|
"StringLike": {
|
||||||
|
"s3:prefix": [
|
||||||
|
"osrm/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"PolicyName": "publish",
|
||||||
|
"PolicyDocument": {
|
||||||
|
"Statement": [
|
||||||
|
{
|
||||||
|
"Action": [
|
||||||
|
"s3:DeleteObject",
|
||||||
|
"s3:GetObject",
|
||||||
|
"s3:GetObjectAcl",
|
||||||
|
"s3:PutObject",
|
||||||
|
"s3:PutObjectAcl"
|
||||||
|
],
|
||||||
|
"Effect": "Allow",
|
||||||
|
"Resource": "arn:aws:s3:::mapbox-node-binary/osrm/*"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AccessKey": {
|
||||||
|
"Type": "AWS::IAM::AccessKey",
|
||||||
|
"Properties": {
|
||||||
|
"UserName": {
|
||||||
|
"Ref": "User"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Outputs": {
|
||||||
|
"AccessKeyId": {
|
||||||
|
"Value": {
|
||||||
|
"Ref": "AccessKey"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"SecretAccessKey": {
|
||||||
|
"Value": {
|
||||||
|
"Fn::GetAtt": [
|
||||||
|
"AccessKey",
|
||||||
|
"SecretAccessKey"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
var cf = require('@mapbox/cloudfriend');
|
||||||
|
var package_json = require('../package.json')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
AWSTemplateFormatVersion: '2010-09-09',
|
||||||
|
Description: 'user for publishing to s3://mapbox-node-binary/' + package_json.name,
|
||||||
|
Resources: {
|
||||||
|
User: {
|
||||||
|
Type: 'AWS::IAM::User',
|
||||||
|
Properties: {
|
||||||
|
Policies: [
|
||||||
|
{
|
||||||
|
PolicyName: 'list',
|
||||||
|
PolicyDocument: {
|
||||||
|
Statement: [
|
||||||
|
{
|
||||||
|
Action: ['s3:ListBucket'],
|
||||||
|
Effect: 'Allow',
|
||||||
|
Resource: 'arn:aws:s3:::mapbox-node-binary',
|
||||||
|
Condition : {
|
||||||
|
StringLike : {
|
||||||
|
"s3:prefix": [ package_json.name + "/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
PolicyName: 'publish',
|
||||||
|
PolicyDocument: {
|
||||||
|
Statement: [
|
||||||
|
{
|
||||||
|
Action: ['s3:DeleteObject', 's3:GetObject', 's3:GetObjectAcl', 's3:PutObject', 's3:PutObjectAcl'],
|
||||||
|
Effect: 'Allow',
|
||||||
|
Resource: 'arn:aws:s3:::mapbox-node-binary/' + package_json.name + '/*'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
AccessKey: {
|
||||||
|
Type: 'AWS::IAM::AccessKey',
|
||||||
|
Properties: {
|
||||||
|
UserName: cf.ref('User')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Outputs: {
|
||||||
|
AccessKeyId: {
|
||||||
|
Value: cf.ref('AccessKey')
|
||||||
|
},
|
||||||
|
SecretAccessKey: {
|
||||||
|
Value: cf.getAtt('AccessKey', 'SecretAccessKey')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# - Check whether the CXX compiler supports a given flag.
|
||||||
|
# CHECK_CXX_COMPILER_FLAG(<flag> <var>)
|
||||||
|
# <flag> - the compiler flag
|
||||||
|
# <var> - variable to store the result
|
||||||
|
# This internally calls the check_cxx_source_compiles macro. See help
|
||||||
|
# for CheckCXXSourceCompiles for a listing of variables that can
|
||||||
|
# modify the build.
|
||||||
|
|
||||||
|
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
|
|
||||||
|
INCLUDE(CheckCXXSourceCompiles)
|
||||||
|
|
||||||
|
MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
|
||||||
|
SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
|
||||||
|
SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
|
||||||
|
CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT}
|
||||||
|
# Some compilers do not fail with a bad flag
|
||||||
|
FAIL_REGEX "unrecognized .*option" # GNU
|
||||||
|
FAIL_REGEX "ignoring unknown option" # MSVC
|
||||||
|
FAIL_REGEX "[Uu]nknown option" # HP
|
||||||
|
FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
|
||||||
|
FAIL_REGEX "command option .* is not recognized" # XL
|
||||||
|
)
|
||||||
|
SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
|
||||||
|
ENDMACRO (CHECK_CXX_COMPILER_FLAG)
|
||||||
+1
-4
@@ -36,10 +36,7 @@
|
|||||||
# 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/
|
||||||
|
|
||||||
if(NOT PKG_CONFIG_FOUND)
|
include(FindPkgConfig)
|
||||||
include(CMakeFindDependencyMacro)
|
|
||||||
find_dependency(PkgConfig)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
unset(_lua_include_subdirs)
|
unset(_lua_include_subdirs)
|
||||||
unset(_lua_library_names)
|
unset(_lua_library_names)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# https://github.com/sbellus/json-cmake/blob/9913da8800b95322d393894d3525d634568f305e/JSONParser.cmake
|
# https://github.com/sbellus/json-cmake/blob/9913da8800b95322d393894d3525d634568f305e/JSONParser.cmake
|
||||||
# MIT Licensed - https://github.com/sbellus/json-cmake/blob/master/LICENSE
|
# MIT Licensed - https://github.com/sbellus/json-cmake/blob/master/LICENSE
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.18)
|
cmake_minimum_required(VERSION 3.1)
|
||||||
|
|
||||||
if (DEFINED JSonParserGuard)
|
if (DEFINED JSonParserGuard)
|
||||||
return()
|
return()
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
default: '--strict --tags ~@stress --tags ~@todo --tags ~@mld --require features/support --require features/step_definitions',
|
default: '--strict --tags ~@stress --tags ~@todo --tags ~@mld-only --require features/support --require features/step_definitions',
|
||||||
ch: '--strict --tags ~@stress --tags ~@todo --tags ~@mld -f progress --require features/support --require features/step_definitions',
|
verify: '--strict --tags ~@stress --tags ~@todo --tags ~@mld-only -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 ~@ch --require features/support --require features/step_definitions -f progress'
|
mld: '--strict --tags ~@stress --tags ~@todo --tags ~@ch --require features/support --require features/step_definitions -f progress'
|
||||||
|
|||||||
+2
-2
@@ -5,7 +5,7 @@ RUN mkdir -p /src && mkdir -p /opt
|
|||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get -y --no-install-recommends install ca-certificates cmake make git gcc g++ libbz2-dev libxml2-dev wget \
|
apt-get -y --no-install-recommends install ca-certificates cmake make git gcc g++ libbz2-dev libxml2-dev wget \
|
||||||
libzip-dev libboost1.74-all-dev lua5.4 liblua5.4-dev pkg-config -o APT::Install-Suggests=0 -o APT::Install-Recommends=0
|
libzip-dev libboost1.74-all-dev lua5.4 liblua5.4-dev -o APT::Install-Suggests=0 -o APT::Install-Recommends=0
|
||||||
|
|
||||||
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
|
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
|
||||||
ldconfig /usr/local/lib && \
|
ldconfig /usr/local/lib && \
|
||||||
@@ -37,7 +37,7 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
|
|||||||
cd ../profiles && \
|
cd ../profiles && \
|
||||||
cp -r * /opt && \
|
cp -r * /opt && \
|
||||||
strip /usr/local/bin/* && \
|
strip /usr/local/bin/* && \
|
||||||
rm -rf /src
|
rm -rf /src /usr/local/lib/libosrm*
|
||||||
|
|
||||||
|
|
||||||
# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
|
# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
|
||||||
|
|||||||
+2
-2
@@ -32,9 +32,9 @@ For outputting data into our file (debug.geojson), we simply need to call the ma
|
|||||||
### Possible Scopeguard Location
|
### Possible Scopeguard Location
|
||||||
Think of the scopeguard as you would do of any reference. If you wan't to access to logging during a call, the guard object must be alive and valid.
|
Think of the scopeguard as you would do of any reference. If you wan't to access to logging during a call, the guard object must be alive and valid.
|
||||||
|
|
||||||
As an example: a good location to create a scopeguard to log decisions in the edge-based-graph-factory would be right before we run it ([here](https://github.com/Project-OSRM/osrm-backend/blob/a933b5d94943bf3edaf42c84a614a99650d23cba/src/extractor/extractor.cpp#L497)). If you put `util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString> geojson_guard( "debug.geojson", node_coordinate_vector);` at that location, you can then print `util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString>::Write(list_of_node_ids);` anywhere within the `edge-based-graph-factory`.
|
As an example: a good location to create the a scopeguard to log decisions in the edge-based-graph-factory would be right before we run it ([here](https://github.com/Project-OSRM/osrm-backend/blob/a933b5d94943bf3edaf42c84a614a99650d23cba/src/extractor/extractor.cpp#L497)). If you put `util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString> geojson_guard( "debug.geojson", node_coordinate_vector);` at that location, you can then print `util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString>::Write(list_of_node_ids);` anywhere within the `edge-based-graph-factory`.
|
||||||
|
|
||||||
This location would enable calls for all guidance related pre-processing which is called in the edge-based-graph-factory.
|
This location would enable call for all guidance related pre-processing which is called in the edge-based-graph-factory.
|
||||||
Logging any turn-handler decisions, for example, would now be possible.
|
Logging any turn-handler decisions, for example, would now be possible.
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|||||||
+22
-23
@@ -35,7 +35,7 @@ To pass parameters to each location some options support an array-like encoding:
|
|||||||
|radiuses |`{radius};{radius}[;{radius} ...]` |Limits the search to given radius in meters. |
|
|radiuses |`{radius};{radius}[;{radius} ...]` |Limits the search to given radius in meters. |
|
||||||
|generate\_hints |`true` (default), `false` |Adds a Hint to the response which can be used in subsequent requests, see `hints` parameter. |
|
|generate\_hints |`true` (default), `false` |Adds a Hint to the response which can be used in subsequent requests, see `hints` parameter. |
|
||||||
|hints |`{hint};{hint}[;{hint} ...]` |Hint from previous request to derive position in street network. |
|
|hints |`{hint};{hint}[;{hint} ...]` |Hint from previous request to derive position in street network. |
|
||||||
|approaches |`{approach};{approach}[;{approach} ...]` |Restrict the direction on the road network at a waypoint, relative to the input coordinate. |
|
|approaches |`{approach};{approach}[;{approach} ...]` |Keep waypoints on curbside. |
|
||||||
|exclude |`{class}[,{class}]` |Additive list of classes to avoid, the order does not matter. |
|
|exclude |`{class}[,{class}]` |Additive list of classes to avoid, the order does not matter. |
|
||||||
|snapping |`default` (default), `any` |Default snapping avoids is_startpoint (see profile) edges, `any` will snap to any edge in the graph |
|
|snapping |`default` (default), `any` |Default snapping avoids is_startpoint (see profile) edges, `any` will snap to any edge in the graph |
|
||||||
|skip_waypoints |`true`, `false` (default) |Removes waypoints from the response. Waypoints are still calculated, but not serialized. Could be useful in case you are interested in some other part of the response and do not want to transfer waste data. |
|
|skip_waypoints |`true`, `false` (default) |Removes waypoints from the response. Waypoints are still calculated, but not serialized. Could be useful in case you are interested in some other part of the response and do not want to transfer waste data. |
|
||||||
@@ -47,7 +47,7 @@ Where the elements follow the following format:
|
|||||||
|bearing |`{value},{range}` `integer 0 .. 360,integer 0 .. 180` |
|
|bearing |`{value},{range}` `integer 0 .. 360,integer 0 .. 180` |
|
||||||
|radius |`double >= 0` or `unlimited` (default) |
|
|radius |`double >= 0` or `unlimited` (default) |
|
||||||
|hint |Base64 `string` |
|
|hint |Base64 `string` |
|
||||||
|approach |`curb`, `opposite` or `unrestricted` (default) |
|
|approach |`curb` or `unrestricted` (default) |
|
||||||
|class |A class name determined by the profile or `none`. |
|
|class |A class name determined by the profile or `none`. |
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -88,11 +88,10 @@ Every response object has a `code` property containing one of the strings below
|
|||||||
| `InvalidService` | Service name is invalid. |
|
| `InvalidService` | Service name is invalid. |
|
||||||
| `InvalidVersion` | Version is not found. |
|
| `InvalidVersion` | Version is not found. |
|
||||||
| `InvalidOptions` | Options are invalid. |
|
| `InvalidOptions` | Options are invalid. |
|
||||||
| `InvalidQuery` | The query string is syntactically malformed. |
|
| `InvalidQuery` | The query string is syntactically malformed. |
|
||||||
| `InvalidValue` | The successfully parsed query parameters are invalid. |
|
| `InvalidValue` | The successfully parsed query parameters are invalid. |
|
||||||
| `NoSegment` | One of the supplied input coordinates could not snap to the street segment. |
|
| `NoSegment` | One of the supplied input coordinates could not snap to the street segment. |
|
||||||
| `TooBig` | The request size violates one of the service-specific request size restrictions. |
|
| `TooBig` | The request size violates one of the service-specific request size restrictions. |
|
||||||
| `DisabledDataset` | The request tried to access a disabled dataset. |
|
|
||||||
|
|
||||||
- `message` is a **optional** human-readable error message. All other status types are service-dependent.
|
- `message` is a **optional** human-readable error message. All other status types are service-dependent.
|
||||||
- In case of an error the HTTP status code will be `400`. Otherwise, the HTTP status code will be `200` and `code` will be `Ok`.
|
- In case of an error the HTTP status code will be `400`. Otherwise, the HTTP status code will be `200` and `code` will be `Ok`.
|
||||||
@@ -131,7 +130,7 @@ In addition to the [general options](#general-options) the following options are
|
|||||||
|number |`integer >= 1` (default `1`) |Number of nearest segments that should be returned. |
|
|number |`integer >= 1` (default `1`) |Number of nearest segments that should be returned. |
|
||||||
|
|
||||||
As `waypoints` is a single thing, returned by that service, using it with the option `skip_waypoints` set to `true` is quite useless, but still
|
As `waypoints` is a single thing, returned by that service, using it with the option `skip_waypoints` set to `true` is quite useless, but still
|
||||||
possible. In that case, only the `code` field will be returned.
|
possible. In that case, only the `code` field will be returned.
|
||||||
|
|
||||||
**Response**
|
**Response**
|
||||||
|
|
||||||
@@ -649,12 +648,12 @@ Represents a route between two waypoints.
|
|||||||
- `distance`: The distance traveled by this route leg, in `float` meters.
|
- `distance`: The distance traveled by this route leg, in `float` meters.
|
||||||
- `duration`: The estimated travel time, in `float` number of seconds.
|
- `duration`: The estimated travel time, in `float` number of seconds.
|
||||||
- `weight`: The calculated weight of the route leg.
|
- `weight`: The calculated weight of the route leg.
|
||||||
- `summary`: Summary of the route taken as `string`. Depends on the `steps` parameter:
|
- `summary`: Summary of the route taken as `string`. Depends on the `summary` parameter:
|
||||||
|
|
||||||
| steps | |
|
| summary | |
|
||||||
|-------|-----------------------------------------------------------------------|
|
|--------------|-----------------------------------------------------------------------|
|
||||||
| true | Names of the two major roads used. Can be empty if the route is too short.|
|
| true | Names of the two major roads used. Can be empty if the route is too short.|
|
||||||
| false | empty `string` |
|
| false | empty `string` |
|
||||||
|
|
||||||
- `steps`: Depends on the `steps` parameter.
|
- `steps`: Depends on the `steps` parameter.
|
||||||
|
|
||||||
@@ -954,11 +953,11 @@ The object is used to describe the waypoint on a route.
|
|||||||
|
|
||||||
## Flatbuffers format
|
## Flatbuffers format
|
||||||
|
|
||||||
The default response format is `json`, but OSRM supports binary [`flatbuffers`](https://google.github.io/flatbuffers/) format, which
|
The default response format is `json`, but OSRM supports binary [`flatbuffers`](https://google.github.io/flatbuffers/) format, which
|
||||||
is much faster in serialization/deserialization, comparing to `json`.
|
is much faster in serialization/deserialization, comparing to `json`.
|
||||||
|
|
||||||
The format itself is described in message descriptors, located at `include/engine/api/flatbuffers` directory. Those descriptors could
|
The format itself is described in message descriptors, located at `include/engine/api/flatbuffers` directory. Those descriptors could
|
||||||
be compiled to provide protocol parsers in Go/Javascript/Typescript/Java/Dart/C#/Python/Lobster/Lua/Rust/PHP/Kotlin. Precompiled
|
be compiled to provide protocol parsers in Go/Javascript/Typescript/Java/Dart/C#/Python/Lobster/Lua/Rust/PHP/Kotlin. Precompiled
|
||||||
protocol parser for C++ is supplied with OSRM.
|
protocol parser for C++ is supplied with OSRM.
|
||||||
|
|
||||||
`Flatbuffers` format provides exactly the same data, as `json` format with a slightly different layout, which was optimized to minimize
|
`Flatbuffers` format provides exactly the same data, as `json` format with a slightly different layout, which was optimized to minimize
|
||||||
@@ -972,7 +971,7 @@ Root object is the only object, available from a 'raw' `flatbuffers` buffer. It
|
|||||||
|
|
||||||
**Properties**
|
**Properties**
|
||||||
|
|
||||||
- `error`: `bool` Marks response as erroneous. An erroneous response should include the `code` fieldset, all the other fields may not be present.
|
- `error`: `bool` Marks response as erroneous. An erroneous response should include the `code` fieldset, all the other fields may not be present.
|
||||||
- `code`: `Error` Error description object, only present, when `error` is `true`
|
- `code`: `Error` Error description object, only present, when `error` is `true`
|
||||||
- `waypoints`: `[Waypoint]` Array of `Waypoint` objects. Should present for every service call, unless `skip_waypoints` is set to `true`. Table service will put `sources` array here.
|
- `waypoints`: `[Waypoint]` Array of `Waypoint` objects. Should present for every service call, unless `skip_waypoints` is set to `true`. Table service will put `sources` array here.
|
||||||
- `routes`: `[RouteObject]` Array of `RouteObject` objects. May be empty or absent. Should present for Route/Trip/Match services call.
|
- `routes`: `[RouteObject]` Array of `RouteObject` objects. May be empty or absent. Should present for Route/Trip/Match services call.
|
||||||
@@ -984,21 +983,21 @@ Contains error information.
|
|||||||
|
|
||||||
**Properties**
|
**Properties**
|
||||||
|
|
||||||
- `code`: `string` Error code
|
- `code`: `string` Error code
|
||||||
- `message`: `string` Detailed error message
|
- `message`: `string` Detailed error message
|
||||||
|
|
||||||
### Waypoint object
|
### Waypoint object
|
||||||
|
|
||||||
Almost the same as `json` Waypoint object. The following properties differ:
|
Almost the same as `json` Waypoint object. The following properties differ:
|
||||||
|
|
||||||
- `location`: `Position` Same as `json` location field, but different format.
|
- `location`: `Position` Same as `json` location field, but different format.
|
||||||
- `nodes`: `Uint64Pair` Same as `json` nodes field, but different format.
|
- `nodes`: `Uint64Pair` Same as `json` nodes field, but different format.
|
||||||
|
|
||||||
### RouteObject object
|
### RouteObject object
|
||||||
|
|
||||||
Almost the same as `json` Route object. The following properties differ:
|
Almost the same as `json` Route object. The following properties differ:
|
||||||
|
|
||||||
- `polyline`: `string` Same as `json` geometry.polyline or geometry.polyline6 fields. One field for both formats.
|
- `polyline`: `string` Same as `json` geometry.polyline or geometry.polyline6 fields. One field for both formats.
|
||||||
- `coordinates`: `[Position]` Same as `json` geometry.coordinates field, but different format.
|
- `coordinates`: `[Position]` Same as `json` geometry.coordinates field, but different format.
|
||||||
- `legs`: `[Leg]` Array of `Leg` objects.
|
- `legs`: `[Leg]` Array of `Leg` objects.
|
||||||
|
|
||||||
@@ -1013,7 +1012,7 @@ Almost the same as `json` Leg object. The following properties differ:
|
|||||||
|
|
||||||
Almost the same as `json` Step object. The following properties differ:
|
Almost the same as `json` Step object. The following properties differ:
|
||||||
|
|
||||||
- `polyline`: `string` Same as `json` geometry.polyline or geometry.polyline6 fields. One field for both formats.
|
- `polyline`: `string` Same as `json` geometry.polyline or geometry.polyline6 fields. One field for both formats.
|
||||||
- `coordinates`: `[Position]` Same as `json` geometry.coordinates field, but different format.
|
- `coordinates`: `[Position]` Same as `json` geometry.coordinates field, but different format.
|
||||||
- `maneuver`: `StepManeuver` Same as `json` maneuver field, but different format.
|
- `maneuver`: `StepManeuver` Same as `json` maneuver field, but different format.
|
||||||
|
|
||||||
@@ -1036,7 +1035,7 @@ Almost the same as `json` Step object. The following properties differ:
|
|||||||
| `ExitRoundabout` | Describes a maneuver exiting a roundabout (usually preceded by a `roundabout` instruction) |
|
| `ExitRoundabout` | Describes a maneuver exiting a roundabout (usually preceded by a `roundabout` instruction) |
|
||||||
| `ExitRotary` | Describes the maneuver exiting a rotary (large named roundabout) |
|
| `ExitRotary` | Describes the maneuver exiting a rotary (large named roundabout) |
|
||||||
|
|
||||||
- `driving_side`: `bool` Ttrue stands for the left side driving.
|
- `driving_side`: `bool` Ttrue stands for the left side driving.
|
||||||
- `intersections`: `[Intersection]` Same as `json` intersections field, but different format.
|
- `intersections`: `[Intersection]` Same as `json` intersections field, but different format.
|
||||||
|
|
||||||
### Intersection object
|
### Intersection object
|
||||||
@@ -1050,7 +1049,7 @@ Almost the same as `json` Intersection object. The following properties differ:
|
|||||||
|
|
||||||
Almost the same as `json` Lane object. The following properties differ:
|
Almost the same as `json` Lane object. The following properties differ:
|
||||||
|
|
||||||
- `indications`: `Turn` Array of `Turn` enum values.
|
- `indications`: `Turn` Array of `Turn` enum values.
|
||||||
|
|
||||||
| `value` | Description |
|
| `value` | Description |
|
||||||
|------------------------|---------------------------------------------------------------------------------------------------------------------------|
|
|------------------------|---------------------------------------------------------------------------------------------------------------------------|
|
||||||
@@ -1090,16 +1089,16 @@ Almost the same as `json` StepManeuver object. The following properties differ:
|
|||||||
| `ExitRoundabout` | Describes a maneuver exiting a roundabout (usually preceded by a `roundabout` instruction) |
|
| `ExitRoundabout` | Describes a maneuver exiting a roundabout (usually preceded by a `roundabout` instruction) |
|
||||||
| `ExitRotary` | Describes the maneuver exiting a rotary (large named roundabout) |
|
| `ExitRotary` | Describes the maneuver exiting a rotary (large named roundabout) |
|
||||||
|
|
||||||
- `modifier`: `Turn` Maneuver turn (enum)
|
- `modifier`: `Turn` Maneuver turn (enum)
|
||||||
|
|
||||||
### Annotation object
|
### Annotation object
|
||||||
|
|
||||||
Exactly the same as `json` annotation object.
|
Exactly the same as `json` annotation object.
|
||||||
|
|
||||||
|
|
||||||
### Position object
|
### Position object
|
||||||
|
|
||||||
A point on Earth.
|
A point on Earth.
|
||||||
|
|
||||||
***Properties***
|
***Properties***
|
||||||
- `longitute`: `float` Point's longitude
|
- `longitute`: `float` Point's longitude
|
||||||
|
|||||||
+5
-7
@@ -31,7 +31,6 @@ var osrm = new OSRM('network.osrm');
|
|||||||
Old behaviour: Path to a file on disk to store the memory using mmap. Current behaviour: setting this value is the same as setting `mmap_memory: true`.
|
Old behaviour: Path to a file on disk to store the memory using mmap. Current behaviour: setting this value is the same as setting `mmap_memory: true`.
|
||||||
- `options.mmap_memory` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Map on-disk files to virtual memory addresses (mmap), rather than loading into RAM.
|
- `options.mmap_memory` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Map on-disk files to virtual memory addresses (mmap), rather than loading into RAM.
|
||||||
- `options.path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The path to the `.osrm` files. This is mutually exclusive with setting {options.shared_memory} to true.
|
- `options.path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The path to the `.osrm` files. This is mutually exclusive with setting {options.shared_memory} to true.
|
||||||
- `options.disable_feature_dataset` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Disables a feature dataset from being loaded into memory if not needed. Options: `ROUTE_STEPS`, `ROUTE_GEOMETRY`.
|
|
||||||
- `options.max_locations_trip` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in trip query (default: unlimited).
|
- `options.max_locations_trip` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in trip query (default: unlimited).
|
||||||
- `options.max_locations_viaroute` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in viaroute query (default: unlimited).
|
- `options.max_locations_viaroute` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in viaroute query (default: unlimited).
|
||||||
- `options.max_locations_distance_table` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in distance table query (default: unlimited).
|
- `options.max_locations_distance_table` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in distance table query (default: unlimited).
|
||||||
@@ -39,7 +38,6 @@ var osrm = new OSRM('network.osrm');
|
|||||||
- `options.max_radius_map_matching` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. radius size supported in map matching query (default: 5).
|
- `options.max_radius_map_matching` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. radius size supported in map matching query (default: 5).
|
||||||
- `options.max_results_nearest` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. results supported in nearest query (default: unlimited).
|
- `options.max_results_nearest` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. results supported in nearest query (default: unlimited).
|
||||||
- `options.max_alternatives` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. number of alternatives supported in alternative routes query (default: 3).
|
- `options.max_alternatives` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. number of alternatives supported in alternative routes query (default: 3).
|
||||||
- `options.default_radius` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Default radius for queries (default: unlimited).
|
|
||||||
|
|
||||||
### route
|
### route
|
||||||
|
|
||||||
@@ -63,7 +61,7 @@ Returns the fastest route between two or more coordinates while visiting the way
|
|||||||
- `options.geometries` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
|
- `options.geometries` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
|
||||||
- `options.overview` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
|
- `options.overview` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
|
||||||
- `options.continue_straight` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Forces the route to keep going straight at waypoints and don't do a uturn even if it would be faster. Default value depends on the profile.
|
- `options.continue_straight` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Forces the route to keep going straight at waypoints and don't do a uturn even if it would be faster. Default value depends on the profile.
|
||||||
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate. Can be `null` (unrestricted, default), `curb` or `opposite`.
|
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||||
`null`/`true`/`false`
|
`null`/`true`/`false`
|
||||||
- `options.waypoints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index.
|
- `options.waypoints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index.
|
||||||
- `options.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
|
- `options.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
|
||||||
@@ -101,7 +99,7 @@ Note: `coordinates` in the general options only supports a single `{longitude},{
|
|||||||
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
|
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
|
||||||
- `options.number` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of nearest segments that should be returned.
|
- `options.number` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of nearest segments that should be returned.
|
||||||
Must be an integer greater than or equal to `1`. (optional, default `1`)
|
Must be an integer greater than or equal to `1`. (optional, default `1`)
|
||||||
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate. Can be `null` (unrestricted, default), `curb` or `opposite`.
|
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||||
- `options.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
|
- `options.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
|
||||||
- `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
|
- `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
|
||||||
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
|
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
|
||||||
@@ -141,7 +139,7 @@ Optionally returns distance table.
|
|||||||
- `options.sources` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to use
|
- `options.sources` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to use
|
||||||
location with given index as source. Default is to use all.
|
location with given index as source. Default is to use all.
|
||||||
- `options.destinations` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to use location with given index as destination. Default is to use all.
|
- `options.destinations` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to use location with given index as destination. Default is to use all.
|
||||||
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate.. Can be `null` (unrestricted, default), `curb` or `opposite`.
|
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||||
- `options.fallback_speed` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Replace `null` responses in result with as-the-crow-flies estimates based on `fallback_speed`. Value is in metres/second.
|
- `options.fallback_speed` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Replace `null` responses in result with as-the-crow-flies estimates based on `fallback_speed`. Value is in metres/second.
|
||||||
- `options.fallback_coordinate` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Either `input` (default) or `snapped`. If using a `fallback_speed`, use either the user-supplied coordinate (`input`), or the snapped coordinate (`snapped`) for calculating the as-the-crow-flies distance between two points.
|
- `options.fallback_coordinate` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Either `input` (default) or `snapped`. If using a `fallback_speed`, use either the user-supplied coordinate (`input`), or the snapped coordinate (`snapped`) for calculating the as-the-crow-flies distance between two points.
|
||||||
- `options.scale_factor` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Multiply the table duration values in the table by this number for more controlled input into a route optimization solver.
|
- `options.scale_factor` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Multiply the table duration values in the table by this number for more controlled input into a route optimization solver.
|
||||||
@@ -250,7 +248,7 @@ osrm.match(options, function(err, response) {
|
|||||||
|
|
||||||
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `tracepoints` and `matchings`.
|
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `tracepoints` and `matchings`.
|
||||||
**`tracepoints`** Array of [`Ẁaypoint`](#waypoint) objects representing all points of the trace in order.
|
**`tracepoints`** Array of [`Ẁaypoint`](#waypoint) objects representing all points of the trace in order.
|
||||||
If the trace point was omitted by map matching because it is an outlier, the entry will be null.
|
If the trace point was ommited by map matching because it is an outlier, the entry will be null.
|
||||||
Each `Waypoint` object has the following additional properties,
|
Each `Waypoint` object has the following additional properties,
|
||||||
1) `matchings_index`: Index to the
|
1) `matchings_index`: Index to the
|
||||||
[`Route`](#route) object in matchings the sub-trace was matched to,
|
[`Route`](#route) object in matchings the sub-trace was matched to,
|
||||||
@@ -298,7 +296,7 @@ Right now, the following combinations are possible:
|
|||||||
- `options.roundtrip` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route is a roundtrip. (optional, default `true`)
|
- `options.roundtrip` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route is a roundtrip. (optional, default `true`)
|
||||||
- `options.source` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route starts at `any` or `first` coordinate. (optional, default `any`)
|
- `options.source` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route starts at `any` or `first` coordinate. (optional, default `any`)
|
||||||
- `options.destination` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route ends at `any` or `last` coordinate. (optional, default `any`)
|
- `options.destination` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route ends at `any` or `last` coordinate. (optional, default `any`)
|
||||||
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate. Can be `null` (unrestricted, default), `curb` or `opposite`.
|
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||||
- `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
|
- `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
|
||||||
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
|
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -113,7 +113,7 @@ 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 which relations should be cached for processing in this profile. It contains relations types
|
relation_types | Sequence | Determines wich relations should be cached for processing in this profile. It contains relations types
|
||||||
|
|
||||||
### process_node(profile, node, result, relations)
|
### 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.
|
||||||
@@ -349,7 +349,7 @@ The input data must an ASCII file with rows of integers. e.g.:
|
|||||||
|
|
||||||
In your `segment_function` you can then access the raster source and use `raster:query()` to query to find the nearest data point, or `raster:interpolate()` to interpolate a value based on nearby data points.
|
In your `segment_function` you can then access the raster source and use `raster:query()` to query to find the nearest data point, or `raster:interpolate()` to interpolate a value based on nearby data points.
|
||||||
|
|
||||||
You must check whether the result is valid before using it.
|
You must check whether the result is valid before use it.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -300,7 +300,7 @@ And the relations
|
|||||||
The setting looks perfectly fine at first glance. However, it is not well defined.
|
The setting looks perfectly fine at first glance. However, it is not well defined.
|
||||||
The forbidden right turn could be either a superfluous addition, forbidding the turn `cb` to `be`, or actually refer to the turn `ab` to `bd` to say that a turn is forbidden here.
|
The forbidden right turn could be either a superfluous addition, forbidding the turn `cb` to `be`, or actually refer to the turn `ab` to `bd` to say that a turn is forbidden here.
|
||||||
|
|
||||||
To model turn-restrictions correctly and uniquely, we need to split segments that contribute to the restriction into the smallest possible parts.
|
To model turn-restrictions correctly and unique, we need to split segments that contribute to the restriction into the smallest possible parts.
|
||||||
E.g. the above scenario could correctly be expressed as:
|
E.g. the above scenario could correctly be expressed as:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -360,7 +360,7 @@ When I route I should get
|
|||||||
|
|
||||||
And the test reports `turn right` for the route `a->e`, where before it said `slight right`.
|
And the test reports `turn right` for the route `a->e`, where before it said `slight right`.
|
||||||
|
|
||||||
If you change the turn angles, obviously you can expect changes in the distinction between `slight right` and `right`.
|
If you changed the turn angles, obviously you can expect changes in the distinction between `slight right` and `right`.
|
||||||
In such a case it is, of course, reasonable to change the expected route to report `right` instead of `slight right`. You should consider inspecting the actual turn angles at `b` to see if you feel that change is justified.
|
In such a case it is, of course, reasonable to change the expected route to report `right` instead of `slight right`. You should consider inspecting the actual turn angles at `b` to see if you feel that change is justified.
|
||||||
|
|
||||||
However, you should never adjust the test itself.
|
However, you should never adjust the test itself.
|
||||||
@@ -390,9 +390,9 @@ In this case we would see a very slight turn angle. If your change now reports d
|
|||||||
|
|
||||||
### Consider Post-Processing Impacts
|
### Consider Post-Processing Impacts
|
||||||
|
|
||||||
Some changes you might see could look completely unrelated. To understand the impact of your changes, you can make use of the debugging utilities you can find in `util/debug.hpp` (and potentially other related headers).
|
Some changes you might see could look completely unrelated. To understand the impact of your changes, you can make use of the debugging utilities you can finde in `util/debug.hpp` (and potentially other related headers).
|
||||||
|
|
||||||
If your test is inspecting a series of turns (remember, a turn does not necessarily equals an instruction), you could see interaction with post-processing.
|
If your test is inspecting a series of turns (remember, a turn not necessarily equals an instruction), you could see interaction with post-processing.
|
||||||
To see the unprocessed turns, you should print the steps at the end of step assembly (`assembleSteps` in `engine/guidance/assemble_steps.hpp`).
|
To see the unprocessed turns, you should print the steps at the end of step assembly (`assembleSteps` in `engine/guidance/assemble_steps.hpp`).
|
||||||
|
|
||||||
If you see unexpected changes, you can consider adding the `locations` field to your test to study what location a turn is reported at.
|
If you see unexpected changes, you can consider adding the `locations` field to your test to study what location a turn is reported at.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.18)
|
cmake_minimum_required(VERSION 2.8.8)
|
||||||
|
|
||||||
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
|
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
|
||||||
message(FATAL_ERROR "In-source builds are not allowed.
|
message(FATAL_ERROR "In-source builds are not allowed.
|
||||||
@@ -12,18 +12,20 @@ endif()
|
|||||||
|
|
||||||
project(osrm-example C CXX)
|
project(osrm-example C CXX)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
|
set(bitness 32)
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
set(bitness 64)
|
||||||
message(STATUS "Building on a 64 bit system")
|
message(STATUS "Building on a 64 bit system")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Building on a 32 bit system")
|
message(STATUS "Building on a 32 bit system")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WIN32 AND MSVC_VERSION LESS 1900)
|
||||||
|
message(FATAL_ERROR "Building with Microsoft compiler needs Latest Visual Studio 2015 (Community or better)")
|
||||||
|
endif()
|
||||||
|
|
||||||
link_directories(${LibOSRM_LIBRARY_DIRS})
|
link_directories(${LibOSRM_LIBRARY_DIRS})
|
||||||
add_executable(osrm-example example.cpp)
|
add_executable(osrm-example example.cpp)
|
||||||
|
|
||||||
|
|||||||
@@ -78,15 +78,6 @@ Feature: Bike - Accessability of different way types
|
|||||||
| construction | yes | | |
|
| construction | yes | | |
|
||||||
| construction | | yes | |
|
| construction | | yes | |
|
||||||
|
|
||||||
@proposed
|
|
||||||
Scenario: Bike - Don't allow routing on ways still being proposed
|
|
||||||
Then routability should be
|
|
||||||
| highway | foot | bicycle | proposed | bothw |
|
|
||||||
| primary | | | | x |
|
|
||||||
| proposed | | | | |
|
|
||||||
| proposed | yes | | yes | |
|
|
||||||
| proposed | | yes | yes | |
|
|
||||||
|
|
||||||
@roundabout
|
@roundabout
|
||||||
Scenario: Bike - Don't push bikes against oneway flow on roundabouts
|
Scenario: Bike - Don't push bikes against oneway flow on roundabouts
|
||||||
Then routability should be
|
Then routability should be
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ Feature: Bike - Surfaces
|
|||||||
| cycleway | cobblestone:flattened | 72 s |
|
| cycleway | cobblestone:flattened | 72 s |
|
||||||
| cycleway | paving_stones | 72 s |
|
| cycleway | paving_stones | 72 s |
|
||||||
| cycleway | wood | 72 s |
|
| cycleway | wood | 72 s |
|
||||||
| cycleway | metal | 72 s |
|
|
||||||
| cycleway | compacted | 72 s |
|
| cycleway | compacted | 72 s |
|
||||||
| cycleway | fine_gravel | 72 s |
|
| cycleway | fine_gravel | 72 s |
|
||||||
| cycleway | ground | 72 s |
|
| cycleway | ground | 72 s |
|
||||||
@@ -23,13 +22,11 @@ Feature: Bike - Surfaces
|
|||||||
| cycleway | cobblestone | 102.9 s |
|
| cycleway | cobblestone | 102.9 s |
|
||||||
| cycleway | gravel | 120 s |
|
| cycleway | gravel | 120 s |
|
||||||
| cycleway | pebblestone | 120 s |
|
| cycleway | pebblestone | 120 s |
|
||||||
| cycleway | grass_paver | 120 s |
|
|
||||||
| cycleway | dirt | 90 s |
|
| cycleway | dirt | 90 s |
|
||||||
| cycleway | earth | 120 s |
|
| cycleway | earth | 120 s |
|
||||||
| cycleway | grass | 120 s |
|
| cycleway | grass | 120 s |
|
||||||
| cycleway | mud | 240 s |
|
| cycleway | mud | 240 s |
|
||||||
| cycleway | sand | 240 s |
|
| cycleway | sand | 240 s |
|
||||||
| cycleway | woodchips | 240 s |
|
|
||||||
| cycleway | sett | 80 s |
|
| cycleway | sett | 80 s |
|
||||||
|
|
||||||
Scenario: Bicycle - Good surfaces on small paths
|
Scenario: Bicycle - Good surfaces on small paths
|
||||||
|
|||||||
@@ -115,36 +115,6 @@ Feature: Car - Turn restrictions
|
|||||||
| c | a | cj,aj,aj |
|
| c | a | cj,aj,aj |
|
||||||
| c | b | cj,bj,bj |
|
| c | b | cj,bj,bj |
|
||||||
|
|
||||||
@no_turning
|
|
||||||
Scenario: Car - No u-turn
|
|
||||||
# https://www.openstreetmap.org/edit?node=54878482#map=19/34.05242/-117.19067
|
|
||||||
Given the node map
|
|
||||||
"""
|
|
||||||
c
|
|
||||||
3
|
|
||||||
a 1 x 2 b
|
|
||||||
4
|
|
||||||
d
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes |
|
|
||||||
| ax |
|
|
||||||
| xb |
|
|
||||||
| cx |
|
|
||||||
| xd |
|
|
||||||
|
|
||||||
And the relations
|
|
||||||
| type | way:from | way:to | node:via | restriction |
|
|
||||||
| restriction | ax | ax | x | no_u_turn |
|
|
||||||
| restriction | bx | bx | x | no_u_turn |
|
|
||||||
| restriction | cx | cx | x | no_u_turn |
|
|
||||||
| restriction | dx | dx | x | no_u_turn |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| waypoints | route | turns |
|
|
||||||
| a,x,a | ax,xb,xb,xb,ax,ax | depart,new name straight,continue uturn,arrive,depart,arrive |
|
|
||||||
|
|
||||||
@no_turning
|
@no_turning
|
||||||
Scenario: Car - Handle any no_* relation
|
Scenario: Car - Handle any no_* relation
|
||||||
Given the node map
|
Given the node map
|
||||||
|
|||||||
@@ -32,14 +32,14 @@ Feature: Car - Handle traffic lights
|
|||||||
| l | traffic_signals |
|
| l | traffic_signals |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | time | # |
|
| from | to | time | # |
|
||||||
| 1 | 2 | 11.1s | no turn with no traffic light |
|
| 1 | 2 | 11.1s | no turn with no traffic light |
|
||||||
| 3 | 4 | 13.1s | no turn with traffic light |
|
| 3 | 4 | 13.1s | no turn with traffic light |
|
||||||
| g | j | 18.7s | turn with no traffic light |
|
| g | j | 18.7s | turn with no traffic light |
|
||||||
| k | n | 20.7s | turn with traffic light |
|
| k | n | 20.7s | turn with traffic light |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Car - Traffic signal direction straight
|
Scenario: Car - Traffic signal direction
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
a-1-b-2-c
|
a-1-b-2-c
|
||||||
@@ -66,60 +66,25 @@ Feature: Car - Handle traffic lights
|
|||||||
| k | traffic_signals | backward |
|
| k | traffic_signals | backward |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | time | weight | # |
|
| from | to | time | # |
|
||||||
| 1 | 2 | 11.1s | 11.1 | no turn with no traffic light |
|
| 1 | 2 | 11.1s | no turn with no traffic light |
|
||||||
| 2 | 1 | 11.1s | 11.1 | no turn with no traffic light |
|
| 2 | 1 | 11.1s | no turn with no traffic light |
|
||||||
| 3 | 4 | 13.1s | 13.1 | no turn with traffic light |
|
| 3 | 4 | 13.1s | no turn with traffic light |
|
||||||
| 4 | 3 | 13.1s | 13.1 | no turn with traffic light |
|
| 4 | 3 | 13.1s | no turn with traffic light |
|
||||||
| 5 | 6 | 13.1s | 13.1 | no turn with traffic light |
|
| 5 | 6 | 13.1s | no turn with traffic light |
|
||||||
| 6 | 5 | 11.1s | 11.1 | no turn with no traffic light |
|
| 6 | 5 | 11.1s | no turn with no traffic light |
|
||||||
| 7 | 8 | 11.1s | 11.1 | no turn with no traffic light |
|
| 7 | 8 | 11.1s | no turn with no traffic light |
|
||||||
| 8 | 7 | 13.1s | 13.1 | no turn with traffic light |
|
| 8 | 7 | 13.1s | no turn with traffic light |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Car - Traffic signal direction with distance weight
|
Scenario: Car - Encounters a traffic light
|
||||||
Given the profile file "car" initialized with
|
|
||||||
"""
|
|
||||||
profile.properties.weight_name = 'distance'
|
|
||||||
profile.properties.traffic_light_penalty = 100000
|
|
||||||
"""
|
|
||||||
|
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
a---b---c
|
a f k
|
||||||
1 2
|
| | |
|
||||||
| |
|
b-c-d h-g-i l-m-n
|
||||||
| |
|
| | |
|
||||||
| |
|
e j o
|
||||||
| |
|
|
||||||
| |
|
|
||||||
d-------f
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes | highway |
|
|
||||||
| abc | primary |
|
|
||||||
| adfc | primary |
|
|
||||||
|
|
||||||
And the nodes
|
|
||||||
| node | highway |
|
|
||||||
| b | traffic_signals |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | time | distances | weight | # |
|
|
||||||
| 1 | 2 | 100033.2s | 599.9m,0m | 599.8 | goes via the expensive traffic signal |
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: Car - Encounters a traffic light direction
|
|
||||||
Given the node map
|
|
||||||
"""
|
|
||||||
a f k p
|
|
||||||
| | | |
|
|
||||||
b-c-d h-g-i l-m-n q-r-s
|
|
||||||
| | | |
|
|
||||||
e j o t
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -131,70 +96,53 @@ Feature: Car - Handle traffic lights
|
|||||||
| fgj | primary |
|
| fgj | primary |
|
||||||
| lmn | primary |
|
| lmn | primary |
|
||||||
| kmo | primary |
|
| kmo | primary |
|
||||||
| qrs | primary |
|
|
||||||
| prt | primary |
|
|
||||||
|
|
||||||
And the nodes
|
And the nodes
|
||||||
| node | highway | traffic_signals:direction |
|
| node | highway | traffic_signals:direction |
|
||||||
| g | traffic_signals | |
|
| g | traffic_signals | forward |
|
||||||
| m | traffic_signals | forward |
|
| m | traffic_signals | backward |
|
||||||
| r | traffic_signals | backward |
|
|
||||||
|
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
# Base case
|
|
||||||
| from | to | time | # |
|
| from | to | time | # |
|
||||||
|
| a | d | 21.9s | no turn with no traffic light |
|
||||||
|
| a | e | 22.2s | no turn with traffic light |
|
||||||
| a | b | 18.7s | turn with no traffic light |
|
| a | b | 18.7s | turn with no traffic light |
|
||||||
| a | e | 22.2s | no turn with no traffic light |
|
| e | b | 21.9s | no turn with no traffic light |
|
||||||
| a | d | 21.9s | turn with no traffic light |
|
| e | a | 22.2s | no turn with traffic light |
|
||||||
| e | b | 21.9s | turn with no traffic light |
|
|
||||||
| e | a | 22.2s | no turn with no traffic light |
|
|
||||||
| e | d | 18.7s | turn with no traffic light |
|
| e | d | 18.7s | turn with no traffic light |
|
||||||
| d | e | 21.9s | turn with no traffic light |
|
| d | e | 21.9s | no turn with no traffic light |
|
||||||
| d | b | 11s | no turn with no traffic light |
|
| d | b | 11s | no turn with traffic light |
|
||||||
| d | a | 18.7s | turn with no traffic light |
|
| d | a | 18.7s | turn with no traffic light |
|
||||||
| b | a | 21.9s | turn with no traffic light |
|
| b | a | 21.9s | no turn with no traffic light |
|
||||||
| b | d | 11s | no turn with no traffic light |
|
| b | d | 11s | no turn with traffic light |
|
||||||
| b | e | 18.7s | turn with no traffic light |
|
| b | e | 18.7s | turn with no traffic light |
|
||||||
# All have traffic lights - 2s penalty
|
|
||||||
| f | h | 20.7s | turn with traffic light |
|
| f | i | 23.9s | no turn with no traffic light |
|
||||||
| f | j | 24.2s | no turn with traffic light |
|
| f | j | 24.2s | no turn with traffic light |
|
||||||
| f | i | 23.9s | turn with traffic light |
|
| f | h | 20.7s | turn with no traffic light |
|
||||||
| j | h | 23.9s | turn with traffic light |
|
| j | h | 21.9s | no turn with no traffic light |
|
||||||
| j | f | 24.2s | no turn with traffic light |
|
| j | f | 22.2s | no turn with traffic light |
|
||||||
| j | i | 20.7s | turn with traffic light |
|
| j | i | 18.7s | turn with no traffic light |
|
||||||
| i | j | 23.9s | turn with traffic light |
|
| i | j | 21.9s | no turn with no traffic light |
|
||||||
| i | h | 13s | no turn with traffic light |
|
| i | h | 11s | no turn with traffic light |
|
||||||
| i | f | 20.7s | turn with traffic light |
|
| i | f | 18.7s | turn with no traffic light |
|
||||||
| h | f | 23.9s | turn with traffic light |
|
| h | f | 23.9s | no turn with no traffic light |
|
||||||
| h | i | 13s | no turn with traffic light |
|
| h | i | 13s | no turn with traffic light |
|
||||||
| h | j | 20.7s | turn with traffic light |
|
| h | j | 20.7s | turn with no traffic light |
|
||||||
# Front direction have traffic lights - 2s penalty
|
|
||||||
| k | l | 20.7s | turn with traffic light |
|
| k | n | 21.9s | no turn with no traffic light |
|
||||||
| k | o | 24.2s | no turn with traffic light |
|
| k | o | 22.2s | no turn with traffic light |
|
||||||
| k | n | 23.9s | turn with traffic light |
|
| k | l | 18.7s | turn with no traffic light |
|
||||||
| o | l | 21.9s | turn with no traffic light |
|
| o | l | 23.9s | no turn with no traffic light |
|
||||||
| o | k | 22.2s | no turn with no traffic light |
|
| o | k | 24.2s | no turn with traffic light |
|
||||||
| o | n | 18.7s | turn with no traffic light |
|
| o | n | 20.7s | turn with no traffic light |
|
||||||
| n | o | 21.9s | turn with no traffic light |
|
| n | o | 23.9s | no turn with no traffic light |
|
||||||
| n | l | 11s | no turn with no traffic light |
|
| n | l | 13s | no turn with traffic light |
|
||||||
| n | k | 18.7s | turn with no traffic light |
|
| n | k | 20.7s | turn with no traffic light |
|
||||||
| l | k | 23.9s | turn with traffic light |
|
| l | k | 21.9s | no turn with no traffic light |
|
||||||
| l | n | 13s | no turn with traffic light |
|
| l | n | 11s | no turn with traffic light |
|
||||||
| l | o | 20.7s | turn with traffic light |
|
| l | o | 18.7s | turn with no traffic light |
|
||||||
# Reverse direction have traffic lights - 2s penalty
|
|
||||||
| p | q | 18.7s | turn with no traffic light |
|
|
||||||
| p | t | 22.2s | no turn with no traffic light |
|
|
||||||
| p | s | 21.9s | turn with no traffic light |
|
|
||||||
| t | q | 23.9s | turn with traffic light |
|
|
||||||
| t | p | 24.2s | no turn with traffic light |
|
|
||||||
| t | s | 20.7s | turn with traffic light |
|
|
||||||
| s | t | 23.9s | turn with traffic light |
|
|
||||||
| s | q | 13s | no turn with traffic light |
|
|
||||||
| s | p | 20.7s | turn with traffic light |
|
|
||||||
| q | p | 21.9s | turn with no traffic light |
|
|
||||||
| q | s | 11s | no turn with no traffic light |
|
|
||||||
| q | t | 18.7s | turn with no traffic light |
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: Traffic Signal Geometry
|
Scenario: Traffic Signal Geometry
|
||||||
@@ -360,106 +308,3 @@ Feature: Car - Handle traffic lights
|
|||||||
| from | to | route | speed | weights | time | distances | a:datasources | a:nodes | a:speed | a:duration | a:weight |
|
| from | to | route | speed | weights | time | distances | a:datasources | a:nodes | a:speed | a:duration | a:weight |
|
||||||
| a | c | abc,abc | 65 km/h | 22.2,0 | 22.2s | 400m,0m | 1:0 | 1:2:3 | 18:18 | 11.1:11.1 | 11.1:11.1 |
|
| a | c | abc,abc | 65 km/h | 22.2,0 | 22.2s | 400m,0m | 1:0 | 1:2:3 | 18:18 | 11.1:11.1 | 11.1:11.1 |
|
||||||
| c | a | abc,abc | 60 km/h | 24.2,0 | 24.2s | 400m,0m | 0:1 | 3:2:1 | 18:18 | 11.1:11.1 | 11.1:11.1 |
|
| c | a | abc,abc | 60 km/h | 24.2,0 | 24.2s | 400m,0m | 0:1 | 3:2:1 | 18:18 | 11.1:11.1 | 11.1:11.1 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Car - Traffic signal straight direction with edge compression
|
|
||||||
Given the node map
|
|
||||||
"""
|
|
||||||
a-1-b - c - d-2-e
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes | highway |
|
|
||||||
| abcde | primary |
|
|
||||||
|
|
||||||
And the nodes
|
|
||||||
| node | highway | traffic_signals:direction |
|
|
||||||
| c | traffic_signals | forward |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | time | weight | # |
|
|
||||||
| 1 | 2 | 35.3s | 35.3 | no turn with traffic light |
|
|
||||||
| 2 | 1 | 33.3s | 33.3 | no turn with no traffic light |
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: Car - Traffic signal turn direction with edge compression
|
|
||||||
Given the node map
|
|
||||||
"""
|
|
||||||
d
|
|
||||||
|
|
|
||||||
2
|
|
||||||
|
|
|
||||||
a-1-b - c - f
|
|
||||||
|
|
|
||||||
e
|
|
||||||
|
|
||||||
j
|
|
||||||
|
|
|
||||||
4
|
|
||||||
|
|
|
||||||
g-3-h - i - k
|
|
||||||
|
|
|
||||||
l
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes | highway |
|
|
||||||
| abc | primary |
|
|
||||||
| cf | primary |
|
|
||||||
| fd | primary |
|
|
||||||
| fe | primary |
|
|
||||||
| ghi | primary |
|
|
||||||
| ik | primary |
|
|
||||||
| kj | primary |
|
|
||||||
| kl | primary |
|
|
||||||
|
|
||||||
And the nodes
|
|
||||||
| node | highway | traffic_signals:direction |
|
|
||||||
| k | traffic_signals | forward |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | time | weight | # |
|
|
||||||
| 1 | 2 | 44.2s | 44.2 | turn with no traffic light |
|
|
||||||
| 2 | 1 | 41s | 41 | turn with no traffic light |
|
|
||||||
| 3 | 4 | 46.2s | 46.2 | turn with traffic light |
|
|
||||||
| 4 | 3 | 41s | 41 | turn with no traffic light |
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: Car - Traffic signal turn direction with turn restriction
|
|
||||||
Given the node map
|
|
||||||
"""
|
|
||||||
d
|
|
||||||
|
|
|
||||||
2
|
|
||||||
|
|
|
||||||
a-1-b - c - f
|
|
||||||
|
|
|
||||||
e
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes | highway |
|
|
||||||
| abc | primary |
|
|
||||||
| cf | primary |
|
|
||||||
| fd | primary |
|
|
||||||
| fe | primary |
|
|
||||||
|
|
||||||
And the nodes
|
|
||||||
| node | highway | traffic_signals:direction |
|
|
||||||
| f | traffic_signals | forward |
|
|
||||||
|
|
||||||
And the relations
|
|
||||||
| type | way:from | way:to | way:via | restriction |
|
|
||||||
| restriction | abc | fe | cf | no_right_turn |
|
|
||||||
|
|
||||||
And the relations
|
|
||||||
| type | way:from | way:to | node:via | restriction |
|
|
||||||
| restriction | df | fc | f | right_turn_only |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | time | weight | # |
|
|
||||||
| 1 | 2 | 46.2s | 46.2 | turn with traffic light |
|
|
||||||
| 2 | 1 | 41s | 41 | turn with no traffic light |
|
|
||||||
|
|||||||
@@ -36,9 +36,3 @@ Feature: Foot - Accessability of different way types
|
|||||||
| highway | leisure | forw |
|
| highway | leisure | forw |
|
||||||
| (nil) | track | x |
|
| (nil) | track | x |
|
||||||
|
|
||||||
Scenario: Foot - Proposed ways
|
|
||||||
Then routability should be
|
|
||||||
| highway | foot | proposed | forw |
|
|
||||||
| footway | | | x |
|
|
||||||
| proposed | | | |
|
|
||||||
| proposed | yes | yes | |
|
|
||||||
|
|||||||
@@ -68,9 +68,8 @@ class OSRMDirectLoader extends OSRMBaseLoader {
|
|||||||
super(scope);
|
super(scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
load (ctx, callback) {
|
load (inputFile, callback) {
|
||||||
this.inputFile = ctx.inputFile;
|
this.inputFile = inputFile;
|
||||||
this.loaderArgs = ctx.loaderArgs;
|
|
||||||
this.shutdown(() => {
|
this.shutdown(() => {
|
||||||
this.launch(callback);
|
this.launch(callback);
|
||||||
});
|
});
|
||||||
@@ -79,7 +78,7 @@ class OSRMDirectLoader extends OSRMBaseLoader {
|
|||||||
osrmUp (callback) {
|
osrmUp (callback) {
|
||||||
if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!"));
|
if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!"));
|
||||||
|
|
||||||
const command_arguments = util.format('%s -p %d -i %s -a %s %s', this.inputFile, this.scope.OSRM_PORT, this.scope.OSRM_IP, this.scope.ROUTING_ALGORITHM, this.loaderArgs);
|
const command_arguments = util.format('%s -p %d -i %s -a %s', this.inputFile, this.scope.OSRM_PORT, this.scope.OSRM_IP, this.scope.ROUTING_ALGORITHM);
|
||||||
this.child = this.scope.runBin('osrm-routed', command_arguments, this.scope.environment, (err) => {
|
this.child = this.scope.runBin('osrm-routed', command_arguments, this.scope.environment, (err) => {
|
||||||
if (err && err.signal !== 'SIGINT') {
|
if (err && err.signal !== 'SIGINT') {
|
||||||
this.child = null;
|
this.child = null;
|
||||||
@@ -102,9 +101,8 @@ class OSRMmmapLoader extends OSRMBaseLoader {
|
|||||||
super(scope);
|
super(scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
load (ctx, callback) {
|
load (inputFile, callback) {
|
||||||
this.inputFile = ctx.inputFile;
|
this.inputFile = inputFile;
|
||||||
this.loaderArgs = ctx.loaderArgs;
|
|
||||||
this.shutdown(() => {
|
this.shutdown(() => {
|
||||||
this.launch(callback);
|
this.launch(callback);
|
||||||
});
|
});
|
||||||
@@ -113,7 +111,7 @@ class OSRMmmapLoader extends OSRMBaseLoader {
|
|||||||
osrmUp (callback) {
|
osrmUp (callback) {
|
||||||
if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!"));
|
if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!"));
|
||||||
|
|
||||||
const command_arguments = util.format('%s -p %d -i %s -a %s --mmap %s', this.inputFile, this.scope.OSRM_PORT, this.scope.OSRM_IP, this.scope.ROUTING_ALGORITHM, this.loaderArgs);
|
const command_arguments = util.format('%s -p %d -i %s -a %s --mmap', this.inputFile, this.scope.OSRM_PORT, this.scope.OSRM_IP, this.scope.ROUTING_ALGORITHM);
|
||||||
this.child = this.scope.runBin('osrm-routed', command_arguments, this.scope.environment, (err) => {
|
this.child = this.scope.runBin('osrm-routed', command_arguments, this.scope.environment, (err) => {
|
||||||
if (err && err.signal !== 'SIGINT') {
|
if (err && err.signal !== 'SIGINT') {
|
||||||
this.child = null;
|
this.child = null;
|
||||||
@@ -136,9 +134,8 @@ class OSRMDatastoreLoader extends OSRMBaseLoader {
|
|||||||
super(scope);
|
super(scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
load (ctx, callback) {
|
load (inputFile, callback) {
|
||||||
this.inputFile = ctx.inputFile;
|
this.inputFile = inputFile;
|
||||||
this.loaderArgs = ctx.loaderArgs;
|
|
||||||
|
|
||||||
this.loadData((err) => {
|
this.loadData((err) => {
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
@@ -151,7 +148,7 @@ class OSRMDatastoreLoader extends OSRMBaseLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadData (callback) {
|
loadData (callback) {
|
||||||
const command_arguments = util.format('--dataset-name=%s %s %s', this.scope.DATASET_NAME, this.inputFile, this.loaderArgs);
|
const command_arguments = util.format('--dataset-name=%s %s', this.scope.DATASET_NAME, this.inputFile);
|
||||||
this.scope.runBin('osrm-datastore', command_arguments, this.scope.environment, (err) => {
|
this.scope.runBin('osrm-datastore', command_arguments, this.scope.environment, (err) => {
|
||||||
if (err) return callback(new Error('*** osrm-datastore exited with ' + err.code + ': ' + err));
|
if (err) return callback(new Error('*** osrm-datastore exited with ' + err.code + ': ' + err));
|
||||||
callback();
|
callback();
|
||||||
|
|||||||
@@ -1,141 +0,0 @@
|
|||||||
@routing @disable-feature-dataset
|
|
||||||
Feature: disable-feature-dataset command line options
|
|
||||||
Background:
|
|
||||||
Given the profile "testbot"
|
|
||||||
And the node map
|
|
||||||
"""
|
|
||||||
0
|
|
||||||
a b c
|
|
||||||
"""
|
|
||||||
And the ways
|
|
||||||
| nodes |
|
|
||||||
| ab |
|
|
||||||
| bc |
|
|
||||||
|
|
||||||
Scenario: disable-feature-dataset - geometry disabled error
|
|
||||||
Given the data load extra arguments "--disable-feature-dataset ROUTE_GEOMETRY"
|
|
||||||
|
|
||||||
# The default values
|
|
||||||
And the query options
|
|
||||||
| overview | simplified |
|
|
||||||
| annotations | false |
|
|
||||||
| steps | false |
|
|
||||||
| skip_waypoints | false |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | code |
|
|
||||||
| a | c | DisabledDataset |
|
|
||||||
|
|
||||||
When I plan a trip I should get
|
|
||||||
| waypoints | code |
|
|
||||||
| a,b,c | DisabledDataset |
|
|
||||||
|
|
||||||
When I match I should get
|
|
||||||
| trace | code |
|
|
||||||
| abc | DisabledDataset |
|
|
||||||
|
|
||||||
Scenario: disable-feature-dataset - geometry disabled error table
|
|
||||||
Given the data load extra arguments "--disable-feature-dataset ROUTE_GEOMETRY"
|
|
||||||
|
|
||||||
When I request nearest I should get
|
|
||||||
| in | code |
|
|
||||||
| 0 | DisabledDataset |
|
|
||||||
|
|
||||||
When I request a travel time matrix with these waypoints I should get the response code
|
|
||||||
| waypoints | code |
|
|
||||||
| a,b,c | DisabledDataset |
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: disable-feature-dataset - geometry disabled success
|
|
||||||
Given the data load extra arguments "--disable-feature-dataset ROUTE_GEOMETRY"
|
|
||||||
|
|
||||||
# No geometry values returned
|
|
||||||
And the query options
|
|
||||||
| overview | false |
|
|
||||||
| annotations | false |
|
|
||||||
| steps | false |
|
|
||||||
| skip_waypoints | true |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | code |
|
|
||||||
| a | c | Ok |
|
|
||||||
|
|
||||||
When I plan a trip I should get
|
|
||||||
| waypoints | code |
|
|
||||||
| a,b,c | Ok |
|
|
||||||
|
|
||||||
When I match I should get
|
|
||||||
| trace | code |
|
|
||||||
| abc | Ok |
|
|
||||||
|
|
||||||
Scenario: disable-feature-dataset - geometry disabled error table
|
|
||||||
Given the data load extra arguments "--disable-feature-dataset ROUTE_GEOMETRY"
|
|
||||||
|
|
||||||
And the query options
|
|
||||||
| skip_waypoints | true |
|
|
||||||
|
|
||||||
# You would never do this, but just to prove the point.
|
|
||||||
When I request nearest I should get
|
|
||||||
| in | code |
|
|
||||||
| 0 | Ok |
|
|
||||||
|
|
||||||
When I request a travel time matrix with these waypoints I should get the response code
|
|
||||||
| waypoints | code |
|
|
||||||
| a,b,c | Ok |
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: disable-feature-dataset - steps disabled error
|
|
||||||
Given the data load extra arguments "--disable-feature-dataset ROUTE_STEPS"
|
|
||||||
|
|
||||||
# Default + annotations, steps
|
|
||||||
And the query options
|
|
||||||
| overview | simplified |
|
|
||||||
| annotations | true |
|
|
||||||
| steps | true |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | code |
|
|
||||||
| a | c | DisabledDataset |
|
|
||||||
|
|
||||||
When I plan a trip I should get
|
|
||||||
| waypoints | code |
|
|
||||||
| a,b,c | DisabledDataset |
|
|
||||||
|
|
||||||
When I match I should get
|
|
||||||
| trace | code |
|
|
||||||
| abc | DisabledDataset |
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: disable-feature-dataset - geometry disabled error table
|
|
||||||
Given the data load extra arguments "--disable-feature-dataset ROUTE_STEPS"
|
|
||||||
|
|
||||||
When I request nearest I should get
|
|
||||||
| in | code |
|
|
||||||
| 0 | Ok |
|
|
||||||
|
|
||||||
When I request a travel time matrix with these waypoints I should get the response code
|
|
||||||
| waypoints | code |
|
|
||||||
| a,b,c | Ok |
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: disable-feature-dataset - steps disabled success
|
|
||||||
Given the data load extra arguments "--disable-feature-dataset ROUTE_STEPS"
|
|
||||||
|
|
||||||
# Default + steps
|
|
||||||
And the query options
|
|
||||||
| overview | simplified |
|
|
||||||
| annotations | true |
|
|
||||||
| steps | false |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | code |
|
|
||||||
| a | c | Ok |
|
|
||||||
|
|
||||||
When I plan a trip I should get
|
|
||||||
| waypoints | code |
|
|
||||||
| a,b,c | Ok |
|
|
||||||
|
|
||||||
When I match I should get
|
|
||||||
| trace | code |
|
|
||||||
| abc | Ok |
|
|
||||||
|
|
||||||
@@ -154,27 +154,3 @@ Feature: osrm-extract lua ways:get_nodes()
|
|||||||
Then it should exit successfully
|
Then it should exit successfully
|
||||||
And stdout should contain "node 42"
|
And stdout should contain "node 42"
|
||||||
And stdout should contain "way 42"
|
And stdout should contain "way 42"
|
||||||
|
|
||||||
Scenario: osrm-extract flags accessible in process_segment function
|
|
||||||
Given the profile file
|
|
||||||
"""
|
|
||||||
functions = require('testbot')
|
|
||||||
|
|
||||||
functions.process_segment = function (profile, segment)
|
|
||||||
print('segment forward ' .. tostring(segment.flags.forward) .. ' backward ' .. tostring(segment.flags.backward))
|
|
||||||
end
|
|
||||||
|
|
||||||
return functions
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the node map
|
|
||||||
"""
|
|
||||||
a b
|
|
||||||
"""
|
|
||||||
And the ways
|
|
||||||
| nodes | oneway |
|
|
||||||
| ab | yes |
|
|
||||||
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 "segment forward true backward false"
|
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ Feature: osrm-routed command line options: help
|
|||||||
And stdout should contain "--max-trip-size"
|
And stdout should contain "--max-trip-size"
|
||||||
And stdout should contain "--max-table-size"
|
And stdout should contain "--max-table-size"
|
||||||
And stdout should contain "--max-matching-size"
|
And stdout should contain "--max-matching-size"
|
||||||
And stdout should contain "--default-radius"
|
|
||||||
And stdout should contain "--keepalive-timeout"
|
|
||||||
And it should exit successfully
|
And it should exit successfully
|
||||||
|
|
||||||
Scenario: osrm-routed - Help, short
|
Scenario: osrm-routed - Help, short
|
||||||
@@ -44,8 +42,6 @@ Feature: osrm-routed command line options: help
|
|||||||
And stdout should contain "--max-trip-size"
|
And stdout should contain "--max-trip-size"
|
||||||
And stdout should contain "--max-table-size"
|
And stdout should contain "--max-table-size"
|
||||||
And stdout should contain "--max-matching-size"
|
And stdout should contain "--max-matching-size"
|
||||||
And stdout should contain "--default-radius"
|
|
||||||
And stdout should contain "--keepalive-timeout"
|
|
||||||
And it should exit successfully
|
And it should exit successfully
|
||||||
|
|
||||||
Scenario: osrm-routed - Help, long
|
Scenario: osrm-routed - Help, long
|
||||||
@@ -66,6 +62,4 @@ Feature: osrm-routed command line options: help
|
|||||||
And stdout should contain "--max-table-size"
|
And stdout should contain "--max-table-size"
|
||||||
And stdout should contain "--max-table-size"
|
And stdout should contain "--max-table-size"
|
||||||
And stdout should contain "--max-matching-size"
|
And stdout should contain "--max-matching-size"
|
||||||
And stdout should contain "--default-radius"
|
|
||||||
And stdout should contain "--keepalive-timeout"
|
|
||||||
And it should exit successfully
|
And it should exit successfully
|
||||||
|
|||||||
@@ -33,11 +33,6 @@ module.exports = function () {
|
|||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.Given(/^the data load extra arguments "(.*?)"$/, (args, callback) => {
|
|
||||||
this.loaderArgs = this.expandOptions(args);
|
|
||||||
callback();
|
|
||||||
});
|
|
||||||
|
|
||||||
this.Given(/^a grid size of ([0-9.]+) meters$/, (meters, callback) => {
|
this.Given(/^a grid size of ([0-9.]+) meters$/, (meters, callback) => {
|
||||||
this.setGridSize(meters);
|
this.setGridSize(meters);
|
||||||
callback();
|
callback();
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ var FBResult = require('../support/fbresult_generated').osrm.engine.api.fbresult
|
|||||||
|
|
||||||
module.exports = function () {
|
module.exports = function () {
|
||||||
const durationsRegex = new RegExp(/^I request a travel time matrix I should get$/);
|
const durationsRegex = new RegExp(/^I request a travel time matrix I should get$/);
|
||||||
const durationsCodeOnlyRegex = new RegExp(/^I request a travel time matrix with these waypoints I should get the response code$/);
|
|
||||||
const distancesRegex = new RegExp(/^I request a travel distance matrix I should get$/);
|
const distancesRegex = new RegExp(/^I request a travel distance matrix I should get$/);
|
||||||
const estimatesRegex = new RegExp(/^I request a travel time matrix I should get estimates for$/);
|
const estimatesRegex = new RegExp(/^I request a travel time matrix I should get estimates for$/);
|
||||||
const durationsRegexFb = new RegExp(/^I request a travel time matrix with flatbuffers I should get$/);
|
const durationsRegexFb = new RegExp(/^I request a travel time matrix with flatbuffers I should get$/);
|
||||||
@@ -18,7 +17,6 @@ module.exports = function () {
|
|||||||
const FORMAT_FB = 'flatbuffers';
|
const FORMAT_FB = 'flatbuffers';
|
||||||
|
|
||||||
this.When(durationsRegex, function(table, callback) {tableParse.call(this, table, DURATIONS_NO_ROUTE, 'durations', FORMAT_JSON, callback);}.bind(this));
|
this.When(durationsRegex, function(table, callback) {tableParse.call(this, table, DURATIONS_NO_ROUTE, 'durations', FORMAT_JSON, callback);}.bind(this));
|
||||||
this.When(durationsCodeOnlyRegex, function(table, callback) {tableCodeOnlyParse.call(this, table, 'durations', FORMAT_JSON, callback);}.bind(this));
|
|
||||||
this.When(distancesRegex, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'distances', FORMAT_JSON, callback);}.bind(this));
|
this.When(distancesRegex, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'distances', FORMAT_JSON, callback);}.bind(this));
|
||||||
this.When(estimatesRegex, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'fallback_speed_cells', FORMAT_JSON, callback);}.bind(this));
|
this.When(estimatesRegex, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'fallback_speed_cells', FORMAT_JSON, callback);}.bind(this));
|
||||||
this.When(durationsRegexFb, function(table, callback) {tableParse.call(this, table, DURATIONS_NO_ROUTE, 'durations', FORMAT_FB, callback);}.bind(this));
|
this.When(durationsRegexFb, function(table, callback) {tableParse.call(this, table, DURATIONS_NO_ROUTE, 'durations', FORMAT_FB, callback);}.bind(this));
|
||||||
@@ -29,64 +27,6 @@ const durationsParse = function(v) { return isNaN(parseInt(v)); };
|
|||||||
const distancesParse = function(v) { return isNaN(parseFloat(v)); };
|
const distancesParse = function(v) { return isNaN(parseFloat(v)); };
|
||||||
const estimatesParse = function(v) { return isNaN(parseFloat(v)); };
|
const estimatesParse = function(v) { return isNaN(parseFloat(v)); };
|
||||||
|
|
||||||
function tableCodeOnlyParse(table, annotation, format, callback) {
|
|
||||||
|
|
||||||
const params = this.queryParams;
|
|
||||||
params.annotations = ['durations','fallback_speed_cells'].indexOf(annotation) !== -1 ? 'duration' : 'distance';
|
|
||||||
params.output = format;
|
|
||||||
|
|
||||||
var got;
|
|
||||||
|
|
||||||
this.reprocessAndLoadData((e) => {
|
|
||||||
if (e) return callback(e);
|
|
||||||
var testRow = (row, ri, cb) => {
|
|
||||||
var afterRequest = (err, res) => {
|
|
||||||
if (err) return cb(err);
|
|
||||||
|
|
||||||
for (var k in row) {
|
|
||||||
var match = k.match(/param:(.*)/);
|
|
||||||
if (match) {
|
|
||||||
if (row[k] === '(nil)') {
|
|
||||||
params[match[1]] = null;
|
|
||||||
} else if (row[k]) {
|
|
||||||
params[match[1]] = [row[k]];
|
|
||||||
}
|
|
||||||
got[k] = row[k];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var json;
|
|
||||||
got.code = 'unknown';
|
|
||||||
if (res.body.length) {
|
|
||||||
json = JSON.parse(res.body);
|
|
||||||
got.code = json.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
cb(null, got);
|
|
||||||
};
|
|
||||||
|
|
||||||
var params = this.queryParams,
|
|
||||||
waypoints = [];
|
|
||||||
if (row.waypoints) {
|
|
||||||
row.waypoints.split(',').forEach((n) => {
|
|
||||||
var node = this.findNodeByName(n);
|
|
||||||
if (!node) throw new Error(util.format('*** unknown waypoint node "%s"', n.trim()));
|
|
||||||
waypoints.push({ coord: node, type: 'loc' });
|
|
||||||
|
|
||||||
});
|
|
||||||
got = { waypoints: row.waypoints };
|
|
||||||
|
|
||||||
this.requestTable(waypoints, params, afterRequest);
|
|
||||||
} else {
|
|
||||||
throw new Error('*** no waypoints');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.processRowsAndDiff(table, testRow, callback);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function tableParse(table, noRoute, annotation, format, callback) {
|
function tableParse(table, noRoute, annotation, format, callback) {
|
||||||
|
|
||||||
const parse = annotation == 'distances' ? distancesParse : (annotation == 'durations' ? durationsParse : estimatesParse);
|
const parse = annotation == 'distances' ? distancesParse : (annotation == 'durations' ? durationsParse : estimatesParse);
|
||||||
@@ -122,6 +62,9 @@ function tableParse(table, noRoute, annotation, format, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var actual = [];
|
||||||
|
actual.push(table.headers);
|
||||||
|
|
||||||
this.reprocessAndLoadData((e) => {
|
this.reprocessAndLoadData((e) => {
|
||||||
if (e) return callback(e);
|
if (e) return callback(e);
|
||||||
// compute matrix
|
// compute matrix
|
||||||
|
|||||||
@@ -12,43 +12,35 @@ module.exports = function () {
|
|||||||
var inNode = this.findNodeByName(row.in);
|
var inNode = this.findNodeByName(row.in);
|
||||||
if (!inNode) throw new Error(util.format('*** unknown in-node "%s"', row.in));
|
if (!inNode) throw new Error(util.format('*** unknown in-node "%s"', row.in));
|
||||||
|
|
||||||
|
var outNode = this.findNodeByName(row.out);
|
||||||
|
if (!outNode) throw new Error(util.format('*** unknown out-node "%s"', row.out));
|
||||||
|
|
||||||
this.requestNearest(inNode, this.queryParams, (err, response) => {
|
this.requestNearest(inNode, this.queryParams, (err, response) => {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
var coord;
|
var coord;
|
||||||
var headers = new Set(table.raw()[0]);
|
var headers = new Set(table.raw()[0]);
|
||||||
|
|
||||||
var got = { in: row.in};
|
if (response.statusCode === 200 && response.body.length) {
|
||||||
|
|
||||||
if (response.body.length) {
|
|
||||||
var json = JSON.parse(response.body);
|
var json = JSON.parse(response.body);
|
||||||
got.code = json.code;
|
|
||||||
|
|
||||||
if (response.statusCode === 200) {
|
coord = json.waypoints[0].location;
|
||||||
|
|
||||||
if (headers.has('data_version')) {
|
var got = { in: row.in, out: row.out };
|
||||||
got.data_version = json.data_version || '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (json.waypoints && json.waypoints.length && row.out) {
|
|
||||||
coord = json.waypoints[0].location;
|
|
||||||
|
|
||||||
got.out = row.out;
|
|
||||||
|
|
||||||
var outNode = this.findNodeByName(row.out);
|
|
||||||
if (!outNode) throw new Error(util.format('*** unknown out-node "%s"', row.out));
|
|
||||||
|
|
||||||
Object.keys(row).forEach((key) => {
|
|
||||||
if (key === 'out') {
|
|
||||||
if (this.FuzzyMatch.matchLocation(coord, outNode)) {
|
|
||||||
got[key] = row[key];
|
|
||||||
} else {
|
|
||||||
row[key] = util.format('%s [%d,%d]', row[key], outNode.lat, outNode.lon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (headers.has('data_version')) {
|
||||||
|
got.data_version = json.data_version || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Object.keys(row).forEach((key) => {
|
||||||
|
if (key === 'out') {
|
||||||
|
if (this.FuzzyMatch.matchLocation(coord, outNode)) {
|
||||||
|
got[key] = row[key];
|
||||||
|
} else {
|
||||||
|
row[key] = util.format('%s [%d,%d]', row[key], outNode.lat, outNode.lon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
cb(null, got);
|
cb(null, got);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ module.exports = function () {
|
|||||||
this.When(/^I request \/(.*)$/, (path, callback) => {
|
this.When(/^I request \/(.*)$/, (path, callback) => {
|
||||||
this.reprocessAndLoadData((e) => {
|
this.reprocessAndLoadData((e) => {
|
||||||
if (e) return callback(e);
|
if (e) return callback(e);
|
||||||
this.requestUrl(path, (err, res, body) => {
|
this.requestPath(path, {}, (err, res, body) => {
|
||||||
this.response = res;
|
this.response = res;
|
||||||
callback(err, res, body);
|
callback(err, res, body);
|
||||||
});
|
});
|
||||||
@@ -23,13 +23,13 @@ module.exports = function () {
|
|||||||
this.ShouldBeWellFormed();
|
this.ShouldBeWellFormed();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.Then(/^status code should be (.+)$/, (code, callback) => {
|
this.Then(/^status code should be (\d+)$/, (code, callback) => {
|
||||||
try {
|
try {
|
||||||
this.json = JSON.parse(this.response.body);
|
this.json = JSON.parse(this.response.body);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
return callback(e);
|
return callback(e);
|
||||||
}
|
}
|
||||||
assert.equal(this.json.code, code);
|
assert.equal(this.json.status, parseInt(code));
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -55,4 +55,4 @@ module.exports = function () {
|
|||||||
assert.equal(this.processError.process, binary);
|
assert.equal(this.processError.process, binary);
|
||||||
assert.equal(parseInt(this.processError.code), parseInt(code));
|
assert.equal(parseInt(this.processError.code), parseInt(code));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ module.exports = function () {
|
|||||||
|
|
||||||
var encodedResult = '';
|
var encodedResult = '';
|
||||||
|
|
||||||
if (json.trips && row.trips) row.trips.split(',').forEach((sub, si) => {
|
if (json.trips) row.trips.split(',').forEach((sub, si) => {
|
||||||
if (si >= subTrips.length) {
|
if (si >= subTrips.length) {
|
||||||
ok = false;
|
ok = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -134,6 +134,7 @@ module.exports = function () {
|
|||||||
} else {
|
} else {
|
||||||
var params = this.queryParams,
|
var params = this.queryParams,
|
||||||
waypoints = [];
|
waypoints = [];
|
||||||
|
params['steps'] = 'true';
|
||||||
if (row.from && row.to) {
|
if (row.from && row.to) {
|
||||||
var fromNode = this.findNodeByName(row.from);
|
var fromNode = this.findNodeByName(row.from);
|
||||||
if (!fromNode) throw new Error(util.format('*** unknown from-node "%s"', row.from));
|
if (!fromNode) throw new Error(util.format('*** unknown from-node "%s"', row.from));
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -280,11 +280,10 @@ module.exports = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.reprocessAndLoadData = (callback) => {
|
this.reprocessAndLoadData = (callback) => {
|
||||||
let p = {loaderArgs: this.loaderArgs, inputFile: this.processedCacheFile};
|
|
||||||
let queue = d3.queue(1);
|
let queue = d3.queue(1);
|
||||||
queue.defer(this.writeAndLinkOSM.bind(this));
|
queue.defer(this.writeAndLinkOSM.bind(this));
|
||||||
queue.defer(this.extractContractPartitionAndCustomize.bind(this));
|
queue.defer(this.extractContractPartitionAndCustomize.bind(this));
|
||||||
queue.defer(this.osrmLoader.load.bind(this.osrmLoader), p);
|
queue.defer(this.osrmLoader.load.bind(this.osrmLoader), this.processedCacheFile);
|
||||||
queue.awaitAll(callback);
|
queue.awaitAll(callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ module.exports = function () {
|
|||||||
this.DEFAULT_ENVIRONMENT = process.env;
|
this.DEFAULT_ENVIRONMENT = process.env;
|
||||||
this.DEFAULT_PROFILE = 'bicycle';
|
this.DEFAULT_PROFILE = 'bicycle';
|
||||||
this.DEFAULT_INPUT_FORMAT = 'osm';
|
this.DEFAULT_INPUT_FORMAT = 'osm';
|
||||||
let loadMethod = process.argv[process.argv.indexOf('-m') +1];
|
this.DEFAULT_LOAD_METHOD = process.argv[process.argv.indexOf('-m') +1].match('mmap') ? 'mmap' : 'datastore';
|
||||||
this.DEFAULT_LOAD_METHOD = loadMethod.match('mmap') ? 'mmap' : loadMethod.match('directly') ? 'directly' : 'datastore';
|
|
||||||
this.DEFAULT_ORIGIN = [1,1];
|
this.DEFAULT_ORIGIN = [1,1];
|
||||||
this.OSM_USER = 'osrm';
|
this.OSM_USER = 'osrm';
|
||||||
this.OSM_UID = 1;
|
this.OSM_UID = 1;
|
||||||
@@ -43,7 +42,7 @@ module.exports = function () {
|
|||||||
this.OSRM_IP = process.env.OSRM_IP || '127.0.0.1';
|
this.OSRM_IP = process.env.OSRM_IP || '127.0.0.1';
|
||||||
this.OSRM_CONNECTION_RETRIES = process.env.OSRM_CONNECTION_RETRIES && parseInt(process.env.OSRM_CONNECTION_RETRIES) || 10;
|
this.OSRM_CONNECTION_RETRIES = process.env.OSRM_CONNECTION_RETRIES && parseInt(process.env.OSRM_CONNECTION_RETRIES) || 10;
|
||||||
this.OSRM_CONNECTION_EXP_BACKOFF_COEF = process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF && parseFloat(process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF) || 1.0;
|
this.OSRM_CONNECTION_EXP_BACKOFF_COEF = process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF && parseFloat(process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF) || 1.0;
|
||||||
|
|
||||||
this.HOST = `http://${this.OSRM_IP}:${this.OSRM_PORT}`;
|
this.HOST = `http://${this.OSRM_IP}:${this.OSRM_PORT}`;
|
||||||
|
|
||||||
this.OSRM_PROFILE = process.env.OSRM_PROFILE;
|
this.OSRM_PROFILE = process.env.OSRM_PROFILE;
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ module.exports = function () {
|
|||||||
this.contractArgs = '';
|
this.contractArgs = '';
|
||||||
this.partitionArgs = '';
|
this.partitionArgs = '';
|
||||||
this.customizeArgs = '';
|
this.customizeArgs = '';
|
||||||
this.loaderArgs = '';
|
|
||||||
this.environment = Object.assign(this.DEFAULT_ENVIRONMENT);
|
this.environment = Object.assign(this.DEFAULT_ENVIRONMENT);
|
||||||
this.resetOSM();
|
this.resetOSM();
|
||||||
|
|
||||||
|
|||||||
@@ -101,8 +101,7 @@ module.exports = function () {
|
|||||||
|
|
||||||
this.requestTrip = (waypoints, userParams, callback) => {
|
this.requestTrip = (waypoints, userParams, callback) => {
|
||||||
var defaults = {
|
var defaults = {
|
||||||
output: 'json',
|
output: 'json'
|
||||||
steps: 'true'
|
|
||||||
},
|
},
|
||||||
params = this.overwriteParams(defaults, userParams);
|
params = this.overwriteParams(defaults, userParams);
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ Feature: Alternative route
|
|||||||
| 7 | 8 | ca,ab,bd,dc,ca,ca | |
|
| 7 | 8 | ca,ab,bd,dc,ca,ca | |
|
||||||
|
|
||||||
|
|
||||||
@mld
|
@mld-only
|
||||||
Scenario: Alternative loop paths on a single node with an asymmetric circle
|
Scenario: Alternative loop paths on a single node with an asymmetric circle
|
||||||
# The test checks only MLD implementation, alternatives results are unpredictable for CH on windows (#4691, #4693)
|
# The test checks only MLD implementation, alternatives results are unpredictable for CH on windows (#4691, #4693)
|
||||||
Given a grid size of 10 meters
|
Given a grid size of 10 meters
|
||||||
|
|||||||
@@ -115,4 +115,4 @@ Feature: Annotations
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | a:speed | a:distance | a:duration | a:nodes |
|
| from | to | route | a:speed | a:distance | a:duration | a:nodes |
|
||||||
| a | c | abc,abc | 10:10 | 249.9876189:299.962882 | 25:30 | 1:2:3 |
|
| a | c | abc,abc | 10:10 | 249.987618946:299.962882039 | 25:30 | 1:2:3 |
|
||||||
|
|||||||
@@ -38,41 +38,7 @@ Feature: Approach parameter
|
|||||||
| 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 opposite for End
|
Scenario: Start End opposite approach, option unrestricted for Start and End
|
||||||
Given the profile "testbot"
|
|
||||||
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 opposite | ab,bc |
|
|
||||||
|
|
||||||
Scenario: Start End same approach, option opposite for Start and curb for End
|
|
||||||
Given the profile "testbot"
|
|
||||||
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 | opposite curb | ab,bc,bc |
|
|
||||||
|
|
||||||
Scenario: Start End different approach, option unrestricted for Start and End
|
|
||||||
Given the profile "testbot"
|
Given the profile "testbot"
|
||||||
And the node map
|
And the node map
|
||||||
"""
|
"""
|
||||||
@@ -90,7 +56,7 @@ Feature: Approach parameter
|
|||||||
| from | to | approaches | route |
|
| from | to | approaches | route |
|
||||||
| s | e | unrestricted unrestricted | ab,bc |
|
| s | e | unrestricted unrestricted | ab,bc |
|
||||||
|
|
||||||
Scenario: Start End different approach, option unrestricted for Start and curb for End
|
Scenario: Start End opposite approach, option unrestricted for Start and curb for End
|
||||||
Given the profile "testbot"
|
Given the profile "testbot"
|
||||||
And the node map
|
And the node map
|
||||||
"""
|
"""
|
||||||
@@ -108,43 +74,6 @@ Feature: Approach parameter
|
|||||||
| from | to | approaches | route |
|
| from | to | approaches | route |
|
||||||
| s | e | unrestricted curb | ab,bc |
|
| s | e | unrestricted curb | ab,bc |
|
||||||
|
|
||||||
Scenario: Start End different approach, option unrestricted for Start and opposite for End
|
|
||||||
Given the profile "testbot"
|
|
||||||
And the node map
|
|
||||||
"""
|
|
||||||
s
|
|
||||||
a------b------c
|
|
||||||
e
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes |
|
|
||||||
| ab |
|
|
||||||
| bc |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | approaches | route |
|
|
||||||
| s | e | unrestricted opposite | ab,bc,bc |
|
|
||||||
|
|
||||||
Scenario: Start End different approach, option curb for Start and opposite for End
|
|
||||||
Given the profile "testbot"
|
|
||||||
And the node map
|
|
||||||
"""
|
|
||||||
e
|
|
||||||
a------b------c-----------d
|
|
||||||
s
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes |
|
|
||||||
| ab |
|
|
||||||
| bc |
|
|
||||||
| cd |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | approaches | route |
|
|
||||||
| s | e | curb opposite | cd,cd,ab,ab |
|
|
||||||
|
|
||||||
|
|
||||||
###############
|
###############
|
||||||
# Oneway Test #
|
# Oneway Test #
|
||||||
@@ -182,44 +111,10 @@ Feature: Approach parameter
|
|||||||
| bc | yes |
|
| bc | yes |
|
||||||
|
|
||||||
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 |
|
| s | e | unrestricted curb | ab,bc |
|
||||||
|
|
||||||
Scenario: Test on oneway segment, Start End same approach, option unrestricted for Start and opposite for End
|
Scenario: Test on oneway segment, Start End opposite approach, option unrestricted for Start and End
|
||||||
Given the profile "testbot"
|
|
||||||
And the node map
|
|
||||||
"""
|
|
||||||
s e
|
|
||||||
a------b------c
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes | oneway |
|
|
||||||
| ab | yes |
|
|
||||||
| bc | yes |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | approaches | route |
|
|
||||||
| s | e | unrestricted opposite | ab,bc |
|
|
||||||
|
|
||||||
Scenario: Test on oneway segment, Start End same approach, option opposite for Start and curb for End
|
|
||||||
Given the profile "testbot"
|
|
||||||
And the node map
|
|
||||||
"""
|
|
||||||
s e
|
|
||||||
a------b------c
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes | oneway |
|
|
||||||
| ab | yes |
|
|
||||||
| bc | yes |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | approaches | route |
|
|
||||||
| s | e | opposite curb | ab,bc |
|
|
||||||
|
|
||||||
Scenario: Test on oneway segment, Start End different approach, option unrestricted for Start and End
|
|
||||||
Given the profile "testbot"
|
Given the profile "testbot"
|
||||||
And the node map
|
And the node map
|
||||||
"""
|
"""
|
||||||
@@ -237,7 +132,7 @@ Feature: Approach parameter
|
|||||||
| from | to | approaches | route |
|
| from | to | approaches | route |
|
||||||
| s | e | unrestricted unrestricted | ab,bc |
|
| s | e | unrestricted unrestricted | ab,bc |
|
||||||
|
|
||||||
Scenario: Test on oneway segment, Start End different 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 profile "testbot"
|
Given the profile "testbot"
|
||||||
And the node map
|
And the node map
|
||||||
"""
|
"""
|
||||||
@@ -255,42 +150,6 @@ Feature: Approach parameter
|
|||||||
| from | to | approaches | route |
|
| from | to | approaches | route |
|
||||||
| s | e | unrestricted curb | ab,bc |
|
| s | e | unrestricted curb | ab,bc |
|
||||||
|
|
||||||
Scenario: Test on oneway segment, Start End different approach, option unrestricted for Start and opposite for End
|
|
||||||
Given the profile "testbot"
|
|
||||||
And the node map
|
|
||||||
"""
|
|
||||||
s
|
|
||||||
a------b------c
|
|
||||||
e
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes | oneway |
|
|
||||||
| ab | yes |
|
|
||||||
| bc | yes |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | approaches | route |
|
|
||||||
| s | e | unrestricted opposite | ab,bc |
|
|
||||||
|
|
||||||
Scenario: Test on oneway segment, Start End different approach, option curb for Start and opposite for End
|
|
||||||
Given the profile "testbot"
|
|
||||||
And the node map
|
|
||||||
"""
|
|
||||||
s
|
|
||||||
a------b------c
|
|
||||||
e
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes | oneway |
|
|
||||||
| ab | yes |
|
|
||||||
| bc | yes |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | approaches | route |
|
|
||||||
| s | e | curb opposite | ab,bc |
|
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# UTurn Test #
|
# UTurn Test #
|
||||||
##############
|
##############
|
||||||
@@ -316,27 +175,6 @@ Feature: Approach parameter
|
|||||||
| from | to | approaches | route |
|
| from | to | approaches | route |
|
||||||
| s | e | unrestricted curb | |
|
| s | e | unrestricted curb | |
|
||||||
|
|
||||||
Scenario: UTurn test, router can find a route because uturn authorized to reach opposite side
|
|
||||||
Given the profile "testbot"
|
|
||||||
And the node map
|
|
||||||
"""
|
|
||||||
e s
|
|
||||||
a------b------c
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes |
|
|
||||||
| ab |
|
|
||||||
| bc |
|
|
||||||
|
|
||||||
And the relations
|
|
||||||
| type | way:from | way:to | node:via | restriction |
|
|
||||||
| restriction | bc | bc | c | no_u_turn |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | approaches | route |
|
|
||||||
| s | e | curb opposite | bc,ab,ab |
|
|
||||||
|
|
||||||
|
|
||||||
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 profile "testbot"
|
Given the profile "testbot"
|
||||||
@@ -360,9 +198,8 @@ Feature: Approach parameter
|
|||||||
| restriction | bc | bc | c | no_u_turn |
|
| restriction | bc | bc | c | no_u_turn |
|
||||||
|
|
||||||
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 |
|
||||||
| s | e | opposite curb | ab,bc,bc |
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: Start End same approach, option unrestricted for Start and curb for End, left-hand driving
|
Scenario: Start End same approach, option unrestricted for Start and curb for End, left-hand driving
|
||||||
@@ -391,32 +228,6 @@ Feature: Approach parameter
|
|||||||
| from | to | approaches | route |
|
| from | to | approaches | route |
|
||||||
| s | e | unrestricted curb | ab,bc |
|
| s | e | unrestricted curb | ab,bc |
|
||||||
|
|
||||||
Scenario: Start End same approach, option unrestricted for Start and opposite 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 opposite | ab,bc,bc |
|
|
||||||
|
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Left-side countries #
|
# Left-side countries #
|
||||||
@@ -449,8 +260,9 @@ Feature: Approach parameter
|
|||||||
"""
|
"""
|
||||||
And the node map
|
And the node map
|
||||||
"""
|
"""
|
||||||
s e
|
s
|
||||||
a------b------c
|
a------b------c
|
||||||
|
e
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
@@ -459,50 +271,10 @@ Feature: Approach parameter
|
|||||||
| bc |
|
| bc |
|
||||||
|
|
||||||
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 |
|
| s | e | unrestricted curb | ab,bc,bc |
|
||||||
|
|
||||||
Scenario: [Left-hand-side] Start End same approach, option unrestricted for Start and opposite for End
|
Scenario: [Left-hand-side] Start End opposite approach, option unrestricted for Start and End
|
||||||
Given the profile file "car" initialized with
|
|
||||||
"""
|
|
||||||
profile.properties.left_hand_driving = true
|
|
||||||
"""
|
|
||||||
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 opposite | ab,bc,bc |
|
|
||||||
|
|
||||||
Scenario: [Left-hand-side] Start End same approach, option opposite for Start and curb for End
|
|
||||||
Given the profile file "car" initialized with
|
|
||||||
"""
|
|
||||||
profile.properties.left_hand_driving = true
|
|
||||||
"""
|
|
||||||
And the node map
|
|
||||||
"""
|
|
||||||
e s
|
|
||||||
a------b------c
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes |
|
|
||||||
| ab |
|
|
||||||
| bc |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | approaches | route |
|
|
||||||
| s | e | opposite curb | bc,ab,ab |
|
|
||||||
|
|
||||||
Scenario: [Left-hand-side] Start End different approach, option unrestricted for Start and End
|
|
||||||
Given the profile file "car" initialized with
|
Given the profile file "car" initialized with
|
||||||
"""
|
"""
|
||||||
profile.properties.left_hand_driving = true
|
profile.properties.left_hand_driving = true
|
||||||
@@ -523,16 +295,15 @@ Feature: Approach parameter
|
|||||||
| from | to | approaches | route |
|
| from | to | approaches | route |
|
||||||
| s | e | unrestricted unrestricted | ab,bc |
|
| s | e | unrestricted unrestricted | ab,bc |
|
||||||
|
|
||||||
Scenario: [Left-hand-side] Start End different approach, option unrestricted for Start and curb for End
|
Scenario: [Left-hand-side] Start End opposite approach, option unrestricted for Start and curb for End
|
||||||
Given the profile file "car" initialized with
|
Given the profile file "car" initialized with
|
||||||
"""
|
"""
|
||||||
profile.properties.left_hand_driving = true
|
profile.properties.left_hand_driving = true
|
||||||
"""
|
"""
|
||||||
And the node map
|
And the node map
|
||||||
"""
|
"""
|
||||||
s
|
s e
|
||||||
a------b------c
|
a------b------c
|
||||||
e
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
@@ -541,122 +312,5 @@ Feature: Approach parameter
|
|||||||
| bc |
|
| bc |
|
||||||
|
|
||||||
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 |
|
||||||
|
|
||||||
Scenario: [Left-hand-side] Start End different approach, option unrestricted for Start and opposite for End
|
|
||||||
Given the profile file "car" initialized with
|
|
||||||
"""
|
|
||||||
profile.properties.left_hand_driving = true
|
|
||||||
"""
|
|
||||||
And the node map
|
|
||||||
"""
|
|
||||||
s
|
|
||||||
a------b------c
|
|
||||||
e
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes |
|
|
||||||
| ab |
|
|
||||||
| bc |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | approaches | route |
|
|
||||||
| s | e | unrestricted opposite | ab,bc |
|
|
||||||
|
|
||||||
Scenario: [Left-hand-side] Start End different approach, option curb for Start and opposite for End
|
|
||||||
Given the profile file "car" initialized with
|
|
||||||
"""
|
|
||||||
profile.properties.left_hand_driving = true
|
|
||||||
"""
|
|
||||||
And the node map
|
|
||||||
"""
|
|
||||||
s
|
|
||||||
a------b------c
|
|
||||||
e
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes |
|
|
||||||
| ab |
|
|
||||||
| bc |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| from | to | approaches | route |
|
|
||||||
| s | e | curb opposite | ab,bc |
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: Routes with more than two waypoints - uturns allowed
|
|
||||||
Given the profile "testbot"
|
|
||||||
And the node map
|
|
||||||
"""
|
|
||||||
2 1
|
|
||||||
a------b------c-----------d
|
|
||||||
|
|
|
||||||
3 | 4
|
|
||||||
e------f------g-----------h
|
|
||||||
|
|
|
||||||
|
|
|
||||||
i
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes |
|
|
||||||
| ab |
|
|
||||||
| bc |
|
|
||||||
| cd |
|
|
||||||
| bf |
|
|
||||||
| ef |
|
|
||||||
| fg |
|
|
||||||
| gh |
|
|
||||||
| ei |
|
|
||||||
|
|
||||||
And the query options
|
|
||||||
| continue_straight | false |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| waypoints | approaches | locations | # |
|
|
||||||
| 1,2,3,4 | curb curb curb curb | _,_,_,a,b,f,_,_,i,h,_ | 1,2,2,a,b,f,3,3,i,h,4 (Only u-turn at end of roads) |
|
|
||||||
| 1,2,3,4 | curb unrestricted unrestricted curb | _,_,_,b,f,_,_,h,_ | 1,2,2,b,f,3,3,h,4 (Can u-turn at 2 and 3) |
|
|
||||||
| 1,2,3,4 | opposite opposite opposite opposite | _,d,a,_,_,b,f,i,_,_,_ | 1,d,a,2,2,b,f,i,3,3,4 (Only u-turn at end of roads) |
|
|
||||||
| 1,2,3,4 | opposite unrestricted unrestricted opposite | _,d,_,_,b,f,_,_,_ | 1,d,2,2,b,f,3,3,4 (Can u-turn at 2 and 3) |
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: Routes with more than two waypoints - uturns forbidden
|
|
||||||
Given the profile "testbot"
|
|
||||||
And the node map
|
|
||||||
"""
|
|
||||||
2 1
|
|
||||||
a------b------c-----------d
|
|
||||||
|
|
|
||||||
3 | 4
|
|
||||||
e------f------g-----------h
|
|
||||||
|
|
|
||||||
|
|
|
||||||
i
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes |
|
|
||||||
| ab |
|
|
||||||
| bc |
|
|
||||||
| cd |
|
|
||||||
| bf |
|
|
||||||
| ef |
|
|
||||||
| fg |
|
|
||||||
| gh |
|
|
||||||
| ei |
|
|
||||||
|
|
||||||
And the query options
|
|
||||||
| continue_straight | true |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| waypoints | approaches | locations | # |
|
|
||||||
| 1,2,3,4 | curb curb curb curb | _,_,_,a,b,f,_,_,i,h,_ | 1,2,2,a,b,f,3,3,i,h,4 (Only u-turn at end of roads) |
|
|
||||||
| 1,2,3,4 | curb opposite opposite curb | _,a,_,_,b,f,i,_,_,h,_ | 1,a,2,2,b,f,i,3,3,h,4 (switches stops with u-turns) |
|
|
||||||
| 1,2,3,4 | opposite opposite opposite opposite | _,d,a,_,_,b,f,i,_,_,_ | 1,d,a,2,2,b,f,i,3,3,4 (Only u-turn at end of roads) |
|
|
||||||
| 1,2,3,4 | opposite curb curb opposite | _,d,_,_,a,b,f,_,_,i,_ | 1,d,2,2,a,b,f,3,3,i,4 (switches stops with u-turns) |
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
@routing @testbot @via
|
|
||||||
Feature: Force routing steps
|
|
||||||
Background:
|
|
||||||
Given the profile "testbot"
|
|
||||||
|
|
||||||
Scenario: Direct routes with waypoints on same edge
|
|
||||||
Given the node map
|
|
||||||
"""
|
|
||||||
1 2
|
|
||||||
a-------b
|
|
||||||
| |
|
|
||||||
d-------c
|
|
||||||
| |
|
|
||||||
e-------f
|
|
||||||
3 4
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes | oneway |
|
|
||||||
| ab | no |
|
|
||||||
| ad | no |
|
|
||||||
| bc | no |
|
|
||||||
| cf | no |
|
|
||||||
| dc | no |
|
|
||||||
| de | no |
|
|
||||||
| ef | yes |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| waypoints | approaches | weight | route |
|
|
||||||
| 1,2 | | 20 | ab,ab |
|
|
||||||
| 1,2 | curb curb | 100 | ab,ad,dc,bc,ab |
|
|
||||||
| 2,1 | | 20 | ab,ab |
|
|
||||||
| 2,1 | opposite opposite | 100 | ab,bc,dc,ad,ab |
|
|
||||||
| 3,4 | | 20 | ef,ef |
|
|
||||||
| 4,3 | | 100 | ef,cf,dc,de,ef |
|
|
||||||
|
|
||||||
Scenario: Via routes with waypoints on same edge
|
|
||||||
Given the node map
|
|
||||||
"""
|
|
||||||
1 2
|
|
||||||
a-------b
|
|
||||||
| |
|
|
||||||
d-5-----c
|
|
||||||
| |
|
|
||||||
e-------f
|
|
||||||
3 4
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes | oneway |
|
|
||||||
| ab | no |
|
|
||||||
| ad | no |
|
|
||||||
| bc | no |
|
|
||||||
| cf | no |
|
|
||||||
| dc | no |
|
|
||||||
| de | no |
|
|
||||||
| ef | yes |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| waypoints | approaches | weight | route |
|
|
||||||
| 5,1,2 | | 59.8 | dc,ad,ab,ab,ab |
|
|
||||||
| 5,1,2 | unrestricted curb curb | 180.2 | dc,bc,ab,ab,ab,ad,dc,bc,ab |
|
|
||||||
| 5,2,1 | | 80.2 | dc,bc,ab,ab,ab |
|
|
||||||
| 5,2,1 | unrestricted opposite opposite | 159.8 | dc,ad,ab,ab,ab,bc,dc,ad,ab |
|
|
||||||
| 5,3,4 | | 59.8 | dc,de,ef,ef,ef |
|
|
||||||
| 5,4,3 | | 159.8 | dc,de,ef,ef,ef,cf,dc,de,ef |
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: [U-turns allowed] Via routes with waypoints on same edge
|
|
||||||
Given the node map
|
|
||||||
"""
|
|
||||||
1 2
|
|
||||||
a-------b
|
|
||||||
| |
|
|
||||||
d-5-----c
|
|
||||||
| |
|
|
||||||
e-------f
|
|
||||||
3 4
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes | oneway |
|
|
||||||
| ab | no |
|
|
||||||
| ad | no |
|
|
||||||
| bc | no |
|
|
||||||
| cf | no |
|
|
||||||
| dc | no |
|
|
||||||
| de | no |
|
|
||||||
| ef | yes |
|
|
||||||
|
|
||||||
And the query options
|
|
||||||
| continue_straight | false |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| waypoints | approaches | weight | route |
|
|
||||||
| 5,1,2 | | 59.8 | dc,ad,ab,ab,ab |
|
|
||||||
| 5,1,2 | unrestricted curb curb | 180.2 | dc,bc,ab,ab,ab,ad,dc,bc,ab |
|
|
||||||
| 5,2,1 | | 79.8 | dc,ad,ab,ab,ab,ab |
|
|
||||||
| 5,2,1 | unrestricted opposite opposite | 159.8 | dc,ad,ab,ab,ab,bc,dc,ad,ab |
|
|
||||||
| 5,3,4 | | 59.8 | dc,de,ef,ef,ef |
|
|
||||||
| 5,4,3 | | 159.8 | dc,de,ef,ef,ef,cf,dc,de,ef |
|
|
||||||
@@ -810,6 +810,6 @@ Feature: Basic Map Matching
|
|||||||
# These should have the same weights/duration in either direction
|
# These should have the same weights/duration in either direction
|
||||||
When I match I should get
|
When I match I should get
|
||||||
| trace | geometry | a:distance | a:duration | a:weight | duration |
|
| trace | geometry | a:distance | a:duration | a:weight | duration |
|
||||||
| 2345 | 1.00018,1,1.000314,1 | 14.91466649 | 1.4 | 1.4 | 1.4 |
|
| 2345 | 1.00018,1,1.000314,1 | 14.914666491 | 1.4 | 1.4 | 1.4 |
|
||||||
| 4321 | 1.00027,1,1.000135,1 | 15.02596997 | 1.5 | 1.5 | 1.5 |
|
| 4321 | 1.00027,1,1.000135,1 | 15.025969972 | 1.5 | 1.5 | 1.5 |
|
||||||
|
|
||||||
|
|||||||
@@ -570,7 +570,7 @@ Feature: Snapping at intersections
|
|||||||
| a,f,k | ac,cf,cf,fj,kj,kj | 132.8s | 132.8 |
|
| a,f,k | ac,cf,cf,fj,kj,kj | 132.8s | 132.8 |
|
||||||
| k,f | ik,fi,fi | 54.3s | 54.3 |
|
| k,f | ik,fi,fi | 54.3s | 54.3 |
|
||||||
| f,a | ef,ae,ae | 66.6s | 66.6 |
|
| f,a | ef,ae,ae | 66.6s | 66.6 |
|
||||||
| k,f,a | kj,fj,fj,ef,ae,ae | 141.4s | 141.4 |
|
| k,f,a | kj,fj,fj,ef,ae,ae | 141.399999999s | 141.399999999 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a | f | k |
|
| | a | f | k |
|
||||||
@@ -626,4 +626,4 @@ Feature: Snapping at intersections
|
|||||||
| a,f,k | ad,df,df,fj,kj,kj | 105.6s | 105.6 |
|
| a,f,k | ad,df,df,fj,kj,kj | 105.6s | 105.6 |
|
||||||
| k,f | ik,fi,fi | 54.3s | 54.3 |
|
| k,f | ik,fi,fi | 54.3s | 54.3 |
|
||||||
| f,a | ef,ae,ae | 66.6s | 66.6 |
|
| f,a | ef,ae,ae | 66.6s | 66.6 |
|
||||||
| k,f,a | ik,fi,fi,ef,ae,ae | 120.9s | 120.9 |
|
| k,f,a | ik,fi,fi,ef,ae,ae | 120.899999999s | 120.899999999 |
|
||||||
|
|||||||
@@ -53,10 +53,10 @@ Feature: Weight tests
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | distances | weights | times | a:distance | a:duration | a:weight | a:speed |
|
| waypoints | route | distances | weights | times | a:distance | a:duration | a:weight | a:speed |
|
||||||
| s,t | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.03462663 | 2 | 2 | 10 |
|
| s,t | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.034626629 | 2 | 2 | 10 |
|
||||||
| t,s | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.03462663 | 2 | 2 | 10 |
|
| t,s | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.034626629 | 2 | 2 | 10 |
|
||||||
| s,e | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 29.94063646:10.01731331 | 3:0.9 | 3:0.9 | 10:11.1 |
|
| s,e | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 29.940636463:10.017313314 | 3:0.9 | 3:0.9 | 10:11.1 |
|
||||||
| e,s | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 10.01731331:29.94063646 | 0.9:3 | 0.9:3 | 11.1:10 |
|
| e,s | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 10.017313314:29.940636463 | 0.9:3 | 0.9:3 | 11.1:10 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Step weights -- way_function: fail if no weight or weight_per_meter property
|
Scenario: Step weights -- way_function: fail if no weight or weight_per_meter property
|
||||||
|
|||||||
+1
-2
@@ -38,8 +38,7 @@ if (ENABLE_FUZZING)
|
|||||||
"table_parameters"
|
"table_parameters"
|
||||||
"tile_parameters"
|
"tile_parameters"
|
||||||
"trip_parameters"
|
"trip_parameters"
|
||||||
"url_parser"
|
"url_parser")
|
||||||
"request_parser")
|
|
||||||
|
|
||||||
foreach (target ${ServerTargets})
|
foreach (target ${ServerTargets})
|
||||||
add_fuzz_target(${target})
|
add_fuzz_target(${target})
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
#include "server/request_parser.hpp"
|
|
||||||
#include "server/http/request.hpp"
|
|
||||||
|
|
||||||
#include "util.hpp"
|
|
||||||
|
|
||||||
#include <iterator>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
using osrm::server::RequestParser;
|
|
||||||
using osrm::server::http::request;
|
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size)
|
|
||||||
{
|
|
||||||
std::string in(reinterpret_cast<const char *>(data), size);
|
|
||||||
|
|
||||||
auto first = begin(in);
|
|
||||||
auto last = end(in);
|
|
||||||
|
|
||||||
RequestParser parser;
|
|
||||||
request req;
|
|
||||||
|
|
||||||
// &(*it) is needed to go from iterator to underlying item to pointer to underlying item
|
|
||||||
parser.parse(req, &(*first), &(*last));
|
|
||||||
|
|
||||||
escape(&req);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,9 @@
|
|||||||
#include "contractor/graph_contractor_adaptors.hpp"
|
#include "contractor/graph_contractor_adaptors.hpp"
|
||||||
#include "contractor/query_graph.hpp"
|
#include "contractor/query_graph.hpp"
|
||||||
|
|
||||||
namespace osrm::contractor
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace contractor
|
||||||
{
|
{
|
||||||
|
|
||||||
using GraphAndFilter = std::tuple<QueryGraph, std::vector<std::vector<bool>>>;
|
using GraphAndFilter = std::tuple<QueryGraph, std::vector<std::vector<bool>>>;
|
||||||
@@ -61,12 +63,10 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
|
|||||||
// Add all non-core edges to container
|
// Add all non-core edges to container
|
||||||
{
|
{
|
||||||
auto non_core_edges = toEdges<QueryEdge>(contractor_graph);
|
auto non_core_edges = toEdges<QueryEdge>(contractor_graph);
|
||||||
auto new_end = std::remove_if(non_core_edges.begin(),
|
auto new_end =
|
||||||
non_core_edges.end(),
|
std::remove_if(non_core_edges.begin(), non_core_edges.end(), [&](const auto &edge) {
|
||||||
[&](const auto &edge) {
|
return is_shared_core[edge.source] && is_shared_core[edge.target];
|
||||||
return is_shared_core[edge.source] &&
|
});
|
||||||
is_shared_core[edge.target];
|
|
||||||
});
|
|
||||||
non_core_edges.resize(new_end - non_core_edges.begin());
|
non_core_edges.resize(new_end - non_core_edges.begin());
|
||||||
edge_container.Insert(std::move(non_core_edges));
|
edge_container.Insert(std::move(non_core_edges));
|
||||||
|
|
||||||
@@ -77,8 +77,8 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extract core graph for further contraction
|
// Extract core graph for further contraction
|
||||||
shared_core_graph = contractor_graph.Filter([&is_shared_core](const NodeID node)
|
shared_core_graph = contractor_graph.Filter(
|
||||||
{ return is_shared_core[node]; });
|
[&is_shared_core](const NodeID node) { return is_shared_core[node]; });
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &filter : filters)
|
for (const auto &filter : filters)
|
||||||
@@ -94,6 +94,7 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
|
|||||||
return GraphAndFilter{QueryGraph{num_nodes, edge_container.edges},
|
return GraphAndFilter{QueryGraph{num_nodes, edge_container.edges},
|
||||||
edge_container.MakeEdgeFilters()};
|
edge_container.MakeEdgeFilters()};
|
||||||
}
|
}
|
||||||
} // namespace osrm::contractor
|
} // namespace contractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -14,7 +14,9 @@
|
|||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm::contractor
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace contractor
|
||||||
{
|
{
|
||||||
|
|
||||||
struct ContractedEdgeContainer
|
struct ContractedEdgeContainer
|
||||||
@@ -89,40 +91,37 @@ struct ContractedEdgeContainer
|
|||||||
|
|
||||||
// Remove all edges that are contained in the old set of edges and set the appropriate flag.
|
// Remove all edges that are contained in the old set of edges and set the appropriate flag.
|
||||||
auto new_end =
|
auto new_end =
|
||||||
std::remove_if(new_edges.begin(),
|
std::remove_if(new_edges.begin(), new_edges.end(), [&](const QueryEdge &edge) {
|
||||||
new_edges.end(),
|
// check if the new edge would be sorted before the currend old edge
|
||||||
[&](const QueryEdge &edge)
|
// if so it is not contained yet in the set of old edges
|
||||||
{
|
if (edge_iter == edge_end || mergeCompare(edge, *edge_iter))
|
||||||
// check if the new edge would be sorted before the currend old edge
|
{
|
||||||
// if so it is not contained yet in the set of old edges
|
return false;
|
||||||
if (edge_iter == edge_end || mergeCompare(edge, *edge_iter))
|
}
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find the first old edge that is equal or greater then the new edge
|
// find the first old edge that is equal or greater then the new edge
|
||||||
while (edge_iter != edge_end && mergeCompare(*edge_iter, edge))
|
while (edge_iter != edge_end && mergeCompare(*edge_iter, edge))
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(flags_iter != flags.end());
|
BOOST_ASSERT(flags_iter != flags.end());
|
||||||
edge_iter++;
|
edge_iter++;
|
||||||
flags_iter++;
|
flags_iter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// all new edges will be sorted after the old edges
|
// all new edges will be sorted after the old edges
|
||||||
if (edge_iter == edge_end)
|
if (edge_iter == edge_end)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_ASSERT(edge_iter != edge_end);
|
BOOST_ASSERT(edge_iter != edge_end);
|
||||||
if (mergable(edge, *edge_iter))
|
if (mergable(edge, *edge_iter))
|
||||||
{
|
{
|
||||||
*flags_iter = *flags_iter | flag;
|
*flags_iter = *flags_iter | flag;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
BOOST_ASSERT(mergeCompare(edge, *edge_iter));
|
BOOST_ASSERT(mergeCompare(edge, *edge_iter));
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// append new edges
|
// append new edges
|
||||||
edges.insert(edges.end(), new_edges.begin(), new_end);
|
edges.insert(edges.end(), new_edges.begin(), new_end);
|
||||||
@@ -135,10 +134,10 @@ struct ContractedEdgeContainer
|
|||||||
// enforce sorting for next merge step
|
// enforce sorting for next merge step
|
||||||
std::vector<unsigned> ordering(edges_size);
|
std::vector<unsigned> ordering(edges_size);
|
||||||
std::iota(ordering.begin(), ordering.end(), 0);
|
std::iota(ordering.begin(), ordering.end(), 0);
|
||||||
tbb::parallel_sort(ordering.begin(),
|
tbb::parallel_sort(
|
||||||
ordering.end(),
|
ordering.begin(), ordering.end(), [&](const auto lhs_idx, const auto rhs_idx) {
|
||||||
[&](const auto lhs_idx, const auto rhs_idx)
|
return mergeCompare(edges[lhs_idx], edges[rhs_idx]);
|
||||||
{ return mergeCompare(edges[lhs_idx], edges[rhs_idx]); });
|
});
|
||||||
auto permutation = util::orderingToPermutation(ordering);
|
auto permutation = util::orderingToPermutation(ordering);
|
||||||
|
|
||||||
util::inplacePermutation(edges.begin(), edges.end(), permutation);
|
util::inplacePermutation(edges.begin(), edges.end(), permutation);
|
||||||
@@ -165,6 +164,7 @@ struct ContractedEdgeContainer
|
|||||||
std::vector<MergedFlags> flags;
|
std::vector<MergedFlags> flags;
|
||||||
std::vector<QueryEdge> edges;
|
std::vector<QueryEdge> edges;
|
||||||
};
|
};
|
||||||
} // namespace osrm::contractor
|
} // namespace contractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
#include "contractor/query_graph.hpp"
|
#include "contractor/query_graph.hpp"
|
||||||
|
|
||||||
namespace osrm::contractor
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace contractor
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
@@ -17,6 +19,7 @@ template <storage::Ownership Ownership> struct ContractedMetric
|
|||||||
|
|
||||||
using ContractedMetric = detail::ContractedMetric<storage::Ownership::Container>;
|
using ContractedMetric = detail::ContractedMetric<storage::Ownership::Container>;
|
||||||
using ContractedMetricView = detail::ContractedMetric<storage::Ownership::View>;
|
using ContractedMetricView = detail::ContractedMetric<storage::Ownership::View>;
|
||||||
} // namespace osrm::contractor
|
} // namespace contractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include "contractor/contractor_config.hpp"
|
#include "contractor/contractor_config.hpp"
|
||||||
|
|
||||||
namespace osrm::contractor
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace contractor
|
||||||
{
|
{
|
||||||
|
|
||||||
/// Base class of osrm-contract
|
/// Base class of osrm-contract
|
||||||
@@ -47,6 +49,7 @@ class Contractor
|
|||||||
private:
|
private:
|
||||||
ContractorConfig config;
|
ContractorConfig config;
|
||||||
};
|
};
|
||||||
} // namespace osrm::contractor
|
} // namespace contractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // PROCESSING_CHAIN_HPP
|
#endif // PROCESSING_CHAIN_HPP
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace osrm::contractor
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace contractor
|
||||||
{
|
{
|
||||||
|
|
||||||
struct ContractorConfig final : storage::IOConfig
|
struct ContractorConfig final : storage::IOConfig
|
||||||
@@ -69,6 +71,7 @@ struct ContractorConfig final : storage::IOConfig
|
|||||||
//(e.g. 0.8 contracts 80 percent of the hierarchy, leaving a core of 20%)
|
//(e.g. 0.8 contracts 80 percent of the hierarchy, leaving a core of 20%)
|
||||||
double core_factor = 1.0;
|
double core_factor = 1.0;
|
||||||
};
|
};
|
||||||
} // namespace osrm::contractor
|
} // namespace contractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // EXTRACTOR_OPTIONS_HPP
|
#endif // EXTRACTOR_OPTIONS_HPP
|
||||||
|
|||||||
@@ -4,18 +4,20 @@
|
|||||||
#include "util/dynamic_graph.hpp"
|
#include "util/dynamic_graph.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace osrm::contractor
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace contractor
|
||||||
{
|
{
|
||||||
|
|
||||||
struct ContractorEdgeData
|
struct ContractorEdgeData
|
||||||
{
|
{
|
||||||
ContractorEdgeData()
|
ContractorEdgeData()
|
||||||
: weight{0}, duration{0}, distance{0}, id(0), originalEdges(0), shortcut(0), forward(0),
|
: weight(0), duration(0), distance(0), id(0), originalEdges(0), shortcut(0), forward(0),
|
||||||
backward(0)
|
backward(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
ContractorEdgeData(EdgeWeight weight,
|
ContractorEdgeData(EdgeWeight weight,
|
||||||
EdgeDuration duration,
|
EdgeWeight duration,
|
||||||
EdgeDistance distance,
|
EdgeDistance distance,
|
||||||
unsigned original_edges,
|
unsigned original_edges,
|
||||||
unsigned id,
|
unsigned id,
|
||||||
@@ -28,7 +30,7 @@ struct ContractorEdgeData
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
EdgeWeight weight;
|
EdgeWeight weight;
|
||||||
EdgeDuration duration;
|
EdgeWeight duration;
|
||||||
EdgeDistance distance;
|
EdgeDistance distance;
|
||||||
unsigned id;
|
unsigned id;
|
||||||
unsigned originalEdges : 29;
|
unsigned originalEdges : 29;
|
||||||
@@ -40,6 +42,7 @@ struct ContractorEdgeData
|
|||||||
using ContractorGraph = util::DynamicGraph<ContractorEdgeData>;
|
using ContractorGraph = util::DynamicGraph<ContractorEdgeData>;
|
||||||
using ContractorEdge = ContractorGraph::InputEdge;
|
using ContractorEdge = ContractorGraph::InputEdge;
|
||||||
|
|
||||||
} // namespace osrm::contractor
|
} // namespace contractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_CONTRACTOR_CONTRACTOR_GRAPH_HPP_
|
#endif // OSRM_CONTRACTOR_CONTRACTOR_GRAPH_HPP_
|
||||||
|
|||||||
@@ -5,7 +5,9 @@
|
|||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
#include "util/xor_fast_hash_storage.hpp"
|
#include "util/xor_fast_hash_storage.hpp"
|
||||||
|
|
||||||
namespace osrm::contractor
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace contractor
|
||||||
{
|
{
|
||||||
struct ContractorHeapData
|
struct ContractorHeapData
|
||||||
{
|
{
|
||||||
@@ -22,6 +24,7 @@ using ContractorHeap = util::QueryHeap<NodeID,
|
|||||||
ContractorHeapData,
|
ContractorHeapData,
|
||||||
util::XORFastHashStorage<NodeID, NodeID>>;
|
util::XORFastHashStorage<NodeID, NodeID>>;
|
||||||
|
|
||||||
} // namespace osrm::contractor
|
} // namespace contractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_CONTRACTOR_CONTRACTOR_HEAP_HPP_
|
#endif // OSRM_CONTRACTOR_CONTRACTOR_HEAP_HPP_
|
||||||
|
|||||||
@@ -8,7 +8,9 @@
|
|||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
namespace osrm::contractor
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace contractor
|
||||||
{
|
{
|
||||||
|
|
||||||
void search(ContractorHeap &heap,
|
void search(ContractorHeap &heap,
|
||||||
@@ -18,6 +20,7 @@ void search(ContractorHeap &heap,
|
|||||||
const EdgeWeight weight_limit,
|
const EdgeWeight weight_limit,
|
||||||
const NodeID forbidden_node);
|
const NodeID forbidden_node);
|
||||||
|
|
||||||
} // namespace osrm::contractor
|
} // namespace contractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_CONTRACTOR_DIJKSTRA_HPP
|
#endif // OSRM_CONTRACTOR_DIJKSTRA_HPP
|
||||||
|
|||||||
@@ -9,7 +9,9 @@
|
|||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
namespace osrm::contractor
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace contractor
|
||||||
{
|
{
|
||||||
|
|
||||||
class IteratorbasedCRC32
|
class IteratorbasedCRC32
|
||||||
@@ -123,6 +125,7 @@ struct RangebasedCRC32
|
|||||||
private:
|
private:
|
||||||
IteratorbasedCRC32 crc32;
|
IteratorbasedCRC32 crc32;
|
||||||
};
|
};
|
||||||
} // namespace osrm::contractor
|
} // namespace contractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif /* ITERATOR_BASED_CRC32_H */
|
#endif /* ITERATOR_BASED_CRC32_H */
|
||||||
|
|||||||
@@ -5,7 +5,11 @@
|
|||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace osrm::contractor::files
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace contractor
|
||||||
|
{
|
||||||
|
namespace files
|
||||||
{
|
{
|
||||||
// reads .osrm.hsgr file
|
// reads .osrm.hsgr file
|
||||||
template <typename ContractedMetricT>
|
template <typename ContractedMetricT>
|
||||||
@@ -48,6 +52,8 @@ inline void writeGraph(const boost::filesystem::path &path,
|
|||||||
serialization::write(writer, "/ch/metrics/" + pair.first, pair.second);
|
serialization::write(writer, "/ch/metrics/" + pair.first, pair.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace osrm::contractor::files
|
} // namespace files
|
||||||
|
} // namespace contractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,7 +8,9 @@
|
|||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm::contractor
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace contractor
|
||||||
{
|
{
|
||||||
|
|
||||||
std::vector<bool> contractGraph(ContractorGraph &graph,
|
std::vector<bool> contractGraph(ContractorGraph &graph,
|
||||||
@@ -35,6 +37,7 @@ inline auto contractGraph(ContractorGraph &graph,
|
|||||||
graph, {}, std::move(node_is_contractable), std::move(node_weights), core_factor);
|
graph, {}, std::move(node_is_contractable), std::move(node_weights), core_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace osrm::contractor
|
} // namespace contractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_CONTRACTOR_GRAPH_CONTRACTOR_HPP
|
#endif // OSRM_CONTRACTOR_GRAPH_CONTRACTOR_HPP
|
||||||
|
|||||||
@@ -10,7 +10,9 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm::contractor
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace contractor
|
||||||
{
|
{
|
||||||
|
|
||||||
// Make sure to move in the input edge list!
|
// Make sure to move in the input edge list!
|
||||||
@@ -27,20 +29,18 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
|
|||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
const unsigned int constexpr DAY_IN_DECI_SECONDS = 24 * 60 * 60 * 10;
|
const unsigned int constexpr DAY_IN_DECI_SECONDS = 24 * 60 * 60 * 10;
|
||||||
if (from_alias<unsigned int>(std::max(input_edge.data.weight, EdgeWeight{1})) >
|
if (static_cast<unsigned int>(std::max(input_edge.data.weight, 1)) > DAY_IN_DECI_SECONDS)
|
||||||
DAY_IN_DECI_SECONDS)
|
|
||||||
{
|
{
|
||||||
util::Log(logWARNING) << "Edge weight large -> "
|
util::Log(logWARNING) << "Edge weight large -> "
|
||||||
<< from_alias<unsigned int>(
|
<< static_cast<unsigned int>(std::max(input_edge.data.weight, 1))
|
||||||
std::max(input_edge.data.weight, EdgeWeight{1}))
|
|
||||||
<< " : " << static_cast<unsigned int>(input_edge.source) << " -> "
|
<< " : " << static_cast<unsigned int>(input_edge.source) << " -> "
|
||||||
<< static_cast<unsigned int>(input_edge.target);
|
<< static_cast<unsigned int>(input_edge.target);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
edges.emplace_back(input_edge.source,
|
edges.emplace_back(input_edge.source,
|
||||||
input_edge.target,
|
input_edge.target,
|
||||||
std::max(input_edge.data.weight, {1}),
|
std::max(input_edge.data.weight, 1),
|
||||||
to_alias<EdgeDuration>(input_edge.data.duration),
|
input_edge.data.duration,
|
||||||
input_edge.data.distance,
|
input_edge.data.distance,
|
||||||
1,
|
1,
|
||||||
input_edge.data.turn_id,
|
input_edge.data.turn_id,
|
||||||
@@ -50,8 +50,8 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
|
|||||||
|
|
||||||
edges.emplace_back(input_edge.target,
|
edges.emplace_back(input_edge.target,
|
||||||
input_edge.source,
|
input_edge.source,
|
||||||
std::max(input_edge.data.weight, {1}),
|
std::max(input_edge.data.weight, 1),
|
||||||
to_alias<EdgeDuration>(input_edge.data.duration),
|
input_edge.data.duration,
|
||||||
input_edge.data.distance,
|
input_edge.data.distance,
|
||||||
1,
|
1,
|
||||||
input_edge.data.turn_id,
|
input_edge.data.turn_id,
|
||||||
@@ -109,7 +109,7 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
|
|||||||
// merge edges (s,t) and (t,s) into bidirectional edge
|
// merge edges (s,t) and (t,s) into bidirectional edge
|
||||||
if (forward_edge.data.weight == reverse_edge.data.weight)
|
if (forward_edge.data.weight == reverse_edge.data.weight)
|
||||||
{
|
{
|
||||||
if (forward_edge.data.weight != INVALID_EDGE_WEIGHT)
|
if ((int)forward_edge.data.weight != INVALID_EDGE_WEIGHT)
|
||||||
{
|
{
|
||||||
forward_edge.data.backward = true;
|
forward_edge.data.backward = true;
|
||||||
edges[edge++] = forward_edge;
|
edges[edge++] = forward_edge;
|
||||||
@@ -117,11 +117,11 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // insert seperate edges
|
{ // insert seperate edges
|
||||||
if (forward_edge.data.weight != INVALID_EDGE_WEIGHT)
|
if (((int)forward_edge.data.weight) != INVALID_EDGE_WEIGHT)
|
||||||
{
|
{
|
||||||
edges[edge++] = forward_edge;
|
edges[edge++] = forward_edge;
|
||||||
}
|
}
|
||||||
if (reverse_edge.data.weight != INVALID_EDGE_WEIGHT)
|
if ((int)reverse_edge.data.weight != INVALID_EDGE_WEIGHT)
|
||||||
{
|
{
|
||||||
edges[edge++] = reverse_edge;
|
edges[edge++] = reverse_edge;
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ template <class Edge, typename GraphT> inline std::vector<Edge> toEdges(GraphT g
|
|||||||
new_edge.target = target;
|
new_edge.target = target;
|
||||||
BOOST_ASSERT_MSG(SPECIAL_NODEID != new_edge.target, "Target id invalid");
|
BOOST_ASSERT_MSG(SPECIAL_NODEID != new_edge.target, "Target id invalid");
|
||||||
new_edge.data.weight = data.weight;
|
new_edge.data.weight = data.weight;
|
||||||
new_edge.data.duration = from_alias<EdgeDuration::value_type>(data.duration);
|
new_edge.data.duration = data.duration;
|
||||||
new_edge.data.distance = data.distance;
|
new_edge.data.distance = data.distance;
|
||||||
new_edge.data.shortcut = data.shortcut;
|
new_edge.data.shortcut = data.shortcut;
|
||||||
new_edge.data.turn_id = data.id;
|
new_edge.data.turn_id = data.id;
|
||||||
@@ -175,6 +175,7 @@ template <class Edge, typename GraphT> inline std::vector<Edge> toEdges(GraphT g
|
|||||||
return edges;
|
return edges;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace osrm::contractor
|
} // namespace contractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_CONTRACTOR_GRAPH_CONTRACTION_ADAPTORS_HPP_
|
#endif // OSRM_CONTRACTOR_GRAPH_CONTRACTION_ADAPTORS_HPP_
|
||||||
|
|||||||
@@ -5,7 +5,9 @@
|
|||||||
|
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
namespace osrm::contractor
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace contractor
|
||||||
{
|
{
|
||||||
|
|
||||||
struct QueryEdge
|
struct QueryEdge
|
||||||
@@ -15,15 +17,15 @@ struct QueryEdge
|
|||||||
struct EdgeData
|
struct EdgeData
|
||||||
{
|
{
|
||||||
explicit EdgeData()
|
explicit EdgeData()
|
||||||
: turn_id(0), shortcut(false), weight{0}, duration(0), forward(false),
|
: turn_id(0), shortcut(false), weight(0), duration(0), forward(false), backward(false),
|
||||||
backward(false), distance{0}
|
distance(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeData(const NodeID turn_id,
|
EdgeData(const NodeID turn_id,
|
||||||
const bool shortcut,
|
const bool shortcut,
|
||||||
const EdgeWeight weight,
|
const EdgeWeight weight,
|
||||||
const EdgeDuration duration,
|
const EdgeWeight duration,
|
||||||
const EdgeDistance distance,
|
const EdgeDistance distance,
|
||||||
const bool forward,
|
const bool forward,
|
||||||
const bool backward)
|
const bool backward)
|
||||||
@@ -48,7 +50,7 @@ struct QueryEdge
|
|||||||
NodeID turn_id : 31;
|
NodeID turn_id : 31;
|
||||||
bool shortcut : 1;
|
bool shortcut : 1;
|
||||||
EdgeWeight weight;
|
EdgeWeight weight;
|
||||||
EdgeDuration::value_type duration : 30;
|
EdgeWeight duration : 30;
|
||||||
std::uint32_t forward : 1;
|
std::uint32_t forward : 1;
|
||||||
std::uint32_t backward : 1;
|
std::uint32_t backward : 1;
|
||||||
EdgeDistance distance;
|
EdgeDistance distance;
|
||||||
@@ -75,6 +77,7 @@ struct QueryEdge
|
|||||||
data.distance == right.data.distance);
|
data.distance == right.data.distance);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace osrm::contractor
|
} // namespace contractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // QUERYEDGE_HPP
|
#endif // QUERYEDGE_HPP
|
||||||
|
|||||||
@@ -6,7 +6,9 @@
|
|||||||
#include "util/static_graph.hpp"
|
#include "util/static_graph.hpp"
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
|
|
||||||
namespace osrm::contractor
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace contractor
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
@@ -17,6 +19,7 @@ using QueryGraph = util::StaticGraph<typename QueryEdge::EdgeData, Ownership>;
|
|||||||
|
|
||||||
using QueryGraph = detail::QueryGraph<storage::Ownership::Container>;
|
using QueryGraph = detail::QueryGraph<storage::Ownership::Container>;
|
||||||
using QueryGraphView = detail::QueryGraph<storage::Ownership::View>;
|
using QueryGraphView = detail::QueryGraph<storage::Ownership::View>;
|
||||||
} // namespace osrm::contractor
|
} // namespace contractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // QUERYEDGE_HPP
|
#endif // QUERYEDGE_HPP
|
||||||
|
|||||||
@@ -8,7 +8,11 @@
|
|||||||
#include "storage/serialization.hpp"
|
#include "storage/serialization.hpp"
|
||||||
#include "storage/tar.hpp"
|
#include "storage/tar.hpp"
|
||||||
|
|
||||||
namespace osrm::contractor::serialization
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace contractor
|
||||||
|
{
|
||||||
|
namespace serialization
|
||||||
{
|
{
|
||||||
|
|
||||||
template <storage::Ownership Ownership>
|
template <storage::Ownership Ownership>
|
||||||
@@ -42,6 +46,8 @@ void read(storage::tar::FileReader &reader,
|
|||||||
metric.edge_filter[index]);
|
metric.edge_filter[index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace osrm::contractor::serialization
|
} // namespace serialization
|
||||||
|
} // namespace contractor
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,7 +10,9 @@
|
|||||||
|
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
namespace osrm::customizer
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace customizer
|
||||||
{
|
{
|
||||||
|
|
||||||
class CellCustomizer
|
class CellCustomizer
|
||||||
@@ -59,7 +61,7 @@ class CellCustomizer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
heap.Clear();
|
heap.Clear();
|
||||||
heap.Insert(source, {0}, {false, {0}, {0}});
|
heap.Insert(source, 0, {false, 0, 0});
|
||||||
|
|
||||||
// explore search space
|
// explore search space
|
||||||
while (!heap.Empty() && !destinations_set.empty())
|
while (!heap.Empty() && !destinations_set.empty())
|
||||||
@@ -122,8 +124,7 @@ class CellCustomizer
|
|||||||
for (std::size_t level = 1; level < partition.GetNumberOfLevels(); ++level)
|
for (std::size_t level = 1; level < partition.GetNumberOfLevels(); ++level)
|
||||||
{
|
{
|
||||||
tbb::parallel_for(tbb::blocked_range<std::size_t>(0, partition.GetNumberOfCells(level)),
|
tbb::parallel_for(tbb::blocked_range<std::size_t>(0, partition.GetNumberOfCells(level)),
|
||||||
[&](const tbb::blocked_range<std::size_t> &range)
|
[&](const tbb::blocked_range<std::size_t> &range) {
|
||||||
{
|
|
||||||
auto &heap = heaps.local();
|
auto &heap = heaps.local();
|
||||||
for (auto id = range.begin(), end = range.end(); id != end; ++id)
|
for (auto id = range.begin(), end = range.end(); id != end; ++id)
|
||||||
{
|
{
|
||||||
@@ -215,11 +216,12 @@ class CellCustomizer
|
|||||||
partition.GetCell(level - 1, to)))
|
partition.GetCell(level - 1, to)))
|
||||||
{
|
{
|
||||||
const EdgeWeight to_weight = weight + data.weight;
|
const EdgeWeight to_weight = weight + data.weight;
|
||||||
const EdgeDuration to_duration = duration + to_alias<EdgeDuration>(data.duration);
|
const EdgeDuration to_duration = duration + data.duration;
|
||||||
const EdgeDistance to_distance = distance + data.distance;
|
const EdgeDistance to_distance = distance + data.distance;
|
||||||
if (!heap.WasInserted(to))
|
if (!heap.WasInserted(to))
|
||||||
{
|
{
|
||||||
heap.Insert(to, to_weight, {false, to_duration, to_distance});
|
heap.Insert(
|
||||||
|
to, to_weight, {false, duration + data.duration, distance + data.distance});
|
||||||
}
|
}
|
||||||
else if (std::tie(to_weight, to_duration, to_distance) <
|
else if (std::tie(to_weight, to_duration, to_distance) <
|
||||||
std::tie(
|
std::tie(
|
||||||
@@ -234,6 +236,7 @@ class CellCustomizer
|
|||||||
|
|
||||||
const partitioner::MultiLevelPartition &partition;
|
const partitioner::MultiLevelPartition &partition;
|
||||||
};
|
};
|
||||||
} // namespace osrm::customizer
|
} // namespace customizer
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_CELLS_CUSTOMIZER_HPP
|
#endif // OSRM_CELLS_CUSTOMIZER_HPP
|
||||||
|
|||||||
@@ -7,7 +7,9 @@
|
|||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
#include "util/vector_view.hpp"
|
#include "util/vector_view.hpp"
|
||||||
|
|
||||||
namespace osrm::customizer
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace customizer
|
||||||
{
|
{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
@@ -24,6 +26,7 @@ template <storage::Ownership Ownership> struct CellMetricImpl
|
|||||||
|
|
||||||
using CellMetric = detail::CellMetricImpl<storage::Ownership::Container>;
|
using CellMetric = detail::CellMetricImpl<storage::Ownership::Container>;
|
||||||
using CellMetricView = detail::CellMetricImpl<storage::Ownership::View>;
|
using CellMetricView = detail::CellMetricImpl<storage::Ownership::View>;
|
||||||
} // namespace osrm::customizer
|
} // namespace customizer
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
#include "customizer/customizer_config.hpp"
|
#include "customizer/customizer_config.hpp"
|
||||||
|
|
||||||
namespace osrm::customizer
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace customizer
|
||||||
{
|
{
|
||||||
|
|
||||||
class Customizer
|
class Customizer
|
||||||
@@ -12,6 +14,7 @@ class Customizer
|
|||||||
int Run(const CustomizationConfig &config);
|
int Run(const CustomizationConfig &config);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace osrm::customizer
|
} // namespace customizer
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_CUSTOMIZE_CUSTOMIZER_HPP
|
#endif // OSRM_CUSTOMIZE_CUSTOMIZER_HPP
|
||||||
|
|||||||
@@ -9,7 +9,9 @@
|
|||||||
#include "storage/io_config.hpp"
|
#include "storage/io_config.hpp"
|
||||||
#include "updater/updater_config.hpp"
|
#include "updater/updater_config.hpp"
|
||||||
|
|
||||||
namespace osrm::customizer
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace customizer
|
||||||
{
|
{
|
||||||
|
|
||||||
struct CustomizationConfig final : storage::IOConfig
|
struct CustomizationConfig final : storage::IOConfig
|
||||||
@@ -37,6 +39,7 @@ struct CustomizationConfig final : storage::IOConfig
|
|||||||
|
|
||||||
updater::UpdaterConfig updater_config;
|
updater::UpdaterConfig updater_config;
|
||||||
};
|
};
|
||||||
} // namespace osrm::customizer
|
} // namespace customizer
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP
|
#endif // OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP
|
||||||
|
|||||||
@@ -11,7 +11,9 @@
|
|||||||
|
|
||||||
#include <boost/filesystem/path.hpp>
|
#include <boost/filesystem/path.hpp>
|
||||||
|
|
||||||
namespace osrm::customizer
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace customizer
|
||||||
{
|
{
|
||||||
|
|
||||||
struct EdgeBasedGraphEdgeData
|
struct EdgeBasedGraphEdgeData
|
||||||
@@ -95,7 +97,7 @@ class MultiLevelGraph : public partitioner::MultiLevelGraph<EdgeDataT, Ownership
|
|||||||
|
|
||||||
EdgeWeight GetNodeWeight(NodeID node) const { return node_weights[node]; }
|
EdgeWeight GetNodeWeight(NodeID node) const { return node_weights[node]; }
|
||||||
|
|
||||||
EdgeDuration GetNodeDuration(NodeID node) const { return node_durations[node]; }
|
EdgeWeight GetNodeDuration(NodeID node) const { return node_durations[node]; }
|
||||||
|
|
||||||
EdgeDistance GetNodeDistance(NodeID node) const { return node_distances[node]; }
|
EdgeDistance GetNodeDistance(NodeID node) const { return node_distances[node]; }
|
||||||
|
|
||||||
@@ -124,6 +126,7 @@ using MultiLevelEdgeBasedGraph =
|
|||||||
MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::Container>;
|
MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::Container>;
|
||||||
using MultiLevelEdgeBasedGraphView =
|
using MultiLevelEdgeBasedGraphView =
|
||||||
MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::View>;
|
MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::View>;
|
||||||
} // namespace osrm::customizer
|
} // namespace customizer
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,7 +9,11 @@
|
|||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace osrm::customizer::files
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace customizer
|
||||||
|
{
|
||||||
|
namespace files
|
||||||
{
|
{
|
||||||
|
|
||||||
// reads .osrm.cell_metrics file
|
// reads .osrm.cell_metrics file
|
||||||
@@ -102,6 +106,8 @@ inline void writeGraph(const boost::filesystem::path &path,
|
|||||||
writer.WriteFrom("/mld/connectivity_checksum", connectivity_checksum);
|
writer.WriteFrom("/mld/connectivity_checksum", connectivity_checksum);
|
||||||
serialization::write(writer, "/mld/multilevelgraph", graph);
|
serialization::write(writer, "/mld/multilevelgraph", graph);
|
||||||
}
|
}
|
||||||
} // namespace osrm::customizer::files
|
} // namespace files
|
||||||
|
} // namespace customizer
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,7 +9,11 @@
|
|||||||
#include "storage/shared_memory_ownership.hpp"
|
#include "storage/shared_memory_ownership.hpp"
|
||||||
#include "storage/tar.hpp"
|
#include "storage/tar.hpp"
|
||||||
|
|
||||||
namespace osrm::customizer::serialization
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace customizer
|
||||||
|
{
|
||||||
|
namespace serialization
|
||||||
{
|
{
|
||||||
|
|
||||||
template <storage::Ownership Ownership>
|
template <storage::Ownership Ownership>
|
||||||
@@ -61,6 +65,8 @@ inline void write(storage::tar::FileWriter &writer,
|
|||||||
storage::serialization::write(writer, name + "/is_backward_edge", graph.is_backward_edge);
|
storage::serialization::write(writer, name + "/is_backward_edge", graph.is_backward_edge);
|
||||||
storage::serialization::write(writer, name + "/node_to_edge_offset", graph.node_to_edge_offset);
|
storage::serialization::write(writer, name + "/node_to_edge_offset", graph.node_to_edge_offset);
|
||||||
}
|
}
|
||||||
} // namespace osrm::customizer::serialization
|
} // namespace serialization
|
||||||
|
} // namespace customizer
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,7 +3,11 @@
|
|||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace osrm::engine::routing_algorithms
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace routing_algorithms
|
||||||
{
|
{
|
||||||
|
|
||||||
// Contraction Hiearchy
|
// Contraction Hiearchy
|
||||||
@@ -107,6 +111,8 @@ template <> struct HasGetTileTurns<mld::Algorithm> final : std::true_type
|
|||||||
template <> struct HasExcludeFlags<mld::Algorithm> final : std::true_type
|
template <> struct HasExcludeFlags<mld::Algorithm> final : std::true_type
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
} // namespace osrm::engine::routing_algorithms
|
} // namespace routing_algorithms
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -18,7 +18,11 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm::engine::api
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace api
|
||||||
{
|
{
|
||||||
|
|
||||||
static const constexpr char *INTERSECTION_DELIMITER = " / ";
|
static const constexpr char *INTERSECTION_DELIMITER = " / ";
|
||||||
@@ -40,10 +44,10 @@ class BaseAPI
|
|||||||
util::json::Array waypoints;
|
util::json::Array waypoints;
|
||||||
waypoints.values.resize(parameters.coordinates.size());
|
waypoints.values.resize(parameters.coordinates.size());
|
||||||
|
|
||||||
boost::range::transform(waypoint_candidates,
|
boost::range::transform(
|
||||||
waypoints.values.begin(),
|
waypoint_candidates,
|
||||||
[this](const PhantomNodeCandidates &candidates)
|
waypoints.values.begin(),
|
||||||
{ return MakeWaypoint(candidates); });
|
[this](const PhantomNodeCandidates &candidates) { return MakeWaypoint(candidates); });
|
||||||
return waypoints;
|
return waypoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,8 +57,8 @@ class BaseAPI
|
|||||||
{
|
{
|
||||||
// TODO: check forward/reverse
|
// TODO: check forward/reverse
|
||||||
const auto toName = [this](const auto &phantom) {
|
const auto toName = [this](const auto &phantom) {
|
||||||
return std::string(
|
return facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id))
|
||||||
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)));
|
.to_string();
|
||||||
};
|
};
|
||||||
const auto noEmpty = [](const auto &name) { return !name.empty(); };
|
const auto noEmpty = [](const auto &name) { return !name.empty(); };
|
||||||
|
|
||||||
@@ -104,8 +108,9 @@ class BaseAPI
|
|||||||
std::transform(waypoint_candidates.begin(),
|
std::transform(waypoint_candidates.begin(),
|
||||||
waypoint_candidates.end(),
|
waypoint_candidates.end(),
|
||||||
waypoints.begin(),
|
waypoints.begin(),
|
||||||
[this, builder](const PhantomNodeCandidates &candidates)
|
[this, builder](const PhantomNodeCandidates &candidates) {
|
||||||
{ return MakeWaypoint(builder, candidates)->Finish(); });
|
return MakeWaypoint(builder, candidates)->Finish();
|
||||||
|
});
|
||||||
return builder->CreateVector(waypoints);
|
return builder->CreateVector(waypoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,8 +128,8 @@ class BaseAPI
|
|||||||
static_cast<float>(static_cast<double>(util::toFloating(snapped_location.lat))));
|
static_cast<float>(static_cast<double>(util::toFloating(snapped_location.lat))));
|
||||||
|
|
||||||
const auto toName = [this](const auto &phantom) {
|
const auto toName = [this](const auto &phantom) {
|
||||||
return std::string(
|
return facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id))
|
||||||
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)));
|
.to_string();
|
||||||
};
|
};
|
||||||
const auto noEmpty = [](const auto &name) { return !name.empty(); };
|
const auto noEmpty = [](const auto &name) { return !name.empty(); };
|
||||||
|
|
||||||
@@ -165,6 +170,8 @@ class BaseAPI
|
|||||||
const BaseParameters ¶meters;
|
const BaseParameters ¶meters;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace osrm::engine::api
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -38,7 +38,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm::engine::api
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace api
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,8 +56,7 @@ namespace osrm::engine::api
|
|||||||
* optional per coordinate
|
* optional per coordinate
|
||||||
* - bearings: limits the search for segments in the road network to given bearing(s) in degree
|
* - bearings: limits the search for segments in the road network to given bearing(s) in degree
|
||||||
* towards true north in clockwise direction, optional per coordinate
|
* towards true north in clockwise direction, optional per coordinate
|
||||||
* - approaches: force the phantom node to start towards the node with the road country side or
|
* - approaches: force the phantom node to start towards the node with the road country side.
|
||||||
* its opposite
|
|
||||||
*
|
*
|
||||||
* \see OSRM, Coordinate, Hint, Bearing, RouteParameters, TableParameters,
|
* \see OSRM, Coordinate, Hint, Bearing, RouteParameters, TableParameters,
|
||||||
* NearestParameters, TripParameters, MatchParameters and TileParameters
|
* NearestParameters, TripParameters, MatchParameters and TileParameters
|
||||||
@@ -112,8 +115,7 @@ struct BaseParameters
|
|||||||
(approaches.empty() || approaches.size() == coordinates.size()) &&
|
(approaches.empty() || approaches.size() == coordinates.size()) &&
|
||||||
std::all_of(bearings.begin(),
|
std::all_of(bearings.begin(),
|
||||||
bearings.end(),
|
bearings.end(),
|
||||||
[](const boost::optional<Bearing> &bearing_and_range)
|
[](const boost::optional<Bearing> &bearing_and_range) {
|
||||||
{
|
|
||||||
if (bearing_and_range)
|
if (bearing_and_range)
|
||||||
{
|
{
|
||||||
return bearing_and_range->IsValid();
|
return bearing_and_range->IsValid();
|
||||||
@@ -122,6 +124,8 @@ struct BaseParameters
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace osrm::engine::api
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // ROUTE_PARAMETERS_HPP
|
#endif // ROUTE_PARAMETERS_HPP
|
||||||
|
|||||||
@@ -8,10 +8,16 @@
|
|||||||
|
|
||||||
#include "util/json_container.hpp"
|
#include "util/json_container.hpp"
|
||||||
|
|
||||||
namespace osrm::engine::api
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace api
|
||||||
{
|
{
|
||||||
using ResultT =
|
using ResultT =
|
||||||
mapbox::util::variant<util::json::Object, std::string, flatbuffers::FlatBufferBuilder>;
|
mapbox::util::variant<util::json::Object, std::string, flatbuffers::FlatBufferBuilder>;
|
||||||
} // namespace osrm::engine::api
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,7 +6,10 @@
|
|||||||
|
|
||||||
#include "flatbuffers/flatbuffers.h"
|
#include "flatbuffers/flatbuffers.h"
|
||||||
|
|
||||||
namespace osrm::engine::api::fbresult {
|
namespace osrm {
|
||||||
|
namespace engine {
|
||||||
|
namespace api {
|
||||||
|
namespace fbresult {
|
||||||
|
|
||||||
struct Position;
|
struct Position;
|
||||||
|
|
||||||
@@ -216,7 +219,7 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Uint64Pair FLATBUFFERS_FINAL_CLASS {
|
|||||||
FLATBUFFERS_STRUCT_END(Uint64Pair, 16);
|
FLATBUFFERS_STRUCT_END(Uint64Pair, 16);
|
||||||
|
|
||||||
struct WaypointT : public flatbuffers::NativeTable {
|
struct WaypointT : public flatbuffers::NativeTable {
|
||||||
using TableType = Waypoint;
|
typedef Waypoint TableType;
|
||||||
std::string hint;
|
std::string hint;
|
||||||
float distance;
|
float distance;
|
||||||
std::string name;
|
std::string name;
|
||||||
@@ -236,7 +239,7 @@ struct WaypointT : public flatbuffers::NativeTable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Waypoint FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
struct Waypoint FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
using NativeTableType = WaypointT;
|
typedef WaypointT NativeTableType;
|
||||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||||
VT_HINT = 4,
|
VT_HINT = 4,
|
||||||
VT_DISTANCE = 6,
|
VT_DISTANCE = 6,
|
||||||
@@ -390,14 +393,14 @@ inline flatbuffers::Offset<Waypoint> CreateWaypointDirect(
|
|||||||
flatbuffers::Offset<Waypoint> CreateWaypoint(flatbuffers::FlatBufferBuilder &_fbb, const WaypointT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
flatbuffers::Offset<Waypoint> CreateWaypoint(flatbuffers::FlatBufferBuilder &_fbb, const WaypointT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
|
||||||
struct MetadataT : public flatbuffers::NativeTable {
|
struct MetadataT : public flatbuffers::NativeTable {
|
||||||
using TableType = Metadata;
|
typedef Metadata TableType;
|
||||||
std::vector<std::string> datasource_names;
|
std::vector<std::string> datasource_names;
|
||||||
MetadataT() {
|
MetadataT() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Metadata FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
struct Metadata FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
using NativeTableType = MetadataT;
|
typedef MetadataT NativeTableType;
|
||||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||||
VT_DATASOURCE_NAMES = 4
|
VT_DATASOURCE_NAMES = 4
|
||||||
};
|
};
|
||||||
@@ -454,7 +457,7 @@ inline flatbuffers::Offset<Metadata> CreateMetadataDirect(
|
|||||||
flatbuffers::Offset<Metadata> CreateMetadata(flatbuffers::FlatBufferBuilder &_fbb, const MetadataT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
flatbuffers::Offset<Metadata> CreateMetadata(flatbuffers::FlatBufferBuilder &_fbb, const MetadataT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
|
||||||
struct AnnotationT : public flatbuffers::NativeTable {
|
struct AnnotationT : public flatbuffers::NativeTable {
|
||||||
using TableType = Annotation;
|
typedef Annotation TableType;
|
||||||
std::vector<uint32_t> distance;
|
std::vector<uint32_t> distance;
|
||||||
std::vector<uint32_t> duration;
|
std::vector<uint32_t> duration;
|
||||||
std::vector<uint32_t> datasources;
|
std::vector<uint32_t> datasources;
|
||||||
@@ -467,7 +470,7 @@ struct AnnotationT : public flatbuffers::NativeTable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Annotation FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
struct Annotation FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
using NativeTableType = AnnotationT;
|
typedef AnnotationT NativeTableType;
|
||||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||||
VT_DISTANCE = 4,
|
VT_DISTANCE = 4,
|
||||||
VT_DURATION = 6,
|
VT_DURATION = 6,
|
||||||
@@ -606,7 +609,7 @@ inline flatbuffers::Offset<Annotation> CreateAnnotationDirect(
|
|||||||
flatbuffers::Offset<Annotation> CreateAnnotation(flatbuffers::FlatBufferBuilder &_fbb, const AnnotationT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
flatbuffers::Offset<Annotation> CreateAnnotation(flatbuffers::FlatBufferBuilder &_fbb, const AnnotationT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
|
||||||
struct StepManeuverT : public flatbuffers::NativeTable {
|
struct StepManeuverT : public flatbuffers::NativeTable {
|
||||||
using TableType = StepManeuver;
|
typedef StepManeuver TableType;
|
||||||
std::unique_ptr<osrm::engine::api::fbresult::Position> location;
|
std::unique_ptr<osrm::engine::api::fbresult::Position> location;
|
||||||
uint16_t bearing_before;
|
uint16_t bearing_before;
|
||||||
uint16_t bearing_after;
|
uint16_t bearing_after;
|
||||||
@@ -623,7 +626,7 @@ struct StepManeuverT : public flatbuffers::NativeTable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct StepManeuver FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
struct StepManeuver FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
using NativeTableType = StepManeuverT;
|
typedef StepManeuverT NativeTableType;
|
||||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||||
VT_LOCATION = 4,
|
VT_LOCATION = 4,
|
||||||
VT_BEARING_BEFORE = 6,
|
VT_BEARING_BEFORE = 6,
|
||||||
@@ -719,7 +722,7 @@ inline flatbuffers::Offset<StepManeuver> CreateStepManeuver(
|
|||||||
flatbuffers::Offset<StepManeuver> CreateStepManeuver(flatbuffers::FlatBufferBuilder &_fbb, const StepManeuverT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
flatbuffers::Offset<StepManeuver> CreateStepManeuver(flatbuffers::FlatBufferBuilder &_fbb, const StepManeuverT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
|
||||||
struct LaneT : public flatbuffers::NativeTable {
|
struct LaneT : public flatbuffers::NativeTable {
|
||||||
using TableType = Lane;
|
typedef Lane TableType;
|
||||||
std::vector<osrm::engine::api::fbresult::Turn> indications;
|
std::vector<osrm::engine::api::fbresult::Turn> indications;
|
||||||
bool valid;
|
bool valid;
|
||||||
LaneT()
|
LaneT()
|
||||||
@@ -728,7 +731,7 @@ struct LaneT : public flatbuffers::NativeTable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Lane FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
struct Lane FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
using NativeTableType = LaneT;
|
typedef LaneT NativeTableType;
|
||||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||||
VT_INDICATIONS = 4,
|
VT_INDICATIONS = 4,
|
||||||
VT_VALID = 6
|
VT_VALID = 6
|
||||||
@@ -796,7 +799,7 @@ inline flatbuffers::Offset<Lane> CreateLaneDirect(
|
|||||||
flatbuffers::Offset<Lane> CreateLane(flatbuffers::FlatBufferBuilder &_fbb, const LaneT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
flatbuffers::Offset<Lane> CreateLane(flatbuffers::FlatBufferBuilder &_fbb, const LaneT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
|
||||||
struct IntersectionT : public flatbuffers::NativeTable {
|
struct IntersectionT : public flatbuffers::NativeTable {
|
||||||
using TableType = Intersection;
|
typedef Intersection TableType;
|
||||||
std::unique_ptr<osrm::engine::api::fbresult::Position> location;
|
std::unique_ptr<osrm::engine::api::fbresult::Position> location;
|
||||||
std::vector<int16_t> bearings;
|
std::vector<int16_t> bearings;
|
||||||
std::vector<std::string> classes;
|
std::vector<std::string> classes;
|
||||||
@@ -811,7 +814,7 @@ struct IntersectionT : public flatbuffers::NativeTable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Intersection FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
struct Intersection FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
using NativeTableType = IntersectionT;
|
typedef IntersectionT NativeTableType;
|
||||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||||
VT_LOCATION = 4,
|
VT_LOCATION = 4,
|
||||||
VT_BEARINGS = 6,
|
VT_BEARINGS = 6,
|
||||||
@@ -947,7 +950,7 @@ inline flatbuffers::Offset<Intersection> CreateIntersectionDirect(
|
|||||||
flatbuffers::Offset<Intersection> CreateIntersection(flatbuffers::FlatBufferBuilder &_fbb, const IntersectionT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
flatbuffers::Offset<Intersection> CreateIntersection(flatbuffers::FlatBufferBuilder &_fbb, const IntersectionT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
|
||||||
struct StepT : public flatbuffers::NativeTable {
|
struct StepT : public flatbuffers::NativeTable {
|
||||||
using TableType = Step;
|
typedef Step TableType;
|
||||||
float distance;
|
float distance;
|
||||||
float duration;
|
float duration;
|
||||||
std::string polyline;
|
std::string polyline;
|
||||||
@@ -973,7 +976,7 @@ struct StepT : public flatbuffers::NativeTable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Step FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
struct Step FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
using NativeTableType = StepT;
|
typedef StepT NativeTableType;
|
||||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||||
VT_DISTANCE = 4,
|
VT_DISTANCE = 4,
|
||||||
VT_DURATION = 6,
|
VT_DURATION = 6,
|
||||||
@@ -1231,7 +1234,7 @@ inline flatbuffers::Offset<Step> CreateStepDirect(
|
|||||||
flatbuffers::Offset<Step> CreateStep(flatbuffers::FlatBufferBuilder &_fbb, const StepT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
flatbuffers::Offset<Step> CreateStep(flatbuffers::FlatBufferBuilder &_fbb, const StepT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
|
||||||
struct LegT : public flatbuffers::NativeTable {
|
struct LegT : public flatbuffers::NativeTable {
|
||||||
using TableType = Leg;
|
typedef Leg TableType;
|
||||||
double distance;
|
double distance;
|
||||||
double duration;
|
double duration;
|
||||||
double weight;
|
double weight;
|
||||||
@@ -1246,7 +1249,7 @@ struct LegT : public flatbuffers::NativeTable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Leg FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
struct Leg FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
using NativeTableType = LegT;
|
typedef LegT NativeTableType;
|
||||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||||
VT_DISTANCE = 4,
|
VT_DISTANCE = 4,
|
||||||
VT_DURATION = 6,
|
VT_DURATION = 6,
|
||||||
@@ -1366,7 +1369,7 @@ inline flatbuffers::Offset<Leg> CreateLegDirect(
|
|||||||
flatbuffers::Offset<Leg> CreateLeg(flatbuffers::FlatBufferBuilder &_fbb, const LegT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
flatbuffers::Offset<Leg> CreateLeg(flatbuffers::FlatBufferBuilder &_fbb, const LegT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
|
||||||
struct RouteObjectT : public flatbuffers::NativeTable {
|
struct RouteObjectT : public flatbuffers::NativeTable {
|
||||||
using TableType = RouteObject;
|
typedef RouteObject TableType;
|
||||||
float distance;
|
float distance;
|
||||||
float duration;
|
float duration;
|
||||||
float weight;
|
float weight;
|
||||||
@@ -1384,7 +1387,7 @@ struct RouteObjectT : public flatbuffers::NativeTable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct RouteObject FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
struct RouteObject FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
using NativeTableType = RouteObjectT;
|
typedef RouteObjectT NativeTableType;
|
||||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||||
VT_DISTANCE = 4,
|
VT_DISTANCE = 4,
|
||||||
VT_DURATION = 6,
|
VT_DURATION = 6,
|
||||||
@@ -1531,7 +1534,7 @@ inline flatbuffers::Offset<RouteObject> CreateRouteObjectDirect(
|
|||||||
flatbuffers::Offset<RouteObject> CreateRouteObject(flatbuffers::FlatBufferBuilder &_fbb, const RouteObjectT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
flatbuffers::Offset<RouteObject> CreateRouteObject(flatbuffers::FlatBufferBuilder &_fbb, const RouteObjectT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
|
||||||
struct TableT : public flatbuffers::NativeTable {
|
struct TableT : public flatbuffers::NativeTable {
|
||||||
using TableType = Table;
|
typedef Table TableType;
|
||||||
std::vector<float> durations;
|
std::vector<float> durations;
|
||||||
uint16_t rows;
|
uint16_t rows;
|
||||||
uint16_t cols;
|
uint16_t cols;
|
||||||
@@ -1545,7 +1548,7 @@ struct TableT : public flatbuffers::NativeTable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Table FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
struct Table FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
using NativeTableType = TableT;
|
typedef TableT NativeTableType;
|
||||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||||
VT_DURATIONS = 4,
|
VT_DURATIONS = 4,
|
||||||
VT_ROWS = 6,
|
VT_ROWS = 6,
|
||||||
@@ -1668,7 +1671,7 @@ inline flatbuffers::Offset<Table> CreateTableDirect(
|
|||||||
flatbuffers::Offset<Table> CreateTable(flatbuffers::FlatBufferBuilder &_fbb, const TableT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
flatbuffers::Offset<Table> CreateTable(flatbuffers::FlatBufferBuilder &_fbb, const TableT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
|
||||||
struct ErrorT : public flatbuffers::NativeTable {
|
struct ErrorT : public flatbuffers::NativeTable {
|
||||||
using TableType = Error;
|
typedef Error TableType;
|
||||||
std::string code;
|
std::string code;
|
||||||
std::string message;
|
std::string message;
|
||||||
ErrorT() {
|
ErrorT() {
|
||||||
@@ -1676,7 +1679,7 @@ struct ErrorT : public flatbuffers::NativeTable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Error FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
struct Error FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
using NativeTableType = ErrorT;
|
typedef ErrorT NativeTableType;
|
||||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||||
VT_CODE = 4,
|
VT_CODE = 4,
|
||||||
VT_MESSAGE = 6
|
VT_MESSAGE = 6
|
||||||
@@ -1746,7 +1749,7 @@ inline flatbuffers::Offset<Error> CreateErrorDirect(
|
|||||||
flatbuffers::Offset<Error> CreateError(flatbuffers::FlatBufferBuilder &_fbb, const ErrorT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
flatbuffers::Offset<Error> CreateError(flatbuffers::FlatBufferBuilder &_fbb, const ErrorT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
|
||||||
struct FBResultT : public flatbuffers::NativeTable {
|
struct FBResultT : public flatbuffers::NativeTable {
|
||||||
using TableType = FBResult;
|
typedef FBResult TableType;
|
||||||
bool error;
|
bool error;
|
||||||
std::unique_ptr<osrm::engine::api::fbresult::ErrorT> code;
|
std::unique_ptr<osrm::engine::api::fbresult::ErrorT> code;
|
||||||
std::string data_version;
|
std::string data_version;
|
||||||
@@ -1759,7 +1762,7 @@ struct FBResultT : public flatbuffers::NativeTable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct FBResult FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
struct FBResult FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
using NativeTableType = FBResultT;
|
typedef FBResultT NativeTableType;
|
||||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||||
VT_ERROR = 4,
|
VT_ERROR = 4,
|
||||||
VT_CODE = 6,
|
VT_CODE = 6,
|
||||||
@@ -2428,6 +2431,9 @@ inline std::unique_ptr<osrm::engine::api::fbresult::FBResultT> UnPackSizePrefixe
|
|||||||
return std::unique_ptr<osrm::engine::api::fbresult::FBResultT>(GetSizePrefixedFBResult(buf)->UnPack(res));
|
return std::unique_ptr<osrm::engine::api::fbresult::FBResultT>(GetSizePrefixedFBResult(buf)->UnPack(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace fbresult
|
||||||
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // FLATBUFFERS_GENERATED_FBRESULT_OSRM_ENGINE_API_FBRESULT_H_
|
#endif // FLATBUFFERS_GENERATED_FBRESULT_OSRM_ENGINE_API_FBRESULT_H_
|
||||||
|
|||||||
@@ -19,12 +19,16 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm::engine
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
{
|
{
|
||||||
|
|
||||||
struct Hint;
|
struct Hint;
|
||||||
|
|
||||||
namespace api::json
|
namespace api
|
||||||
|
{
|
||||||
|
namespace json
|
||||||
{
|
{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
@@ -108,7 +112,9 @@ util::json::Object makeRouteLeg(guidance::RouteLeg leg, util::json::Array steps)
|
|||||||
util::json::Array makeRouteLegs(std::vector<guidance::RouteLeg> legs,
|
util::json::Array makeRouteLegs(std::vector<guidance::RouteLeg> legs,
|
||||||
std::vector<util::json::Value> step_geometries,
|
std::vector<util::json::Value> step_geometries,
|
||||||
std::vector<util::json::Object> annotations);
|
std::vector<util::json::Object> annotations);
|
||||||
} // namespace api::json
|
} // namespace json
|
||||||
} // namespace osrm::engine
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // ENGINE_GUIDANCE_API_RESPONSE_GENERATOR_HPP_
|
#endif // ENGINE_GUIDANCE_API_RESPONSE_GENERATOR_HPP_
|
||||||
|
|||||||
@@ -12,7 +12,11 @@
|
|||||||
|
|
||||||
#include "util/integer_range.hpp"
|
#include "util/integer_range.hpp"
|
||||||
|
|
||||||
namespace osrm::engine::api
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace api
|
||||||
{
|
{
|
||||||
|
|
||||||
class MatchAPI final : public RouteAPI
|
class MatchAPI final : public RouteAPI
|
||||||
@@ -52,10 +56,9 @@ class MatchAPI final : public RouteAPI
|
|||||||
data_version_string = fb_result.CreateString(data_timestamp);
|
data_version_string = fb_result.CreateString(data_timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto response = MakeFBResponse(sub_routes,
|
auto response = MakeFBResponse(sub_routes, fb_result, [this, &fb_result, &sub_matchings]() {
|
||||||
fb_result,
|
return MakeTracepoints(fb_result, sub_matchings);
|
||||||
[this, &fb_result, &sub_matchings]()
|
});
|
||||||
{ return MakeTracepoints(fb_result, sub_matchings); });
|
|
||||||
|
|
||||||
if (!data_timestamp.empty())
|
if (!data_timestamp.empty())
|
||||||
{
|
{
|
||||||
@@ -250,6 +253,8 @@ class MatchAPI final : public RouteAPI
|
|||||||
const tidy::Result &tidy_result;
|
const tidy::Result &tidy_result;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace osrm::engine::api
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -32,7 +32,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm::engine::api
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace api
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,7 +71,7 @@ struct MatchParameters : public RouteParameters
|
|||||||
MatchParameters(const std::vector<unsigned> ×tamps_,
|
MatchParameters(const std::vector<unsigned> ×tamps_,
|
||||||
GapsType gaps_,
|
GapsType gaps_,
|
||||||
bool tidy_,
|
bool tidy_,
|
||||||
Args &&...args_)
|
Args &&... args_)
|
||||||
: MatchParameters(timestamps_, gaps_, tidy_, {}, std::forward<Args>(args_)...)
|
: MatchParameters(timestamps_, gaps_, tidy_, {}, std::forward<Args>(args_)...)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -77,7 +81,7 @@ struct MatchParameters : public RouteParameters
|
|||||||
GapsType gaps_,
|
GapsType gaps_,
|
||||||
bool tidy_,
|
bool tidy_,
|
||||||
const std::vector<std::size_t> &waypoints_,
|
const std::vector<std::size_t> &waypoints_,
|
||||||
Args &&...args_)
|
Args &&... args_)
|
||||||
: RouteParameters{std::forward<Args>(args_)..., waypoints_}, timestamps{std::move(
|
: RouteParameters{std::forward<Args>(args_)..., waypoints_}, timestamps{std::move(
|
||||||
timestamps_)},
|
timestamps_)},
|
||||||
gaps(gaps_), tidy(tidy_)
|
gaps(gaps_), tidy(tidy_)
|
||||||
@@ -94,6 +98,8 @@ struct MatchParameters : public RouteParameters
|
|||||||
(timestamps.empty() || timestamps.size() == coordinates.size());
|
(timestamps.empty() || timestamps.size() == coordinates.size());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace osrm::engine::api
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -11,7 +11,13 @@
|
|||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/dynamic_bitset.hpp>
|
#include <boost/dynamic_bitset.hpp>
|
||||||
|
|
||||||
namespace osrm::engine::api::tidy
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace api
|
||||||
|
{
|
||||||
|
namespace tidy
|
||||||
{
|
{
|
||||||
|
|
||||||
struct Thresholds
|
struct Thresholds
|
||||||
@@ -194,6 +200,9 @@ inline Result tidy(const MatchParameters ¶ms, Thresholds cfg = {15., 5})
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace osrm::engine::api::tidy
|
} // namespace tidy
|
||||||
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -12,7 +12,11 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm::engine::api
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace api
|
||||||
{
|
{
|
||||||
|
|
||||||
class NearestAPI final : public BaseAPI
|
class NearestAPI final : public BaseAPI
|
||||||
@@ -57,20 +61,20 @@ class NearestAPI final : public BaseAPI
|
|||||||
{
|
{
|
||||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||||
waypoints.resize(phantom_nodes.front().size());
|
waypoints.resize(phantom_nodes.front().size());
|
||||||
std::transform(phantom_nodes.front().begin(),
|
std::transform(
|
||||||
phantom_nodes.front().end(),
|
phantom_nodes.front().begin(),
|
||||||
waypoints.begin(),
|
phantom_nodes.front().end(),
|
||||||
[this, &fb_result](const PhantomNodeWithDistance &phantom_with_distance)
|
waypoints.begin(),
|
||||||
{
|
[this, &fb_result](const PhantomNodeWithDistance &phantom_with_distance) {
|
||||||
auto &phantom_node = phantom_with_distance.phantom_node;
|
auto &phantom_node = phantom_with_distance.phantom_node;
|
||||||
|
|
||||||
auto node_values = MakeNodes(phantom_node);
|
auto node_values = MakeNodes(phantom_node);
|
||||||
fbresult::Uint64Pair nodes{node_values.first, node_values.second};
|
fbresult::Uint64Pair nodes{node_values.first, node_values.second};
|
||||||
|
|
||||||
auto waypoint = MakeWaypoint(&fb_result, {phantom_node});
|
auto waypoint = MakeWaypoint(&fb_result, {phantom_node});
|
||||||
waypoint->add_nodes(&nodes);
|
waypoint->add_nodes(&nodes);
|
||||||
return waypoint->Finish();
|
return waypoint->Finish();
|
||||||
});
|
});
|
||||||
|
|
||||||
waypoints_vector = fb_result.CreateVector(waypoints);
|
waypoints_vector = fb_result.CreateVector(waypoints);
|
||||||
}
|
}
|
||||||
@@ -94,8 +98,7 @@ class NearestAPI final : public BaseAPI
|
|||||||
std::transform(phantom_nodes.front().begin(),
|
std::transform(phantom_nodes.front().begin(),
|
||||||
phantom_nodes.front().end(),
|
phantom_nodes.front().end(),
|
||||||
waypoints.values.begin(),
|
waypoints.values.begin(),
|
||||||
[this](const PhantomNodeWithDistance &phantom_with_distance)
|
[this](const PhantomNodeWithDistance &phantom_with_distance) {
|
||||||
{
|
|
||||||
auto &phantom_node = phantom_with_distance.phantom_node;
|
auto &phantom_node = phantom_with_distance.phantom_node;
|
||||||
auto waypoint = MakeWaypoint({phantom_node});
|
auto waypoint = MakeWaypoint({phantom_node});
|
||||||
|
|
||||||
@@ -161,6 +164,8 @@ class NearestAPI final : public BaseAPI
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace osrm::engine::api
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -30,7 +30,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include "engine/api/base_parameters.hpp"
|
#include "engine/api/base_parameters.hpp"
|
||||||
|
|
||||||
namespace osrm::engine::api
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace api
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,6 +52,8 @@ struct NearestParameters : public BaseParameters
|
|||||||
|
|
||||||
bool IsValid() const { return BaseParameters::IsValid() && number_of_results >= 1; }
|
bool IsValid() const { return BaseParameters::IsValid() && number_of_results >= 1; }
|
||||||
};
|
};
|
||||||
} // namespace osrm::engine::api
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // ENGINE_API_NEAREST_PARAMETERS_HPP
|
#endif // ENGINE_API_NEAREST_PARAMETERS_HPP
|
||||||
|
|||||||
@@ -31,7 +31,11 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm::engine::api
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace api
|
||||||
{
|
{
|
||||||
|
|
||||||
class RouteAPI : public BaseAPI
|
class RouteAPI : public BaseAPI
|
||||||
@@ -77,10 +81,9 @@ class RouteAPI : public BaseAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto response =
|
auto response =
|
||||||
MakeFBResponse(raw_routes,
|
MakeFBResponse(raw_routes, fb_result, [this, &waypoint_candidates, &fb_result]() {
|
||||||
fb_result,
|
return BaseAPI::MakeWaypoints(&fb_result, waypoint_candidates);
|
||||||
[this, &waypoint_candidates, &fb_result]()
|
});
|
||||||
{ return BaseAPI::MakeWaypoints(&fb_result, waypoint_candidates); });
|
|
||||||
|
|
||||||
if (!data_timestamp.empty())
|
if (!data_timestamp.empty())
|
||||||
{
|
{
|
||||||
@@ -172,15 +175,10 @@ class RouteAPI : public BaseAPI
|
|||||||
}
|
}
|
||||||
std::vector<fbresult::Position> coordinates;
|
std::vector<fbresult::Position> coordinates;
|
||||||
coordinates.resize(std::distance(begin, end));
|
coordinates.resize(std::distance(begin, end));
|
||||||
std::transform(begin,
|
std::transform(begin, end, coordinates.begin(), [](const Coordinate &c) {
|
||||||
end,
|
return fbresult::Position{static_cast<float>(util::toFloating(c.lon).__value),
|
||||||
coordinates.begin(),
|
static_cast<float>(util::toFloating(c.lat).__value)};
|
||||||
[](const Coordinate &c)
|
});
|
||||||
{
|
|
||||||
return fbresult::Position{
|
|
||||||
static_cast<float>(util::toFloating(c.lon).__value),
|
|
||||||
static_cast<float>(util::toFloating(c.lat).__value)};
|
|
||||||
});
|
|
||||||
return builder.CreateVectorOfStructs(coordinates);
|
return builder.CreateVectorOfStructs(coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,8 +358,9 @@ class RouteAPI : public BaseAPI
|
|||||||
std::transform(leg.steps.begin(),
|
std::transform(leg.steps.begin(),
|
||||||
leg.steps.end(),
|
leg.steps.end(),
|
||||||
legSteps.begin(),
|
legSteps.begin(),
|
||||||
[this, &fb_result, &leg_geometry](auto &step)
|
[this, &fb_result, &leg_geometry](auto &step) {
|
||||||
{ return this->MakeFBStep(fb_result, leg_geometry, step); });
|
return this->MakeFBStep(fb_result, leg_geometry, step);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
auto steps_vector = fb_result.CreateVector(legSteps);
|
auto steps_vector = fb_result.CreateVector(legSteps);
|
||||||
|
|
||||||
@@ -440,14 +439,13 @@ class RouteAPI : public BaseAPI
|
|||||||
{
|
{
|
||||||
// AnnotationsType uses bit flags, & operator checks if a property is set
|
// AnnotationsType uses bit flags, & operator checks if a property is set
|
||||||
flatbuffers::Offset<flatbuffers::Vector<float>> speed;
|
flatbuffers::Offset<flatbuffers::Vector<float>> speed;
|
||||||
if (requested_annotations & RouteParameters::AnnotationsType::Speed)
|
if (parameters.annotations_type & RouteParameters::AnnotationsType::Speed)
|
||||||
{
|
{
|
||||||
double prev_speed = 0;
|
double prev_speed = 0;
|
||||||
speed =
|
speed =
|
||||||
GetAnnotations<float>(fb_result,
|
GetAnnotations<float>(fb_result,
|
||||||
leg_geometry,
|
leg_geometry,
|
||||||
[&prev_speed](const guidance::LegGeometry::Annotation &anno)
|
[&prev_speed](const guidance::LegGeometry::Annotation &anno) {
|
||||||
{
|
|
||||||
if (anno.duration < std::numeric_limits<float>::min())
|
if (anno.duration < std::numeric_limits<float>::min())
|
||||||
{
|
{
|
||||||
return prev_speed;
|
return prev_speed;
|
||||||
@@ -465,37 +463,37 @@ class RouteAPI : public BaseAPI
|
|||||||
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> duration;
|
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> duration;
|
||||||
if (requested_annotations & RouteParameters::AnnotationsType::Duration)
|
if (requested_annotations & RouteParameters::AnnotationsType::Duration)
|
||||||
{
|
{
|
||||||
duration = GetAnnotations<uint32_t>(fb_result,
|
duration = GetAnnotations<uint32_t>(
|
||||||
leg_geometry,
|
fb_result, leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||||
[](const guidance::LegGeometry::Annotation &anno)
|
return anno.duration;
|
||||||
{ return anno.duration; });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> distance;
|
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> distance;
|
||||||
if (requested_annotations & RouteParameters::AnnotationsType::Distance)
|
if (requested_annotations & RouteParameters::AnnotationsType::Distance)
|
||||||
{
|
{
|
||||||
distance = GetAnnotations<uint32_t>(fb_result,
|
distance = GetAnnotations<uint32_t>(
|
||||||
leg_geometry,
|
fb_result, leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||||
[](const guidance::LegGeometry::Annotation &anno)
|
return anno.distance;
|
||||||
{ return anno.distance; });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> weight;
|
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> weight;
|
||||||
if (requested_annotations & RouteParameters::AnnotationsType::Weight)
|
if (requested_annotations & RouteParameters::AnnotationsType::Weight)
|
||||||
{
|
{
|
||||||
weight = GetAnnotations<uint32_t>(fb_result,
|
weight = GetAnnotations<uint32_t>(
|
||||||
leg_geometry,
|
fb_result, leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||||
[](const guidance::LegGeometry::Annotation &anno)
|
return anno.weight;
|
||||||
{ return anno.weight; });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> datasources;
|
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> datasources;
|
||||||
if (requested_annotations & RouteParameters::AnnotationsType::Datasources)
|
if (requested_annotations & RouteParameters::AnnotationsType::Datasources)
|
||||||
{
|
{
|
||||||
datasources = GetAnnotations<uint32_t>(fb_result,
|
datasources = GetAnnotations<uint32_t>(
|
||||||
leg_geometry,
|
fb_result, leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||||
[](const guidance::LegGeometry::Annotation &anno)
|
return anno.datasource;
|
||||||
{ return anno.datasource; });
|
});
|
||||||
}
|
}
|
||||||
std::vector<uint32_t> nodes;
|
std::vector<uint32_t> nodes;
|
||||||
if (requested_annotations & RouteParameters::AnnotationsType::Nodes)
|
if (requested_annotations & RouteParameters::AnnotationsType::Nodes)
|
||||||
@@ -659,8 +657,7 @@ class RouteAPI : public BaseAPI
|
|||||||
step.intersections.begin(),
|
step.intersections.begin(),
|
||||||
step.intersections.end(),
|
step.intersections.end(),
|
||||||
intersections.begin(),
|
intersections.begin(),
|
||||||
[&fb_result, this](const guidance::IntermediateIntersection &intersection)
|
[&fb_result, this](const guidance::IntermediateIntersection &intersection) {
|
||||||
{
|
|
||||||
std::vector<flatbuffers::Offset<fbresult::Lane>> lanes;
|
std::vector<flatbuffers::Offset<fbresult::Lane>> lanes;
|
||||||
if (json::detail::hasValidLanes(intersection))
|
if (json::detail::hasValidLanes(intersection))
|
||||||
{
|
{
|
||||||
@@ -688,11 +685,11 @@ class RouteAPI : public BaseAPI
|
|||||||
auto bearings_vector = fb_result.CreateVector(intersection.bearings);
|
auto bearings_vector = fb_result.CreateVector(intersection.bearings);
|
||||||
std::vector<flatbuffers::Offset<flatbuffers::String>> classes;
|
std::vector<flatbuffers::Offset<flatbuffers::String>> classes;
|
||||||
classes.resize(intersection.classes.size());
|
classes.resize(intersection.classes.size());
|
||||||
std::transform(intersection.classes.begin(),
|
std::transform(
|
||||||
intersection.classes.end(),
|
intersection.classes.begin(),
|
||||||
classes.begin(),
|
intersection.classes.end(),
|
||||||
[&fb_result](const std::string &cls)
|
classes.begin(),
|
||||||
{ return fb_result.CreateString(cls); });
|
[&fb_result](const std::string &cls) { return fb_result.CreateString(cls); });
|
||||||
auto classes_vector = fb_result.CreateVector(classes);
|
auto classes_vector = fb_result.CreateVector(classes);
|
||||||
auto entry_vector = fb_result.CreateVector(intersection.entry);
|
auto entry_vector = fb_result.CreateVector(intersection.entry);
|
||||||
|
|
||||||
@@ -727,10 +724,9 @@ class RouteAPI : public BaseAPI
|
|||||||
|
|
||||||
std::vector<util::json::Value> step_geometries;
|
std::vector<util::json::Value> step_geometries;
|
||||||
const auto total_step_count =
|
const auto total_step_count =
|
||||||
std::accumulate(legs.begin(),
|
std::accumulate(legs.begin(), legs.end(), 0, [](const auto &v, const auto &leg) {
|
||||||
legs.end(),
|
return v + leg.steps.size();
|
||||||
0,
|
});
|
||||||
[](const auto &v, const auto &leg) { return v + leg.steps.size(); });
|
|
||||||
step_geometries.reserve(total_step_count);
|
step_geometries.reserve(total_step_count);
|
||||||
|
|
||||||
for (const auto idx : util::irange<std::size_t>(0UL, legs.size()))
|
for (const auto idx : util::irange<std::size_t>(0UL, legs.size()))
|
||||||
@@ -741,8 +737,7 @@ class RouteAPI : public BaseAPI
|
|||||||
legs[idx].steps.begin(),
|
legs[idx].steps.begin(),
|
||||||
legs[idx].steps.end(),
|
legs[idx].steps.end(),
|
||||||
std::back_inserter(step_geometries),
|
std::back_inserter(step_geometries),
|
||||||
[this, &leg_geometry](const guidance::RouteStep &step)
|
[this, &leg_geometry](const guidance::RouteStep &step) {
|
||||||
{
|
|
||||||
if (parameters.geometries == RouteParameters::GeometriesType::Polyline)
|
if (parameters.geometries == RouteParameters::GeometriesType::Polyline)
|
||||||
{
|
{
|
||||||
return static_cast<util::json::Value>(json::makePolyline<100000>(
|
return static_cast<util::json::Value>(json::makePolyline<100000>(
|
||||||
@@ -783,13 +778,11 @@ class RouteAPI : public BaseAPI
|
|||||||
util::json::Object annotation;
|
util::json::Object annotation;
|
||||||
|
|
||||||
// AnnotationsType uses bit flags, & operator checks if a property is set
|
// AnnotationsType uses bit flags, & operator checks if a property is set
|
||||||
if (requested_annotations & RouteParameters::AnnotationsType::Speed)
|
if (parameters.annotations_type & RouteParameters::AnnotationsType::Speed)
|
||||||
{
|
{
|
||||||
double prev_speed = 0;
|
double prev_speed = 0;
|
||||||
annotation.values["speed"] = GetAnnotations(
|
annotation.values["speed"] = GetAnnotations(
|
||||||
leg_geometry,
|
leg_geometry, [&prev_speed](const guidance::LegGeometry::Annotation &anno) {
|
||||||
[&prev_speed](const guidance::LegGeometry::Annotation &anno)
|
|
||||||
{
|
|
||||||
if (anno.duration < std::numeric_limits<double>::min())
|
if (anno.duration < std::numeric_limits<double>::min())
|
||||||
{
|
{
|
||||||
return prev_speed;
|
return prev_speed;
|
||||||
@@ -805,17 +798,17 @@ class RouteAPI : public BaseAPI
|
|||||||
|
|
||||||
if (requested_annotations & RouteParameters::AnnotationsType::Duration)
|
if (requested_annotations & RouteParameters::AnnotationsType::Duration)
|
||||||
{
|
{
|
||||||
annotation.values["duration"] =
|
annotation.values["duration"] = GetAnnotations(
|
||||||
GetAnnotations(leg_geometry,
|
leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||||
[](const guidance::LegGeometry::Annotation &anno)
|
return anno.duration;
|
||||||
{ return anno.duration; });
|
});
|
||||||
}
|
}
|
||||||
if (requested_annotations & RouteParameters::AnnotationsType::Distance)
|
if (requested_annotations & RouteParameters::AnnotationsType::Distance)
|
||||||
{
|
{
|
||||||
annotation.values["distance"] =
|
annotation.values["distance"] = GetAnnotations(
|
||||||
GetAnnotations(leg_geometry,
|
leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||||
[](const guidance::LegGeometry::Annotation &anno)
|
return anno.distance;
|
||||||
{ return anno.distance; });
|
});
|
||||||
}
|
}
|
||||||
if (requested_annotations & RouteParameters::AnnotationsType::Weight)
|
if (requested_annotations & RouteParameters::AnnotationsType::Weight)
|
||||||
{
|
{
|
||||||
@@ -825,10 +818,10 @@ class RouteAPI : public BaseAPI
|
|||||||
}
|
}
|
||||||
if (requested_annotations & RouteParameters::AnnotationsType::Datasources)
|
if (requested_annotations & RouteParameters::AnnotationsType::Datasources)
|
||||||
{
|
{
|
||||||
annotation.values["datasources"] =
|
annotation.values["datasources"] = GetAnnotations(
|
||||||
GetAnnotations(leg_geometry,
|
leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||||
[](const guidance::LegGeometry::Annotation &anno)
|
return anno.datasource;
|
||||||
{ return anno.datasource; });
|
});
|
||||||
}
|
}
|
||||||
if (requested_annotations & RouteParameters::AnnotationsType::Nodes)
|
if (requested_annotations & RouteParameters::AnnotationsType::Nodes)
|
||||||
{
|
{
|
||||||
@@ -1008,6 +1001,8 @@ class RouteAPI : public BaseAPI
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace osrm::engine::api
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -32,7 +32,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm::engine::api
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace api
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,7 +87,7 @@ struct RouteParameters : public BaseParameters
|
|||||||
const GeometriesType geometries_,
|
const GeometriesType geometries_,
|
||||||
const OverviewType overview_,
|
const OverviewType overview_,
|
||||||
const boost::optional<bool> continue_straight_,
|
const boost::optional<bool> continue_straight_,
|
||||||
Args &&...args_)
|
Args &&... args_)
|
||||||
// Once we perfectly-forward `args` (see #2990) this constructor can delegate to the one
|
// Once we perfectly-forward `args` (see #2990) this constructor can delegate to the one
|
||||||
// below.
|
// below.
|
||||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||||
@@ -101,7 +105,7 @@ struct RouteParameters : public BaseParameters
|
|||||||
const GeometriesType geometries_,
|
const GeometriesType geometries_,
|
||||||
const OverviewType overview_,
|
const OverviewType overview_,
|
||||||
const boost::optional<bool> continue_straight_,
|
const boost::optional<bool> continue_straight_,
|
||||||
Args &&...args_)
|
Args &&... args_)
|
||||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||||
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_},
|
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_},
|
||||||
annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None},
|
annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None},
|
||||||
@@ -119,7 +123,7 @@ struct RouteParameters : public BaseParameters
|
|||||||
const GeometriesType geometries_,
|
const GeometriesType geometries_,
|
||||||
const OverviewType overview_,
|
const OverviewType overview_,
|
||||||
const boost::optional<bool> continue_straight_,
|
const boost::optional<bool> continue_straight_,
|
||||||
Args &&...args_)
|
Args &&... args_)
|
||||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||||
number_of_alternatives{alternatives_ ? 1u : 0u},
|
number_of_alternatives{alternatives_ ? 1u : 0u},
|
||||||
annotations{annotations_ != AnnotationsType::None}, annotations_type{annotations_},
|
annotations{annotations_ != AnnotationsType::None}, annotations_type{annotations_},
|
||||||
@@ -137,7 +141,7 @@ struct RouteParameters : public BaseParameters
|
|||||||
const OverviewType overview_,
|
const OverviewType overview_,
|
||||||
const boost::optional<bool> continue_straight_,
|
const boost::optional<bool> continue_straight_,
|
||||||
std::vector<std::size_t> waypoints_,
|
std::vector<std::size_t> waypoints_,
|
||||||
const Args &&...args_)
|
const Args &&... args_)
|
||||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||||
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_},
|
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_},
|
||||||
annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None},
|
annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None},
|
||||||
@@ -155,7 +159,7 @@ struct RouteParameters : public BaseParameters
|
|||||||
const OverviewType overview_,
|
const OverviewType overview_,
|
||||||
const boost::optional<bool> continue_straight_,
|
const boost::optional<bool> continue_straight_,
|
||||||
std::vector<std::size_t> waypoints_,
|
std::vector<std::size_t> waypoints_,
|
||||||
Args &&...args_)
|
Args &&... args_)
|
||||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||||
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_ !=
|
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_ !=
|
||||||
AnnotationsType::None},
|
AnnotationsType::None},
|
||||||
@@ -180,9 +184,9 @@ struct RouteParameters : public BaseParameters
|
|||||||
const auto coordinates_ok = coordinates.size() >= 2;
|
const auto coordinates_ok = coordinates.size() >= 2;
|
||||||
const auto base_params_ok = BaseParameters::IsValid();
|
const auto base_params_ok = BaseParameters::IsValid();
|
||||||
const auto valid_waypoints =
|
const auto valid_waypoints =
|
||||||
std::all_of(waypoints.begin(),
|
std::all_of(waypoints.begin(), waypoints.end(), [this](const auto &w) {
|
||||||
waypoints.end(),
|
return w < coordinates.size();
|
||||||
[this](const auto &w) { return w < coordinates.size(); });
|
});
|
||||||
return coordinates_ok && base_params_ok && valid_waypoints;
|
return coordinates_ok && base_params_ok && valid_waypoints;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -202,11 +206,13 @@ inline RouteParameters::AnnotationsType operator|(RouteParameters::AnnotationsTy
|
|||||||
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(rhs));
|
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(rhs));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline RouteParameters::AnnotationsType &operator|=(RouteParameters::AnnotationsType &lhs,
|
inline RouteParameters::AnnotationsType operator|=(RouteParameters::AnnotationsType lhs,
|
||||||
RouteParameters::AnnotationsType rhs)
|
RouteParameters::AnnotationsType rhs)
|
||||||
{
|
{
|
||||||
return lhs = lhs | rhs;
|
return lhs = lhs | rhs;
|
||||||
}
|
}
|
||||||
} // namespace osrm::engine::api
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -22,7 +22,11 @@
|
|||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
namespace osrm::engine::api
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace api
|
||||||
{
|
{
|
||||||
|
|
||||||
class TableAPI final : public BaseAPI
|
class TableAPI final : public BaseAPI
|
||||||
@@ -129,8 +133,7 @@ class TableAPI final : public BaseAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool have_speed_cells =
|
bool have_speed_cells =
|
||||||
parameters.fallback_speed != from_alias<double>(INVALID_FALLBACK_SPEED) &&
|
parameters.fallback_speed != INVALID_FALLBACK_SPEED && parameters.fallback_speed > 0;
|
||||||
parameters.fallback_speed > 0;
|
|
||||||
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> speed_cells;
|
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> speed_cells;
|
||||||
if (have_speed_cells)
|
if (have_speed_cells)
|
||||||
{
|
{
|
||||||
@@ -220,8 +223,7 @@ class TableAPI final : public BaseAPI
|
|||||||
MakeDistanceTable(tables.second, number_of_sources, number_of_destinations);
|
MakeDistanceTable(tables.second, number_of_sources, number_of_destinations);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameters.fallback_speed != from_alias<double>(INVALID_FALLBACK_SPEED) &&
|
if (parameters.fallback_speed != INVALID_FALLBACK_SPEED && parameters.fallback_speed > 0)
|
||||||
parameters.fallback_speed > 0)
|
|
||||||
{
|
{
|
||||||
response.values["fallback_speed_cells"] = MakeEstimatesTable(fallback_speed_cells);
|
response.values["fallback_speed_cells"] = MakeEstimatesTable(fallback_speed_cells);
|
||||||
}
|
}
|
||||||
@@ -245,8 +247,9 @@ class TableAPI final : public BaseAPI
|
|||||||
|
|
||||||
boost::range::transform(candidates,
|
boost::range::transform(candidates,
|
||||||
std::back_inserter(waypoints),
|
std::back_inserter(waypoints),
|
||||||
[this, &builder](const PhantomNodeCandidates &candidates)
|
[this, &builder](const PhantomNodeCandidates &candidates) {
|
||||||
{ return BaseAPI::MakeWaypoint(&builder, candidates)->Finish(); });
|
return BaseAPI::MakeWaypoint(&builder, candidates)->Finish();
|
||||||
|
});
|
||||||
return builder.CreateVector(waypoints);
|
return builder.CreateVector(waypoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,8 +263,7 @@ class TableAPI final : public BaseAPI
|
|||||||
boost::range::transform(
|
boost::range::transform(
|
||||||
indices,
|
indices,
|
||||||
std::back_inserter(waypoints),
|
std::back_inserter(waypoints),
|
||||||
[this, &builder, &candidates](const std::size_t idx)
|
[this, &builder, &candidates](const std::size_t idx) {
|
||||||
{
|
|
||||||
BOOST_ASSERT(idx < candidates.size());
|
BOOST_ASSERT(idx < candidates.size());
|
||||||
return BaseAPI::MakeWaypoint(&builder, candidates[idx])->Finish();
|
return BaseAPI::MakeWaypoint(&builder, candidates[idx])->Finish();
|
||||||
});
|
});
|
||||||
@@ -270,21 +272,18 @@ class TableAPI final : public BaseAPI
|
|||||||
|
|
||||||
virtual flatbuffers::Offset<flatbuffers::Vector<float>>
|
virtual flatbuffers::Offset<flatbuffers::Vector<float>>
|
||||||
MakeDurationTable(flatbuffers::FlatBufferBuilder &builder,
|
MakeDurationTable(flatbuffers::FlatBufferBuilder &builder,
|
||||||
const std::vector<EdgeDuration> &values) const
|
const std::vector<EdgeWeight> &values) const
|
||||||
{
|
{
|
||||||
std::vector<float> distance_table;
|
std::vector<float> distance_table;
|
||||||
distance_table.resize(values.size());
|
distance_table.resize(values.size());
|
||||||
std::transform(values.begin(),
|
std::transform(
|
||||||
values.end(),
|
values.begin(), values.end(), distance_table.begin(), [](const EdgeWeight duration) {
|
||||||
distance_table.begin(),
|
if (duration == MAXIMAL_EDGE_DURATION)
|
||||||
[](const EdgeDuration duration)
|
{
|
||||||
{
|
return 0.;
|
||||||
if (duration == MAXIMAL_EDGE_DURATION)
|
}
|
||||||
{
|
return duration / 10.;
|
||||||
return 0.;
|
});
|
||||||
}
|
|
||||||
return from_alias<double>(duration) / 10.;
|
|
||||||
});
|
|
||||||
return builder.CreateVector(distance_table);
|
return builder.CreateVector(distance_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,17 +293,14 @@ class TableAPI final : public BaseAPI
|
|||||||
{
|
{
|
||||||
std::vector<float> duration_table;
|
std::vector<float> duration_table;
|
||||||
duration_table.resize(values.size());
|
duration_table.resize(values.size());
|
||||||
std::transform(values.begin(),
|
std::transform(
|
||||||
values.end(),
|
values.begin(), values.end(), duration_table.begin(), [](const EdgeDistance distance) {
|
||||||
duration_table.begin(),
|
if (distance == INVALID_EDGE_DISTANCE)
|
||||||
[](const EdgeDistance distance)
|
{
|
||||||
{
|
return 0.;
|
||||||
if (distance == INVALID_EDGE_DISTANCE)
|
}
|
||||||
{
|
return std::round(distance * 10) / 10.;
|
||||||
return 0.;
|
});
|
||||||
}
|
|
||||||
return std::round(from_alias<double>(distance) * 10) / 10.;
|
|
||||||
});
|
|
||||||
return builder.CreateVector(duration_table);
|
return builder.CreateVector(duration_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,13 +310,11 @@ class TableAPI final : public BaseAPI
|
|||||||
{
|
{
|
||||||
std::vector<uint32_t> fb_table;
|
std::vector<uint32_t> fb_table;
|
||||||
fb_table.reserve(fallback_speed_cells.size());
|
fb_table.reserve(fallback_speed_cells.size());
|
||||||
std::for_each(fallback_speed_cells.begin(),
|
std::for_each(
|
||||||
fallback_speed_cells.end(),
|
fallback_speed_cells.begin(), fallback_speed_cells.end(), [&](const auto &cell) {
|
||||||
[&](const auto &cell)
|
fb_table.push_back(cell.row);
|
||||||
{
|
fb_table.push_back(cell.column);
|
||||||
fb_table.push_back(cell.row);
|
});
|
||||||
fb_table.push_back(cell.column);
|
|
||||||
});
|
|
||||||
return builder.CreateVector(fb_table);
|
return builder.CreateVector(fb_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,8 +327,9 @@ class TableAPI final : public BaseAPI
|
|||||||
|
|
||||||
boost::range::transform(candidates,
|
boost::range::transform(candidates,
|
||||||
std::back_inserter(json_waypoints.values),
|
std::back_inserter(json_waypoints.values),
|
||||||
[this](const PhantomNodeCandidates &candidates)
|
[this](const PhantomNodeCandidates &candidates) {
|
||||||
{ return BaseAPI::MakeWaypoint(candidates); });
|
return BaseAPI::MakeWaypoint(candidates);
|
||||||
|
});
|
||||||
return json_waypoints;
|
return json_waypoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,15 +340,14 @@ class TableAPI final : public BaseAPI
|
|||||||
json_waypoints.values.reserve(indices.size());
|
json_waypoints.values.reserve(indices.size());
|
||||||
boost::range::transform(indices,
|
boost::range::transform(indices,
|
||||||
std::back_inserter(json_waypoints.values),
|
std::back_inserter(json_waypoints.values),
|
||||||
[this, &candidates](const std::size_t idx)
|
[this, &candidates](const std::size_t idx) {
|
||||||
{
|
|
||||||
BOOST_ASSERT(idx < candidates.size());
|
BOOST_ASSERT(idx < candidates.size());
|
||||||
return BaseAPI::MakeWaypoint(candidates[idx]);
|
return BaseAPI::MakeWaypoint(candidates[idx]);
|
||||||
});
|
});
|
||||||
return json_waypoints;
|
return json_waypoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual util::json::Array MakeDurationTable(const std::vector<EdgeDuration> &values,
|
virtual util::json::Array MakeDurationTable(const std::vector<EdgeWeight> &values,
|
||||||
std::size_t number_of_rows,
|
std::size_t number_of_rows,
|
||||||
std::size_t number_of_columns) const
|
std::size_t number_of_columns) const
|
||||||
{
|
{
|
||||||
@@ -367,15 +361,13 @@ class TableAPI final : public BaseAPI
|
|||||||
std::transform(row_begin_iterator,
|
std::transform(row_begin_iterator,
|
||||||
row_end_iterator,
|
row_end_iterator,
|
||||||
json_row.values.begin(),
|
json_row.values.begin(),
|
||||||
[](const EdgeDuration duration)
|
[](const EdgeWeight duration) {
|
||||||
{
|
|
||||||
if (duration == MAXIMAL_EDGE_DURATION)
|
if (duration == MAXIMAL_EDGE_DURATION)
|
||||||
{
|
{
|
||||||
return util::json::Value(util::json::Null());
|
return util::json::Value(util::json::Null());
|
||||||
}
|
}
|
||||||
// division by 10 because the duration is in deciseconds (10s)
|
// division by 10 because the duration is in deciseconds (10s)
|
||||||
return util::json::Value(
|
return util::json::Value(util::json::Number(duration / 10.));
|
||||||
util::json::Number(from_alias<double>(duration) / 10.));
|
|
||||||
});
|
});
|
||||||
json_table.values.push_back(std::move(json_row));
|
json_table.values.push_back(std::move(json_row));
|
||||||
}
|
}
|
||||||
@@ -396,15 +388,14 @@ class TableAPI final : public BaseAPI
|
|||||||
std::transform(row_begin_iterator,
|
std::transform(row_begin_iterator,
|
||||||
row_end_iterator,
|
row_end_iterator,
|
||||||
json_row.values.begin(),
|
json_row.values.begin(),
|
||||||
[](const EdgeDistance distance)
|
[](const EdgeDistance distance) {
|
||||||
{
|
|
||||||
if (distance == INVALID_EDGE_DISTANCE)
|
if (distance == INVALID_EDGE_DISTANCE)
|
||||||
{
|
{
|
||||||
return util::json::Value(util::json::Null());
|
return util::json::Value(util::json::Null());
|
||||||
}
|
}
|
||||||
// round to single decimal place
|
// round to single decimal place
|
||||||
return util::json::Value(util::json::Number(
|
return util::json::Value(
|
||||||
std::round(from_alias<double>(distance) * 10) / 10.));
|
util::json::Number(std::round(distance * 10) / 10.));
|
||||||
});
|
});
|
||||||
json_table.values.push_back(std::move(json_row));
|
json_table.values.push_back(std::move(json_row));
|
||||||
}
|
}
|
||||||
@@ -415,21 +406,21 @@ class TableAPI final : public BaseAPI
|
|||||||
MakeEstimatesTable(const std::vector<TableCellRef> &fallback_speed_cells) const
|
MakeEstimatesTable(const std::vector<TableCellRef> &fallback_speed_cells) const
|
||||||
{
|
{
|
||||||
util::json::Array json_table;
|
util::json::Array json_table;
|
||||||
std::for_each(fallback_speed_cells.begin(),
|
std::for_each(
|
||||||
fallback_speed_cells.end(),
|
fallback_speed_cells.begin(), fallback_speed_cells.end(), [&](const auto &cell) {
|
||||||
[&](const auto &cell)
|
util::json::Array row;
|
||||||
{
|
row.values.push_back(util::json::Number(cell.row));
|
||||||
util::json::Array row;
|
row.values.push_back(util::json::Number(cell.column));
|
||||||
row.values.push_back(util::json::Number(cell.row));
|
json_table.values.push_back(std::move(row));
|
||||||
row.values.push_back(util::json::Number(cell.column));
|
});
|
||||||
json_table.values.push_back(std::move(row));
|
|
||||||
});
|
|
||||||
return json_table;
|
return json_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TableParameters ¶meters;
|
const TableParameters ¶meters;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace osrm::engine::api
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -36,7 +36,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm::engine::api
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace api
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +59,7 @@ struct TableParameters : public BaseParameters
|
|||||||
{
|
{
|
||||||
std::vector<std::size_t> sources;
|
std::vector<std::size_t> sources;
|
||||||
std::vector<std::size_t> destinations;
|
std::vector<std::size_t> destinations;
|
||||||
double fallback_speed = from_alias<double>(INVALID_FALLBACK_SPEED);
|
double fallback_speed = INVALID_FALLBACK_SPEED;
|
||||||
|
|
||||||
enum class FallbackCoordinateType
|
enum class FallbackCoordinateType
|
||||||
{
|
{
|
||||||
@@ -81,7 +85,7 @@ struct TableParameters : public BaseParameters
|
|||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
TableParameters(std::vector<std::size_t> sources_,
|
TableParameters(std::vector<std::size_t> sources_,
|
||||||
std::vector<std::size_t> destinations_,
|
std::vector<std::size_t> destinations_,
|
||||||
Args &&...args_)
|
Args &&... args_)
|
||||||
: BaseParameters{std::forward<Args>(args_)...}, sources{std::move(sources_)},
|
: BaseParameters{std::forward<Args>(args_)...}, sources{std::move(sources_)},
|
||||||
destinations{std::move(destinations_)}
|
destinations{std::move(destinations_)}
|
||||||
{
|
{
|
||||||
@@ -91,7 +95,7 @@ struct TableParameters : public BaseParameters
|
|||||||
TableParameters(std::vector<std::size_t> sources_,
|
TableParameters(std::vector<std::size_t> sources_,
|
||||||
std::vector<std::size_t> destinations_,
|
std::vector<std::size_t> destinations_,
|
||||||
const AnnotationsType annotations_,
|
const AnnotationsType annotations_,
|
||||||
Args &&...args_)
|
Args &&... args_)
|
||||||
: BaseParameters{std::forward<Args>(args_)...}, sources{std::move(sources_)},
|
: BaseParameters{std::forward<Args>(args_)...}, sources{std::move(sources_)},
|
||||||
destinations{std::move(destinations_)}, annotations{annotations_}
|
destinations{std::move(destinations_)}, annotations{annotations_}
|
||||||
{
|
{
|
||||||
@@ -104,7 +108,7 @@ struct TableParameters : public BaseParameters
|
|||||||
double fallback_speed_,
|
double fallback_speed_,
|
||||||
FallbackCoordinateType fallback_coordinate_type_,
|
FallbackCoordinateType fallback_coordinate_type_,
|
||||||
double scale_factor_,
|
double scale_factor_,
|
||||||
Args &&...args_)
|
Args &&... args_)
|
||||||
: BaseParameters{std::forward<Args>(args_)...}, sources{std::move(sources_)},
|
: BaseParameters{std::forward<Args>(args_)...}, sources{std::move(sources_)},
|
||||||
destinations{std::move(destinations_)}, fallback_speed{fallback_speed_},
|
destinations{std::move(destinations_)}, fallback_speed{fallback_speed_},
|
||||||
fallback_coordinate_type{fallback_coordinate_type_}, annotations{annotations_},
|
fallback_coordinate_type{fallback_coordinate_type_}, annotations{annotations_},
|
||||||
@@ -162,6 +166,8 @@ inline TableParameters::AnnotationsType &operator|=(TableParameters::Annotations
|
|||||||
{
|
{
|
||||||
return lhs = lhs | rhs;
|
return lhs = lhs | rhs;
|
||||||
}
|
}
|
||||||
} // namespace osrm::engine::api
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // ENGINE_API_TABLE_PARAMETERS_HPP
|
#endif // ENGINE_API_TABLE_PARAMETERS_HPP
|
||||||
|
|||||||
@@ -30,7 +30,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
namespace osrm::engine::api
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace api
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,6 +70,8 @@ struct TileParameters final
|
|||||||
return valid_x && valid_y && valid_z;
|
return valid_x && valid_y && valid_z;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace osrm::engine::api
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,7 +10,11 @@
|
|||||||
|
|
||||||
#include "util/integer_range.hpp"
|
#include "util/integer_range.hpp"
|
||||||
|
|
||||||
namespace osrm::engine::api
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace api
|
||||||
{
|
{
|
||||||
|
|
||||||
class TripAPI final : public RouteAPI
|
class TripAPI final : public RouteAPI
|
||||||
@@ -50,10 +54,10 @@ class TripAPI final : public RouteAPI
|
|||||||
data_version_string = fb_result.CreateString(data_timestamp);
|
data_version_string = fb_result.CreateString(data_timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto response = MakeFBResponse(sub_routes,
|
auto response =
|
||||||
fb_result,
|
MakeFBResponse(sub_routes, fb_result, [this, &fb_result, &sub_trips, &candidates]() {
|
||||||
[this, &fb_result, &sub_trips, &candidates]()
|
return MakeWaypoints(fb_result, sub_trips, candidates);
|
||||||
{ return MakeWaypoints(fb_result, sub_trips, candidates); });
|
});
|
||||||
|
|
||||||
if (!data_timestamp.empty())
|
if (!data_timestamp.empty())
|
||||||
{
|
{
|
||||||
@@ -176,6 +180,8 @@ class TripAPI final : public RouteAPI
|
|||||||
const TripParameters ¶meters;
|
const TripParameters ¶meters;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace osrm::engine::api
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -33,7 +33,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm::engine::api
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace api
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,7 +64,7 @@ struct TripParameters : public RouteParameters
|
|||||||
TripParameters(SourceType source_,
|
TripParameters(SourceType source_,
|
||||||
DestinationType destination_,
|
DestinationType destination_,
|
||||||
bool roundtrip_,
|
bool roundtrip_,
|
||||||
Args &&...args_)
|
Args &&... args_)
|
||||||
: RouteParameters{std::forward<Args>(args_)...}, source{source_},
|
: RouteParameters{std::forward<Args>(args_)...}, source{source_},
|
||||||
destination{destination_}, roundtrip{roundtrip_}
|
destination{destination_}, roundtrip{roundtrip_}
|
||||||
{
|
{
|
||||||
@@ -72,6 +76,8 @@ struct TripParameters : public RouteParameters
|
|||||||
|
|
||||||
bool IsValid() const { return RouteParameters::IsValid(); }
|
bool IsValid() const { return RouteParameters::IsValid(); }
|
||||||
};
|
};
|
||||||
} // namespace osrm::engine::api
|
} // namespace api
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -30,15 +30,17 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace osrm::engine
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
{
|
{
|
||||||
|
|
||||||
enum class Approach : std::uint8_t
|
enum class Approach : std::uint8_t
|
||||||
{
|
{
|
||||||
CURB = 0,
|
CURB = 0,
|
||||||
UNRESTRICTED = 1,
|
UNRESTRICTED = 1
|
||||||
OPPOSITE = 2
|
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace osrm::engine
|
}
|
||||||
|
} // namespace osrm
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#ifndef OSRM_ENGINE_BEARING_HPP
|
#ifndef OSRM_ENGINE_BEARING_HPP
|
||||||
#define OSRM_ENGINE_BEARING_HPP
|
#define OSRM_ENGINE_BEARING_HPP
|
||||||
|
|
||||||
namespace osrm::engine
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
{
|
{
|
||||||
|
|
||||||
struct Bearing
|
struct Bearing
|
||||||
@@ -44,6 +46,7 @@ inline bool operator==(const Bearing lhs, const Bearing rhs)
|
|||||||
return lhs.bearing == rhs.bearing && lhs.range == rhs.range;
|
return lhs.bearing == rhs.bearing && lhs.range == rhs.range;
|
||||||
}
|
}
|
||||||
inline bool operator!=(const Bearing lhs, const Bearing rhs) { return !(lhs == rhs); }
|
inline bool operator!=(const Bearing lhs, const Bearing rhs) { return !(lhs == rhs); }
|
||||||
} // namespace osrm::engine
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,7 +17,9 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
namespace osrm::engine
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
@@ -147,6 +149,7 @@ class DataWatchdogImpl<AlgorithmT, datafacade::ContiguousInternalMemoryDataFacad
|
|||||||
// once a new dataset arrives.
|
// once a new dataset arrives.
|
||||||
template <typename AlgorithmT, template <typename A> class FacadeT>
|
template <typename AlgorithmT, template <typename A> class FacadeT>
|
||||||
using DataWatchdog = detail::DataWatchdogImpl<AlgorithmT, FacadeT<AlgorithmT>>;
|
using DataWatchdog = detail::DataWatchdogImpl<AlgorithmT, FacadeT<AlgorithmT>>;
|
||||||
} // namespace osrm::engine
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,12 +3,15 @@
|
|||||||
|
|
||||||
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
|
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
|
||||||
|
|
||||||
namespace osrm::engine
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
{
|
{
|
||||||
|
|
||||||
using DataFacadeBase = datafacade::ContiguousInternalMemoryDataFacadeBase;
|
using DataFacadeBase = datafacade::ContiguousInternalMemoryDataFacadeBase;
|
||||||
template <typename AlgorithmT>
|
template <typename AlgorithmT>
|
||||||
using DataFacade = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
|
using DataFacade = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
|
||||||
} // namespace osrm::engine
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -12,7 +12,11 @@
|
|||||||
#include "util/filtered_graph.hpp"
|
#include "util/filtered_graph.hpp"
|
||||||
#include "util/integer_range.hpp"
|
#include "util/integer_range.hpp"
|
||||||
|
|
||||||
namespace osrm::engine::datafacade
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace datafacade
|
||||||
{
|
{
|
||||||
|
|
||||||
// Namespace local aliases for algorithms
|
// Namespace local aliases for algorithms
|
||||||
@@ -79,7 +83,7 @@ template <> class AlgorithmDataFacade<MLD>
|
|||||||
|
|
||||||
virtual EdgeWeight GetNodeWeight(const NodeID edge_based_node_id) const = 0;
|
virtual EdgeWeight GetNodeWeight(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual EdgeDuration
|
virtual EdgeWeight
|
||||||
GetNodeDuration(const NodeID edge_based_node_id) const = 0; // TODO: to be removed
|
GetNodeDuration(const NodeID edge_based_node_id) const = 0; // TODO: to be removed
|
||||||
|
|
||||||
virtual EdgeDistance GetNodeDistance(const NodeID edge_based_node_id) const = 0;
|
virtual EdgeDistance GetNodeDistance(const NodeID edge_based_node_id) const = 0;
|
||||||
@@ -105,6 +109,8 @@ template <> class AlgorithmDataFacade<MLD>
|
|||||||
virtual EdgeID FindEdge(const NodeID edge_based_node_from,
|
virtual EdgeID FindEdge(const NodeID edge_based_node_from,
|
||||||
const NodeID edge_based_node_to) const = 0;
|
const NodeID edge_based_node_to) const = 0;
|
||||||
};
|
};
|
||||||
} // namespace osrm::engine::datafacade
|
} // namespace datafacade
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,7 +3,11 @@
|
|||||||
|
|
||||||
#include "storage/shared_data_index.hpp"
|
#include "storage/shared_data_index.hpp"
|
||||||
|
|
||||||
namespace osrm::engine::datafacade
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace datafacade
|
||||||
{
|
{
|
||||||
|
|
||||||
class ContiguousBlockAllocator
|
class ContiguousBlockAllocator
|
||||||
@@ -15,6 +19,8 @@ class ContiguousBlockAllocator
|
|||||||
virtual const storage::SharedDataIndex &GetIndex() = 0;
|
virtual const storage::SharedDataIndex &GetIndex() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace osrm::engine::datafacade
|
} // namespace datafacade
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_ENGINE_DATAFACADE_CONTIGUOUS_BLOCK_ALLOCATOR_HPP_
|
#endif // OSRM_ENGINE_DATAFACADE_CONTIGUOUS_BLOCK_ALLOCATOR_HPP_
|
||||||
|
|||||||
@@ -28,28 +28,12 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm::engine::datafacade
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace datafacade
|
||||||
{
|
{
|
||||||
|
|
||||||
static const std::string DATASET_TURN_DATA = "TurnData";
|
|
||||||
static const std::string DATASET_TURN_LANE_DATA = "NameLaneData";
|
|
||||||
static const std::string DATASET_NAME_DATA = "NameData";
|
|
||||||
static const std::string DATASET_INTERSECTION_BEARINGS = "IntersectionBearings";
|
|
||||||
static const std::string DATASET_ENTRY_CLASS = "EntryClass";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Macro is not ideal. But without it we either have to:
|
|
||||||
* a) Write this boiler-plate for every usage of an optional dataset.
|
|
||||||
* b) Convert to a function and add lots of polluting NOLINT(bugprone-unchecked-optional-access)
|
|
||||||
* comments. This macro keeps the API code readable.
|
|
||||||
*/
|
|
||||||
#define CHECK_DATASET_DISABLED(val, dataset) \
|
|
||||||
{ \
|
|
||||||
if (!(val)) \
|
|
||||||
{ \
|
|
||||||
throw osrm::util::DisabledDatasetException((dataset)); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename AlgorithmT> class ContiguousInternalMemoryAlgorithmDataFacade;
|
template <typename AlgorithmT> class ContiguousInternalMemoryAlgorithmDataFacade;
|
||||||
|
|
||||||
@@ -158,18 +142,21 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
extractor::Datasources *m_datasources;
|
extractor::Datasources *m_datasources;
|
||||||
|
|
||||||
std::uint32_t m_check_sum;
|
std::uint32_t m_check_sum;
|
||||||
std::string_view m_data_timestamp;
|
StringView m_data_timestamp;
|
||||||
util::vector_view<util::Coordinate> m_coordinate_list;
|
util::vector_view<util::Coordinate> m_coordinate_list;
|
||||||
extractor::PackedOSMIDsView m_osmnodeid_list;
|
extractor::PackedOSMIDsView m_osmnodeid_list;
|
||||||
std::optional<util::vector_view<std::uint32_t>> m_lane_description_offsets;
|
util::vector_view<std::uint32_t> m_lane_description_offsets;
|
||||||
std::optional<util::vector_view<extractor::TurnLaneType::Mask>> m_lane_description_masks;
|
util::vector_view<extractor::TurnLaneType::Mask> m_lane_description_masks;
|
||||||
util::vector_view<TurnPenalty> m_turn_weight_penalties;
|
util::vector_view<TurnPenalty> m_turn_weight_penalties;
|
||||||
util::vector_view<TurnPenalty> m_turn_duration_penalties;
|
util::vector_view<TurnPenalty> m_turn_duration_penalties;
|
||||||
extractor::SegmentDataView segment_data;
|
extractor::SegmentDataView segment_data;
|
||||||
extractor::EdgeBasedNodeDataView edge_based_node_data;
|
extractor::EdgeBasedNodeDataView edge_based_node_data;
|
||||||
std::optional<guidance::TurnDataView> turn_data;
|
guidance::TurnDataView turn_data;
|
||||||
|
|
||||||
std::optional<util::vector_view<util::guidance::LaneTupleIdPair>> m_lane_tuple_id_pairs;
|
util::vector_view<char> m_datasource_name_data;
|
||||||
|
util::vector_view<std::size_t> m_datasource_name_offsets;
|
||||||
|
util::vector_view<std::size_t> m_datasource_name_lengths;
|
||||||
|
util::vector_view<util::guidance::LaneTupleIdPair> m_lane_tupel_id_pairs;
|
||||||
|
|
||||||
util::vector_view<extractor::StorageManeuverOverride> m_maneuver_overrides;
|
util::vector_view<extractor::StorageManeuverOverride> m_maneuver_overrides;
|
||||||
util::vector_view<NodeID> m_maneuver_override_node_sequences;
|
util::vector_view<NodeID> m_maneuver_override_node_sequences;
|
||||||
@@ -178,24 +165,16 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
std::unique_ptr<SharedGeospatialQuery> m_geospatial_query;
|
std::unique_ptr<SharedGeospatialQuery> m_geospatial_query;
|
||||||
boost::filesystem::path file_index_path;
|
boost::filesystem::path file_index_path;
|
||||||
|
|
||||||
std::optional<extractor::IntersectionBearingsView> intersection_bearings_view;
|
extractor::IntersectionBearingsView intersection_bearings_view;
|
||||||
|
|
||||||
std::optional<extractor::NameTableView> m_name_table;
|
extractor::NameTableView m_name_table;
|
||||||
// the look-up table for entry classes. An entry class lists the possibility of entry for all
|
// the look-up table for entry classes. An entry class lists the possibility of entry for all
|
||||||
// available turns. Such a class id is stored with every edge.
|
// available turns. Such a class id is stored with every edge.
|
||||||
std::optional<util::vector_view<util::guidance::EntryClass>> m_entry_class_table;
|
util::vector_view<util::guidance::EntryClass> m_entry_class_table;
|
||||||
|
|
||||||
// allocator that keeps the allocation data
|
// allocator that keeps the allocation data
|
||||||
std::shared_ptr<ContiguousBlockAllocator> allocator;
|
std::shared_ptr<ContiguousBlockAllocator> allocator;
|
||||||
|
|
||||||
bool isIndexed(const storage::SharedDataIndex &index, const std::string &name)
|
|
||||||
{
|
|
||||||
bool result = false;
|
|
||||||
index.List(name,
|
|
||||||
boost::make_function_output_iterator([&](const auto &) { result = true; }));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void InitializeInternalPointers(const storage::SharedDataIndex &index,
|
void InitializeInternalPointers(const storage::SharedDataIndex &index,
|
||||||
const std::string &metric_name,
|
const std::string &metric_name,
|
||||||
const std::size_t exclude_index)
|
const std::size_t exclude_index)
|
||||||
@@ -208,17 +187,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
|
|
||||||
exclude_mask = m_profile_properties->excludable_classes[exclude_index];
|
exclude_mask = m_profile_properties->excludable_classes[exclude_index];
|
||||||
|
|
||||||
// We no longer use "/common/connectivity_checksum", as osrm.edges is an optional dataset.
|
m_check_sum = *index.GetBlockPtr<std::uint32_t>("/common/connectivity_checksum");
|
||||||
// Instead, we load the value from the MLD or CH graph, whichever is loaded.
|
|
||||||
if (isIndexed(index, "/mld/connectivity_checksum"))
|
|
||||||
{
|
|
||||||
m_check_sum = *index.GetBlockPtr<std::uint32_t>("/mld/connectivity_checksum");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(isIndexed(index, "/ch/connectivity_checksum"));
|
|
||||||
m_check_sum = *index.GetBlockPtr<std::uint32_t>("/ch/connectivity_checksum");
|
|
||||||
}
|
|
||||||
|
|
||||||
m_data_timestamp = make_timestamp_view(index, "/common/timestamp");
|
m_data_timestamp = make_timestamp_view(index, "/common/timestamp");
|
||||||
|
|
||||||
@@ -231,23 +200,13 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
|
|
||||||
edge_based_node_data = make_ebn_data_view(index, "/common/ebg_node_data");
|
edge_based_node_data = make_ebn_data_view(index, "/common/ebg_node_data");
|
||||||
|
|
||||||
if (isIndexed(index, "/common/turn_data"))
|
turn_data = make_turn_data_view(index, "/common/turn_data");
|
||||||
{
|
|
||||||
turn_data = make_turn_data_view(index, "/common/turn_data");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isIndexed(index, "/common/names"))
|
m_name_table = make_name_table_view(index, "/common/names");
|
||||||
{
|
|
||||||
m_name_table = make_name_table_view(index, "/common/names");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isIndexed(index, "/common/turn_lanes"))
|
std::tie(m_lane_description_offsets, m_lane_description_masks) =
|
||||||
{
|
make_turn_lane_description_views(index, "/common/turn_lanes");
|
||||||
std::tie(m_lane_description_offsets, m_lane_description_masks) =
|
m_lane_tupel_id_pairs = make_lane_data_view(index, "/common/turn_lanes");
|
||||||
make_turn_lane_description_views(index, "/common/turn_lanes");
|
|
||||||
|
|
||||||
m_lane_tuple_id_pairs = make_lane_data_view(index, "/common/turn_lanes");
|
|
||||||
}
|
|
||||||
|
|
||||||
m_turn_weight_penalties = make_turn_weight_view(index, "/common/turn_penalty");
|
m_turn_weight_penalties = make_turn_weight_view(index, "/common/turn_penalty");
|
||||||
m_turn_duration_penalties = make_turn_duration_view(index, "/common/turn_penalty");
|
m_turn_duration_penalties = make_turn_duration_view(index, "/common/turn_penalty");
|
||||||
@@ -256,12 +215,10 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
|
|
||||||
m_datasources = index.GetBlockPtr<extractor::Datasources>("/common/data_sources_names");
|
m_datasources = index.GetBlockPtr<extractor::Datasources>("/common/data_sources_names");
|
||||||
|
|
||||||
if (isIndexed(index, "/common/intersection_bearings"))
|
intersection_bearings_view =
|
||||||
{
|
make_intersection_bearings_view(index, "/common/intersection_bearings");
|
||||||
intersection_bearings_view =
|
|
||||||
make_intersection_bearings_view(index, "/common/intersection_bearings");
|
m_entry_class_table = make_entry_classes_view(index, "/common/entry_classes");
|
||||||
m_entry_class_table = make_entry_classes_view(index, "/common/entry_classes");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::tie(m_maneuver_overrides, m_maneuver_override_node_sequences) =
|
std::tie(m_maneuver_overrides, m_maneuver_override_node_sequences) =
|
||||||
make_maneuver_overrides_views(index, "/common/maneuver_overrides");
|
make_maneuver_overrides_views(index, "/common/maneuver_overrides");
|
||||||
@@ -352,8 +309,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
osrm::guidance::TurnInstruction
|
osrm::guidance::TurnInstruction
|
||||||
GetTurnInstructionForEdgeID(const EdgeID edge_based_edge_id) const override final
|
GetTurnInstructionForEdgeID(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
CHECK_DATASET_DISABLED(turn_data, DATASET_TURN_DATA);
|
return turn_data.GetTurnInstruction(edge_based_edge_id);
|
||||||
return turn_data->GetTurnInstruction(edge_based_edge_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate south_west,
|
std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate south_west,
|
||||||
@@ -440,11 +396,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
{
|
{
|
||||||
auto indexes = extractor::getClassIndexes(class_data);
|
auto indexes = extractor::getClassIndexes(class_data);
|
||||||
std::vector<std::string> classes(indexes.size());
|
std::vector<std::string> classes(indexes.size());
|
||||||
std::transform(indexes.begin(),
|
std::transform(indexes.begin(), indexes.end(), classes.begin(), [this](const auto index) {
|
||||||
indexes.end(),
|
return m_profile_properties->GetClassName(index);
|
||||||
classes.begin(),
|
});
|
||||||
[this](const auto index)
|
|
||||||
{ return m_profile_properties->GetClassName(index); });
|
|
||||||
|
|
||||||
return classes;
|
return classes;
|
||||||
}
|
}
|
||||||
@@ -454,37 +408,32 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
return edge_based_node_data.GetNameID(edge_based_node_id);
|
return edge_based_node_data.GetNameID(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string_view GetNameForID(const NameID id) const override final
|
StringView GetNameForID(const NameID id) const override final
|
||||||
{
|
{
|
||||||
CHECK_DATASET_DISABLED(m_name_table, DATASET_NAME_DATA);
|
return m_name_table.GetNameForID(id);
|
||||||
return m_name_table->GetNameForID(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string_view GetRefForID(const NameID id) const override final
|
StringView GetRefForID(const NameID id) const override final
|
||||||
{
|
{
|
||||||
CHECK_DATASET_DISABLED(m_name_table, DATASET_NAME_DATA);
|
return m_name_table.GetRefForID(id);
|
||||||
return m_name_table->GetRefForID(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string_view GetPronunciationForID(const NameID id) const override final
|
StringView GetPronunciationForID(const NameID id) const override final
|
||||||
{
|
{
|
||||||
CHECK_DATASET_DISABLED(m_name_table, DATASET_NAME_DATA);
|
return m_name_table.GetPronunciationForID(id);
|
||||||
return m_name_table->GetPronunciationForID(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string_view GetDestinationsForID(const NameID id) const override final
|
StringView GetDestinationsForID(const NameID id) const override final
|
||||||
{
|
{
|
||||||
CHECK_DATASET_DISABLED(m_name_table, DATASET_NAME_DATA);
|
return m_name_table.GetDestinationsForID(id);
|
||||||
return m_name_table->GetDestinationsForID(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string_view GetExitsForID(const NameID id) const override final
|
StringView GetExitsForID(const NameID id) const override final
|
||||||
{
|
{
|
||||||
CHECK_DATASET_DISABLED(m_name_table, DATASET_NAME_DATA);
|
return m_name_table.GetExitsForID(id);
|
||||||
return m_name_table->GetExitsForID(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string_view GetDatasourceName(const DatasourceID id) const override final
|
StringView GetDatasourceName(const DatasourceID id) const override final
|
||||||
{
|
{
|
||||||
return m_datasources->GetSourceName(id);
|
return m_datasources->GetSourceName(id);
|
||||||
}
|
}
|
||||||
@@ -514,60 +463,46 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
util::guidance::BearingClass
|
util::guidance::BearingClass
|
||||||
GetBearingClass(const NodeID node_based_node_id) const override final
|
GetBearingClass(const NodeID node_based_node_id) const override final
|
||||||
{
|
{
|
||||||
CHECK_DATASET_DISABLED(intersection_bearings_view, DATASET_INTERSECTION_BEARINGS);
|
return intersection_bearings_view.GetBearingClass(node_based_node_id);
|
||||||
return intersection_bearings_view->GetBearingClass(node_based_node_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
guidance::TurnBearing PreTurnBearing(const EdgeID edge_based_edge_id) const override final
|
guidance::TurnBearing PreTurnBearing(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
CHECK_DATASET_DISABLED(turn_data, DATASET_TURN_DATA);
|
return turn_data.GetPreTurnBearing(edge_based_edge_id);
|
||||||
return turn_data->GetPreTurnBearing(edge_based_edge_id);
|
|
||||||
}
|
}
|
||||||
guidance::TurnBearing PostTurnBearing(const EdgeID edge_based_edge_id) const override final
|
guidance::TurnBearing PostTurnBearing(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
CHECK_DATASET_DISABLED(turn_data, DATASET_TURN_DATA);
|
return turn_data.GetPostTurnBearing(edge_based_edge_id);
|
||||||
return turn_data->GetPostTurnBearing(edge_based_edge_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
util::guidance::EntryClass GetEntryClass(const EdgeID edge_based_edge_id) const override final
|
util::guidance::EntryClass GetEntryClass(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
CHECK_DATASET_DISABLED(m_entry_class_table, DATASET_ENTRY_CLASS);
|
auto entry_class_id = turn_data.GetEntryClassID(edge_based_edge_id);
|
||||||
CHECK_DATASET_DISABLED(turn_data, DATASET_TURN_DATA);
|
return m_entry_class_table.at(entry_class_id);
|
||||||
|
|
||||||
auto entry_class_id = turn_data->GetEntryClassID(edge_based_edge_id);
|
|
||||||
return m_entry_class_table->at(entry_class_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasLaneData(const EdgeID edge_based_edge_id) const override final
|
bool HasLaneData(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
CHECK_DATASET_DISABLED(turn_data, DATASET_TURN_DATA);
|
return turn_data.HasLaneData(edge_based_edge_id);
|
||||||
return turn_data->HasLaneData(edge_based_edge_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
util::guidance::LaneTupleIdPair
|
util::guidance::LaneTupleIdPair
|
||||||
GetLaneData(const EdgeID edge_based_edge_id) const override final
|
GetLaneData(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
CHECK_DATASET_DISABLED(turn_data, DATASET_TURN_DATA);
|
|
||||||
CHECK_DATASET_DISABLED(m_lane_tuple_id_pairs, DATASET_TURN_LANE_DATA);
|
|
||||||
|
|
||||||
BOOST_ASSERT(HasLaneData(edge_based_edge_id));
|
BOOST_ASSERT(HasLaneData(edge_based_edge_id));
|
||||||
return m_lane_tuple_id_pairs->at(turn_data->GetLaneDataID(edge_based_edge_id));
|
return m_lane_tupel_id_pairs.at(turn_data.GetLaneDataID(edge_based_edge_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
extractor::TurnLaneDescription
|
extractor::TurnLaneDescription
|
||||||
GetTurnDescription(const LaneDescriptionID lane_description_id) const override final
|
GetTurnDescription(const LaneDescriptionID lane_description_id) const override final
|
||||||
{
|
{
|
||||||
CHECK_DATASET_DISABLED(m_lane_description_offsets, DATASET_TURN_LANE_DATA);
|
|
||||||
CHECK_DATASET_DISABLED(m_lane_description_masks, DATASET_TURN_LANE_DATA);
|
|
||||||
|
|
||||||
if (lane_description_id == INVALID_LANE_DESCRIPTIONID)
|
if (lane_description_id == INVALID_LANE_DESCRIPTIONID)
|
||||||
return {};
|
return {};
|
||||||
else
|
else
|
||||||
return extractor::TurnLaneDescription(
|
return extractor::TurnLaneDescription(
|
||||||
m_lane_description_masks->begin() +
|
m_lane_description_masks.begin() + m_lane_description_offsets[lane_description_id],
|
||||||
m_lane_description_offsets->at(lane_description_id),
|
m_lane_description_masks.begin() +
|
||||||
m_lane_description_masks->begin() +
|
m_lane_description_offsets[lane_description_id + 1]);
|
||||||
m_lane_description_offsets->at(lane_description_id + 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsLeftHandDriving(const NodeID edge_based_node_id) const override final
|
bool IsLeftHandDriving(const NodeID edge_based_node_id) const override final
|
||||||
@@ -602,19 +537,15 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
auto found_range = std::equal_range(
|
auto found_range = std::equal_range(
|
||||||
m_maneuver_overrides.begin(), m_maneuver_overrides.end(), edge_based_node_id, Comp{});
|
m_maneuver_overrides.begin(), m_maneuver_overrides.end(), edge_based_node_id, Comp{});
|
||||||
|
|
||||||
std::for_each(found_range.first,
|
std::for_each(found_range.first, found_range.second, [&](const auto &override) {
|
||||||
found_range.second,
|
std::vector<NodeID> sequence(
|
||||||
[&](const auto &override)
|
m_maneuver_override_node_sequences.begin() + override.node_sequence_offset_begin,
|
||||||
{
|
m_maneuver_override_node_sequences.begin() + override.node_sequence_offset_end);
|
||||||
std::vector<NodeID> sequence(m_maneuver_override_node_sequences.begin() +
|
results.push_back(extractor::ManeuverOverride{std::move(sequence),
|
||||||
override.node_sequence_offset_begin,
|
override.instruction_node,
|
||||||
m_maneuver_override_node_sequences.begin() +
|
override.override_type,
|
||||||
override.node_sequence_offset_end);
|
override.direction});
|
||||||
results.push_back(extractor::ManeuverOverride{std::move(sequence),
|
});
|
||||||
override.instruction_node,
|
|
||||||
override.override_type,
|
|
||||||
override.direction});
|
|
||||||
});
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -762,6 +693,8 @@ class ContiguousInternalMemoryDataFacade<MLD> final
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace osrm::engine::datafacade
|
} // namespace datafacade
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // CONTIGUOUS_INTERNALMEM_DATAFACADE_HPP
|
#endif // CONTIGUOUS_INTERNALMEM_DATAFACADE_HPP
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "util/integer_range.hpp"
|
#include "util/integer_range.hpp"
|
||||||
#include "util/packed_vector.hpp"
|
#include "util/packed_vector.hpp"
|
||||||
#include "util/string_util.hpp"
|
#include "util/string_util.hpp"
|
||||||
|
#include "util/string_view.hpp"
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
|
|
||||||
#include "osrm/coordinate.hpp"
|
#include "osrm/coordinate.hpp"
|
||||||
@@ -36,12 +37,17 @@
|
|||||||
|
|
||||||
#include <engine/bearing.hpp>
|
#include <engine/bearing.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace osrm::engine::datafacade
|
namespace osrm
|
||||||
{
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace datafacade
|
||||||
|
{
|
||||||
|
|
||||||
|
using StringView = util::StringView;
|
||||||
|
|
||||||
class BaseDataFacade
|
class BaseDataFacade
|
||||||
{
|
{
|
||||||
@@ -107,7 +113,7 @@ class BaseDataFacade
|
|||||||
GetUncompressedReverseDatasources(const PackedGeometryID id) const = 0;
|
GetUncompressedReverseDatasources(const PackedGeometryID id) const = 0;
|
||||||
|
|
||||||
// Gets the name of a datasource
|
// Gets the name of a datasource
|
||||||
virtual std::string_view GetDatasourceName(const DatasourceID id) const = 0;
|
virtual StringView GetDatasourceName(const DatasourceID id) const = 0;
|
||||||
|
|
||||||
virtual osrm::guidance::TurnInstruction
|
virtual osrm::guidance::TurnInstruction
|
||||||
GetTurnInstructionForEdgeID(const EdgeID edge_based_edge_id) const = 0;
|
GetTurnInstructionForEdgeID(const EdgeID edge_based_edge_id) const = 0;
|
||||||
@@ -151,15 +157,15 @@ class BaseDataFacade
|
|||||||
|
|
||||||
virtual NameID GetNameIndex(const NodeID edge_based_node_id) const = 0;
|
virtual NameID GetNameIndex(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual std::string_view GetNameForID(const NameID id) const = 0;
|
virtual StringView GetNameForID(const NameID id) const = 0;
|
||||||
|
|
||||||
virtual std::string_view GetRefForID(const NameID id) const = 0;
|
virtual StringView GetRefForID(const NameID id) const = 0;
|
||||||
|
|
||||||
virtual std::string_view GetPronunciationForID(const NameID id) const = 0;
|
virtual StringView GetPronunciationForID(const NameID id) const = 0;
|
||||||
|
|
||||||
virtual std::string_view GetDestinationsForID(const NameID id) const = 0;
|
virtual StringView GetDestinationsForID(const NameID id) const = 0;
|
||||||
|
|
||||||
virtual std::string_view GetExitsForID(const NameID id) const = 0;
|
virtual StringView GetExitsForID(const NameID id) const = 0;
|
||||||
|
|
||||||
virtual bool GetContinueStraightDefault() const = 0;
|
virtual bool GetContinueStraightDefault() const = 0;
|
||||||
|
|
||||||
@@ -185,6 +191,8 @@ class BaseDataFacade
|
|||||||
virtual std::vector<extractor::ManeuverOverride>
|
virtual std::vector<extractor::ManeuverOverride>
|
||||||
GetOverridesThatStartAt(const NodeID edge_based_node_id) const = 0;
|
GetOverridesThatStartAt(const NodeID edge_based_node_id) const = 0;
|
||||||
};
|
};
|
||||||
} // namespace osrm::engine::datafacade
|
} // namespace datafacade
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // DATAFACADE_BASE_HPP
|
#endif // DATAFACADE_BASE_HPP
|
||||||
|
|||||||
@@ -12,7 +12,11 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace osrm::engine::datafacade
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace engine
|
||||||
|
{
|
||||||
|
namespace datafacade
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,6 +37,8 @@ class MMapMemoryAllocator final : public ContiguousBlockAllocator
|
|||||||
std::string rtree_filename;
|
std::string rtree_filename;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace osrm::engine::datafacade
|
} // namespace datafacade
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace osrm
|
||||||
|
|
||||||
#endif // OSRM_ENGINE_DATAFACADE_SHARED_MEMORY_ALLOCATOR_HPP_
|
#endif // OSRM_ENGINE_DATAFACADE_SHARED_MEMORY_ALLOCATOR_HPP_
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user