Compare commits
58 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e2e95cc27 | |||
| f4c6ec90ce | |||
| eed22b343a | |||
| 08ce748a37 | |||
| 69790eb8c7 | |||
| 97b9c65c97 | |||
| 92dbadebae | |||
| fe6d854e11 | |||
| 4615b01fdf | |||
| 276b023b05 | |||
| 350cacb2f3 | |||
| 25ec6105c5 | |||
| 3e4249ad41 | |||
| 13126ac0c1 | |||
| d51aee4fbe | |||
| f9877fd8ba | |||
| a39a35df73 | |||
| 2670dd68f3 | |||
| 9adb590ce7 | |||
| 9567a7e38c | |||
| d86eaa00a0 | |||
| 54c0d50b68 | |||
| 204189c326 | |||
| acdfa546a8 | |||
| 6a9216d6e4 | |||
| 9c2a1dc37f | |||
| 26c9d357f0 | |||
| 879d73c629 | |||
| 441146eeae | |||
| d453cadc8c | |||
| 74188206e8 | |||
| 700206099b | |||
| aa952df541 | |||
| b8944da9dc | |||
| 22dda2b285 | |||
| 0ee469c4e0 | |||
| a7eef27e99 | |||
| 4b40f1253f | |||
| 5ebe8080f9 | |||
| d92b28d2c3 | |||
| ec27881f39 | |||
| c5a8ec7c31 | |||
| afbd3347da | |||
| 41bcafc3a1 | |||
| 27d24885a9 | |||
| 805402b230 | |||
| 4918549bac | |||
| 784f417857 | |||
| 0bc3e098ac | |||
| dfd3a5d554 | |||
| 9dcc472c60 | |||
| c972e2cf41 | |||
| de9ab83cea | |||
| 174e388e2d | |||
| ee41fb45b7 | |||
| 93892b9806 | |||
| 749d83a69f | |||
| 8b109904c8 |
@@ -1,90 +0,0 @@
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlinesLeft: false
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: true
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BraceWrapping:
|
||||
AfterClass: true
|
||||
AfterControlStatement: true
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
IndentBraces: true
|
||||
BreakBeforeBinaryOperators: false
|
||||
BreakBeforeBraces: Allman
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
ColumnLimit: 100
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||
IncludeCategories:
|
||||
- Regex: '^<'
|
||||
Priority: 3
|
||||
- Regex: '^"(osrm|util|engine|extract|contract)/'
|
||||
Priority: 2
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IndentCaseLabels: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
...
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
Checks: '-clang-analyzer-*,google-*,llvm-*,misc-*,readability-*,-google-build-explicit-make-pair,-google-explicit-constructor,-google-readability-braces-around-statements,-google-readability-casting,-google-readability-namespace-comments,-google-readability-function,-google-readability-todo,-google-runtime-int,-llvm-namespace-comment,-llvm-header-guard,-llvm-twine-local,-misc-argument-comment,-readability-braces-around-statements,-readability-identifier-naming'
|
||||
...
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# Kind-specific patterns to check AST nodes against. Both python-clang and
|
||||
# libclang docs explain CursorKind, with differences in detail. See also:
|
||||
# - https://github.com/llvm-mirror/clang/blob/aca4fe314a55cacae29e1548cb7bfd2119c6df4c/bindings/python/clang/cindex.py#L599
|
||||
# - http://clang.llvm.org/doxygen/group__CINDEX.html#gaaccc432245b4cd9f2d470913f9ef0013
|
||||
# - https://docs.python.org/2/library/re.html#regular-expression-syntax
|
||||
|
||||
class_decl: '^([A-Z]+[a-z]+)+$'
|
||||
struct_decl: '^([A-Z]+[a-z]+)+$'
|
||||
field_decl: '^[a-z_]+$'
|
||||
var_decl: '^[a-z]+[a-z0-9_]*$'
|
||||
parm_decl: '^[a-z]*[a-z0-9_]*$'
|
||||
namespace: '^[a-z_]*$'
|
||||
cxx_method: '^([A-Z]+[a-z]+)+$'
|
||||
function_decl: '^[a-z]+([A-Z]+[a-z]+)*$'
|
||||
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"rules": {
|
||||
"indent": [
|
||||
2,
|
||||
4
|
||||
],
|
||||
"quotes": [
|
||||
1,
|
||||
"single"
|
||||
],
|
||||
"linebreak-style": [
|
||||
2,
|
||||
"unix"
|
||||
],
|
||||
"semi": [
|
||||
2,
|
||||
"always"
|
||||
],
|
||||
"no-console": [
|
||||
1
|
||||
]
|
||||
},
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": "eslint:recommended"
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
# Issue
|
||||
|
||||
What issue is this PR targeting? If there is no issue that addresses the problem, please open a corresponding issue and link it here.
|
||||
|
||||
## Tasklist
|
||||
- [ ] ADD OWN TASKS HERE
|
||||
- [ ] update relevant [Wiki pages](https://github.com/Project-OSRM/osrm-backend/wiki)
|
||||
- [ ] add regression / cucumber cases (see docs/testing.md)
|
||||
- [ ] review
|
||||
- [ ] adjust for comments
|
||||
|
||||
## Requirements / Relations
|
||||
Link any requirements here. Other pull requests this PR is based on?
|
||||
@@ -1,96 +1,2 @@
|
||||
# mason #
|
||||
#########
|
||||
/.mason
|
||||
/mason_packages
|
||||
|
||||
# pre compiled dependencies #
|
||||
#############################
|
||||
osrm-deps
|
||||
|
||||
# Compiled source #
|
||||
###################
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.so
|
||||
|
||||
# Packages #
|
||||
############
|
||||
# it's better to unpack these files and commit the raw source
|
||||
# git has its own built in compression methods
|
||||
*.7z
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
|
||||
# Logs and databases #
|
||||
######################
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
ehthumbs.db
|
||||
Icon?
|
||||
Thumbs.db
|
||||
|
||||
# build related files #
|
||||
#######################
|
||||
/build/
|
||||
/example/build/
|
||||
/test/data/monaco*
|
||||
/cmake/postinst
|
||||
|
||||
# Eclipse related files #
|
||||
#########################
|
||||
.setting*
|
||||
.scb
|
||||
.cproject
|
||||
.project
|
||||
|
||||
# stxxl related files #
|
||||
#######################
|
||||
.stxxl
|
||||
stxxl.log
|
||||
stxxl.errlog
|
||||
|
||||
# Compiled Binary Files #
|
||||
####################################
|
||||
/osrm-extract
|
||||
/osrm-io-benchmark
|
||||
/osrm-components
|
||||
/osrm-routed
|
||||
/osrm-datastore
|
||||
/osrm-prepare
|
||||
/osrm-unlock-all
|
||||
/osrm-cli
|
||||
/osrm-check-hsgr
|
||||
/osrm-springclean
|
||||
/nohup.out
|
||||
|
||||
# Sandbox folder #
|
||||
###################
|
||||
/sandbox/
|
||||
|
||||
# Test related files #
|
||||
######################
|
||||
/test/profile.lua
|
||||
/test/cache
|
||||
/test/speeds.csv
|
||||
/test/penalties.csv
|
||||
/test/data/monaco.*
|
||||
node_modules
|
||||
|
||||
# Deprecated config file #
|
||||
##########################
|
||||
/server.ini
|
||||
|
||||
*.swp
|
||||
/.settings
|
||||
/.project
|
||||
|
||||
@@ -1,204 +0,0 @@
|
||||
language: cpp
|
||||
|
||||
git:
|
||||
depth: 10
|
||||
|
||||
# sudo:required is needed for trusty images
|
||||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
cache:
|
||||
ccache: true
|
||||
apt: true
|
||||
directories:
|
||||
- test/cache
|
||||
|
||||
env:
|
||||
global:
|
||||
- CCACHE_TEMPDIR=/tmp/.ccache-temp
|
||||
- CCACHE_COMPRESS=1
|
||||
- CASHER_TIME_OUT=599 # one second less than 10m to avoid 10m timeout error: https://github.com/Project-OSRM/osrm-backend/issues/2742
|
||||
- CCACHE_VERSION=3.3.1
|
||||
- CMAKE_VERSION=3.6.2
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
||||
# We override the compiler names here to yield better ccache behavior, which uses this as key
|
||||
include:
|
||||
|
||||
# Debug Builds
|
||||
- os: linux
|
||||
compiler: "gcc-6-debug"
|
||||
addons: &gcc6
|
||||
apt:
|
||||
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']
|
||||
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_COVERAGE=ON ENABLE_SANITIZER=ON BUILD_COMPONENTS=ON
|
||||
|
||||
- os: linux
|
||||
compiler: "clang-3.8-debug"
|
||||
addons: &clang38
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['libstdc++-5-dev', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
|
||||
env: CLANG_VERSION='3.8.1' BUILD_TYPE='Debug' RUN_CLANG_FORMAT=ON BUILD_COMPONENTS=ON CUCUMBER_TIMEOUT=60000
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode8.2
|
||||
compiler: "mason-osx-release"
|
||||
# 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
|
||||
|
||||
# Release Builds
|
||||
- os: linux
|
||||
compiler: "mason-linux-release"
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['libstdc++-5-dev']
|
||||
env: CLANG_VERSION='3.8.1' BUILD_TYPE='Release' ENABLE_MASON=ON
|
||||
|
||||
- os: linux
|
||||
compiler: "gcc-6-release"
|
||||
addons: &gcc6
|
||||
apt:
|
||||
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']
|
||||
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' BUILD_COMPONENTS=ON
|
||||
|
||||
- os: linux
|
||||
compiler: "gcc-6-release-i686"
|
||||
env: >
|
||||
TARGET_ARCH='i686' CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
|
||||
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse'
|
||||
|
||||
- os: linux
|
||||
compiler: "gcc-4.9-release"
|
||||
addons: &gcc49
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-4.9', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache']
|
||||
env: CCOMPILER='gcc-4.9' CXXCOMPILER='g++-4.9' BUILD_TYPE='Release'
|
||||
|
||||
# Disabled because of CI slowness
|
||||
#- os: linux
|
||||
#- compiler: clang
|
||||
#- addons: &clang38
|
||||
#- apt:
|
||||
#- sources: ['llvm-toolchain-precise-3.8', 'ubuntu-toolchain-r-test']
|
||||
#- packages: ['clang-3.8', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
|
||||
#- env: CCOMPILER='clang-3.8' CXXCOMPILER='clang++-3.8' BUILD_TYPE='Release'
|
||||
|
||||
# Shared Library
|
||||
- os: linux
|
||||
compiler: "gcc-6-release-shared"
|
||||
addons: &gcc6
|
||||
apt:
|
||||
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']
|
||||
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON BUILD_COMPONENTS=ON
|
||||
|
||||
# Disabled because CI slowness
|
||||
#- os: linux
|
||||
#- compiler: clang
|
||||
#- addons: &clang38
|
||||
#- apt:
|
||||
#- sources: ['llvm-toolchain-precise-3.8', 'ubuntu-toolchain-r-test']
|
||||
#- packages: ['clang-3.8', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
|
||||
#- env: CCOMPILER='clang-3.8' CXXCOMPILER='clang++-3.8' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
|
||||
|
||||
before_install:
|
||||
- if [[ ! -z $TARGET_ARCH ]] ; then source ./scripts/travis/before_install.$TARGET_ARCH.sh ; fi
|
||||
- |
|
||||
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
||||
export JOBS=$((`nproc` + 1))
|
||||
fi
|
||||
- |
|
||||
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
||||
export JOBS=$((`sysctl -n hw.ncpu` + 1))
|
||||
sudo mdutil -i off /
|
||||
fi
|
||||
- echo "Using ${JOBS} jobs"
|
||||
- source ./scripts/install_node.sh 4
|
||||
- npm install -g "npm@>=3" # Upgrade to npm >v2 to reduce size of downloaded dependencies
|
||||
- npm install
|
||||
- ./third_party/mason/mason install ccache ${CCACHE_VERSION}
|
||||
- export PATH=$(./third_party/mason/mason prefix ccache ${CCACHE_VERSION})/bin:${PATH}
|
||||
- ./third_party/mason/mason install cmake ${CMAKE_VERSION}
|
||||
- export PATH=$(./third_party/mason/mason prefix cmake ${CMAKE_VERSION})/bin:${PATH}
|
||||
- |
|
||||
if [[ ! -z ${CLANG_VERSION} ]]; then
|
||||
export CCOMPILER='clang'
|
||||
export CXXCOMPILER='clang++'
|
||||
./third_party/mason/mason install clang++ ${CLANG_VERSION}
|
||||
export PATH=$(./third_party/mason/mason prefix clang++ ${CLANG_VERSION})/bin:${PATH}
|
||||
# we only enable lto for release builds
|
||||
# and therefore don't need to us ld.gold or llvm tools for linking
|
||||
# for debug builds
|
||||
if [[ ${BUILD_TYPE} == 'Release' ]]; then
|
||||
./third_party/mason/mason install binutils 2.27
|
||||
export PATH=$(./third_party/mason/mason prefix binutils 2.27)/bin:${PATH}
|
||||
fi
|
||||
fi
|
||||
- ccache --max-size=256M # limiting the cache's size to roughly the previous job's object sizes
|
||||
|
||||
install:
|
||||
- |
|
||||
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
||||
./scripts/check_taginfo.py taginfo.json profiles/car.lua
|
||||
fi
|
||||
- export OSRM_BUILD_DIR="$(pwd)/build-osrm"
|
||||
- mkdir ${OSRM_BUILD_DIR} && pushd ${OSRM_BUILD_DIR}
|
||||
- export CC=${CCOMPILER} CXX=${CXXCOMPILER}
|
||||
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_MASON=${ENABLE_MASON:-OFF} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} -DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} -DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} -DBUILD_TOOLS=ON -DBUILD_COMPONENTS=${BUILD_COMPONENTS:-OFF} -DENABLE_CCACHE=ON
|
||||
- echo "travis_fold:start:MAKE"
|
||||
- make --jobs=${JOBS}
|
||||
- make tests --jobs=${JOBS}
|
||||
- make benchmarks --jobs=${JOBS}
|
||||
- echo "travis_fold:end:MAKE"
|
||||
- ccache -s
|
||||
- sudo make install
|
||||
- |
|
||||
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
||||
sudo ldconfig
|
||||
fi
|
||||
- popd
|
||||
- mkdir example/build && pushd example/build
|
||||
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
|
||||
- make --jobs=${JOBS}
|
||||
- popd
|
||||
- npm run build-api-docs
|
||||
|
||||
script:
|
||||
- if [[ $TARGET_ARCH == armhf ]] ; then echo "Skip tests for $TARGET_ARCH" && exit 0 ; fi
|
||||
- echo "travis_fold:start:BENCHMARK"
|
||||
- make -C test/data benchmark
|
||||
- echo "travis_fold:end:BENCHMARK"
|
||||
- ./example/build/osrm-example test/data/monaco.osrm
|
||||
# All tests assume to be run from the build directory
|
||||
- pushd ${OSRM_BUILD_DIR}
|
||||
- ./unit_tests/library-tests ../test/data/monaco.osrm
|
||||
- ./unit_tests/extractor-tests
|
||||
- ./unit_tests/engine-tests
|
||||
- ./unit_tests/util-tests
|
||||
- ./unit_tests/server-tests
|
||||
- popd
|
||||
- npm test
|
||||
|
||||
after_success:
|
||||
- |
|
||||
if [ -n "${RUN_CLANG_FORMAT}" ]; then
|
||||
./scripts/format.sh # we don't want to fail just yet
|
||||
fi
|
||||
- |
|
||||
if [ -n "${ENABLE_COVERAGE}" ]; then
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
fi
|
||||
@@ -1,378 +0,0 @@
|
||||
# 5.5.0
|
||||
- Changes from 5.4.0
|
||||
- API:
|
||||
- `osrm-datastore` now accepts the parameter `--max-wait` that specifies how long it waits before aquiring a shared memory lock by force
|
||||
- Shared memory now allows for multiple clients (multiple instances of libosrm on the same segment)
|
||||
- Polyline geometries can now be requested with precision 5 as well as with precision 6
|
||||
- Profiles
|
||||
- the car profile has been refactored into smaller functions
|
||||
- get_value_by_key() is now guaranteed never to return empty strings, nil is returned instead.
|
||||
- debug.lua was added to make it easier to test/develop profile code.
|
||||
- `car.lua` now depends on lib/set.lua and lib/sequence.lua
|
||||
- `restrictions` is now used for namespaced restrictions and restriction exceptions (e.g. `restriction:motorcar=` as well as `except=motorcar`)
|
||||
- replaced lhs/rhs profiles by using test defined profiles
|
||||
- Handle `oneway=alternating` (routed over with penalty) separately from `oneway=reversible` (not routed over due to time dependence)
|
||||
- Handle `destination:forward`, `destination:backward`, `destination:ref:forward`, `destination:ref:backward` tags
|
||||
- Properly handle destinations on `oneway=-1` roads
|
||||
- Guidance
|
||||
- Notifications are now exposed more prominently, announcing turns onto a ferry/pushing your bike more prominently
|
||||
- Improved turn angle calculation, detecting offsets due to lanes / minor variations due to inaccuracies
|
||||
- Corrected the bearings returned for intermediate steps - requires reprocessing
|
||||
- Improved turn locations for collapsed turns
|
||||
- Trip Plugin
|
||||
- changed internal behaviour to prefer the smallest lexicographic result over the largest one
|
||||
- Bugfixes
|
||||
- fixed a bug where polyline decoding on a defective polyline could end up in out-of-bound access on a vector
|
||||
- fixed compile errors in tile unit-test framework
|
||||
- fixed a bug that could result in inconsistent behaviour when collapsing instructions
|
||||
- fixed a bug that could result in crashes when leaving a ferry directly onto a motorway ramp
|
||||
- fixed a bug in the tile plugin that resulted in discovering invalid edges for connections
|
||||
- Debug Tiles
|
||||
- Added support for turn penalties
|
||||
- Internals
|
||||
- Internal/Shared memory datafacades now share common memory layout and data loading code
|
||||
- File reading now has much better error handling
|
||||
- Misc
|
||||
- Progress indicators now print newlines when stdout is not a TTY
|
||||
- Prettier API documentation now generated via `npm run build-api-docs` output `build/docs`
|
||||
|
||||
# 5.4.3
|
||||
- Changes from 5.4.2
|
||||
- Bugfixes
|
||||
- #3254 Fixed a bug that could end up hiding roundabout instructions
|
||||
- #3260 fixed a bug that provided the wrong location in the arrival instruction
|
||||
|
||||
# 5.4.2
|
||||
- Changes from 5.4.1
|
||||
- Bugfixes
|
||||
- #3032 Fixed a bug that could result in emitting `invalid` as an instruction type on sliproads with mode changes
|
||||
- #3085 Fixed an outdated assertion that could throw without a cause for concern
|
||||
- #3179 Fixed a bug that could trigger an assertion in TurnInstruciton generation
|
||||
|
||||
# 5.4.1
|
||||
- Changes from 5.4.0
|
||||
- Bugfixes
|
||||
- #3016: Fixes shared memory updates while queries are running
|
||||
|
||||
# 5.4.0
|
||||
- Changes from 5.3.0
|
||||
- Profiles
|
||||
- includes library guidance.lua that offers preliminary configuration on guidance.
|
||||
- added left_hand_driving flag in global profile properties
|
||||
- modified turn penalty function for car profile - better fit to real data
|
||||
- return `ref` and `name` as separate fields. Do no use ref or destination as fallback for name value
|
||||
- the default profile for car now ignores HOV only roads
|
||||
- Guidance
|
||||
- Handle Access tags for lanes, only considering valid lanes in lane-guidance (think car | car | bike | car)
|
||||
- Improved the detection of non-noticeable name-changes
|
||||
- Summaries have been improved to consider references as well
|
||||
- API:
|
||||
- `annotations=true` now returns the data source id for each segment as `datasources`
|
||||
- Reduced semantic of merge to refer only to merges from a lane onto a motorway-like road
|
||||
- new `ref` field in the `RouteStep` object. It contains the reference code or name of a way. Previously merged into the `name` property like `name (ref)` and are now separate fields.
|
||||
- Bugfixes
|
||||
- Fixed an issue that would result in segfaults for viaroutes with an invalid intermediate segment when u-turns were allowed at the via-location
|
||||
- Invalid only_* restrictions could result in loss of connectivity. As a fallback, we assume all turns allowed when the restriction is not valid
|
||||
- Fixed a bug that could result in an infinite loop when finding information about an upcoming intersection
|
||||
- Fixed a bug that led to not discovering if a road simply looses a considered prefix
|
||||
- BREAKING: Fixed a bug that could crash postprocessing of instructions on invalid roundabout taggings. This change requires reprocessing datasets with osrm-extract and osrm-contract
|
||||
- Fixed an issue that could emit `invalid` as instruction when ending on a sliproad after a traffic-light
|
||||
- Fixed an issue that would detect turning circles as sliproads
|
||||
- Fixed a bug where post-processing instructions (e.g. left + left -> uturn) could result in false pronunciations
|
||||
- Fixes a bug where a bearing range of zero would cause exhaustive graph traversals
|
||||
- Fixes a bug where certain looped geometries could cause an infinite loop during extraction
|
||||
- Fixed a bug where some roads could be falsly identified as sliproads
|
||||
- Fixed a bug where roundabout intersections could result in breaking assertions when immediately exited
|
||||
- Infrastructure:
|
||||
- Adds a feature to limit results in nearest service with a default of 100 in `osrm-routed`
|
||||
|
||||
# 5.3.0
|
||||
- Changes from 5.3.0-rc.3
|
||||
- Guidance
|
||||
- Only announce `use lane` on required turns (not using all lanes to go straight)
|
||||
- Moved `lanes` to the intersection objects. This is BREAKING in relation to other Release Candidates but not with respect to other releases.
|
||||
- Bugfixes
|
||||
- Fix BREAKING: bug that could result in failure to load 'osrm.icd' files. This breaks the dataformat
|
||||
- Fix: bug that results in segfaults when `use lane` instructions are suppressed
|
||||
|
||||
- Changes form 5.2.7
|
||||
- API
|
||||
- Introduces new `TurnType` in the form of `use lane`. The type indicates that you have to stick to a lane without turning
|
||||
- Introduces `lanes` to the `Intersection` object. The lane data contains both the markings at the intersection and a flag indicating if they can be chosen for the next turn
|
||||
- Removed unused `-s` from `osrm-datastore`
|
||||
- Guidance
|
||||
- Only announce `use lane` on required turns (not using all lanes to go straight)
|
||||
- Improved detection of obvious turns
|
||||
- Improved turn lane detection
|
||||
- Reduce the number of end-of-road instructions in obvious cases
|
||||
- Profile:
|
||||
- bicycle.lua: Surface speeds never increase the actual speed
|
||||
- Infrastructure
|
||||
- Add 32bit support
|
||||
- Add ARM NEON/VFP support
|
||||
- Fix Windows builds
|
||||
- Optimize speed file updates using mmap
|
||||
- Add option to disable LTO for older compilers
|
||||
- BREAKING: The new turn type changes the turn-type order. This breaks the **data format**.
|
||||
- BREAKING: Turn lane data introduces two new files (osrm.tld,osrm.tls). This breaks the fileformat for older versions.
|
||||
- Bugfixes:
|
||||
- Fix devide by zero on updating speed data using osrm-contract
|
||||
|
||||
# 5.3.0 RC3
|
||||
- Changes from 5.3.0-rc.2
|
||||
- Guidance
|
||||
- Improved detection of obvious turns
|
||||
- Improved turn lane detection
|
||||
- Bugfixes
|
||||
- Fix bug that didn't chose minimal weights on overlapping edges
|
||||
|
||||
# 5.3.0 RC2
|
||||
- Changes from 5.3.0-rc.1
|
||||
- Bugfixes
|
||||
- Fixes invalid checks in the lane-extraction part of the car profile
|
||||
|
||||
# 5.3.0 RC1
|
||||
- API
|
||||
- Introduces new `TurnType` in the form of `use lane`. The type indicates that you have to stick to a lane without turning
|
||||
- Introduces lanes to the route response. The lane data contains both the markings at the intersection and a flag indicating their involvement in the turn
|
||||
|
||||
- Infrastructure
|
||||
- BREAKING: The new turn type changes the turn-type order. This breaks the **data format**.
|
||||
- BREAKING: Turn lane data introduces two new files (osrm.tld,osrm.tls). This breaks the fileformat for older versions.
|
||||
|
||||
# 5.2.5
|
||||
- Bugfixes
|
||||
- Fixes a segfault caused by incorrect trimming logic for very short steps.
|
||||
|
||||
# 5.2.4
|
||||
- Bugfixes:
|
||||
- Fixed in issue that arised on roundabouts in combination with intermediate intersections and sliproads
|
||||
|
||||
# 5.2.3
|
||||
- Bugfixes:
|
||||
- Fixed an issue with name changes in roundabouts that could result in crashes
|
||||
|
||||
# 5.2.2
|
||||
Changes from 5.2.1
|
||||
- Bugfixes:
|
||||
- Buffer overrun in tile plugin response handling
|
||||
|
||||
# 5.2.1
|
||||
Changes from 5.2.0
|
||||
- Bugfixes:
|
||||
- Removed debug statement that was spamming the console
|
||||
|
||||
# 5.2.0
|
||||
Changes from 5.2.0 RC2
|
||||
- Bugfixes:
|
||||
- Fixed crash when loading shared memory caused by invalid OSM IDs segment size.
|
||||
- Various small instructions handling fixes
|
||||
|
||||
Changes from 5.1.0
|
||||
- API:
|
||||
- new parameter `annotations` for `route`, `trip` and `match` requests. Returns additional data about each
|
||||
coordinate along the selected/matched route line per `RouteLeg`:
|
||||
- duration of each segment
|
||||
- distance of each segment
|
||||
- OSM node ids of all segment endpoints
|
||||
- Introducing Intersections for Route Steps. This changes the API format in multiple ways.
|
||||
- `bearing_before`/`bearing_after` of `StepManeuver` are now deprecated and will be removed in the next major release
|
||||
- `location` of `StepManeuvers` is now deprecated and will be removed in the next major release
|
||||
- every `RouteStep` now has property `intersections` containing a list of `Intersection` objects.
|
||||
- Support for destination signs. New member `destinations` in `RouteStep`, based on `destination` and `destination:ref`
|
||||
- Support for name pronunciations. New member `pronunciation` in `RouteStep`, based on `name:pronunciation`
|
||||
|
||||
- Profile changes:
|
||||
- duration parser now accepts P[n]DT[n]H[n]M[n]S, P[n]W, PTHHMMSS and PTHH:MM:SS ISO8601 formats.
|
||||
- `result.destinations` allows you to set a way's destinations
|
||||
- `result.pronunciation` allows you to set way name pronunciations
|
||||
- `highway=motorway_link` no longer implies `oneway` as per the OSM Wiki
|
||||
|
||||
- Infrastructure:
|
||||
- BREAKING: Changed the on-disk encoding of the StaticRTree to reduce ramIndex file size. This breaks the **data format**
|
||||
- BREAKING: Intersection Classification adds a new file to the mix (osrm.icd). This breaks the fileformat for older versions.
|
||||
- Better support for osrm-routed binary upgrade on the fly [UNIX specific]:
|
||||
- Open sockets with SO_REUSEPORT to allow multiple osrm-routed processes serving requests from the same port.
|
||||
- Add SIGNAL_PARENT_WHEN_READY environment variable to enable osrm-routed signal its parent with USR1 when it's running and waiting for requests.
|
||||
- Disable http access logging via DISABLE_ACCESS_LOGGING environment variable.
|
||||
|
||||
- Guidance:
|
||||
- BREAKING: modifies the file format with new internal identifiers
|
||||
- improved detection of turning streets, not reporting new-name in wrong situations
|
||||
- improved handling of sliproads (emit turns instead of 'take the ramp')
|
||||
- improved collapsing of instructions. Some 'new name' instructions will be suppressed if they are without alternative and the segment is short
|
||||
|
||||
- Bugfixes
|
||||
- fixed broken summaries for very short routes
|
||||
|
||||
# 5.2.0 RC2
|
||||
Changes from 5.2.0 RC1
|
||||
|
||||
- Guidance:
|
||||
- improved handling of sliproads (emit turns instead of 'take the ramp')
|
||||
- improved collapsing of instructions. Some 'new name' instructions will be suppressed if they are without alternative and the segment is short
|
||||
- BREAKING: modifies the file format with new internal identifiers
|
||||
|
||||
- API:
|
||||
- paramater `annotate` was renamed to `annotations`.
|
||||
- `annotation` as accidentally placed in `Route` instead of `RouteLeg`
|
||||
- Support for destination signs. New member `destinations` in `RouteStep`, based on `destination` and `destination:ref`
|
||||
- Support for name pronunciations. New member `pronunciation` in `RouteStep`, based on `name:pronunciation`
|
||||
- Add `nodes` property to `annotation` in `RouteLeg` containing the ids of nodes covered by the route
|
||||
|
||||
- Profile changes:
|
||||
- `result.destinations` allows you to set a way's destinations
|
||||
- `result.pronunciation` allows you to set way name pronunciations
|
||||
- `highway=motorway_link` no longer implies `oneway` as per the OSM Wiki
|
||||
|
||||
- Infrastructure
|
||||
- BREAKING: Changed the on-disk encoding of the StaticRTree to reduce ramIndex file size. This breaks the **data format**
|
||||
|
||||
- Bugfixes
|
||||
- fixed broken summaries for very short routes
|
||||
|
||||
# 5.2.0 RC1
|
||||
Changes from 5.1.0
|
||||
|
||||
- API:
|
||||
- new parameter `annotate` for `route` and `match` requests. Returns additional data about each
|
||||
coordinate along the selected/matched route line.
|
||||
- Introducing Intersections for Route Steps. This changes the API format in multiple ways.
|
||||
- `bearing_before`/`bearing_after` of `StepManeuver` are now deprecated and will be removed in the next major release
|
||||
- `location` of `StepManeuvers` is now deprecated and will be removed in the next major release
|
||||
- every `RouteStep` now has property `intersections` containing a list of `Intersection` objects.
|
||||
|
||||
- Profile changes:
|
||||
- duration parser now accepts P[n]DT[n]H[n]M[n]S, P[n]W, PTHHMMSS and PTHH:MM:SS ISO8601 formats.
|
||||
|
||||
- Infrastructure:
|
||||
- Better support for osrm-routed binary upgrade on the fly [UNIX specific]:
|
||||
- Open sockets with SO_REUSEPORT to allow multiple osrm-routed processes serving requests from the same port.
|
||||
- Add SIGNAL_PARENT_WHEN_READY environment variable to enable osrm-routed signal its parent with USR1 when it's running and waiting for requests.
|
||||
- BREAKING: Intersection Classification adds a new file to the mix (osrm.icd). This breaks the fileformat for older versions.
|
||||
- Disable http access logging via DISABLE_ACCESS_LOGGING environment
|
||||
variable.
|
||||
|
||||
- Guidance:
|
||||
- improved detection of turning streets, not reporting new-name in wrong situations
|
||||
|
||||
# 5.1.0
|
||||
Changes with regard to 5.0.0
|
||||
|
||||
- API:
|
||||
- added StepManeuver type `roundabout turn`. The type indicates a small roundabout that is treated as an intersection
|
||||
(turn right at the roundabout for first exit, go straight at the roundabout...)
|
||||
- added StepManeuver type `on ramp` and `off ramp` to distinguish between ramps that enter and exit a highway.
|
||||
- reduced new name instructions for trivial changes
|
||||
- combined multiple turns into a single instruction at segregated roads`
|
||||
|
||||
- Profile Changes:
|
||||
- introduced a suffix_list / get_name_suffix_list to specify name suffices to be suppressed in name change announcements
|
||||
- street names are now consistently assembled for the car, bike and walk profile as: "Name (Ref)" as in "Berlin (A5)"
|
||||
- new `car.lua` dependency `lib/destination.lua`
|
||||
- register a way's .nodes() function for use in the profile's way_function.
|
||||
|
||||
- Infrastructure
|
||||
- BREAKING: reordered internal instruction types. This breaks the **data format**
|
||||
- BREAKING: Changed the on-disk encoding of the StaticRTree for better performance. This breaks the **data format**
|
||||
|
||||
- Fixes:
|
||||
- Issue #2310: post-processing for local paths, fixes #2310
|
||||
- Issue #2309: local path looping, fixes #2309
|
||||
- Issue #2356: Make hint values optional
|
||||
- Issue #2349: Segmentation fault in some requests
|
||||
- Issue #2335: map matching was using shortest path with uturns disabled
|
||||
- Issue #2193: Fix syntax error position indicators in parameters queries
|
||||
- Fix search with u-turn
|
||||
- PhantomNode packing in MSVC now the same on other platforms
|
||||
- Summary is now not malformed when including unnamed roads
|
||||
- Emit new-name on when changing fron unanmed road to named road
|
||||
|
||||
# 5.0.0
|
||||
Changes with regard 5.0.0 RC2:
|
||||
- API:
|
||||
- if `geometry=geojson` is passed the resulting geometry can be a LineString or Point
|
||||
depending on how many coordinates are present.
|
||||
- the removal of the summary field was revered. for `steps=flase` the field will always be an empty string.
|
||||
|
||||
Changes with regard to 4.9.1:
|
||||
- API:
|
||||
- BREAKING: Complete rewrite of the HTTP and library API. See detailed documentation in the wiki.
|
||||
- BREAKING: The default coordinate order is now `longitude, latidue`. Exception: Polyline geometry
|
||||
which follow the original Google specification of `latitdue, longitude`.
|
||||
- BREAKING: Polyline geometries now use precision 5, instead of previously 6
|
||||
- BREAKING: Removed GPX support
|
||||
- New service `tile` which serves debug vector tiles of the road network
|
||||
- Completely new engine for guidance generation:
|
||||
- Support for highway ramps
|
||||
- Support for different intersection types (end of street, forks, merges)
|
||||
- Instruction post-processing to merge unimportant instructions
|
||||
- Improved handling of roundabouts
|
||||
|
||||
- Tools:
|
||||
- BREAKING: Renamed osrm-prepare to osrm-contract
|
||||
- BREAKING: Removes profiles from osrm-contract, only needed in osrm-extract.
|
||||
- Abort processing in osrm-extract if there are no snappable edges remaining.
|
||||
- Added .properties file to osrm-extract ouput.
|
||||
- Enables the use of multiple segment-speed-files on the osrm-contract command line
|
||||
|
||||
- Profile changes:
|
||||
- Remove movable bridge mode
|
||||
- Add `maxspeed=none` tag to car profile.
|
||||
- A `side_road` tag support for the OSRM car profile.
|
||||
|
||||
- Fixes:
|
||||
- Issue #2150: Prevents routing over delivery ways and nodes
|
||||
- Issue #1972: Provide uninstall target
|
||||
- Issue #2072: Disable alternatives by default and if core factor < 1.0
|
||||
- Issue #1999: Fix unpacking for self-loop nodes not in core.
|
||||
|
||||
- Infrastructure:
|
||||
- Cucumber test suit is now based on cucumber-js, removes Ruby as dependency
|
||||
- Updated to mapbox/variant v1.1
|
||||
- Updated to libosmium v2.6.1
|
||||
- Remove GeoJSON based debugging output, replaced by debug tiles
|
||||
|
||||
|
||||
# 5.0.0 RC2
|
||||
- Profiles:
|
||||
- `properties.allow_uturns_at_via` -> `properties.continue_straight_at_waypoint` (value is inverted!)
|
||||
- API:
|
||||
- Removed summary from legs property
|
||||
- Disable steps and alternatives by default
|
||||
- Fix `code` field: 'ok' -> 'Ok'
|
||||
- Allow 4.json and 4.3.json format
|
||||
- Conform to v5 spec and support "unlimited" as radiuses value.
|
||||
- `uturns` parameter was replaced by `continue_straight` (value is inverted!)
|
||||
- Features:
|
||||
- Report progress for gennerating edge expanded edges in the edge based graph factory
|
||||
- Add maxspeed=none tag to car profile.
|
||||
- Optimize StaticRTree code: speedup 2x (to RC1)
|
||||
- Optimize DouglasPeucker code: speedup 10x (to RC1)
|
||||
- Optimize WebMercator projection: speedup 2x (to RC1)
|
||||
- Bugs:
|
||||
- #2195: Resolves issues with multiple includedirs in pkg-config file
|
||||
- #2219: Internal server error when using the match plugin
|
||||
- #2027: basename -> filename
|
||||
- #2168: Report correct position where parsing failed
|
||||
- #2036: Add license to storage and storage config exposed in public API
|
||||
- Fix uturn detection in match plugin
|
||||
- Add missing -lz to fix linking of server-tests
|
||||
|
||||
# 5.0.0 RC1
|
||||
- Renamed osrm-prepare into osrm-contract
|
||||
- osrm-contract does not need a profile parameter anymore
|
||||
- New public HTTP API, find documentation [here](https://github.com/Project-OSRM/osrm-backend/wiki/New-Server-api)
|
||||
- POST support is discontinued, please use library bindings for more complex requests
|
||||
- Removed timestamp plugin
|
||||
- Coordinate order is now Longitude,Latitude
|
||||
- Cucumber tests now based on Javascript (run with `npm test`)
|
||||
- Profile API changed:
|
||||
- `forward_mode` and `backward_mode` now need to be selected from a pre-defined list
|
||||
- Global profile properties are now stored in a global `properties` element. This includes:
|
||||
- `properties.traffic_signal_penalty`
|
||||
- `properties.use_turn_restrictions`
|
||||
- `properties.u_turn_penalty`
|
||||
- `properties.allow_u_turn_at_via`
|
||||
|
||||
|
||||
@@ -1,735 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
# we depend on 2.8.11 introducing target_include_directories
|
||||
|
||||
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
|
||||
message(FATAL_ERROR "In-source builds are not allowed.
|
||||
Please create a directory and run cmake from there, passing the path to this source directory as the last argument.
|
||||
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'. Please delete them.")
|
||||
endif()
|
||||
|
||||
# detect if this is included as subproject and if so expose
|
||||
# some variables to its parent scope
|
||||
get_directory_property(BUILD_AS_SUBPROJECT PARENT_DIRECTORY)
|
||||
if(BUILD_AS_SUBPROJECT)
|
||||
message(STATUS "Building libosrm as subproject.")
|
||||
endif()
|
||||
|
||||
option(ENABLE_MASON "Use mason for dependencies" OFF)
|
||||
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
|
||||
option(BUILD_TOOLS "Build OSRM tools" OFF)
|
||||
option(BUILD_COMPONENTS "Build osrm-components" OFF)
|
||||
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
|
||||
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
|
||||
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
|
||||
option(ENABLE_LTO "Use LTO if available" ON)
|
||||
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
|
||||
option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON)
|
||||
|
||||
if(ENABLE_MASON)
|
||||
# versions in use
|
||||
set(MASON_BOOST_VERSION "1.61.0")
|
||||
set(MASON_STXXL_VERSION "1.4.1")
|
||||
set(MASON_EXPAT_VERSION "2.2.0")
|
||||
set(MASON_LUA_VERSION "5.2.4")
|
||||
set(MASON_LUABIND_VERSION "e414c57bcb687bb3091b7c55bbff6947f052e46b")
|
||||
set(MASON_BZIP2_VERSION "1.0.6")
|
||||
set(MASON_TBB_VERSION "43_20150316")
|
||||
|
||||
message(STATUS "Enabling mason")
|
||||
|
||||
find_program(CURL_FOUND curl)
|
||||
if(NOT CURL_FOUND)
|
||||
message(FATAL_ERROR "curl command required with -DENABLE_MASON")
|
||||
endif()
|
||||
|
||||
set(MASON_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/third_party/mason/mason)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/third_party/mason/mason.cmake)
|
||||
endif()
|
||||
|
||||
# be compatible with version handling before cmake 3.x
|
||||
if (POLICY CMP0048)
|
||||
cmake_policy(SET CMP0048 OLD)
|
||||
endif()
|
||||
project(OSRM C CXX)
|
||||
set(OSRM_VERSION_MAJOR 5)
|
||||
set(OSRM_VERSION_MINOR 5)
|
||||
set(OSRM_VERSION_PATCH 0)
|
||||
set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}")
|
||||
|
||||
# these two functions build up custom variables:
|
||||
# DEPENDENCIES_INCLUDE_DIRS and OSRM_DEFINES
|
||||
# These variables we want to pass to
|
||||
# include_directories and add_definitions for both
|
||||
# this build and for sharing externally via pkg-config
|
||||
|
||||
function(add_dependency_includes includes)
|
||||
list(APPEND DEPENDENCIES_INCLUDE_DIRS "${includes}")
|
||||
set(DEPENDENCIES_INCLUDE_DIRS "${DEPENDENCIES_INCLUDE_DIRS}" PARENT_SCOPE)
|
||||
endfunction(add_dependency_includes)
|
||||
|
||||
function(add_dependency_defines defines)
|
||||
list(APPEND OSRM_DEFINES "${defines}")
|
||||
set(OSRM_DEFINES "${OSRM_DEFINES}" PARENT_SCOPE)
|
||||
endfunction(add_dependency_defines)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
set(bitness 32)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(bitness 64)
|
||||
message(STATUS "Building on a 64 bit system")
|
||||
else()
|
||||
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()
|
||||
|
||||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
||||
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
|
||||
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/)
|
||||
|
||||
add_custom_target(FingerPrintConfigure ALL ${CMAKE_COMMAND}
|
||||
"-DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"-DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/FingerPrint-Config.cmake"
|
||||
COMMENT "Configuring revision fingerprint"
|
||||
VERBATIM)
|
||||
|
||||
set(BOOST_COMPONENTS date_time chrono filesystem iostreams program_options regex system thread unit_test_framework)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/util/version.hpp.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/util/version.hpp
|
||||
)
|
||||
file(GLOB UtilGlob src/util/*.cpp src/util/*/*.cpp)
|
||||
file(GLOB ExtractorGlob src/extractor/*.cpp src/extractor/*/*.cpp)
|
||||
file(GLOB ContractorGlob src/contractor/*.cpp)
|
||||
file(GLOB StorageGlob src/storage/*.cpp)
|
||||
file(GLOB ServerGlob src/server/*.cpp src/server/**/*.cpp)
|
||||
file(GLOB EngineGlob src/engine/*.cpp src/engine/**/*.cpp)
|
||||
|
||||
add_library(UTIL OBJECT ${UtilGlob})
|
||||
add_library(EXTRACTOR OBJECT ${ExtractorGlob})
|
||||
add_library(CONTRACTOR OBJECT ${ContractorGlob})
|
||||
add_library(STORAGE OBJECT ${StorageGlob})
|
||||
add_library(ENGINE OBJECT ${EngineGlob})
|
||||
add_library(SERVER OBJECT ${ServerGlob})
|
||||
|
||||
add_dependencies(UTIL FingerPrintConfigure)
|
||||
set_target_properties(UTIL PROPERTIES LINKER_LANGUAGE CXX)
|
||||
|
||||
add_executable(osrm-extract src/tools/extract.cpp)
|
||||
add_executable(osrm-contract src/tools/contract.cpp)
|
||||
add_executable(osrm-routed src/tools/routed.cpp $<TARGET_OBJECTS:SERVER> $<TARGET_OBJECTS:UTIL>)
|
||||
add_executable(osrm-datastore src/tools/store.cpp $<TARGET_OBJECTS:UTIL>)
|
||||
add_library(osrm src/osrm/osrm.cpp $<TARGET_OBJECTS:ENGINE> $<TARGET_OBJECTS:UTIL> $<TARGET_OBJECTS:STORAGE>)
|
||||
add_library(osrm_extract $<TARGET_OBJECTS:EXTRACTOR> $<TARGET_OBJECTS:UTIL>)
|
||||
add_library(osrm_contract $<TARGET_OBJECTS:CONTRACTOR> $<TARGET_OBJECTS:UTIL>)
|
||||
add_library(osrm_store $<TARGET_OBJECTS:STORAGE> $<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_EXE_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
|
||||
# on the command line. Without this, cmake defaults to an unoptimized,
|
||||
# non-debug build, which almost nobody wants.
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
message(STATUS "No build type specified, defaulting to Release")
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
message(STATUS "Configuring OSRM in debug mode")
|
||||
elseif(CMAKE_BUILD_TYPE MATCHES Release)
|
||||
message(STATUS "Configuring OSRM in release mode")
|
||||
elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
||||
message(STATUS "Configuring OSRM in release mode with debug flags")
|
||||
elseif(CMAKE_BUILD_TYPE MATCHES MinRelSize)
|
||||
message(STATUS "Configuring OSRM in release mode with minimized size")
|
||||
else()
|
||||
message(STATUS "Unrecognized build type - will use cmake defaults")
|
||||
endif()
|
||||
|
||||
# Additional logic for the different build types
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
||||
message(STATUS "Configuring debug mode flags")
|
||||
set(ENABLE_ASSERTIONS ON)
|
||||
if(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-inline -fno-omit-frame-pointer")
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ggdb")
|
||||
else()
|
||||
# Don't override the -O parameter for RelWithDebInfo, we want an optimized build
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
||||
message(STATUS "Configuring release mode optimizations")
|
||||
# Check if LTO is available
|
||||
check_cxx_compiler_flag("-Wl,-flto" LTO_AVAILABLE)
|
||||
|
||||
if(ENABLE_LTO AND LTO_AVAILABLE)
|
||||
set(OLD_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
# GCC in addition allows parallelizing LTO
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "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}" STREQUAL "GNU" AND
|
||||
NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9.0" 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.")
|
||||
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}" STREQUAL "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()
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9.0")
|
||||
message(STATUS "Disabling LTO on GCC < 4.9.0 since it is broken, see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57038")
|
||||
set(CMAKE_CXX_FLAGS "${OLD_CXX_FLAGS}")
|
||||
set(ENABLE_LTO Off)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE AND ENABLE_MASON AND (LTO_WORKS OR ENABLE_GOLD_LINKER))
|
||||
message(WARNING "ENABLE_MASON and ENABLE_LTO/ENABLE_GOLD_LINKER may not work on all linux systems currently")
|
||||
message(WARNING "For more details see: https://github.com/Project-OSRM/osrm-backend/issues/3202")
|
||||
endif()
|
||||
|
||||
set(MAYBE_COVERAGE_LIBRARIES "")
|
||||
if (ENABLE_COVERAGE)
|
||||
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
message(ERROR "ENABLE_COVERAGE=ON only make sense with a Debug build")
|
||||
endif()
|
||||
message(INFO "Enabling coverage")
|
||||
set(MAYBE_COVERAGE_LIBRARIES "-lgcov")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs")
|
||||
endif()
|
||||
if (ENABLE_SANITIZER)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
|
||||
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -fsanitize=address")
|
||||
endif()
|
||||
|
||||
# Configuring compilers
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wuninitialized -Wunreachable-code -Wstrict-overflow=2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC -fcolor-diagnostics")
|
||||
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
||||
set(COLOR_FLAG "-fdiagnostics-color=auto")
|
||||
check_cxx_compiler_flag("-fdiagnostics-color=auto" HAS_COLOR_FLAG)
|
||||
if(NOT HAS_COLOR_FLAG)
|
||||
set(COLOR_FLAG "")
|
||||
endif()
|
||||
# using GCC
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wuninitialized -Wunreachable-code -Wstrict-overflow=1 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ${COLOR_FLAG} -fPIC")
|
||||
if(WIN32) # using mingw
|
||||
add_dependency_defines(-DWIN32)
|
||||
set(OPTIONAL_SOCKET_LIBS ws2_32 wsock32)
|
||||
endif()
|
||||
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
|
||||
# using Intel C++
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-intel -wd10237 -Wall -ipo -fPIC")
|
||||
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
||||
# using Visual Studio C++
|
||||
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} zlib)
|
||||
add_dependency_defines(-DBOOST_LIB_DIAGNOSTIC)
|
||||
add_dependency_defines(-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_dependency_defines(-DNOMINMAX) # avoid min and max macros that can break compilation
|
||||
add_dependency_defines(-D_USE_MATH_DEFINES) #needed for M_PI with cmath.h
|
||||
add_dependency_defines(-D_WIN32_WINNT=0x0501)
|
||||
add_dependency_defines(-DXML_STATIC)
|
||||
find_library(ws2_32_LIBRARY_PATH ws2_32)
|
||||
target_link_libraries(osrm-extract wsock32 ws2_32)
|
||||
endif()
|
||||
|
||||
# Configuring linker
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} "-Wl,--version" ERROR_QUIET OUTPUT_VARIABLE LINKER_VERSION)
|
||||
# For ld.gold and ld.bfs (the GNU linkers) we optimize hard
|
||||
if("${LINKER_VERSION}" MATCHES "GNU gold" OR "${LINKER_VERSION}" MATCHES "GNU ld")
|
||||
message(STATUS "Setting linker optimizations")
|
||||
if(NOT (${CMAKE_CXX_COMPILER_ID} STREQUAL "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()
|
||||
# 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} STREQUAL "MSVC")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
|
||||
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -std=c++1y")
|
||||
endif()
|
||||
|
||||
# Configuring other platform dependencies
|
||||
if(APPLE)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10")
|
||||
execute_process(COMMAND xcrun --sdk macosx --show-sdk-path OUTPUT_VARIABLE CMAKE_OSX_SYSROOT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(CMAKE_OSX_ARCHITECTURES "x86_64")
|
||||
message(STATUS "Set Architecture to x64 on OS X")
|
||||
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()
|
||||
|
||||
# Disallow deprecated protozero APIs
|
||||
add_definitions(-DPROTOZERO_STRICT_API)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
# if mason is enabled no find_package calls are made
|
||||
# to ensure that we are only compiling and linking against
|
||||
# fully portable mason packages
|
||||
if(ENABLE_MASON)
|
||||
message(STATUS "Installing dependencies via mason")
|
||||
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
mason_use(boost VERSION ${MASON_BOOST_VERSION} HEADER_ONLY)
|
||||
add_dependency_includes(${MASON_PACKAGE_boost_INCLUDE_DIRS})
|
||||
mason_use(boost_libfilesystem VERSION ${MASON_BOOST_VERSION})
|
||||
set(Boost_FILESYSTEM_LIBRARY ${MASON_PACKAGE_boost_libfilesystem_STATIC_LIBS})
|
||||
mason_use(boost_libiostreams VERSION ${MASON_BOOST_VERSION})
|
||||
set(Boost_IOSTREAMS_LIBRARY ${MASON_PACKAGE_boost_libiostreams_STATIC_LIBS})
|
||||
mason_use(boost_libprogram_options VERSION ${MASON_BOOST_VERSION})
|
||||
set(Boost_PROGRAM_OPTIONS_LIBRARY ${MASON_PACKAGE_boost_libprogram_options_STATIC_LIBS})
|
||||
mason_use(boost_libregex VERSION ${MASON_BOOST_VERSION})
|
||||
set(Boost_REGEX_LIBRARY ${MASON_PACKAGE_boost_libregex_STATIC_LIBS})
|
||||
mason_use(boost_libtest VERSION ${MASON_BOOST_VERSION})
|
||||
set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY ${MASON_PACKAGE_boost_libtest_STATIC_LIBS})
|
||||
mason_use(boost_libdate_time VERSION ${MASON_BOOST_VERSION})
|
||||
set(Boost_DATE_TIME_LIBRARY ${MASON_PACKAGE_boost_libdate_time_STATIC_LIBS})
|
||||
mason_use(boost_libthread VERSION ${MASON_BOOST_VERSION})
|
||||
set(Boost_THREAD_LIBRARY ${MASON_PACKAGE_boost_libthread_STATIC_LIBS})
|
||||
mason_use(boost_libsystem VERSION ${MASON_BOOST_VERSION})
|
||||
set(Boost_SYSTEM_LIBRARY ${MASON_PACKAGE_boost_libsystem_STATIC_LIBS})
|
||||
|
||||
mason_use(stxxl VERSION ${MASON_STXXL_VERSION})
|
||||
add_dependency_includes(${MASON_PACKAGE_stxxl_INCLUDE_DIRS})
|
||||
set(STXXL_LIBRARY ${MASON_PACKAGE_stxxl_STATIC_LIBS})
|
||||
|
||||
mason_use(expat VERSION ${MASON_EXPAT_VERSION})
|
||||
add_dependency_includes(${MASON_PACKAGE_expat_INCLUDE_DIRS})
|
||||
set(EXPAT_LIBRARIES ${MASON_PACKAGE_expat_STATIC_LIBS})
|
||||
|
||||
mason_use(lua VERSION ${MASON_LUA_VERSION})
|
||||
add_dependency_includes(${MASON_PACKAGE_lua_INCLUDE_DIRS})
|
||||
set(USED_LUA_LIBRARIES ${MASON_PACKAGE_lua_STATIC_LIBS})
|
||||
|
||||
mason_use(luabind_lua524 VERSION ${MASON_LUABIND_VERSION})
|
||||
add_dependency_includes(${MASON_PACKAGE_luabind_lua524_INCLUDE_DIRS})
|
||||
set(LUABIND_LIBRARY ${MASON_PACKAGE_luabind_lua524_STATIC_LIBS})
|
||||
|
||||
mason_use(bzip2 VERSION ${MASON_BZIP2_VERSION})
|
||||
add_dependency_includes(${MASON_PACKAGE_bzip2_INCLUDE_DIRS})
|
||||
set(BZIP2_LIBRARIES ${MASON_PACKAGE_bzip2_STATIC_LIBS})
|
||||
|
||||
mason_use(tbb VERSION ${MASON_TBB_VERSION})
|
||||
add_dependency_includes(${MASON_PACKAGE_tbb_INCLUDE_DIRS})
|
||||
set(TBB_LIBRARIES ${MASON_PACKAGE_tbb_LDFLAGS})
|
||||
|
||||
if(NOT MASON_PACKAGE_tbb_LIBRARY_DIRS)
|
||||
message(FATAL_ERROR "MASON_PACKAGE_tbb_LIBRARY_DIRS is empty, rpath will not work")
|
||||
endif()
|
||||
set(TBB_LINKER_RPATHS "")
|
||||
foreach(libpath ${MASON_PACKAGE_tbb_LIBRARY_DIRS})
|
||||
set(TBB_LINKER_RPATHS "${TBB_LINKER_RPATHS} -Wl,-rpath -Wl,${libpath}")
|
||||
file(GLOB TBBGlob ${libpath}/*.*)
|
||||
install(FILES ${TBBGlob} DESTINATION lib)
|
||||
endforeach()
|
||||
if(APPLE)
|
||||
set(LINKER_FLAGS "${TBB_LINKER_RPATHS} -Wl,-rpath -Wl,@executable_path")
|
||||
elseif(UNIX)
|
||||
set(LINKER_FLAGS "${TBB_LINKER_RPATHS} '-Wl,-rpath,$ORIGIN' -Wl,-z,origin")
|
||||
endif()
|
||||
|
||||
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}")
|
||||
|
||||
if(BUILD_COMPONENTS)
|
||||
message(FATAL_ERROR "BUILD_COMPONENTS is not supported with ENABLE_MASON")
|
||||
endif()
|
||||
|
||||
# current mason packages target -D_GLIBCXX_USE_CXX11_ABI=0
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
|
||||
|
||||
# note: we avoid calling find_package(Osmium ...) here to ensure that the
|
||||
# expat and bzip2 are used from mason rather than the system
|
||||
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include)
|
||||
|
||||
else()
|
||||
|
||||
find_package(Boost 1.49.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
add_dependency_includes(${Boost_INCLUDE_DIRS})
|
||||
|
||||
find_package(TBB REQUIRED)
|
||||
add_dependency_includes(${TBB_INCLUDE_DIR})
|
||||
if(WIN32 AND CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(TBB_LIBRARIES ${TBB_DEBUG_LIBRARIES})
|
||||
endif()
|
||||
find_package(Luabind REQUIRED)
|
||||
add_dependency_includes(${LUABIND_INCLUDE_DIR})
|
||||
set(USED_LUA_LIBRARIES ${LUA_LIBRARY})
|
||||
add_dependency_includes(${LUA_INCLUDE_DIR})
|
||||
|
||||
find_package(EXPAT REQUIRED)
|
||||
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
|
||||
|
||||
find_package(STXXL REQUIRED)
|
||||
add_dependency_includes(${STXXL_INCLUDE_DIR})
|
||||
|
||||
find_package(BZip2 REQUIRED)
|
||||
add_dependency_includes(${BZIP2_INCLUDE_DIR})
|
||||
|
||||
if(BUILD_COMPONENTS)
|
||||
find_package(GDAL)
|
||||
endif()
|
||||
|
||||
# add a target to generate API documentation with Doxygen
|
||||
find_package(Doxygen)
|
||||
if(DOXYGEN_FOUND)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
||||
add_custom_target(doc
|
||||
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating API documentation with Doxygen" VERBATIM
|
||||
)
|
||||
endif()
|
||||
|
||||
# note libosmium depends on expat and bzip2
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/cmake")
|
||||
set(OSMIUM_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include")
|
||||
find_package(Osmium REQUIRED COMPONENTS io)
|
||||
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIR})
|
||||
|
||||
endif()
|
||||
|
||||
# prefix compilation with ccache by default if available and on clang or gcc
|
||||
if(ENABLE_CCACHE AND (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU"))
|
||||
find_program(CCACHE_FOUND ccache)
|
||||
if(CCACHE_FOUND)
|
||||
message(STATUS "Using ccache to speed up incremental builds")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
||||
set(ENV{CCACHE_CPP2} "true")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# even with mason builds we want to link to system zlib
|
||||
# to ensure that osrm binaries play well with other binaries like nodejs
|
||||
find_package(ZLIB REQUIRED)
|
||||
add_dependency_includes(${ZLIB_INCLUDE_DIRS})
|
||||
|
||||
if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS)
|
||||
add_dependency_defines(-DBOOST_TEST_DYN_LINK)
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS)
|
||||
add_dependency_defines(-DBOOST_TEST_DYN_LINK)
|
||||
endif()
|
||||
|
||||
add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3)
|
||||
add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE)
|
||||
add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED)
|
||||
|
||||
set(OpenMP_FIND_QUIETLY ON)
|
||||
find_package(OpenMP)
|
||||
if(OPENMP_FOUND)
|
||||
message(STATUS "OpenMP support found. Linking just in case for stxxl")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
add_definitions(${OSRM_DEFINES})
|
||||
include_directories(SYSTEM ${DEPENDENCIES_INCLUDE_DIRS})
|
||||
|
||||
set(BOOST_BASE_LIBRARIES
|
||||
${Boost_DATE_TIME_LIBRARY}
|
||||
${Boost_CHRONO_LIBRARY}
|
||||
${Boost_FILESYSTEM_LIBRARY}
|
||||
${Boost_IOSTREAMS_LIBRARY}
|
||||
${Boost_THREAD_LIBRARY}
|
||||
${Boost_SYSTEM_LIBRARY})
|
||||
|
||||
set(BOOST_ENGINE_LIBRARIES
|
||||
${Boost_ZLIB_LIBRARY}
|
||||
${Boost_REGEX_LIBRARY}
|
||||
${BOOST_BASE_LIBRARIES})
|
||||
|
||||
# Binaries
|
||||
target_link_libraries(osrm-datastore osrm_store ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||
target_link_libraries(osrm-extract osrm_extract ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||
target_link_libraries(osrm-contract osrm_contract ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||
target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY})
|
||||
|
||||
set(EXTRACTOR_LIBRARIES
|
||||
${BZIP2_LIBRARIES}
|
||||
${Boost_REGEX_LIBRARY}
|
||||
${BOOST_BASE_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${EXPAT_LIBRARIES}
|
||||
${LUABIND_LIBRARY}
|
||||
${USED_LUA_LIBRARIES}
|
||||
${OSMIUM_LIBRARIES}
|
||||
${STXXL_LIBRARY}
|
||||
${TBB_LIBRARIES}
|
||||
${ZLIB_LIBRARY}
|
||||
${MAYBE_COVERAGE_LIBRARIES})
|
||||
set(CONTRACTOR_LIBRARIES
|
||||
${BOOST_BASE_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${LUABIND_LIBRARY}
|
||||
${USED_LUA_LIBRARIES}
|
||||
${STXXL_LIBRARY}
|
||||
${TBB_LIBRARIES}
|
||||
${MAYBE_RT_LIBRARY}
|
||||
${MAYBE_COVERAGE_LIBRARIES})
|
||||
set(ENGINE_LIBRARIES
|
||||
${BOOST_ENGINE_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${TBB_LIBRARIES}
|
||||
${MAYBE_RT_LIBRARY}
|
||||
${MAYBE_COVERAGE_LIBRARIES}
|
||||
${ZLIB_LIBRARY})
|
||||
set(STORAGE_LIBRARIES
|
||||
${BOOST_BASE_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${TBB_LIBRARIES}
|
||||
${MAYBE_RT_LIBRARY}
|
||||
${MAYBE_COVERAGE_LIBRARIES})
|
||||
set(UTIL_LIBRARIES
|
||||
${BOOST_BASE_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${STXXL_LIBRARY}
|
||||
${TBB_LIBRARIES}
|
||||
${MAYBE_COVERAGE_LIBRARIES})
|
||||
# Libraries
|
||||
target_link_libraries(osrm ${ENGINE_LIBRARIES})
|
||||
target_link_libraries(osrm_contract ${CONTRACTOR_LIBRARIES})
|
||||
target_link_libraries(osrm_extract ${EXTRACTOR_LIBRARIES})
|
||||
target_link_libraries(osrm_store ${STORAGE_LIBRARIES})
|
||||
|
||||
if(BUILD_COMPONENTS)
|
||||
if(GDAL_FOUND)
|
||||
add_executable(osrm-components src/tools/components.cpp $<TARGET_OBJECTS:UTIL>)
|
||||
target_link_libraries(osrm-components ${TBB_LIBRARIES})
|
||||
include_directories(SYSTEM ${GDAL_INCLUDE_DIR})
|
||||
target_link_libraries(osrm-components ${GDAL_LIBRARIES} ${BOOST_BASE_LIBRARIES})
|
||||
install(TARGETS osrm-components DESTINATION bin)
|
||||
else()
|
||||
message(WARNING "libgdal and/or development headers not found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BUILD_TOOLS)
|
||||
message(STATUS "Activating OSRM internal tools")
|
||||
add_executable(osrm-io-benchmark src/tools/io-benchmark.cpp $<TARGET_OBJECTS:UTIL>)
|
||||
target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES})
|
||||
add_executable(osrm-unlock-all src/tools/unlock_all_mutexes.cpp $<TARGET_OBJECTS:UTIL>)
|
||||
target_link_libraries(osrm-unlock-all ${BOOST_BASE_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(osrm-unlock-all rt)
|
||||
endif()
|
||||
add_executable(osrm-springclean src/tools/springclean.cpp $<TARGET_OBJECTS:UTIL>)
|
||||
target_link_libraries(osrm-springclean ${BOOST_BASE_LIBRARIES})
|
||||
|
||||
install(TARGETS osrm-io-benchmark DESTINATION bin)
|
||||
install(TARGETS osrm-unlock-all DESTINATION bin)
|
||||
install(TARGETS osrm-springclean DESTINATION bin)
|
||||
endif()
|
||||
|
||||
if (ENABLE_ASSERTIONS)
|
||||
message(STATUS "Enabling assertions")
|
||||
add_definitions(-DBOOST_ENABLE_ASSERT_HANDLER)
|
||||
endif()
|
||||
|
||||
# Add RPATH info to executables so that when they are run after being installed
|
||||
# (i.e., from /usr/local/bin/) the linker can find library dependencies. For
|
||||
# more info see http://www.cmake.org/Wiki/CMake_RPATH_handling
|
||||
set_property(TARGET osrm-extract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
set_property(TARGET osrm-contract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
set_property(TARGET osrm-datastore PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
file(GLOB VariantGlob third_party/variant/*.hpp)
|
||||
file(GLOB LibraryGlob include/osrm/*.hpp)
|
||||
file(GLOB ParametersGlob include/engine/api/*_parameters.hpp)
|
||||
set(EngineHeader include/engine/status.hpp include/engine/engine_config.hpp include/engine/hint.hpp include/engine/bearing.hpp include/engine/phantom_node.hpp)
|
||||
set(UtilHeader include/util/coordinate.hpp include/util/json_container.hpp include/util/typedefs.hpp include/util/strong_typedef.hpp include/util/exception.hpp)
|
||||
set(ExtractorHeader include/extractor/extractor.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp)
|
||||
set(ContractorHeader include/contractor/contractor.hpp include/contractor/contractor_config.hpp)
|
||||
set(StorageHeader include/storage/storage.hpp include/storage/storage_config.hpp)
|
||||
install(FILES ${EngineHeader} DESTINATION include/osrm/engine)
|
||||
install(FILES ${UtilHeader} DESTINATION include/osrm/util)
|
||||
install(FILES ${StorageHeader} DESTINATION include/osrm/storage)
|
||||
install(FILES ${ExtractorHeader} DESTINATION include/osrm/extractor)
|
||||
install(FILES ${ContractorHeader} DESTINATION include/osrm/contractor)
|
||||
install(FILES ${LibraryGlob} DESTINATION include/osrm)
|
||||
install(FILES ${ParametersGlob} DESTINATION include/osrm/engine/api)
|
||||
install(FILES ${VariantGlob} DESTINATION include/variant)
|
||||
install(TARGETS osrm-extract DESTINATION bin)
|
||||
install(TARGETS osrm-contract DESTINATION bin)
|
||||
install(TARGETS osrm-datastore DESTINATION bin)
|
||||
install(TARGETS osrm-routed DESTINATION bin)
|
||||
install(TARGETS osrm DESTINATION lib)
|
||||
install(TARGETS osrm_extract DESTINATION lib)
|
||||
install(TARGETS osrm_contract DESTINATION lib)
|
||||
install(TARGETS osrm_store DESTINATION lib)
|
||||
|
||||
# Setup exporting variables for pkgconfig and subproject
|
||||
#
|
||||
|
||||
if(BUILD_DEBIAN_PACKAGE)
|
||||
include(CPackDebianConfig)
|
||||
include(CPack)
|
||||
endif()
|
||||
|
||||
function(JOIN VALUES GLUE OUTPUT)
|
||||
string (REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}")
|
||||
set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
JOIN("${OSRM_DEFINES}" " " TMP_OSRM_DEFINES)
|
||||
set(LibOSRM_CXXFLAGS "${OSRM_CXXFLAGS} ${TMP_OSRM_DEFINES}")
|
||||
set(LibOSRM_LDFLAGS "${OSRM_LDFLAGS}")
|
||||
|
||||
if(BUILD_AS_SUBPROJECT)
|
||||
set(LibOSRM_CXXFLAGS "${LibOSRM_CXXFLAGS}" PARENT_SCOPE)
|
||||
set(LibOSRM_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include" PARENT_SCOPE)
|
||||
set(LibOSRM_LIBRARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" PARENT_SCOPE)
|
||||
set(LibOSRM_LIBRARIES "osrm" PARENT_SCOPE)
|
||||
set(LibOSRM_DEPENDENT_LIBRARIES "${ENGINE_LIBRARIES}" PARENT_SCOPE)
|
||||
set(LibOSRM_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/osrm"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/third_party"
|
||||
"${DEPENDENCIES_INCLUDE_DIRS}" PARENT_SCOPE)
|
||||
set(LibOSRM_LIBRARY_DIRS "${LibOSRM_LIBRARY_DIR}" PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
# pkgconfig defines
|
||||
set(PKGCONFIG_OSRM_CXXFLAGS "${LibOSRM_CXXFLAGS}")
|
||||
set(PKGCONFIG_OSRM_LDFLAGS "${LibOSRM_LDFLAGS}")
|
||||
set(PKGCONFIG_LIBRARY_DIR "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
set(PKGCONFIG_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
|
||||
|
||||
list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}")
|
||||
list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}/osrm")
|
||||
JOIN("-I${DEPENDENCIES_INCLUDE_DIRS}" " -I" PKGCONFIG_OSRM_INCLUDE_FLAGS)
|
||||
JOIN("${ENGINE_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in libosrm.pc @ONLY)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION lib/pkgconfig)
|
||||
|
||||
# uninstall target
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake)
|
||||
|
||||
|
||||
# Modular build system: each directory registered here provides its own CMakeLists.txt
|
||||
add_subdirectory(unit_tests)
|
||||
add_subdirectory(src/benchmarks)
|
||||
|
||||
if (ENABLE_FUZZING)
|
||||
# Requires libosrm being built with sanitizers; make configurable and default to ubsan
|
||||
set(FUZZ_SANITIZER "undefined" CACHE STRING "Sanitizer to be used for Fuzz testing")
|
||||
set_property(CACHE FUZZ_SANITIZER PROPERTY STRINGS "undefined" "integer" "address" "memory" "thread" "leak")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize-coverage=edge,indirect-calls,8bit-counters -fsanitize=address")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
||||
set(OSRM_LDFLAGS "${OSRM_LDFLAGS} -fsanitize=address")
|
||||
|
||||
message(STATUS "Using -fsanitize=${FUZZ_SANITIZER} for Fuzz testing")
|
||||
|
||||
add_subdirectory(fuzz)
|
||||
endif ()
|
||||
@@ -1,55 +0,0 @@
|
||||
# User
|
||||
|
||||
Before you open a new issue, please search for older ones that cover the same issue.
|
||||
In general "me too" comments/issues are frowned upon.
|
||||
You can add a :+1: emoji to the issue if you want to express interest in this.
|
||||
|
||||
# Developer
|
||||
|
||||
We use `clang-format` version `3.8` to consistently format the code base. There is a helper script under `scripts/format.sh`.
|
||||
|
||||
In general changes that affect the API and/or increase the memory consumption need to be discussed first.
|
||||
Often we don't include changes that would increase the memory consumption a lot if they are not generally usable (e.g. elevation data is a good example).
|
||||
|
||||
## Pull Request
|
||||
|
||||
Every pull-request that changes the API needs to update the docs in `docs/http.md` and add an entry to `CHANGELOG.md`.
|
||||
Breaking changes need to have a BREAKING prefix. See the [releasing documentation](docs/releasing.md) on how this affects the version.
|
||||
|
||||
Early feedback is also important.
|
||||
You will see that a lot of the PR have tags like `[not ready]` or `[wip]`.
|
||||
We like to open PRs as soon as we are starting to work on something to make it visible to the rest of the team.
|
||||
If your work is going in entirely the wrong direction, there is a good chance someone will pick up on this before it is too late.
|
||||
Everyone is encouraged to read PRs of other people and give feedback.
|
||||
|
||||
For every significant code change we require a pull request review before it is merged.
|
||||
If your pull request modifies the API this need to be signed of by a team discussion.
|
||||
This means you will need to find another member of the team with commit access and request a review of your pull request.
|
||||
|
||||
Once your pull request is reviewed you can merge it! If you don't have commit access, ping someone that has commit access.
|
||||
If you do have commit access there are in general two accepted styles to merging:
|
||||
|
||||
1. Make sure the branch is up to date with `master`. Run `git rebase master` to find out.
|
||||
2. Once that is ensured you can either:
|
||||
- Click the nice green merge button (for a non-fast-forward merge)
|
||||
- Merge by hand using a fast-forward merge
|
||||
|
||||
Which merge you prefer is up to personal preference. In general it is recommended to use fast-forward merges because it creates a history that is sequential and easier to understand.
|
||||
|
||||
# Maintainer
|
||||
|
||||
## Doing a release
|
||||
|
||||
There is an in-depth guide around how to push out a release once it is ready [here](docs/releasing.md).
|
||||
|
||||
## The API
|
||||
|
||||
Changes to the API need to be discussed and signed off by the team. Breaking changes even more so than additive changes.
|
||||
|
||||
## Milestones
|
||||
|
||||
If a pull request or an issue is applicable for the current or next milestone, depends on the target version number.
|
||||
Since we use semantic versioning we restrict breaking changes to major releases.
|
||||
After a Release Candidate is released we usually don't change the API anymore if it is not critical.
|
||||
Bigger code changes after a RC was released should also be avoided.
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
PROJECT_NAME = "Project OSRM"
|
||||
PROJECT_BRIEF = "Open Source Routing Machine"
|
||||
BUILTIN_STL_SUPPORT = YES
|
||||
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_PACKAGE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_ANON_NSPACES = YES
|
||||
|
||||
QUIET = YES
|
||||
|
||||
INPUT = @CMAKE_CURRENT_SOURCE_DIR@
|
||||
USE_MDFILE_AS_MAINPAGE = @CMAKE_CURRENT_SOURCE_DIR@/README.md
|
||||
FILE_PATTERNS = *.h *.hpp *.c *.cc *.cpp *.md
|
||||
RECURSIVE = YES
|
||||
|
||||
EXCLUDE = @CMAKE_CURRENT_SOURCE_DIR@/third_party \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/build \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/node_modules \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/unit_tests \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/benchmarks \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/features
|
||||
|
||||
SOURCE_BROWSER = YES
|
||||
|
||||
CLANG_ASSISTED_PARSING = NO
|
||||
|
||||
HTML_COLORSTYLE_HUE = 217
|
||||
HTML_COLORSTYLE_SAT = 71
|
||||
HTML_COLORSTYLE_GAMMA = 50
|
||||
|
||||
GENERATE_TREEVIEW = YES
|
||||
|
||||
HAVE_DOT = @DOXYGEN_DOT_FOUND@
|
||||
CALL_GRAPH = YES
|
||||
CALLER_GRAPH = YES
|
||||
|
||||
DOT_IMAGE_FORMAT = svg
|
||||
INTERACTIVE_SVG = YES
|
||||
DOT_GRAPH_MAX_NODES = 500
|
||||
DOT_TRANSPARENT = YES
|
||||
DOT_MULTI_TARGETS = YES
|
||||
@@ -1,22 +0,0 @@
|
||||
Copyright (c) 2016, Project OSRM contributors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,89 +0,0 @@
|
||||
## About
|
||||
|
||||
The Open Source Routing Machine is a high performance routing engine written in C++11 designed to run on OpenStreetMap data.
|
||||
|
||||
## Current build status
|
||||
|
||||
| build config | status |
|
||||
|:-------------|:-------|
|
||||
| Linux | [](https://travis-ci.org/Project-OSRM/osrm-backend) |
|
||||
| Windows | [](https://ci.appveyor.com/project/DennisOSRM/osrm-backend) |
|
||||
| Coverage | [](https://codecov.io/gh/Project-OSRM/osrm-backend) |
|
||||
|
||||
## Contact
|
||||
|
||||
- IRC: server `irc.oftc.net`, channel: `#osrm` (see: `https://www.oftc.net`, and for a webchat: `https://webchat.oftc.net`)
|
||||
- Mailinglist: `https://lists.openstreetmap.org/listinfo/osrm-talk`
|
||||
|
||||
## Building
|
||||
|
||||
For instructions on how to [build](https://github.com/Project-OSRM/osrm-backend/wiki/Building-OSRM) and [run OSRM](https://github.com/Project-OSRM/osrm-backend/wiki/Running-OSRM), please consult [the Wiki](https://github.com/Project-OSRM/osrm-backend/wiki).
|
||||
|
||||
To quickly try OSRM use our [free and daily updated online service](http://map.project-osrm.org)
|
||||
|
||||
## Documentation
|
||||
|
||||
### Full documentation
|
||||
|
||||
- [osrm-routed HTTP API documentation](docs/http.md)
|
||||
- [libosrm API documentation](docs/libosrm.md)
|
||||
|
||||
### Quick start
|
||||
|
||||
Building OSRM assuming all dependencies are installed:
|
||||
|
||||
```
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build .
|
||||
sudo cmake --build . --target install
|
||||
```
|
||||
|
||||
Loading preparing a dataset and starting the server:
|
||||
|
||||
```
|
||||
osrm-extract data.osm.pbf -p profiles/car.lua
|
||||
osrm-contract data.osrm
|
||||
osrm-routed data.osrm
|
||||
```
|
||||
|
||||
Running a query on your local server:
|
||||
|
||||
```
|
||||
curl http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true&alternatives=true
|
||||
```
|
||||
|
||||
### Running a request against the Demo Server
|
||||
|
||||
First read the [API usage policy](https://github.com/Project-OSRM/osrm-backend/wiki/Api-usage-policy).
|
||||
|
||||
Then run simple query with instructions and alternatives on Berlin:
|
||||
|
||||
```
|
||||
curl https://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true&alternatives=true
|
||||
```
|
||||
|
||||
## References in publications
|
||||
|
||||
When using the code in a (scientific) publication, please cite
|
||||
|
||||
```
|
||||
@inproceedings{luxen-vetter-2011,
|
||||
author = {Luxen, Dennis and Vetter, Christian},
|
||||
title = {Real-time routing with OpenStreetMap data},
|
||||
booktitle = {Proceedings of the 19th ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems},
|
||||
series = {GIS '11},
|
||||
year = {2011},
|
||||
isbn = {978-1-4503-1031-4},
|
||||
location = {Chicago, Illinois},
|
||||
pages = {513--516},
|
||||
numpages = {4},
|
||||
url = {http://doi.acm.org/10.1145/2093973.2094062},
|
||||
doi = {10.1145/2093973.2094062},
|
||||
acmid = {2094062},
|
||||
publisher = {ACM},
|
||||
address = {New York, NY, USA},
|
||||
}
|
||||
```
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// Leaflet extension: Dashed Polyline
|
||||
// [adds dashed optionally dashed lines when using SVG or VML rendering]
|
||||
|
||||
|
||||
// dashed polyline class
|
||||
L.DashedPolyline = L.Polyline.extend({
|
||||
initialize: function(latlngs, options) {
|
||||
L.Polyline.prototype.initialize.call(this, latlngs, options);
|
||||
},
|
||||
|
||||
options: {
|
||||
dashed: true
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// svg rendering
|
||||
L.DashedPolyline = !L.Browser.svg ? L.DashedPolyline : L.DashedPolyline.extend({
|
||||
_updateStyle: function () {
|
||||
L.Polyline.prototype._updateStyle.call(this);
|
||||
if (this.options.stroke) {
|
||||
if (this.options.dashed == true)
|
||||
this._path.setAttribute('stroke-dasharray', '8,6');
|
||||
else
|
||||
this._path.setAttribute('stroke-dasharray', '');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// vml rendering
|
||||
L.DashedPolyline = L.Browser.svg || !L.Browser.vml ? L.DashedPolyline : L.DashedPolyline.extend({
|
||||
_updateStyle: function () {
|
||||
L.Polyline.prototype._updateStyle.call(this);
|
||||
if (this.options.stroke) {
|
||||
if (this.options.dashed == true)
|
||||
this._stroke.dashstyle = "dash";
|
||||
else
|
||||
this._stroke.dashstyle = "solid";
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// Leaflet extension: MouseMarker
|
||||
// [marker class that propagates modifier and button presses]
|
||||
// [currently deactivated: propagation mousemove events]
|
||||
|
||||
|
||||
// extended marker class
|
||||
L.MouseMarker = L.Marker.extend({
|
||||
initialize: function (latlng, options) {
|
||||
L.Marker.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
// _initInteraction: function (){
|
||||
// L.Marker.prototype._initInteraction.apply(this, arguments);
|
||||
// if (this.options.clickable)
|
||||
// L.DomEvent.addListener(this._icon, 'mousemove', this._fireMouseEvent, this);
|
||||
// },
|
||||
|
||||
// _fireMouseEvent: function (e) {
|
||||
// this.fire(e.type, {
|
||||
// latlng: this._map.mouseEventToLatLng(e),
|
||||
// layerPoint: this._map.mouseEventToLayerPoint(e)
|
||||
// });
|
||||
// L.DomEvent.stopPropagation(e);
|
||||
// },
|
||||
|
||||
_onMouseClick: function (e) {
|
||||
L.DomEvent.stopPropagation(e);
|
||||
if (this.dragging && this.dragging.moved()) { return; }
|
||||
this.fire(e.type, {
|
||||
altKey: e.altKey,
|
||||
ctrlKey: e.ctrlKey,
|
||||
shiftKey: e.shiftKey,
|
||||
button: e.button
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM browser detection
|
||||
// [simple detection routines to respect some browser peculiarities]
|
||||
|
||||
|
||||
(function() {
|
||||
var useragent = navigator.userAgent;
|
||||
|
||||
OSRM.Browser = {
|
||||
FF3: useragent.search(/Firefox\/3/),
|
||||
IE6_9: useragent.search(/MSIE (6|7|8|9)/)
|
||||
};
|
||||
}());
|
||||
|
||||
// (runs anonymous function to prevent local variables cluttering global namespace)
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM EventHandler
|
||||
// [adds simple event handling: other classes can derive from this class to acquire custom event handling]
|
||||
|
||||
|
||||
OSRM.EventHandler = function() {
|
||||
this._listeners = {};
|
||||
};
|
||||
|
||||
OSRM.extend( OSRM.EventHandler, {
|
||||
|
||||
// add listener
|
||||
addListener: function(type, listener) {
|
||||
if( this._listeners[type] == undefined)
|
||||
this._listeners[type] = [];
|
||||
this._listeners[type].push(listener);
|
||||
},
|
||||
|
||||
//remove event listener
|
||||
removeListener: function(type, listener) {
|
||||
if( this._listeners[type] != undefined) {
|
||||
for(var i=0; i<this._listeners[type].length; i++)
|
||||
if( this._listeners[type][i] == listener) {
|
||||
this._listeners[type].splice(i,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// fire event
|
||||
fire: function(event) {
|
||||
if( typeof event == "string")
|
||||
event = {type:event};
|
||||
if( !event.target )
|
||||
event.target = this;
|
||||
|
||||
if( !event.type )
|
||||
throw new Error("event object missing type property!");
|
||||
|
||||
if( this._listeners[type] != undefined)
|
||||
for(var listener in this._listeners[event.type])
|
||||
listener.call(this, event);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM GUI functionality
|
||||
// [responsible for all non-routing related GUI behaviour]
|
||||
|
||||
|
||||
OSRM.GUI = {
|
||||
|
||||
// show/hide main-gui
|
||||
toggleMain: function() {
|
||||
// show main-gui
|
||||
if( document.getElementById('main-wrapper').style.left == "-410px" ) {
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="hidden";
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.left="420px";
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.top="5px";
|
||||
|
||||
document.getElementById('blob-wrapper').style.visibility="hidden";
|
||||
document.getElementById('main-wrapper').style.left="5px";
|
||||
if( OSRM.Browser.FF3!=-1 || OSRM.Browser.IE6_9!=-1 ) {
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="visible";
|
||||
}
|
||||
// hide main-gui
|
||||
} else {
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="hidden";
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.left="30px";
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.top="5px";
|
||||
|
||||
document.getElementById('main-wrapper').style.left="-410px";
|
||||
if( OSRM.Browser.FF3!=-1 || OSRM.Browser.IE6_9!=-1 ) {
|
||||
document.getElementById('blob-wrapper').style.visibility="visible";
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="visible";
|
||||
}
|
||||
}
|
||||
|
||||
// execute after animation
|
||||
if( OSRM.Browser.FF3==-1 && OSRM.Browser.IE6_9==-1 ) {
|
||||
document.getElementById('main-wrapper').addEventListener("transitionend", OSRM.GUI.onMainTransitionEnd, false);
|
||||
document.getElementById('main-wrapper').addEventListener("webkitTransitionEnd", OSRM.GUI.onMainTransitionEnd, false);
|
||||
document.getElementById('main-wrapper').addEventListener("oTransitionEnd", OSRM.GUI.onMainTransitionEnd, false);
|
||||
document.getElementById('main-wrapper').addEventListener("MSTransitionEnd", OSRM.GUI.onMainTransitionEnd, false);
|
||||
}
|
||||
},
|
||||
|
||||
// do stuff after main-gui animation finished
|
||||
onMainTransitionEnd: function() {
|
||||
// after hiding main-gui
|
||||
if( document.getElementById('main-wrapper').style.left == "-410px" ) {
|
||||
document.getElementById('blob-wrapper').style.visibility="visible";
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="visible";
|
||||
// after showing main-gui
|
||||
} else {
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="visible";
|
||||
}
|
||||
},
|
||||
|
||||
// show/hide small options bubble
|
||||
toggleOptions: function() {
|
||||
if(document.getElementById('options-box').style.visibility=="visible") {
|
||||
document.getElementById('options-box').style.visibility="hidden";
|
||||
} else {
|
||||
document.getElementById('options-box').style.visibility="visible";
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM JSONP call wrapper
|
||||
// [wrapper for JSONP calls with DOM cleaning, fencing, timout handling]
|
||||
|
||||
|
||||
OSRM.JSONP = {
|
||||
|
||||
// storage to keep track of unfinished JSONP calls
|
||||
fences: {},
|
||||
callbacks: {},
|
||||
timeouts: {},
|
||||
timers: {},
|
||||
|
||||
|
||||
// default callback routines
|
||||
late: function() { /*OSRM.debug.log("[jsonp] reply too late");*/ },
|
||||
empty: function() { /*OSRM.debug.log("[jsonp] empty callback");*/ },
|
||||
|
||||
|
||||
// init JSONP call
|
||||
call: function(source, callback_function, timeout_function, timeout, id, parameters) {
|
||||
// only one active JSONP call per id
|
||||
if (OSRM.JSONP.fences[id] == true)
|
||||
return false;
|
||||
OSRM.JSONP.fences[id] = true;
|
||||
|
||||
// wrap timeout function
|
||||
OSRM.JSONP.timeouts[id] = function(response) {
|
||||
try {
|
||||
timeout_function(response, parameters);
|
||||
} finally {
|
||||
OSRM.JSONP.callbacks[id] = OSRM.JSONP.late; // clean functions
|
||||
OSRM.JSONP.timeouts[id] = OSRM.JSONP.empty;
|
||||
OSRM.JSONP.fences[id] = undefined; // clean fence
|
||||
}
|
||||
|
||||
// OSRM.debug.log("[jsonp] timout handling: "+id);
|
||||
};
|
||||
|
||||
// wrap callback function
|
||||
OSRM.JSONP.callbacks[id] = function(response) {
|
||||
clearTimeout(OSRM.JSONP.timers[id]); // clear timeout timer
|
||||
OSRM.JSONP.timers[id] = undefined;
|
||||
|
||||
try {
|
||||
callback_function(response, parameters); // actual wrapped callback
|
||||
} finally {
|
||||
OSRM.JSONP.callbacks[id] = OSRM.JSONP.empty; // clean functions
|
||||
OSRM.JSONP.timeouts[id] = OSRM.JSONP.late;
|
||||
OSRM.JSONP.fences[id] = undefined; // clean fence
|
||||
}
|
||||
|
||||
// OSRM.debug.log("[jsonp] response handling: "+id);
|
||||
};
|
||||
|
||||
// clean DOM (unfortunately, script elements cannot be reused by all browsers)
|
||||
var jsonp = document.getElementById('jsonp_'+id);
|
||||
if(jsonp)
|
||||
jsonp.parentNode.removeChild(jsonp);
|
||||
|
||||
// add script to DOM
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.id = 'jsonp_'+id;
|
||||
script.src = source + "&json_callback=OSRM.JSONP.callbacks."+id + "&jsonp=OSRM.JSONP.callbacks."+id;
|
||||
document.head.appendChild(script);
|
||||
|
||||
// start timeout timer
|
||||
OSRM.JSONP.timers[id] = setTimeout(OSRM.JSONP.timeouts[id], timeout);
|
||||
|
||||
// OSRM.debug.log("[jsonp] init: "+id);
|
||||
return true;
|
||||
},
|
||||
|
||||
// reset all data
|
||||
reset: function() {
|
||||
OSRM.JSONP.fences = {};
|
||||
OSRM.JSONP.callbacks = {};
|
||||
OSRM.JSONP.timeouts = {};
|
||||
OSRM.JSONP.timers = {};
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM localization
|
||||
// [basic localization options]
|
||||
|
||||
|
||||
OSRM.Localization = {
|
||||
|
||||
// if existing, return localized string -> English string -> input string
|
||||
translate: function(text) {
|
||||
if( OSRM.Localization[OSRM.DEFAULTS.LANGUAGE][text] )
|
||||
return OSRM.Localization[OSRM.DEFAULTS.LANGUAGE][text];
|
||||
else if( OSRM.Localization["en"][text] )
|
||||
return OSRM.Localization["en"][text];
|
||||
else
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
||||
// shorter call to translate function
|
||||
OSRM.loc = OSRM.Localization.translate;
|
||||
|
||||
|
||||
// German language support
|
||||
OSRM.Localization["de"] = {
|
||||
//gui
|
||||
"GUI_START": "Start",
|
||||
"GUI_END": "Ziel",
|
||||
"GUI_RESET": "Reset",
|
||||
"GUI_SEARCH": "Zeigen",
|
||||
"GUI_REVERSE": "Umdrehen",
|
||||
"GUI_OPTIONS": "Optionen",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Unbenannte Straßen hervorheben",
|
||||
"GUI_START_TOOLTIP": "Startposition eingeben",
|
||||
"GUI_END_TOOLTIP": "Zielposition eingeben",
|
||||
"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting by <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder by <a href='http://www.osm.org/'>OSM</a>",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Suchergebnisse",
|
||||
"TIMED_OUT": "Zeitüberschreitung",
|
||||
"NO_RESULTS_FOUND": "Keine Ergebnisse gefunden",
|
||||
"NO_RESULTS_FOUND_SOURCE": "Keine Ergebnisse gefunden für Start",
|
||||
"NO_RESULTS_FOUND_TARGET": "Keine Ergebnisse gefunden für Ziel",
|
||||
// routing
|
||||
"ROUTE_DESCRIPTION": "Routenbeschreibung",
|
||||
"GET_LINK_TO_ROUTE": "Generiere Link",
|
||||
"GENERATE_LINK_TO_ROUTE": "Warte auf Antwort",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "nicht möglich",
|
||||
"GPX_FILE": "GPX Datei",
|
||||
"DISTANCE": "Distanz",
|
||||
"DURATION": "Dauer",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Ihre Route wird berechnet",
|
||||
"NO_ROUTE_FOUND": "Keine Route hierher möglich",
|
||||
// directions
|
||||
"N": "Norden",
|
||||
"O": "Ost",
|
||||
"S": "Süden",
|
||||
"W": "Westen",
|
||||
"NO": "Nordost",
|
||||
"SO": "Südost",
|
||||
"SW": "Südwest",
|
||||
"NW": "Nordwest"
|
||||
};
|
||||
|
||||
|
||||
// English language support
|
||||
OSRM.Localization["en"] = {
|
||||
//gui
|
||||
"GUI_START": "Start",
|
||||
"GUI_END": "End",
|
||||
"GUI_RESET": " Reset ",
|
||||
"GUI_SEARCH": " Show ",
|
||||
"GUI_REVERSE": "Reverse",
|
||||
"GUI_OPTIONS": "Options",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Highlight unnamed streets",
|
||||
"GUI_START_TOOLTIP": "Enter start",
|
||||
"GUI_END_TOOLTIP": "Enter destination",
|
||||
"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting by <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder by <a href='http://www.osm.org/'>OSM</a>",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Search Results",
|
||||
"TIMED_OUT": "Timed Out",
|
||||
"NO_RESULTS_FOUND": "No results found",
|
||||
"NO_RESULTS_FOUND_SOURCE": "No results found for start",
|
||||
"NO_RESULTS_FOUND_TARGET": "No results found for end",
|
||||
//routing
|
||||
"ROUTE_DESCRIPTION": "Route Description",
|
||||
"GET_LINK_TO_ROUTE": "Generate Link",
|
||||
"GENERATE_LINK_TO_ROUTE": "waiting for link",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "not available",
|
||||
"GPX_FILE": "GPX File",
|
||||
"DISTANCE": "Distance",
|
||||
"DURATION": "Duration",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Your route is being computed",
|
||||
"NO_ROUTE_FOUND": "No route possible",
|
||||
// directions
|
||||
"N": "north",
|
||||
"E": "east",
|
||||
"S": "south",
|
||||
"W": "west",
|
||||
"NE": "northeast",
|
||||
"SE": "southeast",
|
||||
"SW": "southwest",
|
||||
"NW": "northwest"
|
||||
};
|
||||
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM markers
|
||||
// [base marker class, derived highlight marker and route marker classes, marker management]
|
||||
|
||||
|
||||
// base marker class (wraps Leaflet markers)
|
||||
OSRM.Marker = function( label, style, position ) {
|
||||
this.label = label ? label : "marker";
|
||||
this.position = position ? position : new L.LatLng(0,0);
|
||||
|
||||
this.marker = new L.MouseMarker( this.position, style );
|
||||
this.marker.parent = this;
|
||||
|
||||
this.shown = false;
|
||||
this.hint = null;
|
||||
};
|
||||
OSRM.extend( OSRM.Marker,{
|
||||
show: function() {
|
||||
OSRM.G.map.addLayer(this.marker);
|
||||
this.shown = true;
|
||||
},
|
||||
hide: function() {
|
||||
OSRM.G.map.removeLayer(this.marker);
|
||||
this.shown = false;
|
||||
},
|
||||
setPosition: function( position ) {
|
||||
this.position = position;
|
||||
this.marker.setLatLng( position );
|
||||
this.hint = null;
|
||||
},
|
||||
getPosition: function() {
|
||||
return this.position;
|
||||
},
|
||||
getLat: function() {
|
||||
return this.position.lat;
|
||||
},
|
||||
getLng: function() {
|
||||
return this.position.lng;
|
||||
},
|
||||
isShown: function() {
|
||||
return this.shown;
|
||||
},
|
||||
centerView: function(zoom) {
|
||||
if( zoom == undefined )
|
||||
zoom = OSRM.DEFAULTS.ZOOM_LEVEL;
|
||||
OSRM.G.map.setView( new L.LatLng( this.position.lat, this.position.lng), zoom);
|
||||
},
|
||||
toString: function() {
|
||||
return "OSRM.Marker: \""+this.label+"\", "+this.position+")";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// highlight marker class (cannot be dragged)
|
||||
OSRM.HighlightMarker = function( label, style, position) {
|
||||
OSRM.HighlightMarker.prototype.base.constructor.apply( this, arguments );
|
||||
this.label = label ? label : "highlight_marker";
|
||||
|
||||
this.marker.on( 'click', this.onClick );
|
||||
};
|
||||
OSRM.inheritFrom( OSRM.HighlightMarker, OSRM.Marker );
|
||||
OSRM.extend( OSRM.HighlightMarker, {
|
||||
toString: function() {
|
||||
return "OSRM.HighlightMarker: \""+this.label+"\", "+this.position+")";
|
||||
},
|
||||
onClick: function(e) {
|
||||
this.parent.hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// route marker class (draggable, invokes route drawing routines)
|
||||
OSRM.RouteMarker = function ( label, style, position ) {
|
||||
OSRM.RouteMarker.prototype.base.constructor.apply( this, arguments );
|
||||
this.label = label ? label : "route_marker";
|
||||
|
||||
this.marker.on( 'click', this.onClick );
|
||||
this.marker.on( 'drag', this.onDrag );
|
||||
this.marker.on( 'dragstart', this.onDragStart );
|
||||
this.marker.on( 'dragend', this.onDragEnd );
|
||||
};
|
||||
OSRM.inheritFrom( OSRM.RouteMarker, OSRM.Marker );
|
||||
OSRM.extend( OSRM.RouteMarker, {
|
||||
onClick: function(e) {
|
||||
for( var i=0; i<OSRM.G.markers.route.length; i++) {
|
||||
if( OSRM.G.markers.route[i].marker === this ) {
|
||||
OSRM.G.markers.removeMarker( i );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
getRoute(OSRM.C.FULL_DESCRIPTION);
|
||||
OSRM.G.markers.highlight.hide();
|
||||
},
|
||||
onDrag: function(e) {
|
||||
this.parent.setPosition( e.target.getLatLng() );
|
||||
getRoute(OSRM.C.NO_DESCRIPTION);
|
||||
updateLocation( this.parent.label );
|
||||
},
|
||||
onDragStart: function(e) {
|
||||
OSRM.G.dragging = true;
|
||||
|
||||
// store id of dragged marker
|
||||
for( var i=0; i<OSRM.G.markers.route.length; i++)
|
||||
if( OSRM.G.markers.route[i].marker === this ) {
|
||||
OSRM.G.dragid = i;
|
||||
break;
|
||||
}
|
||||
|
||||
OSRM.G.markers.highlight.hide();
|
||||
if (OSRM.G.route.isShown())
|
||||
OSRM.G.route.showOldRoute();
|
||||
},
|
||||
onDragEnd: function(e) {
|
||||
OSRM.G.dragging = false;
|
||||
this.parent.setPosition( e.target.getLatLng() );
|
||||
getRoute(OSRM.C.FULL_DESCRIPTION);
|
||||
if (OSRM.G.route.isShown()) {
|
||||
OSRM.G.route.hideOldRoute();
|
||||
OSRM.G.route.hideUnnamedRoute();
|
||||
}
|
||||
|
||||
if(OSRM.G.route.isShown()==false)
|
||||
updateAddress(this.parent.label);
|
||||
},
|
||||
toString: function() {
|
||||
return "OSRM.RouteMarker: \""+this.label+"\", "+this.position+")";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// marker management class (all route markers should only be set and deleted with these routines!)
|
||||
// [this holds the vital information of the route]
|
||||
OSRM.Markers = function() {
|
||||
this.route = new Array();
|
||||
this.highlight = new OSRM.HighlightMarker("highlight", {draggable:false,icon:OSRM.icons['marker-highlight']});;
|
||||
};
|
||||
OSRM.extend( OSRM.Markers,{
|
||||
removeAll: function() {
|
||||
for(var i=0; i<this.route.length;i++)
|
||||
this.route[i].hide();
|
||||
this.route.splice(0, this.route.length);
|
||||
},
|
||||
removeVias: function() {
|
||||
// assert correct route array s - v - t
|
||||
for(var i=1; i<this.route.length-1;i++)
|
||||
this.route[i].hide();
|
||||
this.route.splice(1, this.route.length-2);
|
||||
},
|
||||
setSource: function(position) {
|
||||
// source node is always first node
|
||||
if( this.route[0] && this.route[0].label == OSRM.C.SOURCE_LABEL )
|
||||
this.route[0].setPosition(position);
|
||||
else
|
||||
this.route.splice(0,0, new OSRM.RouteMarker(OSRM.C.SOURCE_LABEL, {draggable:true,icon:OSRM.icons['marker-source']}, position));
|
||||
return 0;
|
||||
},
|
||||
setTarget: function(position) {
|
||||
// target node is always last node
|
||||
if( this.route[this.route.length-1] && this.route[ this.route.length-1 ].label == OSRM.C.TARGET_LABEL )
|
||||
this.route[this.route.length-1].setPosition(position);
|
||||
else
|
||||
this.route.splice( this.route.length,0, new OSRM.RouteMarker(OSRM.C.TARGET_LABEL, {draggable:true,icon:OSRM.icons['marker-target']}, position));
|
||||
return this.route.length-1;
|
||||
},
|
||||
setVia: function(id, position) {
|
||||
// via nodes only between source and target nodes
|
||||
if( this.route.length<2 || id > this.route.length-2 )
|
||||
return -1;
|
||||
|
||||
this.route.splice(id+1,0, new OSRM.RouteMarker(OSRM.C.VIA_LABEL, {draggable:true,icon:OSRM.icons['marker-via']}, position));
|
||||
return id+1;
|
||||
},
|
||||
removeMarker: function(id) {
|
||||
if( id >= this.route.length )
|
||||
return;
|
||||
|
||||
// also remove vias if source or target are removed
|
||||
if( id==0 && this.route[0].label == OSRM.C.SOURCE_LABEL ) {
|
||||
this.removeVias();
|
||||
document.getElementById('input-source-name').value = "";
|
||||
} else if( id == this.route.length-1 && this.route[ this.route.length-1 ].label == OSRM.C.TARGET_LABEL ) {
|
||||
this.removeVias();
|
||||
id = this.route.length-1;
|
||||
document.getElementById('input-target-name').value = "";
|
||||
}
|
||||
|
||||
this.route[id].hide();
|
||||
this.route.splice(id, 1);
|
||||
},
|
||||
hasSource: function() {
|
||||
if( OSRM.G.markers.route[0] && OSRM.G.markers.route[0].label == OSRM.C.SOURCE_LABEL )
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
hasTarget: function() {
|
||||
if( OSRM.G.markers.route[OSRM.G.markers.route.length-1] && OSRM.G.markers.route[OSRM.G.markers.route.length-1].label == OSRM.C.TARGET_LABEL )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM routes
|
||||
// [drawing of all types of route geometry]
|
||||
|
||||
|
||||
// simple route class (wraps Leaflet Polyline)
|
||||
OSRM.SimpleRoute = function (label, style) {
|
||||
this.label = (label ? label : "route");
|
||||
this.route = new L.DashedPolyline();
|
||||
this.route.setLatLngs( [] );
|
||||
if(style) this.route.setStyle( style );
|
||||
|
||||
this.shown = false;
|
||||
|
||||
this.route.on('click', this.onClick);
|
||||
};
|
||||
OSRM.extend( OSRM.SimpleRoute,{
|
||||
show: function() {
|
||||
OSRM.G.map.addLayer(this.route);
|
||||
this.shown = true;
|
||||
},
|
||||
hide: function() {
|
||||
OSRM.G.map.removeLayer(this.route);
|
||||
this.shown = false;
|
||||
},
|
||||
isShown: function() {
|
||||
return this.shown;
|
||||
},
|
||||
getPositions: function() {
|
||||
return this.route.getLatLngs();
|
||||
},
|
||||
setPositions: function(positions) {
|
||||
this.route.setLatLngs( positions );
|
||||
},
|
||||
setStyle: function(style) {
|
||||
this.route.setStyle(style);
|
||||
},
|
||||
centerView: function() {
|
||||
var bounds = new L.LatLngBounds( this.getPositions() );
|
||||
OSRM.G.map.fitBounds( bounds );
|
||||
},
|
||||
onClick: function(e) {
|
||||
if(OSRM.G.route.isRoute())
|
||||
findViaPosition( e.latlng );
|
||||
},
|
||||
toString: function() {
|
||||
return "OSRM.Route("+ this.label + ", " + this.route.getLatLngs().length + " points)";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// multiroute class (wraps Leaflet LayerGroup to hold several disjoint routes)
|
||||
OSRM.MultiRoute = function (label) {
|
||||
this.label = (label ? label : "multiroute");
|
||||
this.route = new L.LayerGroup();
|
||||
|
||||
this.shown = false;
|
||||
};
|
||||
OSRM.extend( OSRM.MultiRoute,{
|
||||
show: function() {
|
||||
OSRM.G.map.addLayer(this.route);
|
||||
this.shown = true;
|
||||
},
|
||||
hide: function() {
|
||||
OSRM.G.map.removeLayer(this.route);
|
||||
this.shown = false;
|
||||
},
|
||||
isShown: function() {
|
||||
return this.shown;
|
||||
},
|
||||
addRoute: function(positions) {
|
||||
var line = new L.DashedPolyline( positions );
|
||||
line.on('click', function(e) { OSRM.G.route.fire('click',e); });
|
||||
this.route.addLayer( line );
|
||||
},
|
||||
clearRoutes: function() {
|
||||
this.route.clearLayers();
|
||||
},
|
||||
setStyle: function(style) {
|
||||
this.route.invoke('setStyle', style);
|
||||
},
|
||||
toString: function() {
|
||||
return "OSRM.MultiRoute("+ this.label + ")";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// route management (handles drawing of route geometry - current route, old route, unnamed route, highlight unnamed streets)
|
||||
// [this holds the route geometry]
|
||||
OSRM.Route = function() {
|
||||
this._current_route = new OSRM.SimpleRoute("current" , {dashed:false} );
|
||||
this._old_route = new OSRM.SimpleRoute("old", {dashed:false,color:"#123"} );
|
||||
this._unnamed_route = new OSRM.MultiRoute("unnamed");
|
||||
|
||||
this._current_route_style = {dashed:false,color:'#0033FF', weight:5};
|
||||
this._current_noroute_style = {dashed:true, color:'#222222', weight:2};
|
||||
this._old_route_style = {dashed:false,color:'#112233', weight:5};
|
||||
this._old_noroute_style = {dashed:true, color:'#000000', weight:2};
|
||||
this._unnamed_route_style = {dashed:false, color:'#FF00FF', weight:10};
|
||||
this._old_unnamed_route_style = {dashed:false, color:'#990099', weight:10};
|
||||
|
||||
this._noroute = OSRM.Route.ROUTE;
|
||||
};
|
||||
OSRM.Route.NOROUTE = true;
|
||||
OSRM.Route.ROUTE = false;
|
||||
OSRM.extend( OSRM.Route,{
|
||||
|
||||
showRoute: function(positions, noroute) {
|
||||
this._noroute = noroute;
|
||||
this._current_route.setPositions( positions );
|
||||
if ( this._noroute == OSRM.Route.NOROUTE )
|
||||
this._current_route.setStyle( this._current_noroute_style );
|
||||
else
|
||||
this._current_route.setStyle( this._current_route_style );
|
||||
this._current_route.show();
|
||||
//this._raiseUnnamedRoute();
|
||||
},
|
||||
hideRoute: function() {
|
||||
this._current_route.hide();
|
||||
this._unnamed_route.hide();
|
||||
},
|
||||
hideAll: function() {
|
||||
this._current_route.hide();
|
||||
this._unnamed_route.hide();
|
||||
this._old_route.hide();
|
||||
this._noroute = OSRM.Route.ROUTE;
|
||||
},
|
||||
|
||||
showUnnamedRoute: function(positions) {
|
||||
this._unnamed_route.clearRoutes();
|
||||
for(var i=0; i<positions.length; i++) {
|
||||
this._unnamed_route.addRoute(positions[i]);
|
||||
}
|
||||
this._unnamed_route.setStyle( this._unnamed_route_style );
|
||||
this._unnamed_route.show();
|
||||
},
|
||||
hideUnnamedRoute: function() {
|
||||
this._unnamed_route.hide();
|
||||
},
|
||||
// TODO: hack to put unnamed_route above old_route -> easier way in will be available Leaflet 0.4
|
||||
_raiseUnnamedRoute: function() {
|
||||
if(this._unnamed_route.isShown()) {
|
||||
this._unnamed_route.hide();
|
||||
this._unnamed_route.show();
|
||||
}
|
||||
},
|
||||
showOldRoute: function() {
|
||||
this._old_route.setPositions( this._current_route.getPositions() );
|
||||
if ( this._noroute == OSRM.Route.NOROUTE)
|
||||
this._old_route.setStyle( this._old_noroute_style );
|
||||
else
|
||||
this._old_route.setStyle( this._old_route_style );
|
||||
this._old_route.show();
|
||||
this._raiseUnnamedRoute();
|
||||
// change color of unnamed route highlighting - no separate object as dragged route does not have unnamed route highlighting
|
||||
this._unnamed_route.setStyle( this._old_unnamed_route_style );
|
||||
},
|
||||
hideOldRoute: function() {
|
||||
this._old_route.hide();
|
||||
},
|
||||
|
||||
isShown: function() {
|
||||
return this._current_route.isShown();
|
||||
},
|
||||
isRoute: function() {
|
||||
return !(this._noroute);
|
||||
},
|
||||
getPositions: function() {
|
||||
return this._current_route.getPositions();
|
||||
},
|
||||
fire: function(type,event) {
|
||||
this._current_route.route.fire(type,event);
|
||||
},
|
||||
centerView: function() {
|
||||
this._current_route.centerView();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM base class
|
||||
// [has to be loaded before all other OSRM classes]
|
||||
|
||||
var OSRM = {};
|
||||
OSRM.VERSION = '0.1.2';
|
||||
OSRM.DATE = '120319';
|
||||
OSRM.CONSTANTS = {};
|
||||
OSRM.DEFAULTS = {};
|
||||
OSRM.GLOBALS = {};
|
||||
OSRM.G = OSRM.GLOBALS; // abbreviations
|
||||
OSRM.C = OSRM.CONSTANTS;
|
||||
|
||||
|
||||
// [convenience function] declare one class to be a subclass of another class
|
||||
OSRM._inheritFromHelper = function() {};
|
||||
OSRM.inheritFrom = function( sub_class, base_class ) {
|
||||
OSRM._inheritFromHelper.prototype = base_class.prototype;
|
||||
sub_class.prototype = new OSRM._inheritFromHelper();
|
||||
sub_class.prototype.constructor = sub_class;
|
||||
sub_class.prototype.base = base_class.prototype;
|
||||
};
|
||||
|
||||
|
||||
// [convenience function] extend prototypes of a class -> used to add member values and functions
|
||||
OSRM.extend = function( target_class, properties ) {
|
||||
for( property in properties ) {
|
||||
target_class.prototype[property] = properties[property];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// [usage of convenience functions]
|
||||
// SubClass = function() {
|
||||
// SubClass.prototype.base.constructor.apply(this, arguments);
|
||||
// }
|
||||
// OSRM.inheritFrom( SubClass, BaseClass );
|
||||
// OSRM.extend( SubClass, { property:value } );
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM config file
|
||||
// [has to be loaded directly after OSRM.base]
|
||||
|
||||
OSRM.DEFAULTS = {
|
||||
HOST_ROUTING_URL: 'http://router.project-osrm.org/viaroute',
|
||||
HOST_SHORTENER_URL: 'http://map.project-osrm.org/shorten/',
|
||||
HOST_GEOCODER_URL: 'http://nominatim.openstreetmap.org/search',
|
||||
HOST_REVERSE_GEOCODER_URL: 'http://nominatim.openstreetmap.org/reverse',
|
||||
WEBSITE_URL: document.URL.replace(/#*(\?.*|$)/i,""), // truncates URL before first ?, and removes tailing #
|
||||
JSONP_TIMEOUT: 5000,
|
||||
ZOOM_LEVEL: 14,
|
||||
ONLOAD_LATITUDE: 48.84,
|
||||
ONLOAD_LONGITUDE: 10.10,
|
||||
ONLOAD_SOURCE: "",
|
||||
ONLOAD_TARGET: "",
|
||||
HIGHLIGHT_ZOOM_LEVEL: 16,
|
||||
LANGUAGE: "en",
|
||||
GEOCODER_BOUNDS: '&bounded=1&viewbox=-27.0,72.0,46.0,36.0'
|
||||
};
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// debug code for OSRM
|
||||
// [works better than console.log in older browsers and for logging event handling]
|
||||
|
||||
OSRM.debug = {};
|
||||
|
||||
|
||||
// add elements to DOM
|
||||
OSRM.debug.init = function() {
|
||||
//create DOM objects for debug output
|
||||
var wrapper = document.createElement('div');
|
||||
wrapper.id = "OSRM.debug-wrapper";
|
||||
wrapper.className = "gui-wrapper";
|
||||
wrapper.style.cssText = "width:410px;height:95%;top:5px;right:50px;";
|
||||
|
||||
var box = document.createElement('div');
|
||||
box.id = "OSRM.debug-box";
|
||||
box.className = "gui-box";
|
||||
box.style.cssText = "width:390px;top:0px;bottom:0px;";
|
||||
|
||||
var clear = document.createElement('a');
|
||||
clear.id = "OSRM.debug-clear";
|
||||
clear.className = "button not-selectable";
|
||||
clear.innerHTML = "clear";
|
||||
clear.onclick = OSRM.debug.clear;
|
||||
|
||||
OSRM.debug.content= document.createElement('div');
|
||||
OSRM.debug.content.id = "OSRM.debug-content";
|
||||
OSRM.debug.content.style.cssText = "position:absolute;bottom:0px;top:20px;width:380px;font-size:11px;overflow:auto;margin:5px;";
|
||||
|
||||
// add elements
|
||||
document.body.appendChild(wrapper);
|
||||
wrapper.appendChild(box);
|
||||
box.appendChild(clear);
|
||||
box.appendChild(OSRM.debug.content);
|
||||
};
|
||||
if(document.addEventListener) // FF, CH
|
||||
document.addEventListener("DOMContentLoaded", OSRM.debug.init, false);
|
||||
else // IE
|
||||
OSRM.debug.init();
|
||||
|
||||
|
||||
// working functions
|
||||
OSRM.debug.log = function(text) {
|
||||
OSRM.debug.content.innerHTML += text + "<hr style='border:none; margin:2px; height:1px; color:#F0F0F0; background:#F0F0F0;'/>";
|
||||
OSRM.debug.content.scrollTop = OSRM.debug.content.scrollHeight;
|
||||
};
|
||||
OSRM.debug.clear = function() {
|
||||
OSRM.debug.content.innerHTML = "";
|
||||
};
|
||||
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM geocoding routines
|
||||
// [geocoder query, management and display of geocoder results]
|
||||
// [TODO: better separation of GUI and geocoding routines, reverse geocoding]
|
||||
|
||||
// some constants
|
||||
OSRM.CONSTANTS.SOURCE_LABEL = "source";
|
||||
OSRM.CONSTANTS.TARGET_LABEL = "target";
|
||||
OSRM.CONSTANTS.VIA_LABEL = "via";
|
||||
OSRM.C.DO_FALLBACK_TO_LAT_LNG = true;
|
||||
|
||||
|
||||
//[normal geocoding]
|
||||
|
||||
// process input request and call geocoder if needed
|
||||
function callGeocoder(marker_id, query) {
|
||||
if(query=="")
|
||||
return;
|
||||
|
||||
//geo coordinates given -> directly draw results
|
||||
if(query.match(/^\s*[-+]?[0-9]*\.?[0-9]+\s*[,;]\s*[-+]?[0-9]*\.?[0-9]+\s*$/)){
|
||||
var coord = query.split(/[,;]/);
|
||||
onclickGeocoderResult(marker_id, coord[0], coord[1]);
|
||||
updateAddress( marker_id );
|
||||
return;
|
||||
}
|
||||
|
||||
//build request for geocoder
|
||||
var call = OSRM.DEFAULTS.HOST_GEOCODER_URL + "?format=json" + OSRM.DEFAULTS.GEOCODER_BOUNDS + "&q=" + query;
|
||||
OSRM.JSONP.call( call, showGeocoderResults, showGeocoderResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "geocoder_"+marker_id, marker_id );
|
||||
}
|
||||
|
||||
|
||||
// helper function for clicks on geocoder search results
|
||||
function onclickGeocoderResult(marker_id, lat, lon) {
|
||||
var index;
|
||||
if( marker_id == OSRM.C.SOURCE_LABEL )
|
||||
index = OSRM.G.markers.setSource( new L.LatLng(lat, lon) );
|
||||
else if( marker_id == OSRM.C.TARGET_LABEL )
|
||||
index = OSRM.G.markers.setTarget( new L.LatLng(lat, lon) );
|
||||
else
|
||||
return;
|
||||
|
||||
OSRM.G.markers.route[index].show();
|
||||
OSRM.G.markers.route[index].centerView();
|
||||
getRoute(OSRM.C.FULL_DESCRIPTION);
|
||||
}
|
||||
|
||||
|
||||
// process geocoder response
|
||||
function showGeocoderResults(response, marker_id) {
|
||||
if(!response){
|
||||
showGeocoderResults_Empty(marker_id);
|
||||
return;
|
||||
}
|
||||
|
||||
if(response.length == 0) {
|
||||
showGeocoderResults_Empty(marker_id);
|
||||
return;
|
||||
}
|
||||
|
||||
// show possible results for input
|
||||
var html = "";
|
||||
html += '<table class="results-table">';
|
||||
for(var i=0; i < response.length; i++){
|
||||
var result = response[i];
|
||||
|
||||
//odd or even ?
|
||||
var rowstyle='results-odd';
|
||||
if(i%2==0) { rowstyle='results-even'; }
|
||||
|
||||
html += '<tr class="'+rowstyle+'">';
|
||||
html += '<td class="result-counter"><span">'+(i+1)+'.</span></td>';
|
||||
html += '<td class="result-items">';
|
||||
|
||||
if(result.display_name){
|
||||
html += '<div class="result-item" onclick="onclickGeocoderResult(\''+marker_id+'\', '+result.lat+', '+result.lon+');">'+result.display_name+'</div>';
|
||||
}
|
||||
html += "</td></tr>";
|
||||
}
|
||||
html += '</table>';
|
||||
|
||||
document.getElementById('information-box-headline').innerHTML = OSRM.loc("SEARCH_RESULTS")+":";
|
||||
document.getElementById('information-box').innerHTML = html;
|
||||
|
||||
onclickGeocoderResult(marker_id, response[0].lat, response[0].lon);
|
||||
}
|
||||
function showGeocoderResults_Empty(marker_id) {
|
||||
document.getElementById('information-box-headline').innerHTML = OSRM.loc("SEARCH_RESULTS")+":";
|
||||
if(marker_id == OSRM.C.SOURCE_LABEL)
|
||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("NO_RESULTS_FOUND_SOURCE")+".<p>";
|
||||
else if(marker_id == OSRM.C.TARGET_LABEL)
|
||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("NO_RESULTS_FOUND_TARGET")+".<p>";
|
||||
else
|
||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("NO_RESULTS_FOUND")+".<p>";
|
||||
}
|
||||
function showGeocoderResults_Timeout() {
|
||||
document.getElementById('information-box-headline').innerHTML = OSRM.loc("SEARCH_RESULTS")+":";
|
||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("TIMED_OUT")+".<p>";
|
||||
}
|
||||
|
||||
|
||||
// [reverse geocoding]
|
||||
|
||||
//update geo coordinates in input boxes
|
||||
function updateLocation(marker_id) {
|
||||
if (marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource()) {
|
||||
document.getElementById("input-source-name").value = OSRM.G.markers.route[0].getPosition().lat.toFixed(6) + ", " + OSRM.G.markers.route[0].getPosition().lng.toFixed(6);
|
||||
} else if (marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget()) {
|
||||
document.getElementById("input-target-name").value = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getPosition().lat.toFixed(6) + ", " + OSRM.G.markers.route[OSRM.G.markers.route.length-1].getPosition().lng.toFixed(6);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// update address in input boxes
|
||||
function updateAddress(marker_id, do_fallback_to_lat_lng) {
|
||||
// build request for reverse geocoder
|
||||
var lat = null;
|
||||
var lng = null;
|
||||
|
||||
if(marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource()) {
|
||||
lat = OSRM.G.markers.route[0].getPosition().lat;
|
||||
lng = OSRM.G.markers.route[0].getPosition().lng;
|
||||
} else if(marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() ) {
|
||||
lat = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getPosition().lat;
|
||||
lng = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getPosition().lng;
|
||||
} else
|
||||
return;
|
||||
|
||||
var call = OSRM.DEFAULTS.HOST_REVERSE_GEOCODER_URL + "?format=json" + "&lat=" + lat + "&lon=" + lng;
|
||||
OSRM.JSONP.call( call, showReverseGeocoderResults, showReverseGeocoderResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "reverse_geocoder_"+marker_id, {marker_id:marker_id, do_fallback: do_fallback_to_lat_lng} );
|
||||
}
|
||||
|
||||
|
||||
// processing JSONP response of reverse geocoder
|
||||
function showReverseGeocoderResults(response, parameters) {
|
||||
if(!response) {
|
||||
showReverseGeocoderResults_Timeout(response, parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
if(response.address == undefined) {
|
||||
showReverseGeocoderResults_Timeout(response, parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
// build reverse geocoding address
|
||||
var used_address_data = 0;
|
||||
var address = "";
|
||||
if( response.address.road) {
|
||||
address += response.address.road;
|
||||
used_address_data++;
|
||||
}
|
||||
if( response.address.city ) {
|
||||
if( used_address_data > 0 )
|
||||
address += ", ";
|
||||
address += response.address.city;
|
||||
used_address_data++;
|
||||
} else if( response.address.village ) {
|
||||
if( used_address_data > 0 )
|
||||
address += ", ";
|
||||
address += response.address.village;
|
||||
used_address_data++;
|
||||
}
|
||||
if( used_address_data < 2 && response.address.country ) {
|
||||
if( used_address_data > 0 )
|
||||
address += ", ";
|
||||
address += response.address.country;
|
||||
used_address_data++;
|
||||
}
|
||||
if( used_address_data == 0 ) {
|
||||
showReverseGeocoderResults_Timeout(response, parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
// add result to DOM
|
||||
if(parameters.marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() )
|
||||
document.getElementById("input-source-name").value = address;
|
||||
else if(parameters.marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() )
|
||||
document.getElementById("input-target-name").value = address;
|
||||
}
|
||||
function showReverseGeocoderResults_Timeout(response, parameters) {
|
||||
if(!parameters.do_fallback)
|
||||
return;
|
||||
|
||||
updateLocation(parameters.marker_id);
|
||||
}
|
||||
|
After Width: | Height: | Size: 402 B |
|
After Width: | Height: | Size: 484 B |
|
After Width: | Height: | Size: 483 B |
|
After Width: | Height: | Size: 414 B |
|
After Width: | Height: | Size: 240 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 477 B |
|
After Width: | Height: | Size: 480 B |
|
After Width: | Height: | Size: 488 B |
|
After Width: | Height: | Size: 716 B |
|
After Width: | Height: | Size: 617 B |
|
After Width: | Height: | Size: 530 B |
|
After Width: | Height: | Size: 746 B |
|
After Width: | Height: | Size: 635 B |
|
After Width: | Height: | Size: 607 B |
|
After Width: | Height: | Size: 489 B |
|
After Width: | Height: | Size: 676 B |
|
After Width: | Height: | Size: 656 B |
|
After Width: | Height: | Size: 778 B |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 963 B |
|
After Width: | Height: | Size: 959 B |
@@ -0,0 +1,323 @@
|
||||
/* required styles */
|
||||
|
||||
.leaflet-map-pane,
|
||||
.leaflet-tile,
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow,
|
||||
.leaflet-tile-pane,
|
||||
.leaflet-overlay-pane,
|
||||
.leaflet-shadow-pane,
|
||||
.leaflet-marker-pane,
|
||||
.leaflet-popup-pane,
|
||||
.leaflet-overlay-pane svg,
|
||||
.leaflet-zoom-box,
|
||||
.leaflet-image-layer { /* TODO optimize classes */
|
||||
position: absolute;
|
||||
}
|
||||
.leaflet-container {
|
||||
overflow: hidden;
|
||||
}
|
||||
.leaflet-tile-pane, .leaflet-container {
|
||||
-webkit-transform: translate3d(0,0,0);
|
||||
}
|
||||
.leaflet-tile,
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow {
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow {
|
||||
display: block;
|
||||
}
|
||||
.leaflet-clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
.leaflet-container img {
|
||||
max-width: none !important;
|
||||
}
|
||||
|
||||
.leaflet-tile-pane { z-index: 2; }
|
||||
|
||||
.leaflet-objects-pane { z-index: 3; }
|
||||
.leaflet-overlay-pane { z-index: 4; }
|
||||
.leaflet-shadow-pane { z-index: 5; }
|
||||
.leaflet-marker-pane { z-index: 6; }
|
||||
.leaflet-popup-pane { z-index: 7; }
|
||||
|
||||
.leaflet-zoom-box {
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.leaflet-tile {
|
||||
visibility: hidden;
|
||||
}
|
||||
.leaflet-tile-loaded {
|
||||
visibility: inherit;
|
||||
}
|
||||
|
||||
a.leaflet-active {
|
||||
outline: 2px solid orange;
|
||||
}
|
||||
|
||||
|
||||
/* Leaflet controls */
|
||||
|
||||
.leaflet-control {
|
||||
position: relative;
|
||||
z-index: 7;
|
||||
}
|
||||
.leaflet-top,
|
||||
.leaflet-bottom {
|
||||
position: absolute;
|
||||
}
|
||||
.leaflet-top {
|
||||
top: 0;
|
||||
}
|
||||
.leaflet-right {
|
||||
right: 0;
|
||||
}
|
||||
.leaflet-bottom {
|
||||
bottom: 0;
|
||||
}
|
||||
.leaflet-left {
|
||||
left: 0;
|
||||
}
|
||||
.leaflet-control {
|
||||
float: left;
|
||||
clear: both;
|
||||
}
|
||||
.leaflet-right .leaflet-control {
|
||||
float: right;
|
||||
}
|
||||
.leaflet-top .leaflet-control {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.leaflet-bottom .leaflet-control {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.leaflet-left .leaflet-control {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.leaflet-right .leaflet-control {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.leaflet-control-zoom, .leaflet-control-layers {
|
||||
-moz-border-radius: 7px;
|
||||
-webkit-border-radius: 7px;
|
||||
border-radius: 7px;
|
||||
}
|
||||
.leaflet-control-zoom {
|
||||
padding: 5px;
|
||||
background: rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.leaflet-control-zoom a {
|
||||
background-color: rgba(255, 255, 255, 0.75);
|
||||
}
|
||||
.leaflet-control-zoom a, .leaflet-control-layers a {
|
||||
background-position: 50% 50%;
|
||||
background-repeat: no-repeat;
|
||||
display: block;
|
||||
}
|
||||
.leaflet-control-zoom a {
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
width: 19px;
|
||||
height: 19px;
|
||||
}
|
||||
.leaflet-control-zoom a:hover {
|
||||
background-color: #fff;
|
||||
}
|
||||
.leaflet-big-buttons .leaflet-control-zoom a {
|
||||
width: 27px;
|
||||
height: 27px;
|
||||
}
|
||||
.leaflet-control-zoom-in {
|
||||
background-image: url(images/zoom-in.png);
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.leaflet-control-zoom-out {
|
||||
background-image: url(images/zoom-out.png);
|
||||
}
|
||||
|
||||
.leaflet-control-layers {
|
||||
-moz-box-shadow: 0 0 7px #999;
|
||||
-webkit-box-shadow: 0 0 7px #999;
|
||||
box-shadow: 0 0 7px #999;
|
||||
|
||||
background: #f8f8f9;
|
||||
}
|
||||
.leaflet-control-layers a {
|
||||
background-image: url(images/layers.png);
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
}
|
||||
.leaflet-big-buttons .leaflet-control-layers a {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
}
|
||||
.leaflet-control-layers .leaflet-control-layers-list,
|
||||
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
|
||||
display: none;
|
||||
}
|
||||
.leaflet-control-layers-expanded .leaflet-control-layers-list {
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
.leaflet-control-layers-expanded {
|
||||
padding: 6px 10px 6px 6px;
|
||||
font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
color: #333;
|
||||
background: #fff;
|
||||
}
|
||||
.leaflet-control-layers input {
|
||||
margin-top: 2px;
|
||||
position: relative;
|
||||
top: 1px;
|
||||
}
|
||||
.leaflet-control-layers label {
|
||||
display: block;
|
||||
}
|
||||
.leaflet-control-layers-separator {
|
||||
height: 0;
|
||||
border-top: 1px solid #ddd;
|
||||
margin: 5px -10px 5px -6px;
|
||||
}
|
||||
|
||||
.leaflet-container .leaflet-control-attribution {
|
||||
margin: 0;
|
||||
padding: 0 5px;
|
||||
|
||||
font: 11px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
color: #333;
|
||||
|
||||
background-color: rgba(255, 255, 255, 0.7);
|
||||
|
||||
-moz-box-shadow: 0 0 7px #ccc;
|
||||
-webkit-box-shadow: 0 0 7px #ccc;
|
||||
box-shadow: 0 0 7px #ccc;
|
||||
}
|
||||
|
||||
|
||||
/* Fade animations */
|
||||
|
||||
.leaflet-fade-anim .leaflet-tile {
|
||||
opacity: 0;
|
||||
|
||||
-webkit-transition: opacity 0.2s linear;
|
||||
-moz-transition: opacity 0.2s linear;
|
||||
-o-transition: opacity 0.2s linear;
|
||||
transition: opacity 0.2s linear;
|
||||
}
|
||||
.leaflet-fade-anim .leaflet-tile-loaded {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.leaflet-fade-anim .leaflet-popup {
|
||||
opacity: 0;
|
||||
|
||||
-webkit-transition: opacity 0.2s linear;
|
||||
-moz-transition: opacity 0.2s linear;
|
||||
-o-transition: opacity 0.2s linear;
|
||||
transition: opacity 0.2s linear;
|
||||
}
|
||||
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.leaflet-zoom-anim .leaflet-tile {
|
||||
-webkit-transition: none;
|
||||
-moz-transition: none;
|
||||
-o-transition: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.leaflet-zoom-anim .leaflet-objects-pane {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
|
||||
/* Popup layout */
|
||||
|
||||
.leaflet-popup {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
-webkit-transform: translate3d(0,0,0);
|
||||
}
|
||||
.leaflet-popup-content-wrapper {
|
||||
padding: 1px;
|
||||
text-align: left;
|
||||
}
|
||||
.leaflet-popup-content {
|
||||
margin: 19px;
|
||||
}
|
||||
.leaflet-popup-tip-container {
|
||||
margin: 0 auto;
|
||||
width: 40px;
|
||||
height: 16px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.leaflet-popup-tip {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
padding: 1px;
|
||||
|
||||
margin: -8px auto 0;
|
||||
|
||||
-moz-transform: rotate(45deg);
|
||||
-webkit-transform: rotate(45deg);
|
||||
-ms-transform: rotate(45deg);
|
||||
-o-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.leaflet-popup-close-button {
|
||||
position: absolute;
|
||||
top: 9px;
|
||||
right: 9px;
|
||||
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
|
||||
overflow: hidden;
|
||||
}
|
||||
.leaflet-popup-content p {
|
||||
margin: 18px 0;
|
||||
}
|
||||
|
||||
|
||||
/* Visual appearance */
|
||||
|
||||
.leaflet-container {
|
||||
background: #ddd;
|
||||
}
|
||||
.leaflet-container a {
|
||||
color: #0078A8;
|
||||
}
|
||||
.leaflet-zoom-box {
|
||||
border: 2px dotted #05f;
|
||||
background: white;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
|
||||
background: white;
|
||||
|
||||
box-shadow: 0 1px 10px #888;
|
||||
-moz-box-shadow: 0 1px 10px #888;
|
||||
-webkit-box-shadow: 0 1px 14px #999;
|
||||
}
|
||||
.leaflet-popup-content-wrapper {
|
||||
-moz-border-radius: 20px;
|
||||
-webkit-border-radius: 20px;
|
||||
border-radius: 20px;
|
||||
}
|
||||
.leaflet-popup-content {
|
||||
font: 12px/1.4 "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
}
|
||||
.leaflet-popup-close-button {
|
||||
background: white url(images/popup-close.png);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
.leaflet-tile {
|
||||
filter: inherit;
|
||||
}
|
||||
|
||||
.leaflet-vml-shape {
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
}
|
||||
.lvml {
|
||||
behavior: url(#default#VML);
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.leaflet-control {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.leaflet-popup-tip {
|
||||
width: 21px;
|
||||
_width: 27px;
|
||||
margin: 0 auto;
|
||||
_margin-top: -3px;
|
||||
|
||||
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
|
||||
}
|
||||
.leaflet-popup-tip-container {
|
||||
margin-top: -1px;
|
||||
}
|
||||
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
|
||||
border: 1px solid #bbb;
|
||||
}
|
||||
|
||||
.leaflet-control-zoom {
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#3F000000',EndColorStr='#3F000000');
|
||||
}
|
||||
.leaflet-control-zoom a {
|
||||
background-color: #eee;
|
||||
}
|
||||
.leaflet-control-zoom a:hover {
|
||||
background-color: #fff;
|
||||
}
|
||||
.leaflet-control-layers-toggle {
|
||||
}
|
||||
.leaflet-control-attribution, .leaflet-control-layers {
|
||||
background: white;
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
/* OSRM CSS styles */
|
||||
|
||||
|
||||
/* map -> fullscreen */
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
html, body, #map {
|
||||
height: 100%;
|
||||
}
|
||||
#map {
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
|
||||
/* styles for gui */
|
||||
.vquad
|
||||
{
|
||||
height:10px;
|
||||
}
|
||||
|
||||
.gui-wrapper
|
||||
{
|
||||
position:absolute;
|
||||
border-radius:10px;
|
||||
-moz-border-radius:10px;
|
||||
-webkit-border-radius:10px;
|
||||
background-color:#666666;
|
||||
background-color:rgba(0, 0, 0, 0.25);
|
||||
transition:left 1s;
|
||||
-moz-transition:left 1s;
|
||||
-webkit-transition:left 1s;
|
||||
-o-transition:left 1s;
|
||||
-ms-transition:left 1s;
|
||||
}
|
||||
.gui-box
|
||||
{
|
||||
position:absolute;
|
||||
background-color:#ffffff;
|
||||
background-color:rgba(255,255,255,1);
|
||||
border-radius:10px;
|
||||
-moz-border-radius:10px;
|
||||
-webkit-border-radius:10px;
|
||||
margin:5px;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
#main-wrapper
|
||||
{
|
||||
width:410px;
|
||||
height:95%;
|
||||
top:5px;
|
||||
left:5px;
|
||||
}
|
||||
#main-input
|
||||
{
|
||||
width:390px;
|
||||
height:200px;
|
||||
}
|
||||
#main-output
|
||||
{
|
||||
width:390px;
|
||||
top:220px;
|
||||
bottom:0px;
|
||||
}
|
||||
|
||||
#blob-wrapper
|
||||
{
|
||||
left:-5px;
|
||||
top:5px;
|
||||
width:36px;
|
||||
height:36px;
|
||||
border-top-left-radius:0px;
|
||||
border-bottom-left-radius:0px;
|
||||
-moz-border-radius-topleft:0px;
|
||||
-moz-border-radius-bottomleft:0px;
|
||||
-webkit-border-top-left-radius:0px;
|
||||
-webkit-border-bottom-left-radius:0px;
|
||||
visibility:hidden;
|
||||
}
|
||||
#blob-input
|
||||
{
|
||||
width:26px;
|
||||
height:26px;
|
||||
border-top-left-radius:0px;
|
||||
border-bottom-left-radius:0px;
|
||||
-moz-border-radius-topleft:0px;
|
||||
-moz-border-radius-bottomleft:0px;
|
||||
-webkit-border-top-left-radius:0px;
|
||||
-webkit-border-bottom-left-radius:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
.main-toggle-out
|
||||
{
|
||||
cursor:pointer;
|
||||
position:absolute;
|
||||
right:5px;
|
||||
top:5px;
|
||||
width:16px;
|
||||
height:16px;
|
||||
background-image:url("images/cancel.png");
|
||||
}
|
||||
.main-toggle-out:hover
|
||||
{
|
||||
background-image:url("images/cancel_hover.png");
|
||||
}
|
||||
.main-toggle-out:active
|
||||
{
|
||||
background-image:url("images/cancel_active.png");
|
||||
}
|
||||
.main-toggle-in
|
||||
{
|
||||
cursor:pointer;
|
||||
position:absolute;
|
||||
right:5px;
|
||||
top:5px;
|
||||
width:16px;
|
||||
height:16px;
|
||||
background-image:url("images/restore.png");
|
||||
}
|
||||
.main-toggle-in:hover
|
||||
{
|
||||
background-image:url("images/restore_hover.png");
|
||||
}
|
||||
.main-toggle-in:active
|
||||
{
|
||||
background-image:url("images/restore_active.png");
|
||||
}
|
||||
|
||||
.main-options
|
||||
{
|
||||
font-size:10px;
|
||||
}
|
||||
#options-toggle
|
||||
{
|
||||
cursor:pointer;
|
||||
color:#0000ff
|
||||
}
|
||||
#options-toggle:hover
|
||||
{
|
||||
color:#ff0000
|
||||
}
|
||||
#options-box
|
||||
{
|
||||
visibility:hidden;
|
||||
}
|
||||
|
||||
#osrm-logo
|
||||
{
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 200px;
|
||||
height: 50px;
|
||||
text-align:center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.input-box
|
||||
{
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
|
||||
.full
|
||||
{
|
||||
width:100%;
|
||||
}
|
||||
.right
|
||||
{
|
||||
text-align:right;
|
||||
}
|
||||
.center
|
||||
{
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
#information-box
|
||||
{
|
||||
position:absolute;
|
||||
bottom:15px;
|
||||
top:60px;
|
||||
width:380px;
|
||||
font-size:12px;
|
||||
overflow:auto;
|
||||
margin:5px;
|
||||
}
|
||||
|
||||
.route-summary
|
||||
{
|
||||
font-size: 12px;
|
||||
}
|
||||
#gpx-link
|
||||
{
|
||||
color:#0000ff;
|
||||
text-decoration:none;
|
||||
cursor:pointer;
|
||||
}
|
||||
#gpx-link:hover
|
||||
{
|
||||
color:#ff0000;
|
||||
}
|
||||
.results-table
|
||||
{
|
||||
border-spacing:0px;
|
||||
}
|
||||
.results-odd
|
||||
{
|
||||
background-color: #FAF3E9; //#ffffff;
|
||||
}
|
||||
.results-even
|
||||
{
|
||||
background-color: #F2DE9C; //#ffffe0;
|
||||
}
|
||||
.result-counter
|
||||
{
|
||||
text-align:right;
|
||||
vertical-align: top;
|
||||
width:30px;
|
||||
font-weight:bold;
|
||||
padding-left:5px;
|
||||
padding-right:5px;
|
||||
padding-top:1px;
|
||||
padding-bottom:1px;
|
||||
}
|
||||
.result-items
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align: middle;
|
||||
width:100%;
|
||||
padding-left:1px;
|
||||
padding-right:1px;
|
||||
padding-top:1px;
|
||||
padding-bottom:1px;
|
||||
}
|
||||
.result-direction
|
||||
{
|
||||
width:30px;
|
||||
padding-left:1px;
|
||||
padding-right:1px;
|
||||
padding-top:1px;
|
||||
padding-bottom:1px;
|
||||
}
|
||||
.result-distance
|
||||
{
|
||||
text-align:right;
|
||||
vertical-align: middle;
|
||||
width:30px;
|
||||
padding-left:1px;
|
||||
padding-right:1px;
|
||||
padding-top:1px;
|
||||
padding-bottom:1px;
|
||||
}
|
||||
.result-item
|
||||
{
|
||||
cursor:pointer;
|
||||
color:#000000
|
||||
}
|
||||
.result-item:hover
|
||||
{
|
||||
color:#ff0000
|
||||
}
|
||||
|
||||
#legal-notice
|
||||
{
|
||||
position:absolute;
|
||||
right:0px;
|
||||
bottom:0px;
|
||||
padding:5px;
|
||||
font-size:10px;
|
||||
}
|
||||
|
||||
|
||||
/* utility styles (defined above buttons, so that buttons retain cursor:pointer)*/
|
||||
.not-selectable
|
||||
{
|
||||
cursor:default;
|
||||
-moz-user-select: -moz-none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.text-selectable
|
||||
{
|
||||
cursor:default;
|
||||
-moz-user-select: text;
|
||||
-webkit-user-select: text;
|
||||
-ms-user-select: text;
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
|
||||
/* buttons */
|
||||
.button
|
||||
{
|
||||
cursor:pointer;
|
||||
padding:2px 10px 2px 10px;
|
||||
border-radius:5px;
|
||||
-moz-border-radius:5px;
|
||||
background-color:#EEEEEE;
|
||||
border:1px solid #999999;
|
||||
color:#333333;
|
||||
text-decoration:none;
|
||||
font-size:11px;
|
||||
outline-style:none;
|
||||
}
|
||||
.button:hover
|
||||
{
|
||||
background-color:#F9F9F9;
|
||||
color:#000000;
|
||||
}
|
||||
.button:active
|
||||
{
|
||||
background-color:#F4F4F4;
|
||||
color:#FF0000;
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<!--
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
-->
|
||||
|
||||
<html>
|
||||
|
||||
|
||||
<!-- head -->
|
||||
<head>
|
||||
|
||||
<!-- metatags -->
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<title>OSRM Website</title>
|
||||
<meta name="description" content="OSRM Website"/>
|
||||
<meta name="author" content="Dennis Schieferdecker" />
|
||||
|
||||
<!-- favicon -->
|
||||
<link rel="shortcut icon" href="images/osrm-favicon.ico" type="image/x-icon" />
|
||||
|
||||
<!-- stylesheets -->
|
||||
<link rel="stylesheet" href="leaflet/leaflet.css" type="text/css"/>
|
||||
<!--[if lte IE 8]><link rel="stylesheet" href="leaflet/leaflet.ie.css" type="text/css"/><![endif]-->
|
||||
<link rel="stylesheet" href="main.css" type="text/css"/>
|
||||
|
||||
<!-- scripts -->
|
||||
<script src="leaflet/leaflet-src.js" type="text/javascript"></script>
|
||||
<script src="L.DashedPolyline.js" type="text/javascript"></script>
|
||||
<script src="L.MouseMarker.js" type="text/javascript"></script>
|
||||
|
||||
<script src="OSRM.base.js" type="text/javascript"></script>
|
||||
<script src="OSRM.config.js" type="text/javascript"></script>
|
||||
<!-- <script defer="defer" src="OSRM.debug.js" type="text/javascript"></script> -->
|
||||
|
||||
<script src="OSRM.Browser.js" type="text/javascript"></script>
|
||||
<script src="OSRM.GUI.js" type="text/javascript"></script>
|
||||
<script src="OSRM.JSONP.js" type="text/javascript"></script>
|
||||
<script src="OSRM.Markers.js" type="text/javascript"></script>
|
||||
<script src="OSRM.Route.js" type="text/javascript"></script>
|
||||
<script src="OSRM.Localization.js" type="text/javascript"></script>
|
||||
|
||||
<script src="main.js" type="text/javascript"></script>
|
||||
<script src="routing.js" type="text/javascript"></script>
|
||||
|
||||
<script src="geocoder.js" type="text/javascript"></script>
|
||||
<script src="via.js" type="text/javascript"></script>
|
||||
|
||||
<script src="utils.js" type="text/javascript"></script>
|
||||
</head>
|
||||
|
||||
|
||||
<!-- body -->
|
||||
<body onload="init();">
|
||||
|
||||
<!--map-->
|
||||
<div id="map"></div>
|
||||
|
||||
<!-- show ui blob -->
|
||||
<div id="blob-wrapper" class="gui-wrapper">
|
||||
<div id="blob-input" class="gui-box">
|
||||
<div class="main-toggle-in" onclick="OSRM.GUI.toggleMain()"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- show main gui -->
|
||||
<div id="main-wrapper" class="gui-wrapper">
|
||||
|
||||
<!-- input box -->
|
||||
<div class="gui-box not-selectable" id="main-input">
|
||||
<div class="main-toggle-out" onclick="OSRM.GUI.toggleMain()"></div>
|
||||
<img id="osrm-logo" alt="OSRM Logo" src="images/osrm-logo.png" />
|
||||
|
||||
<!-- source/target input -->
|
||||
<table class="full">
|
||||
<tr>
|
||||
<td id="gui-search-source-label">Start:</td>
|
||||
<td><input id="input-source-name" class="input-box" type="text" maxlength="200" value="" title="Startposition eingeben" onchange="inputChanged(OSRM.C.SOURCE_LABEL);" /></td>
|
||||
<td class="right"><a class="button not-selectable" id="gui-search-source" onclick="showMarker('source')">Zeigen</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td id="gui-search-target-label">Ende:</td>
|
||||
<td><input id="input-target-name" class="input-box" type="text" maxlength="200" value="" title="Zielposition eingeben" onchange="inputChanged(OSRM.C.TARGET_LABEL);" /></td>
|
||||
<td class="right"><a class="button not-selectable" id="gui-search-target" onclick="showMarker('target');">Zeigen</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- action buttons -->
|
||||
<div class="vquad"></div>
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
<td> <a class="button not-selectable" id="gui-reset" onclick="resetRouting();">Reset</a></td>
|
||||
<td class="right"> <a class="button not-selectable" id="gui-reverse" onclick="reverseRouting();">Umdrehen</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- options -->
|
||||
<div class="vquad"></div>
|
||||
<div class="main-options not-selectable" id="options-toggle" onclick="OSRM.GUI.toggleOptions()">Options</div>
|
||||
<div class="main-options not-selectable" id="options-box">
|
||||
<input type="checkbox" id="option-highlight-nonames" name="main-options" value="highlight-nonames" onclick="getRoute(OSRM.C.FULL_DESCRIPTION)" /><span id="gui-option-highlight-nonames-label">Unbenannte Straßen hervorheben</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- output box -->
|
||||
<div class="gui-box not-selectable" id="main-output">
|
||||
<div id="information-box-headline"></div>
|
||||
<div id="information-box"></div>
|
||||
<div id="legal-notice">GUI2 v0.1.1 120316 - OSRM hosting by <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder by <a href='http://www.osm.org/'>OSM</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,266 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM initialization
|
||||
// [initialization of maps, local strings, image prefetching]
|
||||
|
||||
// will hold the Leaflet map object
|
||||
OSRM.GLOBALS.map = null;
|
||||
|
||||
|
||||
// onload initialization routine
|
||||
function init() {
|
||||
prefetchImages();
|
||||
prefetchIcons();
|
||||
|
||||
initLocale();
|
||||
initMap();
|
||||
initRouting();
|
||||
|
||||
// check if the URL contains some GET parameter, e.g. for the route
|
||||
checkURL();
|
||||
}
|
||||
|
||||
|
||||
// prefetch images
|
||||
OSRM.images = Array();
|
||||
function prefetchImages() {
|
||||
var images = [ 'images/marker-source.png',
|
||||
'images/marker-target.png',
|
||||
'images/marker-via.png',
|
||||
'images/marker-highlight.png',
|
||||
'images/cancel.png',
|
||||
'images/cancel_active.png',
|
||||
'images/cancel_hover.png',
|
||||
'images/restore.png',
|
||||
'images/restore_active.png',
|
||||
'images/restore_hover.png'
|
||||
];
|
||||
|
||||
for(var i=0; i<images.length; i++) {
|
||||
OSRM.images[i] = new Image();
|
||||
OSRM.images[i].src = images[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// prefetch icons
|
||||
OSRM.icons = Array();
|
||||
function prefetchIcons() {
|
||||
var images = [ 'marker-source',
|
||||
'marker-target',
|
||||
'marker-via',
|
||||
'marker-highlight',
|
||||
];
|
||||
|
||||
for(var i=0; i<images.length; i++)
|
||||
OSRM.icons[images[i]] = new L.Icon('images/'+images[i]+'.png');
|
||||
}
|
||||
|
||||
|
||||
// init localization
|
||||
function initLocale() {
|
||||
document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET");
|
||||
document.getElementById("gui-reverse").innerHTML = OSRM.loc("GUI_REVERSE");
|
||||
document.getElementById("gui-option-highlight-nonames-label").innerHTML = OSRM.loc("GUI_HIGHLIGHT_UNNAMED_ROADS");
|
||||
document.getElementById("options-toggle").innerHTML = OSRM.loc("GUI_OPTIONS");
|
||||
document.getElementById("gui-search-source").innerHTML = OSRM.loc("GUI_SEARCH");
|
||||
document.getElementById("gui-search-target").innerHTML = OSRM.loc("GUI_SEARCH");
|
||||
document.getElementById("gui-search-source-label").innerHTML = OSRM.loc("GUI_START")+":";
|
||||
document.getElementById("gui-search-target-label").innerHTML = OSRM.loc("GUI_END")+":";
|
||||
document.getElementById("input-source-name").title = OSRM.loc("GUI_START_TOOLTIP");
|
||||
document.getElementById("input-target-name").title = OSRM.loc("GUI_END_TOOLTIP");
|
||||
document.getElementById("legal-notice").innerHTML = OSRM.loc("GUI_LEGAL_NOTICE");
|
||||
|
||||
document.getElementById('input-source-name').value = OSRM.DEFAULTS.ONLOAD_SOURCE;
|
||||
document.getElementById('input-target-name').value = OSRM.DEFAULTS.ONLOAD_TARGET;
|
||||
}
|
||||
|
||||
|
||||
// centering on geolocation
|
||||
function callbak_centerOnGeolocation( position ) {
|
||||
OSRM.G.map.setView( new L.LatLng( position.coords.latitude, position.coords.longitude), OSRM.DEFAULTS.ZOOM_LEVEL);
|
||||
}
|
||||
function centerOnGeolocation() {
|
||||
if (navigator.geolocation)
|
||||
navigator.geolocation.getCurrentPosition( callbak_centerOnGeolocation );
|
||||
}
|
||||
|
||||
|
||||
// init map
|
||||
function initMap() {
|
||||
// setup tile servers
|
||||
var osmorgURL = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
osmorgAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 Mapnik',
|
||||
osmorgOptions = {maxZoom: 18, attribution: osmorgAttribution};
|
||||
|
||||
var osmdeURL = 'http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
|
||||
osmdeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 Mapnik',
|
||||
osmdeOptions = {maxZoom: 18, attribution: osmdeAttribution};
|
||||
|
||||
var mapquestURL = 'http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png',
|
||||
mapquestAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 MapQuest',
|
||||
mapquestOptions = {maxZoom: 18, attribution: mapquestAttribution, subdomains: '1234'};
|
||||
|
||||
var cloudmadeURL = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
|
||||
cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
|
||||
cloudmadeOptions = {maxZoom: 18, attribution: cloudmadeAttribution};
|
||||
|
||||
var osmorg = new L.TileLayer(osmorgURL, osmorgOptions),
|
||||
osmde = new L.TileLayer(osmdeURL, osmdeOptions),
|
||||
mapquest = new L.TileLayer(mapquestURL, mapquestOptions),
|
||||
cloudmade = new L.TileLayer(cloudmadeURL, cloudmadeOptions);
|
||||
|
||||
// setup map
|
||||
OSRM.G.map = new L.Map('map', {
|
||||
center: new L.LatLng(51.505, -0.09),
|
||||
zoom: 13,
|
||||
zoomAnimation: false, // false: removes animations and hiding of routes during zoom
|
||||
fadeAnimation: false,
|
||||
layers: [osmorg]
|
||||
});
|
||||
|
||||
// add tileservers
|
||||
var baseMaps = {
|
||||
"osm.org": osmorg,
|
||||
"osm.de": osmde,
|
||||
"MapQuest": mapquest,
|
||||
"CloudMade": cloudmade
|
||||
};
|
||||
|
||||
var overlayMaps = {};
|
||||
var layersControl = new L.Control.Layers(baseMaps, overlayMaps);
|
||||
OSRM.G.map.addControl(layersControl);
|
||||
|
||||
// move zoom markers
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.left="420px";
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.top="5px";
|
||||
|
||||
// initial map position and zoom
|
||||
OSRM.G.map.setView( new L.LatLng( OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE), OSRM.DEFAULTS.ZOOM_LEVEL);
|
||||
OSRM.G.map.on('zoomend', function(e) { getRoute(OSRM.C.FULL_DESCRIPTION); });
|
||||
OSRM.G.map.on('contextmenu', function(e) {});
|
||||
|
||||
// click on map to set source and target nodes
|
||||
OSRM.G.map.on('click', function(e) {
|
||||
if( !OSRM.G.markers.hasSource() ) {
|
||||
var index = OSRM.G.markers.setSource( e.latlng );
|
||||
updateAddress( OSRM.C.SOURCE_LABEL, OSRM.C.DO_FALLBACK_TO_LAT_LNG );
|
||||
OSRM.G.markers.route[index].show();
|
||||
OSRM.G.markers.route[index].centerView( OSRM.G.map.getZoom() );
|
||||
getRoute( OSRM.C.FULL_DESCRIPTION );
|
||||
} else if( !OSRM.G.markers.hasTarget() ) {
|
||||
var index = OSRM.G.markers.setTarget( e.latlng );
|
||||
updateAddress( OSRM.C.TARGET_LABEL, OSRM.C.DO_FALLBACK_TO_LAT_LNG );
|
||||
OSRM.G.markers.route[index].show();
|
||||
OSRM.G.markers.route[index].centerView( OSRM.G.map.getZoom() );
|
||||
getRoute( OSRM.C.FULL_DESCRIPTION );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
// parse URL GET parameters if any exist
|
||||
function checkURL(){
|
||||
var called_url = document.location.search.substr(1,document.location.search.length);
|
||||
|
||||
// reject messages that are clearly too long or too small
|
||||
if( called_url.length > 1000 || called_url.length == 0)
|
||||
return;
|
||||
|
||||
// storage for parameter values
|
||||
var positions = [];
|
||||
var zoom = null;
|
||||
var center = null;
|
||||
var destination = null;
|
||||
var destination_name = null;
|
||||
|
||||
// parse input
|
||||
var splitted_url = called_url.split('&');
|
||||
for(var i=0; i<splitted_url.length; i++) {
|
||||
var name_val = splitted_url[i].split('=');
|
||||
if(name_val.length!=2)
|
||||
continue;
|
||||
|
||||
if(name_val[0] == 'loc') {
|
||||
var coordinates = unescape(name_val[1]).split(',');
|
||||
if(coordinates.length!=2 || !isLatitude(coordinates[0]) || !isLongitude(coordinates[1]) )
|
||||
return;
|
||||
positions.push ( new L.LatLng( coordinates[0], coordinates[1]) );
|
||||
}
|
||||
else if(name_val[0] == 'dest') {
|
||||
var coordinates = unescape(name_val[1]).split(',');
|
||||
if(coordinates.length!=2 || !isLatitude(coordinates[0]) || !isLongitude(coordinates[1]) )
|
||||
return;
|
||||
destination = new L.LatLng( coordinates[0], coordinates[1]);
|
||||
}
|
||||
else if(name_val[0] == 'destname') {
|
||||
destination_name = decodeURI(name_val[1]).replace(/<\/?[^>]+(>|$)/g ,""); // discard tags
|
||||
}
|
||||
else if(name_val[0] == 'z') {
|
||||
zoom = name_val[1];
|
||||
if( zoom<0 || zoom > 18)
|
||||
return;
|
||||
}
|
||||
else if(name_val[0] == 'center') {
|
||||
var coordinates = unescape(name_val[1]).split(',');
|
||||
if(coordinates.length!=2 || !isLatitude(coordinates[0]) || !isLongitude(coordinates[1]) )
|
||||
return;
|
||||
center = new L.LatLng( coordinates[0], coordinates[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// case 1: destination given
|
||||
if( destination != undefined ) {
|
||||
var index = OSRM.G.markers.setTarget( e.latlng );
|
||||
if( destination_name == null )
|
||||
updateAddress( OSRM.C.TARGET_LABEL, OSRM.C.DO_FALLBACK_TO_LAT_LNG );
|
||||
else
|
||||
document.getElementById("input-target-name").value = destination_name;
|
||||
OSRM.G.markers.route[index].show();
|
||||
OSRM.G.markers.route[index].centerView();
|
||||
return;
|
||||
}
|
||||
|
||||
// case 2: locations given
|
||||
if( positions != []) {
|
||||
// draw via points
|
||||
if( positions.length > 0) {
|
||||
OSRM.G.markers.setSource( positions[0] );
|
||||
updateAddress( OSRM.C.SOURCE_LABEL, OSRM.C.DO_FALLBACK_TO_LAT_LNG );
|
||||
}
|
||||
if(positions.length > 1) {
|
||||
OSRM.G.markers.setTarget( positions[positions.length-1] );
|
||||
updateAddress( OSRM.C.TARGET_LABEL, OSRM.C.DO_FALLBACK_TO_LAT_LNG );
|
||||
}
|
||||
for(var i=1; i<positions.length-1;i++)
|
||||
OSRM.G.markers.setVia( i-1, positions[i] );
|
||||
for(var i=0; i<OSRM.G.markers.route.length;i++)
|
||||
OSRM.G.markers.route[i].show();
|
||||
|
||||
// center on route (support for old links) / move to given view (new behaviour)
|
||||
if(zoom == null || center == null) {
|
||||
var bounds = new L.LatLngBounds( positions );
|
||||
OSRM.G.map.fitBounds( bounds );
|
||||
} else {
|
||||
OSRM.G.map.setView(center, zoom);
|
||||
}
|
||||
|
||||
// compute route
|
||||
getRoute(OSRM.C.FULL_DESCRIPTION);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,490 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM routing routines
|
||||
// [management of routing/direction requests and processing of responses]
|
||||
// [TODO: major refactoring scheduled]
|
||||
|
||||
// some variables
|
||||
OSRM.GLOBALS.route = null;
|
||||
OSRM.GLOBALS.markers = null;
|
||||
|
||||
OSRM.CONSTANTS.NO_DESCRIPTION = 0;
|
||||
OSRM.CONSTANTS.FULL_DESCRIPTION = 1;
|
||||
|
||||
OSRM.G.dragging = null;
|
||||
OSRM.GLOBALS.dragid = null;
|
||||
OSRM.GLOBALS.pending = false;
|
||||
OSRM.GLOBALS.pendingTimer = null;
|
||||
|
||||
|
||||
// init routing data structures
|
||||
function initRouting() {
|
||||
OSRM.G.route = new OSRM.Route();
|
||||
OSRM.G.markers = new OSRM.Markers();
|
||||
}
|
||||
|
||||
|
||||
// -- JSONP processing --
|
||||
|
||||
// process JSONP response of routing server
|
||||
function timeoutRouteSimple() {
|
||||
showNoRouteGeometry();
|
||||
showNoRouteDescription();
|
||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("TIMED_OUT")+".<p>";
|
||||
}
|
||||
function timeoutRoute() {
|
||||
showNoRouteGeometry();
|
||||
OSRM.G.route.hideUnnamedRoute();
|
||||
showNoRouteDescription();
|
||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("TIMED_OUT")+".<p>";
|
||||
}
|
||||
function showRouteSimple(response) {
|
||||
if(!response)
|
||||
return;
|
||||
|
||||
if( !OSRM.G.dragging ) // prevent simple routing when no longer dragging
|
||||
return;
|
||||
|
||||
if( response.status == 207) {
|
||||
showNoRouteGeometry();
|
||||
showNoRouteDescription();
|
||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("YOUR_ROUTE_IS_BEING_COMPUTED")+".<p>";
|
||||
} else {
|
||||
showRouteGeometry(response);
|
||||
showRouteDescriptionSimple(response);
|
||||
}
|
||||
updateHints(response);
|
||||
|
||||
// // TODO: hack to process final drag event, if it was fenced, but we are still dragging (alternative approach)
|
||||
// if(OSRM.G.pending) {
|
||||
// clearTimeout(OSRM.G.pendingTimer);
|
||||
// OSRM.G.pendingTimer = setTimeout(timeoutDrag,100);
|
||||
// }
|
||||
}
|
||||
function showRoute(response) {
|
||||
if(!response)
|
||||
return;
|
||||
|
||||
if(response.status == 207) {
|
||||
showNoRouteGeometry();
|
||||
OSRM.G.route.hideUnnamedRoute();
|
||||
showNoRouteDescription();
|
||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("NO_ROUTE_FOUND")+".<p>";
|
||||
} else {
|
||||
showRouteGeometry(response);
|
||||
showRouteNonames(response);
|
||||
showRouteDescription(response);
|
||||
snapRoute();
|
||||
}
|
||||
updateHints(response);
|
||||
}
|
||||
|
||||
|
||||
// show route geometry
|
||||
function showNoRouteGeometry() {
|
||||
var positions = [];
|
||||
for(var i=0; i<OSRM.G.markers.route.length;i++)
|
||||
positions.push( OSRM.G.markers.route[i].getPosition() );
|
||||
|
||||
OSRM.G.route.showRoute(positions, OSRM.Route.NOROUTE);
|
||||
}
|
||||
function showRouteGeometry(response) {
|
||||
OSRM.G.via_points = response.via_points.slice(0);
|
||||
|
||||
var geometry = decodeRouteGeometry(response.route_geometry, 5);
|
||||
|
||||
var points = [];
|
||||
for( var i=0; i < geometry.length; i++) {
|
||||
points.push( new L.LatLng(geometry[i][0], geometry[i][1]) );
|
||||
}
|
||||
OSRM.G.route.showRoute(points, OSRM.Route.ROUTE);
|
||||
}
|
||||
|
||||
|
||||
// route description display (and helper functions)
|
||||
function onClickRouteDescription(geometry_index) {
|
||||
var positions = OSRM.G.route.getPositions();
|
||||
|
||||
OSRM.G.markers.highlight.setPosition( positions[geometry_index] );
|
||||
OSRM.G.markers.highlight.show();
|
||||
OSRM.G.markers.highlight.centerView(OSRM.DEFAULTS.HIGHLIGHT_ZOOM_LEVEL);
|
||||
}
|
||||
function onClickCreateShortcut(src){
|
||||
src += '&z='+ OSRM.G.map.getZoom() + '¢er=' + OSRM.G.map.getCenter().lat + ',' + OSRM.G.map.getCenter().lng;
|
||||
OSRM.JSONP.call(OSRM.DEFAULTS.HOST_SHORTENER_URL+src, showRouteLink, showRouteLink_TimeOut, 2000, 'shortener');
|
||||
document.getElementById('route-prelink').innerHTML = '['+OSRM.loc("GENERATE_LINK_TO_ROUTE")+']';
|
||||
}
|
||||
function showRouteLink(response){
|
||||
document.getElementById('route-prelink').innerHTML = '[<a id="gpx-link" class = "text-selectable" href="' +response.ShortURL+ '">'+response.ShortURL+'</a>]';
|
||||
}
|
||||
function showRouteLink_TimeOut(){
|
||||
document.getElementById('route-prelink').innerHTML = '['+OSRM.loc("LINK_TO_ROUTE_TIMEOUT")+']';
|
||||
}
|
||||
function showRouteDescription(response) {
|
||||
// compute query string
|
||||
var query_string = '?rebuild=1';
|
||||
for(var i=0; i<OSRM.G.markers.route.length; i++)
|
||||
query_string += '&loc=' + OSRM.G.markers.route[i].getLat() + ',' + OSRM.G.markers.route[i].getLng();
|
||||
|
||||
// create link to the route
|
||||
var route_link ='<span class="route-summary" id="route-prelink">[<a id="gpx-link" onclick="onClickCreateShortcut(\'' + OSRM.DEFAULTS.WEBSITE_URL + query_string + '\')">'+OSRM.loc("GET_LINK_TO_ROUTE")+'</a>]</span>';
|
||||
|
||||
// create GPX link
|
||||
var gpx_link = '<span class="route-summary">[<a id="gpx-link" onClick="document.location.href=\'' + OSRM.DEFAULTS.HOST_ROUTING_URL + query_string + '&output=gpx\';">'+OSRM.loc("GPX_FILE")+'</a>]</span>';
|
||||
|
||||
// create route description
|
||||
var route_desc = "";
|
||||
route_desc += '<table class="results-table">';
|
||||
|
||||
for(var i=0; i < response.route_instructions.length; i++){
|
||||
//odd or even ?
|
||||
var rowstyle='results-odd';
|
||||
if(i%2==0) { rowstyle='results-even'; }
|
||||
|
||||
route_desc += '<tr class="'+rowstyle+'">';
|
||||
|
||||
route_desc += '<td class="result-directions">';
|
||||
route_desc += '<img width="18px" src="images/'+getDirectionIcon(response.route_instructions[i][0])+'"/>';
|
||||
route_desc += "</td>";
|
||||
|
||||
route_desc += '<td class="result-items">';
|
||||
route_desc += '<span class="result-item" onclick="onClickRouteDescription('+response.route_instructions[i][3]+')">';
|
||||
route_desc += response.route_instructions[i][0];
|
||||
if( i == 0 )
|
||||
route_desc += ' ' + OSRM.loc( response.route_instructions[i][6] );
|
||||
if( response.route_instructions[i][1] != "" ) {
|
||||
route_desc += ' on ';
|
||||
route_desc += '<b>' + response.route_instructions[i][1] + '</b>';
|
||||
}
|
||||
//route_desc += ' for ';
|
||||
route_desc += '</span>';
|
||||
route_desc += "</td>";
|
||||
|
||||
route_desc += '<td class="result-distance">';
|
||||
if( i != response.route_instructions.length-1 )
|
||||
route_desc += '<b>'+getDistanceWithUnit(response.route_instructions[i][2])+'</b>';
|
||||
route_desc += "</td>";
|
||||
|
||||
route_desc += "</tr>";
|
||||
}
|
||||
|
||||
route_desc += '</table>';
|
||||
headline = "";
|
||||
headline += OSRM.loc("ROUTE_DESCRIPTION")+":<br>";
|
||||
headline += '<div style="float:left;width:40%">';
|
||||
headline += "<span class='route-summary'>"
|
||||
+ OSRM.loc("DISTANCE")+": " + getDistanceWithUnit(response.route_summary.total_distance)
|
||||
+ "<br>"
|
||||
+ OSRM.loc("DURATION")+": " + secondsToTime(response.route_summary.total_time)
|
||||
+ "</span>";
|
||||
headline += '</div>';
|
||||
headline += '<div style="float:left;text-align:right;width:60%;">'+route_link+'<br>'+gpx_link+'</div>';
|
||||
|
||||
var output = "";
|
||||
output += route_desc;
|
||||
|
||||
document.getElementById('information-box-headline').innerHTML = headline;
|
||||
document.getElementById('information-box').innerHTML = output;
|
||||
}
|
||||
function showRouteDescriptionSimple(response) {
|
||||
headline = OSRM.loc("ROUTE_DESCRIPTION")+":<br>";
|
||||
headline += "<span class='route-summary'>"
|
||||
+ OSRM.loc("DISTANCE")+": " + getDistanceWithUnit(response.route_summary.total_distance)
|
||||
+ "<br>"
|
||||
+ OSRM.loc("DURATION")+": " + secondsToTime(response.route_summary.total_time)
|
||||
+ "</span>";
|
||||
headline += '<br><br>';
|
||||
|
||||
document.getElementById('information-box-headline').innerHTML = headline;
|
||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("YOUR_ROUTE_IS_BEING_COMPUTED")+".<p>";
|
||||
}
|
||||
function showNoRouteDescription() {
|
||||
headline = OSRM.loc("ROUTE_DESCRIPTION")+":<br>";
|
||||
headline += "<span class='route-summary'>"
|
||||
+ OSRM.loc("DISTANCE")+": N/A"
|
||||
+ "<br>"
|
||||
+ OSRM.loc("DURATION")+": N/A"
|
||||
+ "</span>";
|
||||
headline += '<br><br>';
|
||||
|
||||
document.getElementById('information-box-headline').innerHTML = headline;
|
||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("YOUR_ROUTE_IS_BEING_COMPUTED")+".<p>";
|
||||
}
|
||||
|
||||
|
||||
// unnamed streets display
|
||||
function showRouteNonames(response) {
|
||||
// do not display unnamed streets?
|
||||
if( document.getElementById('option-highlight-nonames').checked == false) {
|
||||
OSRM.G.route.hideUnnamedRoute();
|
||||
return;
|
||||
}
|
||||
|
||||
// mark geometry positions where unnamed/named streets switch
|
||||
var named = [];
|
||||
for (var i = 0; i < response.route_instructions.length; i++) {
|
||||
if( response.route_instructions[i][1] == '' )
|
||||
named[ response.route_instructions[i][3] ] = false; // no street name
|
||||
else
|
||||
named[ response.route_instructions[i][3] ] = true; // yes street name
|
||||
}
|
||||
|
||||
// aggregate geometry for unnamed streets
|
||||
var geometry = decodeRouteGeometry(response.route_geometry, 5);
|
||||
var is_named = true;
|
||||
var current_positions = [];
|
||||
var all_positions = [];
|
||||
for( var i=0; i < geometry.length; i++) {
|
||||
current_positions.push( new L.LatLng(geometry[i][0], geometry[i][1]) );
|
||||
|
||||
// still named/unnamed?
|
||||
if( (named[i] == is_named || named[i] == undefined) && i != geometry.length-1 )
|
||||
continue;
|
||||
|
||||
// switch between named/unnamed!
|
||||
if(is_named == false)
|
||||
all_positions.push( current_positions );
|
||||
current_positions = [];
|
||||
current_positions.push( new L.LatLng(geometry[i][0], geometry[i][1]) );
|
||||
is_named = named[i];
|
||||
}
|
||||
|
||||
// display unnamed streets
|
||||
OSRM.G.route.showUnnamedRoute(all_positions);
|
||||
}
|
||||
|
||||
|
||||
//-- main function --
|
||||
|
||||
// generate server calls to query routes
|
||||
function getRoute(do_description) {
|
||||
|
||||
// if source or target are not set -> hide route
|
||||
if( OSRM.G.markers.route.length < 2 ) {
|
||||
OSRM.G.route.hideRoute();
|
||||
return;
|
||||
}
|
||||
|
||||
// prepare JSONP call
|
||||
var type = null;
|
||||
var callback = null;
|
||||
var timeout = null;
|
||||
|
||||
var source = OSRM.DEFAULTS.HOST_ROUTING_URL;
|
||||
source += '?z=' + OSRM.G.map.getZoom() + '&output=json' + '&geomformat=cmp';
|
||||
if(OSRM.G.markers.checksum)
|
||||
source += '&checksum=' + OSRM.G.markers.checksum;
|
||||
for(var i=0; i<OSRM.G.markers.route.length; i++) {
|
||||
source += '&loc=' + OSRM.G.markers.route[i].getLat() + ',' + OSRM.G.markers.route[i].getLng();
|
||||
if( OSRM.G.markers.route[i].hint)
|
||||
source += '&hint=' + OSRM.G.markers.route[i].hint;
|
||||
}
|
||||
|
||||
// decide whether it is a dragging call or a normal one
|
||||
if (do_description) {
|
||||
callback = showRoute;
|
||||
timeout = timeoutRoute;
|
||||
source +='&instructions=true';
|
||||
type = 'route';
|
||||
} else {
|
||||
callback = showRouteSimple;
|
||||
timeout = timeoutRouteSimple;
|
||||
source +='&instructions=false';
|
||||
type = 'dragging';
|
||||
}
|
||||
|
||||
// do call
|
||||
var called = OSRM.JSONP.call(source, callback, timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, type);
|
||||
|
||||
// TODO: hack to process final drag event, if it was fenced, but we are still dragging
|
||||
if(called == false && !do_description) {
|
||||
clearTimeout(OSRM.G.pendingTimer);
|
||||
OSRM.G.pendingTimer = setTimeout(timeoutDrag,OSRM.DEFAULTS.JSONP_TIMEOUT);
|
||||
}
|
||||
else {
|
||||
clearTimeout(OSRM.G.pendingTimer);
|
||||
}
|
||||
// // TODO: hack to process final drag event, if it was fenced, but we are still dragging (alternative approach)
|
||||
// if(called == false && !do_description) {
|
||||
// OSRM.G.pending = true;
|
||||
// } else {
|
||||
// clearTimeout(OSRM.G.pendingTimer);
|
||||
// OSRM.G.pending = false;
|
||||
// }
|
||||
}
|
||||
function timeoutDrag() {
|
||||
OSRM.G.markers.route[OSRM.G.dragid].hint = null;
|
||||
getRoute(OSRM.C.NO_DESCRIPTION);
|
||||
}
|
||||
|
||||
|
||||
//-- helper functions --
|
||||
|
||||
//decode compressed route geometry
|
||||
function decodeRouteGeometry(encoded, precision) {
|
||||
precision = Math.pow(10, -precision);
|
||||
var len = encoded.length, index=0, lat=0, lng = 0, array = [];
|
||||
while (index < len) {
|
||||
var b, shift = 0, result = 0;
|
||||
do {
|
||||
b = encoded.charCodeAt(index++) - 63;
|
||||
result |= (b & 0x1f) << shift;
|
||||
shift += 5;
|
||||
} while (b >= 0x20);
|
||||
var dlat = ((result & 1) ? ~(result >> 1) : (result >> 1));
|
||||
lat += dlat;
|
||||
shift = 0;
|
||||
result = 0;
|
||||
do {
|
||||
b = encoded.charCodeAt(index++) - 63;
|
||||
result |= (b & 0x1f) << shift;
|
||||
shift += 5;
|
||||
} while (b >= 0x20);
|
||||
var dlng = ((result & 1) ? ~(result >> 1) : (result >> 1));
|
||||
lng += dlng;
|
||||
array.push([lat * precision, lng * precision]);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// update hints of all markers
|
||||
function updateHints(response) {
|
||||
var hint_locations = response.hint_data.locations;
|
||||
OSRM.G.markers.checksum = response.hint_data.checksum;
|
||||
for(var i=0; i<hint_locations.length; i++)
|
||||
OSRM.G.markers.route[i].hint = hint_locations[i];
|
||||
}
|
||||
|
||||
// snap all markers to the received route
|
||||
function snapRoute() {
|
||||
var positions = OSRM.G.route.getPositions();
|
||||
|
||||
OSRM.G.markers.route[0].setPosition( positions[0] );
|
||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].setPosition( positions[positions.length-1] );
|
||||
for(var i=0; i<OSRM.G.via_points.length; i++)
|
||||
OSRM.G.markers.route[i+1].setPosition( new L.LatLng(OSRM.G.via_points[i][0], OSRM.G.via_points[i][1]) );
|
||||
|
||||
updateAddress(OSRM.C.SOURCE_LABEL);
|
||||
updateAddress(OSRM.C.TARGET_LABEL);
|
||||
}
|
||||
|
||||
// map driving instructions to icons
|
||||
// [TODO: better implementation, language-safe]
|
||||
function getDirectionIcon(name) {
|
||||
var directions = {
|
||||
"Turn left":"turn-left.png",
|
||||
"Turn right":"turn-right.png",
|
||||
"U-Turn":"u-turn.png",
|
||||
"Head":"continue.png",
|
||||
"Continue":"continue.png",
|
||||
"Turn slight left":"slight-left.png",
|
||||
"Turn slight right":"slight-right.png",
|
||||
"Turn sharp left":"sharp-left.png",
|
||||
"Turn sharp right":"sharp-right.png",
|
||||
"Enter roundabout and leave at first exit":"round-about.png",
|
||||
"Enter roundabout and leave at second exit":"round-about.png",
|
||||
"Enter roundabout and leave at third exit":"round-about.png",
|
||||
"Enter roundabout and leave at fourth exit":"round-about.png",
|
||||
"Enter roundabout and leave at fifth exit":"round-about.png",
|
||||
"Enter roundabout and leave at sixth exit":"round-about.png",
|
||||
"Enter roundabout and leave at seventh exit":"round-about.png",
|
||||
"Enter roundabout and leave at eighth exit":"round-about.png",
|
||||
"Enter roundabout and leave at nineth exit":"round-about.png",
|
||||
"Enter roundabout and leave at tenth exit":"round-about.png",
|
||||
"Enter roundabout and leave at one of the too many exit":"round-about.png",
|
||||
"You have reached your destination":"target.png"
|
||||
};
|
||||
|
||||
if( directions[name] )
|
||||
return directions[name];
|
||||
else
|
||||
return "default.png";
|
||||
}
|
||||
|
||||
|
||||
// -- gui functions --
|
||||
|
||||
// click: button "reset"
|
||||
function resetRouting() {
|
||||
document.getElementById('input-source-name').value = "";
|
||||
document.getElementById('input-target-name').value = "";
|
||||
|
||||
OSRM.G.route.hideAll();
|
||||
OSRM.G.markers.removeAll();
|
||||
OSRM.G.markers.highlight.hide();
|
||||
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-headline').innerHTML = "";
|
||||
|
||||
OSRM.JSONP.reset();
|
||||
}
|
||||
|
||||
// click: button "reverse"
|
||||
function reverseRouting() {
|
||||
// invert input boxes
|
||||
var tmp = document.getElementById("input-source-name").value;
|
||||
document.getElementById("input-source-name").value = document.getElementById("input-target-name").value;
|
||||
document.getElementById("input-target-name").value = tmp;
|
||||
|
||||
// invert route
|
||||
OSRM.G.markers.route.reverse();
|
||||
if(OSRM.G.markers.route.length == 1) {
|
||||
if(OSRM.G.markers.route[0].label == OSRM.C.TARGET_LABEL) {
|
||||
OSRM.G.markers.route[0].label = OSRM.C.SOURCE_LABEL;
|
||||
OSRM.G.markers.route[0].marker.setIcon( new L.Icon('images/marker-source.png') );
|
||||
} else if(OSRM.G.markers.route[0].label == OSRM.C.SOURCE_LABEL) {
|
||||
OSRM.G.markers.route[0].label = OSRM.C.TARGET_LABEL;
|
||||
OSRM.G.markers.route[0].marker.setIcon( new L.Icon('images/marker-target.png') );
|
||||
}
|
||||
} else if(OSRM.G.markers.route.length > 1){
|
||||
OSRM.G.markers.route[0].label = OSRM.C.SOURCE_LABEL;
|
||||
OSRM.G.markers.route[0].marker.setIcon( new L.Icon('images/marker-source.png') );
|
||||
|
||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].label = OSRM.C.TARGET_LABEL;
|
||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].marker.setIcon( new L.Icon('images/marker-target.png') );
|
||||
}
|
||||
|
||||
// recompute route
|
||||
if( OSRM.G.route.isShown() ) {
|
||||
getRoute(OSRM.C.FULL_DESCRIPTION);
|
||||
OSRM.G.markers.highlight.hide();
|
||||
} else {
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-headline').innerHTML = "";
|
||||
}
|
||||
}
|
||||
|
||||
// click: button "show"
|
||||
function showMarker(marker_id) {
|
||||
if( OSRM.JSONP.fences["geocoder_source"] || OSRM.JSONP.fences["geocoder_target"] )
|
||||
return;
|
||||
|
||||
if( marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() )
|
||||
OSRM.G.markers.route[0].centerView();
|
||||
else if( marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() )
|
||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].centerView();
|
||||
}
|
||||
|
||||
|
||||
// changed: any inputbox (is called when return is pressed [after] or focus is lost [before])
|
||||
function inputChanged(marker_id) {
|
||||
if( marker_id == OSRM.C.SOURCE_LABEL)
|
||||
callGeocoder(OSRM.C.SOURCE_LABEL, document.getElementById('input-source-name').value);
|
||||
else if( marker_id == OSRM.C.TARGET_LABEL)
|
||||
callGeocoder(OSRM.C.TARGET_LABEL, document.getElementById('input-target-name').value);
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// compatibility tools for old browsers
|
||||
function getElementsByClassName(node, classname) {
|
||||
var a = [];
|
||||
var re = new RegExp('(^| )'+classname+'( |$)');
|
||||
var els = node.getElementsByTagName("*");
|
||||
for(var i=0,j=els.length; i<j; i++)
|
||||
if(re.test(els[i].className))a.push(els[i]);
|
||||
return a;
|
||||
}
|
||||
document.head = document.head || document.getElementsByTagName('head')[0];
|
||||
|
||||
// ------------------------------------------------------
|
||||
|
||||
// human readable time
|
||||
function secondsToTime(seconds){
|
||||
seconds = parseInt(seconds);
|
||||
minutes = parseInt(seconds/60);
|
||||
seconds = seconds%60;
|
||||
hours = parseInt(minutes/60);
|
||||
minutes = minutes%60;
|
||||
if(hours==0){
|
||||
return minutes + ' ' + 'min';
|
||||
}
|
||||
else{
|
||||
return hours + ' ' + 'h' + ' ' + minutes + ' ' + 'min';
|
||||
}
|
||||
}
|
||||
|
||||
// human readable distance
|
||||
function getDistanceWithUnit(distance){
|
||||
distance = parseInt(distance);
|
||||
|
||||
if(distance >= 100000){ return (parseInt(distance/1000))+' ' + 'km'; }
|
||||
else if(distance >= 10000){ return (parseInt(distance/1000).toFixed(1))+' ' + 'km'; }
|
||||
else if(distance >= 1000){ return (parseFloat(distance/1000).toFixed(2))+' ' + 'km'; }
|
||||
else{ return distance+' ' + 'm'; }
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
|
||||
// verify angles
|
||||
function isLatitude(value) {
|
||||
if( value >=-90 && value <=90)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
function isLongitude(value) {
|
||||
if( value >=-180 && value <=180)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------
|
||||
|
||||
// distance between two points
|
||||
function distanceBetweenPoint(x1, y1, x2, y2) {
|
||||
var a = x1 - x2;
|
||||
var b = y1 - y2;
|
||||
return Math.sqrt(a*a + b*b);
|
||||
}
|
||||
|
||||
// distance from a point to a line or segment
|
||||
// (x,y) point
|
||||
// (x0,y0) line point A
|
||||
// (x1,y1) line point B
|
||||
// o specifies if the distance should respect the limits of the segment (overLine = true)
|
||||
// or if it should consider the segment as an infinite line (overLine = false);
|
||||
// if false returns the distance from the point to the line,
|
||||
// otherwise the distance from the point to the segment
|
||||
function dotLineLength(x, y, x0, y0, x1, y1, o){
|
||||
function lineLength(x, y, x0, y0){return Math.sqrt((x -= x0) * x + (y -= y0) * y);}
|
||||
|
||||
if(o && !(o = function(x, y, x0, y0, x1, y1){
|
||||
if(!(x1 - x0)) return {x: x0, y: y};
|
||||
else if(!(y1 - y0)) return {x: x, y: y0};
|
||||
var left, tg = -1 / ((y1 - y0) / (x1 - x0));
|
||||
return {x: left = (x1 * (x * tg - y + y0) + x0 * (x * - tg + y - y1)) / (tg * (x1 - x0) + y0 - y1), y: tg * left - tg * x + y};
|
||||
}(x, y, x0, y0, x1, y1) && o.x >= Math.min(x0, x1) && o.x <= Math.max(x0, x1) && o.y >= Math.min(y0, y1) && o.y <= Math.max(y0, y1))){
|
||||
var l1 = lineLength(x, y, x0, y0), l2 = lineLength(x, y, x1, y1);
|
||||
return l1 > l2 ? l2 : l1;
|
||||
}
|
||||
else {
|
||||
var a = y0 - y1, b = x1 - x0, c = x0 * y1 - y0 * x1;
|
||||
return Math.abs(a * x + b * y + c) / Math.sqrt(a * a + b * b);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// store location of via points returned by server
|
||||
OSRM.GLOBALS.via_points = null;
|
||||
|
||||
|
||||
// find route segment of current route geometry that is closest to the new via node (marked by index of its endpoint)
|
||||
function findNearestRouteSegment( new_via ) {
|
||||
var min_dist = Number.MAX_VALUE;
|
||||
var min_index = undefined;
|
||||
|
||||
var positions = OSRM.G.route.getPositions();
|
||||
for(var i=0; i<positions.length-1; i++) {
|
||||
var dist = dotLineLength( new_via.lng, new_via.lat, positions[i].lng, positions[i].lat, positions[i+1].lng, positions[i+1].lat, true);
|
||||
if( dist < min_dist) {
|
||||
min_dist = dist;
|
||||
min_index = i+1;
|
||||
}
|
||||
}
|
||||
|
||||
return min_index;
|
||||
}
|
||||
|
||||
|
||||
// find the correct index among all via nodes to insert the new via node, and insert it
|
||||
function findViaPosition( new_via_position ) {
|
||||
// find route segment that is closest to click position (marked by last index)
|
||||
var nearest_index = findNearestRouteSegment( new_via_position );
|
||||
|
||||
// find correct index to insert new via node
|
||||
var new_via_index = OSRM.G.via_points.length;
|
||||
var via_index = Array();
|
||||
for(var i=0; i<OSRM.G.via_points.length; i++) {
|
||||
via_index[i] = findNearestRouteSegment( new L.LatLng(OSRM.G.via_points[i][0], OSRM.G.via_points[i][1]) );
|
||||
if(via_index[i] > nearest_index) {
|
||||
new_via_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// add via node
|
||||
var index = OSRM.G.markers.setVia(new_via_index, new_via_position);
|
||||
OSRM.G.markers.route[index].show();
|
||||
|
||||
getRoute(OSRM.C.FULL_DESCRIPTION);
|
||||
|
||||
return new_via_index;
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
@ECHO OFF
|
||||
SETLOCAL
|
||||
SET EL=0
|
||||
|
||||
ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
SET PROJECT_DIR=%CD%
|
||||
ECHO PROJECT_DIR^: %PROJECT_DIR%
|
||||
ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS%
|
||||
ECHO cmake^: && cmake --version
|
||||
IF %ERRORLEVEL% NEQ 0 ECHO CMAKE not found && GOTO CMAKE_NOT_OK
|
||||
|
||||
cmake --version | findstr /C:"3.7.0" && GOTO CMAKE_OK
|
||||
|
||||
:CMAKE_NOT_OK
|
||||
SET CMAKE_VERSION=3.7.0-rc2
|
||||
ECHO CMAKE NOT OK - downloading new CMake %CMAKE_VERSION%
|
||||
IF NOT EXIST cm.zip powershell Invoke-WebRequest https://cmake.org/files/v3.7/cmake-%CMAKE_VERSION%-win32-x86.zip -OutFile $env:PROJECT_DIR\cm.zip
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF NOT EXIST cmake-%CMAKE_VERSION%-win32-x86 7z -y x cm.zip | %windir%\system32\FIND "ing archive"
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
SET PATH=%PROJECT_DIR%\cmake-%CMAKE_VERSION%-win32-x86\bin;%PATH%
|
||||
|
||||
:CMAKE_OK
|
||||
ECHO CMAKE_OK
|
||||
cmake --version
|
||||
|
||||
ECHO activating VS command prompt ...
|
||||
SET PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
|
||||
ECHO platform^: %platform%
|
||||
|
||||
ECHO cl.exe version
|
||||
cl
|
||||
ECHO msbuild version
|
||||
msbuild /version
|
||||
|
||||
:: HARDCODE "x64" as it is uppercase on AppVeyor and download from S3 is case sensitive
|
||||
SET DEPSPKG=osrm-deps-win-x64-14.0.7z
|
||||
|
||||
:: local development
|
||||
ECHO.
|
||||
ECHO LOCAL_DEV^: %LOCAL_DEV%
|
||||
IF NOT DEFINED LOCAL_DEV SET LOCAL_DEV=0
|
||||
IF DEFINED LOCAL_DEV IF %LOCAL_DEV% EQU 1 IF EXIST %DEPSPKG% ECHO skipping deps download && GOTO SKIPDL
|
||||
|
||||
IF EXIST %DEPSPKG% DEL %DEPSPKG%
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
ECHO downloading %DEPSPKG%
|
||||
powershell Invoke-WebRequest https://mapbox.s3.amazonaws.com/windows-builds/windows-build-deps/$env:DEPSPKG -OutFile $env:PROJECT_DIR\$env:DEPSPKG
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
:SKIPDL
|
||||
|
||||
IF EXIST osrm-deps ECHO deleting osrm-deps... && RD /S /Q osrm-deps
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF EXIST build ECHO deleting build dir... && RD /S /Q build
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
7z -y x %DEPSPKG% | %windir%\system32\FIND "ing archive"
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
::tree osrm-deps
|
||||
|
||||
MKDIR build
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
cd build
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
SET OSRMDEPSDIR=%PROJECT_DIR%/osrm-deps
|
||||
set PREFIX=%OSRMDEPSDIR%/libs
|
||||
set BOOST_ROOT=%OSRMDEPSDIR%/boost
|
||||
set BOOST_LIBRARYDIR=%BOOST_ROOT%/lib
|
||||
set TBB_INSTALL_DIR=%OSRMDEPSDIR%/tbb
|
||||
set TBB_ARCH_PLATFORM=intel64/vc14
|
||||
|
||||
ECHO OSRMDEPSDIR ^: %OSRMDEPSDIR%
|
||||
ECHO PREFIX ^: %PREFIX%
|
||||
ECHO BOOST_ROOT ^: %BOOST_ROOT%
|
||||
ECHO BOOST_LIBRARYDIR ^: %BOOST_LIBRARYDIR%
|
||||
ECHO TBB_INSTALL_DIR ^: %TBB_INSTALL_DIR%
|
||||
ECHO TBB_ARCH_PLATFORM ^: %TBB_ARCH_PLATFORM%
|
||||
|
||||
|
||||
ECHO calling cmake ....
|
||||
cmake .. ^
|
||||
-G "Visual Studio 14 2015 Win64" ^
|
||||
-DBOOST_ROOT=%BOOST_ROOT% ^
|
||||
-DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% ^
|
||||
-DBoost_ADDITIONAL_VERSIONS=1.58 ^
|
||||
-DBoost_USE_MULTITHREADED=ON ^
|
||||
-DBoost_USE_STATIC_LIBS=ON ^
|
||||
-DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
|
||||
-DCMAKE_INSTALL_PREFIX=%PREFIX%
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
ECHO building ...
|
||||
msbuild OSRM.sln ^
|
||||
/p:Configuration=%Configuration% ^
|
||||
/p:Platform=x64 ^
|
||||
/t:rebuild ^
|
||||
/p:BuildInParallel=true ^
|
||||
/m:%NUMBER_OF_PROCESSORS% ^
|
||||
/toolsversion:14.0 ^
|
||||
/p:PlatformToolset=v140 ^
|
||||
/clp:Verbosity=normal ^
|
||||
/nologo ^
|
||||
/flp1:logfile=build_errors.txt;errorsonly ^
|
||||
/flp2:logfile=build_warnings.txt;warningsonly
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
CD %PROJECT_DIR%\build
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
SET PATH=%PROJECT_DIR%\osrm-deps\libs\bin;%PATH%
|
||||
|
||||
ECHO running extractor-tests.exe ...
|
||||
unit_tests\%Configuration%\extractor-tests.exe
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
ECHO running engine-tests.exe ...
|
||||
unit_tests\%Configuration%\engine-tests.exe
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
ECHO running util-tests.exe ...
|
||||
unit_tests\%Configuration%\util-tests.exe
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
ECHO running server-tests.exe ...
|
||||
unit_tests\%Configuration%\server-tests.exe
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
IF NOT "%APPVEYOR_REPO_BRANCH%"=="master" GOTO DONE
|
||||
ECHO ========= CREATING PACKAGES ==========
|
||||
|
||||
CD %PROJECT_DIR%\build\%Configuration%
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
SET P=%PROJECT_DIR%
|
||||
SET ZIP= %P%\osrm_%Configuration%.zip
|
||||
IF EXIST %ZIP% ECHO deleting %ZIP% && DEL /F /Q %ZIP%
|
||||
IF %ERRORLEVEL% NEQ 0 ECHO deleting %ZIP% FAILED && GOTO ERROR
|
||||
|
||||
7z a %ZIP% *.lib *.exe *.pdb %P%/osrm-deps/libs/bin/*.dll -tzip -mx9 | %windir%\system32\FIND "ing archive"
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
CD ..\..\profiles
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
ECHO disk=c:\temp\stxxl,10000,wincall > .stxxl.txt
|
||||
7z a %ZIP% * -tzip -mx9 | %windir%\system32\FIND "ing archive"
|
||||
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%
|
||||
@@ -1,42 +0,0 @@
|
||||
environment:
|
||||
matrix:
|
||||
- configuration: Release
|
||||
# - configuration: Debug
|
||||
|
||||
# scripts that are called at very beginning, before repo cloning
|
||||
init:
|
||||
- git config --global core.autocrlf input
|
||||
|
||||
os: Visual Studio 2015
|
||||
|
||||
# clone directory
|
||||
clone_folder: c:\projects\osrm
|
||||
|
||||
platform: x64
|
||||
|
||||
build_script:
|
||||
- CALL appveyor-build.bat
|
||||
|
||||
test: off
|
||||
|
||||
artifacts:
|
||||
- path: osrm_Release.zip
|
||||
name: osrm_Release.zip
|
||||
# - path: osrm_Debug.zip
|
||||
# name: osrm_Debug.zip
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
deploy:
|
||||
provider: FTP
|
||||
server:
|
||||
secure: ef7oiQTTXFGt8NdNiOHm/uRFVrUttzyFbIlnaeHhQvw=
|
||||
username:
|
||||
secure: Bw+Se2GTJxA6+GtRkEc//tQSBHOuFIuJHBjFwR9cD+8=
|
||||
password:
|
||||
secure: eqwESZqxMXC/j5mOCpaXuw==
|
||||
folder: /
|
||||
enable_ssl: true
|
||||
active_mode: false
|
||||
@@ -1,33 +0,0 @@
|
||||
@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:\mb\windows-builds-64\tmp-bin\cmake-3.7.0-rc2-win32-x86\bin;%PATH%
|
||||
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%
|
||||
@@ -1,41 +0,0 @@
|
||||
IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
MESSAGE(FATAL_ERROR "Cannot configure CPack to generate Debian packages on non-linux systems.")
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(FindDebArch)
|
||||
|
||||
SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
|
||||
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENCE.TXT")
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CPACK_RESOURCE_FILE_README}")
|
||||
SET(CPACK_PACKAGE_UPSTREAM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}")
|
||||
SET(CPACK_PACKAGE_DEBIAN_REVISION "1")
|
||||
SET(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_UPSTREAM_VERSION}-${CPACK_PACKAGE_DEBIAN_REVISION}")
|
||||
|
||||
string(TOLOWER "${CMAKE_PROJECT_NAME}" LOWER_PROJECT_NAME)
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${LOWER_PROJECT_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
|
||||
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${LOWER_PROJECT_NAME}_${CPACK_PACKAGE_UPSTREAM_VERSION}_orig")
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open Source Routing Machine (OSRM).")
|
||||
SET(CPACK_PACKAGE_DESCRIPTION "Open Source Routing Machine (OSRM) is a routing engine.")
|
||||
|
||||
# To create a proper Debian/Ubuntu package, the following CMake
|
||||
# options should be used:
|
||||
|
||||
SET(CPACK_STRIP_FILES "TRUE")
|
||||
SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY "FALSE")
|
||||
SET(CPACK_GENERATOR "DEB")
|
||||
|
||||
SET(CPACK_DEBIAN_PACKAGE_NAME "${CPACK_PACKAGE_NAME}${VERSION_SUFFIX}")
|
||||
SET(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
|
||||
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Dennis Luxen <info@project-osrm.org>")
|
||||
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
SET(CPACK_DEBIAN_PACKAGE_SECTION "devel")
|
||||
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Open Source Routing Machine (OSRM) is a high-performance routing engine.
|
||||
It combines sophisticated routing algorithms with the open and free data of the OpenStreetMap."
|
||||
)
|
||||
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6-dev, libbz2-1.0, libstxxl1, libxml2, libzip2, liblua5.1-0, libtbb2, libboost-all-dev")
|
||||
|
||||
file(GLOB_RECURSE ProfileGlob ${CMAKE_SOURCE_DIR}/profiles/*)
|
||||
install(FILES ${ProfileGlob} DESTINATION "share/doc/${LOWER_PROJECT_NAME}/profiles")
|
||||
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_BINARY_DIR}/copyright;")
|
||||
|
||||
MESSAGE(STATUS "Debian Package: ${CPACK_DEBIAN_PACKAGE_NAME} (${CPACK_DEBIAN_PACKAGE_VERSION}) [${CPACK_PACKAGE_FILE_NAME}.deb]")
|
||||
@@ -1,29 +0,0 @@
|
||||
# - 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,19 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2013 Emmanuel Roullit <emmanuel.roullit@gmail.com>
|
||||
#
|
||||
|
||||
IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
|
||||
FIND_PROGRAM(DPKG_CMD dpkg)
|
||||
IF(NOT DPKG_CMD)
|
||||
EXECUTE_PROCESS(COMMAND uname -p
|
||||
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
MESSAGE(STATUS "Can not find dpkg in your path, default to uname -p: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.")
|
||||
ELSE(NOT DPKG_CMD)
|
||||
EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture
|
||||
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
ENDIF(NOT DPKG_CMD)
|
||||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
|
||||
@@ -1,188 +0,0 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#.rst:
|
||||
# FindLua
|
||||
# -------
|
||||
#
|
||||
#
|
||||
#
|
||||
# Locate Lua library This module defines
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# LUA_FOUND - if false, do not try to link to Lua
|
||||
# LUA_LIBRARIES - both lua and lualib
|
||||
# LUA_INCLUDE_DIR - where to find lua.h
|
||||
# LUA_VERSION_STRING - the version of Lua found
|
||||
# LUA_VERSION_MAJOR - the major version of Lua
|
||||
# LUA_VERSION_MINOR - the minor version of Lua
|
||||
# LUA_VERSION_PATCH - the patch version of Lua
|
||||
#
|
||||
#
|
||||
#
|
||||
# Note that the expected include convention is
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# #include "lua.h"
|
||||
#
|
||||
# and not
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# #include <lua/lua.h>
|
||||
#
|
||||
# This is because, the lua location is not standardized and may exist in
|
||||
# locations other than lua/
|
||||
|
||||
unset(_lua_include_subdirs)
|
||||
unset(_lua_library_names)
|
||||
unset(_lua_append_versions)
|
||||
|
||||
# this is a function only to have all the variables inside go away automatically
|
||||
function(_lua_set_version_vars)
|
||||
set(LUA_VERSIONS5 5.3 5.2 5.1 5.0)
|
||||
|
||||
if (Lua_FIND_VERSION_EXACT)
|
||||
if (Lua_FIND_VERSION_COUNT GREATER 1)
|
||||
set(_lua_append_versions ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR})
|
||||
endif ()
|
||||
elseif (Lua_FIND_VERSION)
|
||||
# once there is a different major version supported this should become a loop
|
||||
if (NOT Lua_FIND_VERSION_MAJOR GREATER 5)
|
||||
if (Lua_FIND_VERSION_COUNT EQUAL 1)
|
||||
set(_lua_append_versions ${LUA_VERSIONS5})
|
||||
else ()
|
||||
foreach (subver IN LISTS LUA_VERSIONS5)
|
||||
if (NOT subver VERSION_LESS ${Lua_FIND_VERSION})
|
||||
list(APPEND _lua_append_versions ${subver})
|
||||
endif ()
|
||||
endforeach ()
|
||||
endif ()
|
||||
endif ()
|
||||
else ()
|
||||
# once there is a different major version supported this should become a loop
|
||||
set(_lua_append_versions ${LUA_VERSIONS5})
|
||||
endif ()
|
||||
|
||||
list(APPEND _lua_include_subdirs "include/lua" "include")
|
||||
|
||||
foreach (ver IN LISTS _lua_append_versions)
|
||||
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}")
|
||||
list(APPEND _lua_include_subdirs
|
||||
include/lua${CMAKE_MATCH_1}${CMAKE_MATCH_2}
|
||||
include/lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
|
||||
include/lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
|
||||
)
|
||||
list(APPEND _lua_library_names
|
||||
lua${CMAKE_MATCH_1}${CMAKE_MATCH_2}
|
||||
lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
|
||||
lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
|
||||
lua.${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
|
||||
)
|
||||
endforeach ()
|
||||
|
||||
set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE)
|
||||
set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE)
|
||||
set(_lua_append_versions "${_lua_append_versions}" PARENT_SCOPE)
|
||||
endfunction(_lua_set_version_vars)
|
||||
|
||||
function(_lua_check_header_version _hdr_file)
|
||||
# At least 5.[012] have different ways to express the version
|
||||
# so all of them need to be tested. Lua 5.2 defines LUA_VERSION
|
||||
# and LUA_RELEASE as joined by the C preprocessor, so avoid those.
|
||||
file(STRINGS "${_hdr_file}" lua_version_strings
|
||||
REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*")
|
||||
|
||||
string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};")
|
||||
if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$")
|
||||
string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};")
|
||||
string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};")
|
||||
set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
|
||||
else ()
|
||||
string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
|
||||
if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$")
|
||||
string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
|
||||
endif ()
|
||||
string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}")
|
||||
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}")
|
||||
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}")
|
||||
endif ()
|
||||
foreach (ver IN LISTS _lua_append_versions)
|
||||
if (ver STREQUAL "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}")
|
||||
set(LUA_VERSION_MAJOR ${LUA_VERSION_MAJOR} PARENT_SCOPE)
|
||||
set(LUA_VERSION_MINOR ${LUA_VERSION_MINOR} PARENT_SCOPE)
|
||||
set(LUA_VERSION_PATCH ${LUA_VERSION_PATCH} PARENT_SCOPE)
|
||||
set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE)
|
||||
return()
|
||||
endif ()
|
||||
endforeach ()
|
||||
endfunction(_lua_check_header_version)
|
||||
|
||||
_lua_set_version_vars()
|
||||
|
||||
if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
|
||||
_lua_check_header_version("${LUA_INCLUDE_DIR}/lua.h")
|
||||
endif ()
|
||||
|
||||
if (NOT LUA_VERSION_STRING)
|
||||
foreach (subdir IN LISTS _lua_include_subdirs)
|
||||
unset(LUA_INCLUDE_PREFIX CACHE)
|
||||
find_path(LUA_INCLUDE_PREFIX ${subdir}/lua.h
|
||||
HINTS
|
||||
ENV LUA_DIR
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
)
|
||||
if (LUA_INCLUDE_PREFIX)
|
||||
_lua_check_header_version("${LUA_INCLUDE_PREFIX}/${subdir}/lua.h")
|
||||
if (LUA_VERSION_STRING)
|
||||
set(LUA_INCLUDE_DIR "${LUA_INCLUDE_PREFIX}/${subdir}")
|
||||
break()
|
||||
endif ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
endif ()
|
||||
unset(_lua_include_subdirs)
|
||||
unset(_lua_append_versions)
|
||||
|
||||
find_library(LUA_LIBRARY
|
||||
NAMES ${_lua_library_names} lua
|
||||
HINTS
|
||||
ENV LUA_DIR
|
||||
PATH_SUFFIXES lib
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
unset(_lua_library_names)
|
||||
|
||||
if (LUA_LIBRARY)
|
||||
# include the math library for Unix
|
||||
if (UNIX AND NOT APPLE AND NOT BEOS)
|
||||
find_library(LUA_MATH_LIBRARY m)
|
||||
set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}")
|
||||
# For Windows and Mac, don't need to explicitly include the math library
|
||||
else ()
|
||||
set(LUA_LIBRARIES "${LUA_LIBRARY}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua
|
||||
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
|
||||
VERSION_VAR LUA_VERSION_STRING)
|
||||
|
||||
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARY LUA_MATH_LIBRARY)
|
||||
@@ -1,93 +0,0 @@
|
||||
# Locate Luabind library
|
||||
# This module defines
|
||||
# LUABIND_FOUND, if false, do not try to link to Luabind
|
||||
# LUABIND_LIBRARIES
|
||||
# LUABIND_INCLUDE_DIR, where to find luabind.hpp
|
||||
|
||||
# First we try using EXACT but in some verison of
|
||||
# cmake this would also match patch versions
|
||||
FIND_PACKAGE(Lua 5.2 EXACT)
|
||||
IF (LUA_FOUND)
|
||||
MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}")
|
||||
ELSE()
|
||||
FIND_PACKAGE(Lua 5.1 EXACT)
|
||||
IF (LUA_FOUND)
|
||||
MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}")
|
||||
ELSE()
|
||||
# Now fall back to a lua verison without exact
|
||||
# in case this cmake version also forces patch versions
|
||||
FIND_PACKAGE(Lua 5.2)
|
||||
IF (LUA_FOUND)
|
||||
MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}")
|
||||
ELSE()
|
||||
FIND_PACKAGE(Lua 5.1)
|
||||
IF (LUA_FOUND)
|
||||
MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Lua 5.1 or 5.2 was not found.")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
||||
FIND_PATH(LUABIND_INCLUDE_DIR luabind.hpp
|
||||
HINTS
|
||||
$ENV{LUABIND_DIR}
|
||||
PATH_SUFFIXES luabind include/luabind include
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/opt/local # DarwinPorts
|
||||
/opt
|
||||
)
|
||||
|
||||
FIND_LIBRARY(LUABIND_LIBRARY
|
||||
NAMES luabind luabind09
|
||||
HINTS
|
||||
$ENV{LUABIND_DIR}
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/opt/local
|
||||
/opt
|
||||
)
|
||||
|
||||
FIND_LIBRARY(LUABIND_LIBRARY_DBG
|
||||
NAMES luabindd
|
||||
HINTS
|
||||
$ENV{LUABIND_DIR}
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/opt/local
|
||||
/opt
|
||||
)
|
||||
|
||||
IF(LUABIND_LIBRARY)
|
||||
SET( LUABIND_LIBRARIES "${LUABIND_LIBRARY}" CACHE STRING "Luabind Libraries")
|
||||
ENDIF(LUABIND_LIBRARY)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set LUABIND_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Luabind DEFAULT_MSG LUABIND_LIBRARIES LUABIND_INCLUDE_DIR)
|
||||
|
||||
IF( NOT LUABIND_FIND_QUIETLY )
|
||||
IF( LUABIND_FOUND )
|
||||
MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARY}" )
|
||||
ENDIF()
|
||||
IF( LUABIND_LIBRARY_DBG )
|
||||
MESSAGE(STATUS "Luabind debug library availible: ${LUABIND_LIBRARY_DBG}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(LUABIND_INCLUDE_DIR LUABIND_LIBRARIES LUABIND_LIBRARY LUABIND_LIBRARY_DBG)
|
||||
@@ -1,51 +0,0 @@
|
||||
# Locate STXXL library
|
||||
# This module defines
|
||||
# STXXL_FOUND, if false, do not try to link to libstxxl
|
||||
# STXXL_LIBRARY
|
||||
# STXXL_INCLUDE_DIR, where to find stxxl.h
|
||||
#
|
||||
|
||||
|
||||
IF( NOT STXXL_FIND_QUIETLY )
|
||||
MESSAGE(STATUS "Looking for STXXL...")
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(STXXL_INCLUDE_DIR stxxl.h
|
||||
HINTS
|
||||
$ENV{STXXL_DIR}
|
||||
PATH_SUFFIXES stxxl include/stxxl/stxxl include/stxxl include
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/opt/local # DarwinPorts
|
||||
/opt
|
||||
)
|
||||
|
||||
FIND_LIBRARY(STXXL_LIBRARY
|
||||
NAMES stxxl stxxl_debug
|
||||
HINTS
|
||||
$ENV{STXXL_DIR}
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/opt/local
|
||||
/opt
|
||||
)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set STXXL_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(STXXL DEFAULT_MSG STXXL_LIBRARY STXXL_INCLUDE_DIR)
|
||||
|
||||
IF( NOT STXXL_FIND_QUIETLY )
|
||||
IF( STXXL_FOUND )
|
||||
MESSAGE(STATUS "Found STXXL: ${STXXL_LIBRARY}" )
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(STXXL_INCLUDE_DIR STXXL_LIBRARY)
|
||||
@@ -1,284 +0,0 @@
|
||||
# Locate Intel Threading Building Blocks include paths and libraries
|
||||
# FindTBB.cmake can be found at https://code.google.com/p/findtbb/
|
||||
# Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de>
|
||||
# Improvements by Gino van den Bergen <gino _at_ dtecta.com>,
|
||||
# Florian Uhlig <F.Uhlig _at_ gsi.de>,
|
||||
# Jiri Marsik <jiri.marsik89 _at_ gmail.com>
|
||||
|
||||
# The MIT License
|
||||
#
|
||||
# Copyright (c) 2011 Hannes Hofmann
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
# GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler.
|
||||
# e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21"
|
||||
# TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found
|
||||
# in the TBB installation directory (TBB_INSTALL_DIR).
|
||||
#
|
||||
# GvdB: Mac OS X distribution places libraries directly in lib directory.
|
||||
#
|
||||
# For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER.
|
||||
# TBB_ARCHITECTURE [ ia32 | em64t | itanium ]
|
||||
# which architecture to use
|
||||
# TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9
|
||||
# which compiler to use (detected automatically on Windows)
|
||||
|
||||
# This module respects
|
||||
# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR}
|
||||
|
||||
# This module defines
|
||||
# TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc.
|
||||
# TBB_LIBRARY_DIRS, where to find libtbb, libtbbmalloc
|
||||
# TBB_DEBUG_LIBRARY_DIRS, where to find libtbb_debug, libtbbmalloc_debug
|
||||
# TBB_INSTALL_DIR, the base TBB install directory
|
||||
# TBB_LIBRARIES, the libraries to link against to use TBB.
|
||||
# TBB_DEBUG_LIBRARIES, the libraries to link against to use TBB with debug symbols.
|
||||
# TBB_FOUND, If false, don't try to use TBB.
|
||||
# TBB_INTERFACE_VERSION, as defined in tbb/tbb_stddef.h
|
||||
|
||||
|
||||
if (WIN32)
|
||||
# has em64t/vc8 em64t/vc9
|
||||
# has ia32/vc7.1 ia32/vc8 ia32/vc9
|
||||
set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB")
|
||||
set(_TBB_LIB_NAME "tbb")
|
||||
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
|
||||
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
|
||||
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
|
||||
if (MSVC71)
|
||||
set (_TBB_COMPILER "vc7.1")
|
||||
endif(MSVC71)
|
||||
if (MSVC80)
|
||||
set(_TBB_COMPILER "vc8")
|
||||
endif(MSVC80)
|
||||
if (MSVC90)
|
||||
set(_TBB_COMPILER "vc9")
|
||||
endif(MSVC90)
|
||||
if(MSVC10)
|
||||
set(_TBB_COMPILER "vc10")
|
||||
endif(MSVC10)
|
||||
# Todo: add other Windows compilers such as ICL.
|
||||
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
|
||||
endif (WIN32)
|
||||
|
||||
if (UNIX)
|
||||
if (APPLE)
|
||||
# MAC
|
||||
set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions")
|
||||
# libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
|
||||
set(_TBB_LIB_NAME "tbb")
|
||||
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
|
||||
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
|
||||
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
|
||||
# default flavor on apple: ia32/cc4.0.1_os10.4.9
|
||||
# Jiri: There is no reason to presume there is only one flavor and
|
||||
# that user's setting of variables should be ignored.
|
||||
if(NOT TBB_COMPILER)
|
||||
set(_TBB_COMPILER "cc4.0.1_os10.4.9")
|
||||
elseif (NOT TBB_COMPILER)
|
||||
set(_TBB_COMPILER ${TBB_COMPILER})
|
||||
endif(NOT TBB_COMPILER)
|
||||
if(NOT TBB_ARCHITECTURE)
|
||||
set(_TBB_ARCHITECTURE "ia32")
|
||||
elseif(NOT TBB_ARCHITECTURE)
|
||||
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
|
||||
endif(NOT TBB_ARCHITECTURE)
|
||||
else (APPLE)
|
||||
# LINUX
|
||||
set(_TBB_DEFAULT_INSTALL_DIR "/opt/intel/tbb" "/usr/local/include" "/usr/include")
|
||||
set(_TBB_LIB_NAME "tbb")
|
||||
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
|
||||
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
|
||||
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
|
||||
# has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21
|
||||
# has ia32/*
|
||||
# has itanium/*
|
||||
set(_TBB_COMPILER ${TBB_COMPILER})
|
||||
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
|
||||
endif (APPLE)
|
||||
endif (UNIX)
|
||||
|
||||
if (CMAKE_SYSTEM MATCHES "SunOS.*")
|
||||
# SUN
|
||||
# not yet supported
|
||||
# has em64t/cc3.4.3_kernel5.10
|
||||
# has ia32/*
|
||||
endif (CMAKE_SYSTEM MATCHES "SunOS.*")
|
||||
|
||||
|
||||
#-- Clear the public variables
|
||||
set (TBB_FOUND "NO")
|
||||
|
||||
|
||||
#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR}
|
||||
# first: use CMake variable TBB_INSTALL_DIR
|
||||
if (TBB_INSTALL_DIR)
|
||||
set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR})
|
||||
endif (TBB_INSTALL_DIR)
|
||||
# second: use environment variable
|
||||
if (NOT _TBB_INSTALL_DIR)
|
||||
if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
|
||||
set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR})
|
||||
endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
|
||||
# Intel recommends setting TBB21_INSTALL_DIR
|
||||
if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
|
||||
set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR})
|
||||
endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
|
||||
if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
|
||||
set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR})
|
||||
endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
|
||||
if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
|
||||
set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR})
|
||||
endif (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
|
||||
endif (NOT _TBB_INSTALL_DIR)
|
||||
# third: try to find path automatically
|
||||
if (NOT _TBB_INSTALL_DIR)
|
||||
if (_TBB_DEFAULT_INSTALL_DIR)
|
||||
set (_TBB_INSTALL_DIR ${_TBB_DEFAULT_INSTALL_DIR})
|
||||
endif (_TBB_DEFAULT_INSTALL_DIR)
|
||||
endif (NOT _TBB_INSTALL_DIR)
|
||||
# sanity check
|
||||
if (NOT _TBB_INSTALL_DIR)
|
||||
message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
|
||||
else (NOT _TBB_INSTALL_DIR)
|
||||
# finally: set the cached CMake variable TBB_INSTALL_DIR
|
||||
if (NOT TBB_INSTALL_DIR)
|
||||
set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory")
|
||||
mark_as_advanced(TBB_INSTALL_DIR)
|
||||
endif (NOT TBB_INSTALL_DIR)
|
||||
|
||||
|
||||
#-- A macro to rewrite the paths of the library. This is necessary, because
|
||||
# find_library() always found the em64t/vc9 version of the TBB libs
|
||||
macro(TBB_CORRECT_LIB_DIR var_name)
|
||||
# if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
|
||||
string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
|
||||
# endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
|
||||
string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
|
||||
string(REPLACE vc7.1 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
||||
string(REPLACE vc8 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
||||
string(REPLACE vc9 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
||||
string(REPLACE vc10 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
||||
endmacro(TBB_CORRECT_LIB_DIR var_content)
|
||||
|
||||
|
||||
#-- Look for include directory and set ${TBB_INCLUDE_DIR}
|
||||
set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include)
|
||||
# Jiri: tbbvars now sets the CPATH environment variable to the directory
|
||||
# containing the headers.
|
||||
find_path(TBB_INCLUDE_DIR
|
||||
tbb/task_scheduler_init.h
|
||||
PATHS ${TBB_INC_SEARCH_DIR} ENV CPATH
|
||||
)
|
||||
mark_as_advanced(TBB_INCLUDE_DIR)
|
||||
|
||||
|
||||
#-- Look for libraries
|
||||
# GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh]
|
||||
if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
|
||||
set (_TBB_LIBRARY_DIR
|
||||
${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM}
|
||||
${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib
|
||||
)
|
||||
endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
|
||||
# Jiri: This block isn't mutually exclusive with the previous one
|
||||
# (hence no else), instead I test if the user really specified
|
||||
# the variables in question.
|
||||
if ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
|
||||
# HH: deprecated
|
||||
message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set \$ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).")
|
||||
# Jiri: It doesn't hurt to look in more places, so I store the hints from
|
||||
# ENV{TBB_ARCH_PLATFORM} and the TBB_ARCHITECTURE and TBB_COMPILER
|
||||
# variables and search them both.
|
||||
set (_TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib" ${_TBB_LIBRARY_DIR})
|
||||
endif ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
|
||||
|
||||
# GvdB: Mac OS X distribution places libraries directly in lib directory.
|
||||
list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib)
|
||||
|
||||
# Jiri: No reason not to check the default paths. From recent versions,
|
||||
# tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH
|
||||
# variables, which now point to the directories of the lib files.
|
||||
# It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS
|
||||
# argument instead of the implicit PATHS as it isn't hard-coded
|
||||
# but computed by system introspection. Searching the LIBRARY_PATH
|
||||
# and LD_LIBRARY_PATH environment variables is now even more important
|
||||
# that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates
|
||||
# the use of TBB built from sources.
|
||||
find_library(TBB_LIBRARY ${_TBB_LIB_NAME} HINTS ${_TBB_LIBRARY_DIR}
|
||||
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
|
||||
find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} HINTS ${_TBB_LIBRARY_DIR}
|
||||
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
|
||||
|
||||
#Extract path from TBB_LIBRARY name
|
||||
get_filename_component(TBB_LIBRARY_DIR ${TBB_LIBRARY} PATH)
|
||||
|
||||
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY)
|
||||
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY)
|
||||
mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY)
|
||||
|
||||
#-- Look for debug libraries
|
||||
# Jiri: Changed the same way as for the release libraries.
|
||||
find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
|
||||
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
|
||||
find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
|
||||
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
|
||||
|
||||
# Jiri: Self-built TBB stores the debug libraries in a separate directory.
|
||||
# Extract path from TBB_LIBRARY_DEBUG name
|
||||
get_filename_component(TBB_LIBRARY_DEBUG_DIR ${TBB_LIBRARY_DEBUG} PATH)
|
||||
|
||||
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY_DEBUG)
|
||||
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY_DEBUG)
|
||||
mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG)
|
||||
|
||||
|
||||
if (TBB_INCLUDE_DIR)
|
||||
if (TBB_LIBRARY)
|
||||
set (TBB_FOUND "YES")
|
||||
set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES})
|
||||
set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
|
||||
set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
|
||||
set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE)
|
||||
# Jiri: Self-built TBB stores the debug libraries in a separate directory.
|
||||
set (TBB_DEBUG_LIBRARY_DIRS ${TBB_LIBRARY_DEBUG_DIR} CACHE PATH "TBB debug library directory" FORCE)
|
||||
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_DEBUG_LIBRARY_DIRS TBB_LIBRARIES TBB_DEBUG_LIBRARIES)
|
||||
message(STATUS "Found Intel TBB")
|
||||
endif (TBB_LIBRARY)
|
||||
endif (TBB_INCLUDE_DIR)
|
||||
|
||||
if (NOT TBB_FOUND)
|
||||
message("ERROR: Intel TBB NOT found!")
|
||||
message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}")
|
||||
# do only throw fatal, if this pkg is REQUIRED
|
||||
if (TBB_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could NOT find TBB library.")
|
||||
endif (TBB_FIND_REQUIRED)
|
||||
endif (NOT TBB_FOUND)
|
||||
|
||||
endif (NOT _TBB_INSTALL_DIR)
|
||||
|
||||
if (TBB_FOUND)
|
||||
set(TBB_INTERFACE_VERSION 0)
|
||||
FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS)
|
||||
STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}")
|
||||
set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}")
|
||||
message(STATUS "TBB interface version: ${TBB_INTERFACE_VERSION}")
|
||||
endif (TBB_FOUND)
|
||||
@@ -1,24 +0,0 @@
|
||||
set(OLDFILE ${OUTPUT_DIR}/include/util/fingerprint_impl.hpp)
|
||||
set(NEWFILE ${OLDFILE}.tmp)
|
||||
set(INFILE ${SOURCE_DIR}/include/util/fingerprint_impl.hpp.in)
|
||||
file(MD5 ${SOURCE_DIR}/src/tools/contract.cpp MD5PREPARE)
|
||||
file(MD5 ${SOURCE_DIR}/include/util/static_rtree.hpp MD5RTREE)
|
||||
file(MD5 ${SOURCE_DIR}/include/util/graph_loader.hpp MD5GRAPH)
|
||||
file(MD5 ${SOURCE_DIR}/src/storage/storage.cpp MD5OBJECTS)
|
||||
|
||||
CONFIGURE_FILE(${INFILE} ${NEWFILE})
|
||||
|
||||
file(MD5 ${NEWFILE} MD5NEW)
|
||||
|
||||
if (EXISTS ${OLDFILE})
|
||||
file(MD5 ${OLDFILE} MD5OLD)
|
||||
if(NOT ${MD5NEW} STREQUAL ${MD5OLD})
|
||||
file(REMOVE_RECURSE ${OLDFILE})
|
||||
file(RENAME ${NEWFILE} ${OLDFILE})
|
||||
else()
|
||||
file(REMOVE_RECURSE ${NEWFILE})
|
||||
message(STATUS "Fingerprint unchanged, not regenerating")
|
||||
endif()
|
||||
else()
|
||||
file(RENAME ${NEWFILE} ${OLDFILE})
|
||||
endif()
|
||||
@@ -1,43 +0,0 @@
|
||||
# Based on @berenm's pull request https://github.com/quarnster/SublimeClang/pull/135
|
||||
# Create the database with cmake with for example: cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
|
||||
# or you could have set(CMAKE_EXPORT_COMPILE_COMMANDS ON) in your CMakeLists.txt
|
||||
# Usage within SublimeClang:
|
||||
# "sublimeclang_options_script": "python ${home}/code/cmake_options_script.py ${project_path:build}/compile_commands.json",
|
||||
|
||||
|
||||
import re
|
||||
import os
|
||||
import os.path
|
||||
import pickle
|
||||
import sys
|
||||
import json
|
||||
|
||||
compilation_database_pattern = re.compile('(?<=\s)-[DIOUWfgs][^=\s]+(?:=\\"[^"]+\\"|=[^"]\S+)?')
|
||||
|
||||
def load_db(filename):
|
||||
compilation_database = {}
|
||||
with open(filename) as compilation_database_file:
|
||||
compilation_database_entries = json.load(compilation_database_file)
|
||||
|
||||
total = len(compilation_database_entries)
|
||||
entry = 0
|
||||
for compilation_entry in compilation_database_entries:
|
||||
entry = entry + 1
|
||||
compilation_database[compilation_entry["file"]] = [ p.strip() for p in compilation_database_pattern.findall(compilation_entry["command"]) ]
|
||||
return compilation_database
|
||||
|
||||
scriptpath = os.path.dirname(os.path.abspath(sys.argv[1]))
|
||||
cache_file = "%s/cached_options.txt" % (scriptpath)
|
||||
|
||||
db = None
|
||||
if os.access(cache_file, os.R_OK) == 0:
|
||||
db = load_db(sys.argv[1])
|
||||
with open(cache_file, "wb") as f:
|
||||
pickle.dump(db, f)
|
||||
else:
|
||||
with open(cache_file) as f:
|
||||
db = pickle.load(f)
|
||||
|
||||
if db and sys.argv[2] in db:
|
||||
for option in db[sys.argv[2]]:
|
||||
print option
|
||||
@@ -1,21 +0,0 @@
|
||||
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
foreach(file ${files})
|
||||
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
|
||||
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
exec_program(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
if(NOT "${rm_retval}" STREQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
|
||||
endif(NOT "${rm_retval}" STREQUAL 0)
|
||||
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
|
||||
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
endforeach(file)
|
||||
@@ -1,11 +0,0 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
includedir=@PKGCONFIG_INCLUDE_DIR@
|
||||
libdir=@PKGCONFIG_LIBRARY_DIR@
|
||||
|
||||
Name: libOSRM
|
||||
Description: Project OSRM library
|
||||
Version: v@OSRM_VERSION@
|
||||
Requires:
|
||||
Libs: -L${libdir} -losrm @PKGCONFIG_OSRM_LDFLAGS@
|
||||
Libs.private: @PKGCONFIG_OSRM_DEPENDENT_LIBRARIES@
|
||||
Cflags: @PKGCONFIG_OSRM_INCLUDE_FLAGS@ @PKGCONFIG_OSRM_CXXFLAGS@
|
||||
@@ -1,7 +0,0 @@
|
||||
coverage:
|
||||
|
||||
ignore:
|
||||
- unit_tests/.*
|
||||
- third_party/.*
|
||||
|
||||
comment: off
|
||||
@@ -1,9 +0,0 @@
|
||||
module.exports = {
|
||||
default: '--strict --tags ~@stress --tags ~@todo --require features/support --require features/step_definitions',
|
||||
verify: '--strict --tags ~@stress --tags ~@todo -f progress --require features/support --require features/step_definitions',
|
||||
todo: '--strict --tags @todo --require features/support --require features/step_definitions',
|
||||
all: '--strict --require features/support --require features/step_definitions'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
FROM ubuntu:14.04
|
||||
|
||||
RUN apt-get update -y && apt-get install -y software-properties-common
|
||||
RUN add-apt-repository ppa:ubuntu-toolchain-r/test
|
||||
RUN apt-get update -y && apt-get install -y g++-5 libbz2-dev libstxxl-dev libstxxl1 libxml2-dev libzip-dev lua5.1 liblua5.1-0-dev libtbb-dev libgdal-dev libluabind-dev libboost-all-dev ccache
|
||||
RUN apt-get -y install curl cmake cmake-curses-gui git
|
||||
|
||||
WORKDIR /opt
|
||||
RUN git clone --depth 1 --branch v0.31.0 https://github.com/creationix/nvm.git
|
||||
RUN /bin/bash -c "source /opt/nvm/nvm.sh && nvm install v4"
|
||||
|
||||
RUN useradd -ms /bin/bash mapbox
|
||||
USER mapbox
|
||||
ENV HOME /home/mapbox
|
||||
WORKDIR /home/mapbox
|
||||
|
||||
RUN echo "source /opt/nvm/nvm.sh" > .bashrc
|
||||
RUN echo "source /home/mapbox/.bashrc" > .profile
|
||||
@@ -1,6 +0,0 @@
|
||||
# Docker based continious integration
|
||||
|
||||
Run ```./docker/build-image.sh``` to build a docker image.
|
||||
The image contains all the build dependencies and the state of the local git repository.
|
||||
|
||||
Run ```./docker/run-gcc.sh``` to build OSRM with g++ and run all tests.
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
docker build \
|
||||
-t mapbox/osrm:linux \
|
||||
docker/
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
docker run \
|
||||
-i \
|
||||
-e "CXX=clang++" \
|
||||
-v `pwd`:/home/mapbox/osrm-backend \
|
||||
-t mapbox/osrm:linux \
|
||||
/bin/bash -lc "osrm-backend/docker/test.sh"
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
docker run \
|
||||
-i \
|
||||
-e "CXX=g++-5" \
|
||||
-e "CC=gcc-5" \
|
||||
-v `pwd`:/home/mapbox/osrm-backend \
|
||||
-t mapbox/osrm:linux \
|
||||
/bin/bash -lc "osrm-backend/docker/test.sh"
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
export CMAKEOPTIONS="-DCMAKE_BUILD_TYPE=Release"
|
||||
|
||||
cd /home/mapbox/osrm-backend
|
||||
[ -d build ] && rm -rf build
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake .. $CMAKEOPTIONS -DBUILD_TOOLS=1
|
||||
|
||||
make -j`nproc`
|
||||
make tests -j`nproc`
|
||||
#./unit_tests/server-tests
|
||||
#./unit_tests/library-tests
|
||||
#./unit_tests/extractor-tests
|
||||
#./unit_tests/util-tests
|
||||
cd ..
|
||||
npm test
|
||||
@@ -1,61 +0,0 @@
|
||||
# Developing / Debugging guidance code
|
||||
|
||||
When changing guidance code, it is easy to introduce problems somewhere in the network.
|
||||
To get a better feeling of how your changes impact the OSRM experience, we offer ways of generating geojson output to inspect (e.g. with Mapbox Studio).
|
||||
When you do changes, make sure to inspect a few areas for the impact of the changes.
|
||||
|
||||
## How to use GeoJson-Debugging
|
||||
|
||||
This is a short guide to describe usage of our GeoJson debug logging mechanism. It is synchronized to guarantee thread-safe logging.
|
||||
|
||||
## Outputting into a single file
|
||||
To use it, the inclusion of `geojson_debug_logger.hpp` `geojson_debug_policies.hpp` from the `util` directory is required.
|
||||
|
||||
Geojson debugging requires a few simple steps to output data into a feature collection.
|
||||
|
||||
- Create a Scoped Guard that lives through the process and provide it with all required datastructures (it needs to span the lifetime of all your logging efforts)
|
||||
- At the location of the output, simply call Write with your own parameters.
|
||||
|
||||
A guard (ScopedGeojsonLoggerGuard) requires a logging policy. Per default we provide a way of printing out node-ids as coordinates.
|
||||
|
||||
The initialisation to do so looks like this:
|
||||
`util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString> geojson_guard( "debug.geojson", data-for-conversion);`
|
||||
|
||||
The field `data-for-conversion` can be an arbitrary long set of features and needs to match the parameters used for constructing our policy (in this case `util::NodeIdVectorToLineString`).
|
||||
|
||||
The policy itself offers a `operator()` accepting a `vector` of `NodeID`.
|
||||
|
||||
For outputting data into our file (debug.geojson), we simply need to call the matching logging routine of the guard: `util::ScioedGeojsonLoggerGuard<util::NodeIdVectorToLineString>::Write(list_of_node_ids);`
|
||||
(or `guard.Write(list_of_node_ids)` if you created an instance).
|
||||
|
||||
### 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.
|
||||
|
||||
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 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.
|
||||
|
||||
## Limitations
|
||||
GeoJson debugging requires a single GeoJsonGuard (ScopedGeojsonLoggerGuard) for each desired output file.
|
||||
For each set of template parameters, only the most recent guard will actually produce output.
|
||||
|
||||
`util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString> geojson_guard( "debug.geojson", data-for-conversion);`
|
||||
|
||||
`util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString> geojson_guard( "debug-2.geojson", data-for-conversion);`
|
||||
|
||||
Will not provide a way to write into two files, but only `debug-2` will actually contain features.
|
||||
|
||||
We cannot nest-these calls.
|
||||
|
||||
If we want to use the same policy for multiple files, we need to use different template parameters both for the logger and the guard.
|
||||
|
||||
`util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString,0> geojson_guard( "debug.geojson", data-for-conversion);`
|
||||
|
||||
`util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString,1> geojson_guard( "debug-2.geojson", data-for-conversion);`
|
||||
|
||||
as well as,
|
||||
|
||||
`util::ScopedGeojsonLoggerGuardr<util::NodeIdVectorToLineString,0>::Write(list_of_node_ids);`
|
||||
|
||||
`util::ScopedGeojsonLoggerGuardr<util::NodeIdVectorToLineString,1>::Write(list_of_node_ids);`
|
||||
@@ -1,730 +0,0 @@
|
||||
## General options
|
||||
|
||||
All OSRM HTTP requests use a common structure.
|
||||
|
||||
The following syntax applies to all services, except as noted.
|
||||
|
||||
### Requests
|
||||
|
||||
```endpoint
|
||||
GET /{service}/{version}/{profile}/{coordinates}[.{format}]?option=value&option=value
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| --- | --- |
|
||||
| `service` | One of the following values: [`route`](#route-service), [`nearest`](#nearest-service), [`table`](#table-service), [`match`](#match-service), [`trip`](#trip-service), [`tile`](#tile-service) |
|
||||
| `version` | Version of the protocol implemented by the service. `v1` for all OSRM 5.x installations |
|
||||
| `profile` | Mode of transportation, is determined statically by the Lua profile that is used to prepare the data using `osrm-extract`. Typically `car`, `bike` or `foot` if using one of the supplied profiles. |
|
||||
| `coordinates`| String of format `{longitude},{latitude};{longitude},{latitude}[;{longitude},{latitude} ...]` or `polyline({polyline})`. |
|
||||
| `format`| Only `json` is supported at the moment. This parameter is optional and defaults to `json`. |
|
||||
|
||||
Passing any `option=value` is optional. `polyline` follows Google's polyline format with precision 5 by default and can be generated using [this package](https://www.npmjs.com/package/polyline).
|
||||
|
||||
To pass parameters to each location some options support an array like encoding:
|
||||
|
||||
**Request options**
|
||||
|
||||
| Option | Values | Description |
|
||||
|------------|--------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
|
||||
|bearings |`{bearing};{bearing}[;{bearing} ...]` |Limits the search to segments with given bearing in degrees towards true north in clockwise direction. |
|
||||
|radiuses |`{radius};{radius}[;{radius} ...]` |Limits the search to given radius in meters. |
|
||||
|hints |`{hint};{hint}[;{hint} ...]` |Hint from previous request to derive position in street network. |
|
||||
|
||||
Where the elements follow the following format:
|
||||
|
||||
| Element | Values |
|
||||
|------------|--------------------------------------------------------|
|
||||
|bearing |`{value},{range}` `integer 0 .. 360,integer 0 .. 180` |
|
||||
|radius |`double >= 0` or `unlimited` (default) |
|
||||
|hint |Base64 `string` |
|
||||
|
||||
```
|
||||
{option}={element};{element}[;{element} ... ]
|
||||
```
|
||||
|
||||
The number of elements must match exactly the number of locations. If you don't want to pass a value but instead use the default you can pass an empty `element`.
|
||||
|
||||
Example: 2nd location use the default value for `option`:
|
||||
|
||||
```
|
||||
{option}={element};;{element}
|
||||
```
|
||||
|
||||
#### Example Requests
|
||||
|
||||
```curl
|
||||
# Query on Berlin with three coordinates:
|
||||
curl 'http://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?overview=false'
|
||||
|
||||
# Using polyline:
|
||||
curl 'http://router.project-osrm.org/route/v1/driving/polyline(ofp_Ik_vpAilAyu@te@g`E)?overview=false'
|
||||
```
|
||||
|
||||
### Responses
|
||||
|
||||
Every response object has a `code` field containing one of the strings below or a service dependent code:
|
||||
|
||||
| Type | Description |
|
||||
|-------------------|----------------------------------------------------------------------------------|
|
||||
| `Ok` | Request could be processed as expected. |
|
||||
| `InvalidUrl` | URL string is invalid. |
|
||||
| `InvalidService` | Service name is invalid. |
|
||||
| `InvalidVersion` | Version is not found. |
|
||||
| `InvalidOptions` | Options are invalid. |
|
||||
| `InvalidQuery` | The query string is synctactically malformed. |
|
||||
| `InvalidValue` | The successfully parsed query parameters are invalid. |
|
||||
| `NoSegment` | One of the supplied input coordinates could not snap to street segment. |
|
||||
| `TooBig` | The request size violates one of the service specific request size restrictions. |
|
||||
|
||||
- `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`.
|
||||
|
||||
#### Example response
|
||||
|
||||
```json
|
||||
{
|
||||
"code": "Ok",
|
||||
"message": "Everything worked"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Services
|
||||
|
||||
### Nearest service
|
||||
|
||||
Snaps a coordinate to the street network and returns the nearest `n` matches.
|
||||
|
||||
```endpoint
|
||||
GET http://{server}/nearest/v1/{profile}/{coordinates}.json?number={number}
|
||||
```
|
||||
|
||||
Where `coordinates` only supports a single `{longitude},{latitude}` entry.
|
||||
|
||||
In addition to the [general options](#general-options) the following options are supported for this service:
|
||||
|
||||
|Option |Values |Description |
|
||||
|------------|------------------------------|----------------------------------------------------|
|
||||
|number |`integer >= 1` (default `1`) |Number of nearest segments that should be returned. |
|
||||
|
||||
**Response**
|
||||
|
||||
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
|
||||
- `waypoints` array of `Waypoint` objects sorted by distance to the input coordinate. Each object has at least the following additional properties:
|
||||
- `distance`: Distance in meters to the supplied input coordinate.
|
||||
|
||||
#### Example Requests
|
||||
|
||||
```curl
|
||||
# Querying nearest three snapped locations of `13.388860,52.517037` with a bearing between `20° - 340°`.
|
||||
curl 'http://router.project-osrm.org/nearest/v1/driving/13.388860,52.517037?number=3&bearings=0,20'
|
||||
```
|
||||
|
||||
#### Example Response
|
||||
|
||||
```json
|
||||
{
|
||||
"waypoints" : [
|
||||
{
|
||||
"hint" : "KSoKADRYroqUBAEAEAAAABkAAAAGAAAAAAAAABhnCQCLtwAA_0vMAKlYIQM8TMwArVghAwEAAQH1a66g",
|
||||
"distance" : 4.152629,
|
||||
"name" : "Friedrichstraße",
|
||||
"location" : [
|
||||
13.388799,
|
||||
52.517033
|
||||
]
|
||||
},
|
||||
{
|
||||
"hint" : "KSoKADRYroqUBAEABgAAAAAAAAAAAAAAKQAAABhnCQCLtwAA7kvMAAxZIQM8TMwArVghAwAAAQH1a66g",
|
||||
"distance" : 11.811961,
|
||||
"name" : "Friedrichstraße",
|
||||
"location" : [
|
||||
13.388782,
|
||||
52.517132
|
||||
]
|
||||
},
|
||||
{
|
||||
"hint" : "KioKgDbbDgCUBAEAAAAAABoAAAAAAAAAPAAAABlnCQCLtwAA50vMADJZIQM8TMwArVghAwAAAQH1a66g",
|
||||
"distance" : 15.872438,
|
||||
"name" : "Friedrichstraße",
|
||||
"location" : [
|
||||
13.388775,
|
||||
52.51717
|
||||
],
|
||||
}
|
||||
],
|
||||
"code" : "Ok"
|
||||
}
|
||||
```
|
||||
|
||||
### Route service
|
||||
|
||||
Finds the fastest route between coordinates in the supplied order.
|
||||
|
||||
```endpoint
|
||||
GET /route/v1/{profile}/{coordinates}?alternatives={true|false}&steps={true|false}&geometries={polyline|polyline6|geojson}&overview={full|simplified|false}&annotations={true|false}
|
||||
```
|
||||
|
||||
In addition to the [general options](#general-options) the following options are supported for this service:
|
||||
|
||||
|Option |Values |Description |
|
||||
|------------|---------------------------------------------|-------------------------------------------------------------------------------|
|
||||
|alternatives|`true`, `false` (default) |Search for alternative routes and return as well.\* |
|
||||
|steps |`true`, `false` (default) |Return route steps for each route leg |
|
||||
|annotations |`true`, `false` (default) |Returns additional metadata for each coordinate along the route geometry. |
|
||||
|geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) |
|
||||
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
|
||||
|continue\_straight |`default` (default), `true`, `false` |Forces the route to keep going straight at waypoints constraining uturns there even if it would be faster. Default value depends on the profile. |
|
||||
|
||||
\* Please note that even if an alternative route is requested, a result cannot be guaranteed.
|
||||
|
||||
**Response**
|
||||
|
||||
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
|
||||
- `waypoints`: Array of `Waypoint` objects representing all waypoints in order:
|
||||
- `routes`: An array of `Route` objects, ordered by descending recommendation rank.
|
||||
|
||||
In case of error the following `code`s are supported in addition to the general ones:
|
||||
|
||||
| Type | Description |
|
||||
|-------------------|-----------------|
|
||||
| `NoRoute` | No route found. |
|
||||
|
||||
All other fields might be undefined.
|
||||
|
||||
#### Example Request
|
||||
|
||||
```curl
|
||||
# Query on Berlin with three coordinates and no overview geometry returned:
|
||||
curl 'http://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?overview=false'
|
||||
```
|
||||
|
||||
### Table service
|
||||
|
||||
Computes the duration of the fastest route between all pairs of supplied coordinates.
|
||||
|
||||
```endpoint
|
||||
GET /table/v1/{profile}/{coordinates}?{sources}=[{elem}...];&destinations=[{elem}...]
|
||||
```
|
||||
|
||||
**Coordinates**
|
||||
|
||||
In addition to the [general options](#general-options) the following options are supported for this service:
|
||||
|
||||
|Option |Values |Description |
|
||||
|------------|--------------------------------------------------|---------------------------------------------|
|
||||
|sources |`{index};{index}[;{index} ...]` or `all` (default)|Use location with given index as source. |
|
||||
|destinations|`{index};{index}[;{index} ...]` or `all` (default)|Use location with given index as destination.|
|
||||
|
||||
Unlike other array encoded options, the length of `sources` and `destinations` can be **smaller or equal**
|
||||
to number of input locations;
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
sources=0;5;7&destinations=5;1;4;2;3;6
|
||||
```
|
||||
|
||||
|Element |Values |
|
||||
|------------|-----------------------------|
|
||||
|index |`0 <= integer < #locations` |
|
||||
|
||||
#### Example Request
|
||||
|
||||
```curl
|
||||
# Returns a 3x3 matrix:
|
||||
curl 'http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219'
|
||||
|
||||
# Returns a 1x3 matrix
|
||||
curl 'http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?sources=0'
|
||||
|
||||
# Returns a asymmetric 3x2 matrix with from the polyline encoded locations `qikdcB}~dpXkkHz`:
|
||||
curl 'http://router.project-osrm.org/table/v1/driving/polyline(egs_Iq_aqAppHzbHulFzeMe`EuvKpnCglA)?sources=0;1;3&destinations=2;4'
|
||||
```
|
||||
|
||||
**Response**
|
||||
|
||||
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
|
||||
- `durations` array of arrays that stores the matrix in row-major order. `durations[i][j]` gives the travel time from
|
||||
the i-th waypoint to the j-th waypoint. Values are given in seconds.
|
||||
- `sources` array of `Waypoint` objects describing all sources in order
|
||||
- `destinations` array of `Waypoint` objects describing all destinations in order
|
||||
|
||||
In case of error the following `code`s are supported in addition to the general ones:
|
||||
|
||||
| Type | Description |
|
||||
|-------------------|-----------------|
|
||||
| `NoTable` | No route found. |
|
||||
|
||||
All other fields might be undefined.
|
||||
|
||||
### Match service
|
||||
|
||||
Map matching matches/snaps given GPS points to the road network in the most plausible way.
|
||||
Please note the request might result multiple sub-traces. Large jumps in the timestamps (> 60s) or improbable transitions lead to trace splits if a complete matching could not be found.
|
||||
The algorithm might not be able to match all points. Outliers are removed if they can not be matched successfully.
|
||||
|
||||
```endpoint
|
||||
GET /match/v1/{profile}/{coordinates}?steps={true|false}&geometries={polyline|polyline6|geojson}&overview={simplified|full|false}&annotations={true|false}
|
||||
```
|
||||
|
||||
In addition to the [general options](#general-options) the following options are supported for this service:
|
||||
|
||||
|Option |Values |Description |
|
||||
|------------|------------------------------------------------|------------------------------------------------------------------------------------------|
|
||||
|steps |`true`, `false` (default) |Return route steps for each route |
|
||||
|geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) |
|
||||
|annotations |`true`, `false` (default) |Returns additional metadata for each coordinate along the route geometry. |
|
||||
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
|
||||
|timestamps |`{timestamp};{timestamp}[;{timestamp} ...]` |Timestamps for the input locations in seconds since UNIX epoch. Timestamps need to be monotonically increasing. |
|
||||
|radiuses |`{radius};{radius}[;{radius} ...]` |Standard deviation of GPS precision used for map matching. If applicable use GPS accuracy.|
|
||||
|
||||
|Parameter |Values |
|
||||
|------------|-----------------------------------|
|
||||
|timestamp |`integer` seconds since UNIX epoch |
|
||||
|radius |`double >= 0` (default 5m) |
|
||||
|
||||
The radius for each point should be the standard error of the location measured in meters from the true location.
|
||||
Use `Location.getAccuracy()` on Android or `CLLocation.horizontalAccuracy` on iOS.
|
||||
This value is used to determine which points should be considered as candidates (larger radius means more candidates) and how likely each candidate is (larger radius means far-away candidates are penalized less).
|
||||
The area to search is chosen such that the correct candidate should be considered 99.9% of the time (for more details see [this ticket](https://github.com/Project-OSRM/osrm-backend/pull/3184)).
|
||||
|
||||
**Response**
|
||||
|
||||
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
|
||||
- `tracepoints`: Array of `Waypoint` objects representing all points of the trace in order.
|
||||
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:
|
||||
- `matchings_index`: Index to the `Route` object in `matchings` the sub-trace was matched to.
|
||||
- `waypoint_index`: Index of the waypoint inside the matched route.
|
||||
- `matchings`: An array of `Route` objects that assemble the trace. Each `Route` object has the following additional properties:
|
||||
- `confidence`: Confidence of the matching. `float` value between 0 and 1. 1 is very confident that the matching is correct.
|
||||
|
||||
In case of error the following `code`s are supported in addition to the general ones:
|
||||
|
||||
| Type | Description |
|
||||
|-------------------|---------------------|
|
||||
| `NoMatch` | No matchings found. |
|
||||
|
||||
All other fields might be undefined.
|
||||
|
||||
### Trip service
|
||||
|
||||
The trip plugin solves the Traveling Salesman Problem using a greedy heuristic (farthest-insertion algorithm).
|
||||
The returned path does not have to be the fastest path, as TSP is NP-hard it is only an approximation.
|
||||
Note that if the input coordinates can not be joined by a single trip (e.g. the coordinates are on several disconnected islands)
|
||||
multiple trips for each connected component are returned.
|
||||
|
||||
```endpoint
|
||||
GET /trip/v1/{profile}/{coordinates}?steps={true|false}&geometries={polyline|polyline6|geojson}&overview={simplified|full|false}&annotations={true|false}'
|
||||
```
|
||||
|
||||
In addition to the [general options](#general-options) the following options are supported for this service:
|
||||
|
||||
|Option |Values |Description |
|
||||
|------------|------------------------------------------------|---------------------------------------------------------------------------|
|
||||
|steps |`true`, `false` (default) |Return route instructions for each trip |
|
||||
|annotations |`true`, `false` (default) |Returns additional metadata for each coordinate along the route geometry. |
|
||||
|geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) |
|
||||
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
|
||||
|
||||
**Response**
|
||||
|
||||
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
|
||||
- `waypoints`: Array of `Waypoint` objects representing all waypoints in input order. Each `Waypoint` object has the following additional properties:
|
||||
- `trips_index`: Index to `trips` of the sub-trip the point was matched to.
|
||||
- `waypoint_index`: Index of the point in the trip.
|
||||
- `trips`: An array of `Route` objects that assemble the trace.
|
||||
|
||||
In case of error the following `code`s are supported in addition to the general ones:
|
||||
|
||||
| Type | Description |
|
||||
|-------------------|---------------------|
|
||||
| `NoTrips` | No trips found. |
|
||||
|
||||
All other fields might be undefined.
|
||||
|
||||
### Tile service
|
||||
|
||||
This service generates [Mapbox Vector Tiles](https://www.mapbox.com/developers/vector-tiles/) that can be viewed with a vector-tile capable slippy-map viewer. The tiles contain road geometries and metadata that can be used to examine the routing graph. The tiles are generated directly from the data in-memory, so are in sync with actual routing results, and let you examine which roads are actually routable, and what weights they have applied.
|
||||
|
||||
```endpoint
|
||||
GET /tile/v1/{profile}/tile({x},{y},{zoom}).mvt
|
||||
```
|
||||
|
||||
The `x`, `y`, and `zoom` values are the same as described at https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames, and are supported by vector tile viewers like [Mapbox GL JS](https://www.mapbox.com/mapbox-gl-js/api/).
|
||||
|
||||
#### Example request
|
||||
|
||||
```curl
|
||||
# This fetches a Z=13 tile for downtown San Francisco:
|
||||
curl 'http://router.project-osrm.org/tile/v1/car/tile(1310,3166,13).mvt'
|
||||
```
|
||||
|
||||
#### Example response
|
||||
|
||||
> 
|
||||
> http://map.project-osrm.org/debug/#14.33/52.5212/13.3919
|
||||
|
||||
The response object is either a binary encoded blob with a `Content-Type` of `application/x-protobuf`, or a `404` error. Note that OSRM is hard-coded to only return tiles from zoom level 12 and higher (to avoid accidentally returning extremely large vector tiles).
|
||||
|
||||
Vector tiles contain two layers:
|
||||
|
||||
`speeds` layer:
|
||||
|
||||
| Field | Type | Description |
|
||||
| ------------ | --------- | ---------------------------------------- |
|
||||
| `speed` | `integer` | the speed on that road segment, in km/h |
|
||||
| `is_small` | `boolean` | whether this segment belongs to a small (< 1000 node) [strongly connected component](https://en.wikipedia.org/wiki/Strongly_connected_component) |
|
||||
| `datasource` | `string` | the source for the speed value (normally `lua profile` unless you're using the [traffic update feature](https://github.com/Project-OSRM/osrm-backend/wiki/Traffic), in which case it contains the stem of the filename that supplied the speed value for this segment |
|
||||
| `duration` | `float` | how long this segment takes to traverse, in seconds |
|
||||
| `name` | `string` | the name of the road this segment belongs to |
|
||||
|
||||
`turns` layer:
|
||||
|
||||
| Field | Type | Description |
|
||||
| ------------ | --------- | ---------------------------------------- |
|
||||
| `bearing_in` | `integer` | the absolute bearing that approaches the intersection. -180 to +180, 0 = North, 90 = East |
|
||||
| `turn_angle` | `integer` | the angle of the turn, relative to the `bearing_in`. -180 to +180, 0 = straight ahead, 90 = 90-degrees to the right |
|
||||
| `cost` | `float` | the time we think it takes to make that turn, in seconds. May be negative, depending on how the data model is constructed (some turns get a "bonus"). |
|
||||
|
||||
|
||||
## Result objects
|
||||
|
||||
### Route object
|
||||
|
||||
Represents a route through (potentially multiple) waypoints.
|
||||
|
||||
**Properties**
|
||||
|
||||
- `distance`: The distance traveled by the route, in `float` meters.
|
||||
- `duration`: The estimated travel time, in `float` number of seconds.
|
||||
- `geometry`: The whole geometry of the route value depending on `overview` parameter, format depending on the `geometries` parameter. See `RouteStep`'s `geometry` field for a parameter documentation.
|
||||
|
||||
| overview | Description |
|
||||
|------------|-----------------------------|
|
||||
| simplified | Geometry is simplified according to the highest zoom level it can still be displayed on full. |
|
||||
| full | Geometry is not simplified. |
|
||||
| false | Geometry is not added. |
|
||||
|
||||
- `legs`: The legs between the given waypoints, an array of `RouteLeg` objects.
|
||||
|
||||
#### Example
|
||||
|
||||
Three input coordinates, `geometry=geojson`, `steps=false`:
|
||||
|
||||
```json
|
||||
{
|
||||
"distance": 90.0,
|
||||
"duration": 300.0,
|
||||
"geometry": {"type": "LineString", "coordinates": [[120.0, 10.0], [120.1, 10.0], [120.2, 10.0], [120.3, 10.0]]},
|
||||
"legs": [
|
||||
{
|
||||
"distance": 30.0,
|
||||
"duration": 100.0,
|
||||
"steps": []
|
||||
},
|
||||
{
|
||||
"distance": 60.0,
|
||||
"duration": 200.0,
|
||||
"steps": []
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### RouteLeg object
|
||||
|
||||
Represents a route between two waypoints.
|
||||
|
||||
**Properties**
|
||||
|
||||
- `distance`: The distance traveled by this route leg, in `float` meters.
|
||||
- `duration`: The estimated travel time, in `float` number of seconds.
|
||||
- `summary`: Summary of the route taken as `string`. Depends on the `steps` parameter:
|
||||
|
||||
| steps | |
|
||||
|--------------|-----------------------------------------------------------------------|
|
||||
| true | Names of the two major roads used. Can be empty if route is too short.|
|
||||
| false | empty `string` |
|
||||
|
||||
- `steps`: Depends on the `steps` parameter.
|
||||
|
||||
| steps | |
|
||||
|--------------|-----------------------------------------------------------------------|
|
||||
| true | array of `RouteStep` objects describing the turn-by-turn instructions |
|
||||
| false | empty array |
|
||||
|
||||
- `annotation`: Additional details about each coordinate along the route geometry:
|
||||
|
||||
| annotations | |
|
||||
|--------------|-----------------------------------------------------------------------|
|
||||
| true | An `Annotation` object containing node ids, durations and distances |
|
||||
| false | `undefined` |
|
||||
|
||||
#### Example
|
||||
|
||||
With `steps=false` and `annotations=true`:
|
||||
|
||||
```json
|
||||
{
|
||||
"distance": 30.0,
|
||||
"duration": 100.0,
|
||||
"steps": [],
|
||||
"annotation": {
|
||||
"distance": [5,5,10,5,5],
|
||||
"duration": [15,15,40,15,15],
|
||||
"datasources": [1,0,0,0,1],
|
||||
"nodes": [49772551,49772552,49786799,49786800,49786801,49786802]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Annotation object
|
||||
|
||||
Annotation of the whole route leg with fine-grained information about each segment or node id.
|
||||
|
||||
**Properties**
|
||||
|
||||
- `distance`: The distance, in metres, between each pair of coordinates
|
||||
- `duration`: The duration between each pair of coordinates, in seconds
|
||||
- `datasources`: The index of the datasource for the speed between each pair of coordinates. `0` is the default profile, other values are supplied via `--segment-speed-file` to `osrm-contract`
|
||||
- `nodes`: The OSM node ID for each coordinate along the route, excluding the first/last user-supplied coordinates
|
||||
|
||||
#### Example
|
||||
|
||||
```json
|
||||
{
|
||||
"distance": [5,5,10,5,5],
|
||||
"duration": [15,15,40,15,15],
|
||||
"datasources": [1,0,0,0,1],
|
||||
"nodes": [49772551,49772552,49786799,49786800,49786801,49786802]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### RouteStep object
|
||||
|
||||
A step consists of a maneuver such as a turn or merge, followed
|
||||
by a distance of travel along a single way to the subsequent
|
||||
step.
|
||||
|
||||
**Properties**
|
||||
|
||||
- `distance`: The distance of travel from the maneuver to the subsequent step, in `float` meters.
|
||||
- `duration`: The estimated travel time, in `float` number of seconds.
|
||||
- `geometry`: The unsimplified geometry of the route segment, depending on the `geometries` parameter.
|
||||
|
||||
| `geometry` | |
|
||||
|------------|--------------------------------------------------------------------|
|
||||
| polyline | [polyline](https://www.npmjs.com/package/polyline) with precision 5 in [latitude,longitude] encoding |
|
||||
| polyline6 | [polyline](https://www.npmjs.com/package/polyline) with precision 6 in [latitude,longitude] encoding |
|
||||
| geojson | [GeoJSON `LineString`](http://geojson.org/geojson-spec.html#linestring) or [GeoJSON `Point`](http://geojson.org/geojson-spec.html#point) if it is only one coordinate (not wrapped by a GeoJSON feature)|
|
||||
|
||||
- `name`: The name of the way along which travel proceeds.
|
||||
- `ref`: A reference number or code for the way. Optionally included, if ref data is available for the given way.
|
||||
- `pronunciation`: The pronunciation hint of the way name. Will be `undefined` if there is no pronunciation hit.
|
||||
- `destinations`: The destinations of the way. Will be `undefined` if there are no destinations.
|
||||
- `mode`: A string signifying the mode of transportation.
|
||||
- `maneuver`: A `StepManeuver` object representing the maneuver.
|
||||
- `intersections`: A list of `Intersection` objects that are passed along the segment, the very first belonging to the StepManeuver
|
||||
|
||||
#### Example
|
||||
|
||||
```json
|
||||
{
|
||||
"geometry" : "{lu_IypwpAVrAvAdI",
|
||||
"mode" : "driving",
|
||||
"duration" : 15.6,
|
||||
"intersections" : [
|
||||
{ "bearings" : [ 10, 92, 184, 270 ],
|
||||
"lanes" : [
|
||||
{ "indications" : [ "left", "straight" ],
|
||||
"valid" : "false" },
|
||||
{ "valid" : "true",
|
||||
"indications" : [ "right" ] }
|
||||
],
|
||||
"out" : 2,
|
||||
"in" : 3,
|
||||
"entry" : [ "true", "true", "true", "false" ],
|
||||
"location" : [ 13.39677, 52.54366 ]
|
||||
},
|
||||
{ "out" : 1,
|
||||
"lanes" : [
|
||||
{ "indications" : [ "straight" ],
|
||||
"valid" : "true" },
|
||||
{ "indications" : [ "right" ],
|
||||
"valid" : "false" }
|
||||
],
|
||||
"bearings" : [ 60, 240, 330 ],
|
||||
"in" : 0,
|
||||
"entry" : [ "false", "true", "true" ],
|
||||
"location" : [ 13.394718, 52.543096 ]
|
||||
}
|
||||
],
|
||||
"name" : "Lortzingstraße",
|
||||
"distance" : 152.3,
|
||||
"maneuver" : {
|
||||
"modifier" : "right",
|
||||
"type" : "turn"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### StepManeuver object
|
||||
|
||||
**Properties**
|
||||
|
||||
- `location`: A `[longitude, latitude]` pair describing the location of the turn.
|
||||
- `bearing_before`: The clockwise angle from true north to the
|
||||
direction of travel immediately before the maneuver.
|
||||
- `bearing_after`: The clockwise angle from true north to the
|
||||
direction of travel immediately after the maneuver.
|
||||
- `type` A string indicating the type of maneuver. **new identifiers might be introduced without API change**
|
||||
Types unknown to the client should be handled like the `turn` type, the existance of correct `modifier` values is guranteed.
|
||||
|
||||
| `type` | Description |
|
||||
|------------------|--------------------------------------------------------------|
|
||||
| `turn` | a basic turn into direction of the `modifier` |
|
||||
| `new name` | no turn is taken/possible, but the road name changes. The road can take a turn itself, following `modifier`. |
|
||||
| `depart` | indicates the departure of the leg |
|
||||
| `arrive` | indicates the destination of the leg |
|
||||
| `merge` | merge onto a street (e.g. getting on the highway from a ramp, the `modifier specifies the direction of the merge`) |
|
||||
| `ramp` | **Deprecated**. Replaced by `on_ramp` and `off_ramp`. |
|
||||
| `on ramp` | take a ramp to enter a highway (direction given my `modifier`) |
|
||||
| `off ramp` | take a ramp to exit a highway (direction given my `modifier`) |
|
||||
| `fork` | take the left/right side at a fork depending on `modifier` |
|
||||
| `end of road` | road ends in a T intersection turn in direction of `modifier`|
|
||||
| `use lane` | going straight on a specific lane |
|
||||
| `continue` | Turn in direction of `modifier` to stay on the same road |
|
||||
| `roundabout` | traverse roundabout, has additional field `exit` with NR if the roundabout is left. `the modifier specifies the direction of entering the roundabout` |
|
||||
| `rotary` | a traffic circle. While very similar to a larger version of a roundabout, it does not necessarily follow roundabout rules for right of way. It can offer `rotary_name/rotary_pronunciation` in addition to the `exit` parameter. |
|
||||
| `roundabout turn`| Describes a turn at a small roundabout that should be treated as normal turn. The `modifier` indicates the turn direciton. Example instruction: `At the roundabout turn left`. |
|
||||
| `notification` | not an actual turn but a change in the driving conditions. For example the travel mode. If the road takes a turn itself, the `modifier` describes the direction |
|
||||
|
||||
Please note that even though there are `new name` and `notification` instructions, the `mode` and `name` can change
|
||||
between all instructions. They only offer a fallback in case nothing else is to report.
|
||||
|
||||
- `modifier` An optional `string` indicating the direction change of the maneuver.
|
||||
|
||||
| `modifier` | Description |
|
||||
|-------------------|-------------------------------------------|
|
||||
| `uturn` | indicates reversal of direction |
|
||||
| `sharp right` | a sharp right turn |
|
||||
| `right` | a normal turn to the right |
|
||||
| `slight right` | a slight turn to the right |
|
||||
| `straight` | no relevant change in direction |
|
||||
| `slight left` | a slight turn to the left |
|
||||
| `left` | a normal turn to the left |
|
||||
| `sharp left` | a sharp turn to the left |
|
||||
|
||||
The list of turns without a modifier is limited to: `depart/arrive`. If the source/target location is close enough to the `depart/arrive` location, no modifier will be given.
|
||||
|
||||
The meaning depends on the `type` field.
|
||||
|
||||
| `type` | Description |
|
||||
|------------------------|---------------------------------------------------------------------------------------------------------------------------|
|
||||
| `turn` | `modifier` indicates the change in direction accomplished through the turn |
|
||||
| `depart`/`arrive` | `modifier` indicates the position of departure point and arrival point in relation to the current direction of travel |
|
||||
|
||||
- `exit` An optional `integer` indicating number of the exit to take. The field exists for the following `type` field:
|
||||
|
||||
| `type` | Description |
|
||||
|------------------------|---------------------------------------------------------------------------------------------------------------------------|
|
||||
| `roundabout`/`rotary` | Number of the roundabout exit to take. If exit is `undefined` the destination is on the roundabout. |
|
||||
| else | Indicates the number of intersections passed until the turn. Example instruction: `at the fourth intersection, turn left` |
|
||||
|
||||
|
||||
New properties (potentially depending on `type`) may be introduced in the future without an API version change.
|
||||
|
||||
### Lane object
|
||||
|
||||
A `Lane` represents a turn lane at the corresponding turn location.
|
||||
|
||||
**Properties**
|
||||
|
||||
- `indications`: a indication (e.g. marking on the road) specifying the turn lane. A road can have multiple indications (e.g. an arrow pointing straight and left). The indications are given in an array, each containing one of the following types. Further indications might be added on without an API version change.
|
||||
|
||||
| `value` | Description |
|
||||
|------------------------|---------------------------------------------------------------------------------------------------------------------------|
|
||||
| `none` | No dedicated indication is shown. |
|
||||
| `uturn` | An indication signaling the possibility to reverse (i.e. fully bend arrow). |
|
||||
| `sharp right` | An indication indicating a sharp right turn (i.e. strongly bend arrow). |
|
||||
| `right` | An indication indicating a right turn (i.e. bend arrow). |
|
||||
| `slight right` | An indication indicating a slight right turn (i.e. slightly bend arrow). |
|
||||
| `straight` | No dedicated indication is shown (i.e. straight arrow). |
|
||||
| `slight left` | An indication indicating a slight left turn (i.e. slightly bend arrow). |
|
||||
| `left` | An indication indicating a left turn (i.e. bend arrow). |
|
||||
| `sharp left` | An indication indicating a sharp left turn (i.e. strongly bend arrow). |
|
||||
|
||||
- `valid`: a boolean flag indicating whether the lane is a valid choice in the current maneuver
|
||||
|
||||
#### Example
|
||||
|
||||
```json
|
||||
{
|
||||
"indications": ["left", "straight"],
|
||||
"valid": "false"
|
||||
}
|
||||
```
|
||||
|
||||
### Intersection object
|
||||
|
||||
An intersection gives a full representation of any cross-way the path passes bay. For every step, the very first intersection (`intersections[0]`) corresponds to the
|
||||
location of the StepManeuver. Further intersections are listed for every cross-way until the next turn instruction.
|
||||
|
||||
**Properties**
|
||||
|
||||
- `location`: A `[longitude, latitude]` pair describing the location of the turn.
|
||||
- `bearings`: A list of bearing values (e.g. [0,90,180,270]) that are available at the intersection. The bearings describe all available roads at the intersection.
|
||||
- `entry`: A list of entry flags, corresponding in a 1:1 relationship to the bearings. A value of `true` indicates that the respective road could be entered on a valid route.
|
||||
`false` indicates that the turn onto the respective road would violate a restriction.
|
||||
- `in`: index into bearings/entry array. Used to calculate the bearing just before the turn. Namely, the clockwise angle from true north to the
|
||||
direction of travel immediately before the maneuver/passing the intersection. Bearings are given relative to the intersection. To get the bearing
|
||||
in the direction of driving, the bearing has to be rotated by a value of 180. The value is not supplied for `depart` maneuvers.
|
||||
- `out`: index into the bearings/entry array. Used to extract the bearing just after the turn. Namely, The clockwise angle from true north to the
|
||||
direction of travel immediately after the maneuver/passing the intersection. The value is not supplied for `arrive` maneuvers.
|
||||
- `lanes`: Array of `Lane` objects that denote the available turn lanes at the intersection. If no lane information is available for an intersection, the `lanes` property will not be present.
|
||||
|
||||
#### Example
|
||||
|
||||
```json
|
||||
{
|
||||
"location":[13.394718,52.543096],
|
||||
"in":0,
|
||||
"out":2,
|
||||
"bearings":[60,150,240,330],
|
||||
"entry":["false","true","true","true"]
|
||||
"lanes":{
|
||||
"indications": ["left", "straight"],
|
||||
"valid": "false"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Waypoint object
|
||||
|
||||
Object used to describe waypoint on a route.
|
||||
|
||||
**Properties**
|
||||
|
||||
- `name` Name of the street the coordinate snapped to
|
||||
- `location` Array that contains the `[longitude, latitude]` pair of the snapped coordinate
|
||||
- `distance` The distance of the snapped point from the original
|
||||
- `hint` Unique internal identifier of the segment (ephemeral, not constant over data updates)
|
||||
This can be used on subsequent request to significantly speed up the query and to connect multiple services.
|
||||
E.g. you can use the `hint` value obtained by the `nearest` query as `hint` values for `route` inputs.
|
||||
|
||||
#### Example
|
||||
|
||||
```json
|
||||
{
|
||||
"hint" : "KSoKADRYroqUBAEAEAAAABkAAAAGAAAAAAAAABhnCQCLtwAA_0vMAKlYIQM8TMwArVghAwEAAQH1a66g",
|
||||
"distance" : 4.152629,
|
||||
"name" : "Friedrichstraße",
|
||||
"location" : [
|
||||
13.388799,
|
||||
52.517033
|
||||
]
|
||||
}
|
||||
```
|
||||
|
Before Width: | Height: | Size: 694 KiB |
@@ -1,33 +0,0 @@
|
||||
## Introduction
|
||||
|
||||
OSRM can be used as a library (libosrm) via C++ instead of using it through the HTTP interface and `osrm-routed`. This allows for fine-tuning OSRM and has much less overhead. Here is a quick introduction into how to use `libosrm` in the upcoming v5 release.
|
||||
|
||||
Take a look at the example code that lives in the [example directory](https://github.com/Project-OSRM/osrm-backend/tree/master/example). Here is all you ever wanted to know about `libosrm`, that is a short description of what the types do and where to find documentation on it:
|
||||
|
||||
## Important interface objects
|
||||
|
||||
- [`EngineConfig`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/engine_config.hpp) - for initializing an OSRM instance we can configure certain properties and constraints. E.g. the storage config is the base path such as `france.osm.osrm` from which we derive and load `france.osm.osrm.*` auxiliary files. This also lets you set constraints such as the maximum number of locations allowed for specific services.
|
||||
|
||||
- [`OSRM`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/osrm/osrm.hpp) - this is the main Routing Machine type with functions such as `Route` and `Table`. You initialize it with a `EngineConfig`. It does all the heavy lifting for you. Each function takes its own parameters, e.g. the `Route` function takes `RouteParameters`, and a out-reference to a JSON result that gets filled. The return value is a `Status`, indicating error or success.
|
||||
|
||||
- [`Status`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/status.hpp) - this is a type wrapping `Error` or `Ok` for indicating error or success, respectively.
|
||||
|
||||
- [`TableParameters`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/api/table_parameters.hpp) - this is an example of parameter types the Routing Machine functions expect. In this case `Table` expects its own parameters as `TableParameters`. You can see it wrapping two vectors, sources and destinations --- these are indices into your coordinates for the table service to construct a matrix from (empty sources or destinations means: use all of them). If you ask yourself where coordinates come from, you can see `TableParameters` inheriting from `BaseParameters`.
|
||||
|
||||
- [`BaseParameter`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/api/base_parameters.hpp) - this most importantly holds coordinates (and a few other optional properties that you don't need for basic usage); the specific parameter types inherit from `BaseParameters` to get these member attributes. That means your `TableParameters` type has `coordinates`, `sources` and `destination` member attributes (and a few other that we ignore for now).
|
||||
|
||||
- [`Coordinate`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/util/coordinate.hpp) - this is a wrapper around a (longitude, latitude) pair. We really don't care about (lon,lat) vs (lat, lon) but we don't want you to accidentally mix them up, so both latitude and longitude are strictly typed wrappers around integers (fixed notation such as `13423240`) and floating points (floating notation such as `13.42324`).
|
||||
|
||||
- [Parameters for other services](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api) - here are all other `*Parameters` you need for other Routing Machine services.
|
||||
|
||||
- [JSON](https://github.com/Project-OSRM/osrm-backend/blob/master/include/util/json_container.hpp) - this is a sum type resembling JSON. The Routing Machine service functions take a out-ref to a JSON result and fill it accordingly. It is currently implemented using [mapbox/variant](https://github.com/mapbox/variant) which is similar to [Boost.Variant](http://www.boost.org/doc/libs/1_55_0/doc/html/variant.html). There are two ways to work with this sum type: either provide a visitor that acts on each type on visitation or use the `get` function in case you're sure about the structure. The JSON structure is written down in the [HTTP API](#http-api).
|
||||
|
||||
## Example
|
||||
|
||||
See [the example folder](https://github.com/Project-OSRM/osrm-backend/tree/master/example) in the OSRM repository.
|
||||
|
||||
## Workflow
|
||||
|
||||
- Create an `OSRM` instance initialized with a `EngineConfig`
|
||||
- Call the service function on the `OSRM` object providing service specific `*Parameters`
|
||||
- Check the return code and use the JSON result
|
||||
@@ -1,47 +0,0 @@
|
||||
OSRM supports "profiles". Configurations representing different routing behaviours for (typically) different transport modes. A profile describes whether or not we route along a particular type of way, or over a particular node in the OpenStreetMap data, and also how quickly we'll be travelling when we do. This feeds into the way the routing graph is created and thus influences the output routes.
|
||||
|
||||
## Available profiles
|
||||
|
||||
Out-of-the-box OSRM comes with several different profiles, including car, bicycle and foot.
|
||||
|
||||
Profile configuration files have a 'lua' extension, and are found under the 'profiles' subdirectory.
|
||||
Alternatively commands will take a lua profile specified with an explicit -p param, for example:
|
||||
|
||||
`osrm-extract -p ../profiles/car.lua planet-latest.osm.pbf`
|
||||
|
||||
And then **you will need to extract and contract again** (A change to the profile will typically affect the extract step as well as the contract step. See [Processing Flow](https://github.com/Project-OSRM/osrm-backend/wiki/Processing-Flow))
|
||||
|
||||
## lua scripts?
|
||||
|
||||
Profiles are not just configuration files. They are scripts written in the "lua" scripting language ( http://www.lua.org ) The reason for this, is that OpenStreetMap data is not sufficiently straightforward, to simply define tag mappings. Lua scripting offers a powerful way of coping with the complexity of different node,way,relation,tag combinations found within OpenStreetMap data.
|
||||
|
||||
## Basic structure of a profile
|
||||
|
||||
You can understand these lua scripts enough to make interesting modifications, without needing to get to grips with how they work completely.
|
||||
|
||||
Towards the top of the file, a profile (such as [car.lua](../profiles/car.lua)) will typically define various configurations as global variables. A lot of these are look-up hashes of one sort or another.
|
||||
|
||||
As you scroll down the file you'll see local variables, and then local functions, and finally...
|
||||
|
||||
`way_function` and `node_function` are the important functions which are called when extracting OpenStreetMap data with `osrm-extract`.
|
||||
|
||||
## way_function
|
||||
|
||||
Given an OpenStreetMap way, the way_function will either return nothing (meaning we are not going to route over this way at all), or it will set up a result hash to be returned. The most important thing it will do is set the value of `result.forward_speed` and `result.backward_speed` as a suitable integer value representing the speed for traversing the way.
|
||||
|
||||
All other calculations stem from that, including the returned timings in driving directions, but also, less directly, it feeds into the actual routing decisions the engine will take (a way with a slow traversal speed, may be less favoured than a way with fast traversal speed, but it depends how long it is, and... what it connects to in the rest of the network graph)
|
||||
|
||||
Using the power of the scripting language you wouldn't typically see something as simple as a `result.forward_speed = 20` line within the way_function. Instead a way_function will examine the tagging (e.g. `way:get_value_by_key("highway")` and many others), process this information in various ways, calling other local functions, referencing the global variables and look-up hashes, before arriving at the result.
|
||||
|
||||
## Guidance
|
||||
|
||||
The guidance parameters in profiles are currently a work in progress. They can and will change.
|
||||
Please be aware of this when using guidance configuration possibilities.
|
||||
|
||||
### Road Classification
|
||||
|
||||
Guidance uses road classes to decide on when/if to emit specific instructions and to discover which road is obvious when following a route.
|
||||
Classification uses three flags and a priority-category.
|
||||
The flags indicate whether a road is a motorway (required for on/off ramps), a link type (the ramps itself, if also a motorway) and whether a road may be omittted in considerations (is considered purely for connectivity).
|
||||
The priority-category influences the decision which road is considered the obvious choice and which roads can be seen as fork.
|
||||
Forks can be emitted between roads of similar priority category only. Obvious choices follow a major priority road, if the priority difference is large.
|
||||
@@ -1,52 +0,0 @@
|
||||
# Releasing a new OSRM version
|
||||
|
||||
We are using http://semver.org/ for versioning with major, minor and patch versions.
|
||||
|
||||
## Guarantees
|
||||
|
||||
We are giving the following guarantees between versions:
|
||||
|
||||
### Major version change
|
||||
|
||||
- There are no guarantees about compatiblity of APIs or datasets
|
||||
- Breaking changes will be noted as `BREAKING` in the changelog
|
||||
|
||||
### Minor version change
|
||||
|
||||
We may introduce forward-compatible changes: query parameters and response properties may be added in responses, but existing properties may not be changed or removed. One exception to this is the addition of new turn types, which we see as forward-compatible changes.
|
||||
|
||||
- Forward-compatible HTTP API
|
||||
- Forward-compatible C++ library API
|
||||
- Forward-compatible node-osrm API
|
||||
- No compatiblity between OSRM datasets (needs new processing)
|
||||
|
||||
### Patch version change
|
||||
|
||||
- No change of query parameters or response formats
|
||||
- Compatible HTTP API
|
||||
- Compatible C++ library API
|
||||
- Compatible node-osrm API
|
||||
- Compatible OSRM datasets
|
||||
|
||||
## Release and branch management
|
||||
|
||||
- The `master` branch is for the bleeding edge development
|
||||
- We create and maintain release branches `x.y` to control the release flow
|
||||
- We create the release branch once we tagged the final version `x.y.0` version, RCs go on master
|
||||
- No minor or major version will be released without a code-equal release candidates
|
||||
- For quality assurance, release candidates will be run on the demo server for 24 hours before releaseing the version proper
|
||||
- Patch versions may be released without a release candidate
|
||||
- We may backport fixes to older versions and release them as patch versions
|
||||
|
||||
## Releasing a version
|
||||
|
||||
1. Check out the appropriate release branch `x.y`
|
||||
2. Make sure all tests are passing (e.g. Travis CI gives you a :thumbs_up:)
|
||||
3. Make sure `CHANGELOG.md` is up to date.
|
||||
4. Make sure the OSRM version in `CMakeLists.txt` is up to date
|
||||
5. Use an annotated tag to mark the release: `git tag vx.y.z -a` Body of the tag description should be the changelog entries.
|
||||
6. Use `npm run build-api-docs` to generate the API documentation. Copy `build/docs/*` to `https://github.com/Project-OSRM/project-osrm.github.com` in the `docs/vN.N.N/api` directory
|
||||
6. Push tags and commits: `git push; git push --tags`
|
||||
8. Proceede with the `node-osrm` release as [outlined in the repository](https://github.com/Project-OSRM/node-osrm/blob/master/docs/releasing.md).
|
||||
9. If not a release-candidate: Write a mailing-list post to osrm-talk@openstreetmap.org to announce the release
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
## Environment Variables
|
||||
|
||||
### SIGNAL_PARENT_WHEN_READY
|
||||
|
||||
If the SIGNAL_PARENT_WHEN_READY environment variable is set osrm-routed will
|
||||
send the USR1 signal to its parent when it will be running and waiting for
|
||||
requests. This could be used to upgrade osrm-routed to a new binary on the fly
|
||||
without any service downtime - no incoming requests will be lost.
|
||||
|
||||
### DISABLE_ACCESS_LOGGING
|
||||
|
||||
If the DISABLE_ACCESS_LOGGING environment variable is set osrm-routed will
|
||||
**not** log any http requests to standard output. This can be useful in high
|
||||
traffic setup.
|
||||
@@ -1,16 +0,0 @@
|
||||
var fs = require('fs');
|
||||
|
||||
/**
|
||||
* This file exports the content of your website, as a bunch of concatenated
|
||||
* Markdown files. By doing this explicitly, you can control the order
|
||||
* of content without any level of abstraction.
|
||||
*
|
||||
* Using the brfs module, fs.readFileSync calls in this file are translated
|
||||
* into strings of those files' content before the file is delivered to a
|
||||
* browser: the content is read ahead-of-time and included in bundle.js.
|
||||
*/
|
||||
module.exports =
|
||||
'# HTTP API\n' +
|
||||
fs.readFileSync('./content/http.md', 'utf8') + '\n'+
|
||||
'# libosrm C++ API\n' +
|
||||
fs.readFileSync('./content/libosrm.md', 'utf8') + '\n';
|
||||