Compare commits
201 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 96e5c4b518 | |||
| a3cfd49f97 | |||
| fbe722465d | |||
| 448e6cfdc7 | |||
| 8e79b29925 | |||
| bd61494cf4 | |||
| d33a75812d | |||
| 9f5f6019bf | |||
| aef70b832c | |||
| 611d265a27 | |||
| 635b13b61c | |||
| a8a4f56292 | |||
| a0ceee732e | |||
| 560ce74d06 | |||
| d7ffb0d492 | |||
| 369edbe9a7 | |||
| 94ca30c690 | |||
| ab1e5255eb | |||
| 0068d4062d | |||
| 04298b73f3 | |||
| 7657f0de22 | |||
| 7cdeeb0723 | |||
| c0b71cb62a | |||
| 253df58fdb | |||
| cd3005f9fe | |||
| 94cf796ed2 | |||
| 18995379ab | |||
| a5246cc8b8 | |||
| 3a7f527c68 | |||
| f404337383 | |||
| 7421117278 | |||
| f6173b7a48 | |||
| dffd67ef72 | |||
| 3444499cf4 | |||
| 7241438502 | |||
| 44c38146c9 | |||
| 2060088c6b | |||
| 38defe9629 | |||
| 087bb12847 | |||
| c59a6f9444 | |||
| 40c0222ffd | |||
| f763ec2664 | |||
| 186f78f01e | |||
| 1da10942d5 | |||
| 7ad253732a | |||
| 4b1c4068f2 | |||
| 57ec4e5465 | |||
| f3290ab64b | |||
| eb3c2f560e | |||
| 869b13e9db | |||
| 57d9bc5bae | |||
| 917ef160c5 | |||
| ae513dce5c | |||
| 93b5ce2968 | |||
| ba08d0b36c | |||
| 2e60e92b31 | |||
| 5a9a55544b | |||
| ee7c79641a | |||
| 6e57c31ec2 | |||
| 3d9d4f3764 | |||
| 596e7fc60a | |||
| 8845c070a2 | |||
| eaf5dd328f | |||
| 20a0a3b170 | |||
| 8d5d1a9400 | |||
| 572a306d6d | |||
| 63a9e4c6c2 | |||
| c84d4b323e | |||
| 46f717566d | |||
| 0199673d14 | |||
| 607d5408d3 | |||
| 33035fccc0 | |||
| c14e461370 | |||
| 6f4e9a1d11 | |||
| 3610e21854 | |||
| f6a3815e91 | |||
| f2efcfc588 | |||
| 2bf573dbe1 | |||
| 9bd4b77278 | |||
| fb995ad0b0 | |||
| 3a85661e45 | |||
| 0ba881c390 | |||
| c7782b2776 | |||
| 23ca80030e | |||
| f08c389faa | |||
| 47369a0036 | |||
| 253b591a87 | |||
| 5c4488d350 | |||
| 25310ff1bd | |||
| c2d52080d3 | |||
| bf681855ed | |||
| 899d216b9b | |||
| 73aeab3a57 | |||
| 61073ebc9d | |||
| 393334cabd | |||
| 01e4afe2f0 | |||
| 9b599c90f8 | |||
| 252c234221 | |||
| 888a5d04c8 | |||
| b1631eff77 | |||
| ffd5e2de99 | |||
| ea207cef6e | |||
| 893c09f6fc | |||
| 213bb71b35 | |||
| 0fd8d4d8cf | |||
| 13f0a3fb6b | |||
| 3141d3ba48 | |||
| 4ff4fcf516 | |||
| f273f0cfc5 | |||
| dc192d47a8 | |||
| 0f032f7635 | |||
| 060c7e499a | |||
| 28a241c371 | |||
| bab2887f8f | |||
| abba49a44e | |||
| 4638e7c24d | |||
| fe420e5bfc | |||
| 93ae928236 | |||
| 3b485f1426 | |||
| 5165e01a5c | |||
| 7b4e923ec4 | |||
| 007dd19cec | |||
| fd3cf02af4 | |||
| 2bb51717b9 | |||
| 4fe6346146 | |||
| c5bd2b0b1d | |||
| 71426cf760 | |||
| 0ab287e707 | |||
| 49cc0bfb09 | |||
| e132ac5c53 | |||
| 1a9776cff9 | |||
| 342a0d22bd | |||
| 251a43980a | |||
| 41ba8b5e3e | |||
| 30df2aae10 | |||
| a6f00b1856 | |||
| af26c47052 | |||
| 0a774aeef2 | |||
| a89aa68686 | |||
| 4b93107415 | |||
| e0602934b2 | |||
| fdace26222 | |||
| bef41ed667 | |||
| 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,91 +1,2 @@
|
||||
# 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,187 +0,0 @@
|
||||
language: cpp
|
||||
|
||||
git:
|
||||
depth: 10
|
||||
|
||||
# sudo:required is needed for trusty images
|
||||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- "5.2"
|
||||
|
||||
cache:
|
||||
ccache: true
|
||||
apt: true
|
||||
directories:
|
||||
- test/cache
|
||||
|
||||
env:
|
||||
global:
|
||||
- CCACHE_TEMPDIR=/tmp/.ccache-temp
|
||||
- CCACHE_COMPRESS=1
|
||||
- JOBS=4
|
||||
|
||||
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-5-debug"
|
||||
addons: &gcc5
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['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']
|
||||
env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5' BUILD_TYPE='Debug' COVERAGE=ON
|
||||
|
||||
- os: linux
|
||||
compiler: "gcc-4.8-debug"
|
||||
addons: &gcc48
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-4.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', 'ccache']
|
||||
env: CCOMPILER='gcc-4.8' CXXCOMPILER='g++-4.8' BUILD_TYPE='Debug'
|
||||
|
||||
- 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', 'ccache']
|
||||
env: CLANG_VERSION='3.8.0' BUILD_TYPE='Debug' RUN_CLANG_FORMAT=ON
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode7.3
|
||||
compiler: clang
|
||||
env: CCOMPILER='clang' CXXCOMPILER='clang++' BUILD_TYPE='Debug' JOBS=1 CUCUMBER_TIMEOUT=60000
|
||||
|
||||
# Release Builds
|
||||
- os: linux
|
||||
compiler: "gcc-5-release"
|
||||
addons: &gcc5
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['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']
|
||||
env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5' BUILD_TYPE='Release'
|
||||
|
||||
# Disabled because of CI slowness
|
||||
#- os: linux
|
||||
#- compiler: gcc
|
||||
#- addons: &gcc48
|
||||
#- apt:
|
||||
#- sources: ['ubuntu-toolchain-r-test']
|
||||
#- packages: ['g++-4.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='gcc-4.8' CXXCOMPILER='g++-4.8' 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'
|
||||
|
||||
# Disabled because of CI slowness
|
||||
#- os: osx
|
||||
#- osx_image: xcode7.3
|
||||
#- compiler: clang
|
||||
#- env: CCOMPILER='clang' CXXCOMPILER='clang++' BUILD_TYPE='Release'
|
||||
|
||||
# Shared Library
|
||||
- os: linux
|
||||
compiler: "gcc-5-release-shared"
|
||||
addons: &gcc5
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['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']
|
||||
env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5' BUILD_TYPE='Release' BUILD_SHARED_LIBS=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 [[ $(uname -s) == 'Darwin' ]]; then sudo mdutil -i off /; fi;
|
||||
- source ./scripts/install_node.sh 4
|
||||
- npm install
|
||||
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
|
||||
- export PATH=${DEPS_DIR}/bin:${PATH} && mkdir -p ${DEPS_DIR}
|
||||
- CMAKE_URL="https://mason-binaries.s3.amazonaws.com/${TRAVIS_OS_NAME}-x86_64/cmake/3.5.2.tar.gz"
|
||||
- travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${DEPS_DIR}
|
||||
- |
|
||||
if [[ ${CLANG_VERSION:-false} != false ]]; then
|
||||
export CCOMPILER='clang'
|
||||
export CXXCOMPILER='clang++'
|
||||
CLANG_URL="https://mason-binaries.s3.amazonaws.com/${TRAVIS_OS_NAME}-x86_64/clang/${CLANG_VERSION}.tar.gz"
|
||||
travis_retry wget --quiet -O - ${CLANG_URL} | tar --strip-components=1 -xz -C ${DEPS_DIR}
|
||||
fi
|
||||
- |
|
||||
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
||||
# implicit deps, but seem to be installed by default with recent images: libxml2 GDAL boost
|
||||
brew install libzip libstxxl lua51 luabind tbb md5sha1sum ccache
|
||||
fi
|
||||
|
||||
install:
|
||||
- |
|
||||
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
||||
./scripts/check_taginfo.py taginfo.json profiles/car.lua
|
||||
fi
|
||||
- mkdir build && pushd build
|
||||
- export CC=${CCOMPILER} CXX=${CXXCOMPILER}
|
||||
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} -DCOVERAGE=${COVERAGE:-OFF} -DBUILD_TOOLS=1 -DENABLE_CCACHE=ON
|
||||
- echo "travis_fold:start:MAKE"
|
||||
- make osrm-extract --jobs=3
|
||||
- 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
|
||||
- popd
|
||||
|
||||
script:
|
||||
- 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 build
|
||||
- ./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 "${COVERAGE}" ]; then
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
fi
|
||||
@@ -0,0 +1,9 @@
|
||||
The following people contributed code to the Open Source Routing Machine:
|
||||
|
||||
Dennis Schieferdecker
|
||||
Dennis Luxen
|
||||
Pascal Neis
|
||||
Teemu Koskinen
|
||||
Nicolas Belett Vigneron
|
||||
Moyg
|
||||
Jean-Frédéric
|
||||
@@ -1,228 +0,0 @@
|
||||
# 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,499 +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()
|
||||
|
||||
project(OSRM C CXX)
|
||||
set(OSRM_VERSION_MAJOR 5)
|
||||
set(OSRM_VERSION_MINOR 2)
|
||||
set(OSRM_VERSION_PATCH 0)
|
||||
|
||||
# these two functions build up custom variables:
|
||||
# OSRM_INCLUDE_PATHS 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 OSRM_INCLUDE_PATHS "${includes}")
|
||||
set(OSRM_INCLUDE_PATHS "${OSRM_INCLUDE_PATHS}" 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(WARNING "Building on a 32 bit system is unsupported")
|
||||
endif()
|
||||
|
||||
if(WIN32 AND MSVC_VERSION LESS 1900)
|
||||
message(FATAL_ERROR "Building with Microsoft compiler needs Latest Visual Studio 2015 (Community or better)")
|
||||
endif()
|
||||
|
||||
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
|
||||
option(ENABLE_JSON_LOGGING "Adds additional JSON debug logging to the response" OFF)
|
||||
option(BUILD_TOOLS "Build OSRM tools" OFF)
|
||||
option(BUILD_COMPONENTS "Build osrm-components" OFF)
|
||||
option(ENABLE_ASSERTIONS OFF)
|
||||
option(COVERAGE OFF)
|
||||
option(SANITIZER OFF)
|
||||
|
||||
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 filesystem iostreams program_options regex system thread)
|
||||
|
||||
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>)
|
||||
|
||||
# Check the release mode
|
||||
if(NOT CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
message(STATUS "Configuring OSRM in debug mode")
|
||||
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")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ggdb")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endif()
|
||||
if(CMAKE_BUILD_TYPE MATCHES Release)
|
||||
message(STATUS "Configuring OSRM in release mode")
|
||||
# Check if LTO is available
|
||||
check_cxx_compiler_flag("-flto" LTO_AVAILABLE)
|
||||
if(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")
|
||||
else()
|
||||
message(STATUS "LTO broken")
|
||||
set(CMAKE_CXX_FLAGS "${OLD_CXX_FLAGS}")
|
||||
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)
|
||||
message(STATUS "Using gcc specific binutils for LTO.")
|
||||
set(CMAKE_AR "/usr/bin/gcc-ar")
|
||||
set(CMAKE_RANLIB "/usr/bin/gcc-ranlib")
|
||||
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}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(MAYBE_COVERAGE_LIBRARIES "")
|
||||
if (COVERAGE)
|
||||
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
message(ERROR "COVERAGE=ON only make sense with a Debug build")
|
||||
endif()
|
||||
message(INFO "Enabling coverage")
|
||||
set(MAYBE_COVERAGE_LIBRARIES "gcov")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs")
|
||||
endif()
|
||||
if (SANITIZER)
|
||||
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
message(ERROR "SANITIZER=ON only make sense with a Debug build")
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -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 -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 -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} date_time chrono 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")
|
||||
# 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(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++11
|
||||
if(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
endif()
|
||||
|
||||
# Configuring other platform dependencies
|
||||
if(APPLE)
|
||||
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 rt)
|
||||
endif()
|
||||
|
||||
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)
|
||||
add_dependency_includes(${OSMIUM_INCLUDE_DIR})
|
||||
|
||||
|
||||
find_package(Boost 1.49.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
|
||||
# collect a subset of the boost libraries needed
|
||||
# by libosrm
|
||||
foreach(lib ${Boost_LIBRARIES})
|
||||
if(NOT WIN32)
|
||||
if(lib MATCHES filesystem OR lib MATCHES thread OR lib MATCHES iostreams OR lib MATCHES system)
|
||||
list(APPEND BOOST_ENGINE_LIBRARIES "${lib}")
|
||||
endif()
|
||||
else()
|
||||
list(APPEND BOOST_ENGINE_LIBRARIES "${lib}")
|
||||
endif()
|
||||
endforeach(lib)
|
||||
|
||||
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)
|
||||
add_dependency_includes(${Boost_INCLUDE_DIRS})
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
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)
|
||||
include(check_luabind)
|
||||
add_dependency_includes(${LUABIND_INCLUDE_DIR})
|
||||
|
||||
set(USED_LUA_LIBRARIES ${LUA_LIBRARY})
|
||||
if(LUAJIT_FOUND)
|
||||
set(USED_LUA_LIBRARIES, LUAJIT_LIBRARIES)
|
||||
endif()
|
||||
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})
|
||||
|
||||
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()
|
||||
|
||||
find_package(BZip2 REQUIRED)
|
||||
add_dependency_includes(${BZIP2_INCLUDE_DIR})
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
add_dependency_includes(${ZLIB_INCLUDE_DIRS})
|
||||
|
||||
if (ENABLE_JSON_LOGGING)
|
||||
message(STATUS "Enabling json logging")
|
||||
add_dependency_defines(-DENABLE_JSON_LOGGING)
|
||||
endif()
|
||||
|
||||
add_definitions(${OSRM_DEFINES})
|
||||
include_directories(SYSTEM ${OSRM_INCLUDE_PATHS})
|
||||
|
||||
# Binaries
|
||||
target_link_libraries(osrm-datastore osrm_store ${Boost_LIBRARIES})
|
||||
target_link_libraries(osrm-extract osrm_extract ${Boost_LIBRARIES})
|
||||
target_link_libraries(osrm-contract osrm_contract ${Boost_LIBRARIES})
|
||||
target_link_libraries(osrm-routed osrm ${Boost_LIBRARIES} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY})
|
||||
|
||||
set(EXTRACTOR_LIBRARIES
|
||||
${BZIP2_LIBRARIES}
|
||||
${Boost_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_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_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${TBB_LIBRARIES}
|
||||
${MAYBE_RT_LIBRARY}
|
||||
${MAYBE_COVERAGE_LIBRARIES})
|
||||
set(UTIL_LIBRARIES
|
||||
${Boost_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)
|
||||
find_package(GDAL)
|
||||
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_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_LIBRARIES})
|
||||
add_executable(osrm-unlock-all src/tools/unlock_all_mutexes.cpp $<TARGET_OBJECTS:UTIL>)
|
||||
target_link_libraries(osrm-unlock-all ${Boost_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_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)
|
||||
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)
|
||||
|
||||
list(GET ENGINE_LIBRARIES 1 ENGINE_LIBRARY_FIRST)
|
||||
foreach(lib ${ENGINE_LIBRARIES})
|
||||
get_filename_component(ENGINE_LIBRARY_PATH "${ENGINE_LIBRARY_FIRST}" PATH)
|
||||
get_filename_component(ENGINE_LIBRARY_NAME "${lib}" NAME_WE)
|
||||
string(REPLACE "lib" "" ENGINE_LIBRARY_NAME ${ENGINE_LIBRARY_NAME})
|
||||
string(REPLACE "-l" "" ENGINE_LIBRARY_NAME ${ENGINE_LIBRARY_NAME})
|
||||
set(ENGINE_LIBRARY_LISTING "${ENGINE_LIBRARY_LISTING} -L${ENGINE_LIBRARY_PATH} -l${ENGINE_LIBRARY_NAME}")
|
||||
endforeach()
|
||||
|
||||
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()
|
||||
|
||||
# Set up variables, then write to pkgconfig file
|
||||
JOIN("${OSRM_DEFINES}" " " OSRM_DEFINES_STRING)
|
||||
JOIN("-I${OSRM_INCLUDE_PATHS}" " -I" OSRM_INCLUDE_PATHS_STRING)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in libosrm.pc @ONLY)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION lib/pkgconfig)
|
||||
|
||||
# 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()
|
||||
|
||||
# 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()
|
||||
|
||||
# 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)
|
||||
@@ -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,84 +1,63 @@
|
||||
## About
|
||||
Overview
|
||||
--------
|
||||
The repository provides a Leaflet [(1)] based web frontend to the Open Source Routing Machine (Project-OSRM [(2)]).
|
||||
The frontend is implemented in Javascript.
|
||||
Data is fetched from routing and geocoding servers using JSONP queries.
|
||||
The website is XHTML 1.0 Strict compliant.
|
||||
A deployed version of the the web frontend can be seen at [(3)].
|
||||
|
||||
The Open Source Routing Machine is a high performance routing engine written in C++11 designed to run on OpenStreetMap data.
|
||||
|
||||
## Current build status
|
||||
Setup
|
||||
-----
|
||||
The frontend should work directly as provided.
|
||||
Several settings - including the URL for the routing server and the geocoder server - can be specified in `OSRM.config.js`.
|
||||
Different tile servers can be specified in `OSRM.Map.js`.
|
||||
Note that the URL shortener used for generating route links only works with URLs pointing to the official Project-OSRM website.
|
||||
|
||||
| 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) |
|
||||
|
||||
## Building
|
||||
Branches
|
||||
--------
|
||||
* The `master` branch will always point to the latest released version of the frontend.
|
||||
* The `develop` branch should always point to a working version with new features and bugfixes (think of it as a nightly-build).
|
||||
* Other branches contain various work in progress.
|
||||
|
||||
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)
|
||||
Bugtracking
|
||||
-----------
|
||||
Please use the OSRM-Project bug tracker [(4)] for submitting any bug reports or feature requests.
|
||||
|
||||
## Documentation
|
||||
|
||||
### Full documentation
|
||||
Contribute
|
||||
----------
|
||||
If you like to contribute, you can simply fork the project and start coding.
|
||||
When you are going to provide a more substantial addition, please create a new branch first.
|
||||
For pull requests use the develop branch as target, never the master branch.
|
||||
|
||||
- [osrm-routed HTTP API documentation](docs/http.md)
|
||||
- [libosrm API documentation](docs/libosrm.md)
|
||||
|
||||
### Quick start
|
||||
Integration into Project-OSRM repository
|
||||
----------------------------------------
|
||||
The Project-OSRM repository already contains the frontend repository as a submodule.
|
||||
It will always point to the latest deployed version.
|
||||
To successfully work a repository that contains submodules, use the following git commands (available in git 1.7.1+):
|
||||
|
||||
Building OSRM assuming all dependencies are installed:
|
||||
* `git clone --recursive`
|
||||
to clone a repository and the contained submodules
|
||||
|
||||
```
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build .
|
||||
sudo cmake --build . --target install
|
||||
```
|
||||
* `git pull && git submodule update`
|
||||
to pull the latest version of the repository and update its submodules if required
|
||||
|
||||
Loading preparing a dataset and starting the server:
|
||||
Note that the frontend can also be checked out independently of the Project-OSRM repository.
|
||||
|
||||
```
|
||||
osrm-extract data.osm.pbf -p profiles/car.lua
|
||||
osrm-contract data.osrm
|
||||
osrm-routed data.osrm
|
||||
```
|
||||
|
||||
Running a query on your local server:
|
||||
References
|
||||
----------
|
||||
[(1)] Cloudmade Leaflet: http://leaflet.cloudmade.com/
|
||||
[(2)] Project OSRM: http://project-osrm.org/
|
||||
[(3)] Project OSRM Frontend: http://map.project-osrm.org/
|
||||
[(4)] Project OSRM Bugtracker: https://github.com/DennisOSRM/Project-OSRM/issues/
|
||||
|
||||
```
|
||||
curl http://127.0.0.1:5000/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/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},
|
||||
}
|
||||
```
|
||||
|
||||
[(1)]: http://leaflet.cloudmade.com/ "Cloudmade Leaflet"
|
||||
[(2)]: http://project-osrm.org/ "Project OSRM"
|
||||
[(3)]: http://map.project-osrm.org/ "Project-OSRM Frontend"
|
||||
[(4)]: https://github.com/DennisOSRM/Project-OSRM/issues/ "Project-OSRM Bugtracker"
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
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.5';
|
||||
OSRM.DATE = '120427';
|
||||
OSRM.CONSTANTS = {};
|
||||
OSRM.DEFAULTS = {};
|
||||
OSRM.GLOBALS = {};
|
||||
OSRM.G = OSRM.GLOBALS; // abbreviations
|
||||
OSRM.C = OSRM.CONSTANTS;
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
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: 10000,
|
||||
ZOOM_LEVEL: 14,
|
||||
ONLOAD_ZOOM_LEVEL: 5,
|
||||
ONLOAD_LATITUDE: 48.84,
|
||||
ONLOAD_LONGITUDE: 10.10,
|
||||
ONLOAD_SOURCE: "",
|
||||
ONLOAD_TARGET: "",
|
||||
HIGHLIGHT_ZOOM_LEVEL: 16,
|
||||
GEOCODER_BOUNDS: '', // the world is not enough!
|
||||
//GEOCODER_BOUNDS: '&bounded=1&viewbox=-27.0,72.0,46.0,36.0', // bounds for Europe
|
||||
|
||||
SHORTENER_PARAMETERS: '%url&jsonp=%jsonp',
|
||||
SHORTENER_REPLY_PARAMETER: 'ShortURL',
|
||||
|
||||
LANGUAGE: "en",
|
||||
LANGUAGE_FILES_DIRECTORY: "localization/",
|
||||
LANUGAGE_ONDEMAND_RELOADING: true,
|
||||
LANGUAGE_SUPPORTED: [
|
||||
{display_name:"en", encoding:"en"},
|
||||
{display_name:"de", encoding:"de"},
|
||||
{display_name:"fi", encoding:"fi"},
|
||||
{display_name:"fr", encoding:"fr"}
|
||||
],
|
||||
|
||||
TILE_SERVERS: [
|
||||
{ display_name: 'osm.org',
|
||||
url:'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
attribution:'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 Mapnik',
|
||||
options:{maxZoom: 18}
|
||||
},
|
||||
{ display_name: 'osm.de',
|
||||
url:'http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
|
||||
attribution:'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 Mapnik',
|
||||
options:{maxZoom: 18}
|
||||
},
|
||||
{ display_name: 'MapQuest',
|
||||
url:'http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png',
|
||||
attribution:'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 MapQuest',
|
||||
options:{maxZoom: 18, subdomains: '1234'}
|
||||
},
|
||||
{ display_name: 'CloudMade',
|
||||
url:'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
|
||||
attribution:'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
|
||||
options:{maxZoom: 18}
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -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 geocoding routines
|
||||
// [geocoder query, management and display of geocoder results]
|
||||
|
||||
// some constants
|
||||
OSRM.CONSTANTS.SOURCE_LABEL = "source";
|
||||
OSRM.CONSTANTS.TARGET_LABEL = "target";
|
||||
OSRM.CONSTANTS.VIA_LABEL = "via";
|
||||
OSRM.CONSTANTS.DO_FALLBACK_TO_LAT_LNG = true;
|
||||
|
||||
|
||||
OSRM.Geocoder = {
|
||||
|
||||
//[normal geocoding]
|
||||
|
||||
// process input request and call geocoder if needed
|
||||
call: function(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(/[,;]/);
|
||||
OSRM.Geocoder._onclickResult(marker_id, coord[0], coord[1]);
|
||||
OSRM.Geocoder.updateAddress( marker_id );
|
||||
return;
|
||||
}
|
||||
|
||||
//build request for geocoder
|
||||
var call = OSRM.DEFAULTS.HOST_GEOCODER_URL + "?format=json&json_callback=%jsonp" + OSRM.DEFAULTS.GEOCODER_BOUNDS + "&accept-language="+OSRM.Localization.current_language+"&q=" + query;
|
||||
OSRM.JSONP.call( call, OSRM.Geocoder._showResults, OSRM.Geocoder._showResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "geocoder_"+marker_id, {marker_id:marker_id,query:query} );
|
||||
},
|
||||
|
||||
|
||||
// helper function for clicks on geocoder search results
|
||||
_onclickResult: function(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();
|
||||
if( OSRM.G.markers.route.length > 1 )
|
||||
OSRM.Routing.getRoute();
|
||||
},
|
||||
|
||||
|
||||
// process geocoder response
|
||||
_showResults: function(response, parameters) {
|
||||
if(!response){
|
||||
OSRM.Geocoder._showResults_Empty(parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
if(response.length == 0) {
|
||||
OSRM.Geocoder._showResults_Empty(parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
// show first result
|
||||
OSRM.Geocoder._onclickResult(parameters.marker_id, response[0].lat, response[0].lon);
|
||||
if( OSRM.G.markers.route.length > 1 ) // if a route is displayed, we don't need to show other possible geocoding results
|
||||
return;
|
||||
|
||||
// show possible results for input
|
||||
var html = "";
|
||||
html += '<table class="results medium-font">';
|
||||
for(var i=0; i < response.length; i++){
|
||||
var result = response[i];
|
||||
|
||||
//odd or even ?
|
||||
var rowstyle='results-body-odd';
|
||||
if(i%2==0) { rowstyle='results-body-even'; }
|
||||
|
||||
html += '<tr class="'+rowstyle+'">';
|
||||
html += '<td class="results-body-counter"><span">'+(i+1)+'.</span></td>';
|
||||
html += '<td class="results-body-items">';
|
||||
|
||||
if(result.display_name){
|
||||
html += '<div class="results-body-item" onclick="OSRM.Geocoder._onclickResult(\''+parameters.marker_id+'\', '+result.lat+', '+result.lon+');">'+result.display_name+'</div>';
|
||||
}
|
||||
html += "</td></tr>";
|
||||
}
|
||||
html += '</table>';
|
||||
|
||||
document.getElementById('information-box-header').innerHTML =
|
||||
"<div class='header-title'>"+OSRM.loc("SEARCH_RESULTS")+"</div>" +
|
||||
"<div class='header-content'>("+OSRM.loc("FOUND_X_RESULTS").replace(/%i/,response.length)+")</div>";
|
||||
"<div class='header-content'>(found "+response.length+" results)"+"</div>";
|
||||
document.getElementById('information-box').innerHTML = html;
|
||||
},
|
||||
_showResults_Empty: function(parameters) {
|
||||
document.getElementById('information-box-header').innerHTML =
|
||||
"<div class='header-title'>"+OSRM.loc("SEARCH_RESULTS")+"</div>" +
|
||||
"<div class='header-content'>("+OSRM.loc("FOUND_X_RESULTS").replace(/%i/,0)+")</div>";
|
||||
if(parameters.marker_id == OSRM.C.SOURCE_LABEL)
|
||||
document.getElementById('information-box').innerHTML = "<div class='no-results big-font'>"+OSRM.loc("NO_RESULTS_FOUND_SOURCE")+": "+parameters.query +"</div>";
|
||||
else if(parameters.marker_id == OSRM.C.TARGET_LABEL)
|
||||
document.getElementById('information-box').innerHTML = "<div class='no-results big-font'>"+OSRM.loc("NO_RESULTS_FOUND_TARGET")+": "+parameters.query +"</div>";
|
||||
else
|
||||
document.getElementById('information-box').innerHTML = "<div class='no-results big-font'>"+OSRM.loc("NO_RESULTS_FOUND")+": "+parameters.query +"</div>";
|
||||
},
|
||||
_showResults_Timeout: function() {
|
||||
document.getElementById('information-box-header').innerHTML =
|
||||
"<div class='header-title'>"+OSRM.loc("SEARCH_RESULTS")+"</div>" +
|
||||
"<div class='header-content'>("+OSRM.loc("FOUND_X_RESULTS").replace(/%i/,0)+")</div>";
|
||||
document.getElementById('information-box').innerHTML = "<div class='no-results big-font'>"+OSRM.loc("TIMED_OUT")+"</div>";
|
||||
},
|
||||
|
||||
|
||||
// [reverse geocoding]
|
||||
|
||||
//update geo coordinates in input boxes
|
||||
updateLocation: function(marker_id) {
|
||||
if (marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource()) {
|
||||
document.getElementById("gui-input-source").value = OSRM.G.markers.route[0].getLat().toFixed(6) + ", " + OSRM.G.markers.route[0].getLng().toFixed(6);
|
||||
} else if (marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget()) {
|
||||
document.getElementById("gui-input-target").value = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLat().toFixed(6) + ", " + OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLng().toFixed(6);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// update address in input boxes
|
||||
updateAddress: function(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].getLat();
|
||||
lng = OSRM.G.markers.route[0].getLng();
|
||||
} else if(marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() ) {
|
||||
lat = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLat();
|
||||
lng = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLng();
|
||||
} else
|
||||
return;
|
||||
|
||||
var call = OSRM.DEFAULTS.HOST_REVERSE_GEOCODER_URL + "?format=json&json_callback=%jsonp" + "&accept-language="+OSRM.Localization.current_language + "&lat=" + lat.toFixed(6) + "&lon=" + lng.toFixed(6);
|
||||
OSRM.JSONP.call( call, OSRM.Geocoder._showReverseResults, OSRM.Geocoder._showReverseResults_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
|
||||
_showReverseResults: function(response, parameters) {
|
||||
if(!response) {
|
||||
OSRM.Geocoder._showReverseResults_Timeout(response, parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
if(response.address == undefined) {
|
||||
OSRM.Geocoder._showReverseResults_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 ) {
|
||||
OSRM.Geocoder._showReverseResults_Timeout(response, parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
// add result to DOM
|
||||
if(parameters.marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() )
|
||||
document.getElementById("gui-input-source").value = address;
|
||||
else if(parameters.marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() )
|
||||
document.getElementById("gui-input-target").value = address;
|
||||
},
|
||||
_showReverseResults_Timeout: function(response, parameters) {
|
||||
if(!parameters.do_fallback)
|
||||
return;
|
||||
|
||||
OSRM.Geocoder.updateLocation(parameters.marker_id);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
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 map handling
|
||||
// [initialization, event handling, centering relative to UI]
|
||||
|
||||
// will hold the map object
|
||||
OSRM.GLOBALS.map = null;
|
||||
|
||||
|
||||
// map controller
|
||||
// [map initialization, event handling]
|
||||
OSRM.Map = {
|
||||
|
||||
// map initialization
|
||||
init: function() {
|
||||
// check if GUI is initialized!
|
||||
if(OSRM.GUI.visible == null)
|
||||
OSRM.GUI.init();
|
||||
|
||||
// setup tile servers
|
||||
var tile_servers = OSRM.DEFAULTS.TILE_SERVERS;
|
||||
var base_maps = {};
|
||||
for(var i=0, size=tile_servers.length; i<size; i++) {
|
||||
tile_servers[i].options.attribution = tile_servers[i].attribution;
|
||||
base_maps[ tile_servers[i].display_name ] = new L.TileLayer( tile_servers[i].url, tile_servers[i].options );
|
||||
}
|
||||
|
||||
// setup map
|
||||
OSRM.G.map = new OSRM.MapView('map', {
|
||||
center: new L.LatLng(OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE),
|
||||
zoom: OSRM.DEFAULTS.ONLOAD_ZOOM_LEVEL,
|
||||
layers: [base_maps[tile_servers[0].display_name]],
|
||||
zoomAnimation: false, // remove animations -> routes are not hidden during zoom
|
||||
fadeAnimation: false
|
||||
});
|
||||
|
||||
// add layer control
|
||||
var layerControl = new L.Control.QueryableLayers(base_maps, {});
|
||||
OSRM.G.map.addLayerControl(layerControl);
|
||||
|
||||
// move zoom markers
|
||||
OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.left=(OSRM.GUI.width+10)+"px";
|
||||
OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.top="5px";
|
||||
|
||||
// map events
|
||||
OSRM.G.map.on('zoomend', OSRM.Map.zoomed );
|
||||
OSRM.G.map.on('click', OSRM.Map.click );
|
||||
OSRM.G.map.on('contextmenu', OSRM.Map.contextmenu );
|
||||
OSRM.G.map.on('mousemove', OSRM.Map.mousemove );
|
||||
},
|
||||
|
||||
// init map position and zoom (respect UI visibility / use browser geolocation)
|
||||
initPosition: function() {
|
||||
var position = new L.LatLng( OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE);
|
||||
OSRM.G.map.setViewUI( position, OSRM.DEFAULTS.ONLOAD_ZOOM_LEVEL, true);
|
||||
if (navigator.geolocation && document.URL.indexOf("file://") == -1) // convenience: FF does not save access rights for local files
|
||||
navigator.geolocation.getCurrentPosition(OSRM.Map.geolocationResponse);
|
||||
},
|
||||
|
||||
// map event handlers
|
||||
zoomed: function(e) {
|
||||
if(OSRM.G.dragging)
|
||||
OSRM.Routing.getDragRoute();
|
||||
else
|
||||
OSRM.Routing.getZoomRoute();
|
||||
},
|
||||
contextmenu: function(e) {;},
|
||||
mousemove: function(e) { OSRM.Via.drawDragMarker(e); },
|
||||
click: function(e) {
|
||||
if( !OSRM.G.markers.hasSource() ) {
|
||||
var index = OSRM.G.markers.setSource( e.latlng );
|
||||
OSRM.Geocoder.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() );
|
||||
OSRM.Routing.getRoute();
|
||||
} else if( !OSRM.G.markers.hasTarget() ) {
|
||||
var index = OSRM.G.markers.setTarget( e.latlng );
|
||||
OSRM.Geocoder.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() );
|
||||
OSRM.Routing.getRoute();
|
||||
}
|
||||
},
|
||||
geolocationResponse: function(response) {
|
||||
var latlng = new L.LatLng(response.coords.latitude, response.coords.longitude);
|
||||
OSRM.G.map.setViewUI(latlng, OSRM.DEFAULTS.ZOOM_LEVEL );
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
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 marker management (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.DragMarker("highlight", {draggable:true,icon:OSRM.G.icons['marker-highlight'],dragicon:OSRM.G.icons['marker-highlight-drag']});;
|
||||
this.dragger = new OSRM.DragMarker("drag", {draggable:true,icon:OSRM.G.icons['marker-drag'],dragicon:OSRM.G.icons['marker-drag']});;
|
||||
};
|
||||
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);
|
||||
document.getElementById('gui-delete-source').style.visibility = "hidden";
|
||||
document.getElementById('gui-delete-target').style.visibility = "hidden";
|
||||
},
|
||||
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.G.icons['marker-source'],dragicon:OSRM.G.icons['marker-source-drag']}, position));
|
||||
document.getElementById('gui-delete-source').style.visibility = "visible";
|
||||
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.G.icons['marker-target'],dragicon:OSRM.G.icons['marker-target-drag']}, position));
|
||||
document.getElementById('gui-delete-target').style.visibility = "visible";
|
||||
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.G.icons['marker-via'],dragicon:OSRM.G.icons['marker-via-drag']}, 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('gui-input-source').value = "";
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
document.getElementById('gui-delete-source').style.visibility = "hidden";
|
||||
} 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('gui-input-target').value = "";
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
document.getElementById('gui-delete-target').style.visibility = "hidden";
|
||||
}
|
||||
|
||||
this.route[id].hide();
|
||||
this.route.splice(id, 1);
|
||||
},
|
||||
reverseMarkers: function() {
|
||||
var size = this.route.length;
|
||||
|
||||
// invert route, if a route is shown
|
||||
if( size > 1 ) {
|
||||
// switch positions in nodes
|
||||
var temp_position = this.route[0].getPosition();
|
||||
this.route[0].setPosition( this.route[size-1].getPosition() );
|
||||
OSRM.G.markers.route[size-1].setPosition( temp_position );
|
||||
// switch nodes in array
|
||||
var temp_node = OSRM.G.markers.route[0];
|
||||
OSRM.G.markers.route[0] = OSRM.G.markers.route[size-1];
|
||||
OSRM.G.markers.route[size-1] = temp_node;
|
||||
// reverse route
|
||||
OSRM.G.markers.route.reverse();
|
||||
// clear information (both delete markers stay visible)
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
|
||||
// invert marker, if only one marker is shown (implicit clear of information / delete markers)
|
||||
} else if( size > 0 ) {
|
||||
var position = this.route[0].getPosition();
|
||||
var label = this.route[0].label;
|
||||
this.removeMarker(0);
|
||||
if( label == OSRM.C.TARGET_LABEL )
|
||||
this.setSource( position );
|
||||
else if( label == OSRM.C.SOURCE_LABEL )
|
||||
this.setTarget( position );
|
||||
this.route[0].show();
|
||||
}
|
||||
|
||||
},
|
||||
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,115 @@
|
||||
/*
|
||||
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 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();
|
||||
// activate printing
|
||||
OSRM.Printing.deactivate();
|
||||
},
|
||||
hideAll: function() {
|
||||
this._current_route.hide();
|
||||
this._unnamed_route.hide();
|
||||
this._old_route.hide();
|
||||
this._noroute = OSRM.Route.ROUTE;
|
||||
// activate printing
|
||||
OSRM.Printing.deactivate();
|
||||
},
|
||||
|
||||
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();
|
||||
},
|
||||
getPoints: function() {
|
||||
return this._current_route.getPoints();
|
||||
},
|
||||
fire: function(type,event) {
|
||||
this._current_route.route.fire(type,event);
|
||||
},
|
||||
centerView: function() {
|
||||
this._current_route.centerView();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
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 via marker routines
|
||||
// [find correct position for a via marker]
|
||||
|
||||
// store location of via points returned by server
|
||||
OSRM.GLOBALS.via_points = [];
|
||||
|
||||
|
||||
OSRM.Via = {
|
||||
|
||||
// find route segment of current route geometry that is closest to the new via node (marked by index of its endpoint)
|
||||
_findNearestRouteSegment: function( new_via ) {
|
||||
var min_dist = Number.MAX_VALUE;
|
||||
var min_index = undefined;
|
||||
|
||||
var p = OSRM.G.map.latLngToLayerPoint( new_via );
|
||||
var positions = OSRM.G.route.getPoints();
|
||||
for(var i=1; i<positions.length; i++) {
|
||||
var _sqDist = L.LineUtil._sqClosestPointOnSegment(p, positions[i-1], positions[i], true);
|
||||
if( _sqDist < min_dist) {
|
||||
min_dist = _sqDist;
|
||||
min_index = i;
|
||||
}
|
||||
}
|
||||
|
||||
return min_index;
|
||||
},
|
||||
|
||||
|
||||
// find the correct index among all via nodes to insert the new via node, and insert it
|
||||
findViaIndex: function( new_via_position ) {
|
||||
// find route segment that is closest to click position (marked by last index)
|
||||
var nearest_index = OSRM.Via._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] = OSRM.Via._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
|
||||
return new_via_index;
|
||||
},
|
||||
|
||||
|
||||
//function that draws a drag marker
|
||||
dragTimer: new Date(),
|
||||
|
||||
drawDragMarker: function(event) {
|
||||
if( OSRM.G.route.isShown() == false)
|
||||
return;
|
||||
if( OSRM.G.dragging == true )
|
||||
return;
|
||||
|
||||
// throttle computation
|
||||
if( (new Date() - OSRM.Via.dragTimer) < 25 )
|
||||
return;
|
||||
OSRM.Via.dragTimer = new Date();
|
||||
|
||||
// get distance to route
|
||||
var minpoint = OSRM.G.route._current_route.route.closestLayerPoint( event.layerPoint );
|
||||
var min_dist = minpoint ? minpoint._sqDist : 1000;
|
||||
|
||||
// get distance to markers
|
||||
var mouse = event.latlng;
|
||||
for(var i=0, size=OSRM.G.markers.route.length; i<size; i++) {
|
||||
if(OSRM.G.markers.route[i].label=='drag')
|
||||
continue;
|
||||
var position = OSRM.G.markers.route[i].getPosition();
|
||||
var dist = OSRM.G.map.project(mouse).distanceTo(OSRM.G.map.project(position));
|
||||
if( dist < 20 )
|
||||
min_dist = 1000;
|
||||
}
|
||||
|
||||
// check whether mouse is over another marker
|
||||
var pos = OSRM.G.map.layerPointToContainerPoint(event.layerPoint);
|
||||
var obj = document.elementFromPoint(pos.x,pos.y);
|
||||
for(var i=0, size=OSRM.G.markers.route.length; i<size; i++) {
|
||||
if(OSRM.G.markers.route[i].label=='drag')
|
||||
continue;
|
||||
if( obj == OSRM.G.markers.route[i].marker._icon)
|
||||
min_dist = 1000;
|
||||
}
|
||||
|
||||
// special care for highlight marker
|
||||
if( OSRM.G.markers.highlight.isShown() ) {
|
||||
if( OSRM.G.map.project(mouse).distanceTo(OSRM.G.map.project( OSRM.G.markers.highlight.getPosition() ) ) < 20 )
|
||||
min_dist = 1000;
|
||||
else if( obj == OSRM.G.markers.highlight.marker._icon)
|
||||
min_dist = 1000;
|
||||
}
|
||||
|
||||
if( min_dist < 400) {
|
||||
OSRM.G.markers.dragger.setPosition( OSRM.G.map.layerPointToLatLng(minpoint) );
|
||||
OSRM.G.markers.dragger.show();
|
||||
} else
|
||||
OSRM.G.markers.dragger.hide();
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
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 bugfixes
|
||||
// [assorted bugfixes to Leaflet functions we use]
|
||||
|
||||
|
||||
// find relative leaflet URL
|
||||
var i = 0;
|
||||
while( L.ROOT_URL[i] == document.URL[i] ) { i++; }
|
||||
L.RELATIVE_ROOT_URL = L.ROOT_URL.slice(i);
|
||||
|
||||
|
||||
// return closest point on segment or distance to that point
|
||||
L.LineUtil._sqClosestPointOnSegment = function (p, p1, p2, sqDist) {
|
||||
var x = p1.x,
|
||||
y = p1.y,
|
||||
dx = p2.x - x,
|
||||
dy = p2.y - y,
|
||||
dot = dx * dx + dy * dy,
|
||||
t;
|
||||
|
||||
if (dot > 0) {
|
||||
t = ((p.x - x) * dx + (p.y - y) * dy) / dot;
|
||||
|
||||
if (t > 1) {
|
||||
x = p2.x;
|
||||
y = p2.y;
|
||||
} else if (t > 0) {
|
||||
x += dx * t;
|
||||
y += dy * t;
|
||||
}
|
||||
}
|
||||
|
||||
dx = p.x - x;
|
||||
dy = p.y - y;
|
||||
|
||||
// DS_CHANGE: modified return values
|
||||
if(sqDist)
|
||||
return dx*dx + dy*dy;
|
||||
else {
|
||||
var p = new L.Point(x,y);
|
||||
p._sqDist = dx*dx + dy*dy;
|
||||
return p;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// makes requestAnimFrame respect the immediate paramter -> prevents drag events after dragend events
|
||||
// (alternatively: add if(!this.dragging ) return to L.Draggable._updatePosition, but must be done in leaflet.js!)
|
||||
// [TODO: In Leaflet 0.4 use L.Util.cancelAnimFrame(this._animRequest) in L.Draggable._onUp() instead, also has to be done in leaflet.js!]
|
||||
L.Util.requestAnimFrame = (function () {
|
||||
function timeoutDefer(callback) {
|
||||
window.setTimeout(callback, 1000 / 60);
|
||||
}
|
||||
|
||||
var requestFn = window.requestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame ||
|
||||
window.mozRequestAnimationFrame ||
|
||||
window.oRequestAnimationFrame ||
|
||||
window.msRequestAnimationFrame ||
|
||||
timeoutDefer;
|
||||
|
||||
return function (callback, context, immediate, contextEl) {
|
||||
callback = context ? L.Util.bind(callback, context) : callback;
|
||||
if (immediate ) { // DS_CHANGE: removed additional condition requestFn === timeoutDefer
|
||||
callback();
|
||||
} else {
|
||||
requestFn(callback, contextEl);
|
||||
}
|
||||
};
|
||||
}());
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// queryable Layers control
|
||||
// [simply Control.Layers extended by query functions]
|
||||
L.Control.QueryableLayers = L.Control.Layers.extend({
|
||||
getActiveLayerName: function () {
|
||||
var i, input, obj,
|
||||
inputs = this._form.getElementsByTagName('input'),
|
||||
inputsLen = inputs.length;
|
||||
|
||||
for (i = 0; i < inputsLen; i++) {
|
||||
input = inputs[i];
|
||||
obj = this._layers[input.layerId];
|
||||
if (input.checked && !obj.overlay) {
|
||||
return obj.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -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,65 @@
|
||||
/*
|
||||
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 in mouse click events and allows for changing icons]
|
||||
|
||||
|
||||
// extended marker class
|
||||
L.MouseMarker = L.Marker.extend({
|
||||
initialize: function (latlng, options) {
|
||||
L.Marker.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
switchIcon: function( icon ) {
|
||||
this.options.icon = icon;
|
||||
|
||||
if (this._map) {
|
||||
this._changeIcon();
|
||||
this._reset();
|
||||
}
|
||||
},
|
||||
|
||||
_changeIcon: function () {
|
||||
var options = this.options;
|
||||
|
||||
if (this._icon) {
|
||||
this._icon = options.icon.switchIcon( this._icon );
|
||||
if (this.options.clickable) // TODO: only needed until Leaflet 0.4
|
||||
this._icon.className += ' leaflet-clickable';
|
||||
}
|
||||
|
||||
var panes = this._map._panes;
|
||||
|
||||
if (this._shadow)
|
||||
panes.shadowPane.removeChild(this._shadow);
|
||||
this._shadow = options.icon.createShadow();
|
||||
if (this._shadow)
|
||||
panes.shadowPane.appendChild(this._shadow);
|
||||
},
|
||||
|
||||
_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,115 @@
|
||||
/*
|
||||
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: SwitchableIcon
|
||||
// [will be an extension of L.Icon in Leaflet 0.4, for now it is a copy with added functionality]
|
||||
|
||||
|
||||
// icon class with functions to simply switch the icon images
|
||||
L.SwitchableIcon = L.Class.extend({
|
||||
options: {
|
||||
/*
|
||||
iconUrl: (String) (required)
|
||||
iconSize: (Point) (can be set through CSS)
|
||||
iconAnchor: (Point) (centered by default if size is specified, can be set in CSS with negative margins)
|
||||
popupAnchor: (Point) (if not specified, popup opens in the anchor point)
|
||||
shadowUrl: (Point) (no shadow by default)
|
||||
shadowSize: (Point)
|
||||
*/
|
||||
className: ''
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
L.Util.setOptions(this, options);
|
||||
},
|
||||
|
||||
createIcon: function () {
|
||||
return this._createIcon('icon');
|
||||
},
|
||||
|
||||
createShadow: function () {
|
||||
return this.options.shadowUrl ? this._createIcon('shadow') : null;
|
||||
},
|
||||
|
||||
_createIcon: function (name) {
|
||||
var img = this._createImg(this.options[name + 'Url']);
|
||||
this._setIconStyles(img, name);
|
||||
return img;
|
||||
},
|
||||
|
||||
_setIconStyles: function (img, name) {
|
||||
var options = this.options,
|
||||
size = options[name + 'Size'],
|
||||
anchor = options.iconAnchor;
|
||||
|
||||
if (!anchor && size) {
|
||||
anchor = size.divideBy(2, true);
|
||||
}
|
||||
|
||||
if (name === 'shadow' && anchor && options.shadowOffset) {
|
||||
anchor._add(options.shadowOffset);
|
||||
}
|
||||
|
||||
img.className = 'leaflet-marker-' + name + ' ' + options.className;
|
||||
|
||||
if (anchor) {
|
||||
img.style.marginLeft = (-anchor.x) + 'px';
|
||||
img.style.marginTop = (-anchor.y) + 'px';
|
||||
}
|
||||
|
||||
if (size) {
|
||||
img.style.width = size.x + 'px';
|
||||
img.style.height = size.y + 'px';
|
||||
}
|
||||
},
|
||||
|
||||
_createImg: function (src) {
|
||||
var el;
|
||||
if (!L.Browser.ie6) {
|
||||
el = document.createElement('img');
|
||||
el.src = src;
|
||||
} else {
|
||||
el = document.createElement('div');
|
||||
el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")';
|
||||
}
|
||||
return el;
|
||||
},
|
||||
|
||||
// new functions start here
|
||||
switchIcon: function (el) {
|
||||
return this._switchIcon('icon', el);
|
||||
},
|
||||
|
||||
switchShadow: function (el) {
|
||||
return this.options.shadowUrl ? this._switchIcon('shadow', el) : null;
|
||||
},
|
||||
|
||||
_switchIcon: function (name, el) {
|
||||
var img = this._switchImg(this.options[name + 'Url'], el);
|
||||
this._setIconStyles(img, name);
|
||||
return img;
|
||||
},
|
||||
|
||||
_switchImg: function (src, el) {
|
||||
if (!L.Browser.ie6) {
|
||||
el.src = src;
|
||||
} else {
|
||||
el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")';
|
||||
}
|
||||
return el;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// map view/model
|
||||
// [extending Leaflet L.Map with setView/fitBounds methods that respect UI visibility, better layerControl]
|
||||
OSRM.MapView = L.Map.extend({
|
||||
setViewUI: function(position, zoom, no_animation) {
|
||||
if( OSRM.GUI.visible == true ) {
|
||||
var point = this.project( position, zoom);
|
||||
point.x-=OSRM.GUI.width/2;
|
||||
position = this.unproject(point,zoom);
|
||||
}
|
||||
this.setView( position, zoom, no_animation);
|
||||
},
|
||||
fitBoundsUI: function(bounds) {
|
||||
var southwest = bounds.getSouthWest();
|
||||
var northeast = bounds.getNorthEast();
|
||||
var zoom = this.getBoundsZoom(bounds);
|
||||
var sw_point = this.project( southwest, zoom);
|
||||
if( OSRM.GUI.visible == true )
|
||||
sw_point.x-=OSRM.GUI.width+20;
|
||||
else
|
||||
sw_point.x-=20;
|
||||
sw_point.y+=20;
|
||||
var ne_point = this.project( northeast, zoom);
|
||||
ne_point.y-=20;
|
||||
ne_point.x+=20;
|
||||
bounds.extend( this.unproject(sw_point,zoom) );
|
||||
bounds.extend( this.unproject(ne_point,zoom) );
|
||||
this.fitBounds( bounds );
|
||||
},
|
||||
getBoundsUI: function(unbounded) {
|
||||
var bounds = this.getPixelBounds();
|
||||
if( OSRM.GUI.visible == true )
|
||||
bounds.min.x+=OSRM.GUI.width;
|
||||
var sw = this.unproject(new L.Point(bounds.min.x, bounds.max.y), this._zoom, true),
|
||||
ne = this.unproject(new L.Point(bounds.max.x, bounds.min.y), this._zoom, true);
|
||||
return new L.LatLngBounds(sw, ne);
|
||||
},
|
||||
getCenterUI: function(unbounded) {
|
||||
var viewHalf = this.getSize();
|
||||
if( OSRM.GUI.visible == true )
|
||||
viewHalf.x += OSRM.GUI.width;
|
||||
var centerPoint = this._getTopLeftPoint().add(viewHalf.divideBy(2));
|
||||
|
||||
return this.unproject(centerPoint, this._zoom, unbounded);
|
||||
},
|
||||
addLayerControl: function( layerControl ) {
|
||||
if( this.layerControl )
|
||||
return;
|
||||
|
||||
this.layerControl = layerControl;
|
||||
this.addControl(this.layerControl);
|
||||
},
|
||||
getActiveLayerId: function() {
|
||||
var tile_server_id = 0;
|
||||
|
||||
var tile_servers = OSRM.DEFAULTS.TILE_SERVERS;
|
||||
var tile_server_name = this.layerControl.getActiveLayerName();
|
||||
for(var i=0, size=tile_servers.length; i<size; i++)
|
||||
if( tile_servers[tile_server_id].display_name == tile_server_name ) {
|
||||
tile_server_id = i;
|
||||
break;
|
||||
}
|
||||
|
||||
return tile_server_id;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
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]
|
||||
|
||||
|
||||
// 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.setViewUI( this.position, zoom );
|
||||
},
|
||||
toString: function() {
|
||||
return "OSRM.Marker: \""+this.label+"\", "+this.position+")";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// route marker class (draggable, invokes route drawing routines)
|
||||
OSRM.RouteMarker = function ( label, style, position ) {
|
||||
style.baseicon = style.icon;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
OSRM.Routing.getRoute();
|
||||
OSRM.G.markers.highlight.hide();
|
||||
OSRM.G.markers.dragger.hide();
|
||||
},
|
||||
onDrag: function(e) {
|
||||
this.parent.setPosition( e.target.getLatLng() );
|
||||
if(OSRM.G.markers.route.length>1)
|
||||
OSRM.Routing.getDragRoute();
|
||||
OSRM.Geocoder.updateLocation( this.parent.label );
|
||||
},
|
||||
onDragStart: function(e) {
|
||||
OSRM.G.dragging = true;
|
||||
this.switchIcon(this.options.dragicon);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
if( this.parent != OSRM.G.markers.highlight)
|
||||
OSRM.G.markers.highlight.hide();
|
||||
if( this.parent != OSRM.G.markers.dragger)
|
||||
OSRM.G.markers.dragger.hide();
|
||||
if (OSRM.G.route.isShown())
|
||||
OSRM.G.route.showOldRoute();
|
||||
},
|
||||
onDragEnd: function(e) {
|
||||
OSRM.G.dragging = false;
|
||||
this.switchIcon(this.options.baseicon);
|
||||
|
||||
this.parent.setPosition( e.target.getLatLng() );
|
||||
if (OSRM.G.route.isShown()) {
|
||||
OSRM.Routing.getRoute();
|
||||
OSRM.G.route.hideOldRoute();
|
||||
OSRM.G.route.hideUnnamedRoute();
|
||||
} else {
|
||||
OSRM.Geocoder.updateAddress(this.parent.label);
|
||||
OSRM.GUI.clearResults();
|
||||
}
|
||||
},
|
||||
toString: function() {
|
||||
return "OSRM.RouteMarker: \""+this.label+"\", "+this.position+")";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//drag marker class (draggable, invokes route drawing routines)
|
||||
OSRM.DragMarker = function ( label, style, position ) {
|
||||
OSRM.DragMarker.prototype.base.constructor.apply( this, arguments );
|
||||
this.label = label ? label : "drag_marker";
|
||||
};
|
||||
OSRM.inheritFrom( OSRM.DragMarker, OSRM.RouteMarker );
|
||||
OSRM.extend( OSRM.DragMarker, {
|
||||
onClick: function(e) {
|
||||
if( this.parent != OSRM.G.markers.dragger)
|
||||
this.parent.hide();
|
||||
},
|
||||
onDragStart: function(e) {
|
||||
var new_via_index = OSRM.Via.findViaIndex( e.target.getLatLng() );
|
||||
OSRM.G.markers.route.splice(new_via_index+1,0, this.parent );
|
||||
|
||||
OSRM.RouteMarker.prototype.onDragStart.call(this,e);
|
||||
},
|
||||
onDragEnd: function(e) {
|
||||
OSRM.G.markers.route[OSRM.G.dragid] = new OSRM.RouteMarker(OSRM.C.VIA_LABEL, {draggable:true,icon:OSRM.G.icons['marker-via'],dragicon:OSRM.G.icons['marker-via-drag']}, e.target.getLatLng() );
|
||||
OSRM.G.markers.route[OSRM.G.dragid].show();
|
||||
|
||||
OSRM.RouteMarker.prototype.onDragEnd.call(this,e);
|
||||
this.parent.hide();
|
||||
},
|
||||
toString: function() {
|
||||
return "OSRM.DragMarker: \""+this.label+"\", "+this.position+")";
|
||||
}
|
||||
});
|
||||
@@ -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 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;
|
||||
};
|
||||
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;
|
||||
},
|
||||
getPoints: function() {
|
||||
return this.route._originalPoints;
|
||||
},
|
||||
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.fitBoundsUI( bounds );
|
||||
},
|
||||
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 + ")";
|
||||
}
|
||||
});
|
||||
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
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
|
||||
// [base GUI class, all other GUI modules extend this class]
|
||||
|
||||
|
||||
OSRM.GUI = {
|
||||
|
||||
// initialization functions of all GUI parts
|
||||
init_functions: [],
|
||||
|
||||
// init GUI
|
||||
init: function() {
|
||||
for(var i=0, size=OSRM.GUI.init_functions.length; i<size; i++) {
|
||||
OSRM.GUI.init_functions[i]();
|
||||
}
|
||||
},
|
||||
|
||||
//extend GUI class and add init functions to the array
|
||||
extend: function( properties ) {
|
||||
for( property in properties ) {
|
||||
if( property == 'init' )
|
||||
OSRM.GUI.init_functions.push( properties[property] );
|
||||
else
|
||||
OSRM.GUI[property] = properties[property];
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
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 MainGUI
|
||||
// [handles all GUI events that interact with appearance of main window]
|
||||
|
||||
|
||||
OSRM.GUI.extend( {
|
||||
|
||||
// defaults
|
||||
visible: null,
|
||||
width: null,
|
||||
|
||||
// init GUI
|
||||
init: function() {
|
||||
OSRM.GUI.visible = true;
|
||||
OSRM.GUI.width = document.getElementById("main-wrapper").clientWidth;
|
||||
|
||||
// init starting source/target
|
||||
document.getElementById('gui-input-source').value = OSRM.DEFAULTS.ONLOAD_SOURCE;
|
||||
document.getElementById('gui-input-target').value = OSRM.DEFAULTS.ONLOAD_TARGET;
|
||||
|
||||
// init events
|
||||
document.getElementById("gui-toggle-in").onclick = OSRM.GUI.toggleMain;
|
||||
document.getElementById("gui-toggle-out").onclick = OSRM.GUI.toggleMain;
|
||||
|
||||
// gui after transition events
|
||||
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);
|
||||
}
|
||||
|
||||
// set default language
|
||||
OSRM.Localization.setLanguage( OSRM.DEFAULTS.LANGUAGE );
|
||||
},
|
||||
|
||||
// set language dependent labels
|
||||
setLabels: function() {
|
||||
document.getElementById("open-josm").innerHTML = OSRM.loc("OPEN_JOSM");
|
||||
document.getElementById("open-osmbugs").innerHTML = OSRM.loc("OPEN_OSMBUGS");
|
||||
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("gui-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("gui-input-source").title = OSRM.loc("GUI_START_TOOLTIP");
|
||||
document.getElementById("gui-input-target").title = OSRM.loc("GUI_END_TOOLTIP");
|
||||
document.getElementById("legal-notice").innerHTML = OSRM.loc("GUI_LEGAL_NOTICE");
|
||||
},
|
||||
|
||||
//clear output area
|
||||
clearResults: function() {
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
},
|
||||
|
||||
//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";
|
||||
}
|
||||
},
|
||||
|
||||
// show/hide main-gui
|
||||
toggleMain: function() {
|
||||
// show main-gui
|
||||
if( OSRM.GUI.visible == false ) {
|
||||
OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="hidden";
|
||||
OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.left=(OSRM.GUI.width+10)+"px";;
|
||||
|
||||
document.getElementById('blob-wrapper').style.visibility="hidden";
|
||||
document.getElementById('main-wrapper').style.left="5px";
|
||||
// hide main-gui
|
||||
} else {
|
||||
OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="hidden";
|
||||
OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.left="30px";
|
||||
|
||||
document.getElementById('main-wrapper').style.left=-OSRM.GUI.width+"px";
|
||||
}
|
||||
|
||||
// execute after animation (old browser support)
|
||||
if( OSRM.Browser.FF3!=-1 || OSRM.Browser.IE6_9!=-1 )
|
||||
OSRM.GUI._onMainTransitionEnd();
|
||||
},
|
||||
|
||||
// do stuff after main-gui animation finished
|
||||
_onMainTransitionEnd: function() {
|
||||
// after hiding main-gui
|
||||
if( OSRM.GUI.visible == true ) {
|
||||
document.getElementById('blob-wrapper').style.visibility="visible";
|
||||
OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="visible";
|
||||
OSRM.GUI.visible = false;
|
||||
// after showing main-gui
|
||||
} else {
|
||||
OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="visible";
|
||||
OSRM.GUI.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
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 RoutingGUI
|
||||
// [handles all GUI events that interact with routing in main window]
|
||||
|
||||
|
||||
OSRM.GUI.extend( {
|
||||
|
||||
// init
|
||||
init: function() {
|
||||
// init events
|
||||
document.getElementById("gui-input-source").onchange = function() {OSRM.GUI.inputChanged(OSRM.C.SOURCE_LABEL);};
|
||||
document.getElementById("gui-delete-source").onclick = function() {OSRM.GUI.deleteMarker(OSRM.C.SOURCE_LABEL);};
|
||||
document.getElementById("gui-search-source").onclick = function() {OSRM.GUI.showMarker(OSRM.C.SOURCE_LABEL);};
|
||||
|
||||
document.getElementById("gui-input-target").onchange = function() {OSRM.GUI.inputChanged(OSRM.C.TARGET_LABEL);};
|
||||
document.getElementById("gui-delete-target").onclick = function() {OSRM.GUI.deleteMarker(OSRM.C.TARGET_LABEL);};
|
||||
document.getElementById("gui-search-target").onclick = function() {OSRM.GUI.showMarker(OSRM.C.TARGET_LABEL);};
|
||||
|
||||
document.getElementById("gui-reset").onclick = OSRM.GUI.resetRouting;
|
||||
document.getElementById("gui-reverse").onclick = OSRM.GUI.reverseRouting;
|
||||
document.getElementById("gui-options-toggle").onclick = OSRM.GUI.toggleOptions;
|
||||
document.getElementById("open-josm").onclick = OSRM.GUI.openJOSM;
|
||||
document.getElementById("open-osmbugs").onclick = OSRM.GUI.openOSMBugs;
|
||||
document.getElementById("option-highlight-nonames").onclick = OSRM.Routing.getZoomRoute;
|
||||
},
|
||||
|
||||
// click: button "reset"
|
||||
resetRouting: function() {
|
||||
document.getElementById('gui-input-source').value = "";
|
||||
document.getElementById('gui-input-target').value = "";
|
||||
|
||||
OSRM.G.route.hideAll();
|
||||
OSRM.G.markers.removeAll();
|
||||
OSRM.G.markers.highlight.hide();
|
||||
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
|
||||
OSRM.JSONP.reset();
|
||||
},
|
||||
|
||||
// click: button "reverse"
|
||||
reverseRouting: function() {
|
||||
// invert input boxes
|
||||
var tmp = document.getElementById("gui-input-source").value;
|
||||
document.getElementById("gui-input-source").value = document.getElementById("gui-input-target").value;
|
||||
document.getElementById("gui-input-target").value = tmp;
|
||||
|
||||
// recompute route if needed
|
||||
if( OSRM.G.route.isShown() ) {
|
||||
OSRM.G.markers.route.reverse();
|
||||
OSRM.Routing.getRoute(); // temporary route reversal for query, actual reversal done after receiving response
|
||||
OSRM.G.markers.route.reverse();
|
||||
OSRM.G.markers.highlight.hide();
|
||||
OSRM.RoutingDescription.showSimple( OSRM.G.response );
|
||||
|
||||
// simply reverse markers
|
||||
} else {
|
||||
OSRM.G.markers.reverseMarkers();
|
||||
}
|
||||
},
|
||||
|
||||
// click: button "show"
|
||||
showMarker: function(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 enter is pressed [after] or focus is lost [before])
|
||||
inputChanged: function(marker_id) {
|
||||
if( marker_id == OSRM.C.SOURCE_LABEL)
|
||||
OSRM.Geocoder.call(OSRM.C.SOURCE_LABEL, document.getElementById('gui-input-source').value);
|
||||
else if( marker_id == OSRM.C.TARGET_LABEL)
|
||||
OSRM.Geocoder.call(OSRM.C.TARGET_LABEL, document.getElementById('gui-input-target').value);
|
||||
},
|
||||
|
||||
// click: button "open JOSM"
|
||||
openJOSM: function() {
|
||||
var center = OSRM.G.map.getCenterUI();
|
||||
var bounds = OSRM.G.map.getBoundsUI();
|
||||
|
||||
var xdelta = Math.min(0.02, Math.abs(bounds.getSouthWest().lng - center.lng) );
|
||||
var ydelta = Math.min(0.01, Math.abs(bounds.getSouthWest().lat - center.lat) );
|
||||
|
||||
var p = [ 'left=' + (center.lng - xdelta).toFixed(6), 'bottom=' + (center.lat - ydelta).toFixed(6), 'right=' + (center.lng + xdelta).toFixed(6), 'top=' + (center.lat + ydelta).toFixed(6)];
|
||||
var url = 'http://127.0.0.1:8111/load_and_zoom?' + p.join('&');
|
||||
|
||||
var frame = document.getElementById('josm-frame');
|
||||
if(!frame) {
|
||||
frame = L.DomUtil.create('iframe', null, document.body);
|
||||
frame.style.display = "none";
|
||||
frame.id = 'josm-frame';
|
||||
}
|
||||
frame.src = url;
|
||||
},
|
||||
|
||||
//click: button "open OSM Bugs"
|
||||
openOSMBugs: function() {
|
||||
var position = OSRM.G.map.getCenterUI();
|
||||
window.open( "http://osmbugs.org/?lat="+position.lat.toFixed(6)+"&lon="+position.lng.toFixed(6)+"&zoom="+OSRM.G.map.getZoom() );
|
||||
},
|
||||
|
||||
//click: button "delete marker"
|
||||
deleteMarker: function(marker_id) {
|
||||
var id = null;
|
||||
if(marker_id == 'source' && OSRM.G.markers.hasSource() )
|
||||
id = 0;
|
||||
else if(marker_id == 'target' && OSRM.G.markers.hasTarget() )
|
||||
id = OSRM.G.markers.route.length-1;
|
||||
if( id == null)
|
||||
return;
|
||||
|
||||
OSRM.G.markers.removeMarker( id );
|
||||
OSRM.Routing.getRoute();
|
||||
OSRM.G.markers.highlight.hide();
|
||||
}
|
||||
|
||||
});
|
||||
|
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: 710 B |
|
After Width: | Height: | Size: 462 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 347 B |
|
After Width: | Height: | Size: 349 B |
|
After Width: | Height: | Size: 350 B |
|
After Width: | Height: | Size: 322 B |
|
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: 446 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,93 @@
|
||||
/*
|
||||
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
|
||||
// [German language support]
|
||||
|
||||
|
||||
OSRM.Localization["de"] = {
|
||||
//gui
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
"GUI_START": "Start",
|
||||
"GUI_END": "Ziel",
|
||||
"GUI_RESET": "Reset",
|
||||
"GUI_SEARCH": "Zeigen",
|
||||
"GUI_REVERSE": "Umdrehen",
|
||||
"GUI_OPTIONS": "Kartenwerkzeuge",
|
||||
"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",
|
||||
"FOUND_X_RESULTS": "%i Ergebnisse gefunden",
|
||||
"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",
|
||||
// printing
|
||||
"OVERVIEW_MAP": "Übersichtskarte",
|
||||
// directions
|
||||
"N": "Norden",
|
||||
"E": "Ost",
|
||||
"S": "Süden",
|
||||
"W": "Westen",
|
||||
"NE": "Nordost",
|
||||
"SE": "Südost",
|
||||
"SW": "Südwest",
|
||||
"NW": "Nordwest",
|
||||
// driving directions
|
||||
// %s: road name
|
||||
// %d: direction
|
||||
// [*]: will only be printed when there actually is a road name
|
||||
"DIRECTION_0":"Unbekannte Anweisung[ auf <b>%s</b>]",
|
||||
"DIRECTION_1":"Geradeaus weiterfahren[ auf <b>%s</b>]",
|
||||
"DIRECTION_2":"Leicht rechts abbiegen[ auf <b>%s</b>]",
|
||||
"DIRECTION_3":"Rechts abbiegen[ auf <b>%s</b>]",
|
||||
"DIRECTION_4":"Scharf rechts abbiegen[ auf <b>%s</b>]",
|
||||
"DIRECTION_5":"Wenden[ auf <b>%s</b>]",
|
||||
"DIRECTION_6":"Leicht links abbiegen[ auf <b>%s</b>]",
|
||||
"DIRECTION_7":"Links abbiegen[ auf <b>%s</b>]",
|
||||
"DIRECTION_8":"Scharf links abbiegen[ auf <b>%s</b>]",
|
||||
"DIRECTION_10":"Fahren Sie Richtung <b>%d</b>[ auf <b>%s</b>]",
|
||||
"DIRECTION_11-1":"In den Kreisverkehr einfahren und bei erster Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-2":"In den Kreisverkehr einfahren und bei zweiter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-3":"In den Kreisverkehr einfahren und bei dritter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-4":"In den Kreisverkehr einfahren und bei vierter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-5":"In den Kreisverkehr einfahren und bei fünfter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-6":"In den Kreisverkehr einfahren und bei sechster Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-7":"In den Kreisverkehr einfahren und bei siebter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-8":"In den Kreisverkehr einfahren und bei achter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-9":"In den Kreisverkehr einfahren und bei neunter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-x":"In den Kreisverkehr einfahren und bei einer der vielen Möglichkeiten[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_15":"Sie haben Ihr Ziel erreicht"
|
||||
};
|
||||
|
||||
// set GUI language on load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING==true )
|
||||
OSRM.Localization.setLanguage("de");
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
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
|
||||
// [English language support]
|
||||
|
||||
|
||||
OSRM.Localization["en"] = {
|
||||
//gui
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
"GUI_START": "Start",
|
||||
"GUI_END": "End",
|
||||
"GUI_RESET": " Reset ",
|
||||
"GUI_SEARCH": " Show ",
|
||||
"GUI_REVERSE": "Reverse",
|
||||
"GUI_OPTIONS": "Mapping Tools",
|
||||
"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",
|
||||
"FOUND_X_RESULTS": "found %i 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",
|
||||
//printing
|
||||
"OVERVIEW_MAP": "Overview Map",
|
||||
// directions
|
||||
"N": "north",
|
||||
"E": "east",
|
||||
"S": "south",
|
||||
"W": "west",
|
||||
"NE": "northeast",
|
||||
"SE": "southeast",
|
||||
"SW": "southwest",
|
||||
"NW": "northwest",
|
||||
// driving directions
|
||||
// %s: road name
|
||||
// %d: direction
|
||||
// [*]: will only be printed when there actually is a road name
|
||||
"DIRECTION_0":"Unknown instruction[ on <b>%s</b>]",
|
||||
"DIRECTION_1":"Continue[ on <b>%s</b>]",
|
||||
"DIRECTION_2":"Turn slight right[ on <b>%s</b>]",
|
||||
"DIRECTION_3":"Turn right[ on <b>%s</b>]",
|
||||
"DIRECTION_4":"Turn sharp right[ on <b>%s</b>]",
|
||||
"DIRECTION_5":"U-Turn[ on <b>%s</b>]",
|
||||
"DIRECTION_6":"Turn slight left[ on <b>%s</b>]",
|
||||
"DIRECTION_7":"Turn left[ on <b>%s</b>]",
|
||||
"DIRECTION_8":"Turn sharp left[ on <b>%s</b>]",
|
||||
"DIRECTION_10":"Head <b>%d</b>[ on <b>%s</b>]",
|
||||
"DIRECTION_11-1":"Enter roundabout and leave at first exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-2":"Enter roundabout and leave at second exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-3":"Enter roundabout and leave at third exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-4":"Enter roundabout and leave at fourth exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-5":"Enter roundabout and leave at fifth exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-6":"Enter roundabout and leave at sixth exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-7":"Enter roundabout and leave at seventh exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-8":"Enter roundabout and leave at eighth exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-9":"Enter roundabout and leave at nineth exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-x":"Enter roundabout and leave at one of the too many exits[ on <b>%s</b>]",
|
||||
"DIRECTION_15":"You have reached your destination"
|
||||
};
|
||||
|
||||
//set GUI language on load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true )
|
||||
OSRM.Localization.setLanguage("en");
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
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
|
||||
// [Finnish language support]
|
||||
|
||||
|
||||
OSRM.Localization["fi"] = {
|
||||
//gui
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
"GUI_START": "Lähtöpaikka",
|
||||
"GUI_END": "Määränpää",
|
||||
"GUI_RESET": " Tyhjennä ",
|
||||
"GUI_SEARCH": " Etsi ",
|
||||
"GUI_REVERSE": "Käänteinen reitti",
|
||||
"GUI_OPTIONS": "Kartoitustyökalut",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Korosta nimettömät tiet",
|
||||
"GUI_START_TOOLTIP": "Syötä lähtöpaikka",
|
||||
"GUI_END_TOOLTIP": "Syötä määränpää",
|
||||
"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": "Haun tulokset",
|
||||
"FOUND_X_RESULTS": "Löytyi %i vaihtoehtoa",
|
||||
"TIMED_OUT": "Aikakatkaisu",
|
||||
"NO_RESULTS_FOUND": "Ei hakutuloksia",
|
||||
"NO_RESULTS_FOUND_SOURCE": "Ei hakutuloksia lähtöpaikka",
|
||||
"NO_RESULTS_FOUND_TARGET": "Ei hakutuloksia määränpäälle",
|
||||
//routing
|
||||
"ROUTE_DESCRIPTION": "Reittiohjeet",
|
||||
"GET_LINK_TO_ROUTE": "Luo linkki",
|
||||
"GENERATE_LINK_TO_ROUTE": "odotetaan linkkiä",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "ei saatavilla",
|
||||
"GPX_FILE": "GPX-tiedosto",
|
||||
"DISTANCE": "Etäisyys",
|
||||
"DURATION": "Aika",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Reittiä lasketaan",
|
||||
"NO_ROUTE_FOUND": "Reittiä ei löytynyt",
|
||||
//printing
|
||||
"OVERVIEW_MAP": "Yleiskuvakartta",
|
||||
// directions
|
||||
"N": "pohjoiseen",
|
||||
"E": "itään",
|
||||
"S": "etelään",
|
||||
"W": "länteen",
|
||||
"NE": "koilliseen",
|
||||
"SE": "kaakkoon",
|
||||
"SW": "lounaaseen",
|
||||
"NW": "luoteeseen",
|
||||
// driving directions
|
||||
// %s: road name
|
||||
// %d: direction
|
||||
// [*]: will only be printed when there actually is a road name
|
||||
"DIRECTION_0":"Tuntematon ohje[ tielle <b>%s</b>]",
|
||||
"DIRECTION_1":"Jatka[ tielle <b>%s</b>]",
|
||||
"DIRECTION_2":"Käänny loivasti oikealle[ tielle <b>%s</b>]",
|
||||
"DIRECTION_3":"Käänny oikealle[ tielle <b>%s</b>]",
|
||||
"DIRECTION_4":"Käänny jyrkästi oikealle[ tielle <b>%s</b>]",
|
||||
"DIRECTION_5":"Tee U-käännös[ tiellä <b>%s</b>]",
|
||||
"DIRECTION_6":"Käänny loivasti vasemmalle[ tielle <b>%s</b>]",
|
||||
"DIRECTION_7":"Käänny vasemmalle[ tielle <b>%s</b>]",
|
||||
"DIRECTION_8":"Käänny jyrkästi vasemmalle [ tielle <b>%s</b>]",
|
||||
"DIRECTION_10":"Aja <b>%d</b> [ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-1":"Aja liikenneympyrään ja poistu ensimmäisestä haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-2":"Aja liikenneympyrään ja poistu toisesta haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-3":"Aja liikenneympyrään ja poistu kolmannesta haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-4":"Aja liikenneympyrään ja poistu neljännestä haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-5":"Aja liikenneympyrään ja poistu viidennestä haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-6":"Aja liikenneympyrään ja poistu kuudennesta haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-7":"Aja liikenneympyrään ja poistu seitsemännestä haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-8":"Aja liikenneympyrään ja poistu kahdeksannesta haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-9":"Aja liikenneympyrään ja poistu yhdeksännestä haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-x":"Aja liikenneympyrään ja poistu monen haaran jälkeen[ tielle <b>%s</b>]",
|
||||
"DIRECTION_15":"Saavuit määränpäähän"
|
||||
};
|
||||
|
||||
//set GUI language tielle load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true )
|
||||
OSRM.Localization.setLanguage("fi");
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
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
|
||||
// [French language support]
|
||||
|
||||
|
||||
OSRM.Localization["fr"] = {
|
||||
//gui
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "Bugs OSM",
|
||||
"GUI_START": "Départ",
|
||||
"GUI_END": "Arrivée",
|
||||
"GUI_RESET": "Réinitialiser",
|
||||
"GUI_SEARCH": "Montrer",
|
||||
"GUI_REVERSE": "Inverser",
|
||||
"GUI_OPTIONS": "Outils de cartographie",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Surligner les rues sans nom",
|
||||
"GUI_START_TOOLTIP": "Entrez le lieu de départ",
|
||||
"GUI_END_TOOLTIP": "Entrez le lieu d’arrivée",
|
||||
"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - hébergement par <a href='http://algo2.iti.kit.edu/'>KIT</a> - géocodage par <a href='http://www.osm.org/'>OSM</a>",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Résultats de recherche",
|
||||
"FOUND_X_RESULTS": "%i résultat(s)",
|
||||
"TIMED_OUT": "La recherche n’a pas abouti",
|
||||
"NO_RESULTS_FOUND": "Aucun résultat trouvé",
|
||||
"NO_RESULTS_FOUND_SOURCE": "Aucun résultat pour le départ",
|
||||
"NO_RESULTS_FOUND_TARGET": "Aucun résultat pour l'arrivée",
|
||||
//routing
|
||||
"ROUTE_DESCRIPTION": "Description de l’itinéraire",
|
||||
"GET_LINK_TO_ROUTE": "Générer un lien",
|
||||
"GENERATE_LINK_TO_ROUTE": "en attente du lien",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "indisponible",
|
||||
"GPX_FILE": "Fichier GPX",
|
||||
"DISTANCE": "Distance",
|
||||
"DURATION": "Durée",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Votre itinéraire est en cours de calcul",
|
||||
"NO_ROUTE_FOUND": "Pas d’itinéraire possible",
|
||||
//printing
|
||||
"OVERVIEW_MAP": "Overview Map",
|
||||
// directions
|
||||
"N": "nord",
|
||||
"E": "est",
|
||||
"S": "sud",
|
||||
"W": "ouest",
|
||||
"NE": "nord-est",
|
||||
"SE": "sud-est",
|
||||
"SW": "sud-ouest",
|
||||
"NW": "nord-ouest",
|
||||
// driving directions
|
||||
// %s: road name
|
||||
// [*]: will only be printed when there actually is a road name
|
||||
"DIRECTION_0":"Instruction inconnue[ sur <b>%s</b>]",
|
||||
"DIRECTION_1":"Continuez[ sur <b>%s</b>]",
|
||||
"DIRECTION_2":"Tournez légèrement à droite[ sur <b>%s</b>]",
|
||||
"DIRECTION_3":"Tournez à droite[ sur <b>%s</b>]",
|
||||
"DIRECTION_4":"Tournez fortement à droite[ sur <b>%s</b>]",
|
||||
"DIRECTION_5":"Faites demi-tour[ sur <b>%s</b>]",
|
||||
"DIRECTION_6":"Tournez légèrement à gauche[ sur <b>%s</b>]",
|
||||
"DIRECTION_7":"Tournez à gauche[ sur <b>%s</b>]",
|
||||
"DIRECTION_8":"Tournez fortement à gauche[ sur <b>%s</b>]",
|
||||
"DIRECTION_10":"Direction <b>%d</b>[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-1":"Au rond-point, prenez la première sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-2":"Au rond-point, prenez la deuxième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-3":"Au rond-point, prenez la troisième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-4":"Au rond-point, prenez la quatrième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-5":"Au rond-point, prenez la cinquième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-6":"Au rond-point, prenez la sixième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-7":"Au rond-point, prenez la septième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-8":"Au rond-point, prenez la huitième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-9":"Au rond-point, prenez la neuvième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-x":"Au rond-point, prenez l’une des trop nombreuses sorties[ sur <b>%s</b>]",
|
||||
"DIRECTION_15":"Vous êtes arrivé"
|
||||
};
|
||||
|
||||
//set GUI language on load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true )
|
||||
OSRM.Localization.setLanguage("fr");
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
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 = {
|
||||
|
||||
current_language: OSRM.DEFAULTS.LANGUAGE,
|
||||
|
||||
// initialize localization
|
||||
init: function() {
|
||||
// create dropdown menu
|
||||
var select = document.createElement('select');
|
||||
select.id = "gui-language-toggle";
|
||||
select.className = "top-left-button";
|
||||
select.onchange = function() { OSRM.Localization.setLanguage(this.value); };
|
||||
|
||||
// fill dropdown menu
|
||||
var supported_languages = OSRM.DEFAULTS.LANGUAGE_SUPPORTED;
|
||||
for(var i=0, size=supported_languages.length; i<size; i++) {
|
||||
var option=document.createElement("option");
|
||||
option.innerHTML = supported_languages[i].display_name;
|
||||
option.value = supported_languages[i].encoding;
|
||||
select.appendChild(option);
|
||||
}
|
||||
select.value = OSRM.DEFAULTS.LANGUAGE;
|
||||
|
||||
// add element to DOM
|
||||
var input_mask_header = document.getElementById('input-mask-header');
|
||||
input_mask_header.insertBefore(select,input_mask_header.firstChild);
|
||||
|
||||
// create visible dropdown menu
|
||||
var textnode = document.createTextNode(OSRM.DEFAULTS.LANGUAGE);
|
||||
var myspan = document.createElement("span");
|
||||
myspan.className = "styled-select";
|
||||
myspan.id = "styled-select" + select.id;
|
||||
myspan.appendChild(textnode);
|
||||
select.parentNode.insertBefore(myspan, select);
|
||||
myspan.style.width = (select.clientWidth-2)+"px";
|
||||
myspan.style.height = (select.clientHeight)+"px";
|
||||
},
|
||||
|
||||
// perform language change
|
||||
setLanguage: function(language) {
|
||||
if( OSRM.Localization[language]) {
|
||||
OSRM.Localization.current_language = language;
|
||||
// update selector
|
||||
if( select = document.getElementById('gui-language-toggle') ) { // yes, = not == !
|
||||
var option = select.getElementsByTagName("option");
|
||||
select.value = language;
|
||||
for(var i = 0; i < option.length; i++)
|
||||
if(option[i].selected == true) {
|
||||
document.getElementById("styled-select" + select.id).childNodes[0].nodeValue = option[i].childNodes[0].nodeValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// change gui language
|
||||
OSRM.GUI.setLabels();
|
||||
// requery data
|
||||
if( OSRM.G.markers == null )
|
||||
return;
|
||||
if( OSRM.G.markers.route.length > 1)
|
||||
OSRM.Routing.getRoute();
|
||||
else if(OSRM.G.markers.route.length > 0 && document.getElementById('information-box').innerHTML != "" ) {
|
||||
OSRM.Geocoder.call( OSRM.C.SOURCE_LABEL, document.getElementById("gui-input-source").value );
|
||||
OSRM.Geocoder.call( OSRM.C.TARGET_LABEL, document.getElementById("gui-input-target").value );
|
||||
} else {
|
||||
OSRM.Geocoder.updateAddress(OSRM.C.SOURCE_LABEL, false);
|
||||
OSRM.Geocoder.updateAddress(OSRM.C.TARGET_LABEL, false);
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
}
|
||||
} else if(OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING==true) {
|
||||
var supported_languages = OSRM.DEFAULTS.LANGUAGE_SUPPORTED;
|
||||
for(var i=0, size=supported_languages.length; i<size; i++) {
|
||||
if( supported_languages[i].encoding == language) {
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = OSRM.DEFAULTS.LANGUAGE_FILES_DIRECTORY + "OSRM.Locale."+language+".js";
|
||||
document.head.appendChild(script);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// if existing, return localized string -> English string -> input string
|
||||
translate: function(text) {
|
||||
if( OSRM.Localization[OSRM.Localization.current_language] && OSRM.Localization[OSRM.Localization.current_language][text] )
|
||||
return OSRM.Localization[OSRM.Localization.current_language][text];
|
||||
else if( OSRM.Localization[OSRM.DEFAULTS.LANGUAGE] && OSRM.Localization[OSRM.DEFAULTS.LANGUAGE][text] )
|
||||
return OSRM.Localization[OSRM.DEFAULTS.LANGUAGE][text];
|
||||
else
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
||||
// shorter call to translate function
|
||||
OSRM.loc = OSRM.Localization.translate;
|
||||
@@ -0,0 +1,548 @@
|
||||
/*
|
||||
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 */
|
||||
|
||||
|
||||
/* fullscreen map */
|
||||
html, body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
}
|
||||
#map {
|
||||
height: 100%;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
|
||||
/* general styles for gui boxes */
|
||||
.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;
|
||||
}
|
||||
|
||||
|
||||
/* styles for specific gui boxes */
|
||||
#main-wrapper
|
||||
{
|
||||
width:410px;
|
||||
top:5px;
|
||||
bottom:25px;
|
||||
left:5px;
|
||||
}
|
||||
#main-input
|
||||
{
|
||||
width:390px;
|
||||
height:200px;
|
||||
}
|
||||
#main-output
|
||||
{
|
||||
width:390px;
|
||||
top:220px; /* main-input.height+2*gui-box.margin+2*gui-box.padding */
|
||||
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-content
|
||||
{
|
||||
width:16px;
|
||||
height:16px;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/* styles for main-input areas */
|
||||
#input-mask-header
|
||||
{
|
||||
left:0px;
|
||||
right:0px;
|
||||
top:0px;
|
||||
height:50px;
|
||||
background-repeat:no-repeat;
|
||||
background-position:center;
|
||||
background-image:url("images/osrm-logo.png");
|
||||
}
|
||||
#input-mask
|
||||
{
|
||||
margin:3px;
|
||||
}
|
||||
#input-mask-options
|
||||
{
|
||||
margin:3px;
|
||||
}
|
||||
|
||||
|
||||
/* styles for main-input input-mask-header */
|
||||
#gui-language-toggle
|
||||
{
|
||||
position:absolute;
|
||||
border: 0px;
|
||||
text-decoration:none;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.styled-select
|
||||
{
|
||||
position:absolute;
|
||||
background: url("images/selector.png");
|
||||
background-repeat:no-repeat;
|
||||
background-position: top right;
|
||||
padding: 1px 1px 1px 1px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.top-left-button
|
||||
{
|
||||
float:left;
|
||||
}
|
||||
.top-right-button
|
||||
{
|
||||
float:right;
|
||||
}
|
||||
|
||||
|
||||
/* styles for main-input input-mask */
|
||||
.input-marker
|
||||
{
|
||||
display:table-row;
|
||||
}
|
||||
.input-marker > div
|
||||
{
|
||||
padding-bottom:4px;
|
||||
}
|
||||
.input-label
|
||||
{
|
||||
margin:0px 2px 0px 0px;
|
||||
}
|
||||
.input-delete
|
||||
{
|
||||
margin:0px 15px 0px 8px;
|
||||
visibility:hidden;
|
||||
}
|
||||
.input-box
|
||||
{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
/* styles for main-input input-mask-options */
|
||||
#gui-options-toggle
|
||||
{
|
||||
cursor:pointer;
|
||||
color:#0000ff
|
||||
}
|
||||
#gui-options-toggle:hover
|
||||
{
|
||||
color:#ff0000
|
||||
}
|
||||
#options-box
|
||||
{
|
||||
visibility:hidden;
|
||||
}
|
||||
|
||||
|
||||
/* styles for main-output areas */
|
||||
#information-box-header
|
||||
{
|
||||
margin:5px;
|
||||
height:60px;
|
||||
}
|
||||
#information-box
|
||||
{
|
||||
position:absolute;
|
||||
bottom:20px;
|
||||
top:65px;
|
||||
width:380px;
|
||||
overflow:auto;
|
||||
margin:5px;
|
||||
}
|
||||
#legal-notice
|
||||
{
|
||||
position:absolute;
|
||||
right:0px;
|
||||
bottom:0px;
|
||||
margin:5px;
|
||||
}
|
||||
|
||||
|
||||
/* workaround for invisible scrollbars in Chrome */
|
||||
#information-box::-webkit-scrollbar {
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
}
|
||||
#information-box::-webkit-scrollbar-track {
|
||||
background: #FFFFFF;
|
||||
}
|
||||
#information-box::-webkit-scrollbar-thumb {
|
||||
min-height: 30px;
|
||||
background: #EEEEEE;
|
||||
border: 1px solid #999999;
|
||||
-webkit-border-radius: 5ex;
|
||||
}
|
||||
#information-box::-webkit-scrollbar-thumb:hover {
|
||||
background: #F9F9F9;
|
||||
}
|
||||
#information-box::-webkit-scrollbar-thumb:active {
|
||||
background: #F4F4F4;
|
||||
}
|
||||
|
||||
|
||||
/* styles for information-box-header */
|
||||
.header-title
|
||||
{
|
||||
font-weight:bold;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
.header-label
|
||||
{
|
||||
font-weight:normal;
|
||||
padding:0px 5px 0px 0px;
|
||||
}
|
||||
.header-content
|
||||
{
|
||||
font-weight:normal;
|
||||
}
|
||||
.route-link
|
||||
{
|
||||
color:#0000ff;
|
||||
text-decoration:none;
|
||||
cursor:pointer;
|
||||
}
|
||||
.route-link:hover
|
||||
{
|
||||
color:#ff0000;
|
||||
}
|
||||
|
||||
|
||||
/* style for information-box table (general) */
|
||||
.no-results
|
||||
{
|
||||
text-align:center;
|
||||
margin:28px;
|
||||
}
|
||||
|
||||
|
||||
/* style for information-box table (search results) */
|
||||
.results
|
||||
{
|
||||
border-spacing:0px;
|
||||
width:100%;
|
||||
}
|
||||
.results-body-odd
|
||||
{
|
||||
background-color: #FFFDE3;
|
||||
}
|
||||
.results-body-even
|
||||
{
|
||||
background-color: #FFF9BB;
|
||||
}
|
||||
.results-body-counter
|
||||
{
|
||||
text-align:right;
|
||||
vertical-align:top;
|
||||
font-weight:bold;
|
||||
padding:1px 5px 1px 5px;
|
||||
}
|
||||
.results-body-items
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align: middle;
|
||||
width:100%;
|
||||
padding:1px;
|
||||
}
|
||||
.results-body-item
|
||||
{
|
||||
cursor:pointer;
|
||||
color:#000000
|
||||
}
|
||||
.results-body-item:hover
|
||||
{
|
||||
color:#ff0000
|
||||
}
|
||||
|
||||
|
||||
/* style for information-box table (driving directions) */
|
||||
.description
|
||||
{
|
||||
border-spacing:0px;
|
||||
width:100%;
|
||||
}
|
||||
.description-body-odd
|
||||
{
|
||||
background-color: #FFFDE3;
|
||||
}
|
||||
.description-body-even
|
||||
{
|
||||
background-color: #FFF9BB;
|
||||
}
|
||||
.description-body-items
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align: middle;
|
||||
width:100%;
|
||||
padding:1px;
|
||||
}
|
||||
.description-body-directions
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align: middle;
|
||||
padding:1px 5px 1px 5px;
|
||||
}
|
||||
.description-body-direction
|
||||
{
|
||||
width:18px;
|
||||
height:18px;
|
||||
}
|
||||
.description-body-distance
|
||||
{
|
||||
text-align:right;
|
||||
vertical-align: middle;
|
||||
padding:1px 1px 1px 5px;
|
||||
|
||||
}
|
||||
.description-body-item
|
||||
{
|
||||
cursor:pointer;
|
||||
color:#000000
|
||||
}
|
||||
.description-body-item:hover
|
||||
{
|
||||
color:#ff0000
|
||||
}
|
||||
|
||||
|
||||
/* buttons */
|
||||
.button
|
||||
{
|
||||
cursor:pointer;
|
||||
padding:2px 10px 2px 10px;
|
||||
border-radius:5px;
|
||||
-moz-border-radius:5px;
|
||||
-webkit-border-radius:5px;
|
||||
background-color:#EEEEEE;
|
||||
border:1px solid #999999;
|
||||
color:#333333;
|
||||
text-decoration:none;
|
||||
font-size:9px;
|
||||
outline-style:none;
|
||||
vertical-align:1px;
|
||||
}
|
||||
.button:hover
|
||||
{
|
||||
background-color:#F9F9F9;
|
||||
color:#000000;
|
||||
}
|
||||
.button:active
|
||||
{
|
||||
background-color:#F4F4F4;
|
||||
color:#FF0000;
|
||||
}
|
||||
|
||||
|
||||
/* iconic buttons */
|
||||
.iconic-button
|
||||
{
|
||||
cursor:pointer;
|
||||
width:16px;
|
||||
height:16px;
|
||||
background-repeat:no-repeat;
|
||||
background-position:center;
|
||||
}
|
||||
|
||||
#gui-toggle-out
|
||||
{
|
||||
background-image:url("images/cancel.png");
|
||||
}
|
||||
#gui-toggle-out:hover
|
||||
{
|
||||
background-image:url("images/cancel_hover.png");
|
||||
}
|
||||
#gui-toggle-out:active
|
||||
{
|
||||
background-image:url("images/cancel_active.png");
|
||||
}
|
||||
|
||||
#gui-toggle-in
|
||||
{
|
||||
background-image:url("images/restore.png");
|
||||
}
|
||||
#gui-toggle-in:hover
|
||||
{
|
||||
background-image:url("images/restore_hover.png");
|
||||
}
|
||||
#gui-toggle-in:active
|
||||
{
|
||||
background-image:url("images/restore_active.png");
|
||||
}
|
||||
|
||||
#gui-printer
|
||||
{
|
||||
background-image:url("images/printer.png");
|
||||
}
|
||||
#gui-printer-inactive
|
||||
{
|
||||
cursor:default;
|
||||
background-image:url("images/printer_inactive.png");
|
||||
}
|
||||
#gui-printer:hover
|
||||
{
|
||||
background-image:url("images/printer_hover.png");
|
||||
}
|
||||
#gui-printer:active
|
||||
{
|
||||
background-image:url("images/printer_active.png");
|
||||
}
|
||||
|
||||
.delete-marker
|
||||
{
|
||||
background-image:url("images/cancel.png");
|
||||
}
|
||||
.delete-marker:hover
|
||||
{
|
||||
background-image:url("images/cancel_hover.png");
|
||||
}
|
||||
.delete-marker:active
|
||||
{
|
||||
background-image:url("images/cancel_active.png");
|
||||
}
|
||||
|
||||
|
||||
/* fonts */
|
||||
.base-font {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
}
|
||||
.big-font {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.medium-font {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 10.5px;
|
||||
font-weight: normal;
|
||||
}
|
||||
.small-font {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 9px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
|
||||
/* utility styles (defined above buttons, so that buttons retain cursor:pointer)*/
|
||||
.quad
|
||||
{
|
||||
min-width:10px;
|
||||
min-height:10px;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.checkbox-label
|
||||
{
|
||||
vertical-align:2px;
|
||||
}
|
||||
|
||||
.full
|
||||
{
|
||||
display:table;
|
||||
width:100%;
|
||||
}
|
||||
.row
|
||||
{
|
||||
display:table-row;
|
||||
}
|
||||
.left
|
||||
{
|
||||
display:table-cell;
|
||||
text-align:left;
|
||||
vertical-align:middle;
|
||||
}
|
||||
.right
|
||||
{
|
||||
display:table-cell;
|
||||
text-align:right;
|
||||
vertical-align:middle;
|
||||
}
|
||||
.center
|
||||
{
|
||||
display:table-cell;
|
||||
text-align:center;
|
||||
vertical-align:middle;
|
||||
}
|
||||
.stretch
|
||||
{
|
||||
width:100%;
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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 xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
|
||||
<!-- 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" />
|
||||
|
||||
<!-- 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="base/leaflet/L.Bugfixes.js" type="text/javascript"></script>
|
||||
<script src="base/leaflet/L.Control.QueryableLayers.js" type="text/javascript"></script>
|
||||
<script src="base/leaflet/L.DashedPolyline.js" type="text/javascript"></script>
|
||||
<script src="base/leaflet/L.MouseMarker.js" type="text/javascript"></script>
|
||||
<script src="base/leaflet/L.SwitchableIcon.js" type="text/javascript"></script>
|
||||
|
||||
<script src="OSRM.base.js" type="text/javascript"></script>
|
||||
<script src="OSRM.config.js" type="text/javascript"></script>
|
||||
<script src="utils/OSRM.browsers.js" type="text/javascript"></script>
|
||||
<script src="utils/OSRM.classes.js" type="text/javascript"></script>
|
||||
|
||||
<script src="main.js" type="text/javascript"></script>
|
||||
<!-- <script defer="defer" src="OSRM.debug.js" type="text/javascript"></script> -->
|
||||
|
||||
<script src="base/osrm/OSRM.MapView.js" type="text/javascript"></script>
|
||||
<script src="base/osrm/OSRM.Marker.js" type="text/javascript"></script>
|
||||
<script src="base/osrm/OSRM.Route.js" type="text/javascript"></script>
|
||||
|
||||
<script src="base/OSRM.Map.js" type="text/javascript"></script>
|
||||
<script src="base/OSRM.Markers.js" type="text/javascript"></script>
|
||||
<script src="base/OSRM.Routes.js" type="text/javascript"></script>
|
||||
<script src="gui/OSRM.GUI.js" type="text/javascript"></script>
|
||||
<script src="gui/OSRM.MainGUI.js" type="text/javascript"></script>
|
||||
<script src="routing/OSRM.Routing.js" type="text/javascript"></script>
|
||||
<script src="routing/OSRM.RoutingDescription.js" type="text/javascript"></script>
|
||||
<script src="routing/OSRM.RoutingGeometry.js" type="text/javascript"></script>
|
||||
<script src="gui/OSRM.RoutingGUI.js" type="text/javascript"></script>
|
||||
<script src="routing/OSRM.RoutingNoNames.js" type="text/javascript"></script>
|
||||
<script src="base/OSRM.Via.js" type="text/javascript"></script>
|
||||
<script src="base/OSRM.Geocoder.js" type="text/javascript"></script>
|
||||
|
||||
<script src="utils/OSRM.JSONP.js" type="text/javascript"></script>
|
||||
<script src="localization/OSRM.Localization.js" type="text/javascript"></script>
|
||||
<script src="printing/OSRM.Printing.js" type="text/javascript"></script>
|
||||
<script src="utils/OSRM.Utils.js" type="text/javascript"></script>
|
||||
</head>
|
||||
|
||||
|
||||
<!-- body -->
|
||||
<body class="base-font not-selectable">
|
||||
|
||||
<!--map-->
|
||||
<div id="map"></div>
|
||||
|
||||
<!-- show ui blob -->
|
||||
<div id="blob-wrapper" class="gui-wrapper">
|
||||
<div id="blob-content" class="gui-box">
|
||||
<div id="gui-toggle-in" class="iconic-button"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- show main gui -->
|
||||
<div id="main-wrapper" class="gui-wrapper not-selectable">
|
||||
|
||||
<!-- input box -->
|
||||
<div id="main-input" class="gui-box">
|
||||
<!-- header -->
|
||||
<div id="input-mask-header">
|
||||
<div id="gui-toggle-out" class="iconic-button top-right-button"></div>
|
||||
</div>
|
||||
|
||||
<!-- input mask -->
|
||||
<div id="input-mask">
|
||||
|
||||
<!-- source/target input -->
|
||||
<div class="full">
|
||||
<div id="input-source" class="input-marker">
|
||||
<div class="left"><span id="gui-search-source-label" class="input-label">Start:</span></div>
|
||||
<div class="center input-box"><input id="gui-input-source" class="input-box" type="text" maxlength="200" value="" title="Enter start" /></div>
|
||||
<div class="left"><div id="gui-delete-source" class="iconic-button delete-marker input-delete"></div></div>
|
||||
<div class="right"><a class="button" id="gui-search-source">Show</a></div>
|
||||
</div>
|
||||
<div id="input-target" class="input-marker">
|
||||
<div class="left"><span id="gui-search-target-label" class="input-label">End:</span></div>
|
||||
<div class="center input-box"><input id="gui-input-target" class="input-box" type="text" maxlength="200" value="" title="Enter destination" /></div>
|
||||
<div class="left"><div id="gui-delete-target" class="iconic-button delete-marker input-delete"></div></div>
|
||||
<div class="right"><a class="button" id="gui-search-target">Show</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="quad"></div>
|
||||
|
||||
<!-- action buttons -->
|
||||
<div class="full">
|
||||
<div class="left"><a class="button" id="gui-reset">Reset</a></div>
|
||||
<div class="right"><a class="button" id="gui-reverse">Reverse</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="quad"></div>
|
||||
|
||||
<!-- options -->
|
||||
<div id="input-mask-options">
|
||||
|
||||
<!-- option toggle -->
|
||||
<span id="gui-options-toggle" class="small-font">Mapping Tools</span>
|
||||
|
||||
<!-- actual options -->
|
||||
<div id="options-box" class="full">
|
||||
<div class="left">
|
||||
<input type="checkbox" id="option-highlight-nonames" value="highlight-nonames" />
|
||||
<span id="gui-option-highlight-nonames-label" class="checkbox-label small-font">Highlight unnamed streets</span>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="button" id="open-josm">JOSM</a>
|
||||
<a class="button" id="open-osmbugs">OSM Bugs</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- output box -->
|
||||
<div id="main-output" class="gui-box">
|
||||
<div id="information-box-header"></div>
|
||||
<div id="information-box"></div>
|
||||
<div id="legal-notice" class="small-font">GUI2 - 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,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 initialization
|
||||
// [initialization, image prefetching]
|
||||
|
||||
|
||||
// onload initialization routine
|
||||
OSRM.init = function() {
|
||||
OSRM.prefetchImages();
|
||||
OSRM.prefetchIcons();
|
||||
|
||||
OSRM.Localization.init();
|
||||
OSRM.GUI.init();
|
||||
OSRM.Map.init();
|
||||
OSRM.Printing.init();
|
||||
OSRM.Routing.init();
|
||||
|
||||
// check if the URL contains some GET parameter, e.g. for showing a route
|
||||
OSRM.parseParameters();
|
||||
|
||||
// only init default position / geolocation position if GET parameters do not specify a different one
|
||||
if( OSRM.G.initial_position_override == false )
|
||||
OSRM.Map.initPosition();
|
||||
};
|
||||
|
||||
|
||||
// prefetch images
|
||||
OSRM.GLOBALS.images = {};
|
||||
OSRM.prefetchImages = function() {
|
||||
var image_list = [ {id:'marker-shadow', url:L.RELATIVE_ROOT_URL + 'images/marker-shadow.png'},
|
||||
{id:'marker-source', url:'images/marker-source.png'},
|
||||
{id:'marker-target', url:'images/marker-target.png'},
|
||||
{id:'marker-via', url:'images/marker-via.png'},
|
||||
{id:'marker-highlight', url:'images/marker-highlight.png'},
|
||||
{id:'marker-source-drag', url:'images/marker-source-drag.png'},
|
||||
{id:'marker-target-drag', url:'images/marker-target-drag.png'},
|
||||
{id:'marker-via-drag', url:'images/marker-via-drag.png'},
|
||||
{id:'marker-highlight-drag', url:'images/marker-highlight-drag.png'},
|
||||
{id:'marker-drag', url:'images/marker-drag.png'},
|
||||
{id:'cancel', url:'images/cancel.png'},
|
||||
{id:'cancel_active', url:'images/cancel_active.png'},
|
||||
{id:'cancel_hover', url:'images/cancel_hover.png'},
|
||||
{id:'restore', url:'images/restore.png'},
|
||||
{id:'restore_active', url:'images/restore_active.png'},
|
||||
{id:'restore_hover', url:'images/restore_hover.png'},
|
||||
{id:'printer', url:'images/printer.png'},
|
||||
{id:'printer_active', url:'images/printer_active.png'},
|
||||
{id:'printer_hover', url:'images/printer_hover.png'},
|
||||
{id:'printer_inactive', url:'images/printer_inactive.png'},
|
||||
{id:'direction_0', url:'images/default.png'},
|
||||
{id:'direction_1', url:'images/continue.png'},
|
||||
{id:'direction_2', url:'images/slight-right.png'},
|
||||
{id:'direction_3', url:'images/turn-right.png'},
|
||||
{id:'direction_4', url:'images/sharp-right.png'},
|
||||
{id:'direction_5', url:'images/u-turn.png'},
|
||||
{id:'direction_6', url:'images/slight-left.png'},
|
||||
{id:'direction_7', url:'images/turn-left.png'},
|
||||
{id:'direction_8', url:'images/sharp-left.png'},
|
||||
{id:'direction_10', url:'images/head.png'},
|
||||
{id:'direction_11', url:'images/round-about.png'},
|
||||
{id:'direction_15', url:'images/target.png'}
|
||||
];
|
||||
|
||||
for(var i=0; i<image_list.length; i++) {
|
||||
OSRM.G.images[image_list[i].id] = new Image();
|
||||
OSRM.G.images[image_list[i].id].src = image_list[i].url;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// prefetch icons
|
||||
OSRM.GLOBALS.icons = {};
|
||||
OSRM.prefetchIcons = function() {
|
||||
var icon_list = [ {id:'marker-source', image_id:'marker-source'},
|
||||
{id:'marker-target', image_id:'marker-target'},
|
||||
{id:'marker-via', image_id:'marker-via'},
|
||||
{id:'marker-highlight', image_id:'marker-highlight'},
|
||||
{id:'marker-source-drag', image_id:'marker-source-drag'},
|
||||
{id:'marker-target-drag', image_id:'marker-target-drag'},
|
||||
{id:'marker-via-drag', image_id:'marker-via-drag'},
|
||||
{id:'marker-highlight-drag', image_id:'marker-highlight-drag'}
|
||||
//{id:'marker-drag', image_id:'marker-drag'} // special treatment because of size
|
||||
];
|
||||
|
||||
for(var i=0; i<icon_list.length; i++) {
|
||||
var icon = {
|
||||
iconUrl: OSRM.G.images[icon_list[i].image_id].getAttribute("src"), iconSize: new L.Point(25, 41), iconAnchor: new L.Point(13, 41),
|
||||
shadowUrl: OSRM.G.images["marker-shadow"].getAttribute("src"), shadowSize: new L.Point(41, 41),
|
||||
popupAnchor: new L.Point(0, -33)
|
||||
};
|
||||
OSRM.G.icons[icon_list[i].id] = new L.SwitchableIcon(icon);
|
||||
}
|
||||
|
||||
// special values for drag marker
|
||||
OSRM.G.icons['marker-drag'] = new L.SwitchableIcon( {iconUrl: OSRM.G.images["marker-drag"].getAttribute("src"), iconSize: new L.Point(18, 18) } );
|
||||
};
|
||||
|
||||
|
||||
//parse URL GET parameters
|
||||
OSRM.parseParameters = function(){
|
||||
var called_url = document.location.search.substr(1,document.location.search.length);
|
||||
|
||||
// state, if GET parameters specify a different initial position
|
||||
OSRM.G.initial_position_override = false;
|
||||
|
||||
// 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 params = {};
|
||||
|
||||
// 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] == 'hl') {
|
||||
OSRM.Localization.setLanguage(name_val[1]);
|
||||
}
|
||||
else if(name_val[0] == 'loc') {
|
||||
var coordinates = unescape(name_val[1]).split(',');
|
||||
if(coordinates.length!=2 || !OSRM.Utils.isLatitude(coordinates[0]) || !OSRM.Utils.isLongitude(coordinates[1]) )
|
||||
return;
|
||||
params.positions = params.positions || [];
|
||||
params.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 || !OSRM.Utils.isLatitude(coordinates[0]) || !OSRM.Utils.isLongitude(coordinates[1]) )
|
||||
return;
|
||||
params.destination = new L.LatLng( coordinates[0], coordinates[1]);
|
||||
}
|
||||
else if(name_val[0] == 'destname') {
|
||||
params.destination_name = decodeURI(name_val[1]).replace(/<\/?[^>]+(>|$)/g ,""); // discard tags
|
||||
}
|
||||
else if(name_val[0] == 'z') {
|
||||
var zoom_level = Number(name_val[1]);
|
||||
if( zoom_level<0 || zoom_level > 18)
|
||||
return;
|
||||
params.zoom = zoom_level;
|
||||
}
|
||||
else if(name_val[0] == 'center') {
|
||||
var coordinates = unescape(name_val[1]).split(',');
|
||||
if(coordinates.length!=2 || !OSRM.Utils.isLatitude(coordinates[0]) || !OSRM.Utils.isLongitude(coordinates[1]) )
|
||||
return;
|
||||
params.center = new L.LatLng( coordinates[0], coordinates[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// case 1: destination given
|
||||
if( params.destination ) {
|
||||
var index = OSRM.G.markers.setTarget( params.destination.latlng );
|
||||
if( params.destination_name )
|
||||
document.getElementById("gui-input-target").value = params.destination_name;
|
||||
else
|
||||
OSRM.Geocoder.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.initial_position_override = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// case 2: locations given
|
||||
if( params.positions ) {
|
||||
// draw via points
|
||||
if( params.positions.length > 0 ) {
|
||||
OSRM.G.markers.setSource( params.positions[0] );
|
||||
OSRM.Geocoder.updateAddress( OSRM.C.SOURCE_LABEL, OSRM.C.DO_FALLBACK_TO_LAT_LNG );
|
||||
}
|
||||
if( params.positions.length > 1 ) {
|
||||
OSRM.G.markers.setTarget( params.positions[params.positions.length-1] );
|
||||
OSRM.Geocoder.updateAddress( OSRM.C.TARGET_LABEL, OSRM.C.DO_FALLBACK_TO_LAT_LNG );
|
||||
}
|
||||
for(var i=1; i<params.positions.length-1;i++)
|
||||
OSRM.G.markers.setVia( i-1, params.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( params.zoom == null || params.center == null ) {
|
||||
var bounds = new L.LatLngBounds( params.positions );
|
||||
OSRM.G.map.fitBoundsUI( bounds );
|
||||
} else {
|
||||
OSRM.G.map.setView(params.center, params.zoom);
|
||||
}
|
||||
|
||||
// compute route
|
||||
OSRM.Routing.getRoute();
|
||||
OSRM.G.initial_position_override = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// default case: do nothing
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
// onload event
|
||||
OSRM.Browser.onLoadHandler( OSRM.init );
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
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 printing
|
||||
// [printing support]
|
||||
|
||||
|
||||
OSRM.Printing = {
|
||||
|
||||
// create UI for printing in mainwindow
|
||||
init: function() {
|
||||
var icon = document.createElement('div');
|
||||
icon.id = "gui-printer-inactive";
|
||||
icon.className = "iconic-button top-right-button";
|
||||
|
||||
var spacer = document.createElement('div');
|
||||
spacer.className = "quad top-right-button";
|
||||
|
||||
var input_mask_header = document.getElementById('input-mask-header');
|
||||
input_mask_header.appendChild(spacer,input_mask_header.lastChild);
|
||||
input_mask_header.appendChild(icon,input_mask_header.lastChild);
|
||||
|
||||
document.getElementById("gui-printer-inactive").onclick = OSRM.Printing.openPrintWindow;
|
||||
},
|
||||
|
||||
|
||||
// switch printer button on/off
|
||||
activate: function() { // use showing route description as trigger
|
||||
if( document.getElementById("gui-printer-inactive") )
|
||||
document.getElementById("gui-printer-inactive").id = "gui-printer";
|
||||
},
|
||||
deactivate: function() { // use hide route as trigger
|
||||
if( document.getElementById("gui-printer") )
|
||||
document.getElementById("gui-printer").id = "gui-printer-inactive";
|
||||
},
|
||||
|
||||
|
||||
// create UI in printwindow
|
||||
show: function(response) {
|
||||
// create header
|
||||
var header =
|
||||
'<thead class="description-header"><tr><td colspan="3">' +
|
||||
|
||||
'<div class="full">' +
|
||||
'<div class="row">' +
|
||||
|
||||
'<div class="left stretch">' +
|
||||
'<div class="full">' +
|
||||
'<div class="row">' +
|
||||
'<div class="left description-header-label">' + OSRM.loc("GUI_START")+ ': </div>' +
|
||||
'<div class="left description-header-content stretch">' + document.getElementById("gui-input-source").value + '</div>' +
|
||||
'</div>' +
|
||||
'<div class="row">' +
|
||||
'<div class="left description-header-label">' + OSRM.loc("GUI_END")+ ': </div>' +
|
||||
'<div class="left description-header-content stretch">' + document.getElementById("gui-input-target").value + '</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
|
||||
'<div class="left">' +
|
||||
'<div class="full">' +
|
||||
'<div class="row">' +
|
||||
'<div class="left description-header-label">' + OSRM.loc("DISTANCE")+': </div>' +
|
||||
'<div class="left description-header-content">' + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '</div>' +
|
||||
'</div>' +
|
||||
'<div class="row">' +
|
||||
'<div class="left description-header-label">' + OSRM.loc("DURATION")+': </div>' +
|
||||
'<div class="left description-header-content">' + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
|
||||
'<div class="quad"></div>' +
|
||||
'</td></tr></thead>';
|
||||
|
||||
// create route description
|
||||
var body = '<tbody class="description-body">';
|
||||
for(var i=0; i < response.route_instructions.length; i++){
|
||||
//odd or even ?
|
||||
var rowstyle='description-body-odd';
|
||||
if(i%2==0) { rowstyle='description-body-even'; }
|
||||
|
||||
body += '<tr class="'+rowstyle+'">';
|
||||
|
||||
body += '<td class="description-body-directions">';
|
||||
body += '<img class="description-body-direction" src="../'+OSRM.RoutingDescription._getDrivingInstructionIcon(response.route_instructions[i][0])+'" alt="" />';
|
||||
body += "</td>";
|
||||
|
||||
// build route description
|
||||
body += '<td class="description-body-items">';
|
||||
if( response.route_instructions[i][1] != "" )
|
||||
body += OSRM.loc(OSRM.RoutingDescription._getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]).replace(/%d/, OSRM.loc(response.route_instructions[i][6]));
|
||||
else
|
||||
body += OSRM.loc(OSRM.RoutingDescription._getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"").replace(/%d/, OSRM.loc(response.route_instructions[i][6]));
|
||||
body += "</td>";
|
||||
|
||||
body += '<td class="description-body-distance">';
|
||||
if( i != response.route_instructions.length-1 )
|
||||
body += '<b>'+OSRM.Utils.metersToDistance(response.route_instructions[i][2])+'</b>';
|
||||
body += "</td>";
|
||||
|
||||
body += "</tr>";
|
||||
}
|
||||
body += '</tbody>';
|
||||
|
||||
// put everything in DOM
|
||||
var print_window = OSRM.G.printwindow;
|
||||
print_window.document.getElementById('description').innerHTML = '<table class="description medium-font">' + header + body + '</table>';
|
||||
print_window.document.getElementById('overview-map-description').innerHTML = '<table class="description medium-font">' + header + '</table>';
|
||||
|
||||
// draw map
|
||||
var positions = OSRM.G.route.getPositions();
|
||||
var tile_server_id = OSRM.G.map.getActiveLayerId();
|
||||
var zoom = print_window.drawMap( OSRM.DEFAULTS.TILE_SERVERS[tile_server_id], new L.LatLngBounds( positions ) );
|
||||
|
||||
// draw markers
|
||||
print_window.prefetchIcons( OSRM.G.images );
|
||||
print_window.drawMarkers( OSRM.G.markers.route );
|
||||
|
||||
// draw route & query for better geometry
|
||||
print_window.drawRoute( positions );
|
||||
OSRM.JSONP.call(OSRM.Routing._buildCall()+'&z='+zoom+'&instructions=false', OSRM.Printing.drawRoute, OSRM.Printing.timeoutRoute, OSRM.DEFAULTS.JSONP_TIMEOUT, 'print');
|
||||
},
|
||||
timeoutRoute: function() {},
|
||||
drawRoute: function(response) {
|
||||
if(!response)
|
||||
return;
|
||||
var positions = OSRM.RoutingGeometry._decode(response.route_geometry, 5);
|
||||
OSRM.G.printwindow.drawRoute( positions );
|
||||
},
|
||||
|
||||
|
||||
// opens the print window and closes old instances
|
||||
openPrintWindow: function() {
|
||||
// do not open window if there is no route to draw
|
||||
if( !OSRM.G.route.isRoute() || !OSRM.G.route.isShown() )
|
||||
return;
|
||||
|
||||
// close old window (should we really do this?)
|
||||
if( OSRM.G.printwindow )
|
||||
OSRM.G.printwindow.close();
|
||||
|
||||
// generate a new window and wait till it has finished loading
|
||||
OSRM.G.printwindow = window.open("printing/printing.html","","width=540,height=500,left=100,top=100,dependent=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes");
|
||||
},
|
||||
|
||||
|
||||
// add content to printwindow after it has finished loading
|
||||
printWindowLoaded: function(){
|
||||
var print_window = OSRM.G.printwindow;
|
||||
var print_document = print_window.document;
|
||||
|
||||
// add events
|
||||
print_document.getElementById('gui-printer').onclick = print_window.printWindow;
|
||||
|
||||
// localization
|
||||
print_document.getElementById('description-label').innerHTML = OSRM.loc( "ROUTE_DESCRIPTION" );
|
||||
print_document.getElementById('overview-map-label').innerHTML = OSRM.loc( "OVERVIEW_MAP" );
|
||||
|
||||
// add routing content
|
||||
OSRM.Printing.show( OSRM.G.response );
|
||||
|
||||
// finally, focus on printwindow
|
||||
print_window.focus();
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,253 @@
|
||||
/*
|
||||
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 for printing*/
|
||||
|
||||
/* page setup */
|
||||
body
|
||||
{
|
||||
margin: 8px;
|
||||
}
|
||||
|
||||
|
||||
/* header area */
|
||||
#printing-header
|
||||
{
|
||||
left:0px;
|
||||
right:0px;
|
||||
top:0px;
|
||||
height:20px;
|
||||
}
|
||||
.top-left-button
|
||||
{
|
||||
float:left;
|
||||
}
|
||||
.top-right-button
|
||||
{
|
||||
float:right;
|
||||
}
|
||||
|
||||
|
||||
/* content area */
|
||||
div.label
|
||||
{
|
||||
font-weight:bold;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
.box
|
||||
{
|
||||
width:500px;
|
||||
margin:5px;
|
||||
}
|
||||
#overview-map
|
||||
{
|
||||
width:500px;
|
||||
height:500px;
|
||||
margin:5px;
|
||||
}
|
||||
|
||||
|
||||
/* description content */
|
||||
.description
|
||||
{
|
||||
border-spacing:0px;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
/* styles for description header */
|
||||
.description-header
|
||||
{
|
||||
display:table-header-group;
|
||||
}
|
||||
.description-header-label
|
||||
{
|
||||
padding:0px 5px 0px 0px;
|
||||
}
|
||||
.description-header-content
|
||||
{
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
|
||||
/* styles for description body */
|
||||
.description-body
|
||||
{
|
||||
display:table-row-group;
|
||||
}
|
||||
.description-body-odd
|
||||
{
|
||||
background-color: #FFFDE3;
|
||||
}
|
||||
.description-body-even
|
||||
{
|
||||
background-color: #FFF9BB;
|
||||
}
|
||||
.description-body-items
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align: middle;
|
||||
width:100%;
|
||||
padding:1px;
|
||||
}
|
||||
.description-body-directions
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align: middle;
|
||||
padding:1px 5px 1px 5px;
|
||||
}
|
||||
.description-body-direction
|
||||
{
|
||||
height:36px;
|
||||
width:36px;
|
||||
}
|
||||
.description-body-distance
|
||||
{
|
||||
text-align:right;
|
||||
vertical-align: middle;
|
||||
padding:1px 1px 1px 5px;
|
||||
}
|
||||
@media print {
|
||||
.description-body-even > td,
|
||||
.description-body-odd > td
|
||||
{
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* utility styles */
|
||||
.quad
|
||||
{
|
||||
min-width:10px;
|
||||
min-height:10px;
|
||||
}
|
||||
@media print {
|
||||
.pagebreak
|
||||
{
|
||||
page-break-before:always;
|
||||
}
|
||||
.noprint
|
||||
{
|
||||
display:none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* fonts */
|
||||
@media print {
|
||||
.base-font {
|
||||
font-family: Times New Roman, Times, serif;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
}
|
||||
.big-font {
|
||||
font-family: Times New Roman, Times, serif;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.medium-font {
|
||||
font-family: Times New Roman, Times, serif;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
}
|
||||
.small-font {
|
||||
font-family: Times New Roman, Times, serif;
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen {
|
||||
.base-font {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
}
|
||||
.big-font {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.medium-font {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 10.5px;
|
||||
font-weight: normal;
|
||||
}
|
||||
.small-font {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 9px;
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* iconic buttons */
|
||||
.iconic-button
|
||||
{
|
||||
cursor:pointer;
|
||||
width:16px;
|
||||
height:16px;
|
||||
background-repeat:no-repeat;
|
||||
background-position:center;
|
||||
}
|
||||
|
||||
#gui-printer
|
||||
{
|
||||
background-image:url("../images/printer.png");
|
||||
}
|
||||
#gui-printer:hover
|
||||
{
|
||||
background-image:url("../images/printer_hover.png");
|
||||
}
|
||||
#gui-printer:active
|
||||
{
|
||||
background-image:url("../images/printer_active.png");
|
||||
}
|
||||
|
||||
|
||||
/* table */
|
||||
.full
|
||||
{
|
||||
display:table;
|
||||
width:100%;
|
||||
}
|
||||
.row
|
||||
{
|
||||
display:table-row;
|
||||
}
|
||||
.left
|
||||
{
|
||||
display:table-cell;
|
||||
text-align:left;
|
||||
vertical-align:top;
|
||||
}
|
||||
.right
|
||||
{
|
||||
display:table-cell;
|
||||
text-align:right;
|
||||
vertical-align:top;
|
||||
}
|
||||
.center
|
||||
{
|
||||
display:table-cell;
|
||||
text-align:center;
|
||||
vertical-align:top;
|
||||
}
|
||||
.stretch
|
||||
{
|
||||
width:100%;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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 xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
|
||||
<!-- 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" />
|
||||
|
||||
<!-- 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="printing.css" type="text/css"/>
|
||||
|
||||
<!-- scripts -->
|
||||
<script src="printing.js" type="text/javascript"></script>
|
||||
<script src="../leaflet/leaflet-src.js" type="text/javascript"></script>
|
||||
<script src="../base/leaflet/L.DashedPolyline.js" type="text/javascript"></script>
|
||||
<script src="../base/leaflet/L.MouseMarker.js" type="text/javascript"></script>
|
||||
<script src="../base/leaflet/L.SwitchableIcon.js" type="text/javascript"></script>
|
||||
<script src="../base/osrm/OSRM.MapView.js" type="text/javascript"></script>
|
||||
</head>
|
||||
|
||||
|
||||
<!-- body -->
|
||||
<body class="base-font">
|
||||
|
||||
<!-- header -->
|
||||
<div id="printing-header" class="noprint">
|
||||
<div id="gui-printer" class="iconic-button top-right-button"></div>
|
||||
</div>
|
||||
|
||||
<!--description-->
|
||||
<div id="description-label" class="label">Route Description</div>
|
||||
<div id="description" class="box"></div>
|
||||
|
||||
<!--map-->
|
||||
<div class="pagebreak"></div>
|
||||
<div class="quad noprint"></div>
|
||||
<div class="quad noprint"></div>
|
||||
<div id="overview-map-label" class="label">Overview Map</div>
|
||||
<div id="overview-map-description" class="box"></div>
|
||||
<div id="overview-map"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -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 initialization
|
||||
// [for printing window]
|
||||
|
||||
OSRM = {};
|
||||
OSRM.GLOBALS = {};
|
||||
OSRM.GUI = { visible:false };
|
||||
OSRM.G = OSRM.GLOBALS;
|
||||
|
||||
|
||||
//print the window
|
||||
function printWindow() {
|
||||
window.print();
|
||||
}
|
||||
|
||||
|
||||
//prefetch icons
|
||||
OSRM.GLOBALS.icons = {};
|
||||
prefetchIcons = function(images_list) {
|
||||
var icon_list = [ {id:'marker-source', image_id:'marker-source'},
|
||||
{id:'marker-target', image_id:'marker-target'},
|
||||
{id:'marker-via', image_id:'marker-via'},
|
||||
{id:'marker-highlight', image_id:'marker-highlight'}
|
||||
];
|
||||
|
||||
for(var i=0; i<icon_list.length; i++) {
|
||||
var icon = {
|
||||
iconUrl: "../"+images_list[icon_list[i].image_id].getAttribute("src"), iconSize: new L.Point(25, 41), iconAnchor: new L.Point(13, 41),
|
||||
shadowUrl: "../"+images_list["marker-shadow"].getAttribute("src"), shadowSize: new L.Point(41, 41),
|
||||
popupAnchor: new L.Point(0, -33)
|
||||
};
|
||||
OSRM.G.icons[icon_list[i].id] = new L.SwitchableIcon(icon);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// function to initialize a map in the new window
|
||||
function drawMap(tile_server, bounds) {
|
||||
// setup map
|
||||
var tile_layer = new L.TileLayer(tile_server.url, tile_server.options);
|
||||
OSRM.G.map = new OSRM.MapView("overview-map", {
|
||||
center: new L.LatLng(48.84, 10.10),
|
||||
zoom: 13,
|
||||
zoomAnimation: false,
|
||||
fadeAnimation: false,
|
||||
layers: [tile_layer],
|
||||
attributionControl: false,
|
||||
zoomControl: false,
|
||||
dragging:false,
|
||||
scrollWheelZoom:false,
|
||||
touchZoom:false,
|
||||
doubleClickZoom:false
|
||||
});
|
||||
|
||||
OSRM.G.map.fitBoundsUI(bounds);
|
||||
return OSRM.G.map.getBoundsZoom(bounds);
|
||||
}
|
||||
|
||||
|
||||
// manage makers
|
||||
function drawMarkers( markers ) {
|
||||
OSRM.G.map.addLayer( new L.MouseMarker( markers[0].getPosition(), {draggable:false,clickable:false,icon:OSRM.G.icons['marker-source']} ) );
|
||||
for(var i=1, size=markers.length-1; i<size; i++)
|
||||
OSRM.G.map.addLayer( new L.MouseMarker( markers[i].getPosition(), {draggable:false,clickable:false,icon:OSRM.G.icons['marker-via']} ) );
|
||||
OSRM.G.map.addLayer( new L.MouseMarker( markers[markers.length-1].getPosition(), {draggable:false,clickable:false,icon:OSRM.G.icons['marker-target']} ) );
|
||||
}
|
||||
|
||||
|
||||
// manage route
|
||||
function drawRoute( positions ) {
|
||||
OSRM.G.route = new L.DashedPolyline();
|
||||
OSRM.G.route.setLatLngs( positions );
|
||||
OSRM.G.route.setStyle( {dashed:false,clickable:false,color:'#0033FF', weight:5} );
|
||||
OSRM.G.map.addLayer( OSRM.G.route );
|
||||
}
|
||||
function updateRoute( positions ) {
|
||||
OSRM.G.route.setLatLngs( positions );
|
||||
}
|
||||
|
||||
|
||||
// start populating the window when it is fully loaded
|
||||
window.opener.OSRM.Browser.onLoadHandler( window.opener.OSRM.Printing.printWindowLoaded, window );
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
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
|
||||
// [management of routing requests and processing of responses]
|
||||
|
||||
// some variables
|
||||
OSRM.GLOBALS.route = null;
|
||||
OSRM.GLOBALS.markers = null;
|
||||
|
||||
OSRM.GLOBALS.dragging = null;
|
||||
OSRM.GLOBALS.dragid = null;
|
||||
OSRM.GLOBALS.pending = false;
|
||||
|
||||
|
||||
OSRM.Routing = {
|
||||
|
||||
// init routing data structures
|
||||
init: function() {
|
||||
OSRM.G.route = new OSRM.Route();
|
||||
OSRM.G.markers = new OSRM.Markers();
|
||||
},
|
||||
|
||||
|
||||
// -- JSONP processing --
|
||||
|
||||
// process JSONP response of routing server
|
||||
timeoutRouteSimple: function() {
|
||||
OSRM.RoutingGeometry.showNA();
|
||||
OSRM.RoutingDescription.showNA( OSRM.loc("TIMED_OUT") );
|
||||
},
|
||||
timeoutRoute: function() {
|
||||
OSRM.RoutingGeometry.showNA();
|
||||
OSRM.RoutingNoNames.showNA();
|
||||
OSRM.RoutingDescription.showNA( OSRM.loc("TIMED_OUT") );
|
||||
OSRM.Routing._snapRoute();
|
||||
},
|
||||
timeoutRouteReverse: function() {
|
||||
OSRM.G.markers.reverseMarkers();
|
||||
timeoutRoute();
|
||||
},
|
||||
showRouteSimple: function(response) {
|
||||
if(!response)
|
||||
return;
|
||||
if( !OSRM.G.dragging ) // prevent simple routing when not dragging (required as there can be drag events after a dragstop event!)
|
||||
return;
|
||||
|
||||
if( response.status == 207) {
|
||||
OSRM.RoutingGeometry.showNA();
|
||||
OSRM.RoutingDescription.showNA( OSRM.loc("YOUR_ROUTE_IS_BEING_COMPUTED") );
|
||||
} else {
|
||||
OSRM.RoutingGeometry.show(response);
|
||||
OSRM.RoutingDescription.showSimple(response);
|
||||
}
|
||||
OSRM.Routing._updateHints(response);
|
||||
|
||||
if(OSRM.G.pending)
|
||||
setTimeout(OSRM.Routing.draggingTimeout,1);
|
||||
},
|
||||
showRoute: function(response) {
|
||||
if(!response)
|
||||
return;
|
||||
|
||||
OSRM.G.response = response;
|
||||
OSRM.G.via_points = response.via_points.slice(0);
|
||||
if(response.status == 207) {
|
||||
OSRM.RoutingGeometry.showNA();
|
||||
OSRM.RoutingNoNames.showNA();
|
||||
OSRM.RoutingDescription.showNA( OSRM.loc("NO_ROUTE_FOUND") );
|
||||
OSRM.Routing._snapRoute();
|
||||
} else {
|
||||
OSRM.RoutingGeometry.show(response);
|
||||
OSRM.RoutingNoNames.show(response);
|
||||
OSRM.RoutingDescription.show(response);
|
||||
OSRM.Routing._snapRoute();
|
||||
}
|
||||
OSRM.Routing._updateHints(response);
|
||||
},
|
||||
showRouteZooming: function(response) {
|
||||
if(!response)
|
||||
return;
|
||||
|
||||
if(response.status != 207) {
|
||||
OSRM.RoutingGeometry.show(response);
|
||||
OSRM.RoutingNoNames.show(response);
|
||||
}
|
||||
OSRM.Routing._updateHints(response);
|
||||
},
|
||||
|
||||
|
||||
|
||||
//-- main function --
|
||||
|
||||
//generate server calls to query routes
|
||||
getRoute: function() {
|
||||
|
||||
// if source or target are not set -> hide route
|
||||
if( OSRM.G.markers.route.length < 2 ) {
|
||||
OSRM.G.route.hideRoute();
|
||||
return;
|
||||
}
|
||||
OSRM.JSONP.clear('dragging');
|
||||
OSRM.JSONP.clear('zooming');
|
||||
OSRM.JSONP.clear('route');
|
||||
OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=true', OSRM.Routing.showRoute, OSRM.Routing.timeoutRoute, OSRM.DEFAULTS.JSONP_TIMEOUT, 'route');
|
||||
},
|
||||
getZoomRoute: function() {
|
||||
if( OSRM.G.markers.route.length < 2 )
|
||||
return;
|
||||
|
||||
OSRM.JSONP.clear('dragging');
|
||||
OSRM.JSONP.clear('zooming');
|
||||
OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=true', OSRM.Routing.showRouteZooming, OSRM.Routing.timeoutRoute, OSRM.DEFAULTS.JSONP_TIMEOUT, 'zooming');
|
||||
},
|
||||
getDragRoute: function() {
|
||||
OSRM.G.pending = !OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=false', OSRM.Routing.showRouteSimple, OSRM.Routing.timeoutRouteSimple, OSRM.DEFAULTS.JSONP_TIMEOUT, 'dragging');;
|
||||
},
|
||||
getReverseRoute: function() {
|
||||
if( OSRM.G.markers.route.length < 2 )
|
||||
return;
|
||||
|
||||
OSRM.JSONP.clear('dragging');
|
||||
OSRM.JSONP.clear('zooming');
|
||||
OSRM.JSONP.clear('route');
|
||||
OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=true', OSRM.Routing.showRoute, OSRM.Routing.timeoutRouteReverse, OSRM.DEFAULTS.JSONP_TIMEOUT, 'route');
|
||||
},
|
||||
draggingTimeout: function() {
|
||||
OSRM.G.markers.route[OSRM.G.dragid].hint = null;
|
||||
OSRM.Routing.getDragRoute();
|
||||
},
|
||||
|
||||
_buildCall: function() {
|
||||
var source = OSRM.DEFAULTS.HOST_ROUTING_URL;
|
||||
source += '?z=' + OSRM.G.map.getZoom() + '&output=json&jsonp=%jsonp&geomformat=cmp';
|
||||
if(OSRM.G.markers.checksum)
|
||||
source += '&checksum=' + OSRM.G.markers.checksum;
|
||||
for(var i=0,size=OSRM.G.markers.route.length; i<size; i++) {
|
||||
source += '&loc=' + OSRM.G.markers.route[i].getLat().toFixed(6) + ',' + OSRM.G.markers.route[i].getLng().toFixed(6);
|
||||
if( OSRM.G.markers.route[i].hint)
|
||||
source += '&hint=' + OSRM.G.markers.route[i].hint;
|
||||
}
|
||||
return source;
|
||||
},
|
||||
|
||||
|
||||
//-- helper functions --
|
||||
|
||||
// update hints of all markers
|
||||
_updateHints: function(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
|
||||
_snapRoute: function() {
|
||||
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]) );
|
||||
|
||||
OSRM.Geocoder.updateAddress(OSRM.C.SOURCE_LABEL);
|
||||
OSRM.Geocoder.updateAddress(OSRM.C.TARGET_LABEL);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
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 description
|
||||
// [renders routing description and manages events]
|
||||
|
||||
|
||||
OSRM.RoutingDescription = {
|
||||
|
||||
// route description events
|
||||
onClickRouteDescription: function(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);
|
||||
},
|
||||
onClickCreateShortcut: function(src){
|
||||
src += '&z='+ OSRM.G.map.getZoom() + '¢er=' + OSRM.G.map.getCenter().lat.toFixed(6) + ',' + OSRM.G.map.getCenter().lng.toFixed(6);
|
||||
|
||||
var source = OSRM.DEFAULTS.SHORTENER_PARAMETERS.replace(/%url/, OSRM.DEFAULTS.HOST_SHORTENER_URL+src);
|
||||
|
||||
OSRM.JSONP.call(source, OSRM.RoutingDescription.showRouteLink, OSRM.RoutingDescription.showRouteLink_TimeOut, OSRM.DEFAULTS.JSONP_TIMEOUT, 'shortener');
|
||||
document.getElementById('route-link').innerHTML = '['+OSRM.loc("GENERATE_LINK_TO_ROUTE")+']';
|
||||
},
|
||||
showRouteLink: function(response){
|
||||
if(!response[OSRM.DEFAULTS.SHORTENER_REPLY_PARAMETER])
|
||||
OSRM.RoutingDescription.showRouteLink_TimeOut();
|
||||
else
|
||||
document.getElementById('route-link').innerHTML = '[<a class="route-link text-selectable" href="' +response[OSRM.DEFAULTS.SHORTENER_REPLY_PARAMETER]+ '">'+response[OSRM.DEFAULTS.SHORTENER_REPLY_PARAMETER]+'</a>]';
|
||||
},
|
||||
showRouteLink_TimeOut: function(){
|
||||
document.getElementById('route-link').innerHTML = '['+OSRM.loc("LINK_TO_ROUTE_TIMEOUT")+']';
|
||||
},
|
||||
|
||||
// handling of routing description
|
||||
show: function(response) {
|
||||
// activate printing
|
||||
OSRM.Printing.activate();
|
||||
|
||||
// compute query string
|
||||
var query_string = '?hl=' + OSRM.Localization.current_language;
|
||||
for(var i=0; i<OSRM.G.markers.route.length; i++)
|
||||
query_string += '&loc=' + OSRM.G.markers.route[i].getLat().toFixed(6) + ',' + OSRM.G.markers.route[i].getLng().toFixed(6);
|
||||
|
||||
// create link to the route
|
||||
var route_link ='[<a class="route-link" onclick="OSRM.RoutingDescription.onClickCreateShortcut(\'' + OSRM.DEFAULTS.WEBSITE_URL + query_string + '\')">'+OSRM.loc("GET_LINK_TO_ROUTE")+'</a>]';
|
||||
|
||||
// create GPX link
|
||||
var gpx_link = '[<a class="route-link" onClick="document.location.href=\'' + OSRM.DEFAULTS.HOST_ROUTING_URL + query_string + '&output=gpx\';">'+OSRM.loc("GPX_FILE")+'</a>]';
|
||||
|
||||
// create route description
|
||||
var body = "";
|
||||
|
||||
body += '<table class="description medium-font">';
|
||||
for(var i=0; i < response.route_instructions.length; i++){
|
||||
//odd or even ?
|
||||
var rowstyle='description-body-odd';
|
||||
if(i%2==0) { rowstyle='description-body-even'; }
|
||||
|
||||
body += '<tr class="'+rowstyle+'">';
|
||||
|
||||
body += '<td class="description-body-directions">';
|
||||
body += '<img class="description-body-direction" src="'+ OSRM.RoutingDescription._getDrivingInstructionIcon(response.route_instructions[i][0]) + '" alt=""/>';
|
||||
body += '</td>';
|
||||
|
||||
body += '<td class="description-body-items">';
|
||||
body += '<div class="description-body-item" onclick="OSRM.RoutingDescription.onClickRouteDescription('+response.route_instructions[i][3]+')">';
|
||||
|
||||
// build route description
|
||||
if( response.route_instructions[i][1] != "" )
|
||||
body += OSRM.loc(OSRM.RoutingDescription._getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]).replace(/%d/, OSRM.loc(response.route_instructions[i][6]));
|
||||
else
|
||||
body += OSRM.loc(OSRM.RoutingDescription._getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"").replace(/%d/, OSRM.loc(response.route_instructions[i][6]));
|
||||
|
||||
body += '</div>';
|
||||
body += "</td>";
|
||||
|
||||
body += '<td class="description-body-distance">';
|
||||
if( i != response.route_instructions.length-1 )
|
||||
body += '<b>'+OSRM.Utils.metersToDistance(response.route_instructions[i][2])+'</b>';
|
||||
body += "</td>";
|
||||
|
||||
body += "</tr>";
|
||||
}
|
||||
body += '</table>';
|
||||
|
||||
// build header
|
||||
header = OSRM.RoutingDescription._buildHeader(OSRM.Utils.metersToDistance(response.route_summary.total_distance), OSRM.Utils.secondsToTime(response.route_summary.total_time), route_link, gpx_link);
|
||||
|
||||
// update DOM
|
||||
document.getElementById('information-box-header').innerHTML = header;
|
||||
document.getElementById('information-box').innerHTML = body;
|
||||
},
|
||||
|
||||
// simple description
|
||||
showSimple: function(response) {
|
||||
// build header
|
||||
header = OSRM.RoutingDescription._buildHeader(OSRM.Utils.metersToDistance(response.route_summary.total_distance), OSRM.Utils.secondsToTime(response.route_summary.total_time), "", "");
|
||||
|
||||
// update DOM
|
||||
document.getElementById('information-box-header').innerHTML = header;
|
||||
document.getElementById('information-box').innerHTML = "<div class='no-results big-font'>"+OSRM.loc("YOUR_ROUTE_IS_BEING_COMPUTED")+"</div>";
|
||||
},
|
||||
|
||||
// no description
|
||||
showNA: function( display_text ) {
|
||||
// build header
|
||||
header = OSRM.RoutingDescription._buildHeader("N/A", "N/A", "", "");
|
||||
|
||||
// update DOM
|
||||
document.getElementById('information-box-header').innerHTML = header;
|
||||
document.getElementById('information-box').innerHTML = "<div class='no-results big-font'>"+display_text+"</div>";
|
||||
},
|
||||
|
||||
// build header
|
||||
_buildHeader: function(distance, duration, route_link, gpx_link) {
|
||||
var temp =
|
||||
'<div class="header-title">' + OSRM.loc("ROUTE_DESCRIPTION") + '</div>' +
|
||||
|
||||
'<div class="full">' +
|
||||
'<div class="row">' +
|
||||
|
||||
'<div class="left">' +
|
||||
'<div class="full">' +
|
||||
'<div class="row">' +
|
||||
'<div class="left header-label">' + OSRM.loc("DISTANCE")+":" + '</div>' +
|
||||
'<div class="left header-content stretch">' + distance + '</div>' +
|
||||
'</div>' +
|
||||
'<div class="row">' +
|
||||
'<div class="left header-label">' + OSRM.loc("DURATION")+":" + '</div>' +
|
||||
'<div class="left header-content stretch">' + duration + '</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
|
||||
'<div class="left">' +
|
||||
'<div class="full">' +
|
||||
'<div class="row">' +
|
||||
'<div class="right header-content" id="route-link">' + route_link + '</div>' +
|
||||
'</div>' +
|
||||
'<div class="row">' +
|
||||
'<div class="right header-content">' + gpx_link + '</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
|
||||
'</div>';
|
||||
// '<div class="header-title">' + OSRM.loc("ROUTE_DESCRIPTION") + '</div>' +
|
||||
// '<div class="full">' +
|
||||
// '<div class="row">' +
|
||||
// '<div class="left header-label">' + OSRM.loc("DISTANCE")+":" + '</div>' +
|
||||
// '<div class="left header-content">' + distance + '</div>' +
|
||||
// '<div class="right header-content" id="route-link">' + route_link + '</div>' +
|
||||
// '</div>' +
|
||||
// '<div class="row">' +
|
||||
// '<div class="left header-label">' + OSRM.loc("DURATION")+":" + '</div>' +
|
||||
// '<div class="left header-content">' + duration + '</div>' +
|
||||
// '<div class="right header-content">' + gpx_link + '</div>' +
|
||||
// '</div>' +
|
||||
// '</div>';
|
||||
return temp;
|
||||
},
|
||||
|
||||
// retrieve driving instruction icon from instruction id
|
||||
_getDrivingInstructionIcon: function(server_instruction_id) {
|
||||
var local_icon_id = "direction_";
|
||||
server_instruction_id = server_instruction_id.replace(/^11-\d{1,}$/,"11"); // dumb check, if there is a roundabout (all have the same icon)
|
||||
local_icon_id += server_instruction_id;
|
||||
|
||||
if( OSRM.G.images[local_icon_id] )
|
||||
return OSRM.G.images[local_icon_id].getAttribute("src");
|
||||
else
|
||||
return OSRM.G.images["direction_0"].getAttribute("src");
|
||||
},
|
||||
|
||||
// retrieve driving instructions from instruction ids
|
||||
_getDrivingInstruction: function(server_instruction_id) {
|
||||
var local_instruction_id = "DIRECTION_";
|
||||
server_instruction_id = server_instruction_id.replace(/^11-\d{2,}$/,"11-x"); // dumb check, if there are 10+ exits on a roundabout (say the same for exit 10+)
|
||||
local_instruction_id += server_instruction_id;
|
||||
|
||||
var description = OSRM.loc( local_instruction_id );
|
||||
if( description == local_instruction_id)
|
||||
return OSRM.loc("DIRECTION_0");
|
||||
return description;
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
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 geometry
|
||||
// [renders routing geometry]
|
||||
|
||||
|
||||
OSRM.RoutingGeometry = {
|
||||
|
||||
// show route geometry - if there is a route
|
||||
show: function(response) {
|
||||
var geometry = OSRM.RoutingGeometry._decode(response.route_geometry, 5);
|
||||
|
||||
OSRM.G.route.showRoute(geometry, OSRM.Route.ROUTE);
|
||||
},
|
||||
|
||||
//show route geometry - if there is no route
|
||||
showNA: function() {
|
||||
var positions = [];
|
||||
for(var i=0, size=OSRM.G.markers.route.length; i<size; i++)
|
||||
positions.push( OSRM.G.markers.route[i].getPosition() );
|
||||
|
||||
OSRM.G.route.showRoute(positions, OSRM.Route.NOROUTE);
|
||||
},
|
||||
|
||||
//decode compressed route geometry
|
||||
_decode: function(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: lat * precision, lng: lng * precision} );
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
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
|
||||
// [renders route segments that are unnamed streets]
|
||||
|
||||
|
||||
OSRM.RoutingNoNames = {
|
||||
|
||||
// displays route segments that are unnamed streets
|
||||
show: function(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 = OSRM.RoutingGeometry._decode(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( geometry[i] );
|
||||
|
||||
// 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( geometry[i] );
|
||||
is_named = named[i];
|
||||
}
|
||||
|
||||
// display unnamed streets
|
||||
OSRM.G.route.showUnnamedRoute(all_positions);
|
||||
},
|
||||
|
||||
showNA: function() {
|
||||
OSRM.G.route.hideUnnamedRoute();
|
||||
}
|
||||
};
|
||||
@@ -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,103 @@
|
||||
/*
|
||||
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() {},
|
||||
empty: function() {},
|
||||
|
||||
|
||||
// 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
|
||||
}
|
||||
};
|
||||
|
||||
// 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
|
||||
}
|
||||
};
|
||||
|
||||
// clean DOM
|
||||
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.replace(/%jsonp/,"OSRM.JSONP.callbacks."+id);
|
||||
document.head.appendChild(script);
|
||||
|
||||
// start timeout timer
|
||||
OSRM.JSONP.timers[id] = setTimeout(OSRM.JSONP.timeouts[id], timeout);
|
||||
return true;
|
||||
},
|
||||
|
||||
clear: function(id) {
|
||||
clearTimeout(OSRM.JSONP.timers[id]); // clear timeout timer
|
||||
OSRM.JSONP.callbacks[id] = OSRM.JSONP.empty; // clean functions
|
||||
OSRM.JSONP.timeouts[id] = OSRM.JSONP.empty;
|
||||
OSRM.JSONP.fences[id] = undefined; // clean fence
|
||||
|
||||
// clean DOM
|
||||
var jsonp = document.getElementById('jsonp_'+id);
|
||||
if(jsonp)
|
||||
jsonp.parentNode.removeChild(jsonp);
|
||||
},
|
||||
|
||||
// reset all data
|
||||
reset: function() {
|
||||
OSRM.JSONP.fences = {};
|
||||
OSRM.JSONP.callbacks = {};
|
||||
OSRM.JSONP.timeouts = {};
|
||||
OSRM.JSONP.timers = {};
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
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 utility functions
|
||||
// [mixed functions]
|
||||
|
||||
|
||||
OSRM.Utils = {
|
||||
|
||||
// [human readabilty functions]
|
||||
|
||||
// human readable time
|
||||
secondsToTime: function(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
|
||||
metersToDistance: function(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'; }
|
||||
},
|
||||
|
||||
|
||||
// [verification routines]
|
||||
|
||||
// verify angles
|
||||
isLatitude: function(value) {
|
||||
if( value >=-90 && value <=90)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
},
|
||||
isLongitude: function(value) {
|
||||
if( value >=-180 && value <=180)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
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 old/cross browser support
|
||||
// [browser detection and routines for old/cross browser support]
|
||||
|
||||
|
||||
// browser detection (runs anonymous function to prevent local variables cluttering global namespace)
|
||||
(function() {
|
||||
var useragent = navigator.userAgent;
|
||||
|
||||
OSRM.Browser = {
|
||||
FF3: useragent.search(/Firefox\/3/),
|
||||
IE6_9: useragent.search(/MSIE (6|7|8|9)/)
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
// compatibility tools
|
||||
|
||||
//add document.head reference for older browsers
|
||||
document.head = document.head || document.getElementsByTagName('head')[0];
|
||||
|
||||
// supply getElementsByClassName method for older browser
|
||||
OSRM.Browser.getElementsByClassName = function( 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;
|
||||
};
|
||||
|
||||
// call a function when DOM has finished loading and remove event handler (optionally pass a different window object)
|
||||
OSRM.Browser.onLoadHandler = function( function_pointer, the_window ) {
|
||||
the_window = the_window || window; // default document
|
||||
var the_document = the_window.document;
|
||||
|
||||
if(the_window.addEventListener) { // FF, CH, IE9+
|
||||
var temp_function = function() {
|
||||
the_window.removeEventListener("DOMContentLoaded", arguments.callee, false);
|
||||
function_pointer.call();
|
||||
};
|
||||
the_window.addEventListener("DOMContentLoaded", temp_function, false);
|
||||
}
|
||||
|
||||
else if(the_document.attachEvent) { // IE8-
|
||||
var temp_function = function() {
|
||||
if ( the_document.readyState === "interactive" || the_document.readyState === "complete" ) {
|
||||
the_document.detachEvent("onreadystatechange", arguments.callee);
|
||||
function_pointer.call();
|
||||
}
|
||||
};
|
||||
the_document.attachEvent("onreadystatechange", temp_function);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
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
|
||||
// [support for inheritance]
|
||||
|
||||
// declare one class to be a subclass of another class
|
||||
// (runs anonymous function to prevent local functions cluttering global namespace)
|
||||
(function() {
|
||||
var _inheritFromHelper = function() {};
|
||||
OSRM.inheritFrom = function( sub_class, base_class ) {
|
||||
_inheritFromHelper.prototype = base_class.prototype;
|
||||
sub_class.prototype = new _inheritFromHelper();
|
||||
sub_class.prototype.constructor = sub_class;
|
||||
sub_class.prototype.base = base_class.prototype;
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
// 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 } );
|
||||