Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
4370fd126d | ||
|
15a2fdd1f8 | ||
|
0eedcf69bc | ||
|
62abea30f5 | ||
|
3364be1860 | ||
|
a5eeca9b51 | ||
|
1a09ff6005 | ||
|
2794a52902 | ||
|
cb796e4cfc | ||
|
522ec4fc2e | ||
|
15dc5899b0 | ||
|
7e932ffbc3 | ||
|
810596bb83 | ||
|
acabf0075c | ||
|
1ed72db210 | ||
|
6bdf95dfb4 | ||
|
785ae89cd8 | ||
|
16680191de |
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,6 +7,8 @@
|
|||||||
#############################
|
#############################
|
||||||
osrm-deps
|
osrm-deps
|
||||||
|
|
||||||
|
.ycm_extra_conf.py
|
||||||
|
|
||||||
# Compiled source #
|
# Compiled source #
|
||||||
###################
|
###################
|
||||||
*.com
|
*.com
|
||||||
|
10
.npmignore
10
.npmignore
@ -1,10 +0,0 @@
|
|||||||
*
|
|
||||||
!README.md
|
|
||||||
!CHANGELOG.md
|
|
||||||
!CONTRIBUTING.MD
|
|
||||||
!LICENCE.TXT
|
|
||||||
!package.json
|
|
||||||
!example
|
|
||||||
!lib/*.js
|
|
||||||
!profiles/*
|
|
||||||
!profiles/lib/*
|
|
41
.travis.yml
41
.travis.yml
@ -7,8 +7,9 @@ git:
|
|||||||
sudo: required
|
sudo: required
|
||||||
dist: trusty
|
dist: trusty
|
||||||
|
|
||||||
nodejs:
|
node_js:
|
||||||
- "4"
|
- "4"
|
||||||
|
- "6"
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
@ -16,6 +17,7 @@ notifications:
|
|||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
- "5.7"
|
||||||
# enable building tags
|
# enable building tags
|
||||||
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
|
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
|
||||||
|
|
||||||
@ -36,6 +38,8 @@ env:
|
|||||||
- CCACHE_VERSION=3.3.1
|
- CCACHE_VERSION=3.3.1
|
||||||
- CMAKE_VERSION=3.7.2
|
- CMAKE_VERSION=3.7.2
|
||||||
- MASON="$(pwd)/scripts/mason.sh"
|
- MASON="$(pwd)/scripts/mason.sh"
|
||||||
|
- ENABLE_NODE_BINDINGS=On
|
||||||
|
- NODE="4"
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
@ -45,12 +49,14 @@ matrix:
|
|||||||
|
|
||||||
# Debug Builds
|
# Debug Builds
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: "gcc-6-debug"
|
compiler: "gcc-6-debug-cov-asan"
|
||||||
addons: &gcc6
|
addons: &gcc6
|
||||||
apt:
|
apt:
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
|
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
|
||||||
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_COVERAGE=ON ENABLE_SANITIZER=ON
|
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_COVERAGE=ON ENABLE_SANITIZER=ON
|
||||||
|
after_success:
|
||||||
|
- bash <(curl -s https://codecov.io/bash)
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: "clang-4.0-debug"
|
compiler: "clang-4.0-debug"
|
||||||
@ -61,12 +67,12 @@ matrix:
|
|||||||
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000
|
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: "mason-linux-debug-santize"
|
compiler: "mason-linux-debug-asan"
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['libstdc++-5-dev']
|
packages: ['libstdc++-5-dev']
|
||||||
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON ENABLE_NODE_BINDINGS=ON
|
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON
|
||||||
|
|
||||||
# Release Builds
|
# Release Builds
|
||||||
- os: linux
|
- os: linux
|
||||||
@ -75,7 +81,7 @@ matrix:
|
|||||||
apt:
|
apt:
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['libstdc++-5-dev']
|
packages: ['libstdc++-5-dev']
|
||||||
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON ENABLE_NODE_BINDINGS=ON
|
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: "gcc-6-release"
|
compiler: "gcc-6-release"
|
||||||
@ -104,6 +110,8 @@ matrix:
|
|||||||
compiler: "mason-osx-release"
|
compiler: "mason-osx-release"
|
||||||
# we use the xcode provides clang and don't install our own
|
# we use the xcode provides clang and don't install our own
|
||||||
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON
|
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON
|
||||||
|
after_success:
|
||||||
|
- ./scripts/travis/publish.sh
|
||||||
|
|
||||||
# Disabled because of CI slowness
|
# Disabled because of CI slowness
|
||||||
#- os: linux
|
#- os: linux
|
||||||
@ -140,8 +148,7 @@ matrix:
|
|||||||
apt:
|
apt:
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['libstdc++-5-dev']
|
packages: ['libstdc++-5-dev']
|
||||||
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON ENABLE_NODE_BINDINGS=ON PUBLISH_NODE_BINDINGS=On JOBS=4
|
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON PUBLISH_NODE_BINDINGS=On JOBS=3
|
||||||
nodejs: "4"
|
|
||||||
install:
|
install:
|
||||||
- pushd ${OSRM_BUILD_DIR}
|
- pushd ${OSRM_BUILD_DIR}
|
||||||
- |
|
- |
|
||||||
@ -164,8 +171,7 @@ matrix:
|
|||||||
apt:
|
apt:
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['libstdc++-5-dev']
|
packages: ['libstdc++-5-dev']
|
||||||
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON ENABLE_NODE_BINDINGS=ON PUBLISH_NODE_BINDINGS=On JOBS=4
|
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON PUBLISH_NODE_BINDINGS=On JOBS=3
|
||||||
nodejs: "4"
|
|
||||||
install:
|
install:
|
||||||
- pushd ${OSRM_BUILD_DIR}
|
- pushd ${OSRM_BUILD_DIR}
|
||||||
- |
|
- |
|
||||||
@ -188,8 +194,7 @@ matrix:
|
|||||||
apt:
|
apt:
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['libstdc++-5-dev']
|
packages: ['libstdc++-5-dev']
|
||||||
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON ENABLE_NODE_BINDINGS=ON PUBLISH_NODE_BINDINGS=On JOBS=4
|
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON PUBLISH_NODE_BINDINGS=On JOBS=3 NODE="6"
|
||||||
nodejs: "6"
|
|
||||||
install:
|
install:
|
||||||
- pushd ${OSRM_BUILD_DIR}
|
- pushd ${OSRM_BUILD_DIR}
|
||||||
- |
|
- |
|
||||||
@ -212,8 +217,7 @@ matrix:
|
|||||||
apt:
|
apt:
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['libstdc++-5-dev']
|
packages: ['libstdc++-5-dev']
|
||||||
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON ENABLE_NODE_BINDINGS=ON PUBLISH_NODE_BINDINGS=On JOBS=4
|
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON PUBLISH_NODE_BINDINGS=On JOBS=3 NODE="6"
|
||||||
nodejs: "6"
|
|
||||||
install:
|
install:
|
||||||
- pushd ${OSRM_BUILD_DIR}
|
- pushd ${OSRM_BUILD_DIR}
|
||||||
- |
|
- |
|
||||||
@ -230,6 +234,10 @@ matrix:
|
|||||||
- ./scripts/travis/publish.sh
|
- ./scripts/travis/publish.sh
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
|
- source $NVM_DIR/nvm.sh
|
||||||
|
- nvm install $NODE
|
||||||
|
- nvm use $NODE
|
||||||
|
- node --version
|
||||||
- if [[ ! -z $TARGET_ARCH ]] ; then source ./scripts/travis/before_install.$TARGET_ARCH.sh ; fi
|
- if [[ ! -z $TARGET_ARCH ]] ; then source ./scripts/travis/before_install.$TARGET_ARCH.sh ; fi
|
||||||
- |
|
- |
|
||||||
if [[ -z $JOBS ]]; then
|
if [[ -z $JOBS ]]; then
|
||||||
@ -331,14 +339,9 @@ script:
|
|||||||
- ./unit_tests/server-tests
|
- ./unit_tests/server-tests
|
||||||
- ./unit_tests/partition-tests
|
- ./unit_tests/partition-tests
|
||||||
- |
|
- |
|
||||||
if [ -n "${ENABLE_NODE_BINDINGS}" ] && [ -z "${ENABLE_SANITIZER}" ]; then
|
if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then
|
||||||
npm run nodejs-tests
|
npm run nodejs-tests
|
||||||
fi
|
fi
|
||||||
- popd
|
- popd
|
||||||
- yarn test
|
- yarn test
|
||||||
|
|
||||||
after_success:
|
|
||||||
- |
|
|
||||||
if [ -n "${ENABLE_COVERAGE}" ]; then
|
|
||||||
bash <(curl -s https://codecov.io/bash)
|
|
||||||
fi
|
|
||||||
|
19
CHANGELOG.md
19
CHANGELOG.md
@ -1,17 +1,32 @@
|
|||||||
- Track preprocessing flag in the map matching plugin.
|
|
||||||
|
|
||||||
# 5.7.0
|
# 5.7.0
|
||||||
- Changes from 5.6
|
- Changes from 5.6
|
||||||
|
- Bug fixes:
|
||||||
|
- Fixed 505: Invalid distance value for distance as routing weight.
|
||||||
|
- Fixed 3958: Fix traffic light penalties for non-turns
|
||||||
|
- Fixed 3933: crash when collapsing instructions
|
||||||
|
- Algorithm:
|
||||||
|
- OSRM object has new option `algorithm` that allows the selection of a routing algorithm.
|
||||||
|
- New experimental algorithm: Multi-Level Dijkstra with new toolchain:
|
||||||
|
- Allows for fast metric updates in below a minute on continental sized networks (osrm-customize)
|
||||||
|
- Plugins supported: `match` and `route`
|
||||||
|
- Quickstart: `osrm-extract data.osm.pbf`, `osrm-partition data.osrm`, `osrm-customize data.osrm`, `osrm-routed --algorithm=MLD data.osrm`
|
||||||
- NodeJs Bindings
|
- NodeJs Bindings
|
||||||
- Merged https://github.com/Project-OSRM/node-osrm into repository. Build via `cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=On -DENABLE_MASON=On`.
|
- Merged https://github.com/Project-OSRM/node-osrm into repository. Build via `cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=On -DENABLE_MASON=On`.
|
||||||
|
- `OSRM` object has new option `algorihtm="CH","CoreCH","MLD"`
|
||||||
- Internals
|
- Internals
|
||||||
- Shared memory notification via conditional variables on Linux or semaphore queue on OS X and Windows with a limit of 128 OSRM Engine instances
|
- Shared memory notification via conditional variables on Linux or semaphore queue on OS X and Windows with a limit of 128 OSRM Engine instances
|
||||||
- Files
|
- Files
|
||||||
- .osrm.datasource_index file was removed. Data is now part of .osrm.geometries.
|
- .osrm.datasource_index file was removed. Data is now part of .osrm.geometries.
|
||||||
- .osrm.edge_lookup was removed. The option `--generate-edge-lookup` does nothing now.
|
- .osrm.edge_lookup was removed. The option `--generate-edge-lookup` does nothing now.
|
||||||
- `osrm-contract` does not depend on the `.osrm.fileIndex` file anymore
|
- `osrm-contract` does not depend on the `.osrm.fileIndex` file anymore
|
||||||
|
- `osrm-extract` creates new file `.osrm.cnbg` and `.cnbg_to_ebg`
|
||||||
|
- `osrm-partition` creates new file `.osrm.partition` and `.osrm.cells`
|
||||||
|
- `osrm-customize` creates new file `.osrm.mldgr`
|
||||||
- Profiles
|
- Profiles
|
||||||
- Added `force_split_edges` flag to global properties. True value guarantees that segment_function will be called for all segments, but also could double memory consumption
|
- Added `force_split_edges` flag to global properties. True value guarantees that segment_function will be called for all segments, but also could double memory consumption
|
||||||
|
- Map Matching:
|
||||||
|
- new option `gaps=split|ignore` to enable/disbale track splitting
|
||||||
|
- new option `tidy=true|false` to simplify traces automatically
|
||||||
|
|
||||||
# 5.6.3
|
# 5.6.3
|
||||||
- Changes from 5.6.0
|
- Changes from 5.6.0
|
||||||
|
39
features/car/traffic_light_penalties.feature
Normal file
39
features/car/traffic_light_penalties.feature
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
@routing @car @traffic_light
|
||||||
|
Feature: Car - Handle traffic lights
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the profile "car"
|
||||||
|
|
||||||
|
Scenario: Car - Encounters a traffic light
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a-1-b-2-c
|
||||||
|
|
||||||
|
d-3-e-4-f
|
||||||
|
|
||||||
|
g-h-i k-l-m
|
||||||
|
| |
|
||||||
|
j n
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway |
|
||||||
|
| abc | primary |
|
||||||
|
| def | primary |
|
||||||
|
| ghi | primary |
|
||||||
|
| klm | primary |
|
||||||
|
| hj | primary |
|
||||||
|
| ln | primary |
|
||||||
|
|
||||||
|
And the nodes
|
||||||
|
| node | highway |
|
||||||
|
| e | traffic_signals |
|
||||||
|
| l | traffic_signals |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | time | # |
|
||||||
|
| 1 | 2 | 11.1s | no turn with no traffic light |
|
||||||
|
| 3 | 4 | 13.1s | no turn with traffic light |
|
||||||
|
| g | j | 18.7s | turn with no traffic light |
|
||||||
|
| k | n | 20.7s | turn with traffic light |
|
@ -62,3 +62,28 @@ Feature: Car - weights
|
|||||||
| from | to | route | speed | weight |
|
| from | to | route | speed | weight |
|
||||||
| a | d | ab,bc,cd,cd | 65 km/h | 44.4 |
|
| a | d | ab,bc,cd,cd | 65 km/h | 44.4 |
|
||||||
| a | e | ab,be,be | 14 km/h | 112 |
|
| a | e | ab,be,be | 14 km/h | 112 |
|
||||||
|
|
||||||
|
Scenario: Distance weights
|
||||||
|
Given the profile file "car" extended with
|
||||||
|
"""
|
||||||
|
api_version = 1
|
||||||
|
properties.weight_name = 'distance'
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a---b---c
|
||||||
|
|
|
||||||
|
d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| abc |
|
||||||
|
| bd |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | bearings | route | distance | weights | times |
|
||||||
|
| a,b | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s |
|
||||||
|
| b,c | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s |
|
||||||
|
| a,d | 90 180 | abc,bd,bd | 399.9m | 200,200,0 | 13.2s,11.1s,0s |
|
||||||
|
@ -1019,3 +1019,39 @@ Feature: Collapse
|
|||||||
| a,g | road,cross,cross | depart,fork left,arrive | a,b,g |
|
| a,g | road,cross,cross | depart,fork left,arrive | a,b,g |
|
||||||
| a,e | road,road,road | depart,fork slight right,arrive | a,b,e |
|
| a,e | road,road,road | depart,fork slight right,arrive | a,b,e |
|
||||||
| a,f | road,road,cross,cross | depart,fork slight right,turn right,arrive | a,b,d,f |
|
| a,f | road,road,cross,cross | depart,fork slight right,turn right,arrive | a,b,d,f |
|
||||||
|
|
||||||
|
|
||||||
|
# http://www.openstreetmap.org/way/92415447 #3933
|
||||||
|
Scenario: Use total angle for turn instruction if entry step has large distance
|
||||||
|
# """
|
||||||
|
# kf-_ a
|
||||||
|
# | - b
|
||||||
|
# | c
|
||||||
|
# |d
|
||||||
|
# e
|
||||||
|
# |
|
||||||
|
# i
|
||||||
|
# """
|
||||||
|
|
||||||
|
And the node locations
|
||||||
|
| node | lat | lon | #id |
|
||||||
|
| a | -33.9644254 | 151.1378673 | 33226063 |
|
||||||
|
| b | -33.9644373 | 151.1377172 | 1072787030 |
|
||||||
|
| c | -33.9644791 | 151.1374452 | 4222903609 |
|
||||||
|
| d | -33.9645661 | 151.1372654 | 4222903610 |
|
||||||
|
| e | -33.9646986 | 151.1371539 | 4222903611 |
|
||||||
|
| f | -33.964386 | 151.1372133 | 1072786875 |
|
||||||
|
| i | -33.9661796 | 151.1368491 | 2781176918 |
|
||||||
|
| k | -33.9643781 | 151.1371422 | 1684173853 |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | name | oneway | #id |
|
||||||
|
| ab | trunk | President Avenue | yes | 92415447 |
|
||||||
|
| bcde | trunk | President Avenue | yes | 422534457 |
|
||||||
|
| bf | trunk | President Avenue | yes | 447779786 |
|
||||||
|
| fk | trunk | President Avenue | yes | 179293012 |
|
||||||
|
| fei | trunk | Princes Highway | yes | 130099670 |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | turns | locations |
|
||||||
|
| a,i | President Avenue,Princes Highway,Princes Highway | depart,turn left,arrive | a,b,i |
|
||||||
|
@ -79,102 +79,102 @@ module.exports = function () {
|
|||||||
|
|
||||||
if (headers.has('route')) {
|
if (headers.has('route')) {
|
||||||
got.route = (instructions || '').trim();
|
got.route = (instructions || '').trim();
|
||||||
|
|
||||||
if (headers.has('summary')) {
|
|
||||||
got.summary = (summary || '').trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (headers.has('alternative')) {
|
|
||||||
// TODO examine more than first alternative?
|
|
||||||
got.alternative ='';
|
|
||||||
if (json.routes && json.routes.length > 1)
|
|
||||||
got.alternative = this.wayList(json.routes[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
var distance = hasRoute && json.routes[0].distance,
|
|
||||||
time = hasRoute && json.routes[0].duration,
|
|
||||||
weight = hasRoute && json.routes[0].weight;
|
|
||||||
|
|
||||||
if (headers.has('distance')) {
|
|
||||||
if (row.distance.length) {
|
|
||||||
if (!row.distance.match(/\d+m/))
|
|
||||||
return cb(new Error('*** Distance must be specified in meters. (ex: 250m)'));
|
|
||||||
got.distance = instructions ? util.format('%dm', distance) : '';
|
|
||||||
} else {
|
|
||||||
got.distance = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (headers.has('weight')) {
|
|
||||||
if (row.weight.length) {
|
|
||||||
if (!row.weight.match(/[\d\.]+/))
|
|
||||||
return cb(new Error('*** Weight must be specified as a numeric value. (ex: 8)'));
|
|
||||||
got.weight = instructions ? util.format('%d', weight) : '';
|
|
||||||
} else {
|
|
||||||
got.weight = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (headers.has('time')) {
|
|
||||||
if (!row.time.match(/\d+s/))
|
|
||||||
return cb(new Error('*** Time must be specied in seconds. (ex: 60s)'));
|
|
||||||
got.time = instructions ? util.format('%ds', time) : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (headers.has('lanes')) {
|
|
||||||
got.lanes = (lanes || '').trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (headers.has('speed')) {
|
|
||||||
if (row.speed !== '' && instructions) {
|
|
||||||
if (!row.speed.match(/\d+ km\/h/))
|
|
||||||
cb(new Error('*** Speed must be specied in km/h. (ex: 50 km/h)'));
|
|
||||||
var speed = time > 0 ? Math.round(3.6*distance/time) : null;
|
|
||||||
got.speed = util.format('%d km/h', speed);
|
|
||||||
} else {
|
|
||||||
got.speed = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (headers.has('intersections')) {
|
|
||||||
got.intersections = (intersections || '').trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (headers.has('locations')){
|
|
||||||
got.locations = (locations || '').trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
// if header matches 'a:*', parse out the values for *
|
|
||||||
// and return in that header
|
|
||||||
headers.forEach((k) => {
|
|
||||||
let whitelist = ['duration', 'distance', 'datasources', 'nodes', 'weight', 'speed'];
|
|
||||||
if (k.match(/^a:/)) {
|
|
||||||
let a_type = k.slice(2);
|
|
||||||
if (whitelist.indexOf(a_type) == -1)
|
|
||||||
return cb(new Error('Unrecognized annotation field', a_type));
|
|
||||||
if (annotation && !annotation[a_type])
|
|
||||||
return cb(new Error('Annotation not found in response', a_type));
|
|
||||||
got[k] = annotation && annotation[a_type] || '';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var putValue = (key, value) => {
|
|
||||||
if (headers.has(key)) got[key] = instructions ? value : '';
|
|
||||||
};
|
|
||||||
|
|
||||||
putValue('ref', refs);
|
|
||||||
putValue('bearing', bearings);
|
|
||||||
putValue('turns', turns);
|
|
||||||
putValue('modes', modes);
|
|
||||||
putValue('times', times);
|
|
||||||
putValue('distances', distances);
|
|
||||||
putValue('pronunciations', pronunciations);
|
|
||||||
putValue('destinations', destinations);
|
|
||||||
putValue('weight_name', weight_name);
|
|
||||||
putValue('weights', weights);
|
|
||||||
putValue('weight', weight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (headers.has('summary')) {
|
||||||
|
got.summary = (summary || '').trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (headers.has('alternative')) {
|
||||||
|
// TODO examine more than first alternative?
|
||||||
|
got.alternative ='';
|
||||||
|
if (json.routes && json.routes.length > 1)
|
||||||
|
got.alternative = this.wayList(json.routes[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
var distance = hasRoute && json.routes[0].distance,
|
||||||
|
time = hasRoute && json.routes[0].duration,
|
||||||
|
weight = hasRoute && json.routes[0].weight;
|
||||||
|
|
||||||
|
if (headers.has('distance')) {
|
||||||
|
if (row.distance.length) {
|
||||||
|
if (!row.distance.match(/\d+m/))
|
||||||
|
return cb(new Error('*** Distance must be specified in meters. (ex: 250m)'));
|
||||||
|
got.distance = instructions ? util.format('%dm', distance) : '';
|
||||||
|
} else {
|
||||||
|
got.distance = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (headers.has('weight')) {
|
||||||
|
if (row.weight.length) {
|
||||||
|
if (!row.weight.match(/[\d\.]+/))
|
||||||
|
return cb(new Error('*** Weight must be specified as a numeric value. (ex: 8)'));
|
||||||
|
got.weight = instructions ? util.format('%d', weight) : '';
|
||||||
|
} else {
|
||||||
|
got.weight = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (headers.has('time')) {
|
||||||
|
if (!row.time.match(/\d+s/))
|
||||||
|
return cb(new Error('*** Time must be specied in seconds. (ex: 60s)'));
|
||||||
|
got.time = instructions ? util.format('%ds', time) : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (headers.has('lanes')) {
|
||||||
|
got.lanes = (lanes || '').trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (headers.has('speed')) {
|
||||||
|
if (row.speed !== '' && instructions) {
|
||||||
|
if (!row.speed.match(/\d+ km\/h/))
|
||||||
|
cb(new Error('*** Speed must be specied in km/h. (ex: 50 km/h)'));
|
||||||
|
var speed = time > 0 ? Math.round(3.6*distance/time) : null;
|
||||||
|
got.speed = util.format('%d km/h', speed);
|
||||||
|
} else {
|
||||||
|
got.speed = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (headers.has('intersections')) {
|
||||||
|
got.intersections = (intersections || '').trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (headers.has('locations')){
|
||||||
|
got.locations = (locations || '').trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
// if header matches 'a:*', parse out the values for *
|
||||||
|
// and return in that header
|
||||||
|
headers.forEach((k) => {
|
||||||
|
let whitelist = ['duration', 'distance', 'datasources', 'nodes', 'weight', 'speed'];
|
||||||
|
if (k.match(/^a:/)) {
|
||||||
|
let a_type = k.slice(2);
|
||||||
|
if (whitelist.indexOf(a_type) == -1)
|
||||||
|
return cb(new Error('Unrecognized annotation field', a_type));
|
||||||
|
if (annotation && !annotation[a_type])
|
||||||
|
return cb(new Error('Annotation not found in response', a_type));
|
||||||
|
got[k] = annotation && annotation[a_type] || '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var putValue = (key, value) => {
|
||||||
|
if (headers.has(key)) got[key] = instructions ? value : '';
|
||||||
|
};
|
||||||
|
|
||||||
|
putValue('ref', refs);
|
||||||
|
putValue('bearing', bearings);
|
||||||
|
putValue('turns', turns);
|
||||||
|
putValue('modes', modes);
|
||||||
|
putValue('times', times);
|
||||||
|
putValue('distances', distances);
|
||||||
|
putValue('pronunciations', pronunciations);
|
||||||
|
putValue('destinations', destinations);
|
||||||
|
putValue('weight_name', weight_name);
|
||||||
|
putValue('weights', weights);
|
||||||
|
putValue('weight', weight);
|
||||||
|
|
||||||
for (var key in row) {
|
for (var key in row) {
|
||||||
if (this.FuzzyMatch.match(got[key], row[key])) {
|
if (this.FuzzyMatch.match(got[key], row[key])) {
|
||||||
got[key] = row[key];
|
got[key] = row[key];
|
||||||
|
@ -80,6 +80,8 @@ inline Result keep_all(const MatchParameters ¶ms)
|
|||||||
|
|
||||||
inline Result tidy(const MatchParameters ¶ms, Thresholds cfg = {15., 5})
|
inline Result tidy(const MatchParameters ¶ms, Thresholds cfg = {15., 5})
|
||||||
{
|
{
|
||||||
|
BOOST_ASSERT(!params.coordinates.empty());
|
||||||
|
|
||||||
Result result;
|
Result result;
|
||||||
|
|
||||||
result.can_be_removed.resize(params.coordinates.size(), false);
|
result.can_be_removed.resize(params.coordinates.size(), false);
|
||||||
@ -91,10 +93,8 @@ inline Result tidy(const MatchParameters ¶ms, Thresholds cfg = {15., 5})
|
|||||||
Thresholds running{0., 0};
|
Thresholds running{0., 0};
|
||||||
|
|
||||||
// Walk over adjacent (coord, ts)-pairs, with rhs being the candidate to discard or keep
|
// Walk over adjacent (coord, ts)-pairs, with rhs being the candidate to discard or keep
|
||||||
for (std::size_t current = 0; current < params.coordinates.size() - 1; ++current)
|
for (std::size_t current = 0, next = 1; next < params.coordinates.size() - 1; ++current, ++next)
|
||||||
{
|
{
|
||||||
const auto next = current + 1;
|
|
||||||
|
|
||||||
auto distance_delta = util::coordinate_calculation::haversineDistance(
|
auto distance_delta = util::coordinate_calculation::haversineDistance(
|
||||||
params.coordinates[current], params.coordinates[next]);
|
params.coordinates[current], params.coordinates[next]);
|
||||||
running.distance_in_meters += distance_delta;
|
running.distance_in_meters += distance_delta;
|
||||||
@ -130,7 +130,11 @@ inline Result tidy(const MatchParameters ¶ms, Thresholds cfg = {15., 5})
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_ASSERT(result.can_be_removed.size() == params.coordinates.size());
|
// Always use the last coordinate if more than two original coordinates
|
||||||
|
if (params.coordinates.size() > 1)
|
||||||
|
{
|
||||||
|
result.tidied_to_original.push_back(params.coordinates.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
// We have to filter parallel arrays that may be empty or the exact same size.
|
// We have to filter parallel arrays that may be empty or the exact same size.
|
||||||
// result.parameters contains an empty MatchParameters at this point: conditionally fill.
|
// result.parameters contains an empty MatchParameters at this point: conditionally fill.
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "osrm/trip_parameters.hpp"
|
#include "osrm/trip_parameters.hpp"
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/make_unique.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -81,7 +80,7 @@ inline void ParseResult(const osrm::Status &result_status, const std::string & /
|
|||||||
inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo<v8::Value> &args)
|
inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo<v8::Value> &args)
|
||||||
{
|
{
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
auto engine_config = boost::make_unique<osrm::EngineConfig>();
|
auto engine_config = std::make_unique<osrm::EngineConfig>();
|
||||||
|
|
||||||
if (args.Length() == 0)
|
if (args.Length() == 0)
|
||||||
{
|
{
|
||||||
@ -631,7 +630,7 @@ inline route_parameters_ptr
|
|||||||
argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||||
bool requires_multiple_coordinates)
|
bool requires_multiple_coordinates)
|
||||||
{
|
{
|
||||||
route_parameters_ptr params = boost::make_unique<osrm::RouteParameters>();
|
route_parameters_ptr params = std::make_unique<osrm::RouteParameters>();
|
||||||
bool has_base_params = argumentsToParameter(args, params, requires_multiple_coordinates);
|
bool has_base_params = argumentsToParameter(args, params, requires_multiple_coordinates);
|
||||||
if (!has_base_params)
|
if (!has_base_params)
|
||||||
return route_parameters_ptr();
|
return route_parameters_ptr();
|
||||||
@ -681,7 +680,7 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
|||||||
inline tile_parameters_ptr
|
inline tile_parameters_ptr
|
||||||
argumentsToTileParameters(const Nan::FunctionCallbackInfo<v8::Value> &args, bool /*unused*/)
|
argumentsToTileParameters(const Nan::FunctionCallbackInfo<v8::Value> &args, bool /*unused*/)
|
||||||
{
|
{
|
||||||
tile_parameters_ptr params = boost::make_unique<osrm::TileParameters>();
|
tile_parameters_ptr params = std::make_unique<osrm::TileParameters>();
|
||||||
|
|
||||||
if (args.Length() < 2)
|
if (args.Length() < 2)
|
||||||
{
|
{
|
||||||
@ -742,7 +741,7 @@ inline nearest_parameters_ptr
|
|||||||
argumentsToNearestParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
argumentsToNearestParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||||
bool requires_multiple_coordinates)
|
bool requires_multiple_coordinates)
|
||||||
{
|
{
|
||||||
nearest_parameters_ptr params = boost::make_unique<osrm::NearestParameters>();
|
nearest_parameters_ptr params = std::make_unique<osrm::NearestParameters>();
|
||||||
bool has_base_params = argumentsToParameter(args, params, requires_multiple_coordinates);
|
bool has_base_params = argumentsToParameter(args, params, requires_multiple_coordinates);
|
||||||
if (!has_base_params)
|
if (!has_base_params)
|
||||||
return nearest_parameters_ptr();
|
return nearest_parameters_ptr();
|
||||||
@ -781,7 +780,7 @@ inline table_parameters_ptr
|
|||||||
argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||||
bool requires_multiple_coordinates)
|
bool requires_multiple_coordinates)
|
||||||
{
|
{
|
||||||
table_parameters_ptr params = boost::make_unique<osrm::TableParameters>();
|
table_parameters_ptr params = std::make_unique<osrm::TableParameters>();
|
||||||
bool has_base_params = argumentsToParameter(args, params, requires_multiple_coordinates);
|
bool has_base_params = argumentsToParameter(args, params, requires_multiple_coordinates);
|
||||||
if (!has_base_params)
|
if (!has_base_params)
|
||||||
return table_parameters_ptr();
|
return table_parameters_ptr();
|
||||||
@ -875,7 +874,7 @@ inline trip_parameters_ptr
|
|||||||
argumentsToTripParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
argumentsToTripParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||||
bool requires_multiple_coordinates)
|
bool requires_multiple_coordinates)
|
||||||
{
|
{
|
||||||
trip_parameters_ptr params = boost::make_unique<osrm::TripParameters>();
|
trip_parameters_ptr params = std::make_unique<osrm::TripParameters>();
|
||||||
bool has_base_params = argumentsToParameter(args, params, requires_multiple_coordinates);
|
bool has_base_params = argumentsToParameter(args, params, requires_multiple_coordinates);
|
||||||
if (!has_base_params)
|
if (!has_base_params)
|
||||||
return trip_parameters_ptr();
|
return trip_parameters_ptr();
|
||||||
@ -970,7 +969,7 @@ inline match_parameters_ptr
|
|||||||
argumentsToMatchParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
argumentsToMatchParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||||
bool requires_multiple_coordinates)
|
bool requires_multiple_coordinates)
|
||||||
{
|
{
|
||||||
match_parameters_ptr params = boost::make_unique<osrm::MatchParameters>();
|
match_parameters_ptr params = std::make_unique<osrm::MatchParameters>();
|
||||||
bool has_base_params = argumentsToParameter(args, params, requires_multiple_coordinates);
|
bool has_base_params = argumentsToParameter(args, params, requires_multiple_coordinates);
|
||||||
if (!has_base_params)
|
if (!has_base_params)
|
||||||
return match_parameters_ptr();
|
return match_parameters_ptr();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "osrm",
|
"name": "osrm",
|
||||||
"version": "5.7.0-latest.6",
|
"version": "5.7.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
|
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -392,21 +392,21 @@ function turn_function (turn)
|
|||||||
local turn_penalty = profile.turn_penalty
|
local turn_penalty = profile.turn_penalty
|
||||||
local turn_bias = profile.turn_bias
|
local turn_bias = profile.turn_bias
|
||||||
|
|
||||||
|
if turn.has_traffic_light then
|
||||||
|
turn.duration = profile.traffic_light_penalty
|
||||||
|
end
|
||||||
|
|
||||||
if turn.turn_type ~= turn_type.no_turn then
|
if turn.turn_type ~= turn_type.no_turn then
|
||||||
if turn.angle >= 0 then
|
if turn.angle >= 0 then
|
||||||
turn.duration = turn_penalty / (1 + math.exp( -((13 / turn_bias) * turn.angle/180 - 6.5*turn_bias)))
|
turn.duration = turn.duration + turn_penalty / (1 + math.exp( -((13 / turn_bias) * turn.angle/180 - 6.5*turn_bias)))
|
||||||
else
|
else
|
||||||
turn.duration = turn_penalty / (1 + math.exp( -((13 * turn_bias) * -turn.angle/180 - 6.5/turn_bias)))
|
turn.duration = turn.duration + turn_penalty / (1 + math.exp( -((13 * turn_bias) * -turn.angle/180 - 6.5/turn_bias)))
|
||||||
end
|
end
|
||||||
|
|
||||||
if turn.direction_modifier == direction_modifier.u_turn then
|
if turn.direction_modifier == direction_modifier.u_turn then
|
||||||
turn.duration = turn.duration + profile.u_turn_penalty
|
turn.duration = turn.duration + profile.u_turn_penalty
|
||||||
end
|
end
|
||||||
|
|
||||||
if turn.has_traffic_light then
|
|
||||||
turn.duration = turn.duration + profile.traffic_light_penalty
|
|
||||||
end
|
|
||||||
|
|
||||||
-- for distance based routing we don't want to have penalties based on turn angle
|
-- for distance based routing we don't want to have penalties based on turn angle
|
||||||
if properties.weight_name == 'distance' then
|
if properties.weight_name == 'distance' then
|
||||||
turn.weight = 0
|
turn.weight = 0
|
||||||
|
@ -441,7 +441,7 @@ end
|
|||||||
|
|
||||||
function Handlers.handle_weights(way,result,data,profile)
|
function Handlers.handle_weights(way,result,data,profile)
|
||||||
if properties.weight_name == 'distance' then
|
if properties.weight_name == 'distance' then
|
||||||
result.weight = 0
|
result.weight = -1
|
||||||
-- set weight rates to 1 for the distance weight, edge weights are distance / rate
|
-- set weight rates to 1 for the distance weight, edge weights are distance / rate
|
||||||
if (result.forward_mode ~= mode.inaccessible and result.forward_speed > 0) then
|
if (result.forward_mode ~= mode.inaccessible and result.forward_speed > 0) then
|
||||||
result.forward_rate = 1
|
result.forward_rate = 1
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
NODE_HOME=$HOME/node
|
|
||||||
export NODE_HOME
|
|
||||||
mkdir ${NODE_HOME}
|
|
||||||
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
|
|
||||||
curl https://s3.amazonaws.com/mapbox/apps/install-node/v2.0.0/run | NV=4.4.2 NP=darwin-x64 OD=${NODE_HOME} sh
|
|
||||||
else
|
|
||||||
curl https://s3.amazonaws.com/mapbox/apps/install-node/v2.0.0/run | NV=4.4.2 NP=linux-x64 OD=${NODE_HOME} sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
PATH="${NODE_HOME}/bin:$PATH"
|
|
||||||
export PATH
|
|
||||||
node --version
|
|
||||||
npm --version
|
|
||||||
which node
|
|
||||||
|
|
||||||
|
|
@ -74,9 +74,6 @@ double findTotalTurnAngle(const RouteStep &entry_step, const RouteStep &exit_ste
|
|||||||
if (entry_step.distance < MAX_COLLAPSE_DISTANCE)
|
if (entry_step.distance < MAX_COLLAPSE_DISTANCE)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (entry_step.distance > 2 * MAX_COLLAPSE_DISTANCE)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// both go roughly in the same direction
|
// both go roughly in the same direction
|
||||||
if ((entry_angle <= 185 && exit_angle <= 185) || (entry_angle >= 175 && exit_angle >= 175))
|
if ((entry_angle <= 185 && exit_angle <= 185) || (entry_angle >= 175 && exit_angle >= 175))
|
||||||
return true;
|
return true;
|
||||||
|
@ -53,10 +53,10 @@ BOOST_AUTO_TEST_CASE(two_item_trace_needs_tidiying_test)
|
|||||||
auto result = tidy::tidy(params, thresholds);
|
auto result = tidy::tidy(params, thresholds);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(result.can_be_removed.size(), 2);
|
BOOST_CHECK_EQUAL(result.can_be_removed.size(), 2);
|
||||||
BOOST_CHECK_EQUAL(result.tidied_to_original.size(), 1);
|
BOOST_CHECK_EQUAL(result.tidied_to_original.size(), 2);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(result.can_be_removed[0], false);
|
BOOST_CHECK_EQUAL(result.can_be_removed[0], false);
|
||||||
BOOST_CHECK_EQUAL(result.can_be_removed[1], true);
|
BOOST_CHECK_EQUAL(result.can_be_removed[1], false);
|
||||||
BOOST_CHECK_EQUAL(result.tidied_to_original[0], 0);
|
BOOST_CHECK_EQUAL(result.tidied_to_original[0], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,16 +87,18 @@ BOOST_AUTO_TEST_CASE(two_blobs_in_traces_needs_tidiying_test)
|
|||||||
auto result = tidy::tidy(params, thresholds);
|
auto result = tidy::tidy(params, thresholds);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(result.can_be_removed.size(), params.coordinates.size());
|
BOOST_CHECK_EQUAL(result.can_be_removed.size(), params.coordinates.size());
|
||||||
BOOST_CHECK_EQUAL(result.tidied_to_original.size(), 2);
|
BOOST_CHECK_EQUAL(result.tidied_to_original.size(), 3);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(result.tidied_to_original[0], 0);
|
BOOST_CHECK_EQUAL(result.tidied_to_original[0], 0);
|
||||||
BOOST_CHECK_EQUAL(result.tidied_to_original[1], 3);
|
BOOST_CHECK_EQUAL(result.tidied_to_original[1], 3);
|
||||||
|
BOOST_CHECK_EQUAL(result.tidied_to_original[2], 5);
|
||||||
|
|
||||||
const auto redundant = result.can_be_removed.count();
|
const auto redundant = result.can_be_removed.count();
|
||||||
BOOST_CHECK_EQUAL(redundant, params.coordinates.size() - 2);
|
BOOST_CHECK_EQUAL(redundant, params.coordinates.size() - 3);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(result.can_be_removed[0], false);
|
BOOST_CHECK_EQUAL(result.can_be_removed[0], false);
|
||||||
BOOST_CHECK_EQUAL(result.can_be_removed[3], false);
|
BOOST_CHECK_EQUAL(result.can_be_removed[3], false);
|
||||||
|
BOOST_CHECK_EQUAL(result.can_be_removed[5], false);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(two_blobs_in_traces_needs_tidiying_no_timestamps_test)
|
BOOST_AUTO_TEST_CASE(two_blobs_in_traces_needs_tidiying_no_timestamps_test)
|
||||||
@ -118,15 +120,17 @@ BOOST_AUTO_TEST_CASE(two_blobs_in_traces_needs_tidiying_no_timestamps_test)
|
|||||||
auto result = tidy::tidy(params, thresholds);
|
auto result = tidy::tidy(params, thresholds);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(result.can_be_removed.size(), params.coordinates.size());
|
BOOST_CHECK_EQUAL(result.can_be_removed.size(), params.coordinates.size());
|
||||||
BOOST_CHECK_EQUAL(result.tidied_to_original.size(), 2);
|
BOOST_CHECK_EQUAL(result.tidied_to_original.size(), 3);
|
||||||
BOOST_CHECK_EQUAL(result.tidied_to_original[0], 0);
|
BOOST_CHECK_EQUAL(result.tidied_to_original[0], 0);
|
||||||
BOOST_CHECK_EQUAL(result.tidied_to_original[1], 3);
|
BOOST_CHECK_EQUAL(result.tidied_to_original[1], 3);
|
||||||
|
BOOST_CHECK_EQUAL(result.tidied_to_original[2], 5);
|
||||||
|
|
||||||
const auto redundant = result.can_be_removed.count();
|
const auto redundant = result.can_be_removed.count();
|
||||||
BOOST_CHECK_EQUAL(redundant, params.coordinates.size() - 2);
|
BOOST_CHECK_EQUAL(redundant, params.coordinates.size() - 3);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(result.can_be_removed[0], false);
|
BOOST_CHECK_EQUAL(result.can_be_removed[0], false);
|
||||||
BOOST_CHECK_EQUAL(result.can_be_removed[3], false);
|
BOOST_CHECK_EQUAL(result.can_be_removed[3], false);
|
||||||
|
BOOST_CHECK_EQUAL(result.can_be_removed[5], false);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
Loading…
Reference in New Issue
Block a user