Merge branch 'master' of github.com:Project-OSRM/osrm-backend
This commit is contained in:
commit
3116734bec
8
.gitignore
vendored
8
.gitignore
vendored
@ -49,7 +49,7 @@ Thumbs.db
|
||||
/_build*
|
||||
/build/
|
||||
/example/build/
|
||||
/test/data/monaco*
|
||||
/test/data/monaco.osrm*
|
||||
/test/data/ch
|
||||
/test/data/corech
|
||||
/test/data/mld
|
||||
@ -72,12 +72,6 @@ Thumbs.db
|
||||
###########################
|
||||
.idea/
|
||||
|
||||
# stxxl related files #
|
||||
#######################
|
||||
.stxxl
|
||||
stxxl.log
|
||||
stxxl.errlog
|
||||
|
||||
# Compiled Binary Files #
|
||||
####################################
|
||||
/osrm-extract
|
||||
|
17
.travis.yml
17
.travis.yml
@ -121,6 +121,14 @@ matrix:
|
||||
packages: ['libstdc++-4.9-dev']
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON
|
||||
|
||||
- os: linux
|
||||
compiler: "gcc-9-release"
|
||||
addons: &gcc9
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-9', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
|
||||
env: CCOMPILER='gcc-9' CXXCOMPILER='g++-9' BUILD_TYPE='Release' CXXFLAGS='-Wno-cast-function-type'
|
||||
|
||||
- os: linux
|
||||
compiler: "gcc-8-release"
|
||||
addons: &gcc8
|
||||
@ -143,14 +151,6 @@ matrix:
|
||||
TARGET_ARCH='i686' CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release'
|
||||
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse'
|
||||
|
||||
- os: linux
|
||||
compiler: "gcc-7-stxxl"
|
||||
addons: &gcc7
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-7', 'libbz2-dev', 'libstxxl-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
|
||||
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release' ENABLE_STXXL=On
|
||||
|
||||
- os: linux
|
||||
compiler: "gcc-5-release"
|
||||
addons: &gcc49
|
||||
@ -475,7 +475,6 @@ install:
|
||||
-DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \
|
||||
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
||||
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
|
||||
-DENABLE_STXXL=${ENABLE_STXXL:-OFF} \
|
||||
-DBUILD_TOOLS=ON \
|
||||
-DENABLE_CCACHE=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
|
||||
|
11
CHANGELOG.md
11
CHANGELOG.md
@ -2,18 +2,27 @@
|
||||
- Changes from 5.21.0
|
||||
- Build:
|
||||
- ADDED: optionally build Node `lts` and `latest` bindings [#5347](https://github.com/Project-OSRM/osrm-backend/pull/5347)
|
||||
- FIXED: pessimistic calls to std::move [#5560](https://github.com/Project-OSRM/osrm-backend/pull/5561)
|
||||
- Features:
|
||||
- ADDED: new waypoints parameter to the `route` plugin, enabling silent waypoints [#5345](https://github.com/Project-OSRM/osrm-backend/pull/5345)
|
||||
- ADDED: data timestamp information in the response (saved in new file `.osrm.timestamp`). [#5115](https://github.com/Project-OSRM/osrm-backend/issues/5115)
|
||||
- ADDED: new API parameter - `snapping=any|default` to allow snapping to previously unsnappable edges [#5361](https://github.com/Project-OSRM/osrm-backend/pull/5361)
|
||||
- ADDED: keepalive support to the osrm-routed HTTP server [#5518](https://github.com/Project-OSRM/osrm-backend/pull/5518)
|
||||
- ADDED: flatbuffers output format support [#5513](https://github.com/Project-OSRM/osrm-backend/pull/5513)
|
||||
- ADDED: Global 'skip_waypoints' option [#5556](https://github.com/Project-OSRM/osrm-backend/pull/5556)
|
||||
- FIXED: Install the libosrm_guidance library correctly [#5604](https://github.com/Project-OSRM/osrm-backend/pull/5604)
|
||||
- FIXED: Http Handler can now deal witch optional whitespace between header-key and -value [#5606](https://github.com/Project-OSRM/osrm-backend/issues/5606)
|
||||
- Routing:
|
||||
- CHANGED: allow routing past `barrier=arch` [#5352](https://github.com/Project-OSRM/osrm-backend/pull/5352)
|
||||
- CHANGED: default car weight was reduced to 2000 kg. [#5371](https://github.com/Project-OSRM/osrm-backend/pull/5371)
|
||||
- CHANGED: default car height was reduced to 2 meters. [#5389](https://github.com/Project-OSRM/osrm-backend/pull/5389)
|
||||
- FIXED: treat `bicycle=use_sidepath` as no access on the tagged way. [#5622](https://github.com/Project-OSRM/osrm-backend/pull/5622)
|
||||
- Misc:
|
||||
- CHANGED: Reduce memory usage for raster source handling. [#5572](https://github.com/Project-OSRM/osrm-backend/pull/5572)
|
||||
- CHANGED: Add cmake option `ENABLE_DEBUG_LOGGING` to control whether output debug logging. [#3427](https://github.com/Project-OSRM/osrm-backend/issues/3427)
|
||||
- CHANGED: updated extent of Hong Kong as left hand drive country. [#5535](https://github.com/Project-OSRM/osrm-backend/issues/5535)
|
||||
|
||||
- Infrastructure
|
||||
- REMOVED: STXXL support removed as STXXL became abandonware. [#5760](https://github.com/Project-OSRM/osrm-backend/pull/5760)
|
||||
# 5.21.0
|
||||
- Changes from 5.20.0
|
||||
- Features:
|
||||
|
@ -23,9 +23,9 @@ option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
|
||||
option(BUILD_TOOLS "Build OSRM tools" OFF)
|
||||
option(BUILD_PACKAGE "Build OSRM package" OFF)
|
||||
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
|
||||
option(ENABLE_DEBUG_LOGGING "Use debug logging in release mode" OFF)
|
||||
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
|
||||
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
|
||||
option(ENABLE_STXXL "Use STXXL library" OFF)
|
||||
option(ENABLE_LTO "Use LTO if available" OFF)
|
||||
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
|
||||
option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON)
|
||||
@ -37,7 +37,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
if(ENABLE_MASON)
|
||||
# versions in use
|
||||
set(MASON_BOOST_VERSION "1.65.1")
|
||||
set(MASON_STXXL_VERSION "1.4.1-1")
|
||||
set(MASON_EXPAT_VERSION "2.2.0")
|
||||
set(MASON_LUA_VERSION "5.2.4")
|
||||
set(MASON_BZIP2_VERSION "1.0.6")
|
||||
@ -57,6 +56,12 @@ endif()
|
||||
if (POLICY CMP0048)
|
||||
cmake_policy(SET CMP0048 OLD)
|
||||
endif()
|
||||
if (POLICY CMP0057)
|
||||
cmake_policy(SET CMP0057 NEW)
|
||||
endif()
|
||||
if (POLICY CMP0074)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
project(OSRM C CXX)
|
||||
|
||||
include(JSONParser)
|
||||
@ -227,6 +232,7 @@ endif()
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
||||
message(STATUS "Configuring debug mode flags")
|
||||
set(ENABLE_ASSERTIONS ON)
|
||||
set(ENABLE_DEBUG_LOGGING ON)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
@ -472,13 +478,6 @@ if(ENABLE_MASON)
|
||||
mason_use(boost_libsystem VERSION ${MASON_BOOST_VERSION})
|
||||
set(Boost_SYSTEM_LIBRARY ${MASON_PACKAGE_boost_libsystem_STATIC_LIBS})
|
||||
|
||||
if (ENABLE_STXXL)
|
||||
mason_use(stxxl VERSION ${MASON_STXXL_VERSION})
|
||||
add_dependency_includes(${MASON_PACKAGE_stxxl_INCLUDE_DIRS})
|
||||
set(MAYBE_STXXL_LIBRARY ${MASON_PACKAGE_stxxl_STATIC_LIBS})
|
||||
add_definitions(-DUSE_STXXL_LIBRARY)
|
||||
endif()
|
||||
|
||||
mason_use(expat VERSION ${MASON_EXPAT_VERSION})
|
||||
add_dependency_includes(${MASON_PACKAGE_expat_INCLUDE_DIRS})
|
||||
set(EXPAT_LIBRARIES ${MASON_PACKAGE_expat_STATIC_LIBS})
|
||||
@ -524,30 +523,16 @@ else()
|
||||
|
||||
find_package(Boost 1.54 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
add_dependency_includes(${Boost_INCLUDE_DIRS})
|
||||
if(WIN32 AND Boost_VERSION VERSION_LESS 106200)
|
||||
message(FATAL_ERROR "Building with MSVC needs Boost 1.62 with CXX11_CONSTEXPR support")
|
||||
endif()
|
||||
|
||||
find_package(TBB REQUIRED)
|
||||
add_dependency_includes(${TBB_INCLUDE_DIR})
|
||||
if(WIN32 AND CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(TBB_LIBRARIES ${TBB_DEBUG_LIBRARIES})
|
||||
if(WIN32)
|
||||
set(TBB_LIBRARIES optimized ${TBB_LIBRARY} optimized ${TBB_MALLOC_LIBRARY} debug ${TBB_LIBRARY_DEBUG} debug ${TBB_MALLOC_LIBRARY_DEBUG})
|
||||
endif()
|
||||
|
||||
find_package(EXPAT REQUIRED)
|
||||
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
|
||||
|
||||
if (ENABLE_STXXL)
|
||||
find_package(STXXL)
|
||||
if (STXXL_FOUND)
|
||||
add_dependency_includes(${STXXL_INCLUDE_DIR})
|
||||
set(MAYBE_STXXL_LIBRARY ${STXXL_LIBRARY})
|
||||
add_definitions(-DUSE_STXXL_LIBRARY)
|
||||
else()
|
||||
MESSAGE(STATUS "STXXL was requested but not found, default STL will be used")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(BZip2 REQUIRED)
|
||||
add_dependency_includes(${BZIP2_INCLUDE_DIR})
|
||||
|
||||
@ -607,15 +592,6 @@ add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3)
|
||||
add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE)
|
||||
add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED)
|
||||
|
||||
if (ENABLE_STXXL)
|
||||
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()
|
||||
endif()
|
||||
|
||||
add_definitions(${OSRM_DEFINES})
|
||||
include_directories(SYSTEM ${DEPENDENCIES_INCLUDE_DIRS})
|
||||
|
||||
@ -648,7 +624,6 @@ set(EXTRACTOR_LIBRARIES
|
||||
${EXPAT_LIBRARIES}
|
||||
${USED_LUA_LIBRARIES}
|
||||
${OSMIUM_LIBRARIES}
|
||||
${MAYBE_STXXL_LIBRARY}
|
||||
${TBB_LIBRARIES}
|
||||
${ZLIB_LIBRARY}
|
||||
${MAYBE_COVERAGE_LIBRARIES})
|
||||
@ -682,7 +657,6 @@ set(CONTRACTOR_LIBRARIES
|
||||
${BOOST_BASE_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${USED_LUA_LIBRARIES}
|
||||
${MAYBE_STXXL_LIBRARY}
|
||||
${TBB_LIBRARIES}
|
||||
${MAYBE_RT_LIBRARY}
|
||||
${MAYBE_COVERAGE_LIBRARIES})
|
||||
@ -702,7 +676,6 @@ set(STORAGE_LIBRARIES
|
||||
set(UTIL_LIBRARIES
|
||||
${BOOST_BASE_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${MAYBE_STXXL_LIBRARY}
|
||||
${TBB_LIBRARIES}
|
||||
${MAYBE_COVERAGE_LIBRARIES}
|
||||
${ZLIB_LIBRARY})
|
||||
@ -734,6 +707,11 @@ if (ENABLE_ASSERTIONS)
|
||||
add_definitions(-DBOOST_ENABLE_ASSERT_HANDLER)
|
||||
endif()
|
||||
|
||||
if (ENABLE_DEBUG_LOGGING)
|
||||
message(STATUS "Enabling debug logging")
|
||||
add_definitions(-DENABLE_DEBUG_LOGGING)
|
||||
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
|
||||
@ -778,6 +756,7 @@ install(TARGETS osrm_customize DESTINATION lib)
|
||||
install(TARGETS osrm_update DESTINATION lib)
|
||||
install(TARGETS osrm_contract DESTINATION lib)
|
||||
install(TARGETS osrm_store DESTINATION lib)
|
||||
install(TARGETS osrm_guidance DESTINATION lib)
|
||||
|
||||
|
||||
# Install profiles and support library to /usr/local/share/osrm/profiles by default
|
||||
|
@ -10,7 +10,7 @@ ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS%
|
||||
|
||||
|
||||
:: Check CMake version
|
||||
SET CMAKE_VERSION=3.9.2
|
||||
SET CMAKE_VERSION=3.16.3
|
||||
SET PATH=%PROJECT_DIR%\cmake-%CMAKE_VERSION%-win32-x86\bin;%PATH%
|
||||
ECHO cmake^: && cmake --version
|
||||
IF %ERRORLEVEL% NEQ 0 ECHO CMAKE not found && GOTO CMAKE_NOT_OK
|
||||
@ -19,7 +19,7 @@ cmake --version | findstr /C:%CMAKE_VERSION% && GOTO CMAKE_OK
|
||||
|
||||
:CMAKE_NOT_OK
|
||||
ECHO CMAKE NOT OK - downloading new CMake %CMAKE_VERSION%
|
||||
powershell Invoke-WebRequest https://cmake.org/files/v3.9/cmake-%CMAKE_VERSION%-win32-x86.zip -OutFile $env:PROJECT_DIR\cm.zip
|
||||
powershell Invoke-WebRequest https://cmake.org/files/v3.16/cmake-%CMAKE_VERSION%-win32-x86.zip -OutFile $env:PROJECT_DIR\cm.zip
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF NOT EXIST cmake-%CMAKE_VERSION%-win32-x86 7z -y x cm.zip | %windir%\system32\FIND "ing archive"
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
@ -29,8 +29,8 @@ ECHO CMAKE_OK
|
||||
cmake --version
|
||||
|
||||
ECHO activating VS command prompt ...
|
||||
SET PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
SET PATH=C:\Program Files (x86)\MSBuild\15.0\Bin;%PATH%
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||
|
||||
ECHO platform^: %platform%
|
||||
|
||||
@ -40,7 +40,7 @@ ECHO msbuild version
|
||||
msbuild /version
|
||||
|
||||
:: HARDCODE "x64" as it is uppercase on AppVeyor and download from S3 is case sensitive
|
||||
SET DEPSPKG=osrm-deps-win-x64-14.0-2017.09.7z
|
||||
SET DEPSPKG=osrm-deps-win-x64-14.2-2019.01.7z
|
||||
|
||||
:: local development
|
||||
ECHO.
|
||||
@ -52,7 +52,7 @@ IF EXIST %DEPSPKG% DEL %DEPSPKG%
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
ECHO downloading %DEPSPKG%
|
||||
powershell Invoke-WebRequest https://mapbox.s3.amazonaws.com/windows-builds/windows-build-deps/$env:DEPSPKG -OutFile $env:PROJECT_DIR\$env:DEPSPKG
|
||||
powershell Invoke-WebRequest http://project-osrm.wolt.com/windows-build-deps/$env:DEPSPKG -OutFile $env:PROJECT_DIR\$env:DEPSPKG
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
:SKIPDL
|
||||
@ -74,27 +74,35 @@ IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
SET OSRMDEPSDIR=%PROJECT_DIR%/osrm-deps
|
||||
set PREFIX=%OSRMDEPSDIR%/libs
|
||||
set BOOST_ROOT=%OSRMDEPSDIR%/boost
|
||||
set BOOST_ROOT=%OSRMDEPSDIR%
|
||||
set BOOST_LIBRARYDIR=%BOOST_ROOT%/lib
|
||||
set TBB_INSTALL_DIR=%OSRMDEPSDIR%/tbb
|
||||
set TBB_ARCH_PLATFORM=intel64/vc14
|
||||
set TBB_INSTALL_DIR=%OSRMDEPSDIR%
|
||||
REM set TBB_ARCH_PLATFORM=intel64/vc17
|
||||
|
||||
ECHO OSRMDEPSDIR ^: %OSRMDEPSDIR%
|
||||
ECHO PREFIX ^: %PREFIX%
|
||||
ECHO BOOST_ROOT ^: %BOOST_ROOT%
|
||||
ECHO BOOST_LIBRARYDIR ^: %BOOST_LIBRARYDIR%
|
||||
ECHO TBB_INSTALL_DIR ^: %TBB_INSTALL_DIR%
|
||||
ECHO TBB_ARCH_PLATFORM ^: %TBB_ARCH_PLATFORM%
|
||||
REM ECHO TBB_ARCH_PLATFORM ^: %TBB_ARCH_PLATFORM%
|
||||
|
||||
|
||||
ECHO calling cmake ....
|
||||
cmake .. ^
|
||||
-G "Visual Studio 14 2015 Win64" ^
|
||||
-G "Visual Studio 16 2019" ^
|
||||
-DBOOST_ROOT=%BOOST_ROOT% ^
|
||||
-DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% ^
|
||||
-DBoost_ADDITIONAL_VERSIONS=1.58 ^
|
||||
-DBoost_ADDITIONAL_VERSIONS=1.73.0 ^
|
||||
-DBoost_USE_MULTITHREADED=ON ^
|
||||
-DBoost_USE_STATIC_LIBS=ON ^
|
||||
-DEXPAT_INCLUDE_DIR=%OSRMDEPSDIR% ^
|
||||
-DEXPAT_LIBRARY=%OSRMDEPSDIR%/lib/libexpat.lib ^
|
||||
-DBZIP2_INCLUDE_DIR=%OSRMDEPSDIR% ^
|
||||
-DBZIP2_LIBRARIES=%OSRMDEPSDIR%/lib/libbz2.lib ^
|
||||
-DLUA_INCLUDE_DIR=%OSRMDEPSDIR% ^
|
||||
-DLUA_LIBRARIES=%OSRMDEPSDIR%/lib/lua5.3.5.lib ^
|
||||
-DZLIB_INCLUDE_DIR=%OSRMDEPSDIR% ^
|
||||
-DZLIB_LIBRARY=%OSRMDEPSDIR%/lib/libz.lib ^
|
||||
-DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
|
||||
-DCMAKE_INSTALL_PREFIX=%PREFIX%
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
@ -106,60 +114,63 @@ msbuild OSRM.sln ^
|
||||
/t:rebuild ^
|
||||
/p:BuildInParallel=true ^
|
||||
/m:%NUMBER_OF_PROCESSORS% ^
|
||||
/toolsversion:14.0 ^
|
||||
/p:PlatformToolset=v140 ^
|
||||
/toolsversion:Current ^
|
||||
/p:PlatformToolset=v142 ^
|
||||
/clp:Verbosity=normal ^
|
||||
/nologo ^
|
||||
/flp1:logfile=build_errors.txt;errorsonly ^
|
||||
/flp2:logfile=build_warnings.txt;warningsonly
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
||||
|
||||
CD %PROJECT_DIR%\build
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
||||
|
||||
SET PATH=%PROJECT_DIR%\osrm-deps\libs\bin;%PATH%
|
||||
SET PATH=%PROJECT_DIR%\osrm-deps\lib;%PATH%
|
||||
|
||||
ECHO running extractor-tests.exe ...
|
||||
unit_tests\%Configuration%\extractor-tests.exe
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
||||
|
||||
ECHO running engine-tests.exe ...
|
||||
unit_tests\%Configuration%\engine-tests.exe
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
||||
|
||||
ECHO running util-tests.exe ...
|
||||
unit_tests\%Configuration%\util-tests.exe
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
||||
|
||||
ECHO running server-tests.exe ...
|
||||
unit_tests\%Configuration%\server-tests.exe
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
||||
|
||||
ECHO running library-tests.exe ...
|
||||
SET test_region=monaco
|
||||
SET test_region_ch=ch\monaco
|
||||
SET test_region_corech=corech\monaco
|
||||
SET test_region_mld=mld\monaco
|
||||
SET test_osm=%test_region%.osm.pbf
|
||||
IF NOT EXIST %test_osm% powershell Invoke-WebRequest https://s3.amazonaws.com/mapbox/osrm/testing/monaco.osm.pbf -OutFile %test_osm%
|
||||
%Configuration%\osrm-extract.exe -p ../profiles/car.lua %test_osm%
|
||||
MKDIR ch
|
||||
XCOPY %test_region%.osrm.* ch\
|
||||
XCOPY %test_region%.osrm ch\
|
||||
MKDIR corech
|
||||
XCOPY %test_region%.osrm.* corech\
|
||||
XCOPY %test_region%.osrm corech\
|
||||
MKDIR mld
|
||||
XCOPY %test_region%.osrm.* mld\
|
||||
XCOPY %test_region%.osrm mld\
|
||||
%Configuration%\osrm-contract.exe %test_region_ch%.osrm
|
||||
%Configuration%\osrm-contract.exe --core 0.8 %test_region_corech%.osrm
|
||||
%Configuration%\osrm-partition.exe %test_region_mld%.osrm
|
||||
%Configuration%\osrm-customize.exe %test_region_mld%.osrm
|
||||
XCOPY /Y ch\*.* ..\test\data\ch\
|
||||
XCOPY /Y corech\*.* ..\test\data\corech\
|
||||
XCOPY /Y mld\*.* ..\test\data\mld\
|
||||
unit_tests\%Configuration%\library-tests.exe
|
||||
::TODO: CH processing sometimes mysteriously hangs, need to find why and enable tests below.
|
||||
::ECHO running library-tests.exe ...
|
||||
::SET test_region=monaco
|
||||
::SET test_region_ch=ch\monaco
|
||||
::SET test_region_corech=corech\monaco
|
||||
::SET test_region_mld=mld\monaco
|
||||
::SET test_osm=%test_region%.osm.pbf
|
||||
::IF NOT EXIST %test_osm% powershell Invoke-WebRequest http://project-osrm.wolt.com/testing/monaco.osm.pbf -OutFile %test_osm%
|
||||
::ECHO running %Configuration%\osrm-extract.exe -p ../profiles/car.lua %test_osm%
|
||||
::%Configuration%\osrm-extract.exe
|
||||
::%Configuration%\osrm-extract.exe -p ../profiles/car.lua %test_osm%
|
||||
::MKDIR ch
|
||||
::XCOPY %test_region%.osrm.* ch\
|
||||
::XCOPY %test_region%.osrm ch\
|
||||
::MKDIR corech
|
||||
::XCOPY %test_region%.osrm.* corech\
|
||||
::XCOPY %test_region%.osrm corech\
|
||||
::MKDIR mld
|
||||
::XCOPY %test_region%.osrm.* mld\
|
||||
::XCOPY %test_region%.osrm mld\
|
||||
::%Configuration%\osrm-contract.exe %test_region_ch%.osrm
|
||||
::%Configuration%\osrm-contract.exe --core 0.8 %test_region_corech%.osrm
|
||||
::%Configuration%\osrm-partition.exe %test_region_mld%.osrm
|
||||
::%Configuration%\osrm-customize.exe %test_region_mld%.osrm
|
||||
::XCOPY /Y ch\*.* ..\test\data\ch\
|
||||
::XCOPY /Y corech\*.* ..\test\data\corech\
|
||||
::XCOPY /Y mld\*.* ..\test\data\mld\
|
||||
::unit_tests\%Configuration%\library-tests.exe
|
||||
|
||||
:ERROR
|
||||
ECHO ~~~~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -10,7 +10,7 @@ install:
|
||||
init:
|
||||
- git config --global core.autocrlf input
|
||||
|
||||
os: Visual Studio 2015
|
||||
os: Visual Studio 2019
|
||||
|
||||
# clone directory
|
||||
clone_folder: c:\projects\osrm
|
||||
@ -25,9 +25,10 @@ before_test:
|
||||
- npm --version
|
||||
- npm install --ignore-scripts
|
||||
- npm link --ignore-scripts
|
||||
- SET PATH=%CD%\osrm-deps\libs\bin;%PATH%
|
||||
- SET PATH=%CD%\osrm-deps\lib;%PATH%
|
||||
- SET OSRM_BUILD_DIR=build\%Configuration%
|
||||
- npm test
|
||||
# TODO tests fail with "JavaScript heap out of memory", need a better host?
|
||||
# - npm test
|
||||
|
||||
branches:
|
||||
only:
|
||||
|
@ -11,7 +11,6 @@ SET CONFIGURATION=Release
|
||||
FOR /F "tokens=*" %%i in ('git rev-parse --abbrev-ref HEAD') do SET APPVEYOR_REPO_BRANCH=%%i
|
||||
ECHO APPVEYOR_REPO_BRANCH^: %APPVEYOR_REPO_BRANCH%
|
||||
|
||||
SET PATH=C:\mb\windows-builds-64\tmp-bin\cmake-3.7.0-rc2-win32-x86\bin;%PATH%
|
||||
SET PATH=C:\Program Files\7-Zip;%PATH%
|
||||
|
||||
powershell Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force
|
||||
|
@ -1,51 +0,0 @@
|
||||
# Locate STXXL library
|
||||
# This module defines
|
||||
# STXXL_FOUND, if false, do not try to link to libstxxl
|
||||
# STXXL_LIBRARY
|
||||
# STXXL_INCLUDE_DIR, where to find stxxl.h
|
||||
#
|
||||
|
||||
|
||||
IF( NOT STXXL_FIND_QUIETLY )
|
||||
MESSAGE(STATUS "Looking for STXXL...")
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(STXXL_INCLUDE_DIR stxxl.h
|
||||
HINTS
|
||||
$ENV{STXXL_DIR}
|
||||
PATH_SUFFIXES stxxl include/stxxl/stxxl include/stxxl include
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/opt/local # DarwinPorts
|
||||
/opt
|
||||
)
|
||||
|
||||
FIND_LIBRARY(STXXL_LIBRARY
|
||||
NAMES stxxl stxxl_debug
|
||||
HINTS
|
||||
$ENV{STXXL_DIR}
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/opt/local
|
||||
/opt
|
||||
)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set STXXL_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(STXXL DEFAULT_MSG STXXL_LIBRARY STXXL_INCLUDE_DIR)
|
||||
|
||||
IF( NOT STXXL_FIND_QUIETLY )
|
||||
IF( STXXL_FOUND )
|
||||
MESSAGE(STATUS "Found STXXL: ${STXXL_LIBRARY}" )
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(STXXL_INCLUDE_DIR STXXL_LIBRARY)
|
13
docs/http.md
13
docs/http.md
@ -30,7 +30,7 @@ To pass parameters to each location some options support an array like encoding:
|
||||
**Request options**
|
||||
|
||||
| Option | Values | Description |
|
||||
|----------------|--------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
|
||||
|----------------|--------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
|bearings |`{bearing};{bearing}[;{bearing} ...]` |Limits the search to segments with given bearing in degrees towards true north in clockwise direction. |
|
||||
|radiuses |`{radius};{radius}[;{radius} ...]` |Limits the search to given radius in meters. |
|
||||
|generate\_hints |`true` (default), `false` |Adds a Hint to the response which can be used in subsequent requests, see `hints` parameter. |
|
||||
@ -38,6 +38,7 @@ To pass parameters to each location some options support an array like encoding:
|
||||
|approaches |`{approach};{approach}[;{approach} ...]` |Keep waypoints on curb side. |
|
||||
|exclude |`{class}[,{class}]` |Additive list of classes to avoid, order does not matter. |
|
||||
|snapping |`default` (default), `any` |Default snapping avoids is_startpoint (see profile) edges, `any` will snap to any edge in the graph |
|
||||
|skip_waypoints |`true`, `false` (default) |Removes waypoints from the response. Waypoints are still calculated, but not serialized. Could be useful in case you are interested in some other part of response and do not want to transfer waste data. |
|
||||
|
||||
Where the elements follow the following format:
|
||||
|
||||
@ -128,6 +129,9 @@ In addition to the [general options](#general-options) the following options are
|
||||
|------------|------------------------------|----------------------------------------------------|
|
||||
|number |`integer >= 1` (default `1`) |Number of nearest segments that should be returned. |
|
||||
|
||||
As `waypoints` is a single thing, returned byt that service, using it with option `skip_waypoints` set to `true` is quite useless, but still
|
||||
possible. In that case only `code` field will be returned.
|
||||
|
||||
**Response**
|
||||
|
||||
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
|
||||
@ -257,6 +261,8 @@ In addition to the [general options](#general-options) the following options are
|
||||
Unlike other array encoded options, the length of `sources` and `destinations` can be **smaller or equal**
|
||||
to number of input locations;
|
||||
|
||||
With `skip_waypoints` set to `true`, both `sources` and `destinations` arrays will be skipped.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
@ -967,7 +973,7 @@ Root object is the only object, available from a 'raw' `flatbuffers` buffer. It
|
||||
|
||||
- `error`: `bool` Marks response as erroneous. Erroneus response should include `code` field set, all the other field may not present.
|
||||
- `code`: `Error` Error description object, only present, when `error` is `true`
|
||||
- `waypoints`: `[Waypoint]` Array of `Waypoint` objects. Should present for every service call. Table service will put `sources` array here.
|
||||
- `waypoints`: `[Waypoint]` Array of `Waypoint` objects. Should present for every service call, unless `skip_waypoints` is set to `true`. Table service will put `sources` array here.
|
||||
- `routes`: `[RouteObject]` Array of `RouteObject` objects. May be empty or absent. Should present for Route/Trip/Match services call.
|
||||
- `table`: `Table` Table object, may absent. Should be present in case of Table service call.
|
||||
|
||||
@ -1112,6 +1118,7 @@ Almost same as `json` Table object. The main difference is that 'sources' field
|
||||
used instead. All the other differences follow:
|
||||
|
||||
- `durations`: `[float]` Flat representation of a durations matrix. Element at row;col can be adressed as [row * cols + col]
|
||||
- `destinations`: `[float]` Flat representation of a destinations matrix. Element at row;col can be adressed as [row * cols + col]
|
||||
- `distances`: `[float]` Flat representation of a destinations matrix. Element at row;col can be adressed as [row * cols + col]
|
||||
- `destinations`: `[Waypoint]` Array of `Waypoint` objects. Will be `null` if `skip_waypoints` will be set to `true`
|
||||
- `rows`: `ushort` Number of rows in durations/destinations matrices.
|
||||
- `cols`: `ushort` Number of cols in durations/destinations matrices.
|
||||
|
@ -50,6 +50,7 @@ Returns the fastest route between two or more coordinates while visiting the way
|
||||
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
|
||||
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`.
|
||||
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
|
||||
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
|
||||
- `options.alternatives` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Search for alternative routes. (optional, default `false`)
|
||||
- `options.alternatives` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Search for up to this many alternative routes.
|
||||
_Please note that even if alternative routes are requested, a result cannot be guaranteed._ (optional, default `0`)
|
||||
@ -91,6 +92,7 @@ Note: `coordinates` in the general options only supports a single `{longitude},{
|
||||
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
|
||||
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`.
|
||||
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
|
||||
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
|
||||
- `options.number` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of nearest segments that should be returned.
|
||||
Must be an integer greater than or equal to `1`. (optional, default `1`)
|
||||
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||
@ -128,6 +130,7 @@ tables. Optionally returns distance table.
|
||||
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
|
||||
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`.
|
||||
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
|
||||
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
|
||||
- `options.sources` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to
|
||||
use
|
||||
location with given index as source. Default is to use all.
|
||||
@ -208,6 +211,7 @@ if they can not be matched successfully.
|
||||
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
|
||||
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
|
||||
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
|
||||
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
|
||||
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`)
|
||||
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
|
||||
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
|
||||
@ -274,6 +278,7 @@ Right now, the following combinations are possible:
|
||||
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
|
||||
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `double >= 0` or `null` (unlimited, default).
|
||||
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
|
||||
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
|
||||
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`)
|
||||
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
|
||||
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
|
||||
|
@ -89,7 +89,7 @@ They all return a table of functions when you use `require` to load them. You ca
|
||||
### setup()
|
||||
The `setup` function is called once when the profile is loaded and must return a table of configurations. It's also where you can do other global setup, like loading data sources that are used during processing.
|
||||
|
||||
Note that processing of data is parallelized and several unconnected LUA interpreters will be running at the same time. The `setup` function will be called once for each. Each LUA iinterpreter will have its own set of globals.
|
||||
Note that processing of data is parallelized and several unconnected LUA interpreters will be running at the same time. The `setup` function will be called once for each. Each LUA interpreter will have its own set of globals.
|
||||
|
||||
The following global properties can be set under `properties` in the hash you return in the `setup` function:
|
||||
|
||||
@ -98,7 +98,7 @@ Attribute | Type | Notes
|
||||
weight_name | String | Name used in output for the routing weight property (default `'duration'`)
|
||||
weight_precision | Unsigned | Decimal precision of edge weights (default `1`)
|
||||
left_hand_driving | Boolean | Are vehicles assumed to drive on the left? (used in guidance, default `false`)
|
||||
use_turn_restrictions | Boolean | Are turn instructions followed? (default `false`)
|
||||
use_turn_restrictions | Boolean | Are turn restrictions followed? (default `false`)
|
||||
continue_straight_at_waypoint | Boolean | Must the route continue straight on at a via point, or are U-turns allowed? (default `true`)
|
||||
max_speed_for_map_matching | Float | Maximum vehicle speed to be assumed in matching (in m/s)
|
||||
max_turn_weight | Float | Maximum turn penalty weight
|
||||
@ -178,7 +178,7 @@ exits | String | The ramp's exit numbers or
|
||||
pronunciation | String | Name pronunciation
|
||||
road_classification.motorway_class | Boolean | Guidance: way is a motorway
|
||||
road_classification.link_class | Boolean | Guidance: way is a slip/link road
|
||||
road_classification.road_priority_class | Enum | Guidance: order in priority list. Defined in `include/extractor/guidance/road_classification.hpp`
|
||||
road_classification.road_priority_class | Enum | Guidance: order in priority list. Defined in `include/extractor/road_classification.hpp`
|
||||
road_classification.may_be_ignored | Boolean | Guidance: way is non-highway
|
||||
road_classification.num_lanes | Unsigned | Guidance: total number of lanes in way
|
||||
|
||||
@ -223,7 +223,7 @@ source_number_of_lanes | Read | Integer |
|
||||
source_highway_turn_classification | Read | Integer | Classification based on highway tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
|
||||
source_access_turn_classification | Read | Integer | Classification based on access tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
|
||||
source_speed | Read | Integer | Speed on this source road in km/h
|
||||
source_priority_class | Read | Enum | The type of road priority class of the source. Defined in `include/extractor/guidance/road_classification.hpp`
|
||||
source_priority_class | Read | Enum | The type of road priority class of the source. Defined in `include/extractor/road_classification.hpp`
|
||||
target_restricted | Read | Boolean | Is the target a restricted access road? (See definition in `process_way`)
|
||||
target_mode | Read | Enum | Travel mode after the turn. Defined in `include/extractor/travel_mode.hpp`
|
||||
target_is_motorway | Read | Boolean | Is the target road a motorway?
|
||||
@ -232,7 +232,7 @@ target_number_of_lanes | Read | Integer |
|
||||
target_highway_turn_classification | Read | Integer | Classification based on highway tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
|
||||
target_access_turn_classification | Read | Integer | Classification based on access tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
|
||||
target_speed | Read | Integer | Speed on this target road in km/h
|
||||
target_priority_class | Read | Enum | The type of road priority class of the target. Defined in `include/extractor/guidance/road_classification.hpp`
|
||||
target_priority_class | Read | Enum | The type of road priority class of the target. Defined in `include/extractor/road_classification.hpp`
|
||||
roads_on_the_right | Read | Vector<ExtractionTurnLeg> | Vector with information about other roads on the right of the turn that are also connected at the intersection
|
||||
roads_on_the_left | Read | Vector<ExtractionTurnLeg> | Vector with information about other roads on the left of the turn that are also connected at the intersection. If turn is a u turn, this is empty.
|
||||
weight | Read/write | Float | Penalty to be applied for this turn (routing weight)
|
||||
@ -252,7 +252,7 @@ number_of_lanes | Read | Integer | How many lanes does th
|
||||
highway_turn_classification | Read | Integer | Classification based on highway tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15)
|
||||
access_turn_classification | Read | Integer | Classification based on access tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15)
|
||||
speed | Read | Integer | Speed on this road in km/h
|
||||
priority_class | Read | Enum | The type of road priority class of the leg. Defined in `include/extractor/guidance/road_classification.hpp`
|
||||
priority_class | Read | Enum | The type of road priority class of the leg. Defined in `include/extractor/road_classification.hpp`
|
||||
is_incoming | Read | Boolean | Is the road an incoming road of the intersection
|
||||
is_outgoing | Read | Boolean | Is the road an outgoing road of the intersection
|
||||
|
||||
|
97
docs/windows-deps.md
Normal file
97
docs/windows-deps.md
Normal file
@ -0,0 +1,97 @@
|
||||
# Building OSRM for Windows
|
||||
|
||||
## Dependencies
|
||||
|
||||
Get a decent Windows with decent Visual Studio (14 at least for C++11 support). The published binaries are build with
|
||||
VS2019 and Windows SDK8.1.
|
||||
|
||||
In case you are using [prepacked Windows VM with VS2019](https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/), you
|
||||
have to install [Windows SDK 8.1](https://go.microsoft.com/fwlink/p/?LinkId=323507)
|
||||
|
||||
Prepare directories for dependencies, build and target file location.Target directory ($target starting from that moment) should have /include and /lib subdirectories.
|
||||
|
||||
### Bzip2
|
||||
|
||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
||||
* https://project-osrm.wolt.com/deps/bzip2-1.0.8.tar.gz
|
||||
* https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
|
||||
|
||||
2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||
3. Issue `nmake /f makefile.msc`
|
||||
4. Copy bzlib.h to $target\include and libbz2.lib to $target\lib
|
||||
|
||||
### ZLib
|
||||
|
||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
||||
* https://project-osrm.wolt.com/deps/zlib-1.2.11.tar.gz
|
||||
* https://www.zlib.net/zlib-1.2.11.tar.gz
|
||||
|
||||
2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||
3. Switch to `contrib\vstudio\vc14`
|
||||
4. If needed, open `zlibvc.sln` with Visual Studio and retarget to your version of compiler and SDK.
|
||||
5. Issue `msbuild zlibvc.sln /p:BuildInParallel=true /p:Configuration=Release /p:Platform=x64 /m:<Number of cpu cores>`
|
||||
6. Copy x64\ZlibStatRelease\zlibstat.lib to $target\lib\libz.lib, copy zlib.h and zconf.h to $target\include
|
||||
|
||||
### ICU
|
||||
|
||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
||||
* https://wolt-project.wolt.com/deps/icu4c-66_1-src.zip
|
||||
* https://github.com/unicode-org/icu/releases/download/release-66-1/icu4c-66_1-src.zip
|
||||
* https://wolt-project.wolt.com/deps/icu4c-66_1-data.zip
|
||||
* https://github.com/unicode-org/icu/releases/download/release-66-1/icu4c-66_1-data.zip
|
||||
2. Do retarget if neededby openinig .\source\allinone\allinone.sln and editing projects
|
||||
3. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||
4. Run build:
|
||||
msbuild .\source\allinone\allinone.sln /nologo /p:BuildInParallel=true /p:Configuration=Release /p:Platform=x64 /m:<Number of cpu cores>
|
||||
5. Copy lib64\*.lib to $target\lib, copy include contents to $target\include
|
||||
6. Copy bin64\*dll to any dir withing your $PATH. At the same time copy them to $target\lib
|
||||
|
||||
### Boost
|
||||
|
||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
||||
* https://project-osrm.wolt.com/deps/boost_1_73_0.zip
|
||||
* https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.zip
|
||||
|
||||
2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||
3. Build b2:
|
||||
bootstrap.bat --with-toolset=msvc-14.2
|
||||
4. Build boost:
|
||||
b2 -a -d release state --build-type=minimal toolset=msvc-14.2 -q runtime-link=shared link=static address-model=64 --with-iostreams --with-test --with-thread --with-filesystem --with-date_time --with-system --with-program_options --with-regex --disable-filesystem2 -sHAVE_ICU=1 include=<target>\include library-path=<target>\lib -sZLIB_SOURCE=<builddir>/zlib -zBZIP2_BINARY=libbz2 -sBZIP2_INCLUDE=<target>\include -sBZIP2_LIBPATH=<target>\lib -sICU_ICUUC_NAME=icuuc -sICU_ICUDT_NAME=icudt -sICU_ICUIN_NAME=icuin -sBUILD=boost_unit_test_framework -j<number of cpu cores>
|
||||
5. Copy `boost` subdirectory to <target>\include and contents of `stage` to <target>\lib
|
||||
|
||||
### Expat
|
||||
|
||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
||||
* https://project-osrm.wolt.com/deps/libexpat-2_2_9.zip
|
||||
* https://github.com/libexpat/libexpat/archive/R_2_2_9.zip
|
||||
2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||
3. Configure build my calling cmake:
|
||||
mkdir expat\build
|
||||
cd expat\build
|
||||
cmake -G"Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Release -DEXPAT_MSVC_STATIC_CRT=ON -DEXPAT_BUILD_EXAMPLES=OFF -DEXPAT_BUILD_TESTS=OFF -DEXPAT_SHARED_LIBS=OFF ..
|
||||
4. Build expat: `msbuild expat.sln /nologo /p:Configuration=Release /p:Platform=x64`
|
||||
5. Copy `Release\libexpat.*` to <target>/lib. Copy `expat/lib/expat.h` and `expat/lib/expat_external.h` to <target>/include
|
||||
|
||||
### LUA
|
||||
|
||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
||||
* https://project-osrm.wolt.com/deps/lua-5.3.5.tar.gz
|
||||
* https://www.lua.org/ftp/lua-5.3.5.tar.gz
|
||||
2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||
3. Lua doesn't have native MSVC support, so you have to compile it by hand:
|
||||
cd src
|
||||
cl /MD /O2 /c /DLUA_COMPAT_5_2 *.c
|
||||
ren lua.obj lua.o
|
||||
ren luac.obj luac.o
|
||||
link /LIB /OUT:lua5.3.5.dll *.obj
|
||||
4. Copy `lua5.3.5.lib` to <target>/lib. Copy `lua.h`,`lauxlib,h`,`lua.hpp`,`lualib.h`,`luaconf.h` to <target>/include
|
||||
|
||||
### TBB
|
||||
|
||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
||||
* https://project-osrm.wolt.com/deps/oneTBB-v2020.2.zip
|
||||
* https://github.com/oneapi-src/oneTBB/archive/v2020.2.zip
|
||||
2. Retarget by opening build\vs2013\makefile.sln
|
||||
3. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||
4. Switch to build\vs2013 and build: `msbuild makefle.sln /nologo /p:Configuration=Release /p:Platform=x64`
|
||||
5. Copy x64/Release/*.{dll,lib} files to <target>/lib and copy contents of include directory to <target>/include
|
@ -127,6 +127,7 @@ Feature: Bike - Access tags on ways
|
||||
| | | agricultural | |
|
||||
| | | forestry | |
|
||||
| | | delivery | |
|
||||
| | | use_sidepath | |
|
||||
|
||||
Scenario: Bike - Access tags on both node and way
|
||||
Then routability should be
|
||||
|
@ -1,27 +1,38 @@
|
||||
var util = require('util');
|
||||
|
||||
var flatbuffers = require('../support/flatbuffers').flatbuffers;
|
||||
var FBResult = require('../support/fbresult_generated').osrm.engine.api.fbresult.FBResult;
|
||||
|
||||
module.exports = function () {
|
||||
const durationsRegex = new RegExp(/^I request a travel time matrix I should get$/);
|
||||
const distancesRegex = new RegExp(/^I request a travel distance matrix I should get$/);
|
||||
const estimatesRegex = new RegExp(/^I request a travel time matrix I should get estimates for$/);
|
||||
const durationsRegexFb = new RegExp(/^I request a travel time matrix with flatbuffers I should get$/);
|
||||
const distancesRegexFb = new RegExp(/^I request a travel distance matrix with flatbuffers I should get$/);
|
||||
|
||||
const DURATIONS_NO_ROUTE = 2147483647; // MAX_INT
|
||||
const DISTANCES_NO_ROUTE = 3.40282e+38; // MAX_FLOAT
|
||||
|
||||
this.When(durationsRegex, function(table, callback) {tableParse.call(this, table, DURATIONS_NO_ROUTE, 'durations', callback);}.bind(this));
|
||||
this.When(distancesRegex, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'distances', callback);}.bind(this));
|
||||
this.When(estimatesRegex, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'fallback_speed_cells', callback);}.bind(this));
|
||||
const FORMAT_JSON = 'json';
|
||||
const FORMAT_FB = 'flatbuffers';
|
||||
|
||||
this.When(durationsRegex, function(table, callback) {tableParse.call(this, table, DURATIONS_NO_ROUTE, 'durations', FORMAT_JSON, callback);}.bind(this));
|
||||
this.When(distancesRegex, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'distances', FORMAT_JSON, callback);}.bind(this));
|
||||
this.When(estimatesRegex, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'fallback_speed_cells', FORMAT_JSON, callback);}.bind(this));
|
||||
this.When(durationsRegexFb, function(table, callback) {tableParse.call(this, table, DURATIONS_NO_ROUTE, 'durations', FORMAT_FB, callback);}.bind(this));
|
||||
this.When(distancesRegexFb, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'distances', FORMAT_FB, callback);}.bind(this));
|
||||
};
|
||||
|
||||
const durationsParse = function(v) { return isNaN(parseInt(v)); };
|
||||
const distancesParse = function(v) { return isNaN(parseFloat(v)); };
|
||||
const estimatesParse = function(v) { return isNaN(parseFloat(v)); };
|
||||
|
||||
function tableParse(table, noRoute, annotation, callback) {
|
||||
function tableParse(table, noRoute, annotation, format, callback) {
|
||||
|
||||
const parse = annotation == 'distances' ? distancesParse : (annotation == 'durations' ? durationsParse : estimatesParse);
|
||||
const params = this.queryParams;
|
||||
params.annotations = ['durations','fallback_speed_cells'].indexOf(annotation) !== -1 ? 'duration' : 'distance';
|
||||
params.output = format;
|
||||
|
||||
var tableRows = table.raw();
|
||||
|
||||
@ -62,9 +73,10 @@ function tableParse(table, noRoute, annotation, callback) {
|
||||
if (err) return callback(err);
|
||||
if (!response.body.length) return callback(new Error('Invalid response body'));
|
||||
|
||||
var result = [];
|
||||
if (format === 'json') {
|
||||
var json = JSON.parse(response.body);
|
||||
|
||||
var result = {};
|
||||
if (annotation === 'fallback_speed_cells') {
|
||||
result = table.raw().map(row => row.map(() => ''));
|
||||
json[annotation].forEach(pair => {
|
||||
@ -84,6 +96,31 @@ function tableParse(table, noRoute, annotation, callback) {
|
||||
return hashes;
|
||||
});
|
||||
}
|
||||
} else { //flatbuffers
|
||||
var body = response.body;
|
||||
var bytes = new Uint8Array(body.length);
|
||||
for (var indx = 0; indx < body.length; ++indx) {
|
||||
bytes[indx] = body.charCodeAt(indx);
|
||||
}
|
||||
var buf = new flatbuffers.ByteBuffer(bytes);
|
||||
var fb = FBResult.getRootAsFBResult(buf);
|
||||
|
||||
var matrix;
|
||||
if (annotation === 'durations') {
|
||||
matrix = fb.table().durationsArray();
|
||||
}
|
||||
if (annotation === 'distances') {
|
||||
matrix = fb.table().distancesArray();
|
||||
}
|
||||
var cols = fb.table().cols();
|
||||
var rows = fb.table().rows();
|
||||
for (let r = 0; r < rows; ++r) {
|
||||
result[r]={};
|
||||
for(let c=0; c < cols; ++c) {
|
||||
result[r][tableRows[0][c+1]] = matrix[r*cols + c];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var testRow = (row, ri, cb) => {
|
||||
for (var k in result[ri]) {
|
||||
|
@ -12,4 +12,9 @@ module.exports = function () {
|
||||
|
||||
q.awaitAll(callback);
|
||||
});
|
||||
|
||||
this.Given(/^skip waypoints$/, (callback) => {
|
||||
this.queryParams['skip_waypoints'] = true;
|
||||
callback();
|
||||
});
|
||||
};
|
||||
|
@ -22,14 +22,9 @@ module.exports = function () {
|
||||
this.PROFILES_PATH = path.resolve(this.ROOT_PATH, 'profiles');
|
||||
this.FIXTURES_PATH = path.resolve(this.ROOT_PATH, 'unit_tests/fixtures');
|
||||
this.BIN_PATH = process.env.OSRM_BUILD_DIR && process.env.OSRM_BUILD_DIR || path.resolve(this.ROOT_PATH, 'build');
|
||||
var stxxl_config = path.resolve(this.ROOT_PATH, 'test/.stxxl');
|
||||
if (!fs.existsSync(stxxl_config)) {
|
||||
return callback(new Error('*** '+stxxl_config+ 'does not exist'));
|
||||
}
|
||||
|
||||
this.DATASET_NAME = 'cucumber';
|
||||
this.PLATFORM_WINDOWS = process.platform.match(/^win.*/);
|
||||
this.DEFAULT_ENVIRONMENT = Object.assign({STXXLCFG: stxxl_config}, process.env);
|
||||
this.DEFAULT_ENVIRONMENT = process.env;
|
||||
this.DEFAULT_PROFILE = 'bicycle';
|
||||
this.DEFAULT_INPUT_FORMAT = 'osm';
|
||||
this.DEFAULT_LOAD_METHOD = process.argv[process.argv.indexOf('-m') +1].match('mmap') ? 'mmap' : 'datastore';
|
||||
|
@ -155,6 +155,13 @@ module.exports = function () {
|
||||
if (headers.has('locations')){
|
||||
got.locations = (locations || '').trim();
|
||||
}
|
||||
if (headers.has('waypoints_count')) {
|
||||
if ('waypoints' in json) {
|
||||
got.waypoints_count = json.waypoints.length;
|
||||
} else{
|
||||
got.waypoints_count = 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (headers.has('approaches')){
|
||||
got.approaches = (approaches || '').trim();
|
||||
|
@ -17,9 +17,9 @@ Feature: Basic Routing
|
||||
| ab |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | data_version |
|
||||
| a | b | ab,ab | |
|
||||
| b | a | ab,ab | |
|
||||
| from | to | route | data_version | waypoints_count |
|
||||
| a | b | ab,ab | | 2 |
|
||||
| b | a | ab,ab | | 2 |
|
||||
|
||||
Scenario: Data_version test
|
||||
Given the node map
|
||||
@ -38,6 +38,23 @@ Feature: Basic Routing
|
||||
| a | b | ab,ab | cucumber_data_version |
|
||||
| b | a | ab,ab | cucumber_data_version |
|
||||
|
||||
Scenario: Skip_waypoints test
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
|
||||
And skip waypoints
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | waypoints_count |
|
||||
| a | b | ab,ab | 0 |
|
||||
| b | a | ab,ab | 0 |
|
||||
|
||||
Scenario: Routing in between two nodes of way
|
||||
Given the node map
|
||||
"""
|
||||
|
@ -21,6 +21,21 @@ Feature: Basic Duration Matrix
|
||||
| a | 0 | 10 |
|
||||
| b | 10 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel time matrix of minimal network requested with flatbuffer format
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
|
||||
When I request a travel time matrix with flatbuffers I should get
|
||||
| | a | b |
|
||||
| a | 0 | 10 |
|
||||
| b | 10 | 0 |
|
||||
|
||||
@ch
|
||||
Scenario: Testbot - Travel time matrix of minimal network with toll exclude
|
||||
Given the query options
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/range/algorithm/transform.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace osrm
|
||||
@ -73,7 +74,7 @@ class BaseAPI
|
||||
}
|
||||
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||
MakeWaypoints(flatbuffers::FlatBufferBuilder &builder,
|
||||
MakeWaypoints(flatbuffers::FlatBufferBuilder *builder,
|
||||
const std::vector<PhantomNodes> &segment_end_coordinates) const
|
||||
{
|
||||
BOOST_ASSERT(parameters.coordinates.size() > 0);
|
||||
@ -82,43 +83,43 @@ class BaseAPI
|
||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||
waypoints.resize(parameters.coordinates.size());
|
||||
waypoints[0] =
|
||||
MakeWaypoint(builder, segment_end_coordinates.front().source_phantom).Finish();
|
||||
MakeWaypoint(builder, segment_end_coordinates.front().source_phantom)->Finish();
|
||||
|
||||
std::transform(segment_end_coordinates.begin(),
|
||||
segment_end_coordinates.end(),
|
||||
std::next(waypoints.begin()),
|
||||
[this, &builder](const PhantomNodes &phantom_pair) {
|
||||
return MakeWaypoint(builder, phantom_pair.target_phantom).Finish();
|
||||
[this, builder](const PhantomNodes &phantom_pair) {
|
||||
return MakeWaypoint(builder, phantom_pair.target_phantom)->Finish();
|
||||
});
|
||||
return builder.CreateVector(waypoints);
|
||||
return builder->CreateVector(waypoints);
|
||||
}
|
||||
|
||||
// FIXME: gcc 4.9 does not like MakeWaypoints to be protected
|
||||
// protected:
|
||||
fbresult::WaypointBuilder MakeWaypoint(flatbuffers::FlatBufferBuilder &builder,
|
||||
std::unique_ptr<fbresult::WaypointBuilder> MakeWaypoint(flatbuffers::FlatBufferBuilder *builder,
|
||||
const PhantomNode &phantom) const
|
||||
{
|
||||
|
||||
auto location =
|
||||
fbresult::Position(static_cast<double>(util::toFloating(phantom.location.lon)),
|
||||
static_cast<double>(util::toFloating(phantom.location.lat)));
|
||||
auto name_string = builder.CreateString(
|
||||
auto name_string = builder->CreateString(
|
||||
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)).to_string());
|
||||
|
||||
boost::optional<flatbuffers::Offset<flatbuffers::String>> hint_string = boost::none;
|
||||
flatbuffers::Offset<flatbuffers::String> hint_string;
|
||||
if (parameters.generate_hints)
|
||||
{
|
||||
hint_string = builder.CreateString(Hint{phantom, facade.GetCheckSum()}.ToBase64());
|
||||
hint_string = builder->CreateString(Hint{phantom, facade.GetCheckSum()}.ToBase64());
|
||||
}
|
||||
|
||||
fbresult::WaypointBuilder waypoint(builder);
|
||||
waypoint.add_location(&location);
|
||||
waypoint.add_distance(util::coordinate_calculation::fccApproximateDistance(
|
||||
auto waypoint = std::make_unique<fbresult::WaypointBuilder>(*builder);
|
||||
waypoint->add_location(&location);
|
||||
waypoint->add_distance(util::coordinate_calculation::fccApproximateDistance(
|
||||
phantom.location, phantom.input_location));
|
||||
waypoint.add_name(name_string);
|
||||
if (hint_string)
|
||||
waypoint->add_name(name_string);
|
||||
if (parameters.generate_hints)
|
||||
{
|
||||
waypoint.add_hint(*hint_string);
|
||||
waypoint->add_hint(hint_string);
|
||||
}
|
||||
return waypoint;
|
||||
}
|
||||
|
@ -87,6 +87,9 @@ struct BaseParameters
|
||||
// Adds hints to response which can be included in subsequent requests, see `hints` above.
|
||||
bool generate_hints = true;
|
||||
|
||||
// Remove waypoints array from the response.
|
||||
bool skip_waypoints = false;
|
||||
|
||||
SnappingType snapping = SnappingType::Default;
|
||||
|
||||
BaseParameters(const std::vector<util::Coordinate> coordinates_ = {},
|
||||
|
@ -50,7 +50,7 @@ class MatchAPI final : public RouteAPI
|
||||
flatbuffers::FlatBufferBuilder &fb_result) const
|
||||
{
|
||||
auto data_timestamp = facade.GetTimestamp();
|
||||
boost::optional<flatbuffers::Offset<flatbuffers::String>> data_version_string = boost::none;
|
||||
flatbuffers::Offset<flatbuffers::String> data_version_string;
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
data_version_string = fb_result.CreateString(data_timestamp);
|
||||
@ -60,12 +60,12 @@ class MatchAPI final : public RouteAPI
|
||||
return MakeTracepoints(fb_result, sub_matchings);
|
||||
});
|
||||
|
||||
if (data_version_string)
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
response.add_data_version(*data_version_string);
|
||||
response->add_data_version(data_version_string);
|
||||
}
|
||||
|
||||
fb_result.Finish(response.Finish());
|
||||
fb_result.Finish(response->Finish());
|
||||
}
|
||||
void MakeResponse(const std::vector<map_matching::SubMatching> &sub_matchings,
|
||||
const std::vector<InternalRouteResult> &sub_routes,
|
||||
@ -83,7 +83,10 @@ class MatchAPI final : public RouteAPI
|
||||
route.values["confidence"] = sub_matchings[index].confidence;
|
||||
routes.values.push_back(std::move(route));
|
||||
}
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
response.values["tracepoints"] = MakeTracepoints(sub_matchings);
|
||||
}
|
||||
response.values["matchings"] = std::move(routes);
|
||||
response.values["code"] = "Ok";
|
||||
}
|
||||
@ -138,9 +141,9 @@ class MatchAPI final : public RouteAPI
|
||||
}
|
||||
const auto &phantom =
|
||||
sub_matchings[matching_index.sub_matching_index].nodes[matching_index.point_index];
|
||||
auto waypoint = BaseAPI::MakeWaypoint(fb_result, phantom);
|
||||
waypoint.add_matchings_index(matching_index.sub_matching_index);
|
||||
waypoint.add_alternatives_count(sub_matchings[matching_index.sub_matching_index]
|
||||
auto waypoint = BaseAPI::MakeWaypoint(&fb_result, phantom);
|
||||
waypoint->add_matchings_index(matching_index.sub_matching_index);
|
||||
waypoint->add_alternatives_count(sub_matchings[matching_index.sub_matching_index]
|
||||
.alternatives_count[matching_index.point_index]);
|
||||
// waypoint indices need to be adjusted if route legs were collapsed
|
||||
// waypoint parameter assumes there is only one match object
|
||||
@ -148,19 +151,19 @@ class MatchAPI final : public RouteAPI
|
||||
{
|
||||
if (tidy_result.was_waypoint[trace_index])
|
||||
{
|
||||
waypoint.add_waypoint_index(was_waypoint_idx);
|
||||
waypoint->add_waypoint_index(was_waypoint_idx);
|
||||
was_waypoint_idx++;
|
||||
}
|
||||
else
|
||||
{
|
||||
waypoint.add_waypoint_index(0);
|
||||
waypoint->add_waypoint_index(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
waypoint.add_waypoint_index(matching_index.point_index);
|
||||
waypoint->add_waypoint_index(matching_index.point_index);
|
||||
}
|
||||
waypoints.push_back(waypoint.Finish());
|
||||
waypoints.push_back(waypoint->Finish());
|
||||
}
|
||||
|
||||
return fb_result.CreateVector(waypoints);
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define ENGINE_API_NEAREST_API_HPP
|
||||
|
||||
#include "engine/api/base_api.hpp"
|
||||
#include "engine/api/base_result.hpp"
|
||||
#include "engine/api/nearest_parameters.hpp"
|
||||
|
||||
#include "engine/api/json_factory.hpp"
|
||||
@ -54,9 +55,14 @@ class NearestAPI final : public BaseAPI
|
||||
data_version_string = fb_result.CreateString(data_timestamp);
|
||||
}
|
||||
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||
waypoints_vector;
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||
waypoints.resize(phantom_nodes.front().size());
|
||||
std::transform(phantom_nodes.front().begin(),
|
||||
std::transform(
|
||||
phantom_nodes.front().begin(),
|
||||
phantom_nodes.front().end(),
|
||||
waypoints.begin(),
|
||||
[this, &fb_result](const PhantomNodeWithDistance &phantom_with_distance) {
|
||||
@ -65,14 +71,16 @@ class NearestAPI final : public BaseAPI
|
||||
auto node_values = MakeNodes(phantom_node);
|
||||
fbresult::Uint64Pair nodes{node_values.first, node_values.second};
|
||||
|
||||
auto waypoint = MakeWaypoint(fb_result, phantom_node);
|
||||
waypoint.add_nodes(&nodes);
|
||||
|
||||
return waypoint.Finish();
|
||||
auto waypoint = MakeWaypoint(&fb_result, phantom_node);
|
||||
waypoint->add_nodes(&nodes);
|
||||
return waypoint->Finish();
|
||||
});
|
||||
|
||||
auto waypoints_vector = fb_result.CreateVector(waypoints);
|
||||
waypoints_vector = fb_result.CreateVector(waypoints);
|
||||
}
|
||||
|
||||
fbresult::FBResultBuilder response(fb_result);
|
||||
|
||||
response.add_waypoints(waypoints_vector);
|
||||
if (data_version_string)
|
||||
{
|
||||
@ -82,6 +90,8 @@ class NearestAPI final : public BaseAPI
|
||||
}
|
||||
void MakeResponse(const std::vector<std::vector<PhantomNodeWithDistance>> &phantom_nodes,
|
||||
util::json::Object &response) const
|
||||
{
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
util::json::Array waypoints;
|
||||
waypoints.values.resize(phantom_nodes.front().size());
|
||||
@ -102,9 +112,10 @@ class NearestAPI final : public BaseAPI
|
||||
|
||||
return waypoint;
|
||||
});
|
||||
response.values["waypoints"] = std::move(waypoints);
|
||||
}
|
||||
|
||||
response.values["code"] = "Ok";
|
||||
response.values["waypoints"] = std::move(waypoints);
|
||||
}
|
||||
|
||||
const NearestParameters ¶meters;
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "extractor/maneuver_override.hpp"
|
||||
#include "engine/api/base_api.hpp"
|
||||
#include "engine/api/base_result.hpp"
|
||||
#include "engine/api/json_factory.hpp"
|
||||
#include "engine/api/route_parameters.hpp"
|
||||
|
||||
@ -72,7 +73,7 @@ class RouteAPI : public BaseAPI
|
||||
{
|
||||
|
||||
auto data_timestamp = facade.GetTimestamp();
|
||||
boost::optional<flatbuffers::Offset<flatbuffers::String>> data_version_string = boost::none;
|
||||
flatbuffers::Offset<flatbuffers::String> data_version_string;
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
data_version_string = fb_result.CreateString(data_timestamp);
|
||||
@ -80,14 +81,14 @@ class RouteAPI : public BaseAPI
|
||||
|
||||
auto response =
|
||||
MakeFBResponse(raw_routes, fb_result, [this, &all_start_end_points, &fb_result]() {
|
||||
return BaseAPI::MakeWaypoints(fb_result, all_start_end_points);
|
||||
return BaseAPI::MakeWaypoints(&fb_result, all_start_end_points);
|
||||
});
|
||||
|
||||
if (data_version_string)
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
response.add_data_version(*data_version_string);
|
||||
response->add_data_version(data_version_string);
|
||||
}
|
||||
fb_result.Finish(response.Finish());
|
||||
fb_result.Finish(response->Finish());
|
||||
}
|
||||
|
||||
void
|
||||
@ -109,7 +110,10 @@ class RouteAPI : public BaseAPI
|
||||
route.target_traversed_in_reverse));
|
||||
}
|
||||
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
response.values["waypoints"] = BaseAPI::MakeWaypoints(all_start_end_points);
|
||||
}
|
||||
response.values["routes"] = std::move(jsRoutes);
|
||||
response.values["code"] = "Ok";
|
||||
auto data_timestamp = facade.GetTimestamp();
|
||||
@ -121,7 +125,8 @@ class RouteAPI : public BaseAPI
|
||||
|
||||
protected:
|
||||
template <typename GetWptsFn>
|
||||
fbresult::FBResultBuilder MakeFBResponse(const InternalManyRoutesResult &raw_routes,
|
||||
std::unique_ptr<fbresult::FBResultBuilder>
|
||||
MakeFBResponse(const InternalManyRoutesResult &raw_routes,
|
||||
flatbuffers::FlatBufferBuilder &fb_result,
|
||||
GetWptsFn getWaypoints) const
|
||||
{
|
||||
@ -140,11 +145,16 @@ class RouteAPI : public BaseAPI
|
||||
}
|
||||
|
||||
auto routes_vector = fb_result.CreateVector(routes);
|
||||
auto waypoints_vector = getWaypoints();
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||
waypoints_vector;
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
waypoints_vector = getWaypoints();
|
||||
}
|
||||
|
||||
fbresult::FBResultBuilder response(fb_result);
|
||||
response.add_routes(routes_vector);
|
||||
response.add_waypoints(waypoints_vector);
|
||||
auto response = std::make_unique<fbresult::FBResultBuilder>(fb_result);
|
||||
response->add_routes(routes_vector);
|
||||
response->add_waypoints(waypoints_vector);
|
||||
|
||||
return response;
|
||||
}
|
||||
@ -363,8 +373,7 @@ class RouteAPI : public BaseAPI
|
||||
requested_annotations = RouteParameters::AnnotationsType::All;
|
||||
}
|
||||
|
||||
boost::optional<flatbuffers::Offset<fbresult::Annotation>> annotation_buffer =
|
||||
boost::none;
|
||||
flatbuffers::Offset<fbresult::Annotation> annotation_buffer;
|
||||
if (requested_annotations != RouteParameters::AnnotationsType::None)
|
||||
{
|
||||
annotation_buffer =
|
||||
@ -387,9 +396,9 @@ class RouteAPI : public BaseAPI
|
||||
}
|
||||
legBuilder.add_steps(steps_vector);
|
||||
|
||||
if (annotation_buffer)
|
||||
if (requested_annotations != RouteParameters::AnnotationsType::None)
|
||||
{
|
||||
legBuilder.add_annotations(*annotation_buffer);
|
||||
legBuilder.add_annotations(annotation_buffer);
|
||||
}
|
||||
routeLegs.emplace_back(legBuilder.Finish());
|
||||
}
|
||||
@ -496,8 +505,9 @@ class RouteAPI : public BaseAPI
|
||||
}
|
||||
auto nodes_vector = fb_result.CreateVector(nodes);
|
||||
// Add any supporting metadata, if needed
|
||||
boost::optional<flatbuffers::Offset<fbresult::Metadata>> metadata_buffer = boost::none;
|
||||
if (requested_annotations & RouteParameters::AnnotationsType::Datasources)
|
||||
bool use_metadata = requested_annotations & RouteParameters::AnnotationsType::Datasources;
|
||||
flatbuffers::Offset<fbresult::Metadata> metadata_buffer;
|
||||
if (use_metadata)
|
||||
{
|
||||
const auto MAX_DATASOURCE_ID = 255u;
|
||||
std::vector<flatbuffers::Offset<flatbuffers::String>> names;
|
||||
@ -519,9 +529,9 @@ class RouteAPI : public BaseAPI
|
||||
annotation.add_weight(weight);
|
||||
annotation.add_datasources(datasources);
|
||||
annotation.add_nodes(nodes_vector);
|
||||
if (metadata_buffer)
|
||||
if (use_metadata)
|
||||
{
|
||||
annotation.add_metadata(*metadata_buffer);
|
||||
annotation.add_metadata(metadata_buffer);
|
||||
}
|
||||
|
||||
return annotation.Finish();
|
||||
@ -647,7 +657,6 @@ class RouteAPI : public BaseAPI
|
||||
step.intersections.end(),
|
||||
intersections.begin(),
|
||||
[&fb_result, this](const guidance::IntermediateIntersection &intersection) {
|
||||
|
||||
std::vector<flatbuffers::Offset<fbresult::Lane>> lanes;
|
||||
if (json::detail::hasValidLanes(intersection))
|
||||
{
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define ENGINE_API_TABLE_HPP
|
||||
|
||||
#include "engine/api/base_api.hpp"
|
||||
#include "engine/api/base_result.hpp"
|
||||
#include "engine/api/json_factory.hpp"
|
||||
#include "engine/api/table_parameters.hpp"
|
||||
|
||||
@ -73,7 +74,7 @@ class TableAPI final : public BaseAPI
|
||||
auto number_of_destinations = parameters.destinations.size();
|
||||
|
||||
auto data_timestamp = facade.GetTimestamp();
|
||||
boost::optional<flatbuffers::Offset<flatbuffers::String>> data_version_string = boost::none;
|
||||
flatbuffers::Offset<flatbuffers::String> data_version_string;
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
data_version_string = fb_result.CreateString(data_timestamp);
|
||||
@ -82,42 +83,57 @@ class TableAPI final : public BaseAPI
|
||||
// symmetric case
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>> sources;
|
||||
if (parameters.sources.empty())
|
||||
{
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
sources = MakeWaypoints(fb_result, phantoms);
|
||||
}
|
||||
number_of_sources = phantoms.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
sources = MakeWaypoints(fb_result, phantoms, parameters.sources);
|
||||
}
|
||||
}
|
||||
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||
destinations;
|
||||
if (parameters.destinations.empty())
|
||||
{
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
destinations = MakeWaypoints(fb_result, phantoms);
|
||||
}
|
||||
number_of_destinations = phantoms.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
destinations = MakeWaypoints(fb_result, phantoms, parameters.destinations);
|
||||
}
|
||||
}
|
||||
|
||||
boost::optional<flatbuffers::Offset<flatbuffers::Vector<float>>> durations = boost::none;
|
||||
if (parameters.annotations & TableParameters::AnnotationsType::Duration)
|
||||
bool use_durations = parameters.annotations & TableParameters::AnnotationsType::Duration;
|
||||
flatbuffers::Offset<flatbuffers::Vector<float>> durations;
|
||||
if (use_durations)
|
||||
{
|
||||
durations = MakeDurationTable(fb_result, tables.first);
|
||||
}
|
||||
|
||||
boost::optional<flatbuffers::Offset<flatbuffers::Vector<float>>> distances = boost::none;
|
||||
if (parameters.annotations & TableParameters::AnnotationsType::Distance)
|
||||
bool use_distances = parameters.annotations & TableParameters::AnnotationsType::Distance;
|
||||
flatbuffers::Offset<flatbuffers::Vector<float>> distances;
|
||||
if (use_distances)
|
||||
{
|
||||
distances = MakeDistanceTable(fb_result, tables.second);
|
||||
}
|
||||
|
||||
boost::optional<flatbuffers::Offset<flatbuffers::Vector<uint32_t>>> speed_cells =
|
||||
boost::none;
|
||||
if (parameters.fallback_speed != INVALID_FALLBACK_SPEED && parameters.fallback_speed > 0)
|
||||
bool have_speed_cells =
|
||||
parameters.fallback_speed != INVALID_FALLBACK_SPEED && parameters.fallback_speed > 0;
|
||||
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> speed_cells;
|
||||
if (have_speed_cells)
|
||||
{
|
||||
speed_cells = MakeEstimatesTable(fb_result, fallback_speed_cells);
|
||||
}
|
||||
@ -126,24 +142,24 @@ class TableAPI final : public BaseAPI
|
||||
table.add_destinations(destinations);
|
||||
table.add_rows(number_of_sources);
|
||||
table.add_cols(number_of_destinations);
|
||||
if (durations)
|
||||
if (use_durations)
|
||||
{
|
||||
table.add_durations(*durations);
|
||||
table.add_durations(durations);
|
||||
}
|
||||
if (distances)
|
||||
if (use_distances)
|
||||
{
|
||||
table.add_distances(*distances);
|
||||
table.add_distances(distances);
|
||||
}
|
||||
if (speed_cells)
|
||||
if (have_speed_cells)
|
||||
{
|
||||
table.add_fallback_speed_cells(*speed_cells);
|
||||
table.add_fallback_speed_cells(speed_cells);
|
||||
}
|
||||
auto table_buffer = table.Finish();
|
||||
|
||||
fbresult::FBResultBuilder response(fb_result);
|
||||
if (data_version_string)
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
response.add_data_version(*data_version_string);
|
||||
response.add_data_version(data_version_string);
|
||||
}
|
||||
response.add_table(table_buffer);
|
||||
response.add_waypoints(sources);
|
||||
@ -161,24 +177,36 @@ class TableAPI final : public BaseAPI
|
||||
|
||||
// symmetric case
|
||||
if (parameters.sources.empty())
|
||||
{
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
response.values["sources"] = MakeWaypoints(phantoms);
|
||||
}
|
||||
number_of_sources = phantoms.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
response.values["sources"] = MakeWaypoints(phantoms, parameters.sources);
|
||||
}
|
||||
}
|
||||
|
||||
if (parameters.destinations.empty())
|
||||
{
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
response.values["destinations"] = MakeWaypoints(phantoms);
|
||||
}
|
||||
number_of_destinations = phantoms.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
response.values["destinations"] = MakeWaypoints(phantoms, parameters.destinations);
|
||||
}
|
||||
}
|
||||
|
||||
if (parameters.annotations & TableParameters::AnnotationsType::Duration)
|
||||
{
|
||||
@ -211,7 +239,7 @@ class TableAPI final : public BaseAPI
|
||||
|
||||
boost::range::transform(
|
||||
phantoms, std::back_inserter(waypoints), [this, &builder](const PhantomNode &phantom) {
|
||||
return BaseAPI::MakeWaypoint(builder, phantom).Finish();
|
||||
return BaseAPI::MakeWaypoint(&builder, phantom)->Finish();
|
||||
});
|
||||
return builder.CreateVector(waypoints);
|
||||
}
|
||||
@ -227,7 +255,7 @@ class TableAPI final : public BaseAPI
|
||||
std::back_inserter(waypoints),
|
||||
[this, &builder, phantoms](const std::size_t idx) {
|
||||
BOOST_ASSERT(idx < phantoms.size());
|
||||
return BaseAPI::MakeWaypoint(builder, phantoms[idx]).Finish();
|
||||
return BaseAPI::MakeWaypoint(&builder, phantoms[idx])->Finish();
|
||||
});
|
||||
return builder.CreateVector(waypoints);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class TripAPI final : public RouteAPI
|
||||
flatbuffers::FlatBufferBuilder &fb_result) const
|
||||
{
|
||||
auto data_timestamp = facade.GetTimestamp();
|
||||
boost::optional<flatbuffers::Offset<flatbuffers::String>> data_version_string = boost::none;
|
||||
flatbuffers::Offset<flatbuffers::String> data_version_string;
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
data_version_string = fb_result.CreateString(data_timestamp);
|
||||
@ -59,11 +59,11 @@ class TripAPI final : public RouteAPI
|
||||
return MakeWaypoints(fb_result, sub_trips, phantoms);
|
||||
});
|
||||
|
||||
if (data_version_string)
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
response.add_data_version(*data_version_string);
|
||||
response->add_data_version(data_version_string);
|
||||
}
|
||||
fb_result.Finish(response.Finish());
|
||||
fb_result.Finish(response->Finish());
|
||||
}
|
||||
void MakeResponse(const std::vector<std::vector<NodeID>> &sub_trips,
|
||||
const std::vector<InternalRouteResult> &sub_routes,
|
||||
@ -81,7 +81,10 @@ class TripAPI final : public RouteAPI
|
||||
sub_routes[index].target_traversed_in_reverse);
|
||||
routes.values.push_back(std::move(route));
|
||||
}
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
response.values["waypoints"] = MakeWaypoints(sub_trips, phantoms);
|
||||
}
|
||||
response.values["trips"] = std::move(routes);
|
||||
response.values["code"] = "Ok";
|
||||
}
|
||||
@ -124,10 +127,10 @@ class TripAPI final : public RouteAPI
|
||||
auto trip_index = input_idx_to_trip_idx[input_index];
|
||||
BOOST_ASSERT(!trip_index.NotUsed());
|
||||
|
||||
auto waypoint = BaseAPI::MakeWaypoint(fb_result, phantoms[input_index]);
|
||||
waypoint.add_waypoint_index(trip_index.point_index);
|
||||
waypoint.add_trips_index(trip_index.sub_trip_index);
|
||||
waypoints.push_back(waypoint.Finish());
|
||||
auto waypoint = BaseAPI::MakeWaypoint(&fb_result, phantoms[input_index]);
|
||||
waypoint->add_waypoint_index(trip_index.point_index);
|
||||
waypoint->add_trips_index(trip_index.sub_trip_index);
|
||||
waypoints.push_back(waypoint->Finish());
|
||||
}
|
||||
|
||||
return fb_result.CreateVector(waypoints);
|
||||
|
@ -192,17 +192,22 @@ void annotatePath(const FacadeT &facade,
|
||||
|
||||
const bool is_first_segment = unpacked_path.empty();
|
||||
|
||||
const std::size_t start_index =
|
||||
(is_first_segment ? ((start_traversed_in_reverse)
|
||||
? weight_vector.size() -
|
||||
phantom_node_pair.source_phantom.fwd_segment_position - 1
|
||||
: phantom_node_pair.source_phantom.fwd_segment_position)
|
||||
: 0);
|
||||
std::size_t start_index = 0;
|
||||
if (is_first_segment)
|
||||
{
|
||||
unsigned short segment_position = phantom_node_pair.source_phantom.fwd_segment_position;
|
||||
if (start_traversed_in_reverse)
|
||||
{
|
||||
segment_position = weight_vector.size() -
|
||||
phantom_node_pair.source_phantom.fwd_segment_position - 1;
|
||||
}
|
||||
BOOST_ASSERT(segment_position >= 0);
|
||||
start_index = static_cast<std::size_t>(segment_position);
|
||||
}
|
||||
const std::size_t end_index = weight_vector.size();
|
||||
|
||||
bool is_left_hand_driving = facade.IsLeftHandDriving(node_id);
|
||||
|
||||
BOOST_ASSERT(start_index >= 0);
|
||||
BOOST_ASSERT(start_index < end_index);
|
||||
for (std::size_t segment_idx = start_index; segment_idx < end_index; ++segment_idx)
|
||||
{
|
||||
|
@ -85,33 +85,6 @@ struct InternalExtractorEdge
|
||||
DurationData duration_data;
|
||||
// coordinate of the source node
|
||||
util::Coordinate source_coordinate;
|
||||
|
||||
// necessary static util functions for stxxl's sorting
|
||||
static InternalExtractorEdge min_osm_value()
|
||||
{
|
||||
return InternalExtractorEdge(
|
||||
MIN_OSM_NODEID, MIN_OSM_NODEID, WeightData(), DurationData(), util::Coordinate());
|
||||
}
|
||||
static InternalExtractorEdge max_osm_value()
|
||||
{
|
||||
return InternalExtractorEdge(
|
||||
MAX_OSM_NODEID, MAX_OSM_NODEID, WeightData(), DurationData(), util::Coordinate());
|
||||
}
|
||||
|
||||
static InternalExtractorEdge min_internal_value()
|
||||
{
|
||||
auto v = min_osm_value();
|
||||
v.result.source = 0;
|
||||
v.result.target = 0;
|
||||
return v;
|
||||
}
|
||||
static InternalExtractorEdge max_internal_value()
|
||||
{
|
||||
auto v = max_osm_value();
|
||||
v.result.source = std::numeric_limits<NodeID>::max();
|
||||
v.result.target = std::numeric_limits<NodeID>::max();
|
||||
return v;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
73
include/extractor/raster_source.hpp
Normal file → Executable file
73
include/extractor/raster_source.hpp
Normal file → Executable file
@ -4,16 +4,21 @@
|
||||
#include "util/coordinate.hpp"
|
||||
#include "util/exception.hpp"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
#include <boost/spirit/include/qi_int.hpp>
|
||||
|
||||
#include <storage/io.hpp>
|
||||
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
using namespace std;
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
@ -43,37 +48,31 @@ class RasterGrid
|
||||
xdim = _xdim;
|
||||
ydim = _ydim;
|
||||
_data.reserve(ydim * xdim);
|
||||
BOOST_ASSERT(ydim * xdim <= _data.capacity());
|
||||
|
||||
// Construct FileReader
|
||||
storage::io::FileReader file_reader(filepath, storage::io::FileReader::HasNoFingerprint);
|
||||
|
||||
std::string buffer;
|
||||
buffer.resize(file_reader.GetSize());
|
||||
|
||||
BOOST_ASSERT(buffer.size() > 1);
|
||||
|
||||
file_reader.ReadInto(&buffer[0], buffer.size());
|
||||
buffer.resize(xdim * 11); // INT32_MAX = 2147483647 = 10 chars + 1 white space = 11
|
||||
BOOST_ASSERT(xdim * 11 <= buffer.size());
|
||||
|
||||
for (unsigned int y = 0; y < ydim; y++)
|
||||
{
|
||||
// read one line from file.
|
||||
file_reader.ReadLine(&buffer[0], xdim * 11);
|
||||
boost::algorithm::trim(buffer);
|
||||
|
||||
auto itr = buffer.begin();
|
||||
auto end = buffer.end();
|
||||
|
||||
bool r = false;
|
||||
try
|
||||
std::vector<std::string> result;
|
||||
boost::split(
|
||||
result, buffer, boost::is_any_of(" \r\n\0"), boost::algorithm::token_compress_on);
|
||||
unsigned int x = 0;
|
||||
for (const auto &s : result)
|
||||
{
|
||||
r = boost::spirit::qi::parse(
|
||||
itr, end, +boost::spirit::qi::int_ % +boost::spirit::qi::space, _data);
|
||||
if (x < xdim)
|
||||
_data[(y * xdim) + x] = atoi(s.c_str());
|
||||
++x;
|
||||
}
|
||||
catch (std::exception const &ex)
|
||||
{
|
||||
throw util::exception("Failed to read from raster source " + filepath.string() + ": " +
|
||||
ex.what() + SOURCE_REF);
|
||||
}
|
||||
|
||||
if (!r || itr != end)
|
||||
{
|
||||
throw util::exception("Failed to parse raster source: " + filepath.string() +
|
||||
SOURCE_REF);
|
||||
BOOST_ASSERT(x == xdim);
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,8 +142,36 @@ class RasterContainer
|
||||
RasterDatum GetRasterInterpolateFromSource(unsigned int source_id, double lon, double lat);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
// << singletone >> RasterCache
|
||||
// The instance of RasterContainer is created for every threads osrm-extract uses.
|
||||
// To avoid multiple load of same file on each RasterContainer,
|
||||
// The LoadedSources and LoadedSourcePaths are separated to RasterCache class
|
||||
// and handled as the singletone pattern to avoid duplicate creation.
|
||||
class RasterCache
|
||||
{
|
||||
public:
|
||||
// class method to get the instance
|
||||
static RasterCache &getInstance()
|
||||
{
|
||||
if (NULL == g_instance)
|
||||
{
|
||||
g_instance = new RasterCache();
|
||||
}
|
||||
return *g_instance;
|
||||
}
|
||||
// get reference of cache
|
||||
std::vector<RasterSource> &getLoadedSources() { return LoadedSources; }
|
||||
std::unordered_map<std::string, int> &getLoadedSourcePaths() { return LoadedSourcePaths; }
|
||||
private:
|
||||
// constructor
|
||||
RasterCache() = default;
|
||||
// member
|
||||
std::vector<RasterSource> LoadedSources;
|
||||
std::unordered_map<std::string, int> LoadedSourcePaths;
|
||||
// the instance
|
||||
static RasterCache *g_instance;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,11 @@ struct Engine final : public Nan::ObjectWrap
|
||||
std::shared_ptr<osrm::OSRM> this_;
|
||||
};
|
||||
|
||||
} // ns node_osrm
|
||||
} // namespace node_osrm
|
||||
|
||||
NODE_MODULE(osrm, node_osrm::Engine::Init)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
NAN_MODULE_WORKER_ENABLED(osrm, node_osrm::Engine::Init)
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#endif
|
||||
|
@ -116,8 +116,8 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
|
||||
|
||||
if (args[0]->IsString())
|
||||
{
|
||||
engine_config->storage_config = osrm::StorageConfig(
|
||||
*v8::String::Utf8Value(Nan::To<v8::String>(args[0]).ToLocalChecked()));
|
||||
engine_config->storage_config =
|
||||
osrm::StorageConfig(*Nan::Utf8String(Nan::To<v8::String>(args[0]).ToLocalChecked()));
|
||||
engine_config->use_shared_memory = false;
|
||||
return engine_config;
|
||||
}
|
||||
@ -155,7 +155,7 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
|
||||
}
|
||||
|
||||
engine_config->memory_file =
|
||||
*v8::String::Utf8Value(Nan::To<v8::String>(memory_file).ToLocalChecked());
|
||||
*Nan::Utf8String(Nan::To<v8::String>(memory_file).ToLocalChecked());
|
||||
}
|
||||
|
||||
auto dataset_name = params->Get(Nan::New("dataset_name").ToLocalChecked());
|
||||
@ -166,7 +166,7 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
|
||||
if (dataset_name->IsString())
|
||||
{
|
||||
engine_config->dataset_name =
|
||||
*v8::String::Utf8Value(Nan::To<v8::String>(dataset_name).ToLocalChecked());
|
||||
*Nan::Utf8String(Nan::To<v8::String>(dataset_name).ToLocalChecked());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -178,7 +178,7 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
|
||||
if (!path->IsUndefined())
|
||||
{
|
||||
engine_config->storage_config =
|
||||
osrm::StorageConfig(*v8::String::Utf8Value(Nan::To<v8::String>(path).ToLocalChecked()));
|
||||
osrm::StorageConfig(*Nan::Utf8String(Nan::To<v8::String>(path).ToLocalChecked()));
|
||||
|
||||
engine_config->use_shared_memory = false;
|
||||
}
|
||||
@ -221,15 +221,15 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
|
||||
if (algorithm->IsString())
|
||||
{
|
||||
auto algorithm_str = Nan::To<v8::String>(algorithm).ToLocalChecked();
|
||||
if (*v8::String::Utf8Value(algorithm_str) == std::string("CH"))
|
||||
if (*Nan::Utf8String(algorithm_str) == std::string("CH"))
|
||||
{
|
||||
engine_config->algorithm = osrm::EngineConfig::Algorithm::CH;
|
||||
}
|
||||
else if (*v8::String::Utf8Value(algorithm_str) == std::string("CoreCH"))
|
||||
else if (*Nan::Utf8String(algorithm_str) == std::string("CoreCH"))
|
||||
{
|
||||
engine_config->algorithm = osrm::EngineConfig::Algorithm::CH;
|
||||
}
|
||||
else if (*v8::String::Utf8Value(algorithm_str) == std::string("MLD"))
|
||||
else if (*Nan::Utf8String(algorithm_str) == std::string("MLD"))
|
||||
{
|
||||
engine_config->algorithm = osrm::EngineConfig::Algorithm::MLD;
|
||||
}
|
||||
@ -290,23 +290,22 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
|
||||
}
|
||||
|
||||
if (max_locations_trip->IsNumber())
|
||||
engine_config->max_locations_trip = static_cast<int>(max_locations_trip->NumberValue());
|
||||
engine_config->max_locations_trip = Nan::To<int>(max_locations_trip).FromJust();
|
||||
if (max_locations_viaroute->IsNumber())
|
||||
engine_config->max_locations_viaroute =
|
||||
static_cast<int>(max_locations_viaroute->NumberValue());
|
||||
engine_config->max_locations_viaroute = Nan::To<int>(max_locations_viaroute).FromJust();
|
||||
if (max_locations_distance_table->IsNumber())
|
||||
engine_config->max_locations_distance_table =
|
||||
static_cast<int>(max_locations_distance_table->NumberValue());
|
||||
Nan::To<int>(max_locations_distance_table).FromJust();
|
||||
if (max_locations_map_matching->IsNumber())
|
||||
engine_config->max_locations_map_matching =
|
||||
static_cast<int>(max_locations_map_matching->NumberValue());
|
||||
Nan::To<int>(max_locations_map_matching).FromJust();
|
||||
if (max_results_nearest->IsNumber())
|
||||
engine_config->max_results_nearest = static_cast<int>(max_results_nearest->NumberValue());
|
||||
engine_config->max_results_nearest = Nan::To<int>(max_results_nearest).FromJust();
|
||||
if (max_alternatives->IsNumber())
|
||||
engine_config->max_alternatives = static_cast<int>(max_alternatives->NumberValue());
|
||||
engine_config->max_alternatives = Nan::To<int>(max_alternatives).FromJust();
|
||||
if (max_radius_map_matching->IsNumber())
|
||||
engine_config->max_radius_map_matching =
|
||||
static_cast<double>(max_radius_map_matching->NumberValue());
|
||||
Nan::To<double>(max_radius_map_matching).FromJust();
|
||||
|
||||
return engine_config;
|
||||
}
|
||||
@ -343,8 +342,8 @@ parseCoordinateArray(const v8::Local<v8::Array> &coordinates_array)
|
||||
return resulting_coordinates;
|
||||
}
|
||||
|
||||
double lon = coordinate_pair->Get(0)->NumberValue();
|
||||
double lat = coordinate_pair->Get(1)->NumberValue();
|
||||
double lon = Nan::To<double>(coordinate_pair->Get(0)).FromJust();
|
||||
double lat = Nan::To<double>(coordinate_pair->Get(1)).FromJust();
|
||||
|
||||
if (std::isnan(lon) || std::isnan(lat) || std::isinf(lon) || std::isinf(lat))
|
||||
{
|
||||
@ -430,7 +429,7 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
return false;
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("approaches").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("approaches").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> approaches = obj->Get(Nan::New("approaches").ToLocalChecked());
|
||||
if (approaches.IsEmpty())
|
||||
@ -487,7 +486,7 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("bearings").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("bearings").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> bearings = obj->Get(Nan::New("bearings").ToLocalChecked());
|
||||
if (bearings.IsEmpty())
|
||||
@ -528,8 +527,8 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto bearing = static_cast<short>(bearing_pair->Get(0)->NumberValue());
|
||||
const auto range = static_cast<short>(bearing_pair->Get(1)->NumberValue());
|
||||
const auto bearing = Nan::To<int>(bearing_pair->Get(0)).FromJust();
|
||||
const auto range = Nan::To<int>(bearing_pair->Get(1)).FromJust();
|
||||
|
||||
if (bearing < 0 || bearing > 360 || range < 0 || range > 180)
|
||||
{
|
||||
@ -537,7 +536,8 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
return false;
|
||||
}
|
||||
|
||||
params->bearings.push_back(osrm::Bearing{bearing, range});
|
||||
params->bearings.push_back(
|
||||
osrm::Bearing{static_cast<short>(bearing), static_cast<short>(range)});
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -553,7 +553,7 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("hints").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("hints").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> hints = obj->Get(Nan::New("hints").ToLocalChecked());
|
||||
if (hints.IsEmpty())
|
||||
@ -581,14 +581,13 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
|
||||
if (hint->IsString())
|
||||
{
|
||||
if (hint->ToString()->Length() == 0)
|
||||
if (Nan::To<v8::String>(hint).ToLocalChecked()->Length() == 0)
|
||||
{
|
||||
Nan::ThrowError("Hint cannot be an empty string");
|
||||
return false;
|
||||
}
|
||||
|
||||
params->hints.push_back(
|
||||
osrm::engine::Hint::FromBase64(*v8::String::Utf8Value(hint)));
|
||||
params->hints.push_back(osrm::engine::Hint::FromBase64(*Nan::Utf8String(hint)));
|
||||
}
|
||||
else if (hint->IsNull())
|
||||
{
|
||||
@ -602,7 +601,7 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("radiuses").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("radiuses").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> radiuses = obj->Get(Nan::New("radiuses").ToLocalChecked());
|
||||
if (radiuses.IsEmpty())
|
||||
@ -632,9 +631,9 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
{
|
||||
params->radiuses.emplace_back();
|
||||
}
|
||||
else if (radius->IsNumber() && radius->NumberValue() >= 0)
|
||||
else if (radius->IsNumber() && Nan::To<double>(radius).FromJust() >= 0)
|
||||
{
|
||||
params->radiuses.push_back(static_cast<double>(radius->NumberValue()));
|
||||
params->radiuses.push_back(Nan::To<double>(radius).FromJust());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -644,7 +643,7 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("generate_hints").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("generate_hints").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> generate_hints = obj->Get(Nan::New("generate_hints").ToLocalChecked());
|
||||
if (generate_hints.IsEmpty())
|
||||
@ -656,10 +655,10 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
return false;
|
||||
}
|
||||
|
||||
params->generate_hints = generate_hints->BooleanValue();
|
||||
params->generate_hints = Nan::To<bool>(generate_hints).FromJust();
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("exclude").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("exclude").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> exclude = obj->Get(Nan::New("exclude").ToLocalChecked());
|
||||
if (exclude.IsEmpty())
|
||||
@ -681,7 +680,7 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
|
||||
if (class_name->IsString())
|
||||
{
|
||||
std::string class_name_str = *v8::String::Utf8Value(class_name);
|
||||
std::string class_name_str = *Nan::Utf8String(class_name);
|
||||
params->exclude.emplace_back(class_name_str);
|
||||
}
|
||||
else
|
||||
@ -698,7 +697,7 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
template <typename ParamType>
|
||||
inline bool parseCommonParameters(const v8::Local<v8::Object> &obj, ParamType ¶ms)
|
||||
{
|
||||
if (obj->Has(Nan::New("steps").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("steps").ToLocalChecked()).FromJust())
|
||||
{
|
||||
auto steps = obj->Get(Nan::New("steps").ToLocalChecked());
|
||||
if (steps.IsEmpty())
|
||||
@ -706,7 +705,7 @@ inline bool parseCommonParameters(const v8::Local<v8::Object> &obj, ParamType &p
|
||||
|
||||
if (steps->IsBoolean())
|
||||
{
|
||||
params->steps = steps->BooleanValue();
|
||||
params->steps = Nan::To<bool>(steps).FromJust();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -715,7 +714,7 @@ inline bool parseCommonParameters(const v8::Local<v8::Object> &obj, ParamType &p
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("annotations").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("annotations").ToLocalChecked()).FromJust())
|
||||
{
|
||||
auto annotations = obj->Get(Nan::New("annotations").ToLocalChecked());
|
||||
if (annotations.IsEmpty())
|
||||
@ -723,7 +722,7 @@ inline bool parseCommonParameters(const v8::Local<v8::Object> &obj, ParamType &p
|
||||
|
||||
if (annotations->IsBoolean())
|
||||
{
|
||||
params->annotations = annotations->BooleanValue();
|
||||
params->annotations = Nan::To<bool>(annotations).FromJust();
|
||||
}
|
||||
else if (annotations->IsArray())
|
||||
{
|
||||
@ -778,7 +777,7 @@ inline bool parseCommonParameters(const v8::Local<v8::Object> &obj, ParamType &p
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("geometries").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("geometries").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> geometries = obj->Get(Nan::New("geometries").ToLocalChecked());
|
||||
if (geometries.IsEmpty())
|
||||
@ -812,7 +811,7 @@ inline bool parseCommonParameters(const v8::Local<v8::Object> &obj, ParamType &p
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("overview").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("overview").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> overview = obj->Get(Nan::New("overview").ToLocalChecked());
|
||||
if (overview.IsEmpty())
|
||||
@ -857,7 +856,7 @@ argumentsToPluginParameters(const Nan::FunctionCallbackInfo<v8::Value> &args)
|
||||
return {};
|
||||
}
|
||||
v8::Local<v8::Object> obj = Nan::To<v8::Object>(args[1]).ToLocalChecked();
|
||||
if (obj->Has(Nan::New("format").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("format").ToLocalChecked()).FromJust())
|
||||
{
|
||||
|
||||
v8::Local<v8::Value> format = obj->Get(Nan::New("format").ToLocalChecked());
|
||||
@ -904,7 +903,7 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
|
||||
v8::Local<v8::Object> obj = Nan::To<v8::Object>(args[0]).ToLocalChecked();
|
||||
|
||||
if (obj->Has(Nan::New("continue_straight").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("continue_straight").ToLocalChecked()).FromJust())
|
||||
{
|
||||
auto value = obj->Get(Nan::New("continue_straight").ToLocalChecked());
|
||||
if (value.IsEmpty())
|
||||
@ -917,11 +916,11 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
}
|
||||
if (value->IsBoolean())
|
||||
{
|
||||
params->continue_straight = value->BooleanValue();
|
||||
params->continue_straight = Nan::To<bool>(value).FromJust();
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("alternatives").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("alternatives").ToLocalChecked()).FromJust())
|
||||
{
|
||||
auto value = obj->Get(Nan::New("alternatives").ToLocalChecked());
|
||||
if (value.IsEmpty())
|
||||
@ -929,13 +928,13 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
|
||||
if (value->IsBoolean())
|
||||
{
|
||||
params->alternatives = value->BooleanValue();
|
||||
params->number_of_alternatives = value->BooleanValue() ? 1u : 0u;
|
||||
params->alternatives = Nan::To<bool>(value).FromJust();
|
||||
params->number_of_alternatives = Nan::To<bool>(value).FromJust() ? 1u : 0u;
|
||||
}
|
||||
else if (value->IsNumber())
|
||||
{
|
||||
params->alternatives = value->BooleanValue();
|
||||
params->number_of_alternatives = static_cast<unsigned>(value->NumberValue());
|
||||
params->alternatives = Nan::To<bool>(value).FromJust();
|
||||
params->number_of_alternatives = Nan::To<unsigned>(value).FromJust();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -944,7 +943,7 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("waypoints").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("waypoints").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> waypoints = obj->Get(Nan::New("waypoints").ToLocalChecked());
|
||||
if (waypoints.IsEmpty())
|
||||
@ -994,7 +993,7 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
Nan::ThrowError("Waypoints must correspond with the index of an input coordinate");
|
||||
return route_parameters_ptr();
|
||||
}
|
||||
params->waypoints.emplace_back(static_cast<unsigned>(waypoint_value->NumberValue()));
|
||||
params->waypoints.emplace_back(Nan::To<unsigned>(waypoint_value).FromJust());
|
||||
}
|
||||
|
||||
if (!params->waypoints.empty())
|
||||
@ -1010,7 +1009,7 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("snapping").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("snapping").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> snapping = obj->Get(Nan::New("snapping").ToLocalChecked());
|
||||
if (snapping.IsEmpty())
|
||||
@ -1095,9 +1094,9 @@ argumentsToTileParameters(const Nan::FunctionCallbackInfo<v8::Value> &args, bool
|
||||
return tile_parameters_ptr();
|
||||
}
|
||||
|
||||
params->x = x->Uint32Value();
|
||||
params->y = y->Uint32Value();
|
||||
params->z = z->Uint32Value();
|
||||
params->x = Nan::To<uint32_t>(x).FromJust();
|
||||
params->y = Nan::To<uint32_t>(y).FromJust();
|
||||
params->z = Nan::To<uint32_t>(z).FromJust();
|
||||
|
||||
if (!params->IsValid())
|
||||
{
|
||||
@ -1121,7 +1120,7 @@ argumentsToNearestParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
if (obj.IsEmpty())
|
||||
return nearest_parameters_ptr();
|
||||
|
||||
if (obj->Has(Nan::New("number").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("number").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> number = obj->Get(Nan::New("number").ToLocalChecked());
|
||||
|
||||
@ -1132,7 +1131,7 @@ argumentsToNearestParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned number_value = static_cast<unsigned>(number->NumberValue());
|
||||
unsigned number_value = Nan::To<unsigned>(number).FromJust();
|
||||
|
||||
if (number_value < 1)
|
||||
{
|
||||
@ -1140,7 +1139,7 @@ argumentsToNearestParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
return nearest_parameters_ptr();
|
||||
}
|
||||
|
||||
params->number_of_results = static_cast<unsigned>(number->NumberValue());
|
||||
params->number_of_results = Nan::To<unsigned>(number).FromJust();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1160,7 +1159,7 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
if (obj.IsEmpty())
|
||||
return table_parameters_ptr();
|
||||
|
||||
if (obj->Has(Nan::New("sources").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("sources").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> sources = obj->Get(Nan::New("sources").ToLocalChecked());
|
||||
if (sources.IsEmpty())
|
||||
@ -1181,7 +1180,7 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
|
||||
if (source->IsUint32())
|
||||
{
|
||||
size_t source_value = static_cast<size_t>(source->NumberValue());
|
||||
size_t source_value = Nan::To<unsigned>(source).FromJust();
|
||||
if (source_value > params->coordinates.size())
|
||||
{
|
||||
Nan::ThrowError(
|
||||
@ -1189,7 +1188,7 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
return table_parameters_ptr();
|
||||
}
|
||||
|
||||
params->sources.push_back(static_cast<size_t>(source->NumberValue()));
|
||||
params->sources.push_back(Nan::To<unsigned>(source).FromJust());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1199,7 +1198,7 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("destinations").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("destinations").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> destinations = obj->Get(Nan::New("destinations").ToLocalChecked());
|
||||
if (destinations.IsEmpty())
|
||||
@ -1220,7 +1219,7 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
|
||||
if (destination->IsUint32())
|
||||
{
|
||||
size_t destination_value = static_cast<size_t>(destination->NumberValue());
|
||||
size_t destination_value = Nan::To<unsigned>(destination).FromJust();
|
||||
if (destination_value > params->coordinates.size())
|
||||
{
|
||||
Nan::ThrowError("Destination indices must be less than or equal to the number "
|
||||
@ -1228,7 +1227,7 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
return table_parameters_ptr();
|
||||
}
|
||||
|
||||
params->destinations.push_back(static_cast<size_t>(destination->NumberValue()));
|
||||
params->destinations.push_back(Nan::To<unsigned>(destination).FromJust());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1238,7 +1237,7 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("annotations").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("annotations").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> annotations = obj->Get(Nan::New("annotations").ToLocalChecked());
|
||||
if (annotations.IsEmpty())
|
||||
@ -1278,7 +1277,7 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("fallback_speed").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("fallback_speed").ToLocalChecked()).FromJust())
|
||||
{
|
||||
auto fallback_speed = obj->Get(Nan::New("fallback_speed").ToLocalChecked());
|
||||
|
||||
@ -1287,16 +1286,16 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
Nan::ThrowError("fallback_speed must be a number");
|
||||
return table_parameters_ptr();
|
||||
}
|
||||
else if (fallback_speed->NumberValue() <= 0)
|
||||
else if (Nan::To<double>(fallback_speed).FromJust() <= 0)
|
||||
{
|
||||
Nan::ThrowError("fallback_speed must be > 0");
|
||||
return table_parameters_ptr();
|
||||
}
|
||||
|
||||
params->fallback_speed = static_cast<double>(fallback_speed->NumberValue());
|
||||
params->fallback_speed = Nan::To<double>(fallback_speed).FromJust();
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("fallback_coordinate").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("fallback_coordinate").ToLocalChecked()).FromJust())
|
||||
{
|
||||
auto fallback_coordinate = obj->Get(Nan::New("fallback_coordinate").ToLocalChecked());
|
||||
|
||||
@ -1306,7 +1305,7 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
return table_parameters_ptr();
|
||||
}
|
||||
|
||||
std::string fallback_coordinate_str = *v8::String::Utf8Value(fallback_coordinate);
|
||||
std::string fallback_coordinate_str = *Nan::Utf8String(fallback_coordinate);
|
||||
|
||||
if (fallback_coordinate_str == "snapped")
|
||||
{
|
||||
@ -1324,7 +1323,7 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("scale_factor").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("scale_factor").ToLocalChecked()).FromJust())
|
||||
{
|
||||
auto scale_factor = obj->Get(Nan::New("scale_factor").ToLocalChecked());
|
||||
|
||||
@ -1333,13 +1332,13 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
Nan::ThrowError("scale_factor must be a number");
|
||||
return table_parameters_ptr();
|
||||
}
|
||||
else if (scale_factor->NumberValue() <= 0)
|
||||
else if (Nan::To<double>(scale_factor).FromJust() <= 0)
|
||||
{
|
||||
Nan::ThrowError("scale_factor must be > 0");
|
||||
return table_parameters_ptr();
|
||||
}
|
||||
|
||||
params->scale_factor = static_cast<double>(scale_factor->NumberValue());
|
||||
params->scale_factor = Nan::To<double>(scale_factor).FromJust();
|
||||
}
|
||||
|
||||
return params;
|
||||
@ -1362,7 +1361,7 @@ argumentsToTripParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
return trip_parameters_ptr();
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("roundtrip").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("roundtrip").ToLocalChecked()).FromJust())
|
||||
{
|
||||
auto roundtrip = obj->Get(Nan::New("roundtrip").ToLocalChecked());
|
||||
if (roundtrip.IsEmpty())
|
||||
@ -1370,7 +1369,7 @@ argumentsToTripParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
|
||||
if (roundtrip->IsBoolean())
|
||||
{
|
||||
params->roundtrip = roundtrip->BooleanValue();
|
||||
params->roundtrip = Nan::To<bool>(roundtrip).FromJust();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1379,7 +1378,7 @@ argumentsToTripParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("source").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("source").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> source = obj->Get(Nan::New("source").ToLocalChecked());
|
||||
if (source.IsEmpty())
|
||||
@ -1391,7 +1390,7 @@ argumentsToTripParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
return trip_parameters_ptr();
|
||||
}
|
||||
|
||||
std::string source_str = *v8::String::Utf8Value(source);
|
||||
std::string source_str = *Nan::Utf8String(source);
|
||||
|
||||
if (source_str == "first")
|
||||
{
|
||||
@ -1408,7 +1407,7 @@ argumentsToTripParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("destination").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("destination").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> destination = obj->Get(Nan::New("destination").ToLocalChecked());
|
||||
if (destination.IsEmpty())
|
||||
@ -1420,7 +1419,7 @@ argumentsToTripParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
return trip_parameters_ptr();
|
||||
}
|
||||
|
||||
std::string destination_str = *v8::String::Utf8Value(destination);
|
||||
std::string destination_str = *Nan::Utf8String(destination);
|
||||
|
||||
if (destination_str == "last")
|
||||
{
|
||||
@ -1451,7 +1450,7 @@ argumentsToMatchParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
|
||||
v8::Local<v8::Object> obj = Nan::To<v8::Object>(args[0]).ToLocalChecked();
|
||||
|
||||
if (obj->Has(Nan::New("timestamps").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("timestamps").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> timestamps = obj->Get(Nan::New("timestamps").ToLocalChecked());
|
||||
if (timestamps.IsEmpty())
|
||||
@ -1483,11 +1482,11 @@ argumentsToMatchParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
Nan::ThrowError("Timestamps array items must be numbers");
|
||||
return match_parameters_ptr();
|
||||
}
|
||||
params->timestamps.emplace_back(static_cast<std::size_t>(timestamp->NumberValue()));
|
||||
params->timestamps.emplace_back(Nan::To<unsigned>(timestamp).FromJust());
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("gaps").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("gaps").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> gaps = obj->Get(Nan::New("gaps").ToLocalChecked());
|
||||
if (gaps.IsEmpty())
|
||||
@ -1517,7 +1516,7 @@ argumentsToMatchParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("tidy").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("tidy").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> tidy = obj->Get(Nan::New("tidy").ToLocalChecked());
|
||||
if (tidy.IsEmpty())
|
||||
@ -1529,10 +1528,10 @@ argumentsToMatchParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
return match_parameters_ptr();
|
||||
}
|
||||
|
||||
params->tidy = tidy->BooleanValue();
|
||||
params->tidy = Nan::To<bool>(tidy).FromJust();
|
||||
}
|
||||
|
||||
if (obj->Has(Nan::New("waypoints").ToLocalChecked()))
|
||||
if (Nan::Has(obj, Nan::New("waypoints").ToLocalChecked()).FromJust())
|
||||
{
|
||||
v8::Local<v8::Value> waypoints = obj->Get(Nan::New("waypoints").ToLocalChecked());
|
||||
if (waypoints.IsEmpty())
|
||||
@ -1582,7 +1581,8 @@ argumentsToMatchParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
Nan::ThrowError("Waypoints must correspond with the index of an input coordinate");
|
||||
return match_parameters_ptr();
|
||||
}
|
||||
params->waypoints.emplace_back(static_cast<unsigned>(waypoint_value->NumberValue()));
|
||||
params->waypoints.emplace_back(
|
||||
static_cast<unsigned>(Nan::To<unsigned>(waypoint_value).FromJust()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,6 +152,10 @@ struct BaseParametersGrammar : boost::spirit::qi::grammar<Iterator, Signature>
|
||||
qi::lit("generate_hints=") >
|
||||
qi::bool_[ph::bind(&engine::api::BaseParameters::generate_hints, qi::_r1) = qi::_1];
|
||||
|
||||
skip_waypoints_rule =
|
||||
qi::lit("skip_waypoints=") >
|
||||
qi::bool_[ph::bind(&engine::api::BaseParameters::skip_waypoints, qi::_r1) = qi::_1];
|
||||
|
||||
bearings_rule =
|
||||
qi::lit("bearings=") >
|
||||
(-(qi::short_ > ',' > qi::short_))[ph::bind(add_bearing, qi::_r1, qi::_1)] % ';';
|
||||
@ -183,6 +187,7 @@ struct BaseParametersGrammar : boost::spirit::qi::grammar<Iterator, Signature>
|
||||
| hints_rule(qi::_r1) //
|
||||
| bearings_rule(qi::_r1) //
|
||||
| generate_hints_rule(qi::_r1) //
|
||||
| skip_waypoints_rule(qi::_r1) //
|
||||
| approach_rule(qi::_r1) //
|
||||
| exclude_rule(qi::_r1) //
|
||||
| snapping_rule(qi::_r1);
|
||||
@ -203,6 +208,7 @@ struct BaseParametersGrammar : boost::spirit::qi::grammar<Iterator, Signature>
|
||||
qi::rule<Iterator, Signature> hints_rule;
|
||||
|
||||
qi::rule<Iterator, Signature> generate_hints_rule;
|
||||
qi::rule<Iterator, Signature> skip_waypoints_rule;
|
||||
qi::rule<Iterator, Signature> approach_rule;
|
||||
qi::rule<Iterator, Signature> exclude_rule;
|
||||
|
||||
|
@ -61,7 +61,6 @@ class RequestParser
|
||||
header_line_start,
|
||||
header_lws,
|
||||
header_name,
|
||||
space_before_header_value,
|
||||
header_value,
|
||||
expecting_newline_2,
|
||||
expecting_newline_3
|
||||
|
35
include/storage/io.hpp
Normal file → Executable file
35
include/storage/io.hpp
Normal file → Executable file
@ -10,6 +10,7 @@
|
||||
#include "util/log.hpp"
|
||||
#include "util/version.hpp"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/iostreams/device/array.hpp>
|
||||
#include <boost/iostreams/seek.hpp>
|
||||
@ -60,29 +61,27 @@ class FileReader
|
||||
|
||||
std::size_t GetSize()
|
||||
{
|
||||
const boost::filesystem::ifstream::pos_type position = input_stream.tellg();
|
||||
input_stream.seekg(0, std::ios::end);
|
||||
const boost::filesystem::ifstream::pos_type file_size = input_stream.tellg();
|
||||
|
||||
if (file_size == boost::filesystem::ifstream::pos_type(-1))
|
||||
const boost::filesystem::path path(filepath);
|
||||
try
|
||||
{
|
||||
throw util::RuntimeError("Unable to determine file size for " +
|
||||
std::string(filepath.string()),
|
||||
ErrorCode::FileIOError,
|
||||
SOURCE_REF,
|
||||
std::strerror(errno));
|
||||
return std::size_t(boost::filesystem::file_size(path)) -
|
||||
((fingerprint == FingerprintFlag::VerifyFingerprint) ? sizeof(util::FingerPrint)
|
||||
: 0);
|
||||
}
|
||||
catch (const boost::filesystem::filesystem_error &ex)
|
||||
{
|
||||
std::cout << ex.what() << std::endl;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// restore the current position
|
||||
input_stream.seekg(position, std::ios::beg);
|
||||
|
||||
if (fingerprint == FingerprintFlag::VerifyFingerprint)
|
||||
/* Read one line */
|
||||
template <typename T> void ReadLine(T *dest, const std::size_t count)
|
||||
{
|
||||
return std::size_t(file_size) - sizeof(util::FingerPrint);
|
||||
}
|
||||
else
|
||||
if (0 < count)
|
||||
{
|
||||
return file_size;
|
||||
memset(dest, 0, count * sizeof(T));
|
||||
input_stream.getline(reinterpret_cast<char *>(dest), count * sizeof(T));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,10 +17,6 @@
|
||||
#include <cstdint>
|
||||
#include <tuple>
|
||||
|
||||
#if USE_STXXL_LIBRARY
|
||||
#include <stxxl/vector>
|
||||
#endif
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace storage
|
||||
@ -134,24 +130,6 @@ inline void write(storage::tar::FileWriter &writer,
|
||||
writer.WriteStreaming<T>(name, vec.begin(), vec.size());
|
||||
}
|
||||
|
||||
#if USE_STXXL_LIBRARY
|
||||
template <typename T>
|
||||
inline void read(storage::tar::FileReader &reader, const std::string &name, stxxl::vector<T> &vec)
|
||||
{
|
||||
auto size = reader.ReadElementCount64(name);
|
||||
vec.reserve(size);
|
||||
reader.ReadStreaming<T>(name, std::back_inserter(vec), size);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void
|
||||
write(storage::tar::FileWriter &writer, const std::string &name, const stxxl::vector<T> &vec)
|
||||
{
|
||||
writer.WriteElementCount64(name, vec.size());
|
||||
writer.WriteStreaming<T>(name, vec.begin(), vec.size());
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename T> void read(io::BufferReader &reader, std::vector<T> &data)
|
||||
{
|
||||
const auto count = reader.ReadElementCount64();
|
||||
|
@ -122,7 +122,7 @@ template <typename Key, typename Value> struct CSVFilesParser
|
||||
|
||||
util::Log() << "Loaded " << filename << " with " << result.size() << "values";
|
||||
|
||||
return std::move(result);
|
||||
return result;
|
||||
}
|
||||
catch (const boost::exception &e)
|
||||
{
|
||||
|
@ -7,29 +7,11 @@
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#if USE_STXXL_LIBRARY
|
||||
#include <stxxl/mng>
|
||||
#endif
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
|
||||
inline void DumpSTXXLStats()
|
||||
{
|
||||
#if USE_STXXL_LIBRARY
|
||||
#if STXXL_VERSION_MAJOR > 1 || (STXXL_VERSION_MAJOR == 1 && STXXL_VERSION_MINOR >= 4)
|
||||
auto manager = stxxl::block_manager::get_instance();
|
||||
util::Log() << "STXXL: peak bytes used: " << manager->get_maximum_allocation();
|
||||
util::Log() << "STXXL: total disk allocated: " << manager->get_total_bytes();
|
||||
#else
|
||||
#warning STXXL 1.4+ recommended - STXXL memory summary will not be available
|
||||
util::Log() << "STXXL: memory summary not available, needs STXXL 1.4 or higher";
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void DumpMemoryStats()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
|
@ -19,10 +19,6 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#if USE_STXXL_LIBRARY
|
||||
#include <stxxl/vector>
|
||||
#endif
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace util
|
||||
@ -253,16 +249,10 @@ template <typename DataT> void swap(vector_view<DataT> &lhs, vector_view<DataT>
|
||||
std::swap(lhs.m_size, rhs.m_size);
|
||||
}
|
||||
|
||||
#if USE_STXXL_LIBRARY
|
||||
template <typename T> using ExternalVector = stxxl::vector<T>;
|
||||
#else
|
||||
template <typename T> using ExternalVector = std::vector<T>;
|
||||
#endif
|
||||
|
||||
template <typename DataT, storage::Ownership Ownership>
|
||||
using InternalOrExternalVector =
|
||||
typename std::conditional<Ownership == storage::Ownership::External,
|
||||
ExternalVector<DataT>,
|
||||
std::vector<DataT>,
|
||||
std::vector<DataT>>::type;
|
||||
|
||||
template <typename DataT, storage::Ownership Ownership>
|
||||
|
10
package-lock.json
generated
10
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "osrm",
|
||||
"version": "5.20.0-latest.1",
|
||||
"version": "5.22.0-customsnapping.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -1740,6 +1740,7 @@
|
||||
"resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz",
|
||||
"integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"inherits": "~2.0.0"
|
||||
}
|
||||
@ -5567,6 +5568,7 @@
|
||||
"resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz",
|
||||
"integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
"inherits": "~2.0.0",
|
||||
@ -7646,9 +7648,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"nan": {
|
||||
"version": "2.11.1",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.11.1.tgz",
|
||||
"integrity": "sha512-iji6k87OSXa0CcrLl9z+ZiYSuR2o+c0bGuNmXdrhTQTakxytAFsC56SArGYoiHlJlFoHSnvmhpceZJaXkVuOtA=="
|
||||
"version": "2.14.1",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
|
||||
"integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw=="
|
||||
},
|
||||
"natural-compare": {
|
||||
"version": "1.4.0",
|
||||
|
@ -5,7 +5,7 @@
|
||||
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
|
||||
"dependencies": {
|
||||
"mkdirp": "^0.5.1",
|
||||
"nan": "^2.11.1",
|
||||
"nan": "^2.14.1",
|
||||
"node-cmake": "^2.3.2",
|
||||
"node-pre-gyp": "^0.12.0",
|
||||
"rimraf": "^2.5.4"
|
||||
|
@ -56,7 +56,13 @@ function setup()
|
||||
'private',
|
||||
'agricultural',
|
||||
'forestry',
|
||||
'delivery'
|
||||
'delivery',
|
||||
-- When a way is tagged with `use_sidepath` a parallel way suitable for
|
||||
-- cyclists is mapped and must be used instead (by law). This tag is
|
||||
-- used on ways that normally may be used by cyclists, but not when
|
||||
-- a signposted parallel cycleway is available. For purposes of routing
|
||||
-- cyclists, this value should be treated as 'no access for bicycles'.
|
||||
'use_sidepath'
|
||||
},
|
||||
|
||||
restricted_access_tag_list = Set { },
|
||||
|
@ -38,7 +38,7 @@ local way = {
|
||||
local result = {}
|
||||
|
||||
-- call the way function
|
||||
Debug.way_function(way,result)
|
||||
Debug.process_way(way,result)
|
||||
|
||||
-- print input and output
|
||||
pprint(way)
|
||||
|
@ -10,7 +10,7 @@ local pprint = require('lib/pprint')
|
||||
|
||||
-- globals that are normally set from C++
|
||||
|
||||
-- should match values defined in include/extractor/guidance/road_classification.hpp
|
||||
-- should match values defined in include/extractor/road_classification.hpp
|
||||
road_priority_class = {
|
||||
motorway = 0,
|
||||
trunk = 2,
|
||||
|
@ -15,7 +15,7 @@ local pprint = require('lib/pprint')
|
||||
-- profiles code modifies this table
|
||||
properties = {}
|
||||
|
||||
-- should match values defined in include/extractor/guidance/road_classification.hpp
|
||||
-- should match values defined in include/extractor/road_classification.hpp
|
||||
road_priority_class = {
|
||||
motorway = 0,
|
||||
trunk = 2,
|
||||
|
@ -18,11 +18,3 @@ sudo apt-get update -qq --yes || true
|
||||
|
||||
sudo apt-get install -qq --yes --force-yes g++-4.8-arm-linux-gnueabihf g++-4.8-multilib-arm-linux-gnueabihf gcc-4.8-arm-linux-gnueabihf gcc-4.8-multilib-arm-linux-gnueabihf
|
||||
sudo apt-get install -qq --yes --force-yes libexpat1-dev:armhf zlib1g-dev:armhf libbz2-dev:armhf libboost-date-time-dev:armhf libboost-filesystem-dev:armhf libboost-iostreams-dev:armhf libboost-program-options-dev:armhf libboost-regex-dev:armhf libboost-system-dev:armhf libboost-thread-dev:armhf libtbb-dev:armhf libboost-test-dev:armhf
|
||||
|
||||
## build libstxxl1v5:armhf from sources, no package in trusty
|
||||
if [ $UBUNTU_RELEASE == trusty ] ; then
|
||||
( cd /tmp && wget http://sourceforge.net/projects/stxxl/files/stxxl/1.4.1/stxxl-1.4.1.tar.gz && tar xf stxxl-1.4.1.tar.gz )
|
||||
( cd /tmp/stxxl-1.4.1 && mkdir build && cd build && CC=arm-linux-gnueabihf-gcc-4.8 CXX=arm-linux-gnueabihf-g++-4.8 cmake .. && make && sudo make install )
|
||||
else
|
||||
sudo apt-get install -qq --yes --force-yes libstxxl1v5:armhf
|
||||
fi
|
||||
|
@ -3,4 +3,4 @@
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test && ( sudo apt-get update -qq --yes || true )
|
||||
|
||||
sudo apt-get install -qq --yes --force-yes g++-7-multilib libxml2-dev:i386 libexpat1-dev:i386 libzip-dev:i386 libbz2-dev:i386 libstxxl-dev:i386 libtbb-dev:i386 lua5.2:i386 liblua5.2-dev:i386 libboost-date-time-dev:i386 libboost-filesystem-dev:i386 libboost-iostreams-dev:i386 libboost-program-options-dev:i386 libboost-regex-dev:i386 libboost-system-dev:i386 libboost-thread-dev:i386 libboost-test-dev:i386
|
||||
sudo apt-get install -qq --yes --force-yes g++-7-multilib libxml2-dev:i386 libexpat1-dev:i386 libzip-dev:i386 libbz2-dev:i386 libtbb-dev:i386 lua5.2:i386 liblua5.2-dev:i386 libboost-date-time-dev:i386 libboost-filesystem-dev:i386 libboost-iostreams-dev:i386 libboost-program-options-dev:i386 libboost-regex-dev:i386 libboost-system-dev:i386 libboost-thread-dev:i386 libboost-test-dev:i386
|
||||
|
@ -51,8 +51,8 @@ struct Parameters
|
||||
// Alternative paths are still reasonable around the via node candidate (local optimality).
|
||||
// At least optimal around 10% sub-paths around the via node candidate.
|
||||
double kAtLeastOptimalAroundViaBy = 0.1;
|
||||
// Alternative paths similarity requirement (sharing) based on calles.
|
||||
// At least 15% different than the shortest path.
|
||||
// Alternative paths similarity requirement (sharing) based on cells.
|
||||
// At least 5% different than the shortest path.
|
||||
double kCellsAtMostSameBy = 0.95;
|
||||
};
|
||||
|
||||
|
@ -206,12 +206,7 @@ void GraphCompressor::Compress(
|
||||
graph.GetEdgeData(reverse_e2).annotation_data = selectAnnotation(
|
||||
rev_edge_data2.annotation_data, rev_edge_data1.annotation_data);
|
||||
|
||||
/*
|
||||
// Do not compress edge if it crosses a traffic signal.
|
||||
// This can't be done in CanCombineWith, becase we only store the
|
||||
// traffic signals in the `traffic signal` list, which EdgeData
|
||||
// doesn't have access to.
|
||||
*/
|
||||
// Add node penalty when compress edge crosses a traffic signal
|
||||
const bool has_node_penalty = traffic_signals.find(node_v) != traffic_signals.end();
|
||||
EdgeDuration node_duration_penalty = MAXIMAL_EDGE_DURATION;
|
||||
EdgeWeight node_weight_penalty = INVALID_EDGE_WEIGHT;
|
||||
|
@ -92,15 +92,15 @@ int RasterContainer::LoadRasterSource(const std::string &path_string,
|
||||
const auto _ymin = static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{ymin}));
|
||||
const auto _ymax = static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{ymax}));
|
||||
|
||||
const auto itr = LoadedSourcePaths.find(path_string);
|
||||
if (itr != LoadedSourcePaths.end())
|
||||
const auto itr = RasterCache::getInstance().getLoadedSourcePaths().find(path_string);
|
||||
if (itr != RasterCache::getInstance().getLoadedSourcePaths().end())
|
||||
{
|
||||
util::Log() << "[source loader] Already loaded source '" << path_string << "' at source_id "
|
||||
<< itr->second;
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
int source_id = static_cast<int>(LoadedSources.size());
|
||||
int source_id = static_cast<int>(RasterCache::getInstance().getLoadedSources().size());
|
||||
|
||||
util::Log() << "[source loader] Loading from " << path_string << " ... ";
|
||||
TIMER_START(loading_source);
|
||||
@ -116,8 +116,8 @@ int RasterContainer::LoadRasterSource(const std::string &path_string,
|
||||
|
||||
RasterSource source{std::move(rasterData), ncols, nrows, _xmin, _xmax, _ymin, _ymax};
|
||||
TIMER_STOP(loading_source);
|
||||
LoadedSourcePaths.emplace(path_string, source_id);
|
||||
LoadedSources.push_back(std::move(source));
|
||||
RasterCache::getInstance().getLoadedSourcePaths().emplace(path_string, source_id);
|
||||
RasterCache::getInstance().getLoadedSources().push_back(std::move(source));
|
||||
|
||||
util::Log() << "[source loader] ok, after " << TIMER_SEC(loading_source) << "s";
|
||||
|
||||
@ -127,10 +127,11 @@ int RasterContainer::LoadRasterSource(const std::string &path_string,
|
||||
// External function for looking up nearest data point from a specified source
|
||||
RasterDatum RasterContainer::GetRasterDataFromSource(unsigned int source_id, double lon, double lat)
|
||||
{
|
||||
if (LoadedSources.size() < source_id + 1)
|
||||
if (RasterCache::getInstance().getLoadedSources().size() < source_id + 1)
|
||||
{
|
||||
throw util::exception("Attempted to access source " + std::to_string(source_id) +
|
||||
", but there are only " + std::to_string(LoadedSources.size()) +
|
||||
", but there are only " +
|
||||
std::to_string(RasterCache::getInstance().getLoadedSources().size()) +
|
||||
" loaded" + SOURCE_REF);
|
||||
}
|
||||
|
||||
@ -139,7 +140,7 @@ RasterDatum RasterContainer::GetRasterDataFromSource(unsigned int source_id, dou
|
||||
BOOST_ASSERT(lon < 180);
|
||||
BOOST_ASSERT(lon > -180);
|
||||
|
||||
const auto &found = LoadedSources[source_id];
|
||||
const auto &found = RasterCache::getInstance().getLoadedSources()[source_id];
|
||||
return found.GetRasterData(static_cast<std::int32_t>(util::toFixed(util::FloatLongitude{lon})),
|
||||
static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{lat})));
|
||||
}
|
||||
@ -148,10 +149,11 @@ RasterDatum RasterContainer::GetRasterDataFromSource(unsigned int source_id, dou
|
||||
RasterDatum
|
||||
RasterContainer::GetRasterInterpolateFromSource(unsigned int source_id, double lon, double lat)
|
||||
{
|
||||
if (LoadedSources.size() < source_id + 1)
|
||||
if (RasterCache::getInstance().getLoadedSources().size() < source_id + 1)
|
||||
{
|
||||
throw util::exception("Attempted to access source " + std::to_string(source_id) +
|
||||
", but there are only " + std::to_string(LoadedSources.size()) +
|
||||
", but there are only " +
|
||||
std::to_string(RasterCache::getInstance().getLoadedSources().size()) +
|
||||
" loaded" + SOURCE_REF);
|
||||
}
|
||||
|
||||
@ -160,10 +162,12 @@ RasterContainer::GetRasterInterpolateFromSource(unsigned int source_id, double l
|
||||
BOOST_ASSERT(lon < 180);
|
||||
BOOST_ASSERT(lon > -180);
|
||||
|
||||
const auto &found = LoadedSources[source_id];
|
||||
const auto &found = RasterCache::getInstance().getLoadedSources()[source_id];
|
||||
return found.GetRasterInterpolate(
|
||||
static_cast<std::int32_t>(util::toFixed(util::FloatLongitude{lon})),
|
||||
static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{lat})));
|
||||
}
|
||||
|
||||
RasterCache *RasterCache::g_instance = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -45,9 +45,8 @@ boost::optional<ParameterT> parseParameters(std::string::iterator &iter,
|
||||
const auto ok =
|
||||
boost::spirit::qi::parse(iter, end, grammar(boost::phoenix::ref(parameters)));
|
||||
|
||||
// return move(a.b) is needed to move b out of a and then return the rvalue by implicit move
|
||||
if (ok && iter == end)
|
||||
return std::move(parameters);
|
||||
return parameters;
|
||||
}
|
||||
catch (const qi::expectation_failure<It> &failure)
|
||||
{
|
||||
|
@ -68,7 +68,14 @@ void Connection::handle_read(const boost::system::error_code &error, std::size_t
|
||||
// the request has been parsed
|
||||
if (result == RequestParser::RequestStatus::valid)
|
||||
{
|
||||
current_request.endpoint = TCP_socket.remote_endpoint().address();
|
||||
|
||||
boost::system::error_code ec;
|
||||
current_request.endpoint = TCP_socket.remote_endpoint(ec).address();
|
||||
if (ec)
|
||||
{
|
||||
handle_shutdown();
|
||||
return;
|
||||
}
|
||||
request_handler.HandleRequest(current_request, current_reply);
|
||||
|
||||
if (boost::iequals(current_request.connection, "close"))
|
||||
@ -149,6 +156,8 @@ void Connection::handle_write(const boost::system::error_code &error)
|
||||
current_request = http::request();
|
||||
current_reply = http::reply();
|
||||
request_parser = RequestParser();
|
||||
incoming_data_buffer = boost::array<char, 8192>();
|
||||
output_buffer.clear();
|
||||
this->start();
|
||||
}
|
||||
else
|
||||
@ -166,7 +175,8 @@ void Connection::handle_timeout(boost::system::error_code ec)
|
||||
// Absent next request during waiting time in the keepalive mode - should stop right there.
|
||||
if (ec != boost::asio::error::operation_aborted)
|
||||
{
|
||||
TCP_socket.cancel();
|
||||
boost::system::error_code ignore_error;
|
||||
TCP_socket.cancel(ignore_error);
|
||||
handle_shutdown();
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ RequestParser::RequestStatus RequestParser::consume(http::request ¤t_reque
|
||||
case internal_state::header_name:
|
||||
if (input == ':')
|
||||
{
|
||||
state = internal_state::space_before_header_value;
|
||||
state = internal_state::header_value;
|
||||
return RequestStatus::indeterminate;
|
||||
}
|
||||
if (!is_char(input) || is_CTL(input) || is_special(input))
|
||||
@ -226,14 +226,12 @@ RequestParser::RequestStatus RequestParser::consume(http::request ¤t_reque
|
||||
}
|
||||
current_header.name.push_back(input);
|
||||
return RequestStatus::indeterminate;
|
||||
case internal_state::space_before_header_value:
|
||||
case internal_state::header_value:
|
||||
if (input == ' ')
|
||||
{
|
||||
state = internal_state::header_value;
|
||||
return RequestStatus::indeterminate;
|
||||
}
|
||||
return RequestStatus::invalid;
|
||||
case internal_state::header_value:
|
||||
if (input == '\r')
|
||||
{
|
||||
state = internal_state::expecting_newline_2;
|
||||
|
@ -189,21 +189,18 @@ int main(int argc, char *argv[]) try
|
||||
|
||||
osrm::contract(contractor_config);
|
||||
|
||||
util::DumpSTXXLStats();
|
||||
util::DumpMemoryStats();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
catch (const osrm::RuntimeError &e)
|
||||
{
|
||||
util::DumpSTXXLStats();
|
||||
util::DumpMemoryStats();
|
||||
util::Log(logERROR) << e.what();
|
||||
return e.GetCode();
|
||||
}
|
||||
catch (const std::bad_alloc &e)
|
||||
{
|
||||
util::DumpSTXXLStats();
|
||||
util::DumpMemoryStats();
|
||||
util::Log(logERROR) << e.what();
|
||||
util::Log(logERROR) << "Please provide more memory or consider using a larger swapfile";
|
||||
|
@ -186,28 +186,24 @@ int main(int argc, char *argv[]) try
|
||||
|
||||
osrm::extract(extractor_config);
|
||||
|
||||
util::DumpSTXXLStats();
|
||||
util::DumpMemoryStats();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
catch (const osrm::RuntimeError &e)
|
||||
{
|
||||
util::DumpSTXXLStats();
|
||||
util::DumpMemoryStats();
|
||||
util::Log(logERROR) << e.what();
|
||||
return e.GetCode();
|
||||
}
|
||||
catch (const std::system_error &e)
|
||||
{
|
||||
util::DumpSTXXLStats();
|
||||
util::DumpMemoryStats();
|
||||
util::Log(logERROR) << e.what();
|
||||
return e.code().value();
|
||||
}
|
||||
catch (const std::bad_alloc &e)
|
||||
{
|
||||
util::DumpSTXXLStats();
|
||||
util::DumpMemoryStats();
|
||||
util::Log(logERROR) << "[exception] " << e.what();
|
||||
util::Log(logERROR) << "Please provide more memory or consider using a larger swapfile";
|
||||
|
@ -16,7 +16,7 @@ namespace
|
||||
static const char COL_RESET[]{"\x1b[0m"};
|
||||
static const char RED[]{"\x1b[31m"};
|
||||
static const char YELLOW[]{"\x1b[33m"};
|
||||
#ifndef NDEBUG
|
||||
#ifdef ENABLE_DEBUG_LOGGING
|
||||
static const char MAGENTA[]{"\x1b[35m"};
|
||||
#endif
|
||||
// static const char GREEN[] { "\x1b[32m"};
|
||||
@ -80,7 +80,7 @@ Log::Log(LogLevel level_, std::ostream &ostream) : level(level_), stream(ostream
|
||||
stream << (is_terminal ? RED : "") << "[error] ";
|
||||
break;
|
||||
case logDEBUG:
|
||||
#ifndef NDEBUG
|
||||
#ifdef ENABLE_DEBUG_LOGGING
|
||||
stream << (is_terminal ? MAGENTA : "") << "[debug] ";
|
||||
#endif
|
||||
break;
|
||||
@ -126,7 +126,7 @@ Log::~Log()
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
case logDEBUG:
|
||||
#ifdef NDEBUG
|
||||
#ifndef ENABLE_DEBUG_LOGGING
|
||||
break;
|
||||
#endif
|
||||
case logINFO:
|
||||
|
@ -1 +0,0 @@
|
||||
disk=###.stxxl,20,memory
|
@ -1 +0,0 @@
|
||||
disk=/tmp/stxxl_###,200M,syscall autogrow
|
@ -1,6 +1,4 @@
|
||||
DATA_NAME:=monaco
|
||||
DATA_URL:=https://s3.amazonaws.com/mapbox/osrm/testing/$(DATA_NAME).osm.pbf
|
||||
DATA_POLY_URL:=https://s3.amazonaws.com/mapbox/osrm/testing/$(DATA_NAME).poly
|
||||
OSRM_BUILD_DIR?=../../build
|
||||
PROFILE_ROOT:=../../profiles
|
||||
SCRIPT_ROOT:=../../scripts
|
||||
@ -22,12 +20,6 @@ clean:
|
||||
-rm -r $(DATA_NAME).*
|
||||
-rm -r ch corech mld
|
||||
|
||||
$(DATA_NAME).osm.pbf:
|
||||
wget $(DATA_URL) -O $(DATA_NAME).osm.pbf
|
||||
|
||||
$(DATA_NAME).poly:
|
||||
wget $(DATA_POLY_URL) -O $(DATA_NAME).poly
|
||||
|
||||
ch/$(DATA_NAME).osrm: $(DATA_NAME).osrm
|
||||
mkdir -p ch
|
||||
cp $(DATA_NAME).osrm $(DATA_NAME).osrm.* ch/
|
||||
|
BIN
test/data/monaco.osm.pbf
Normal file
BIN
test/data/monaco.osm.pbf
Normal file
Binary file not shown.
31
test/data/monaco.poly
Normal file
31
test/data/monaco.poly
Normal file
@ -0,0 +1,31 @@
|
||||
none
|
||||
1
|
||||
7.448637E+00 4.373992E+01
|
||||
7.420651E+00 4.372335E+01
|
||||
7.409205E+00 4.372933E+01
|
||||
7.410161E+00 4.373072E+01
|
||||
7.411732E+00 4.373139E+01
|
||||
7.413011E+00 4.373162E+01
|
||||
7.412909E+00 4.373379E+01
|
||||
7.412364E+00 4.373429E+01
|
||||
7.415174E+00 4.373618E+01
|
||||
7.421612E+00 4.374033E+01
|
||||
7.421557E+00 4.374080E+01
|
||||
7.423117E+00 4.374135E+01
|
||||
7.424507E+00 4.374069E+01
|
||||
7.426007E+00 4.374226E+01
|
||||
7.427535E+00 4.374369E+01
|
||||
7.428709E+00 4.374590E+01
|
||||
7.430755E+00 4.374885E+01
|
||||
7.431923E+00 4.374856E+01
|
||||
7.433675E+00 4.374952E+01
|
||||
7.435904E+00 4.374979E+01
|
||||
7.437361E+00 4.375083E+01
|
||||
7.436782E+00 4.375149E+01
|
||||
7.437709E+00 4.375169E+01
|
||||
7.438827E+00 4.375133E+01
|
||||
7.438466E+00 4.374899E+01
|
||||
7.441831E+00 4.374505E+01
|
||||
7.448637E+00 4.373992E+01
|
||||
END
|
||||
END
|
17
third_party/sol2/sol2/sol.hpp
vendored
17
third_party/sol2/sol2/sol.hpp
vendored
@ -3399,7 +3399,9 @@ namespace sol {
|
||||
runtime = LUA_ERRRUN,
|
||||
memory = LUA_ERRMEM,
|
||||
handler = LUA_ERRERR,
|
||||
#if SOL_LUA_VERSION < 504
|
||||
gc = LUA_ERRGCMM,
|
||||
#endif
|
||||
syntax = LUA_ERRSYNTAX,
|
||||
file = LUA_ERRFILE,
|
||||
};
|
||||
@ -3409,7 +3411,9 @@ namespace sol {
|
||||
yielded = LUA_YIELD,
|
||||
runtime = LUA_ERRRUN,
|
||||
memory = LUA_ERRMEM,
|
||||
#if SOL_LUA_VERSION < 504
|
||||
gc = LUA_ERRGCMM,
|
||||
#endif
|
||||
handler = LUA_ERRERR,
|
||||
dead = -1,
|
||||
};
|
||||
@ -3418,7 +3422,9 @@ namespace sol {
|
||||
ok = LUA_OK,
|
||||
syntax = LUA_ERRSYNTAX,
|
||||
memory = LUA_ERRMEM,
|
||||
#if SOL_LUA_VERSION < 504
|
||||
gc = LUA_ERRGCMM,
|
||||
#endif
|
||||
file = LUA_ERRFILE,
|
||||
};
|
||||
|
||||
@ -3462,8 +3468,10 @@ namespace sol {
|
||||
return names[3];
|
||||
case call_status::handler:
|
||||
return names[4];
|
||||
#if SOL_LUA_VERSION < 504
|
||||
case call_status::gc:
|
||||
return names[5];
|
||||
#endif
|
||||
case call_status::syntax:
|
||||
return names[6];
|
||||
case call_status::file:
|
||||
@ -3485,8 +3493,10 @@ namespace sol {
|
||||
return names[0];
|
||||
case load_status::memory:
|
||||
return names[1];
|
||||
#if SOL_LUA_VERSION < 504
|
||||
case load_status::gc:
|
||||
return names[2];
|
||||
#endif
|
||||
case load_status::syntax:
|
||||
return names[3];
|
||||
case load_status::file:
|
||||
@ -14374,9 +14384,12 @@ namespace sol {
|
||||
void luacall(std::ptrdiff_t argcount, std::ptrdiff_t) {
|
||||
#if SOL_LUA_VERSION < 502
|
||||
stats = static_cast<call_status>(lua_resume(lua_state(), static_cast<int>(argcount)));
|
||||
#else
|
||||
#elif SOL_LUA_VERSION < 504
|
||||
stats = static_cast<call_status>(lua_resume(lua_state(), nullptr, static_cast<int>(argcount)));
|
||||
#endif // Lua 5.1 compat
|
||||
#else
|
||||
int nstack = 0;
|
||||
stats = static_cast<call_status>(lua_resume(lua_state(), nullptr, static_cast<int>(argcount), &nstack));
|
||||
#endif
|
||||
}
|
||||
|
||||
template<std::size_t... I, typename... Ret>
|
||||
|
@ -65,6 +65,30 @@ BOOST_AUTO_TEST_CASE(test_match)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_match_skip_waypoints)
|
||||
{
|
||||
using namespace osrm;
|
||||
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
|
||||
MatchParameters params;
|
||||
params.skip_waypoints = true;
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
|
||||
engine::api::ResultT result = json::Object();
|
||||
|
||||
const auto rc = osrm.Match(params, result);
|
||||
|
||||
auto &json_result = result.get<json::Object>();
|
||||
BOOST_CHECK(rc == Status::Ok || rc == Status::Error);
|
||||
const auto code = json_result.values.at("code").get<json::String>().value;
|
||||
BOOST_CHECK_EQUAL(code, "Ok");
|
||||
|
||||
BOOST_CHECK(json_result.values.find("tracepoints") == json_result.values.end());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_match_split)
|
||||
{
|
||||
using namespace osrm;
|
||||
@ -118,4 +142,70 @@ BOOST_AUTO_TEST_CASE(test_match_split)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_match_fb_serialization)
|
||||
{
|
||||
using namespace osrm;
|
||||
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
|
||||
MatchParameters params;
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
|
||||
engine::api::ResultT result = flatbuffers::FlatBufferBuilder();
|
||||
|
||||
const auto rc = osrm.Match(params, result);
|
||||
BOOST_CHECK(rc == Status::Ok);
|
||||
|
||||
auto &fb_result = result.get<flatbuffers::FlatBufferBuilder>();
|
||||
auto fb = engine::api::fbresult::GetFBResult(fb_result.GetBufferPointer());
|
||||
|
||||
BOOST_CHECK(!fb->error());
|
||||
|
||||
BOOST_CHECK(fb->waypoints() != nullptr);
|
||||
const auto waypoints = fb->waypoints();
|
||||
BOOST_CHECK(waypoints->size() == params.coordinates.size());
|
||||
|
||||
BOOST_CHECK(fb->routes() != nullptr);
|
||||
const auto matchings = fb->routes();
|
||||
const auto &number_of_matchings = matchings->size();
|
||||
|
||||
for (const auto &waypoint : *waypoints)
|
||||
{
|
||||
BOOST_CHECK(waypoint_check(waypoint));
|
||||
const auto matchings_index = waypoint->matchings_index();
|
||||
const auto waypoint_index = waypoint->waypoint_index();
|
||||
const auto &route_legs = matchings->operator[](matchings_index)->legs();
|
||||
|
||||
BOOST_CHECK_LT(waypoint_index, route_legs->size() + 1);
|
||||
BOOST_CHECK_LT(matchings_index, number_of_matchings);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_match_fb_serialization_skip_waypoints)
|
||||
{
|
||||
using namespace osrm;
|
||||
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
|
||||
MatchParameters params;
|
||||
params.skip_waypoints = true;
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
|
||||
engine::api::ResultT result = flatbuffers::FlatBufferBuilder();
|
||||
|
||||
const auto rc = osrm.Match(params, result);
|
||||
BOOST_CHECK(rc == Status::Ok);
|
||||
|
||||
auto &fb_result = result.get<flatbuffers::FlatBufferBuilder>();
|
||||
auto fb = engine::api::fbresult::GetFBResult(fb_result.GetBufferPointer());
|
||||
|
||||
BOOST_CHECK(!fb->error());
|
||||
|
||||
BOOST_CHECK(fb->waypoints() == nullptr);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
@ -43,6 +43,27 @@ BOOST_AUTO_TEST_CASE(test_nearest_response)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_nearest_response_skip_waypoints)
|
||||
{
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
|
||||
using namespace osrm;
|
||||
|
||||
NearestParameters params;
|
||||
params.skip_waypoints = true;
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
|
||||
engine::api::ResultT result = json::Object();
|
||||
const auto rc = osrm.Nearest(params, result);
|
||||
BOOST_REQUIRE(rc == Status::Ok);
|
||||
|
||||
auto &json_result = result.get<json::Object>();
|
||||
const auto code = json_result.values.at("code").get<json::String>().value;
|
||||
BOOST_CHECK_EQUAL(code, "Ok");
|
||||
|
||||
BOOST_CHECK(json_result.values.find("waypoints") == json_result.values.end());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_nearest_response_no_coordinates)
|
||||
{
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
@ -118,7 +139,7 @@ BOOST_AUTO_TEST_CASE(test_nearest_response_for_location_in_small_component)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_nearest_fb_serilization)
|
||||
BOOST_AUTO_TEST_CASE(test_nearest_fb_serialization)
|
||||
{
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
|
||||
@ -147,6 +168,27 @@ BOOST_AUTO_TEST_CASE(test_nearest_fb_serilization)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_nearest_fb_serialization_skip_waypoints)
|
||||
{
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
|
||||
using namespace osrm;
|
||||
|
||||
NearestParameters params;
|
||||
params.skip_waypoints = true;
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
|
||||
engine::api::ResultT result = flatbuffers::FlatBufferBuilder();
|
||||
const auto rc = osrm.Nearest(params, result);
|
||||
BOOST_REQUIRE(rc == Status::Ok);
|
||||
|
||||
auto &fb_result = result.get<flatbuffers::FlatBufferBuilder>();
|
||||
auto fb = engine::api::fbresult::GetFBResult(fb_result.GetBufferPointer());
|
||||
BOOST_CHECK(!fb->error());
|
||||
|
||||
BOOST_CHECK(fb->waypoints() == nullptr);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_nearest_fb_error)
|
||||
{
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
|
@ -270,6 +270,53 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_route_same_coordinates_no_waypoints)
|
||||
{
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
|
||||
using namespace osrm;
|
||||
|
||||
RouteParameters params;
|
||||
params.skip_waypoints = true;
|
||||
params.steps = true;
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
|
||||
engine::api::ResultT result = json::Object();
|
||||
const auto rc = osrm.Route(params, result);
|
||||
BOOST_CHECK(rc == Status::Ok);
|
||||
|
||||
auto &json_result = result.get<json::Object>();
|
||||
const auto code = json_result.values.at("code").get<json::String>().value;
|
||||
BOOST_CHECK_EQUAL(code, "Ok");
|
||||
|
||||
BOOST_CHECK(json_result.values.find("waypoints") == json_result.values.end());
|
||||
|
||||
const auto &routes = json_result.values.at("routes").get<json::Array>().values;
|
||||
BOOST_REQUIRE_GT(routes.size(), 0);
|
||||
|
||||
for (const auto &route : routes)
|
||||
{
|
||||
const auto &route_object = route.get<json::Object>();
|
||||
|
||||
const auto distance = route_object.values.at("distance").get<json::Number>().value;
|
||||
BOOST_CHECK_EQUAL(distance, 0);
|
||||
|
||||
const auto duration = route_object.values.at("duration").get<json::Number>().value;
|
||||
BOOST_CHECK_EQUAL(duration, 0);
|
||||
|
||||
// geometries=polyline by default
|
||||
const auto geometry = route_object.values.at("geometry").get<json::String>().value;
|
||||
BOOST_CHECK(!geometry.empty());
|
||||
|
||||
const auto &legs = route_object.values.at("legs").get<json::Array>().values;
|
||||
BOOST_CHECK(!legs.empty());
|
||||
|
||||
// The rest of legs contents is verified by test_route_same_coordinates
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_route_response_for_locations_in_small_component)
|
||||
{
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
@ -575,4 +622,43 @@ BOOST_AUTO_TEST_CASE(test_route_serialize_fb)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_route_serialize_fb_skip_waypoints)
|
||||
{
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
|
||||
using namespace osrm;
|
||||
|
||||
RouteParameters params;
|
||||
params.skip_waypoints = true;
|
||||
params.steps = true;
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
|
||||
engine::api::ResultT result = flatbuffers::FlatBufferBuilder();
|
||||
const auto rc = osrm.Route(params, result);
|
||||
BOOST_CHECK(rc == Status::Ok);
|
||||
|
||||
auto &fb_result = result.get<flatbuffers::FlatBufferBuilder>();
|
||||
auto fb = engine::api::fbresult::GetFBResult(fb_result.GetBufferPointer());
|
||||
BOOST_CHECK(!fb->error());
|
||||
|
||||
BOOST_CHECK(fb->waypoints() == nullptr);
|
||||
|
||||
BOOST_CHECK(fb->routes() != nullptr);
|
||||
const auto routes = fb->routes();
|
||||
BOOST_REQUIRE_GT(routes->size(), 0);
|
||||
|
||||
for (const auto &route : *routes)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(route->distance(), 0);
|
||||
BOOST_CHECK_EQUAL(route->duration(), 0);
|
||||
|
||||
const auto &legs = route->legs();
|
||||
BOOST_CHECK(legs->size() > 0);
|
||||
|
||||
// Rest of the content is verified by test_route_serialize_fb
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
@ -77,6 +77,57 @@ BOOST_AUTO_TEST_CASE(test_table_three_coords_one_source_one_dest_matrix)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_table_three_coords_one_source_one_dest_matrix_no_waypoints)
|
||||
{
|
||||
using namespace osrm;
|
||||
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
|
||||
TableParameters params;
|
||||
params.skip_waypoints = true;
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.sources.push_back(0);
|
||||
params.destinations.push_back(2);
|
||||
params.annotations = TableParameters::AnnotationsType::All;
|
||||
|
||||
engine::api::ResultT result = json::Object();
|
||||
|
||||
const auto rc = osrm.Table(params, result);
|
||||
|
||||
auto &json_result = result.get<json::Object>();
|
||||
BOOST_CHECK(rc == Status::Ok || rc == Status::Error);
|
||||
const auto code = json_result.values.at("code").get<json::String>().value;
|
||||
BOOST_CHECK_EQUAL(code, "Ok");
|
||||
|
||||
// check that returned durations error is expected size and proportions
|
||||
// this test expects a 1x1 matrix
|
||||
const auto &durations_array = json_result.values.at("durations").get<json::Array>().values;
|
||||
BOOST_CHECK_EQUAL(durations_array.size(), params.sources.size());
|
||||
for (unsigned int i = 0; i < durations_array.size(); i++)
|
||||
{
|
||||
const auto durations_matrix = durations_array[i].get<json::Array>().values;
|
||||
BOOST_CHECK_EQUAL(durations_matrix.size(),
|
||||
params.sources.size() * params.destinations.size());
|
||||
}
|
||||
|
||||
// check that returned distances error is expected size and proportions
|
||||
// this test expects a 1x1 matrix
|
||||
const auto &distances_array = json_result.values.at("distances").get<json::Array>().values;
|
||||
BOOST_CHECK_EQUAL(distances_array.size(), params.sources.size());
|
||||
for (unsigned int i = 0; i < distances_array.size(); i++)
|
||||
{
|
||||
const auto distances_matrix = distances_array[i].get<json::Array>().values;
|
||||
BOOST_CHECK_EQUAL(distances_matrix.size(),
|
||||
params.sources.size() * params.destinations.size());
|
||||
}
|
||||
|
||||
// waypoint arrays should be missing
|
||||
BOOST_CHECK(json_result.values.find("destinations") == json_result.values.end());
|
||||
BOOST_CHECK(json_result.values.find("sources") == json_result.values.end());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_table_three_coords_one_source_matrix)
|
||||
{
|
||||
using namespace osrm;
|
||||
@ -247,4 +298,46 @@ BOOST_AUTO_TEST_CASE(test_table_serialiaze_fb)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_table_serialiaze_fb_no_waypoints)
|
||||
{
|
||||
using namespace osrm;
|
||||
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
|
||||
TableParameters params;
|
||||
params.skip_waypoints = true;
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.coordinates.push_back(get_dummy_location());
|
||||
params.sources.push_back(0);
|
||||
params.destinations.push_back(2);
|
||||
params.annotations = TableParameters::AnnotationsType::All;
|
||||
|
||||
engine::api::ResultT result = flatbuffers::FlatBufferBuilder();
|
||||
|
||||
const auto rc = osrm.Table(params, result);
|
||||
|
||||
BOOST_CHECK(rc == Status::Ok || rc == Status::Error);
|
||||
|
||||
auto &fb_result = result.get<flatbuffers::FlatBufferBuilder>();
|
||||
auto fb = engine::api::fbresult::GetFBResult(fb_result.GetBufferPointer());
|
||||
BOOST_CHECK(!fb->error());
|
||||
BOOST_CHECK(fb->table() != nullptr);
|
||||
|
||||
// check that returned durations error is expected size and proportions
|
||||
// this test expects a 1x1 matrix
|
||||
BOOST_CHECK(fb->table()->durations() != nullptr);
|
||||
auto durations_array = fb->table()->durations();
|
||||
BOOST_CHECK_EQUAL(durations_array->size(), params.sources.size() * params.destinations.size());
|
||||
|
||||
// check that returned distances error is expected size and proportions
|
||||
// this test expects a 1x1 matrix
|
||||
BOOST_CHECK(fb->table()->distances() != nullptr);
|
||||
auto distances_array = fb->table()->distances();
|
||||
BOOST_CHECK_EQUAL(distances_array->size(), params.sources.size() * params.destinations.size());
|
||||
|
||||
BOOST_CHECK(fb->table()->destinations() == nullptr);
|
||||
BOOST_CHECK(fb->waypoints() == nullptr);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "fixture.hpp"
|
||||
|
||||
#include "osrm/trip_parameters.hpp"
|
||||
#include <engine/api/flatbuffers/fbresult_generated.h>
|
||||
|
||||
#include "osrm/coordinate.hpp"
|
||||
#include "osrm/engine_config.hpp"
|
||||
@ -57,6 +58,30 @@ BOOST_AUTO_TEST_CASE(test_roundtrip_response_for_locations_in_small_component)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_roundtrip_response_for_locations_in_small_component_skip_waypoints)
|
||||
{
|
||||
using namespace osrm;
|
||||
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
const auto locations = get_locations_in_small_component();
|
||||
|
||||
TripParameters params;
|
||||
params.skip_waypoints = true;
|
||||
params.coordinates.push_back(locations.at(0));
|
||||
params.coordinates.push_back(locations.at(1));
|
||||
params.coordinates.push_back(locations.at(2));
|
||||
|
||||
engine::api::ResultT result = json::Object();
|
||||
const auto rc = osrm.Trip(params, result);
|
||||
BOOST_CHECK(rc == Status::Ok);
|
||||
|
||||
auto &json_result = result.get<json::Object>();
|
||||
const auto code = json_result.values.at("code").get<json::String>().value;
|
||||
BOOST_CHECK_EQUAL(code, "Ok");
|
||||
|
||||
BOOST_CHECK(json_result.values.find("waypoints") == json_result.values.end());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_roundtrip_response_for_locations_in_big_component)
|
||||
{
|
||||
using namespace osrm;
|
||||
@ -422,4 +447,72 @@ BOOST_AUTO_TEST_CASE(test_tfse_legal_parameters)
|
||||
CheckOk(osrm, params);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_roundtrip_response_fb_serialization)
|
||||
{
|
||||
using namespace osrm;
|
||||
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
const auto locations = get_locations_in_small_component();
|
||||
|
||||
TripParameters params;
|
||||
params.coordinates.push_back(locations.at(0));
|
||||
params.coordinates.push_back(locations.at(1));
|
||||
params.coordinates.push_back(locations.at(2));
|
||||
|
||||
engine::api::ResultT result = flatbuffers::FlatBufferBuilder();
|
||||
const auto rc = osrm.Trip(params, result);
|
||||
BOOST_CHECK(rc == Status::Ok);
|
||||
|
||||
auto &fb_result = result.get<flatbuffers::FlatBufferBuilder>();
|
||||
auto fb = engine::api::fbresult::GetFBResult(fb_result.GetBufferPointer());
|
||||
|
||||
BOOST_CHECK(!fb->error());
|
||||
|
||||
BOOST_CHECK(fb->waypoints() != nullptr);
|
||||
const auto waypoints = fb->waypoints();
|
||||
BOOST_CHECK(waypoints->size() == params.coordinates.size());
|
||||
|
||||
BOOST_CHECK(fb->routes() != nullptr);
|
||||
const auto trips = fb->routes();
|
||||
BOOST_CHECK_EQUAL(trips->size(), 1);
|
||||
|
||||
for (const auto &waypoint : *waypoints)
|
||||
{
|
||||
const auto longitude = waypoint->location()->longitude();
|
||||
const auto latitude = waypoint->location()->latitude();
|
||||
BOOST_CHECK(longitude >= -180. && longitude <= 180.);
|
||||
BOOST_CHECK(latitude >= -90. && latitude <= 90.);
|
||||
|
||||
const auto trip = waypoint->trips_index();
|
||||
const auto pos = waypoint->waypoint_index();
|
||||
BOOST_CHECK(trip < trips->size());
|
||||
BOOST_CHECK(pos < waypoints->size());
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_roundtrip_response_fb_serialization_skip_waypoints)
|
||||
{
|
||||
using namespace osrm;
|
||||
|
||||
auto osrm = getOSRM(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
const auto locations = get_locations_in_small_component();
|
||||
|
||||
TripParameters params;
|
||||
params.skip_waypoints = true;
|
||||
params.coordinates.push_back(locations.at(0));
|
||||
params.coordinates.push_back(locations.at(1));
|
||||
params.coordinates.push_back(locations.at(2));
|
||||
|
||||
engine::api::ResultT result = flatbuffers::FlatBufferBuilder();
|
||||
const auto rc = osrm.Trip(params, result);
|
||||
BOOST_CHECK(rc == Status::Ok);
|
||||
|
||||
auto &fb_result = result.get<flatbuffers::FlatBufferBuilder>();
|
||||
auto fb = engine::api::fbresult::GetFBResult(fb_result.GetBufferPointer());
|
||||
|
||||
BOOST_CHECK(!fb->error());
|
||||
|
||||
BOOST_CHECK(fb->waypoints() == nullptr);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
Loading…
Reference in New Issue
Block a user