Compare commits

...

3534 Commits

Author SHA1 Message Date
Daniel Patterson 17adeeecf5 Fix segfault when route includes very short segments. 2016-06-22 14:55:20 -07:00
Patrick Niklaus edafb0a83c [skip ci] Add breaking notice to changelog 2016-06-21 19:49:13 +02:00
Patrick Niklaus f7cc89400a Update the v5.2.4 changelog 2016-06-21 19:47:39 +02:00
Lauren Budorick 473e4e129c Update tests to catch 0-subtraction error 2016-06-21 19:41:01 +02:00
Patrick Niklaus 2ac497c6b8 Fix fromTop and fromLeft calculation 2016-06-21 19:40:50 +02:00
Michael Krasnyk defdc8cc4b Fix omitting the last point's coordinates in the geometry field 2016-06-21 18:23:29 +02:00
Moritz Kobitzsch 4c5314676a fix issues with roundabouts and intersections and sliproads 2016-06-21 18:23:06 +02:00
Moritz Kobitzsch 1da044f3e3 fix roundabout-handling when name changes 2016-06-17 11:19:27 -07:00
Patrick Niklaus 45516ef534 Enable travis builds for 5.2 branch 2016-06-14 14:36:41 +02:00
Patrick Niklaus 532fda267f [skip ci] Update changelog for 5.2.1
Conflicts:
	CHANGELOG.md
2016-06-14 14:32:33 +02:00
Daniel Patterson 494845b160 Copy data to beginning of buffer, not end. (#2542)
Copy data to beginning of buffer, not end.
2016-06-13 12:59:42 -07:00
Patrick Niklaus 0fc823041e Removed debug code 2016-06-13 17:57:33 +02:00
Patrick Niklaus 71eae4137d [skip ci] Update changelog 2016-06-13 17:27:53 +02:00
Moritz Kobitzsch 47b19f209b prefer obvious turn assignment over forks 2016-06-13 15:00:18 +02:00
Moritz Kobitzsch 2b5355edca improve slipway handling to allow multiple styles of turn lanes / turn roads 2016-06-13 11:56:50 +02:00
Patrick Niklaus e9a0beb4e8 Fix shared memory encoding for node-ids 2016-06-12 20:50:57 +02:00
Vladimir Kurchatkin 6bdfe68897 Add feature name to vector tiles (#2488) 2016-06-10 11:15:14 -07:00
Daniel J. Hofmann cf2d2b6763 Boost.Test Testing Docs 2016-06-10 19:03:44 +02:00
Moritz Kobitzsch 95cd44f34f add directions guide 2016-06-10 19:03:44 +02:00
Moritz Kobitzsch d330e60d40 added a guide on writing good cucumber tests for osrm 2016-06-10 19:03:44 +02:00
Moritz Kobitzsch 99004bbec8 add testcase 2016-06-10 10:20:39 +02:00
Emil Tin bbcc728a07 Update http.md
clarify "new name" instruction
2016-06-10 09:42:13 +02:00
Daniel J. Hofmann 033dc0a72d Pre-allocate up-front whenever possible 2016-06-09 16:06:27 +02:00
Patrick Niklaus 1c140a112a Make sure we also reserve space for destination and pronunciation 2016-06-08 10:58:11 +02:00
Moritz Kobitzsch 312e86eb58 handle merge on collapsed instructions 2016-06-06 11:55:14 +02:00
Moritz Kobitzsch 1dfdb38d4a improve collapse-handling 2016-06-06 10:05:18 +02:00
Dane Springmeyer dfafe7dc5f Install clang-3.8 via mason binary 2016-06-04 12:15:29 +02:00
Dane Springmeyer 6ecc123d15 Fix various issues with pkg-config 2016-06-04 12:08:54 +02:00
Daniel J. Hofmann 6f322d2140 Silence multiline comment warning 2016-06-03 14:47:45 +02:00
Daniel J. Hofmann dfa762bccc Pronunciation.
Spelling is hard. Maybe this time. /cc @themarex @systemed
2016-06-02 16:35:21 +02:00
Daniel J. Hofmann 87f00d2c4c Restrict CMake version to 2.8.11+ for target_include_directories 2016-06-02 16:07:29 +02:00
Daniel J. Hofmann 6f94e0dfb8 Update the Changelog for v5.2.0-rc2 2016-06-02 15:22:56 +02:00
Daniel J. Hofmann ad70759f91 Revert "Handle small roundabouts, fixes #516."
This reverts commit 7641b12b08.

Conflicts:
	profiles/bicycle.lua
	profiles/car.lua
2016-06-02 15:08:24 +02:00
Daniel J. Hofmann 27c4e8ddd0 Revert "Adds tag to taginfo"
This reverts commit 14fdf861ca.
2016-06-02 15:00:50 +02:00
Daniel J. Hofmann 805d74b6ae Revert "Fixes roundabout spelling in existing cucumber test"
This reverts commit ef7b36da32.
2016-06-02 15:00:49 +02:00
Daniel J. Hofmann 4ad78309e2 Revert "Set speeds for mini roundabouts in car and bike profile"
This reverts commit a85f39c140.
2016-06-02 15:00:47 +02:00
Daniel J. Hofmann b78207ddd8 Revert "Add implied oneway cucumber tests for mini roundabouts"
This reverts commit bd707b0cfc.

Conflicts:
	features/bicycle/oneway.feature
	features/car/oneway.feature
2016-06-02 15:00:44 +02:00
Daniel J. Hofmann b6834da9a4 Revert "Test guidance instructions for entering and leaving mini roundabouts"
This reverts commit 9cdc9008aa.
2016-06-02 14:57:48 +02:00
Daniel J. Hofmann 801cc72691 Sync with Clang38 Format 2016-06-02 14:43:27 +02:00
Patrick Niklaus e198709643 Add documentation about nodes property 2016-06-02 14:28:33 +02:00
Patrick Niklaus ed8d5e0b0a Add missing semicolon 2016-06-02 14:27:25 +02:00
Lauren Budorick e8fb312703 Update OSM node IDs annotation cucumber code per d6de2ca71c 2016-06-02 14:27:25 +02:00
Lauren Budorick 058b8c3b31 Template vector 2016-06-02 14:27:25 +02:00
Lauren Budorick ae3ccb009e Formatting [ci skip] 2016-06-02 14:27:25 +02:00
Lauren Budorick 0c60a2aef8 Minor cleanups + comments 2016-06-02 14:27:25 +02:00
Lauren Budorick 44fdf86702 IT WORKS 2016-06-02 14:27:25 +02:00
Lauren Budorick 1659bbf7b1 Refining packed_vector.hpp
* Rename to std::vector-like APIs (push_back, at)
* Add size, reserve, capacity methods
2016-06-02 14:27:25 +02:00
Lauren Budorick 46b58fba83 Packed vector cleanups and unit test 2016-06-02 14:27:25 +02:00
Lauren Budorick 84da86ba4a Add packed vector sketch 2016-06-02 14:27:25 +02:00
Lauren Budorick 6777127497 Add cucumber tests for node IDs 2016-06-02 14:27:25 +02:00
Lauren Budorick a4ac07866a Recreate feature/expose_node_ids 2016-06-02 14:27:25 +02:00
Daniel J. Hofmann 448f8377fb Sync with Clang38 Format 2016-06-02 13:14:33 +02:00
Daniel J. Hofmann c490752ca7 highway=motorway_link does not imply oneway, fixes #1662
References:
- http://wiki.openstreetmap.org/wiki/Tag:highway%3Dmotorway_link#Tagging_oneway
- http://wiki.openstreetmap.org/wiki/Tag:highway%3Dmotorway_link
- http://wiki.openstreetmap.org/wiki/Tag:highway%3Dmotorway
2016-06-02 13:05:50 +02:00
Daniel J. Hofmann 6edc565c01 Add destinations API feature 2016-06-02 12:00:23 +02:00
Daniel J. Hofmann bb0c2754d3 With empty summaries no longer the case, update library tests accordingly 2016-06-02 00:26:04 +02:00
Moritz Kobitzsch 58d6e8f4d0 handle short summaries correctly 2016-06-02 00:26:04 +02:00
Moritz Kobitzsch bdc66049a5 fix INVALID_NAME_ID vs INVALID_NAMEID -> EMPTY_NAMEID 2016-06-01 23:19:26 +02:00
Patrick Niklaus 0a53775fb3 Expose pronunciation in RouteStep
Uses name:pronunciation by default for cars.
2016-06-01 23:17:57 +02:00
Daniel J. Hofmann 9cdc9008aa Test guidance instructions for entering and leaving mini roundabouts 2016-06-01 20:17:48 +02:00
Daniel J. Hofmann bd707b0cfc Add implied oneway cucumber tests for mini roundabouts 2016-06-01 20:17:48 +02:00
Daniel J. Hofmann a85f39c140 Set speeds for mini roundabouts in car and bike profile 2016-06-01 20:17:48 +02:00
Daniel J. Hofmann ef7b36da32 Fixes roundabout spelling in existing cucumber test 2016-06-01 20:17:48 +02:00
Daniel J. Hofmann 14fdf861ca Adds tag to taginfo 2016-06-01 20:17:48 +02:00
Daniel J. Hofmann 7641b12b08 Handle small roundabouts, fixes #516.
This gives us ~51k additional roundabout instructions.
Guidance handes sizes internally.

Note: it is highway=mini_roundabout but junction=roundabout

References:
- http://wiki.openstreetmap.org/wiki/Tag:highway%3Dmini_roundabout
- http://wiki.openstreetmap.org/wiki/Tag:junction=roundabout
- http://taginfo.openstreetmap.org/tags/highway=mini_roundabout
2016-06-01 20:17:48 +02:00
Daniel J. Hofmann e7159adf59 Switching off any LLVM APT references as servers are no longer available
References:
- http://lists.llvm.org/pipermail/llvm-foundation/2016-June/000025.html
2016-06-01 20:04:52 +02:00
Daniel J. Hofmann 51f08f2994 Let's still show the badge although we dropped support for Windows
This reverts commit a03eac8e48.
2016-06-01 19:22:31 +02:00
Daniel J. Hofmann a03eac8e48 Remove Windows Build Badge from Readme 2016-06-01 15:37:16 +02:00
Daniel J. Hofmann 503137221d Let osrm-routed log status code, fixes #512.
Disclaimer: osrm-routed is not recommended for production usage.
Use node-osrm instead: https://github.com/Project-OSRM/node-osrm
2016-05-31 14:44:50 +02:00
Patrick Niklaus fb9205bf81 Merge pull request #2476 from oxidase/refactor/2472
Refactor ramIndex #2472
2016-05-31 03:00:47 -04:00
Michael Krasnyk bfbb313088 Conditional hashing of osrm libraries 2016-05-29 07:39:49 +02:00
Michael Krasnyk 25d3c4b843 Updated change log and adjusted format 2016-05-29 07:39:49 +02:00
Michael Krasnyk 371c06d66d Change size of QueryCandidate from 32 to 24 bytes 2016-05-29 07:39:49 +02:00
Michael Krasnyk 3e5c978719 Reduce ramIndex file size
PR #2472: the bottom-most node of the r-tree contains
only a single index to a leaf node, so out of 532 bytes
only 4 are used.
2016-05-29 07:39:49 +02:00
Michael Krasnyk 843f1a6356 Set LeafNode alignment to LEAF_PAGE_SIZE bytes
References:
- https://github.com/Project-OSRM/osrm-backend/pull/2348#issuecomment-219804408
- http://stackoverflow.com/questions/15523537/alignas-specifier-vs-attribute-aligned-c11
- http://stackoverflow.com/questions/7895869/cross-platform-alignx-macro
2016-05-29 07:39:49 +02:00
Dane Springmeyer a5c5faa21d drop support for using DYLD_LIBRARY_PATH on OS X 2016-05-29 06:01:16 +02:00
Patrick Niklaus 6a1e17c6fa Print TBB version in FindTBB 2016-05-29 00:06:45 +02:00
Patrick Niklaus cd30f370b8 Remove the use of atomics and use thread-local accumulation instead 2016-05-29 00:06:18 +02:00
Dane Springmeyer 4ae8abe6a3 run clang-format [skip ci] 2016-05-27 22:35:17 +02:00
Dane Springmeyer 82bfd4ee40 fix compile with clang-3.5 2016-05-27 22:35:17 +02:00
Patrick Niklaus e08c4cff13 Make PRs fail if they don't adhere to our style format 2016-05-27 21:05:43 +02:00
Patrick Niklaus 6e16eab6ec Format with clang-format 3.8 2016-05-27 21:05:04 +02:00
Patrick Niklaus 21c47514da Update clang-format to 3.8 2016-05-27 17:45:00 +02:00
Patrick Niklaus d6de2ca71c Really place annotations in RouteLeg and not Route 2016-05-27 16:46:28 +02:00
Dane Springmeyer 451a0d9090 try caching test data on travis 2016-05-27 00:40:49 +02:00
Patrick Niklaus 262354f733 Rename annotate to annotations 2016-05-26 23:35:11 +02:00
Daniel J. Hofmann 498370330d String bulk insertion 2016-05-26 22:50:17 +02:00
Daniel J. Hofmann 6865853776 Not everything is a NodeID! 2016-05-26 22:50:17 +02:00
Daniel J. Hofmann 1418c0dbbc Move ExtractionWays and ExtractionNodes into container to avoid copying 2016-05-26 22:50:17 +02:00
Daniel J. Hofmann bbc79dd49f ExtractionContainers already owns its data 2016-05-26 22:50:17 +02:00
Daniel J. Hofmann 8036320d94 Do not bind primitives per ref 2016-05-26 22:50:17 +02:00
Patrick Niklaus c30f69d6e9 Fix breaking test uncovered by this fix 2016-05-26 22:34:39 +02:00
Patrick Niklaus 2e2f34f241 Fix retry code launch classes 2016-05-26 22:34:39 +02:00
Lauren Budorick cbbeef5c46 Prune unnecessary cucumber code 2016-05-26 22:34:39 +02:00
Moritz Kobitzsch 823ee54f22 add turn restrictions to test-cases 2016-05-26 21:31:04 +02:00
Daniel Patterson 3d03797e53 Distinguish between offramps and sliproads. 2016-05-26 21:31:04 +02:00
Patrick Niklaus 089e60fa1e Remove obsolete timer code 2016-05-26 20:25:33 +02:00
Patrick Niklaus baf8e4784b Transfer match benchmark to own binary 2016-05-26 20:25:33 +02:00
Moritz Kobitzsch d53350b263 be more verbose on broken configs 2016-05-26 20:04:24 +02:00
Patrick Niklaus 824afdceca use 5 seconds as cucumber timeout 2016-05-26 20:02:21 +02:00
Patrick Niklaus a8230e976f Merge pull request #2454 from oxidase/reset-force-flags
Remove force flags and update extract/contract hashes with arguments
2016-05-26 13:16:29 -04:00
Michael Krasnyk 6af7e6866c Sort file extensions in rename lists 2016-05-26 17:05:11 +02:00
Michael Krasnyk aaa27333ba Remove force flags and update extractor/contractor hashes
with command line arguments and argument files data.
2016-05-26 16:36:26 +02:00
Moritz Kobitzsch 797f2a196b handle intersection-access for roundabout correctly 2016-05-26 16:25:26 +02:00
Moritz Kobitzsch 51066ff18f fix options in step-definitions 2016-05-26 15:38:55 +02:00
Dane Springmeyer 4de64a92cb fix zlib linking order 2016-05-25 09:32:27 -04:00
Freenerd a21fd2ea18 Contractor: log stats for loaded speed files 2016-05-24 14:35:16 -04:00
Patrick Niklaus 0df0b4305d Merge pull request #2453 from Project-OSRM/cmake-from-mason
[Travis] Install cmake from more reliable s3 endpoint
2016-05-24 14:32:45 -04:00
Dane Springmeyer a5ed53e7aa install cmake from mason / simplify install 2016-05-24 13:35:13 -04:00
Daniel Patterson 0587c5f5c4 Trim datasource names before writing to datafile. 2016-05-24 15:20:14 +02:00
Patrick Niklaus 57dbb18c4c Merge pull request #2451 from Project-OSRM/disable-osx-spotlight
[Travis] Disable spotlight indexing on osx to speed up 'npm test'
2016-05-24 09:10:35 -04:00
Dane Springmeyer 4d92f08424 disable spotlight indexing on osx to speed up 'npm test' 2016-05-23 19:35:22 -04:00
Patrick Niklaus 254ee07942 Add new sanity check assertions to UnpackPath 2016-05-23 23:15:15 +02:00
Patrick Niklaus 0bf8bd2230 Remove invalid assertion.
This ports the matching change from RoutingBase.
2016-05-23 23:15:15 +02:00
Michael Krasnyk b5225f07cb Fix #2413 by converting enums to unsigned char constants 2016-05-23 18:33:24 +02:00
Moritz Kobitzsch abed7690d0 fix continue on obvious 2016-05-23 17:55:30 +02:00
Patrick Niklaus f96174ddbe Merge pull request #2428 from zimathias/disable-access-logging-option
Disable access logging option
2016-05-23 10:12:42 -04:00
Mathias Gug e5b713841a Fix style. 2016-05-20 12:47:47 -07:00
Mathias Gug 3b1b12069f Add changelog entry. 2016-05-20 12:47:47 -07:00
Mathias Gug 1635f7351d Support environment variable to disable http requests logging. 2016-05-20 12:47:47 -07:00
Daniel J. Hofmann ce5ae411c1 Resurrect Flat Map + Binary Search commit from PR 2412 2016-05-20 20:43:45 +02:00
Patrick Niklaus d1bc32fb31 Add comments and debug code 2016-05-20 18:52:29 +02:00
Patrick Niklaus f9f87f25d4 Use elogate() to fixup geometry when merging steps, fixes #2424 2016-05-20 18:52:29 +02:00
Patrick Niklaus 89aa6b7881 Add regression test for #2424 2016-05-20 18:52:29 +02:00
Patrick Niklaus edf9e0c1ed [skip ci] Update changelog and OSRM version 2016-05-20 18:52:00 +02:00
Dane Springmeyer c2e520ad9d Fix linking of osrm-example to boost_iostreams
Fixes linking error seen on OS X:

```
[ 50%] Linking CXX executable osrm-example
/Users/dane/.homebrew/Cellar/cmake/3.5.0/bin/cmake -E cmake_link_script CMakeFiles/osrm-example.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++    -std=c++11  -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/osrm-example.dir/example.cpp.o  -o osrm-example  /Users/dane/projects/osrm-backend/here/lib/libOSRM.a /Users/dane/.homebrew/lib/libboost_filesystem-mt.dylib /Users/dane/.homebrew/lib/libboost_system-mt.dylib /Users/dane/.homebrew/lib/libboost_thread-mt.dylib /Users/dane/.homebrew/lib/libboost_chrono-mt.dylib /Users/dane/.homebrew/lib/libboost_date_time-mt.dylib /Users/dane/.homebrew/lib/libboost_atomic-mt.dylib 
undef: __ZN5boost9iostreams18mapped_file_source9open_implERKNS0_24basic_mapped_file_paramsINS0_6detail4pathEEE
undef: __ZN5boost9iostreams18mapped_file_sourceC1Ev
undef: __ZNK5boost9iostreams18mapped_file_source4sizeEv
undef: __ZNK5boost9iostreams18mapped_file_source4dataEv
Undefined symbols for architecture x86_64:
  "boost::iostreams::mapped_file_source::open_impl(boost::iostreams::basic_mapped_file_params<boost::iostreams::detail::path> const&)", referenced from:
      void boost::iostreams::mapped_file_source::open<boost::filesystem::path>(boost::filesystem::path const&, unsigned long, long) in libOSRM.a(engine.cpp.o)
  "boost::iostreams::mapped_file_source::mapped_file_source()", referenced from:
      osrm::engine::datafacade::SharedDataFacade::CheckAndReloadFacade() in libOSRM.a(engine.cpp.o)
      osrm::engine::datafacade::InternalDataFacade::InternalDataFacade(osrm::storage::StorageConfig const&) in libOSRM.a(engine.cpp.o)
  "boost::iostreams::mapped_file_source::size() const", referenced from:
      osrm::engine::datafacade::SharedDataFacade::CheckAndReloadFacade() in libOSRM.a(engine.cpp.o)
      osrm::engine::datafacade::InternalDataFacade::InternalDataFacade(osrm::storage::StorageConfig const&) in libOSRM.a(engine.cpp.o)
  "boost::iostreams::mapped_file_source::data() const", referenced from:
      osrm::engine::datafacade::SharedDataFacade::CheckAndReloadFacade() in libOSRM.a(engine.cpp.o)
      osrm::engine::datafacade::InternalDataFacade::InternalDataFacade(osrm::storage::StorageConfig const&) in libOSRM.a(engine.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
2016-05-20 16:04:18 +02:00
Dane Springmeyer 7649187095 workaround boostorg/numeric_conversion#4 2016-05-20 16:03:19 +02:00
Dane Springmeyer fe39d0fd10 disable BOOST_TEST_DYN_LINK if Boost_USE_STATIC_LIBS 2016-05-20 00:03:37 -04:00
Patrick Niklaus 98b83b7208 Fix library test 2016-05-19 16:44:31 +02:00
Patrick Niklaus 57321979ae Remove leftover debugging code 2016-05-19 16:44:31 +02:00
Patrick Niklaus e3ce0c5887 Add fuzzy matching for bearings and intersections list 2016-05-19 16:44:31 +02:00
Patrick Niklaus 95af72c70c Make intersection backwards compatible
For `depart` and `arrive` `step.intersections[0].{bearings|entry}` will have
only one entry.
2016-05-19 16:44:31 +02:00
Patrick Niklaus 3b37769624 Use bearing_before and bearing_after in the bearings field 2016-05-19 16:44:31 +02:00
Moritz Kobitzsch d150df1c5c format 2016-05-19 16:44:31 +02:00
Moritz Kobitzsch a322e27e05 update changelog/docs 2016-05-19 16:44:31 +02:00
Moritz Kobitzsch 98fe0badbe fix loading in storage 2016-05-19 16:44:31 +02:00
Moritz Kobitzsch 44b841a25d fix storage 2016-05-19 16:44:31 +02:00
Moritz Kobitzsch 9c8bf820de adjusted to in/out. only emit one of them for depart/arrive 2016-05-19 16:44:31 +02:00
Moritz Kobitzsch 4d9aa65e78 intersection classes with variable degree of discretization 2016-05-19 16:44:31 +02:00
Moritz Kobitzsch 0f3942558f version using discrete values stored directly at intersection 2016-05-19 16:43:46 +02:00
Moritz Kobitzsch ba074b0116 initial version of intersection classification 2016-05-19 16:43:46 +02:00
Daniel J. Hofmann 6aa97048df Rip out custom CSV parser code and its third_party dependency 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann d9a5c79ea6 Map leaf nodes to RAM and iterate over them potentially in parallel 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann 9d7714c714 Make looping through all leaf nodes less confusing 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann 8291be375a Expose concurrency in saving files 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann 0a73737f69 Fold parsing and data loading in concurrently executing action 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann 2fd1b6c913 Expose concurrency between intern/external node map and geometries 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann ea38a1d880 Parse multiple files concurrently 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann f576e13c51 Concurrent lookup hashtables 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann ee7bb8731a Expose concurrency between segment speeds and turn penalties 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann da0c3ff394 Refactor edge weight parsing code 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann 6ae559b42b Throw error if edge based graph file could not be loaded 2016-05-19 00:01:54 +02:00
Mathias Gug 95ca6ebdaa Update CHANGELOG entry. 2016-05-18 23:59:52 +02:00
Mathias Gug 0d6964d9c8 Add CHANGELOG entry. 2016-05-18 23:59:52 +02:00
Mathias Gug ba386d4b2c Document environment variable. 2016-05-18 23:59:52 +02:00
Mathias Gug b5ffb51e18 Signal the parent process when we're ready to serve requests.
This can be used for a hot reload of the process binary. The supervising
process can be told when the new process is ready to serve requests.
2016-05-18 23:59:52 +02:00
Moritz Kobitzsch a9f674497a emit turn-straight for obvious turns where the main road continues 2016-05-18 19:54:53 +02:00
Patrick Niklaus 1e8a92ccb4 Add changelog entry 2016-05-18 19:16:44 +02:00
Mathias Gug b9178bb8c7 Fix build on windows. 2016-05-18 19:13:18 +02:00
Mathias Gug 520b29d0d5 Use const for option. Include proper header files. 2016-05-18 19:13:18 +02:00
Mathias Gug fe397e6953 Support SO_REUSEPORT option
so that multiple osrm-routed processes can bind to the same port.
2016-05-18 19:13:18 +02:00
Patrick Niklaus dcb741d827 Merge pull request #2403 from oxidase/refactor/duration-parser
Refactoring of iso_8601_grammar
2016-05-17 12:26:28 -04:00
Michael Krasnyk 508c205d35 Refactoring of iso_8601_grammar
* formats 'hh:mm:ss' and ISO 8601 are merged into one grammar.
* iso_8601_grammar is changed to static const.
* iso_8601_grammar supports formats P[n]DT[n]H[n]M[n]S, P[n]W,
  and part of alternative PTHHMMSS and extended PTHH:MM:SS formats.
2016-05-17 00:39:32 +02:00
Daniel J. Hofmann d5294bb5d0 Silences warnings when running npm test 2016-05-16 14:43:54 -04:00
Patrick Niklaus 6ed9be31ca Merge pull request #2408 from oxidase/master
Remove latitude rounding in yToLat
2016-05-16 17:04:49 +02:00
Michael Krasnyk 3bbd3a8a65 Remove latitude rounding in yToLat 2016-05-16 00:53:33 +02:00
Daniel Patterson 73a608895a Merge pull request #2402 from Project-OSRM/fix_docker
Remove Ruby from docker setup, use Node.
2016-05-13 13:38:10 -07:00
Daniel Patterson 96c73baeb3 Remove Ruby from docker setup, use Node. 2016-05-13 12:32:36 -07:00
Patrick Niklaus 73113f5eb8 Fix codecov.yml 2016-05-12 17:56:40 +02:00
Patrick Niklaus 7b74b86891 Add codecov file 2016-05-12 01:17:16 +02:00
Daniel Patterson 0903b8227f Example of the annotation response value. 2016-05-12 01:11:09 +02:00
Daniel Patterson fa525ad610 Return an array with meta-data for each coordinate.
Currently supports duration and distance for each coordinate.

This is particularly useful in map-matching, comparing how
a trip progresses compared to a real GPS trace that is
map-matched.
2016-05-12 01:11:09 +02:00
Daniel J. Hofmann 0f2bb5dde5 Disable builing components tool by default until GDAL 2 compatibility #1738 lands 2016-05-12 00:25:18 +02:00
Patrick Niklaus 84dc1b6845 [skip ci] Use codecov badge 2016-05-11 22:45:07 +02:00
Patrick Niklaus 4ce1a37772 Limit osrm-extact to 3 jobs because OOM 2016-05-11 22:43:26 +02:00
Patrick Niklaus 8dd4cc5c40 Integrate codecov 2016-05-11 22:43:18 +02:00
Patrick Niklaus 6aed145dae [skip ci] Rephrased the API docs in terms of adding new types 2016-05-09 18:39:30 +02:00
Patrick Niklaus d15cc77b0b Merge pull request #2386 from oxidase/rtree-optimize-addition
Missing two commits in StaticRTree changes
2016-05-08 14:20:59 +02:00
Michael Krasnyk 24a75d37fb Approximate inverse Gudermannian function by a Padé approximant 2016-05-08 06:00:21 +02:00
Michael Krasnyk 7e80dae59b Fix MSVS build. 2016-05-08 06:00:21 +02:00
Patrick Niklaus 7316c48e9f Changelog entry for StaticRTree changes 2016-05-07 23:52:11 +02:00
Patrick Niklaus c520c7a24a Fix rtree benchmark 2016-05-07 23:52:11 +02:00
Patrick Niklaus 7564633045 Update SearchInBox to not copy TreeNode 2016-05-07 23:52:11 +02:00
Patrick Niklaus 7174c5d036 Make StaticRTree and facades const 2016-05-07 23:52:11 +02:00
Patrick Niklaus ddd128ce0e Only use const-ref for coordinate vector 2016-05-07 23:52:11 +02:00
Patrick Niklaus f5aa5c0769 Don't wrap StaticRTree in thread-specfic ptr 2016-05-07 23:52:11 +02:00
Michael Krasnyk 2acde49f0f Make LeafNode aligned to memory pages.
Changes:
* LeafNode is aligned to LEAF_PAGE_SIZE.
  Alignment brings 24 bytes memory overhead for 4096, but reduces
  cache misses rate.
* Unused m_element_count from leaf nodes file.
  The size is computed as m_leaves_region.size() / LEAF_PAGE_SIZE.
* Added try/catch for mmap exceptions messages.
2016-05-07 23:52:11 +02:00
Michael Krasnyk 8849015bbf Fix construct_multiple_levels_test
candidate_cache is removed because of failing test
make util-tests && ./unit_tests/util-tests --run_test=*/construct_multiple_levels_test
first bad commit: [9692be6f50] Add cache for CandidateSegments to reduce heap worke even more

Now SegmentIndex contains leaf index, object index and fixed_projected_coordinate
2016-05-07 23:52:11 +02:00
Michael Krasnyk 70cd7a94ec Fix memory mapping "Invalid argument" exception. 2016-05-07 23:52:11 +02:00
Patrick Niklaus 3984dea34b Use mmap in StaticRTree 2016-05-07 23:52:11 +02:00
Patrick Niklaus b11b471aa4 Move LoadLeafFromDisk to return by value 2016-05-07 23:52:11 +02:00
Patrick Niklaus 63754df4d4 Add cache for CandidateSegments to reduce heap worke even more 2016-05-07 23:52:11 +02:00
Patrick Niklaus e644424508 Only save TreeNode index in search tree x3 speedup 2016-05-07 23:52:11 +02:00
Patrick Niklaus 4f6eef3d16 Merge pull request #2376 from oxidase/fix/addition-to-2356
Addition to fix #2356
2016-05-07 12:47:28 +02:00
Michael Krasnyk e2e8104864 Addition to fix #2356
Updated unit tests for the Hint parser and
added emplacement of empty hints.
2016-05-07 09:47:32 +02:00
Patrick Niklaus 96127c289c Set OSX timeout to a minute 2016-05-06 10:36:40 +02:00
Patrick Niklaus cfed65f7ea Double timeout again 2016-05-05 21:07:38 +02:00
Patrick Niklaus c2263fec9b One TIMEOUT to rule them all 2016-05-05 18:36:30 +02:00
Patrick Niklaus 497720d060 Bump timeout and lower jobs on OSX 2016-05-05 17:12:22 +02:00
Patrick Niklaus 238366e71f Merge pull request #2373 from oxidase/master
Fix #2362 by using generic path strings
2016-05-05 15:57:51 +02:00
Michael Krasnyk 2c8cf26e74 Fix build break in MSVC
fatal error C1189: #error:  "This header can't be used in operating systems without XSI (System V) shared memory support"
2016-05-05 13:24:27 +02:00
Michael Krasnyk c87ae5612a Fix #2362 by using generic path strings
In windows native strings in Lua incorrectly
interpreted because native separators must be escaped.
Use of generic strings prevent use of backslashes and
"Generic paths are portable and independent of the operating system.".
2016-05-05 12:10:45 +02:00
Patrick Niklaus a2d83753bc Install ccmake on OSX 2016-05-05 11:39:15 +02:00
Patrick Niklaus eedf75d951 Correct path to test data 2016-05-04 20:44:05 +02:00
Patrick Niklaus 3f51a1ae2e Run tests from build directory 2016-05-04 19:46:27 +02:00
Patrick Niklaus a000f80705 [skip ci] Use 3 jobs on travis to utilize cores better 2016-05-04 19:39:52 +02:00
Patrick Niklaus 7030bff7f7 Fix typo in compiler name 2016-05-04 19:24:13 +02:00
Patrick Niklaus bb0b7fd2d1 Modify compiler name for ccache key 2016-05-04 19:22:43 +02:00
Patrick Niklaus 71e1f3679e Restructure travis run 2016-05-04 19:12:07 +02:00
Patrick Niklaus b33517b099 Remove pip from dependencies 2016-05-04 18:55:29 +02:00
Patrick Niklaus f3d5336892 Lint .travis.yml 2016-05-04 18:46:08 +02:00
Patrick Niklaus d81f25d54e Enable ccache compression 2016-05-04 18:42:47 +02:00
Patrick Niklaus 44ebdfeb2d [skip ci] Update changelog 2016-05-04 18:05:37 +02:00
Daniel J. Hofmann a5a7a03fa0 Cucumber test for destination:ref and no destination=* 2016-05-04 15:28:34 +02:00
Daniel J. Hofmann 363d2145bd Register a way's .nodes() function for use in the profile's way_function.
Can be used as in:

    function way_function(way, result)
      for node in way:get_nodes() do
        local id = node:id()
        io.write(">>> " .. id .. "\n")
      end

      -- ...
    end

Warning: we do not use libosmium's location cache, therefore .location()
on the nodes will crash at runtime. Once we switch to using libosmium's
cache this should work. Until then, you can use the node id now.
2016-05-04 15:28:34 +02:00
Daniel J. Hofmann c7e19396a4 Guard against mis-tagging: only use destination tag in combination with oneway tag 2016-05-04 15:28:34 +02:00
Daniel J. Hofmann 445e5bed49 Respect ';'-separated list in destination:ref tag 2016-05-04 15:28:34 +02:00
Daniel J. Hofmann 4cf94319df Basic destination sign handling.
This first part in our Exit Sign / Destination Sign quest re-wires
the `destination=` and `destination:ref=` tag to the `ref=` tag (in case
it's the highway does not already have a `ref=` tag).

Doing some analysis on both Berlin and San Francisco it looks like this
will add a couple of thousand `ref=` tags that we will announce in guidance.

References:
- https://github.com/Project-OSRM/osrm-backend/issues/2267#issuecomment-214771682
- http://wiki.openstreetmap.org/wiki/Key:destination
- http://wiki.openstreetmap.org/wiki/Proposed_features/Destination_details
2016-05-04 15:28:34 +02:00
Patrick Niklaus 1bb88b374e Make hint values optional, fixes issue 2356 2016-05-04 15:24:48 +02:00
Patrick Niklaus 35fac07581 Add failing test for empty hint 2016-05-04 15:24:48 +02:00
Patrick Niklaus 9287475b2a ccache needs language: cpp 2016-05-04 15:09:02 +02:00
Patrick Niklaus b4976f89f2 APT seems slow, try explicitly enabling 2016-05-04 14:27:44 +02:00
Patrick Niklaus 93c8674a40 Disable coverage builds since coveralls is broken 2016-05-04 14:02:11 +02:00
Moritz Kobitzsch d5f21fd13a fix test-case 2016-05-04 14:00:34 +02:00
Patrick Niklaus 04eef0463a Fix the second test that breaks because of phantom node 2016-05-04 14:00:34 +02:00
Patrick Niklaus 82c3bc7b0e Adapt tests to desired behaviour 2016-05-04 14:00:34 +02:00
Patrick Niklaus 1d33cb96f5 Fix missing semicolon in cucumber support code 2016-05-04 14:00:34 +02:00
Moritz Kobitzsch 648646068c additional testcase on what I would expect 2016-05-04 14:00:34 +02:00
Daniel Patterson f251f93a11 Fix summary generation when empty strings are present.
Also corrects step ordering when steps have equal durations.
2016-05-04 14:00:34 +02:00
Patrick Niklaus aab1aad8f4 Enable ccache 2016-05-04 13:54:04 +02:00
Patrick Niklaus 65a6dc704e Disable all release builds but one 2016-05-04 13:41:55 +02:00
Moritz Kobitzsch 6018fcf490 Introduce on_ramp and off_ramp, deprecate ramp 2016-05-04 12:09:54 +02:00
Moritz Kobitzsch 1e6888c0d3 fix new-name on empty strings 2016-05-04 10:52:55 +02:00
Patrick Niklaus c7303be33b [skip ci] Add specifics about how we interpret semver 2016-05-03 23:36:27 +02:00
Lauren Budorick d8acf76f2d Fix wrong assertion size in CompressedEdgeContainer::GetLastEdgeSourceID 2016-05-03 21:50:27 +02:00
Moritz Kobitzsch 08248e3853 fix 2349 2016-05-03 21:14:31 +02:00
Moritz Kobitzsch 78acc6f215 fix search with u-turn 2016-05-03 21:13:22 +02:00
Patrick Niklaus a4f1dc536d Trip plugin does not have a continue_straight parameter, use false 2016-05-03 21:13:22 +02:00
jperaltamalvar 57a30dd375 Remove more typename
Needed to compile con Windows
2016-05-03 16:00:44 +02:00
Daniel J. Hofmann 5517ee334f Remove typename prefix from non-dependent type alias
I think VS is predantic but actually right here.

References:
- http://eel.is/c++draft/namespace.udecl#19
2016-05-03 12:00:40 +02:00
Daniel J. Hofmann 30af544919 Changelog for street name assembly 2016-05-03 00:09:17 +02:00
Daniel J. Hofmann f0069d3dcc Makes bicycle and foot profile's name and ref tag handling consistent with car profile 2016-05-03 00:09:17 +02:00
Patrick Niklaus 206bdff9e7 Inline and vectorize haversine for GetPathDistance 2016-05-02 19:53:42 +02:00
Patrick Niklaus c32270b2b8 Make projectOnLine inline-able 2016-05-02 19:53:05 +02:00
Patrick Niklaus cc03402570 Use pass-by-copy for Coordinate 2016-05-02 19:51:32 +02:00
Patrick Niklaus 21a76f1867 Move coordinate constructors to header to enable inlining 2016-05-02 19:50:52 +02:00
Patrick Niklaus 212ad94c90 x2 speedup in Douglas Peucker by projecting all coordinates first 2016-05-02 19:50:33 +02:00
Patrick Niklaus 378d9f4112 Remove debug ouput from post-processing 2016-05-02 19:47:59 +02:00
Patrick Niklaus e341d367d8 Move detail:: to osrm::detail:: 2016-05-02 18:36:32 +02:00
Daniel J. Hofmann 98937b187f We require Visual Studio 2015+
References:
- https://github.com/Project-OSRM/osrm-backend/issues/2341#issuecomment-216231618
2016-05-02 17:50:54 +02:00
Moritz Kobitzsch 59168e21b4 remove unnecessary warnings, initialize correctly 2016-05-02 17:29:37 +02:00
Patrick Niklaus d12a95b4ef Fix naming convention of Percent 2016-05-02 17:25:58 +02:00
Patrick Niklaus 83482afa02 Fix naming conventions of TrajanSCC 2016-05-02 17:25:58 +02:00
Patrick Niklaus e470d1ae1c Fix naming convention in RasterSource 2016-05-02 17:25:58 +02:00
Patrick Niklaus e504128587 Fix naming convention in HiddenMarkovModell 2016-05-02 17:25:58 +02:00
Patrick Niklaus 1ab6c07bad Fix naming convention in BayesClassifier 2016-05-02 17:25:58 +02:00
Patrick Niklaus 5ce465ce23 Remove extra ; in PostProcessing 2016-05-02 17:25:58 +02:00
Patrick Niklaus a8b730576f Fix naming convention in GeospatialQuery 2016-05-02 17:25:58 +02:00
Patrick Niklaus b796033473 Clean up naming conventions in CRC32 code 2016-05-02 17:25:58 +02:00
Patrick Niklaus d078ed67ca Fix naming convention in GraphContractor 2016-05-02 17:25:58 +02:00
Lauren Budorick 346146d834 Address comments from b89164c14e (#2346) 2016-05-02 08:00:27 -07:00
Patrick Niklaus 64307ea882 Add missing headers and remove dead code 2016-04-29 20:02:08 +02:00
Patrick Niklaus 578eda7d28 [skip ci] Add release docs 2016-04-29 14:00:10 +02:00
Patrick Niklaus 505f4cb4a2 [skip ci] Add profile documentation 2016-04-29 13:10:43 +02:00
Patrick Niklaus bac6b729bf Overhault the README 2016-04-29 13:00:27 +02:00
Patrick Niklaus d3a5cadb6c [skip ci] Fix linkt to C++ library 2016-04-29 12:26:04 +02:00
Patrick Niklaus 65351faf83 [skip ci] Move correct docs. 2016-04-29 12:24:21 +02:00
Patrick Niklaus 3aa1c5f13c Link docs from README 2016-04-29 12:20:51 +02:00
Patrick Niklaus 8f3fe410b8 Import docs from the wiki 2016-04-29 12:16:19 +02:00
Patrick Niklaus ff3bf32b11 Merge pull request #2342 from Project-OSRM/publish-win-binaries
make AppVeyor publish binaries again
2016-04-29 11:16:27 +02:00
bergwerkgis 38cb01a30e [skip travis] make AppVeyor publish binaries again 2016-04-29 10:32:29 +02:00
Lauren Budorick b8f7569e93 Implement arbitrary turn penalty file IO and integration (#2306)
Closes #1830
2016-04-29 00:48:13 -07:00
Moritz Kobitzsch cf17bd38eb Revert "Revert "switched to space separated suffix/prefix only"" 2016-04-28 14:59:17 +02:00
Patrick Niklaus 930f6df2cb Fixes #2335, map matching was using shortest path with uturns disabled 2016-04-28 12:02:31 +02:00
Patrick Niklaus e88106e990 Revert "switched to space separated suffix/prefix only"
This reverts commit e9e935303c.
2016-04-27 23:20:10 +02:00
Patrick Niklaus 21f64c75eb Merge pull request #2324 from oxidase/master
Fix syntax error position indicators in parameters queries
2016-04-27 23:15:16 +02:00
Michael Krasnyk 5186b9490d Fix syntax error position indicators in parameters queries
To fix #2193 prefix_length member variable has been added to ParsedURL
that is set to the length of "/service/version/profile/" prefix
when the prefix is accepted by the parser.
Also BOOST_FUSION_ADAPT_STRUCT for osrm::server::api::ParsedURL
has been moved from header to url_parser.cpp to speed up compilation
of CUs that do not use the fusion adaption.
2016-04-27 19:52:23 +02:00
Moritz Kobitzsch e9e935303c switched to space separated suffix/prefix only 2016-04-27 19:12:24 +02:00
Moritz Kobitzsch a154d71841 enable suppression name suffix changes 2016-04-27 18:10:56 +02:00
Moritz Kobitzsch fddb035539 suppress name additions (xxx -> xxxbridge) 2016-04-27 12:13:42 +02:00
Moritz Kobitzsch 1544a08ea2 introduce roundabout-turns into instruction set 2016-04-27 12:13:42 +02:00
Moritz Kobitzsch 8d68d4c050 fix copy-paste errors in guidance tests 2016-04-26 13:43:22 +02:00
Moritz Kobitzsch 62a1290043 remove invalid assertion 2016-04-26 13:16:44 +02:00
Moritz Kobitzsch c5e1742150 fix post-processing for local paths, fixes #2310 2016-04-26 13:15:46 +02:00
Moritz Kobitzsch 754bc2d274 handle combined turns at segregated roads 2016-04-26 13:13:20 +02:00
Moritz Kobitzsch 3ac061c546 fix guidance issues / improve tests 2016-04-26 10:34:39 +02:00
Moritz Kobitzsch e59a7926a2 roundabout for segregated entry roads 2016-04-26 01:01:09 +02:00
Moritz Kobitzsch be5b49e391 Fix local path looping, fixes #2309 2016-04-25 19:37:59 +02:00
Moritz Kobitzsch 7b32d3184c remove unused instruction types 2016-04-25 19:24:59 +02:00
Moritz Kobitzsch d770c35245 refactor guidance 2016-04-25 19:24:59 +02:00
Daniel J. Hofmann e04baef3bb Do not copy geometries in loop 2016-04-25 12:12:32 +02:00
Patrick Niklaus 9d3ad22bc7 Fix path to monaco data 2016-04-25 00:46:36 +02:00
Patrick Niklaus cc35d15b2d More folds and reorder some build instructions 2016-04-25 00:19:48 +02:00
Patrick Niklaus 15e3928906 Merge pull request #2312 from oxidase/stateless-parameters-grammars
Stateless parameters grammars and fix for PhantomNode bitfields packing in MSVC
2016-04-24 23:45:51 +02:00
Michael Krasnyk 4363fd64c4 Fix for PhantomNode packing in MSVC
Changed bool to uint32_t in bit fields to have 4-byte packings for 32 bits:
"c++ compilers will allocate bit-fields in memory as follows:
several consecutive bit-field members of the same type will
be allocated sequentially. As soon as a new type needs to be allocated,
it will be aligned with the beginning of the next logical memory block."

References:
- https://msdn.microsoft.com/en-us/library/ewwyfdbe.aspx
- http://stackoverflow.com/questions/308364/c-bitfield-packing-with-bools/308383#308383
2016-04-24 14:06:48 +02:00
Michael Krasnyk dac2f93383 Refactoring of parameter garammars
* signature changed from void() to void(engine::api::Parameters&)
* performance increase due to use "static const GrammarT" and avoid
  construction and destruction of grammars during parsing
* removed code duplication in inherited grammars
* rule unlimited changed to qi::lit
* added rule size_t_
* parser accepts "&geometries=" and "&overview=" and fails at "foo"
  instead of "&geometries=foo" and &overview=foo
* added expectations checks for derived grammars
* changed rules qi::list(".") to character rules '.'
2016-04-23 21:15:21 +02:00
Patrick Niklaus 82372bb2ab Remove develop branch from appveyor 2016-04-23 17:55:18 +02:00
Patrick Niklaus b0c67c9019 Update coverall badge 2016-04-23 14:19:58 +02:00
Patrick Niklaus d83a34f72b Remove develop branch from travis 2016-04-22 14:51:38 +02:00
Patrick Niklaus a16f156203 Update README to remove develop branch 2016-04-22 14:49:27 +02:00
Patrick Niklaus 807aa71a7c Merge branch 'develop' 2016-04-22 14:35:32 +02:00
Patrick Niklaus 14d9b67b58 Update changelog with regard to 4.9.1 2016-04-22 14:28:45 +02:00
Patrick Niklaus 82df0ca766 Fix parser tests and destinations=all / sources=all 2016-04-22 11:01:15 +02:00
bergwerkgis a6c7529a4e AppVeyor: new path to test executables, add server-tests.exe 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann 202bb6d3e2 Fix accidental rebase issues 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann bc514926bf Unit test for trip across component boundaries.
Daniel's mental model, with updates from Patrick and staring at the code
(plugins/trip.cpp): Trip first snaps coordinates which in the case of
phantoms that are not only in small components with the same id
switches small components to big ones. Therefore we get either only
small or only big components. Only then the Tarjan SCC decomposes this.

Result: multiple subtrips only happen for islands or continents.
2016-04-22 10:40:03 +02:00
Daniel J. Hofmann 9fc16b6a83 Unit test for trip exclusively in big component 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann 2125e0175d Unit tests for special symbols in radiuses, sources, destination 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann 6b5982d389 Table unit test, revealing position_index -> waypoint_index mismatch 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann a4a8aa63d4 Invalid route requests 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann bedf451952 Namespace aliases 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann 93b8f1993c Split off parameters I/O from unit tests 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann c693f4806b Unit tests for routing / snapping across components 2016-04-22 10:40:03 +02:00
Patrick Niklaus b07275694a Add more guidance tests 2016-04-21 23:07:29 +02:00
Patrick Niklaus 82177c101b Add changelog entry for summary 2016-04-21 22:47:05 +02:00
Patrick Niklaus da6dbd2159 Revert "Removes summary from legs property"
This adds the summary back to the RouteLeg, it now depends on if
`steps=true`.
This reverts commit eaf9993dd9.
2016-04-21 22:39:16 +02:00
Patrick Niklaus b3957d87b4 Add changelog entry 2016-04-21 22:14:01 +02:00
Patrick Niklaus 5f9ccadd6c If geometry is only one point, encode as Point not as LineString 2016-04-20 20:49:54 +02:00
karenzshea 6e04da9f8f remove movable bridge refs in bike profile 2016-04-19 14:24:16 -04:00
karenzshea 58c13d2c07 remove movable bridge travel mode references 2016-04-19 12:59:33 -04:00
karenzshea bca8593eef remove movable bridge mode from car profile 2016-04-19 10:21:46 -04:00
Patrick Niklaus 3e2e10a4c3 Add unit test for tile plugin 2016-04-15 14:48:21 +02:00
Patrick Niklaus 6979763292 Refactor the vector tile constants 2016-04-15 14:48:21 +02:00
karenzshea 324f1739e4 more table tests, break waypoint obj check into header file 2016-04-15 14:46:17 +02:00
karenzshea 1489662f57 start tests for table plugin 2016-04-15 14:46:17 +02:00
Daniel Patterson 1c1f407f67 Fix formatting. 2016-04-14 14:39:20 -07:00
Daniel Patterson 8fb631417b Abort processing if there are no snappable edges remaining. 2016-04-14 13:07:23 -07:00
Moritz Kobitzsch ae45ad1ad2 fix r-tree abort location 2016-04-14 11:40:36 +02:00
Patrick Niklaus 6b89803534 Forgot to commit a test 2016-04-13 11:24:14 +02:00
Patrick Niklaus d01b34f501 Forgot changelog entry 2016-04-12 23:17:47 +02:00
Patrick Niklaus fcad2fa471 Update changelog 2016-04-12 23:16:02 +02:00
Patrick Niklaus 589767fe6d uturns -> continue_straight 2016-04-12 23:16:02 +02:00
Daniel J. Hofmann d6407e5095 Fixes regression introduced in 8ff8dc.
References:
- https://github.com/Project-OSRM/osrm-backend/pull/2252/commits/8ff8dc7200c0e1623b66ec950419be233ab37cc3
2016-04-12 21:12:08 +02:00
Patrick Niklaus 8ff8dc7200 Try ulong_long, requires ifdef 2016-04-12 18:11:08 +02:00
Patrick Niklaus 2f7b02c96f Fix std::min 2016-04-12 18:11:08 +02:00
Patrick Niklaus 669e2a767a Another missed irange 2016-04-12 18:11:08 +02:00
Patrick Niklaus 2b4f9feeab Forgot a irange fix 2016-04-12 18:11:08 +02:00
Patrick Niklaus 1554916639 Include <iterator> for back_inserter 2016-04-12 18:11:08 +02:00
Patrick Niklaus 32a3651231 Changed windows encoded size to 104 2016-04-12 18:11:08 +02:00
Patrick Niklaus dbd4ecf89b Remove boost::irange 2016-04-12 18:11:08 +02:00
Patrick Niklaus 7416653874 Force correct type deduction for irange on windows 2016-04-12 18:11:08 +02:00
Patrick Niklaus 621ed970da Fix assertions about hint size for windows 2016-04-12 18:11:08 +02:00
Patrick Niklaus 457ba9ac62 Adapt RC2 changelog 2016-04-12 17:15:16 +02:00
Patrick Niklaus f9da5f2c80 Fix coverall flags 2016-04-12 16:20:45 +02:00
Patrick Niklaus b6a793a1e2 Fix COVERAGE=ON and add SANITIZE=ON/OFF 2016-04-12 15:43:29 +02:00
Daniel J. Hofmann bf2ab3d8af One-Definition-Rule violation in viewport 2016-04-12 12:17:52 +02:00
Daniel J. Hofmann 02f75236cb Increase the Cucumber timeout, as we're hitting it on Travis.
Our OSX Travis builds seem to hit the 2s timeout from time to time,
which is really irritating.

This increases the timeout to 5s, hoping for the best.
2016-04-12 12:17:01 +02:00
Daniel J. Hofmann 5dff83c6e9 Report progress for gennerating edge expanded edges in the edge based graph factory 2016-04-12 12:16:14 +02:00
Daniel Patterson 43725bae89 Fix Radius Calculation for points collinear in latidue 2016-04-12 11:25:59 +02:00
Patrick Niklaus 59c12506cf Update taginfo 2016-04-11 09:38:54 +02:00
Daniel J. Hofmann be15a3b739 Add maxspeed=none tag to car profile.
maxspeed=none means there is no explicit maxspeed limit. Set to
guestimate for driving on the Autobahn.

References:

 - https://github.com/Project-OSRM/osrm-backend/issues/2145
 - http://wiki.openstreetmap.org/wiki/Key:maxspeed
 - http://taginfo.openstreetmap.org/tags/maxspeed=none
 - http://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Maxspeed
2016-04-11 09:38:45 +02:00
Patrick Niklaus 9f515dad09 Fix tests 2016-04-09 23:04:43 +02:00
Patrick Niklaus 5052c4ae3a Move projection function into own header and inline 2016-04-09 17:31:36 +02:00
Patrick Niklaus 9a617f5d41 Make the poly2req script work with 4.9 and 5.0 and add modes 2016-04-09 17:31:36 +02:00
Patrick Niklaus 4886d46d91 Use DouglasPeucker with squaredEuclideanDistance 2016-04-09 17:26:27 +02:00
Patrick Niklaus 67834def5f Switch to uint64 for distance measurements in StaticRTree 2016-04-09 17:26:27 +02:00
Patrick Niklaus c51ffeb65a Switch StaticRTree leaf size to 256 elements per leaf
This increses query performance dramatically for queries with a lot of
coordinates. However it increases the internal memory usage of the
StaticRTree also 4x.
2016-04-09 17:26:27 +02:00
Patrick Niklaus 68ee4eab61 Switch squaredEuclideanDistance to uint64_t 2016-04-09 01:38:22 +02:00
Patrick Niklaus fa6d4ac0bc Add faster version of WGS84 -> Web Mercator 2016-04-09 01:38:22 +02:00
Patrick Niklaus 3fa533d91e Okay include build again since it seems to contain the coverage files 2016-04-09 00:28:04 +02:00
Patrick Niklaus c0db144906 Exclude build and third_party 2016-04-09 00:07:19 +02:00
Patrick Niklaus ea2ec168b0 Cleanup .travis.yml and run coverall from root 2016-04-08 21:40:05 +02:00
Patrick Niklaus cb18c1a54d Adapt status cucumber tests 2016-04-08 21:03:50 +02:00
Daniel J. Hofmann 45bcb22270 Fixes unit tests that relied upon wrong behavior in parsers 2016-04-08 21:03:50 +02:00
Daniel J. Hofmann 2539fd53dc Enable unit test that should pass with fixes from this branch 2016-04-08 21:03:50 +02:00
Daniel J. Hofmann 8a2bd09fd0 Adapts all grammars to use expectation parsers without backtracking.
Sequence parsers using `>>` allow for backtracking, expectation parsers
`>` do not. This allows us to properly report the position where parsing
failed, by catching the expectation_failure exception and adapting the
iterator ourselves.

References:
- https://github.com/Project-OSRM/osrm-backend/pull/2188
- https://github.com/Project-OSRM/osrm-backend/issues/2168
- http://www.boost.org/doc/libs/1_55_0/libs/spirit/doc/html/spirit/qi/reference/operator/expect.html
2016-04-08 21:03:50 +02:00
Daniel J. Hofmann def89ac079 Conform to v5 spec and support "unlimited" as radiuses value.
Supersedes: https://github.com/Project-OSRM/osrm-backend/pull/2231

Thanks to Michael Krasnyk (@oxidase) for figuring out the reason for the
segfault earlier:

> https://github.com/Project-OSRM/osrm-backend/pull/2231#issuecomment-207114226
2016-04-08 21:03:50 +02:00
Michael Krasnyk fe08726387 Fix BOOST_FUSION_ADAPT_STRUCT parameters for ParsedURL
Fix build error: macro "BOOST_FUSION_ADAPT_STRUCT" passed 5 arguments, but takes just 2
https://travis-ci.org/Project-OSRM/osrm-backend/builds/121406444
2016-04-08 21:03:50 +02:00
Daniel J. Hofmann 9bb4a68599 Fixes grammar includes and formats them 2016-04-08 21:03:50 +02:00
Daniel J. Hofmann 996a27dbd1 Report position where parsing failed; resolves #2168 2016-04-08 21:03:50 +02:00
Michael Krasnyk 58ebadd7b3 Fix #2173 with a no_trailing_dot_policy
no_trailing_dot_policy rejects parsing exp, exp_n, nan, inf
and rejects parsing a fractional part if detects ".Fmt".
For Fmt = 'j', 's', 'o', 'n':
 42.foo    rule parses 42.
 42.json   rule parses 42
 42..json  rule parses 42.

Reference:
- https://github.com/Project-OSRM/osrm-backend/pull/2222#issuecomment-206206239
2016-04-08 21:03:50 +02:00
Michael Krasnyk cae06ba2c1 Fix type "osrm::server::api::ParsedURL ()" 2016-04-08 21:03:50 +02:00
Daniel J. Hofmann 0274afa0f7 Allow 4.json and 4.3.json format; needs -lit(".") >> -lit("json") hack^Wworkaround
Rainer Deyke's workaround without the need to do ugly backtracking.

References:
- http://lists.boost.org/boost-users/2016/03/85960.php
- https://github.com/Project-OSRM/osrm-backend/issues/2173#issuecomment-204342785
2016-04-08 21:03:50 +02:00
Daniel J. Hofmann 221f70ac7b Synthesize parser only once from DSL: static storage duration 2016-04-08 21:03:50 +02:00
Daniel J. Hofmann d3dbca374d Do not modify the end iterator for parameter parsing, too 2016-04-08 21:03:50 +02:00
Daniel J. Hofmann 6f0b6a8158 Re-factor URL parser: make grammar stateless 2016-04-08 21:03:50 +02:00
Daniel J. Hofmann b25cd6aaf2 Moving from references is a bad idea in parameter parsers, too 2016-04-08 21:03:50 +02:00
Daniel J. Hofmann d27025003a Do not move from references in grammar handlers 2016-04-08 21:03:50 +02:00
Daniel J. Hofmann 66eb90d9d0 Adapts move(*optional) to *move(optional) to get rvalue operator* overload 2016-04-08 21:03:50 +02:00
Daniel J. Hofmann 6a81a9d191 Extra semicolon 2016-04-08 21:03:50 +02:00
Daniel J. Hofmann 64cb134113 Align Spirit rules for URL parser 2016-04-08 21:03:50 +02:00
Daniel J. Hofmann 891ff7dd80 Do not modify the end iterator, make const 2016-04-08 21:03:50 +02:00
Patrick Niklaus 6643e7f499 Integrate converage reporting 2016-04-08 20:37:51 +02:00
Moritz Kobitzsch fcbf527ba5 refactor of turn analysis into turn handlers 2016-04-08 18:14:43 +02:00
Moritz Kobitzsch dfd180a292 fixing unit tests 2016-04-08 11:21:14 +02:00
Moritz Kobitzsch fa0a5040e5 adding tests for guidance 2016-04-08 10:43:22 +02:00
Dane Springmeyer 56ba2cb251 Add missing -lz to fix linking of server-tests 2016-04-08 01:52:35 +02:00
Patrick Niklaus dea12779cf basename -> filename, fixes #2027 2016-04-08 01:50:25 +02:00
karenzshea 6033c05ff0 checks for waypoint index and route lengths 2016-04-07 22:11:28 +02:00
karenzshea 407da8bd15 start match test 2016-04-07 22:11:28 +02:00
Daniel J. Hofmann 43413ff980 Add license to storage and storage config exposed in public API, closes #2036 2016-04-07 10:41:32 +02:00
Moritz Kobitzsch 4d864b8267 fix warnings in compilation on clang 2016-04-06 18:44:42 +02:00
Daniel J. Hofmann a516245c94 Modularize benchmarks subproject 2016-04-06 18:36:08 +02:00
Daniel J. Hofmann b1ed268d0e Start modularizing the CMake buildsystem
The main reason for modularizing the unit tests was to split off
libboost_unit_test_framework from the osrm toolchain binaries.

Now only the unit test binaries link against it, unblocking
binary distribution without unit test library dependencies.

I started this on v4 a couple of weeks ago and hit a -llua5 issue on
Travis. By now v5 diverged quite a bit (especially in the code that I
have to stare at for debugging the issues).

https://github.com/Project-OSRM/osrm-backend/pull/2073

Let's bring this to v5+ only.

This is blocking:

- https://github.com/Project-OSRM/osrm-backend/issues/2065
- https://github.com/Project-OSRM/osrm-backend/issues/2197#issuecomment-204864938
2016-04-06 18:36:06 +02:00
Patrick Niklaus 83b86bf092 Fix typo .travis.yml for clang compiler name 2016-04-06 18:08:22 +02:00
Daniel J. Hofmann 954caa6804 The C compiler is used for several CMake tests, match with C++ compiler 2016-04-06 15:25:18 +02:00
Patrick Niklaus 8b6da4d2fe Enable server-tests on travis 2016-04-06 15:20:53 +02:00
Patrick Niklaus f2d70d972d Temporarily enable travis for rewrite/new-api branch 2016-04-06 15:16:28 +02:00
Daniel J. Hofmann b20de76037 Make verbose sections foldable on Travis 2016-04-06 10:58:49 +02:00
Patrick Niklaus a33bd9dfe6 Adapt benchmarking script 2016-04-05 23:40:24 +02:00
Moritz Kobitzsch f2443c64db adds distinction between rotaries/rounabouts 2016-04-05 22:59:14 +02:00
Patrick Niklaus 278ec04f5e Remove left-over summary code 2016-04-05 22:59:14 +02:00
Patrick Niklaus 95787255a1 Fix broken uturns test 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann eaf9993dd9 Removes summary from legs property 2016-04-05 22:59:14 +02:00
Moritz Kobitzsch 470d7600b8 fixes 2219 2016-04-05 22:59:14 +02:00
Patrick Niklaus 849baea544 Fix uturn detection in match plugin 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 4f1ca20dda Do not rely on alternatives being found in unit tests 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 97401ad99a Disable steps and alternatives by default 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 59f5e364c1 Suppress pedantic ISO C++ warning about argv[0] size check 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 29c2a117c0 Adapts tests to case sensitive "Ok" status code. 2016-04-05 22:59:14 +02:00
Patrick Niklaus c209e31ce1 Fix tests for 2016-04-05 22:59:14 +02:00
Patrick Niklaus 12608889e2 Fix 'ok' -> 'Ok' 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 3343882876 Resolves issues with multiple includedirs in pkg-config file; closes #2195. 2016-04-05 22:59:14 +02:00
Patrick Niklaus 6e50b5fc60 Filter segments correctly by bounding box 2016-04-05 22:59:14 +02:00
Patrick Niklaus c540c85cf8 Remove tests from default target until we get proper switchting in place 2016-04-05 22:59:14 +02:00
Patrick Niklaus b17491ebe5 Bump osrm version 2016-04-05 22:59:14 +02:00
Patrick Niklaus 76b410b2ca Update changelog to 5.0.0 RC1 2016-04-05 22:59:14 +02:00
Daniel Patterson 069388eae0 Exclude new node_modules folder that might be around if test cases have been run. 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann c6c25e609b Initial libosrm API docs 2016-04-05 22:59:14 +02:00
Daniel Patterson 9b52dd8bf7 Remove leftover debug output. 2016-04-05 22:59:14 +02:00
Daniel Patterson 2cf19010e3 Fix context returned in JSON error (had null bytes).
Update status test cases to match new API.
2016-04-05 22:59:14 +02:00
Moritz Kobitzsch 89d56e1cd1 fix duration of direct connection 2016-04-05 22:59:14 +02:00
Moritz Kobitzsch ef1fb08723 fix cucumber tests and issues 2016-04-05 22:59:14 +02:00
Daniel Patterson e60ebee3f2 Add missing arrival instruction. 2016-04-05 22:59:14 +02:00
Lauren Budorick 4c88fe0fb1 Add arrival instruction 2016-04-05 22:59:14 +02:00
Daniel Patterson 13338414db Add missing arrival instruction. 2016-04-05 22:59:14 +02:00
Daniel Patterson 96f49f3b53 Add missing arrival instruction. 2016-04-05 22:59:14 +02:00
Daniel Patterson 75979d7e1c Add missing arrival instruction. 2016-04-05 22:59:14 +02:00
Daniel Patterson 29a2447906 Add missing arrival instruction. 2016-04-05 22:59:14 +02:00
Daniel Patterson 2f702f61a4 Add missing arrival instruction. This test was incorrect. 2016-04-05 22:59:14 +02:00
Lauren Budorick 5a71acbe3c Add missing arrival instructions 2016-04-05 22:59:14 +02:00
Daniel Patterson ca3e8ef09e Add missing arrive instruction. 2016-04-05 22:59:14 +02:00
Daniel Patterson 8c44084af1 Add missing arrive instruction. 2016-04-05 22:59:14 +02:00
Daniel Patterson d829a390fd Add missing arrive instruction. 2016-04-05 22:59:14 +02:00
Daniel Patterson 6b6597e453 Add missing arrive instruction. 2016-04-05 22:59:14 +02:00
Daniel Patterson 97c550d5f6 Add missing arrive instruction to distance feature. 2016-04-05 22:59:14 +02:00
Daniel Patterson acfd6ab141 Fix missing arrive instruction on bearing tests. 2016-04-05 22:59:14 +02:00
Daniel Patterson 7e790c1aa6 Add missing arrive instructions to time tests. 2016-04-05 22:59:14 +02:00
Lauren Budorick d1e2aa57a8 start updating testbot fixtures (TODO: the rest) 2016-04-05 22:59:14 +02:00
Lauren Budorick 2e6e3bf0b0 Update raster features to reflect not cutting off arrive instruction 2016-04-05 22:59:14 +02:00
Lauren Budorick e5025665fc Update foot features to reflect not cutting off arrive instruction 2016-04-05 22:59:14 +02:00
Lauren Budorick 1a8097f810 Update car features to reflect not cutting off arrival instruction 2016-04-05 22:59:14 +02:00
Patrick Niklaus f45daad6ca Fix code of InternalError 2016-04-05 22:59:14 +02:00
Patrick Niklaus e4e85e6f7e Fix some via tests 2016-04-05 22:59:14 +02:00
Daniel Patterson 5beaf695ed Fix bearing param tests. Have not yet fixed the cause of the two failing cases. 2016-04-05 22:59:14 +02:00
Lauren Budorick d09827b501 Update bicycle tests to reflect not cutting off arrive step 2016-04-05 22:59:14 +02:00
Daniel Patterson 97722adbfa Adjust threshold when trimming steps (needs to be bigger).
Also, when trimming the last step, we need to copy name values from the new next-to-last step, otherwise
we can still end up with an arrive step on a different road to the last maneuver.
2016-04-05 22:59:14 +02:00
Patrick Niklaus 006a8833d3 Fix some of the accidental forced loops in viaroute 2016-04-05 22:59:14 +02:00
Patrick Niklaus 8111baa8f9 Remove unused detach parameter 2016-04-05 22:59:14 +02:00
Daniel Patterson d6e4dc0aa2 Add 'arrive' step to route descriptions. 2016-04-05 22:59:14 +02:00
Daniel Patterson 497da1d29b Colorize test result diff output. 2016-04-05 22:59:14 +02:00
Lauren Budorick cbc8b64854 unbreak the zombiekilling 2016-04-05 22:59:14 +02:00
Lauren Budorick c06f2a50f1 Fix routability now that we don't chop off a step 2016-04-05 22:59:14 +02:00
Patrick Niklaus 825a422721 Remove arrive filter 2016-04-05 22:59:14 +02:00
Patrick Niklaus 2c4ba90abb Remove leftover hello_world and timestamp plugins 2016-04-05 22:59:14 +02:00
Patrick Niklaus 6dda899a60 There is no timestamp service anymore 2016-04-05 22:59:14 +02:00
Lauren Budorick 8725e2f40d Remove one more compass column; update polyline encoding tests 2016-04-05 22:59:14 +02:00
Patrick Niklaus 35c501c203 .json hotfix 2016-04-05 22:59:14 +02:00
Patrick Niklaus 30a9bc3179 Fix mathematical assumptions in StaticRTree
StaticRTree now uses projected coordinates internally. That means we can
use a euclidean distance measure (squared distance) for sorting the
query queue.
2016-04-05 22:59:14 +02:00
Moritz Kobitzsch f9350a276c fix same segment routes 2016-04-05 22:59:14 +02:00
Moritz Kobitzsch cd9addf0e2 Removed debug code 2016-04-05 22:59:14 +02:00
Moritz Kobitzsch 2219b6507c correctly handle roundabouts in a wide set of special cases 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 09931d7ad8 Removes server-side support for POST requests. 2016-04-05 22:59:14 +02:00
Lauren Budorick 7ce0c0ef9a Rm unnecessary io.write 2016-04-05 22:59:14 +02:00
Lauren Budorick 49e2cb6c36 Fix raster_source + tests 2016-04-05 22:59:14 +02:00
Lauren Budorick 4b60fc4747 return geometry from new API 2016-04-05 22:59:14 +02:00
Lauren Budorick 164fb09f2c Fix route/bearing param 2016-04-05 22:59:14 +02:00
Lauren Budorick 5647e6c199 Fix double shutdown 2016-04-05 22:59:14 +02:00
Lauren Budorick a4d6544764 Fix alternatives option test, chdirs on fail, spacing 2016-04-05 22:59:14 +02:00
Lauren Budorick e942f6e420 Update pushing test to reflect better guidance 2016-04-05 22:59:14 +02:00
Patrick Niklaus 7174baa91e Move osrm-components to BUILD_COMPONENTS flag 2016-04-05 22:59:14 +02:00
Patrick Niklaus 5c8b7542d0 Fix staticrtree benchmark 2016-04-05 22:59:14 +02:00
Lauren Budorick e8035ced5a Fix trips + matchLocation 2016-04-05 22:59:14 +02:00
Jeff Miccolis 70a086a9e1 make eslint happy 2016-04-05 22:59:14 +02:00
Jeff Miccolis 08cb6d1f63 Fix timestamp handling, restores testbot/matching test 2016-04-05 22:59:14 +02:00
Lauren Budorick c7f3645fe2 Status fixes 2016-04-05 22:59:14 +02:00
Lauren Budorick 4b6a85aae0 Distance matrix fixes 2016-04-05 22:59:14 +02:00
Lauren Budorick c8a8859d2f rm console.log my bad 2016-04-05 22:59:14 +02:00
Lauren Budorick 8c0f47f06c Fix guidance/roundabout spacing 2016-04-05 22:59:14 +02:00
Lauren Budorick 926290dd9c enter_roundabout -> roundabout-exit (these are still off by one @mokob ?) 2016-04-05 22:59:14 +02:00
karenzshea 6ae3315bb9 parse for the right nearest output coordinate 2016-04-05 22:59:14 +02:00
Jeff Miccolis 8621b1890e Fix testbot turns 2016-04-05 22:59:14 +02:00
karenzshea c726001a0e console error which files are missing for osrm-routed 2016-04-05 22:59:14 +02:00
Jeff Miccolis eba5f7d275 Matrix times are on seconds now. Removing POST matrix tests 2016-04-05 22:59:14 +02:00
Lauren Budorick 2f793473cc head/destination -> depart/arrive to reflect guidance API changes; minor fixes for roundabout tests 2016-04-05 22:59:14 +02:00
karenzshea 91567cad9e update osrm-routed options menu 2016-04-05 22:59:14 +02:00
Jeff Miccolis d48ee84ae7 Return first alternative in tests 2016-04-05 22:59:14 +02:00
Jeff Miccolis fd000cad86 Remove compass direction test handling 2016-04-05 22:59:14 +02:00
Lauren Budorick 6244063073 #2155 is fixed 2016-04-05 22:59:14 +02:00
Jeff Miccolis f34de8422e eslinting 2016-04-05 22:59:14 +02:00
Jeff Miccolis a33edd15b4 Update alternatives flag 2016-04-05 22:59:14 +02:00
Jeff Miccolis 6a65261765 test query params are an object 2016-04-05 22:59:14 +02:00
Jeff Miccolis 07f3e2d457 Removing unneeded stopgap 2016-04-05 22:59:14 +02:00
Jeff Miccolis 958199ffef Allow for different rounding in car-maxspeed fixture 2016-04-05 22:59:14 +02:00
Jeff Miccolis e5ebf74d76 Add stopgap for https://github.com/Project-OSRM/osrm-backend/pull/2159 2016-04-05 22:59:14 +02:00
Lauren Budorick 126d2f85ac Mode changes, guidance comments, fix turns 2016-04-05 22:59:14 +02:00
Lauren Budorick 908e3a2af6 Fixes: double callbacks and untested headers 2016-04-05 22:59:14 +02:00
Jeff Miccolis 25e40d723a Better handling of test response payloads 2016-04-05 22:59:14 +02:00
Lauren Budorick 7a764ce78b ensure all nodes are written as decimals 2016-04-05 22:59:14 +02:00
Lauren Budorick 8947c789a9 WIP: race conditions and stalling server 2016-04-05 22:59:14 +02:00
Lauren Budorick 8ac403abb9 start fixing URLs 2016-04-05 22:59:14 +02:00
Lauren Budorick 9752cb8e4d Add more files to be renamed; fix launch error 2016-04-05 22:59:14 +02:00
Lauren Budorick e9be9dd8d0 Bind use_turn_restrictions to ProfileProperties in scripting environment 2016-04-05 22:59:14 +02:00
Moritz Kobitzsch 5e6d638c6f perform zero-length segment removal 2016-04-05 22:59:14 +02:00
Daniel Patterson c47f6e2ca5 Use simpler coordinates for tests. 2016-04-05 22:59:14 +02:00
Daniel Patterson cc09df1961 Use correct perpendicular distance measure when simplifying line geometries. 2016-04-05 22:59:14 +02:00
Moritz Kobitzsch db26d2b2d7 fixes missing overrides in mock data facade 2016-04-05 22:59:14 +02:00
Daniel Patterson 5b33efeecc Fixes #2152 - weight vector needed to be reversed, and start index was wrong. 2016-04-05 22:59:14 +02:00
Patrick Niklaus fda4656630 Implement re-enabling of PhantomNode directions after bearing filtering 2016-04-05 22:59:14 +02:00
Patrick Niklaus 5829bbe22d Move Centroid to coordinate_calculation 2016-04-05 22:59:14 +02:00
Patrick Niklaus f4cfde719d Round integers to remove fake precision 2016-04-05 22:59:14 +02:00
Patrick Niklaus 1fd66f55c1 Fix problem with uturns=true 2016-04-05 22:59:14 +02:00
Patrick Niklaus a964bec0f8 Add route fixture test 2016-04-05 22:59:14 +02:00
Patrick Niklaus b65ba5c394 Adapt get_osrm to EngineConfig changes 2016-04-05 22:59:14 +02:00
Patrick Niklaus d51eefa1c4 Make tests build by default 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 4025cbd555 Make extractor unit tests work again after global uturn changeset 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 3da27c06c3 Number of waypoints equals number of input coordinates 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann bc7824812b Make test assumption failure output violation in Route unit tests 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann baf7822340 Hook up small component locations for Nearest response test 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 82ee08fcaf Provide dummy locations from our fixed monaco dataset 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 51d153a5f7 Fixes integer overflow due to fixed / floating mismatch in coordinate interpolation 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann df608e8b43 Makes switching between floating and fixed coordinates safe wrt. overflows 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 8e477437a6 Makes viewport immune to inf and nans 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann e70f0eea02 Fix base64 test wrt. Hint no longer taking coordinate in ctor 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 8be93a0202 Adapt mock facade implementation to renamed base facade symbols 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann d4f7f19a22 Provide implementation for all pure virtual base member functions in mock facade 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 4441381042 Mismatched tag in fwd decl 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 61c9c69718 Make unit tests compile again after rebasing 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 5beaab97da Make Tile plugin validate its parameters, fixes #2109 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 843a4b8eae Make Route plugin validate its parameters 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 9ec46222e3 Makes Nearest plugin adhere to v5 spec for precondition violations, fixes #2108 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 210da11fbb Unit test for Route service; some failing where v5 spec is unclear 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann ee61ae360d Unit tests for Tile service; plugin needs improvements: see #2109 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 890e0f4995 Unit tests for Nearest service; one test failing: see #2108 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 224c66e0dc Makes table plugin adhere to v5 spec for limit violations, fixes #2100 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann 88052cd194 Adapts our Travis config to continuously run the library unit tests 2016-04-05 22:59:14 +02:00
Daniel J. Hofmann c22453f24a Tests for config level constraints; table failing: see #2100 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 099a805260 Initial unit tests setup for typed libosrm services 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 7ed474af8d Puts auto-generated monaco test files on gitignore 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 9d893d6d4d Library tests build system integration 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann e55af0c274 Add guidance assembly unit test stub 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 803fbf2541 Sentinel spelling 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 061b2b63e9 Explicitely construct coordinate and phantom node 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 1486098065 Adapts all unit tests and benchmarks to compile under v5 again 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 0f0db4c823 Provide correct Base64 implementation.
Phew, this was painful. Turns out most hints out there on how to use the
Boost serialization iterators are wrong. Here's why:

    transform_width<6, 8>

needs an input stream of length: common multiple of 6 and 8.

That is, the padding needs to happen _before_ using the provided
iterators, otherwise the behavior is undefined!

See: http://www.boost.org/doc/libs/1_60_0/boost/archive/iterators/transform_width.hpp

Thanks @mokob for pointing that out to me!

We also need to manually add as many padding chars "=" to the encoded
result as many bytes we had to append to the input to conform to the
rule above.

Decoding then knows the number of padding chars by counting for "=" and
then using it in order to split off the last bytes from the decoded
result.
2016-04-05 22:58:32 +02:00
Daniel J. Hofmann c3e7e96dce Adds round trip tests for RFC 4648 Test Vectors and equality checks 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 3c5f6bd8ac Makes hint Equatable and Printable for tests 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann b6b59e5c08 Make Hint encoding safe for passing them as GET parameter in URLs
Thanks @TheMarex for flagging this!
2016-04-05 22:58:32 +02:00
Daniel J. Hofmann a7aa27c87c Completely re-write base64 logic, make API suck less in doing so 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 735b325d74 RFC 4648 Test Vectors 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann f948380fa2 Object Encoder -> Base64, kill false dependencies while doing so 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 79cf1880fc Adapts Hint encoding and decoding to new fixed data facade 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann ca130e1dc4 Formats parameter parser unit tests 2016-04-05 22:58:32 +02:00
Patrick Niklaus d67ce81438 Fix hint size 2016-04-05 22:58:32 +02:00
Patrick Niklaus ec1a84c57a Always safe the absolute path to .fileIndex 2016-04-05 22:58:32 +02:00
Patrick Niklaus 59163cb2fc Install storage_config.hpp 2016-04-05 22:58:32 +02:00
Aleksei Potov 419cf9e2b0 compilation error on debian jessie with boost 1.54 2016-04-05 22:58:32 +02:00
Daniel Patterson 95c78eac9c Fix boost geometry constructor.
Versions older than 1.58 don't support the initializer-list form.
2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 51a4cf5e46 syncronize geometry and steps after post-processing 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 2472c5d6a1 added list of intersections to the step-maneuver, not in api so far 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 59fbb289b9 fix initial maneuvers 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch e82bc20422 post processing moved onto route-steps, looses sync with geometry segments 2016-04-05 22:58:32 +02:00
Patrick Niklaus 1e753e98ce Simplify the timestamp handling 2016-04-05 22:58:32 +02:00
Patrick Niklaus 39b3cab1da Check all streams 2016-04-05 22:58:32 +02:00
Patrick Niklaus 87fbfc6475 std::string -> boost::filesystem::path 2016-04-05 22:58:32 +02:00
Patrick Niklaus cb8bfa027e Only allow to specify the common base path 2016-04-05 22:58:32 +02:00
Patrick Niklaus 1b1274fd56 print -> io.write 2016-04-05 22:58:32 +02:00
Patrick Niklaus 38db495879 Address PR comments
Renamed lua_function_exists and removes unused print function
2016-04-05 22:58:32 +02:00
Patrick Niklaus a781c36876 Use uturn default from .properties file 2016-04-05 22:58:32 +02:00
Patrick Niklaus 71c336d9dd Adds .properties file to osrm-extract ouput
This file contains global properties set by the lua
profile, such as enabling uturns at vias and penalties.
This file will be consumed by the server.
2016-04-05 22:58:32 +02:00
Patrick Niklaus e10e8910f3 Use global uturns parameter.
Instead of previously per-via settings like uturns=true;false;true;; it
now only supports a global setting uturns=true.
2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 253496c7ee improves consistency of fork handling 2016-04-05 22:58:32 +02:00
Patrick Niklaus 30a3ab68c0 Make gcc 4.8 happy and disable protected because of lambdas 2016-04-05 22:58:32 +02:00
Daniel Patterson 663a7c52c7 Properly clip lines so that we don't get crazy coords with long linestrings (relative to tile coords) 2016-04-05 22:58:32 +02:00
Daniel Patterson 4e8ccd6f7d Include edge duration information. 2016-04-05 22:58:32 +02:00
Patrick Niklaus 879ccfc8c2 Implement viewport code to fix simplification
This fixes #2083
2016-04-05 22:58:32 +02:00
Patrick Niklaus a77574b3d7 Add tests for coordinate transformation 2016-04-05 22:58:32 +02:00
Patrick Niklaus 50738f8ce0 Consolidate math functions 2016-04-05 22:58:32 +02:00
Patrick Niklaus 5c01878542 get_name_for_id -> GetNameForID 2016-04-05 22:58:32 +02:00
Patrick Niklaus ea93f6f560 Simplfy name change announcement 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 7bab34eeda fix division by zero 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 0cc23dec6f restructured to only return valid turns to the outside + cleanup 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 71c0d5253d less new names, forks consider road classes, api clean-up 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch a674028c37 implement basic turn handling 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 29fff4f51b implements relative position feature based on coordinates 2016-04-05 22:58:32 +02:00
Patrick Niklaus 4309ccfa02 Don't sum up durations of merged steps since we do that in a different place now 2016-04-05 22:58:32 +02:00
Patrick Niklaus 4e8fe89faa Fix foward/backwad swap 2016-04-05 22:58:32 +02:00
Patrick Niklaus 8218d5a47e Limit zoomlevel to 18 2016-04-05 22:58:32 +02:00
Patrick Niklaus 4bbb587280 Fix shared memory 2016-04-05 22:58:32 +02:00
Patrick Niklaus 0f04fe75bd Fixup for last commit 2016-04-05 22:58:32 +02:00
Daniel Patterson 11b356e55f Enables the use of multiple segment-speed-files on the osrm-contract
command line, and exposes the file name used for each edge in the debug
tiles.
2016-04-05 22:58:32 +02:00
Patrick Niklaus 80f008684d Fix ingestion fixed duration values from UnpackPath 2016-04-05 22:58:32 +02:00
Patrick Niklaus c9c2d8133c Fix durations in UnpackPath 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch ac9a4d1e0d fixes a broken assertion 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch d7dd6acd9d fix merging of turn instructions 2016-04-05 22:58:32 +02:00
Patrick Niklaus b5739cb3d8 Include reverse edges again 2016-04-05 22:58:32 +02:00
Patrick Niklaus ea93d56ca8 Formating and logging changes for turn classification 2016-04-05 22:58:32 +02:00
Patrick Niklaus 10097a946f Handle case of dead-end edges by inserting an invalid turn 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch c439594403 report depart/arrive in addition to waypoint 2016-04-05 22:58:32 +02:00
Patrick Niklaus 29cf9e05db Only install necessary headers 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 298f68c966 Adds the license preamble for all publicly installed eaders, closes #2036 2016-04-05 22:58:32 +02:00
Patrick Niklaus 0b3289ea37 Remove the encoder/decoder dependecy from Hint 2016-04-05 22:58:32 +02:00
Patrick Niklaus 5f457bff12 Rename alternative -> alternatives 2016-04-05 22:58:32 +02:00
Patrick Niklaus 6c00ccca9a Remove obsolete debug information 2016-04-05 22:58:32 +02:00
Patrick Niklaus 7e679ab252 Just return NoSegment in map matching if all candidates are empty 2016-04-05 22:58:32 +02:00
Patrick Niklaus 0ca21dbc91 Add failing test for map matching of outlier 2016-04-05 22:58:32 +02:00
Patrick Niklaus d2590f1078 Fix missing capitalization of error codes 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch eb3f550e26 encapsulated into class 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 06aa6dedab improving fork handling on three-way turns 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch f769478abe fix comparison for ramps on three-way turns 2016-04-05 22:58:32 +02:00
Patrick Niklaus ba5f0af5a4 Minor auto iterator cleanup 2016-04-05 22:58:32 +02:00
Patrick Niklaus 5e5f72ae57 Don't pass down unsnapped coordinates. All information is already there 2016-04-05 22:58:32 +02:00
Patrick Niklaus f36037ebf2 Fix camMergeTrivially 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 0c276ac71e fixes roundabout counting 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 9e95d1f1fd fixes assignment for basic turn types / invalid ramp assignment 2016-04-05 22:58:32 +02:00
Patrick Niklaus e00bda37a5 Add edge id assertions 2016-04-05 22:58:32 +02:00
Patrick Niklaus e7ea5f500d Don't pass shared_ptr down to functions
"Don’t pass a smart pointer as a function parameter unless you want to
use or manipulate the smart pointer itself, such as to share or transfer
ownership."

Source:
http://herbsutter.com/2013/06/05/gotw-91-solution-smart-pointer-parameters/
2016-04-05 22:58:32 +02:00
Patrick Niklaus a8fc95d4e4 Move bearing to public namespace 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 3f598a5121 Properly includes needed headers in turn analysis interface 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 81c5ec0777 Const-correctnes for compressed geometry iterator 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 32bb58b272 Use stdint and using type-alias for discrete angle 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann aa4b786ab3 Hide functional road classification based on tags in implementation file 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 3f5968b60c Inline initialize functional road classification hash table 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 251eeb534a 256 functional road classes should be enough 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 90add9f840 Moves route assembly into implementation file 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 770624d492 Fixes remaining engine/guidance includes 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann c59758ef65 Fixes accumulate living in <numeric> and not <algorithm> 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 15752335f4 Puts step maneuver handling into implementation file 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 3e4b48e206 Removes penalizing move 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 25c685527a Uses static_casts for underlying type in post processing 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann fbabd137c2 Fix asymmetry in min/max from using -max 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 6e7cf68164 Adapts MakeResponse to not pass vector by pointer 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann b47a532eb4 Fixes multi-line comment 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 7c30ea32bf Runs scripts/format.sh 2016-04-05 22:58:32 +02:00
Patrick Niklaus bb06e044f5 Fix coodinate include and unused warnings 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 01318a08b4 start of four way turns 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 119487f1aa improved fork handling 2016-04-05 22:58:32 +02:00
Patrick Niklaus 911427a361 Fix crash on extracting Berlin in guidance 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 58628a4bfc bugfixing/classification 2016-04-05 22:58:32 +02:00
Patrick Niklaus b08b360f38 Big Restructuring / Cleanup 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch adb8d0e845 starting on conflict resolution 2016-04-05 22:58:32 +02:00
Lauren Budorick e0f009b3b9 Fixes for gcc compiling, temporary hacks to remove later 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch f1aa03c360 handle segregated roads (merge for turn analysis) 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 2ba417cf9f structural changes, motorway handling 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch d8af074ff6 enter and exit roundabout feature - currently not showing turn 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch daf2bbf991 migrated out of edge based graph factory 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 6605f293b4 relative waypoint locations 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch 482e18ccdb handling of roundabouts (simple version) 2016-04-05 22:58:32 +02:00
Moritz Kobitzsch ef1e0e14ec advanced guidance on 5.0 2016-04-05 22:58:32 +02:00
Patrick Niklaus 33f083b213 Fix numerical problems with polyline 2016-04-05 22:58:32 +02:00
Patrick Niklaus bcfbc0cf6c Fix table response format to return null + double in seconds 2016-04-05 22:58:32 +02:00
Patrick Niklaus 00d75ece64 Return NoMatch 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann dc1b5d3424 Provides ctor from base path for EngineConfig, fixes #2030 2016-04-05 22:58:32 +02:00
Patrick Niklaus 58fb633df3 Add support for tile plugin 2016-04-05 22:58:32 +02:00
Patrick Niklaus 36f9366f3f Preliminary integration of the tile plugin 2016-04-05 22:58:32 +02:00
Patrick Niklaus 712f1ca02a sources and destinations can be empty actually 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 285b238f26 Fixes coordinate, source and destination validation by means of backporting #2041 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 70fb12b10e Fixes ownership semantics and forwarding references misplacements in the JSON factory 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 6380a6be05 Unwrap function call from identity lambda 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 548fd92c15 Uses JSON's String constructor for polyline encoding 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 86de53eb9a Passes coordinates by value 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann e1616953db Asserts on unknown TurnInstruction 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann c1dbab50fe Fixes header includes in the JSON factory 2016-04-05 22:58:32 +02:00
Dane Springmeyer b6bb6a92a9 fix compile of osrm-components 2016-04-05 22:58:32 +02:00
Patrick Niklaus 0ab80ad0a7 Fix if the last coordinate is not found 2016-04-05 22:58:32 +02:00
Patrick Niklaus 61744764da Allocate correct table size 2016-04-05 22:58:32 +02:00
Patrick Niklaus 8eb98982f3 Fix travel mode passing from profiles up to the API 2016-04-05 22:58:32 +02:00
Patrick Niklaus 1090339331 Fix geometries type in steps 2016-04-05 22:58:32 +02:00
Patrick Niklaus 804816f014 Fix table parameter parsing 2016-04-05 22:58:32 +02:00
Patrick Niklaus 51e8318224 Fix behaviour of table if sources/destinations arrays are empty 2016-04-05 22:58:32 +02:00
Patrick Niklaus 0d38a50dba Fuck. this. shit. 2016-04-05 22:58:32 +02:00
Patrick Niklaus 72094acf74 Change stream operator of strong typedef 2016-04-05 22:58:32 +02:00
Patrick Niklaus 1bd67943bb Fix stream operator for coordinate 2016-04-05 22:58:32 +02:00
Patrick Niklaus 30101e129f Add stream operator to Rectangle 2016-04-05 22:58:32 +02:00
Patrick Niklaus 9bb31678a6 Add euclideanDistance to coordinate_calculation 2016-04-05 22:58:32 +02:00
Patrick Niklaus 5e5c52ff0a Simplify static_rtree tests 2016-04-05 22:58:32 +02:00
Patrick Niklaus d9d4742130 First round of lat,lng -> lng,lat switcheroo 2016-04-05 22:58:32 +02:00
Patrick Niklaus 0fab6b7cab Add rectangle unit test 2016-04-05 22:58:32 +02:00
Patrick Niklaus f10286de8c Fix match and trip API response 2016-04-05 22:58:32 +02:00
Patrick Niklaus a0e0465704 Fix out-of-bounds write in map_matching 2016-04-05 22:58:32 +02:00
Dane Springmeyer c8457a2619 Fix compile on OS X 2016-04-05 22:58:32 +02:00
Patrick Niklaus 14c36bc405 Finish the nearest plugin 2016-04-05 22:58:32 +02:00
Patrick Niklaus 81319228bd Initialize NearestParameters correctly 2016-04-05 22:58:32 +02:00
Patrick Niklaus fcd7b05900 Adapt to feedback in #519 2016-04-05 22:58:32 +02:00
Patrick Niklaus 8378d95588 Add trip plugin 2016-04-05 22:58:32 +02:00
Patrick Niklaus b34f9b1795 Hook up map matching 2016-04-05 22:58:32 +02:00
Patrick Niklaus 35b098e656 First compiling version of map_match plugin 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann e05a45b080 Adapts example/example.cpp to new osrm api 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 715ee66b03 Install _all_ transitively from public headers included header 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 3d6e9da115 Fix missing headers in hint.hpp 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 54410988eb Adds $prefix/include/osrm to include dirs so that transitive header includes without osrm prefix can be found 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann dded2c2463 Adapt the example to include all osrm public headers 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann fcf5838019 Fixes missing public header installations 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann beafa18708 Fix forward declarations in publicly facing osrm header 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann bd371a11ad Enable all plugins with aStatus::Error return code fallback for not implemented ones 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 1895fee1c9 Adds publicly facing alias headers for parameters 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 2200d0b678 Temporarily comment out match.cpp as to not break the build process 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann f3c4a7dd16 We don't need templates at all, this is not CRTP? 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 25834b89dd Fix classes for service member function definitions 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 4d20dea271 Service skeletons for nearest, trip, match 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann c59647ad2f Fix grammar constraint and enable all plugin links 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann e466cbe0ce Plugin grammar skeletons 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann a24de2d22a Enforce parameter and grammar type to catch subtle bugs 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann f452a3025d Link parameters to grammars 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 3c58eaf49f Require a BaseParameters type at compile time via enable_if 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann c75b497b2e Adapts Nearest plugin to new API 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann d572d77b48 Fix deleting incomplete type and make Engine moveable only 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann a4074332cc Adapts publicly facing new API 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann c31ceb6a5b Adapts NearestParameters to new API 2016-04-05 22:58:32 +02:00
Patrick Niklaus b0863d8628 Initial non-building match plugin 2016-04-05 22:58:32 +02:00
Lauren Budorick c38a6d74dd Include numeric in assemble_overview.cpp (needed on OSX for std::accumulate) 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann 7bec75b709 Semantic action handler requires passing optional by value and fusion::vector2 2016-04-05 22:58:32 +02:00
Patrick Niklaus 56ea24b03b Add tests for bearing parsing 2016-04-05 22:58:32 +02:00
Patrick Niklaus 277829c280 Add table service 2016-04-05 22:58:32 +02:00
Patrick Niklaus c127aaae6b Add table API 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann c895848061 Optional<T> semantic action handler takes T argument 2016-04-05 22:58:32 +02:00
Patrick Niklaus 64e5ebb55f Fix parameter parsing tests 2016-04-05 22:58:32 +02:00
Patrick Niklaus 83addd6bba Fix table plugin 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann d87a19b2f9 First take at distance table API re-write 2016-04-05 22:58:32 +02:00
Daniel J. Hofmann b58edc980c Adapts TableParameters and its validation to new API 2016-04-05 22:58:32 +02:00
Patrick Niklaus f3e72623e9 Add viaroute suport for new API 2016-04-05 22:58:32 +02:00
Patrick Niklaus 54ee76bcef Add benchmark target to Makefile and save timings 2016-04-05 18:57:31 +02:00
Daniel J. Hofmann efe6faabfd Adds tests for routing over delivery ways and nodes; see #2150. 2016-04-04 14:00:54 +02:00
Daniel J. Hofmann 3ee8b655ea Prevents routing over delivery ways and nodes; closes #2150. 2016-04-04 14:00:54 +02:00
Daniel J. Hofmann c70d138eb9 Spelling: Hierachy vs Hierarchy 2016-04-04 13:58:55 +02:00
Daniel J. Hofmann af2a327310 Removes unused access_tag list from car profile
This is dead code. Using my time machine (which sadly can only go back
in history), I found the introducing commit here:

https://github.com/Project-OSRM/osrm-backend/commit/74cc50f52b79cdb06d5c61fabc1fdc9ca5979fcc#diff-ded22cbfae0ae88f6359ccff1c3355b0R106

Seems like we no longer use it, and it was still left in the car profile.
2016-04-04 13:55:27 +02:00
Daniel J. Hofmann b27e0e2807 Update CMake from 3.3 to 3.5 on Travis 2016-04-04 12:29:15 +02:00
Daniel J. Hofmann 8267ed53f0 Pins LLVM 3.8 (stable) instead of tracking the nightly repository 2016-04-04 12:27:45 +02:00
Patrick Niklaus aa90d7b4b7 Merge pull request #2200 from oxidase/fix/uninitialised_alternative_segment
Fixes using uninitialised values in extractRouteNames
2016-04-03 22:58:04 +02:00
Michael Krasnyk 6b69946b9e Fixes using uninitialised values in extractRouteNames
Conditional jump or move depends on uninitialised value(s)
   at 0x5FEE48: osrm::engine::RouteNames osrm::engine::extractRouteNames<osrm::engine::datafacade::BaseDataFacade<osrm::contractor::QueryEdge::EdgeData>, osrm::engine::detail::Segment>(std::vector<osrm::engine::detail::Segment, std::allocator<osrm::engine::detail::Segment> >&, std::vector<osrm::engine::detail::Segment, std::allocator<osrm::engine::detail::Segment> >&, osrm::engine::datafacade::BaseDataFacade<osrm::contractor::QueryEdge::EdgeData> const*) (route_name_extraction.hpp:127)
   by 0x61A1B2: osrm::engine::ApiResponseGenerator<osrm::engine::datafacade::BaseDataFacade<osrm::contractor::QueryEdge::EdgeData> >::DescribeRoute(osrm::engine::RouteParameters const&, osrm::engine::InternalRouteResult const&, osrm::util::json::Object&) (api_response_generator.hpp:173)
   by 0x61AF47: osrm::engine::plugins::ViaRoutePlugin<osrm::engine::datafacade::BaseDataFacade<osrm::contractor::QueryEdge::EdgeData> >::HandleRequest(osrm::engine::RouteParameters const&, osrm::util::json::Object&) (viaroute.hpp:144)
   by 0x61EEEC: osrm::engine::Engine::RunQuery(osrm::engine::RouteParameters const&, osrm::util::json::Object&) (engine.cpp:100)
   by 0x5AE585: osrm::OSRM::RunQuery(osrm::engine::RouteParameters const&, osrm::util::json::Object&) (osrm.cpp:19)
   by 0x5A8E07: main (in /home/miha/work/foss/osrm-backend/build.example/osrm-example)
2016-04-03 19:29:35 +02:00
Daniel J. Hofmann a1b87b5236 Handle all distances between coordinates being zero in Farthest Insertion algorithm.
Assertions for additional safety and sanity.

References:
- see https://github.com/Project-OSRM/osrm-backend/issues/2147
2016-03-31 18:57:24 +02:00
bergwerkgis 3044c5ea52 AppVeyor: remove MSBuild logs from artifacts as it interferes with deployment of binary 2016-03-31 15:55:11 +00:00
bergwerkgis d0636a9f6d make AppVeyor work again 2016-03-31 16:49:30 +02:00
Lauren Budorick 0d291cb68e Make cucumber executable via package.json bin field 2016-03-24 17:31:18 -07:00
Lauren Budorick c8bb50497b Rewrite cucumber test suite in JS 2016-03-24 16:01:01 -07:00
Patrick Niklaus ea027a7cc1 Merge commit '62e8601919faca57a0fa4be1a910458390450cc9' as 'third_party/variant' 2016-03-24 21:32:27 +01:00
Patrick Niklaus 62e8601919 Squashed 'third_party/variant/' content from commit b585021
git-subtree-dir: third_party/variant
git-subtree-split: b5850212f16efeb409a112edb1e719d5f5edb604
2016-03-24 21:32:27 +01:00
Patrick Niklaus be2cc7aed9 Remove variant 2016-03-24 21:32:12 +01:00
Patrick Niklaus 17babb22e2 mapbox/variant v1.0 -> v1.1 2016-03-24 21:26:31 +01:00
Patrick Niklaus 21245273b4 Also exclude the compressed flag from the data format 2016-03-24 21:24:08 +01:00
Patrick Niklaus 8d7821c84e Remove geometry indicator 2016-03-24 21:24:08 +01:00
Daniel J. Hofmann c78dff9a15 Write out unsigned with a check for edge counter overflow 2016-03-19 00:27:55 +01:00
Daniel J. Hofmann 25fea558ba Fixes the edge-based-graph factory's edge counter serialization.
The counter for original edges is of type `std::size_t`, but we
serialized `sizeof(unsigned)` number of bytes out to the `.osrm.edges`
file.

We should probably check all writes (analogous for reads) and make the
count parameter dependent on `sizeof(variable)`.

    ag '\.write\((.*), sizeof\((.*)\)\);'
2016-03-19 00:27:55 +01:00
Daniel J. Hofmann b1c84b598f Print the _local_ endpoint Boost ASIO assigns a port to, fixes #2097 2016-03-18 12:09:28 +01:00
Daniel J. Hofmann a6aa0a4cb0 Adapts routed to always print port and ip it listens on, fixed #2097 2016-03-16 11:21:20 +01:00
Daniel J. Hofmann 8640129835 Ampersand binds to variable name 2016-03-15 11:47:57 +01:00
Daniel J. Hofmann 655dd2277c Eliminate extra semicola 2016-03-15 11:47:57 +01:00
Daniel J. Hofmann 40f95191a0 Do not copy pairs in loop 2016-03-15 11:47:57 +01:00
Daniel J. Hofmann a013da860e Fixes unneeded includes in contractor header and self-include 2016-03-15 10:44:33 +01:00
Moritz Kobitzsch 4150c804df Improve the core search stopping criterion 2016-03-15 09:33:10 +01:00
Patrick Niklaus 0446847278 Merge pull request #2093 from arnekaiser/develop
Bugfix: set initial uturn indicators
2016-03-14 20:41:47 -04:00
akaiser 2cf8309987 Bugfix: set initial uturn indicators 2016-03-14 17:14:01 +01:00
Daniel J. Hofmann 5b30f92677 Adapts the test makefile clean target to remove monaco files.
See: https://github.com/Project-OSRM/osrm-backend/pull/2086#commitcomment-16639848
2016-03-11 12:06:34 +01:00
Patrick Niklaus 88fac0ad2b Use language: generic to use the minimal image
Since we are pulling all dependencies from PPA this just gives use the
advantage of faster boot up times.
2016-03-11 06:34:17 +01:00
Patrick Niklaus 45a9a6c4df Switch example to monaco 2016-03-11 05:58:42 +01:00
Daniel J. Hofmann af554e7ed0 Provide uninstall target, closes #1972 2016-03-10 21:25:27 +01:00
Patrick Niklaus 8912928581 Disable alternatives by defaul fixes #2072 2016-03-10 21:01:30 +01:00
Daniel J. Hofmann c2e49bd152 Do not install already installed deps. on OSX TraviS build, this should be made future proof 2016-03-10 20:27:46 +01:00
Daniel J. Hofmann ac0279aa83 RAII for auto-closing file streams
Small fixes I didn't want to include in unrelated PRs.

There are a few left in `storage.cpp` but since it's a single function
in 600 lines of code, I didn't want to touch the mess. The others are
safe to remove, cucumber and test run on Finland gives 👍.
2016-03-09 17:46:02 +01:00
Patrick Niklaus ae4161b780 Fix extraction in case of ways referencing invalid node ids 2016-03-08 20:59:11 +01:00
Patrick Niklaus adc3bacea9 Add pruning based on @MoKob's idea in #1921 2016-03-08 00:43:45 +01:00
Patrick Niklaus e125f3a897 Add core factor tests 2016-03-07 21:44:32 +01:00
Patrick Niklaus f86b5a44bc Adapt shortest_path and viaroute to core search 2016-03-07 21:26:12 +01:00
Daniel J. Hofmann 0c5899b2a2 Disable ccache on Travis until we can cache the ccache cache directory, fixes #2057 2016-03-07 12:39:32 +01:00
Daniel J. Hofmann a7d83b701f Provides a CMake variable to disable ccache usage 2016-03-07 12:37:16 +01:00
Daniel J. Hofmann d0b591307a We're already on v4.9.1, update CMakeLists, closes #2060 2016-03-07 12:25:54 +01:00
Daniel Patterson 13378a4b55 Only attempt to return PBF if the call to the tile plugin actually returned PBF data. This may occur if bad parameters are passed (e.g. zoom level is < 12)) 2016-03-04 17:49:20 -08:00
Patrick Niklaus ac6218eef2 Simplify EBGF code 2016-03-04 16:37:25 +01:00
Patrick Niklaus a98cc51ac2 Fix up some PR comments 2016-03-04 16:13:30 +01:00
Patrick Niklaus 92a06c9a28 Renamed prepared -> contracted 2016-03-04 16:12:10 +01:00
Daniel Patterson e595bdb20a More cleanup. 2016-03-03 19:28:48 -08:00
Daniel Patterson 9bd2446901 Cleanup. 2016-03-03 19:27:36 -08:00
Daniel Patterson 27babfec3d Add the uncompressible edges to the compressed edge container during the graph compressor run, rather than in the EdgeBasedGraphFactory. This keeps the logic a lot simpler to follow, although it's not quite as fast. 2016-03-03 18:48:39 -08:00
Daniel Patterson 017ff53702 Code review updates. 2016-03-03 13:25:01 -08:00
Daniel Patterson 49441fe204 Make forward/reverse weight/offset calculated at query time,
rather than being cached in the StaticRTree.  This means we
can freely apply traffic data and not have stale values lying
around.  It reduces the size of the RTree on disk, at the expense
of some additional data in RAM.
2016-03-03 10:49:12 -08:00
Daniel Patterson 03d360b7bf Enable color output when compiling with clang - makes errors a bit easier to spot. 2016-03-02 18:00:31 -08:00
Daniel Patterson 53542abbb7 Disable compression across traffic lights. Previously, we merged the traffic light penalty into the edge weight. When later considering traffic data, we need to be able to update just the edge weight, and it was impossible to extricate the traffic penalty. This increases the number of edge-based-nodes a little bit, but some quick tests show it should only be about 0.1% overall (only affects traffic signals on edges with no intersections (i.e. degree=2)) 2016-03-02 18:00:31 -08:00
Daniel Patterson fc908d4687 Fix naming of variable so it's a lot less confusing. 2016-03-02 18:00:31 -08:00
Daniel J. Hofmann e90b1bbead Allow no sources and no destinations for full table query 2016-03-03 02:00:39 +01:00
Daniel J. Hofmann ce1ca1b625 Fixes critical error in table plugin accessing uninitialized memory
Although we check for valid coordinates in the table plugin via
`check_all_coordinates`, we do not check for #srcs > 0 and #dsts > 0.

This would be fine as the grammar parser combines adding coordinates and
setting their `is_source` and `is_destination` property, which makes
adding coordinates without specifying source or destination impossible.

See: route_parameters.cpp, AddSource, AddDestination, and api_grammar.hpp

In contract, the Polyline codepath does not do this! In fact, it only lets
you set coordinates, but not their `is_source` or `is_destination` property.

See: route_parameters.cpp, SetCoordinatesFromGeometry

Therefore, the following queries only set coordinates:

    http 'http://localhost:5000/table?locs=s_hhFg{arEgEfEgEfEgEfEgEfEgEfEgEfEgEfEgEfEgEfE'
    http 'http://localhost:5000/table?locs=_p~iF~ps|U_ulLnnqC_mqNvxq`@'

but fail to specify sources and targets!

The distance table plugin now assumes `is_course` and `is_destination`
is the same size as `coordinates`.

And happily accesses uninitialized memory.
2016-03-03 02:00:39 +01:00
Patrick Niklaus 0eaa393065 Limit tile zoomlevel to 12+ 2016-03-02 19:59:49 +01:00
Daniel Patterson 6d749777fc Using bind<T> in this case causes ambiguity with GCC 5.2.1 (see http://www.boost.org/doc/libs/develop/libs/bind/doc/html/bind.html#bind.faq.Q_forms). Remove template and let the type be deduced automatically. 2016-03-02 09:54:08 -08:00
Patrick Niklaus 6c20a4a874 Merge pull request #2040 from davidlowjw/develop
Minor typo fix
2016-03-02 16:40:38 +01:00
David Low 79e8d1aac3 Minor typo fix 2016-03-02 15:16:28 +08:00
Daniel J. Hofmann becae46296 Enable decltype-based result_of type alias 2016-03-01 23:51:26 +01:00
Daniel J. Hofmann 2ce553d661 Math functions are not constexpr since they have side-effects (setting errno) :( 2016-03-01 23:51:26 +01:00
Daniel J. Hofmann 66cadac6b6 Explicitly std:: prefix fixed integral types in static rtree header 2016-03-01 23:51:26 +01:00
Daniel J. Hofmann c237c5353b Explicitly std:: prefix fixed integral types in rectangle header 2016-03-01 23:51:26 +01:00
Daniel J. Hofmann c27a7e087f Fixes rectangle header includes 2016-03-01 23:51:26 +01:00
Daniel J. Hofmann 0894590a96 Fixes default declared ctor in Buffer 2016-03-01 23:51:26 +01:00
Daniel J. Hofmann 2efef91f1c Fixes const correctnes and explicit types in tile header 2016-03-01 23:51:26 +01:00
Daniel J. Hofmann 3feba9a581 Fixes Undefined Behavior in tile header from ODR-violation 2016-03-01 23:51:26 +01:00
Daniel J. Hofmann afae896d05 Makes compile time constants properly ROM-able and deduplicates them across TUs 2016-03-01 23:51:26 +01:00
Daniel J. Hofmann bcbaa21739 Fixes tile header includes 2016-03-01 23:51:25 +01:00
Daniel J. Hofmann d60bc61d13 Properly constructs objects of type const RectangleInt2D in facades 2016-03-01 23:51:25 +01:00
Daniel J. Hofmann aeee565115 Formats all the files we touch.. 2016-03-01 23:51:25 +01:00
Daniel Patterson 8126793b18 Don't need to actually create a vector, we just write out all speeds from 0-127 2016-03-01 23:51:25 +01:00
Daniel Patterson 6a2592421c Optimize encoding of speed values. Only store 0-127, so we can efficiently pack into a byte. Speed and is_tiny values are now shared, so tiles should be much smaller. 2016-03-01 23:51:25 +01:00
Daniel Patterson 36adeec220 Remove unused tests. 2016-03-01 23:51:25 +01:00
Daniel Patterson 22bf0ead18 We don't need this header. 2016-03-01 23:51:25 +01:00
Daniel Patterson b9dd6369d4 Remove draft tiler tool, we moved everything into 2016-03-01 23:51:25 +01:00
Daniel Patterson 3d6c0ac512 Remove some commented out code that's not used any more. 2016-03-01 23:51:25 +01:00
Daniel Patterson 95bf81f528 Add a bunch of comments. 2016-03-01 23:51:25 +01:00
Daniel Patterson 56e35e8ef2 Remove GeoJSON based debugging output, we can now generate vector tiles with roughly the same data on-the-fly. 2016-03-01 23:51:25 +01:00
Daniel Patterson ae802a8a83 No need to send a back to the client, km/h are specific enough. 2016-03-01 23:51:25 +01:00
Daniel Patterson ee71d2fe5f Don't need to static cast. 2016-03-01 23:51:25 +01:00
Daniel Patterson 8dd2447cc5 Don't round until necessary, this keeps coordinates in much better positions. 2016-03-01 23:51:25 +01:00
Daniel Patterson 3869ab6345 Use the correct type when pulling object from variant 2016-03-01 23:51:25 +01:00
Daniel Patterson 26453af1b9 Add a distinct Buffer type for encoding binary data in JSON responses. Treated like a string, but allows other consumers (a-la node-osrm) to recognize and not break string encodings. 2016-03-01 23:51:25 +01:00
Daniel Patterson 5dc7b79bb6 Implements a vector tileserver so you can see what's going on inside
OSRM.
2016-03-01 23:51:25 +01:00
Daniel J. Hofmann 33403efc8e Use XCode 7.3 on Travis 2016-03-01 23:50:43 +01:00
Patrick Niklaus a0b4fcc05a Remove last bits of GPX support code 2016-03-01 23:44:07 +01:00
Patrick Niklaus 82f7ab2ba5 Merge pull request #2038 from Project-OSRM/update/osmium_2.6.1
Update/osmium 2.6.1
2016-03-01 14:37:11 -05:00
Patrick Niklaus 505833a534 Remove #line checks, it seems to be dependent on the boost version 2016-03-01 19:19:31 +01:00
Patrick Niklaus 2557fb4f4d Merge commit '8511256779228db8d2ffed7ccced2b53c70be248' as 'third_party/libosmium' 2016-03-01 17:56:55 +01:00
Patrick Niklaus 8511256779 Squashed 'third_party/libosmium/' content from commit 2282c84
git-subtree-dir: third_party/libosmium
git-subtree-split: 2282c8450bae55839372a2002db7ca754530d2fc
2016-03-01 17:56:55 +01:00
Patrick Niklaus ae85d86d8f Remove libosmium 2016-03-01 17:54:39 +01:00
Daniel J. Hofmann 042740877c Update dependency script to libosmium 2.6.1 2016-03-01 17:10:20 +01:00
Daniel J. Hofmann b787b993b6 Adapt contract cucumber tests to new argparser output 2016-03-01 16:43:34 +01:00
Daniel J. Hofmann 51ae14ec23 Extra ; 2016-03-01 16:43:34 +01:00
Daniel J. Hofmann 152f739527 Adapts test data Makefile to no longer pass parameters to osrm-contract 2016-03-01 16:43:34 +01:00
Daniel J. Hofmann da88cb6a43 Extractor comments wrt. osrm-contract 2016-03-01 16:43:34 +01:00
Daniel J. Hofmann 52a8bb414c Fixes Rakefile wrt. osrm-contract 2016-03-01 16:43:34 +01:00
Daniel J. Hofmann a27902205b Fixes spelling in changelog 2016-03-01 16:43:34 +01:00
Patrick Niklaus 7fb5b9886e Fix test data prepare 2016-03-01 16:43:34 +01:00
Patrick Niklaus 8feb300d15 Add changelog entry for breakage 2016-03-01 16:43:34 +01:00
Patrick Niklaus 085bab749f osrm-prepare -> osrm-contract 2016-03-01 16:43:34 +01:00
Daniel J. Hofmann 96a5e594b3 Removes profiles from osrm-prepare, only needed in osrm-extract. Fixes #1950. 2016-03-01 16:43:34 +01:00
Daniel J. Hofmann 04765d82ba Fixes undefined behavior via One-Definition-Rule violations
Heuristic

    find . -type f -name '*.hpp' |xargs ag -B 1 '^([^inline][a-zA-Z0-9_&\*::])+ (.*)\((.*)\)$'
2016-02-26 06:39:52 +01:00
Patrick Niklaus 47a9981571 Disabling style failing the tests for now 2016-02-25 01:08:23 +01:00
Daniel J. Hofmann 0b45678ccc Adapts Travis to run the formatter script checking for violations 2016-02-25 01:07:00 +01:00
Daniel J. Hofmann 19ac465fa4 Provides a script to clang-format the repository in parallel 2016-02-25 00:53:30 +01:00
Patrick Niklaus 69bc8a8b22 Fix unpacking for self-loop nodes not in core. Fixes #1999 2016-02-21 01:38:06 +01:00
Patrick Niklaus d0644bace9 Merge pull request #1998 from mortada/develop
fixed minor typos
2016-02-19 17:39:28 -05:00
Mortada Mehyar aae02cd1be fixed minor typos 2016-02-18 23:05:11 -05:00
Daniel J. Hofmann 47d56676f1 Don't bounds check by default in static rtree; fixes #1988 2016-02-17 18:20:27 -08:00
Dane Springmeyer efbaaf2f84 Merge pull request #1994 from Project-OSRM/win-lock-types
include boost/thread/lock_types.hpp
2016-02-17 16:16:27 -08:00
bergwerkgis d38575a011 include lock_types.hpp 2016-02-17 22:54:45 +01:00
Daniel J. Hofmann 908a9e9fa1 Reorders Travis builds by most likely failing one 2016-02-16 09:49:29 -08:00
Daniel J. Hofmann 0ebabfad73 Finish Travis build as soon as a single job failed.
Manually cancelling obviously failing builds is getting cumbersome.
Hopefully this will speed things up as a side effect.

References:
- https://docs.travis-ci.com/user/customizing-the-build/#Fast-Finishing
2016-02-16 09:49:29 -08:00
karenzshea 6ac3d902c9 update help output test 2016-02-16 18:43:06 +01:00
karenzshea 3beb8c825b cf 2016-02-16 18:43:06 +01:00
karenzshea b80e96547e remove ini parsing 2016-02-16 18:43:06 +01:00
Moritz Kobitzsch 2679c1cf0a correct handling of travel modes 2016-02-16 01:35:04 +01:00
Daniel Patterson 65183e94c6 Use \n instead of std::endl to avoid unnecessary flushing. Cleanup some newlines to avoid blank lines in debug output. 2016-02-15 14:21:18 -08:00
Daniel Patterson 6b0fe683c9 Expose the base type. Going via the operator<< leaves us with invalid geojson. 2016-02-15 13:25:55 -08:00
Moritz Kobitzsch f14352f494 modify turn angles and instructions 2016-02-15 20:13:55 +01:00
Moritz Kobitzsch ab9426e260 fix routing when requiring loop at a core node 2016-02-15 18:26:39 +01:00
Daniel J. Hofmann 27fe85ac8b Dividable-by-three instead of next-dividable-by-three 2016-02-12 18:10:44 -08:00
Daniel J. Hofmann eb6f01e65a Rip out obsolete floating point header 2016-02-12 16:30:01 -08:00
Daniel J. Hofmann a6d406d2c3 Fix headers for JSON abstractions 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann 4b8c0ac143 Revert "Folds json_* utilities into json subfolder and adapts includes"
This reverts commit cd039c69c0a92a35889e3c875b8eb53cf07377bb.
2016-02-12 15:46:24 -08:00
Daniel J. Hofmann c9f0158fdb Ifdef is_trivially_copyable<T> behind gcc >= 5 guard 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann aac21f932b Refactors Base64 encoding and decoding, it's almost beautiful now 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann ec01c2a119 Folds json_* utilities into json subfolder and adapts includes 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann fbef77a942 Documents why not to use boost::irange in favor of our hand-written irange 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann f207d988f4 Removes floating point epsilon comparator 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann 60fc486cea Prefix exception header guard with osrm prefix 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann 978b70c998 Adds a comment as to why the char to typed enum class transformation is not possible 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann ef171f3acd Properly use typed math constants instead of impl. specific hacks
PI is not in the stdlib, neither is 1/pi, pi*2 and so on. Instead
of relying on implementations providing these, use properly typed
math constants.

Main benefits:
- portable and
- returns constexpr, for compile-time computation

References:
- http://www.boost.org/doc/libs/1_60_0/libs/math/doc/html/math_toolkit/constants_intro.html
- http://www.boost.org/doc/libs/1_60_0/libs/math/doc/html/math_toolkit/constants.html
2016-02-12 15:46:24 -08:00
Daniel J. Hofmann 64b36807d3 Transforms osrm_exception to exception 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann 5de8f1803c Folds mercator projections into coordinate_calculation 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann d1c4a26791 Remove .restriction reference 2016-02-11 19:19:28 -08:00
karenzshea a647cb9836 kick 2016-02-11 17:36:49 -05:00
karenzshea 7398bed974 Include real coordinates in debug geojson mode 2016-02-11 17:09:20 -05:00
Patrick Niklaus 6077708831 Merge pull request #1964 from Project-OSRM/libosmium-2.6.0
Update libosmium to v2.6.0
2016-02-10 20:51:34 -05:00
Dane Springmeyer 6eebb1c089 Support passing OSRM_SHARED_LIBRARY_PATH env variable for cucumber tests
The need for this is that:

  - On OS X if libraries are stored in custom locations (not /usr/lib or /usr/local)
    and they do not embed an rpath (which is common to not have) then the developer
    needs to set DYLD_LIBRARY_PATH to ensure that osrm tools can find dependent libraries
    at runtime (this is normal and common).
  - But as of OS X > 10.11 DYLD_LIBRARY_PATH no longer is inherited. While it works in
    the main shell when running a command like `osrm-extract` you will find that when
    `osrm-extract` is run by cucumber (ruby child process) then DYLD_LIBRARY_PATH
    is blocked and the command cannot start.
  - So, this introduces the ability to pass in a variable that the cucumber tests will
    understand and can manually forward along to ensure that DYLD_LIBRARY_PATH is respected
    where it counts.

The intended usage of this is therefore:

    # set the environment variable
    export OSRM_SHARED_LIBRARY_PATH=${DYLD_LIBRARY_PATH}
    # then run cucumber tests
    cucumber -p verify
2016-02-11 02:43:51 +01:00
Daniel J. Hofmann 6cd55e535c Removes potentially dangerous and misleading lat, lon subscript oeprator 2016-02-11 02:37:33 +01:00
Dane Springmeyer 7d0955c0f4 Merge pull request #1960 from Project-OSRM/cucumber-exit-early
Ensure key command line programs can be run before running cucumber tests
2016-02-10 16:03:17 -08:00
Dane Springmeyer 8c9d24bd9f Merge pull request #1962 from Project-OSRM/no-static-visitor
Remove uneeded and deprecated usage of mapbox::util::static_visitor
2016-02-10 16:02:56 -08:00
Dane Springmeyer c40375a424 update libosmium to v2.6.0 2016-02-10 13:41:22 -08:00
Dane Springmeyer 2949a52a11 remove uneeded and deprecated usage of mapbox::util::static_visitor 2016-02-10 12:58:36 -08:00
Dane Springmeyer 2e762d05f9 Ensure key command line programs can be run before running cucumber tests
- Otherwise, currently, if osrm-extract crashes at startup then
    the tests continue on and will crash many many times.
  - This also tests that --help returns an exit code of zero and will
    catch if this behavior ever changes or is inconsistent between
    the command line programs
2016-02-09 17:49:47 -08:00
Daniel J. Hofmann bb06bfbbd7 Same undefined behavior from shifting into the sign bit in Storage 2016-02-08 11:47:44 -08:00
Daniel J. Hofmann b8d20dfe99 Prevent undefined behavior from left shifting into sign bit when offset is 31 2016-02-08 11:47:44 -08:00
Daniel J. Hofmann fa8529949b Make swap noexcept (as it has to be!) and fix swap misuses 2016-02-08 11:47:44 -08:00
Daniel J. Hofmann 7b37c847bd Fixes shared memory wrapper includes 2016-02-08 11:47:02 -08:00
Daniel J. Hofmann 3075f6cea7 No need for deferred, non-blocking or timeout acquisition 2016-02-08 11:26:40 -08:00
Daniel J. Hofmann ff966490bb Fixes datafacade includes 2016-02-08 11:26:40 -08:00
Patrick Niklaus 46993b43fe Merge pull request #1954 from sebastic/edges-typo
Fix 'egdes' typo, replace with 'edges'.
2016-02-06 22:01:16 -05:00
Bas Couwenberg 5e15bceaae Fix 'egdes' typo, replace with 'edges'. 2016-02-07 02:59:44 +01:00
Patrick Niklaus fefe5e241a Merge pull request #1946 from kerrick-lyft/develop
Add operator<< to OSRM_STRONG_TYPEDEF
2016-02-01 16:30:43 -05:00
Kerrick Staley 8804330d83 Add operator<< to OSRM_STRONG_TYPEDEF
Useful for debugging.
2016-02-01 12:32:30 -08:00
karenzshea f5c12ec433 comments 2016-01-29 23:49:09 +01:00
karenzshea 262cdd7bc0 move tribool obj into request_parser 2016-01-29 23:49:09 +01:00
Patrick Niklaus efee07e20b Move arrays don't copy 2016-01-29 15:58:48 +01:00
Moritz Kobitzsch 603b83e1c3 Fixes Alternative Routing when including loops 2016-01-28 16:33:07 +01:00
Daniel J. Hofmann a48f02e0da Takes care of proper special member generation globally, fixes #1689
Phew, a lot of classes were affected by this. The rationale for the
changes are as follows:

- When a type X declares any constructor, the default constructor is
  not declared, so there is no need for X() = delete there. In fact,
  there is brutal difference between those two: deleted members
  participate in overload resolution, but not-declared members do not!

- When a type X wants to be non-copyable (e.g. to be only movable, like
  threads, unique_ptrs, and so on), you can either do it by inheriting
  from boost::noncopyable (the old way), or better declare both (!) the
  copy constructor _and_ the copy assignment operator as deleted:

      X(X const&) = delete;
      X& operator=(X const&) = delete;

  We had tons of types with deleted copy constructors that were lacking
  a corresponding deleted copy assignment operator, making them still
  copyable and you wouldn't even notice (read: scary)!

References:

- http://accu.org/content/conf2014/Howard_Hinnant_Accu_2014.pdf
- http://www.boost.org/doc/libs/master/libs/core/doc/html/core/noncopyable.html

Note: I know, I'm quoting Hinnant's extraordinary slides a lot, but
getting the sematic right here is so incredibly important.
2016-01-27 17:25:30 +01:00
Daniel J. Hofmann d189339495 Makes the extractor no longer depend on the crc32 computation 2016-01-27 17:18:04 +01:00
Patrick Niklaus 0802804677 Fix PR comments 2016-01-26 22:57:02 +01:00
Patrick Niklaus d9c281cd7c Remove boost fusion dependency in RouteParameters 2016-01-26 22:57:02 +01:00
Patrick Niklaus 46185fe9e8 Ptr -> auto 2016-01-26 22:57:02 +01:00
Daniel J. Hofmann 38e8a90f4e Make HilbertCode a free standing function 2016-01-26 22:57:02 +01:00
Daniel J. Hofmann 7a115e93c0 Removes check-hsgr 2016-01-26 22:57:02 +01:00
Daniel J. Hofmann d391df52ba Be kind to the optimizer, pass coordinates by value (just two ints) 2016-01-26 22:57:02 +01:00
Daniel J. Hofmann 46fc6f8da4 Collapse computeAngle into coordinate calculation 2016-01-26 22:57:02 +01:00
Daniel J. Hofmann 0fcca04150 TU-local STXXL comparator for OSMNodeIDs, needs {min,max}_value
Can not use std::less<>{} because of this.
2016-01-26 22:57:02 +01:00
Daniel J. Hofmann 54a9173107 Make public RouteParameters header no longer depend on Spirit
And includes the optional header that was transitively included by the
spirit header before. Hopefully this will speed up compile times, as the
RouteParameters header is used in a lot of translation units.
2016-01-26 22:57:02 +01:00
Patrick Niklaus bf455c8d20 Fix empty parameter list 2016-01-26 22:56:19 +01:00
Patrick Niklaus c05d23a586 Fix POST request 2016-01-26 22:56:19 +01:00
Freenerd 2a882aa58d Tests: Preserve param order on POST 2016-01-26 22:56:19 +01:00
Daniel J. Hofmann 04e26ba6b8 Adds missing cstdlib header for std::llabs 2016-01-26 17:54:08 +01:00
Daniel J. Hofmann 2211731c80 Alternative test depends on random order, make less random-ish 2016-01-26 17:54:08 +01:00
Daniel J. Hofmann 0fbdd57835 Quickfixes polyline encoder's undefined behavior via left-shifting negative numbers 2016-01-26 17:54:08 +01:00
Daniel J. Hofmann 312b414d8f Adapts XORFastHashStorage to XORFastHash compile time limits 2016-01-26 17:54:08 +01:00
Daniel J. Hofmann a6e7954128 Make XORFastHash's number of hashable elements compile time constant
Still constraint by the usage of uint32_t and subsequent splitting into
two uint16_t we use for indexing into the tables.
2016-01-26 17:54:08 +01:00
Daniel J. Hofmann 1417d43430 Cut down memory usage for tables in XORFastHash by factor of four
`pow(2, 16)` is not `2 << 16` but rather `1 << 16`.

With this change we cut memory usage in half for the XORFastHash's two
tables. Adapts XORFastHashStorage, memory usage reduction by factor two.
2016-01-26 17:54:08 +01:00
Daniel J. Hofmann 60ef6070b0 Simplify uint32_t splitting in XORFastHash 2016-01-26 17:54:08 +01:00
Daniel J. Hofmann 2f42196fca Explicitely type XORFastHash 2016-01-26 17:54:08 +01:00
Daniel J. Hofmann f8b5e7e2c9 Removes XORMiniHash, unused 2016-01-26 17:54:08 +01:00
Daniel J. Hofmann 2c0547bb0e Make XORFastHash great again 2016-01-26 17:54:08 +01:00
Patrick Niklaus 0f9eec887f Only run script on linux 2016-01-26 07:01:11 +01:00
Patrick Niklaus 234cf2d847 Move taginfo check 2016-01-26 07:01:11 +01:00
Patrick Niklaus 9304ad125c Fix python2 2016-01-26 07:01:11 +01:00
Patrick Niklaus 752c15c230 Add taginfo checker script and update taginfo 2016-01-26 07:01:11 +01:00
Patrick Niklaus 4f792c40b7 Merge pull request #1928 from mortada/max_locations_map_matching
make it possible to disable max_locations in map_matching
2016-01-25 22:31:55 -05:00
Patrick Niklaus 0245184c18 Merge pull request #1930 from mortada/gps_precision
improve comments for gps_precision
2016-01-25 22:31:09 -05:00
Patrick Niklaus 7ddf0226c6 Merge pull request #1929 from zimathias/fix-keepalive-non-support
Send the Connection: close response header
2016-01-25 19:17:47 -05:00
Mortada Mehyar 17c3c1d66a improve comments for gps_precision 2016-01-25 15:17:44 -08:00
Mathias Gug 40a3008318 Send the Connection: close response header
so that proxy server don't try to reuse the connection. Given that
osrm-routed does *not* support keepalive the Connection: close response
header should be set.
2016-01-25 15:03:37 -08:00
Mortada Mehyar b48022be22 make it possible to disable max_locations in map_matching 2016-01-25 14:53:44 -08:00
Daniel J. Hofmann 502aedb33e Provide a way to selectively enable assertions in release mode
- Throwing an assertion exception for proper stack unwinding, making
  sure destructors are called

- On in Debug mode, in Release, enable via:

      cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_ASSERTIONS=ON

Current problem that I'm seeing is that some code is not catching
exceptions or worse silently swallowing them. Would like to check the
whole pipeline before merging this in.
2016-01-21 15:37:25 +01:00
Patrick Niklaus 17f8e65808 Fail hard if node weights are not there 2016-01-21 06:47:34 +01:00
Patrick Niklaus 439eb9da3d Create public facing libraries for extractor, contractor and datastore
New libraries libosrm_extract, libosrm_contract, libosrm_store
2016-01-21 06:47:34 +01:00
Patrick Niklaus f6116db957 Merge pull request #1902 from Project-OSRM/4.9.1
Bug fix release 4.9.1
2016-01-19 19:00:11 -05:00
karenzshea b36145e3c4 add target test 2016-01-19 23:38:13 +01:00
Moritz Kobitzsch 1c1bfd7541 Fix routing when start and target are on the same segment
Fixes issue #1864. Given the simple set-up:

a --> b --> c
^-----------|

This would translate into an edge based graph (ab) -> (bc),
(bc) -> (ca), (ca) -> (ab).

Starting at the end of the one-way street (ab) and going to
the beginning, the query has to find a self-loop within the
graph (ab) -> (bc) -> (ca) -> (ab), as both nodes map to the
same segment (ab).
2016-01-19 23:26:19 +01:00
Patrick Niklaus c824429458 Include the travel mode in the last instruction by copying it from the previous instruction. 2016-01-19 23:23:32 +01:00
Daniel Patterson 238e77d959 Include the travel mode in the last instruction by copying it from the previous instruction. 2016-01-19 21:28:56 +01:00
Daniel Patterson 23b2154d98 Adds a shared/exclusive lock around queries and CheckAndReloadFacade.
Without this, it's possible for CheckAndReloadFacade to start working
while a query is still in progress, leading to undefined behaviour.
2016-01-19 21:26:30 +01:00
Daniel J. Hofmann 25c8711aad Fix shared memory non-copyable properties 2016-01-19 20:31:14 +01:00
Daniel Patterson cf30628d4e DataFacade should only remove shared segments if they're actually different from the last time they were checked. 2016-01-19 20:31:03 +01:00
Daniel Patterson e21eaa4b9e Adds a shared/exclusive lock around queries and CheckAndReloadFacade.
Without this, it's possible for CheckAndReloadFacade to start working
while a query is still in progress, leading to undefined behaviour.
2016-01-19 17:44:29 +01:00
Daniel J. Hofmann 80b897d8cf Fix shared memory non-copyable properties 2016-01-19 17:44:07 +01:00
Daniel Patterson 1ed7bcfb2c DataFacade should only remove shared segments if they're actually different from the last time they were checked. 2016-01-19 17:44:07 +01:00
Daniel J. Hofmann e20f92bbbb Anonymous namespaces in header files are bad
They duplicate the code across translation units.
2016-01-19 17:42:49 +01:00
Daniel J. Hofmann 6e717bfd30 Switch to const constexpr for header constants (3.5/3 internal linkage) 2016-01-19 17:42:49 +01:00
Daniel J. Hofmann 5d743bb0a3 Switch to explicit find in tidy script 2016-01-19 17:42:49 +01:00
Patrick Niklaus 7675c730b6 Fix wrong assertion and emplace_back bug in trip plugin 2016-01-19 17:38:02 +01:00
Patrick Niklaus 42942bb1e0 Add regression test 2016-01-19 17:36:29 +01:00
Patrick Niklaus 9d12de9bce Fix wrong assertion and emplace_back bug in trip plugin 2016-01-19 17:36:29 +01:00
Patrick Niklaus 790520e335 Enable AppVeyor only for master/develop and PRs 2016-01-18 21:23:13 +01:00
Daniel J. Hofmann 4b0e1a4b19 Run modernizer 2016-01-18 16:54:30 +01:00
Daniel J. Hofmann a877f8abf0 Switch to explicit find in modernize script 2016-01-18 16:54:13 +01:00
Daniel J. Hofmann 491b1d9c96 Remove headers with no reverse dependencies
Found with

```
daniel@x1c /t/o/i/util> for header in *.hpp
                            echo -n $header:
                            ag -iQ $header ../../ --noheading | wc -l
                        end
...
fixed_point_number.hpp:0
range_algorithms.hpp:0
...
```

Only two. Surprises me to be honest.
But we're cleaning up for quite a bit now.
2016-01-18 16:05:39 +01:00
Patrick Niklaus 2ce74c05e1 Use a sane gps_precision multipler 2016-01-15 22:15:05 +01:00
Patrick Niklaus 88e6558da3 Fix handling unexpected errors. 2016-01-15 22:08:04 +01:00
Patrick Niklaus f1140ec903 Fix uturns at dead-end streets 2016-01-15 21:48:14 +01:00
Moritz Kobitzsch 8a745ecdfd fixed u-turn testcase to actually emit u-turn instruction 2016-01-15 19:56:39 +01:00
Moritz Kobitzsch b8e29f5ae3 Add a u-turn instruciton when performing a u-turn at a via-node 2016-01-15 19:56:39 +01:00
Patrick Niklaus 22e83013e3 Fix uturns at dead-end streets 2016-01-15 16:24:21 +01:00
Patrick Niklaus cc4713d878 Add regression test for uturn before barrier 2016-01-15 00:56:31 +01:00
Patrick Niklaus 490e838c60 Add regression test for Disney Land bug 2016-01-15 00:39:49 +01:00
Patrick Niklaus 6b15f29d7c Fix handling unexpected errors. 2016-01-14 18:27:36 +01:00
Daniel J. Hofmann e7d9e42a16 Fix race condition in osrm-routed HTTP server
We had a similar issue a few month ago. Stumbled upon this by accident.

It goes like this:

- `output_buffer` is function-local
- we pass it to async_write and leave the scope
- `output_buffers` goes out of scope
- bad things happen, sometimes

The fix is to, again, put it inside the connection that handles itself
via the enable_shared_from_this idiom.

References:

- http://www.boost.org/doc/libs/1_59_0/doc/html/boost_asio/reference/async_write/overload1.html
- https://github.com/Project-OSRM/osrm-backend/pull/1690
2016-01-13 23:21:45 +01:00
Patrick Niklaus bd91727f49 Merge pull request #1890 from zimathias/fix-debian-package-upgrades
Fix debian package upgrades.
2016-01-13 23:19:20 +01:00
Mathias Gug 328faf3744 Fix debian package upgrades.
The postinst script fails on package upgrade given that the symlink
already exists.

Note that symlinks should *not* be handled in a postinst scripts.
Instead dh_links should be used so that symlinks are compliant with the
Debian policy.
2016-01-13 11:53:59 -08:00
Patrick Niklaus 1157cb9b95 Remove obsolete protobuf test 2016-01-13 17:57:22 +01:00
Daniel J. Hofmann 7c8626d144 No longer install osmosis in docker env 2016-01-13 17:57:22 +01:00
Daniel J. Hofmann 03faf2665b No longer install osmosis on travis 2016-01-13 17:57:22 +01:00
Daniel J. Hofmann 9959fd26bb Do not convert osm xml files to pbf for the cucumber tests 2016-01-13 17:57:22 +01:00
Daniel J. Hofmann 43dcdb21ec Revert "Build osmium_convert in order to be able to eventually replace osmosis"
This reverts commit 344588114dd5076385b35e0fbaef966de681f95f.
2016-01-13 17:57:22 +01:00
Daniel J. Hofmann 3727637145 Build osmium_convert in order to be able to eventually replace osmosis
This provides a script to build the libosmium examples such as
osmium_convert (to convert from xml to pbf).

I initially tried a CMake ExternalProject setup, but this was more
complicated than I initially thought; this is the more elegant solution.

The goal is to eventually rip out osmosis, so that we no longer depend
on java for the cucumber tests.

References:

- https://github.com/Project-OSRM/osrm-backend/issues/1788
2016-01-13 17:57:22 +01:00
Daniel J. Hofmann 466251287f Define compile-time constants for coordinate calculation only once
Closes #1327.
2016-01-12 19:59:02 +01:00
Daniel J. Hofmann f46706843b STXXL's debug build creates stxxl_debug.{a,so}, adapts FindSTXXL
References:

- https://github.com/Project-OSRM/osrm-backend/issues/1885
2016-01-12 13:40:36 +01:00
Daniel J. Hofmann c93ca02fb8 Rips out dead code from the container.hpp and creates for_each_pai.hpp
I added two TODOs that I would like to address in the future.
2016-01-11 20:14:35 +01:00
Daniel J. Hofmann 4813488f84 Split import_edge.hpp: node_based_edge.hpp, edge_based_edge.hpp closes #1604 2016-01-11 20:11:44 +01:00
Daniel J. Hofmann fc292cc2d8 No need for extra translation units (for edge data structures) 2016-01-11 20:11:44 +01:00
Daniel J. Hofmann f875e26fbf Inline mercator transformations; no need for separate translation unit 2016-01-11 20:10:45 +01:00
Patrick Niklaus 05658aeb3b Ignore .swp file 2016-01-11 20:06:12 +01:00
Patrick Niklaus a14cb1fc06 Merge pull request #1818 from gardster/side_road_tag_support
A side_road tag support for the OSRM car profile.
2016-01-11 17:10:42 +01:00
Daniel J. Hofmann f68247673a Make ComputeAngle a free standing function 2016-01-09 19:55:22 +01:00
Daniel J. Hofmann f65dd63210 Make TurnInstructionsClass functions free standing functions 2016-01-09 19:55:22 +01:00
Daniel J. Hofmann 03f64a6c20 Make RouteNameExtraction a free standing function 2016-01-09 19:55:22 +01:00
Daniel J. Hofmann 0627c3443d Make PolylineFormatter's encodedAsJSON and unencodedAsJSON free standing functions 2016-01-09 19:55:22 +01:00
Daniel J. Hofmann c65dd16460 Make PolylineCompresser's encode and decode free standing functions 2016-01-09 19:55:22 +01:00
Daniel J. Hofmann c590596dbe Make DouglasPeucker a free standing function 2016-01-09 19:55:21 +01:00
Patrick Niklaus 23cd4d5ed2 not -> ! 2016-01-09 19:42:31 +01:00
Moritz Kobitzsch 4dc6ff9fb8 and another missed not 2016-01-09 19:42:31 +01:00
Moritz Kobitzsch 8638cbf8b2 missed a not 2016-01-09 19:42:31 +01:00
Moritz Kobitzsch a2555983e6 replaces and/not with &&/! for windows 2016-01-09 19:42:31 +01:00
Daniel J. Hofmann 21804aecdb Prefer inline over static inline for free standing functions
When you mark free standing functions as `static inline` instead
of just `inline` they can not get merged across TUs and therefore
produce code bloat which is bad for the binaries size, the CPUs
instruction cache, and so on.

Please also see the discussion at:

- https://groups.google.com/forum/#!topic/mozilla.dev.platform/Ulw9HoZbSyQ
- http://stackoverflow.com/a/12836392

Note that non-fully specialized templates (i.e. with a kind of at
least `Template :: * -> *`) are `inline` by default.
2016-01-08 23:33:31 +01:00
Patrick Niklaus 6991a38703 Run clang-format 2016-01-08 01:31:57 +01:00
Patrick Niklaus 6b18e4f7e9 Add namespace around all files 2016-01-08 01:30:52 +01:00
Patrick Niklaus efc9007cbf Remore start_phantom/target_phantom because they are useless here 2016-01-07 22:51:37 +01:00
Moritz Kobitzsch efd33b295a Refactor guidance generation 2016-01-07 22:51:24 +01:00
Patrick Niklaus fa4ba42f15 Use a sane gps_precision multipler 2016-01-07 16:30:54 +01:00
Daniel J. Hofmann d3ef520915 Print message about ccache usage from cmake 2016-01-07 15:20:32 +01:00
Patrick Niklaus 811e29ff1b Add cmath to geospatial_query 2016-01-07 11:35:35 +01:00
Daniel Patterson 95d1efb7f8 Disable via test that fails on OSX so that we can test everything else on Travis on OSX. 2016-01-06 14:42:31 -08:00
Daniel J. Hofmann 5341cb5ff9 Merge branch 'use_libosmium_2_5_4' into develop 2016-01-06 15:08:10 +01:00
Daniel J. Hofmann cb37c0d135 Use FindOsmium.cmake to handle libosmium's buildsystem integration 2016-01-06 12:32:19 +01:00
Patrick Niklaus 73d40ce02a Merge pull request #1858 from zimathias/fix-debian-cpack-config
Use OSRM versions for Debian package version.
2016-01-05 22:08:50 +01:00
Mathias Gug c1709da6bf Fix typo. 2016-01-05 14:25:14 -05:00
Mathias Gug dcfa81f983 Add debian revision. 2016-01-05 14:15:55 -05:00
Mathias Gug 42b1eaa240 Use OSRM versions for Debian package version. 2016-01-05 11:44:24 -05:00
Patrick Niklaus 1da1fa5a31 Fix naming in PhantomNode 2016-01-05 12:41:16 +01:00
Patrick Niklaus 707931125e Remove unnecceary pre-define 2016-01-05 12:06:34 +01:00
Patrick Niklaus f4e82a879b Fix naming in static_rtree benchmark 2016-01-05 12:06:34 +01:00
Patrick Niklaus 4f7369ed02 Fix naming in FixedPointCoordinate 2016-01-05 12:06:34 +01:00
Patrick Niklaus 4312013552 Fix naming in coordinate_calculation 2016-01-05 12:06:34 +01:00
Patrick Niklaus e8bc69aa01 Fix naming in springclean 2016-01-05 12:06:33 +01:00
Patrick Niklaus befb667759 Fix naming of routed 2016-01-05 12:06:33 +01:00
Patrick Niklaus b35254ec78 Fix naming in io-benchmark 2016-01-05 12:06:33 +01:00
Patrick Niklaus 9956988938 Fix naming in datstore 2016-01-05 12:06:33 +01:00
Patrick Niklaus 5b0e2e487a Fix naming in components tool 2016-01-05 12:06:33 +01:00
Patrick Niklaus ccd3872bf1 Fix naming in ScriptingEnvironment 2016-01-05 12:06:33 +01:00
Patrick Niklaus b209952ce0 Fix naming of methodes for RouteParameters 2016-01-05 12:06:33 +01:00
Patrick Niklaus 3568de2c6c Fix missing include 2016-01-05 12:06:33 +01:00
Patrick Niklaus a8957d75b9 Add simple cncc file 2016-01-05 12:06:33 +01:00
Patrick Niklaus 028ca5c9d9 Apply clang-format 2016-01-05 12:04:04 +01:00
Daniel J. Hofmann d516e1c736 Update in-tree libosmium dependency to 2.5.4
The latest releases have some critical fixes, see the changelog:
https://github.com/osmcode/libosmium/blob/v2.5.4/CHANGELOG.md

Merge commit 'afdf8e7b21fbaf597e91d9d8a7542635e60ee9a1' into use_libosmium_2_5_4
2016-01-05 12:01:06 +01:00
Daniel J. Hofmann afdf8e7b21 Squashed 'third_party/libosmium/' changes from c43f8db..0ff2780
0ff2780 Release v2.5.4
3f1583a Remove workaround for MSVC missing constexpr support.
2a6c80b Rewrite expressions to avoid warnings on MSVC.
9b0602a Make two functions non-constexpr that can't be.
ca1e501 Make NodeRef constructor, accessors and comparison ops constexpr.
fb48312 Disable some problematic clang_tidy checks.
d2d2812 Only do clang_tidy checks on files that are configured to be built.
5af55bb Always use braces after while() and if().
aebb6e3 No else after return.
65a3bf6 Better clang-tidy config.
3a965fa Add typedef Buffer::value_type needed when using std::back_inserter.
c20ac26 Add lots of explicits to constructors.
1d12e09 Add clang-tidy make target.
052b1ee Add benchmark programs to files checked with cppcheck.
9ccbb49 Use only "final", not "override final".
0b9df1f User 'override' instead of 'virtual' in overridden functions.
1d0c1c6 Remove unnecessary get() call.
705391b Use consistent namespace closing comment.
25c1f38 Only use "final" on overridden methods, not "override".
8da2553 Setting CMAKE_EXPORT_COMPILE_COMMANDS works only after project() command.
5fec437 Use newest protozero library (v1.2.3).
a3d759b Overloaded version of add_tag() with std::pair of strings.
1b4bcf9 Add function to add tag to tag list from existing tag.
7087e62 Update gdalcpp.hpp header to v1.1.1.
0008e8c Update change log.
39fe3a5 Add conversion and comparison operators to Timestamp.
e6643a7 Update gdalcpp.
650280f Bugfix: Improved segment intersection function.
1b20597 Make operator bool explicit for (Typed)MemoryMapping.
b580b25 Merge pull request #136 from tomhughes/ruby
a7c6737 The multipolygon test only needs the ruby interpreter
4a0a9e7 Make conversion from Buffer to bool noexcept.
7cdabbe Set thread name in o5m input format.
6a17a8d Break out computation of thread pool size into function and test it.
1950853 Allow initializing a Timestamp from any integral type.
4103198 Fix link in change log.
dc2ed89 Release v2.5.3
a2816b7 Fix end_of_time() Timestamp, add constructor taking std::string&.
3f5eb8e Updated changelog.
9b75c14 Cleanup and better docs for DiffObject and related classes.
d0beead Better documentation for NodeRef and NodeRefList classes.
0192292 Cleanup/doc/test osmium::util::Options.
b3db055 Use header with forward declarations.
8b3fe16 Improved documentation.
cd2ce38 Remove unused typedef Buffer::value_type.
87c9b32 Cleanup and test Buffer::add_buffer() function.
e519278 Improved documentation for osmium::memory::Buffer.
d721d43 Deprecate set_full_callback(). Better doc for deprecated functions.
58b5fd1 Remove DataFile class which was never used anywhere.
30b806e Simplify some tests.
62958df Update change log.
a8a2e68 Merge pull request #134 from zerebubuth/buffer-size-checks
987faab Move some code belonging into there into relations::Collector.
da31175 When the buffer isn't big enough, even when empty, to reserve the space that's being requested then it shouldn't reserve it anyway.
5d2f949 Swap the growth flag and any "full" callback as well as all the other members when swapping this buffer object.
1845aa9 The assertions prior to dereference are more strict than the conversion to bool. However, conversion to bool is often used as a predicate for whether dereference is okay, so the behaviour is easier to understand if they match.
abdfee1 Remove unused m_want_types in relations collector.
95b387f "Officially" mark two constructors as deprecated.
1d0da5f Release v2.5.2
31c3eaf Copy iterator around less often.
83c93d0 Do not check the write_future for exceptions on every item.
1c805ea Add counting of push() calls on queue in debug mode.
aa869c0 Release v2.5.1
212578b Fix documentation of Writer constructor.
0445dd8 Add new header file with forward declarations of commonly used classes.
4b6baac Optionally include external library headers.
712a6d1 Update change log.
fc78d04 Update style rules.
b590fe3 Unify use of 'typename' in templates. Unify spacing of ellipsis operator.
8c450ac Move osmium/io/overwrite.hpp to writer_options.hpp.
08eed02 Move DEPRECATED macro into compatibility.hpp.
b72eb8d Release v2.5.0
5aeba6b Better formatting for invalid timestamps on debug output.
6772413 Add valid() function on Timestamp.
7549b05 Update change log.
84119b0 Add option to fsync files after they are written.
db1bd92 Make optional parameters on Writer work in any order.
3482e3e Remove boilerplate. Add explicits to constructors.
cf389c6 Rename the wrap() function to the better ensure_cleanup().
678049e Use reference instead of pointer for decompressor.
7189d28 More consistent use and naming of Function templates.
3d66deb Use const& for parameter that's not changed.
88d65fb Fix warning with a cast.
03e8c9f Fix some misc issues found by cppcheck.
4848676 Options to cppcheck to check everything (--force) and ignore assert.
5f89a8c Add lots of assert() calls to Buffer implementation.
c990b43 Use a wrapper function in Writer for error handling.
04d9e3e Refactor of writer to work properly in all error cases.
6daf2d3 Throw when reading from Reader after eof or error. Use io_error everywhere.
713a189 Rename OutputFormat::close() to write_end().
7905add Refactor Reader/Writer code.
c050a05 Make thread_handler class movable.
8e661a2 Make DeltaEncode/Decode more generic and fix signedness issues.
da712a9 Fixed a few signedness issues.
dc04e67 Avoid possible narrowing conversion.
abd44af Make a variable static that should be.
7039fa6 Avoid global variable.
9e9fc0f Add a noreturn attribute.
a681a2c Do not pass Timestamp class through forwarding.
d37b717 Clean up status handling in Reader and Writer.
3b1f0d8 Add at_end_of_data() helper function to get self-documenting code.
bf3cc8c Add add_end_of_data_to_queue() helper function.
94bdd09 Fix test.
531db80 Use valid() on future instead of an extra bool.
7f328b3 Make RVO work for pop() function.
c1d726d Add some static_cast_with_assert paranoia checks.
5a064f7 Make sure DeltaDecode/DeltaEncode classes work for all integer types.
c69a701 Fix some integer types.
2b2cfc9 Remove extra semicolons at end of function definitions.
2b74aa6 Use workaround for GCC unused variable warning for index::map, too.
f7fb94d Different way of supression unused-variable warning.
c0813e6 Better handling of threads.
963ff8e Move internal buffer from OutputIterator into Writer.
698d027 Update change log.
24270dd Remove unused variables.
64d6363 Remove unnecessarily fully-qualified name.
5ccacc7 Add support for reading o5m and o5c files.
b603904 Fix up includes.
6013a27 Remove pessimizing move.
a19e4cf Use queue_wrapper in Reader, too.
74a5174 Refactor thread creation for WriteThread.
c480b33 Fix test code.
e135597 Do not use promise in two threads at once.
6fa16ca Refactor input format code.
53fc576 More robust implementation of writer/writer_thread.
1285316 Put some queue handling into new wrapper class.
a1e6e6f Rename osmium/io/detail/util.hpp to queue_util.hpp.
f42d6fc New add_to_queue() helper functions.
3db9b49 Simplify read thread handling.
a903561 Move any exception in read thread through queue.
ee977cb Add more tests for reader code.
99aaa45 Factor out input handling in classes derived from Parser.
7afa03c Wrap access to m_read_types in InputFormat.
f6c5971 Wrap sending to output queue in InputFormat.
26f4170 Consolidate header handling in InputFormat.
a0aa3ed Remove unnecessary inline declaration.
894e84a Declare a bunch of destructors noexcept and use consistent comments.
6c49b43 Add hack to append_printf_formatted_string() so it works on Windows.
20c3f20 Remove a move that prevented copy elision.
8192a4c Pull low-level string formatting out of debug output and test it.
190aa46 Move low-level string formatting/encoding functions into own header.
3e35441 Add Option::is_not_false() helper, use and test it.
0a90339 Updated some comments.
a44066f Make naming of output format options more consistent and document them.
a59b60b Run serialization of PBF blobs in worker threads speeding up PBF writer.
18a739f Remove unused m_file attribute from OutputFormat class.
9b5d3b7 Various output option related cleanups.
36772a0 Consistent ordering of methods in *InputFormat classes.
c04a51f Factor out common code in output formats.
ebc53d4 Do not use "explicit" on constructors with more than one argument.
e1dfcfc Make all destructors in io/detail noexcept.
cfd7970 Use consistent handling of output options in all outputs.
c4e71f0 Better implementation for output_formatted() and tests for it.
899a061 Extract common code from output formats.
b226ae4 Factor out common code from *OutputBlock classes.
fe4b287 Cleanup WriteThread class.
af421df Consistent naming of queue typedefs.
e8253c4 Add missing include.
9f71cd3 Refactor management of read thread into its own class.
4c96e16 Refactor Reader/InputFormat.
fa02e6c Refactor input format code.
d14ea27 Extract common code from PBF/XMLParser into new Parser class.
fe7acd3 Better handling of failures when parsing header.
2e3b6cd Remove unnecessary include of <future>.
3bd18b8 Factor out common code in input format.
2915604 Only get promise and future once, even if header() is called multiple times.
cfc980c Make output buffer for XML parser smaller.
4c1ffa7 Orderly shutdown in io::Reader.
8c7aa32 Remember whether the input queue was exhausted.
535bb6a Function call in new thread can be void.
e0d5448 Factor out some helper function for queue cleanup.
5a4c6b5 Use std::thread directly for input instead of std::async.
c1bdf4f Move common code from InputFormat child classed into base class.
89caa6e Report failures in input_format through the queue.
8f4d300 Rename (m_)queue to (m_)output_queue.
8fc1f5b Reorder XMLParser class making check_attributes() private.
df381d7 Make sure we always send end-of-file from PBF parser.
1a178b0 Factor out construction of PBFDataBlobDecoder.
cb34f76 Factor out read_from_input_queue_with_check() method.
21b51cc Factor out parse_data_blobs() method.
dc957a8 Make some variables const.
1c2812c Make methods private that don't need to be public.
81e5625 Refactor out parse_header_blob() function.
f9e5760 Fix test: New signature of XMLParser constructor.
43746d3 Add copy constructor to PBFParser.
8524780 Rename variables and other changes for clarity.
3e9627b Removed now superfluous parameters from InputFormat class.
7eac5cf Simplify input format class.
3ea2ace Set max queue size only in one place.
77ab086 Formatting.
ceee837 Use std::async instead of "raw" std::thread for pbf input.
6cafb45 Move and rename PromiseKeeper class: Now in thread/util.hpp.
06eff29 Set thread name for xml parser thread.
bd485cd Refactoring of threading code for input.
fc03bf6 Make sure (de)compression classes clean up properly.
27af4ea Use special function to shut down pool workers instead of an atomic<bool>.
84297b3 Bugfix: auto and std::minmax() don't mix well.
597ecc4 Always use std::swap() in the idiomatic form.
10dd14f Remove threading test that fails when machine is too busy.
2072786 Use reserve() to spead up dumping indexes.
66a344b Declare some index functions noexcept, especially destructors.
a0586da Use map::find() instead of awkward try-catch block.
d38a7f1 Do not run make tasks in parallel.
cd33daa Do not use clever YAML aliases, instead copy dependencies explicitely
4ad6e43 Integrate more compiler and os versions
b2c519b Check return code of close() system call and throw.
369057b Update protozero to current 1.2.2.
d1db14b Collect debug output options into struct.
54667dd More consistent debug output of way nodes, relation members and changeset comments.
67e1513 Add some paranoia checks to xml parser.
69de191 Refactoring in xml reader: New function check_attributes().
c67f3f3 Add support for changeset discussions (comments).
9c5531c Merge pull request #121 from DerDakon/cmake-find-no-components
44be1a7 Add helper functions to make input iterator ranges and output iterators.
76e2b91 Merge pull request #130 from alex85k/master
5a4fa6b remove assertion messageboxes in tests on Windows
bac5a77 Updated change log.
7e7bba4 Updated included protozero library to 1.2.0.
1ae370d Merge pull request #122 from zerebubuth/pbf-decode-non-visible-node-locations
5897468 Merge branch 'master' of github.com:osmcode/libosmium
7f2de1b Bugfix: Delta iterator handling.
65d31e9 Try ; as cmake list separator.
3a9dbc2 Add PBF libraries, now that the test reads PBF too. Thanks @tomhughes for pointing this out.
9a22ea1 Add test case for reading deleted / non-visible nodes in history files.
36098a8 Decode lat/lon even for non-visible nodes.
8279fd1 kick off AppVeyor to test new binary deps package with gdal200
c8244f7 FindOsmium: prevent errors in list(REMOVE_DUPLICATES) when no components are requested
a02806a Use https URL to travis.
a1b7015 Fix some includes.
468e4d8 Remove pessimizing std::move.
427d2e0 Do iwyu check on header files in alphabetical order.
be9a996 Release v2.4.1
95a3bc8 Fixed CRC calculation of tags and changesets.
4e157e3 Release v2.4.0
3da68f0 Fixed setting of binary mode on Windows.
81aa057 Use binary mode for memory mapped file on Windows.
986cb7e Set stdout to binary mode on windows before writing to files.
27d02eb Bugfix: Do not dereference end iterator.
e96eeaf Updated change log.
64a55ce FindOsmium: let FPHSA handle all the additionally required things
e152057 FindOsmium: pass the proper module name to FPHSA
a4acce3 Remove restriction on master branch in appveyor config.
10c8265 FindOsmium: simplify the fallback code for sparsetable::size_type
190ed47 remove the correct include dir from OSMIUM_INCLUDE_DIRS
aaa99c1 avoid that FindOsmium finds a random include dir
6406010 Add a magic define fixing a boost problem.
2fa6674 Remove superfluous file paths from cmake config.
e081a51 Merge pull request #114 from DerDakon/do-not-cache-version
20e1a24 Use external gdalcpp wrapper for compatibility with GDAL 2.
3b7cc86 Fix initialization order in DeltaEncodeIterator.
0954b0f Fix possibly uninitialized variable.
f081942 Take byte swap functions out of CRC class.
e085aae Fix byte swap, add test cases for crc.
e648b62 Merge pull request #116 from DerDakon/yml-simplify
7912897 properly put bzip2 library in the CMake cache
e0ea72b use less variables when defining the test environment
cf8ff6c do not cache the version string
38234cd Remove pragmas disabling warnings from gdal includes.
82d8c30 Include headers of external libraries as "system libraries".
f721b86 Update protozero to version 1.1.0.
a29ef82 Add some magic to enable folding on travis output.
18b2418 Removed toogr examples. They are in their own repository now.
89c8220 AppVeyor: 1st try with VS2015
93a1626 Added recent changes to change log.
ce4b45e Bugfix: Program hanging when opening unknown file type.
06ad6ef Rename add_string() to store_in_stringtable() and use right return type.
869058d Add explicit conversion that always works.
0b28f2c Add missing check in TagListBuilder add_tag() overload.
51fa9c0 Check in builder that key/value of a tag is not too long.
9b1da20 Check that string table isn't overflowing.
2c732c6 Add some extra paranoia checks and type conversions to pbf writer.
f92096a Fix integer size.
a47ddb4 Force conversion to smaller int type, because we know it must fit.
f150ff1 Rename variable that was hiding parameter name.
ab92064 Use correct size_t as return type.
2f2bf68 Check that roles are no longer than max allowed string length.
4a7df68 Check strings for max length in PBF input.
e4b8bb0 Explicit conversion to bool.
d18352d Make conversion from double to integer explicit.

git-subtree-dir: third_party/libosmium
git-subtree-split: 0ff278001f6e0bc79040add736452bef3aa4ff06
2016-01-05 12:00:40 +01:00
Daniel J. Hofmann 9852b147f8 Bump libosmium version to 2.5.4 in update script 2016-01-05 11:56:51 +01:00
Patrick Niklaus 552cdbfe20 Apply clang-tidy 2016-01-05 11:54:31 +01:00
Daniel J. Hofmann 4ca29dd18e Default initialize (i.e. zero initialize) variables to suppress -Wuninitialized false positive 2016-01-05 11:29:25 +01:00
Daniel J. Hofmann 0d971a70cc Prevent comment splicing from backslash at end of line 2016-01-05 11:19:18 +01:00
Daniel J. Hofmann 0dda98384b Bump license year count for headers we install, too 2016-01-05 11:15:30 +01:00
Daniel J. Hofmann 685d330ee2 Remove license headers from project source files; global license 2016-01-04 19:06:32 +01:00
Daniel J. Hofmann 2d455018ae We are at 2016 for the license 2016-01-04 18:13:05 +01:00
Patrick Niklaus fce486735b Merge pull request #1841 from mortada/use_double_not_float
use double precision calculations instead of mixing double and float
2016-01-04 11:58:07 +01:00
Patrick Niklaus 45073ce9eb Merge pull request #1840 from mortada/improve_comments
improve comments
2016-01-04 11:57:18 +01:00
Patrick Niklaus 4ba732c886 Fix AppVayor tests 2016-01-04 11:15:37 +01:00
Mortada Mehyar a6cb786718 improve comments 2016-01-03 20:50:25 -08:00
Mortada Mehyar 93a2e66704 use double precision calculations instead of mixing double and float 2016-01-03 20:44:38 -08:00
Patrick Niklaus facbe2c012 Fix test names for travis 2016-01-03 18:47:50 +01:00
Patrick Niklaus 02a49c8a68 Use local includes before system includes 2016-01-03 18:47:50 +01:00
Patrick Niklaus 97585bb26a Fix include paths 2016-01-03 18:47:50 +01:00
Patrick Niklaus b618a1241f Adapt build system 2016-01-03 18:22:31 +01:00
Patrick Niklaus d936009ea1 DOS -> UNIX file format 2016-01-03 16:37:38 +01:00
Patrick Niklaus 078f71c144 Move files in unit_tests around 2016-01-03 16:37:38 +01:00
Patrick Niklaus bfc6c9b89d Move files in src/ include/ 2016-01-03 16:37:38 +01:00
Patrick Niklaus 758d402305 Merge pull request #1839 from sebastic/occurred-typo
Fix 'occured' typo, replace with 'occurred'.
2015-12-26 13:39:07 +01:00
Bas Couwenberg e6789fab6c Fix 'occured' typo, replace with 'occurred'. 2015-12-25 22:26:08 +01:00
Patrick Niklaus a2e114e852 Merge branch 'develop' 2015-12-24 11:22:16 +01:00
Patrick Niklaus 0baf90a218 Adjust error string of distance_table to other plugins 2015-12-19 01:40:55 +01:00
Patrick Niklaus f9f3d43152 Fix min average sample time 2015-12-19 01:40:55 +01:00
Patrick Niklaus 326f2d2743 Accidentally broke the trip plugin 2015-12-18 19:22:02 +01:00
Patrick Niklaus 57f257dce5 Fix status messages and don't include 2015-12-18 18:18:48 +01:00
Patrick Niklaus c27fc4e4d8 Add comments to profiles about uturn 2015-12-18 15:54:33 +01:00
Moritz Kobitzsch a37192c102 alignment 2015-12-18 12:28:03 +01:00
Moritz Kobitzsch 68bd6a29b6 modified local state of u_turn_penalty_variable 2015-12-18 12:25:46 +01:00
Patrick Niklaus da11113bf1 Fix generate options parameter 2015-12-17 17:57:39 +01:00
Patrick Niklaus 70f4cdd0ca Replace codes with enum 2015-12-17 16:45:15 +01:00
Patrick Niklaus 78ac3cffde Add max values for viaroute and trip and reorganize return code handling
"status" is now always:
 - 200 if the request was successful
 - 207 if the result is empty (no path found)
 - 400 if the request is invalid

 viaroute and trip now have a maximum of 500 and 100 locations
 respectively. Override with the --max-viaroute-size and --max-trip-size
 parameters.
2015-12-17 04:14:34 +01:00
Patrick Niklaus 7eb2af6cd3 Add snapping regression test for viaroute 2015-12-16 22:51:01 +01:00
Patrick Niklaus 0b1c9d33a5 Don't use phantom node pairs as input for distance table 2015-12-16 22:51:01 +01:00
Patrick Niklaus 648a62112e Fix snapping to small components 2015-12-16 22:51:01 +01:00
Patrick Niklaus ff7cb91d9c Use the Koenig swap and add free swap function for DeallocationVector 2015-12-16 22:03:46 +01:00
Patrick Niklaus fd5881670d Use std::swap 2015-12-16 22:03:46 +01:00
Patrick Niklaus fc8768b79b Add test for car mode snapping 2015-12-16 22:03:46 +01:00
Patrick Niklaus 914570b053 Don't snap to ferries in car profile 2015-12-16 22:03:46 +01:00
Patrick Niklaus 1a8783cfa0 Fix unused variable warning 2015-12-16 22:03:46 +01:00
Patrick Niklaus 28bfefcac6 Add option to set segments as non-snapable from lua 2015-12-16 22:03:46 +01:00
Patrick Niklaus bec56522e3 Add stxxl/vector include to range_table test 2015-12-16 22:02:34 +01:00
Patrick Niklaus 0ddd473477 Use ::min() instead of -::max() 2015-12-16 19:41:06 +01:00
Patrick Niklaus 2defc8e826 Correctly initialize the min value 2015-12-16 19:35:12 +01:00
Patrick Niklaus c3756f6b58 Template the vector type in RangeTable 2015-12-16 18:17:04 +01:00
Patrick Niklaus 66af3d260c Merge pull request #1822 from rparanjpe-tesla/develop
name_lengths std::vector --> stxxl::vector
2015-12-16 11:49:59 -05:00
rparanjpe 5c3398c280 name_lengths std::vector --> stxxl::vector 2015-12-15 19:12:33 -08:00
Patrick Niklaus 63a59325f5 Fix SimpleClient 2015-12-16 00:26:13 +01:00
Patrick Niklaus f1091f97fc Fix cucumber help text test 2015-12-15 23:38:12 +01:00
Patrick Niklaus fe9bdfef79 Fix case when not specifing path or sharedmemory to osrm-routed 2015-12-15 22:27:12 +01:00
Patrick Niklaus a8f11981e3 Include tbb in libosrm.pc 2015-12-15 21:42:32 +01:00
Patrick Niklaus 94651744af Remove assertion in farest insertion 2015-12-15 21:33:59 +01:00
Patrick Niklaus 24e7d00af5 Fix call to shortest_path from match plugin /cc @danpat 2015-12-15 21:27:03 +01:00
Patrick Niklaus f85a35b5fc Fix map matching coordinate check 2015-12-15 21:14:43 +01:00
Patrick Niklaus a27aad0061 Fix osrm-routed options 2015-12-15 21:08:09 +01:00
Patrick Niklaus 9a332d2f86 Fix osrm.hpp placement 2015-12-15 19:25:26 +01:00
Patrick Niklaus 1264983688 Fix build 2015-12-15 16:31:28 +01:00
Lev Dragunov 4d4a3d02ed A side_road tag support for the OSRM car profile. 2015-12-15 13:23:27 +03:00
Patrick Niklaus 53cee90933 Fix removed server_paths reference 2015-12-15 05:17:31 +01:00
Patrick Niklaus 6daa3290d4 Cleanup library setup 2015-12-14 22:00:20 +01:00
Patrick Niklaus 5a9bee0527 Don't include zero characters in empty names 2015-12-13 20:31:47 +01:00
Daniel Patterson 6914d26187 Correct data entry for the empty string.
Rename name_offsets to name_lengths, because that makes more sense.
2015-12-13 11:02:55 -08:00
Daniel Patterson 68c01d09bb Merge branch 'rparanjpe-tesla-fix_stxxl_write' into develop 2015-12-11 15:40:03 -08:00
rparanjpe 4bf1ad2566 Write out stxxl vector for names correctly 2015-12-11 15:18:55 -08:00
Patrick Niklaus 00ed526fb0 Fix return value for node snapping 2015-12-11 17:37:48 +01:00
Patrick Niklaus 9bdc58069b Adapt snapping test to viaroute behaviour 2015-12-11 16:53:10 +01:00
Daniel Patterson 4ddbd2efb6 Expose component size variable as command-line option (this allows testing of big/small components in cucumber tests).
Add ability to pass extra parameters to  during tests.
Limit distance table search so that it doesn't return any big components if they're beyond max_distance.
2015-12-11 16:53:10 +01:00
Daniel Patterson f3f153cb38 Reduce source/targets to a single phantom node based on the small/big components that are present. 2015-12-11 16:53:10 +01:00
Patrick Niklaus 9414a8085d Fixed shortest_path when called from match plugin 2015-12-11 05:44:05 +01:00
Patrick Niklaus 33b18df1a0 Merge pull request #1809 from rparanjpe-tesla/develop
Use a std::vector in place of stxxl:vector for the names list
2015-12-10 11:13:05 -05:00
rparanjpe da91d342f7 name_list --> name_char_data and name_offsets
-Use stxxl vectors with char and unsigned int containers
-Write out the entire character vector to fil
-Cap the names at length 255 during the parsing so we reduce
 the amount of memory used by stxxl vectors and we can do a
 direct writing of the character vector to .names
2015-12-09 17:28:34 -08:00
Patrick Niklaus 4950e044ba Remove warnings and fix tests 2015-12-09 23:37:06 +01:00
Patrick Niklaus b41af5f580 Incoperate PR comments 2015-12-09 23:37:06 +01:00
Patrick Niklaus 24090d4642 Fix StaticRTree benchmark 2015-12-09 23:37:05 +01:00
Patrick Niklaus cdb1918973 Refactor StaticRTree to remove application dependent code
StaticRTree now acts like a container, just returning the input data
(NodeBasedEdge) and not PhantomNodes.
2015-12-09 23:37:05 +01:00
Patrick Niklaus a8e8f04fa3 std::vector<bool>::emplace_back -> push_back for gcc 4.8 2015-12-09 22:39:10 +01:00
Patrick Niklaus 4ec3102df2 Refactor cucumber tests 2015-12-09 21:17:18 +01:00
Patrick Niklaus 7e722db3ee Make the API grammar more strict to actually error 2015-12-09 21:17:18 +01:00
Patrick Niklaus 20c45be3b3 Address PR comments 2015-12-09 21:17:18 +01:00
Fabien Girard f2ee0aad20 Use now 3 parameters for matrix: loc/dst/src 2015-12-09 21:17:18 +01:00
Fabien Girard 478d4a571a Support rectangular matrix with less sources than targets 2015-12-09 21:17:18 +01:00
Patrick Niklaus 4253ebf243 Fix inverted error message. 2015-12-09 21:16:53 +01:00
rparanjpe 5b782a783a Use a std::vector in place of stxxl:vector for the names list
-For large datasets with very many unique names, stxxl::vector can corrupt
 data. Technically, we should only be using stxxl:vectors with POD. Other
 types might lead to strange/unpredictable behavior as we noticed here.
-See http://algo2.iti.kit.edu/dementiev/stxxl/trunk/FAQ.html
2015-12-08 23:31:58 -08:00
Patrick Niklaus c38183423f Move assertion to caller to save parameter 2015-12-05 01:27:01 +01:00
Patrick Niklaus 019e26dd8e Refactor direct_shortest_path and shortest_path 2015-12-04 23:34:24 +01:00
Patrick Niklaus 6d2a65b4ea Add additional uturn test 2015-12-04 20:52:21 +01:00
Patrick Niklaus 4206d98b55 Move leg search to routing base 2015-12-04 20:52:21 +01:00
Daniel Patterson 9005fe2f61 Merge pull request #1793 from Project-OSRM/fix/64bit_osm_ids
Add support for 64bit OSM node identifiers
2015-11-30 13:04:48 -08:00
Daniel Patterson f87f18a291 Add support for 64bit OSM node id values. 2015-11-30 12:37:58 -08:00
Patrick Niklaus c0fdcb381a Fix MVS compilation. 2015-11-25 00:27:37 +01:00
Patrick Niklaus aeaf0e7ba8 Fix unit test compilation 2015-11-25 00:27:20 +01:00
Patrick Niklaus 6dada4e347 Fix impossible route status message 2015-11-25 00:27:20 +01:00
Patrick Niklaus 61f015eef6 Fix match plugin status codes 2015-11-25 00:27:20 +01:00
Patrick Niklaus d843521839 Preserve information about big components
This uses a bit flag to differenciate between small and big components
and keeps the ids for both. This makes it possible to give better
error messages.
2015-11-25 00:27:20 +01:00
Patrick Niklaus 420369fe13 Fix off-by-one in via_indices 2015-11-24 21:05:18 +01:00
Daniel J. Hofmann 71bf1edc5e Run Modernizer 2015-11-21 22:17:55 +01:00
Patrick Niklaus d06ac519ab Only build using calng 3.8, gcc 4.8 & 5.0 2015-11-20 19:52:22 +01:00
Patrick Niklaus 50512b52e1 Remove -m parameter from routed as it conflicts. Use the long names instead. 2015-11-20 18:50:14 +01:00
Patrick Niklaus 543e77b9be Add pre-turn bearing as last field to instruction 2015-11-20 16:06:33 +01:00
Patrick Niklaus 783d455bd7 Add support for advisory speed limits
This adds support for the maxspeed:advisory class of speed tags.
2015-11-19 21:25:12 +01:00
Patrick Niklaus 6c35272fe2 Remove obsolte code as we use a turn function now 2015-11-19 21:25:12 +01:00
Daniel Patterson 6955978a62 Remove commented out line in windows build script. History is what git is for. 2015-11-19 15:02:42 -05:00
Daniel Patterson 27d87dff79 Remove some accidentally merged changes. 2015-11-19 15:00:29 -05:00
Daniel Patterson d8ca58a04e Merge pull request #1785 from Project-OSRM/feature/weight_debugging
Adds ability to dump GeoJSON with detailed edge weight info.
2015-11-19 12:01:08 -05:00
Patrick Niklaus ce34798685 Merge pull request #1782 from Mapotempo/pkgconfig
Fix pkgconfig cmake template
2015-11-19 11:42:34 -05:00
Fabien Girard 16fd5249dd Fix pkgconfig cmake template 2015-11-19 17:38:04 +01:00
Daniel Patterson b9a4c322a7 Add ability to debug routing graph visually by dumping
annotated GeoJSON during processing.
2015-11-19 10:41:44 -05:00
Daniel Patterson 673bf356e4 Merge pull request #1764 from Project-OSRM/edge_segment_lookup
Enable per-segment speed updates just before contraction.
2015-11-18 16:15:04 -05:00
Daniel Patterson 6228412e61 Enable just-before-contraction updates to edge weights. For small
datasets, this enables things like traffic-based updates in the
shortest possible processing turnaround time.
2015-11-18 16:14:08 -05:00
Daniel Patterson 578d947e2d Comment out failing bearing test - wontfix this problem for now 2015-11-18 14:08:12 -05:00
Daniel Patterson 72629d0081 Fix test cases for level cache command-line option. 2015-11-18 11:48:28 -05:00
Daniel Patterson d7989f19cf Fix bug in bearing filter related to reverse edges. Fix tests to catch it. Still one outstanding test failure that looks like a problem in the viaroute results. 2015-11-18 10:57:20 -05:00
Daniel Patterson 8b11cdbf61 Merge pull request #1780 from Project-OSRM/build_shared_libs
Enable building of shared libraries on Travis.
2015-11-18 09:56:59 -05:00
Daniel Patterson 5c1f76e3cf Build shared libraries on a selection of platforms. 2015-11-18 09:54:33 -05:00
Patrick Niklaus 63ba6018f3 Cache the node priorities between runs
This speeds up processings on the same dataset significantly by creating
a .level file that saves the level in which a node was contracted.
It removes the need for expensive recomputation of priorities and such.

Use with care! Running `osrm-extract` again will invalidate .level
files.
2015-11-18 00:56:33 +01:00
Daniel Patterson 8f3482561b Rename great_circle_distance->haversine_distance, and euclidean_distance->great_circle_distance, because that's what they actually are. 2015-11-17 17:10:06 -05:00
Daniel Patterson 13ceeb191c Merge pull request #1766 from Project-OSRM/feature/bearing_selection
Add bearing support to all plugins, add optional range to bearing parameter.
2015-11-17 16:41:34 -05:00
Daniel Patterson 1536d1c044 Add bearing filter support to viaroute, trip, nearest, and distance
table plugins.
Make bearing range configurable by adding a comma-separated second part
to the bearing paramenter, like so:

    b=<bearing:0-359>(,<range:0-180>)

If no range is supplied, it defaults to +/- 10 degrees.
2015-11-17 16:35:20 -05:00
Daniel Patterson 16b6c26d6e Merge pull request #1774 from Project-OSRM/feature/match_summary
Add a route summary to each match result.
2015-11-17 15:32:00 -05:00
Daniel Patterson c7e30e2266 Add a summary to each match result showing distance and duration.
Helpful for comparing how long the routing engine thinks the matched
trace should take to travel.
2015-11-17 15:28:21 -05:00
Daniel Patterson d5e4495f89 Merge pull request #1723 from Project-OSRM/i_like_travis
New Travis CI integration - upgrades Linux builds to Ubuntu trusty, simplifies dependency installation because system packages are now available for most things.
2015-11-17 15:26:29 -05:00
Daniel J. Hofmann 963960a44c Switch Travis builds over to trusty for Linux (simpler dependency installs), build
with mutliple compilers, fix debug builds.

OSX builds are disabled until we fix #1778
2015-11-17 15:15:31 -05:00
Daniel Patterson a62c10321c Update variant to 91ba0301a672ea0a3131390d44d304c5493de84a, specifically this commit: https://github.com/mapbox/variant/commit/39a631394e185f527159164c8b0fffae755b8512, which fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68073 under GCC 5.2.1.
Fixes  #1758
2015-11-03 21:56:26 -08:00
Patrick Niklaus bb49e03435 Merge pull request #1743 from c0nk/wip-build
Don't generate files in source tree
2015-10-22 16:32:28 -04:00
Kal Conley 38e7b1a262 Remove non-existent git_sha.cpp from .gitignore 2015-10-19 21:33:10 +02:00
Kal Conley a00d3dfc00 Don't generate util/version.hpp in source tree 2015-10-19 21:33:10 +02:00
Kal Conley cd458e7a44 Don't generate util/fingerprint_impl.hpp in source tree 2015-10-19 21:33:10 +02:00
Patrick Niklaus 3f82570469 Merge pull request #1740 from c0nk/develop
Fix various bugs
2015-10-19 20:31:23 +02:00
Kal Conley a8642bd208 Fix segmentation fault when "hsgrdata" unset 2015-10-19 20:13:02 +02:00
Kal Conley b404c79ca4 Fix json renderer always rendering arrays empty 2015-10-19 20:13:02 +02:00
Kal Conley 29c75337f2 Fix segmentation fault when sizeof(size_t) < sizeof(int64_t) 2015-10-19 20:13:02 +02:00
Patrick Niklaus fca4aeb50b Merge pull request #1741 from Project-OSRM/oom_messages
Catch `std::bad_alloc` at the top and translate to human readable messages
2015-10-19 19:29:53 +02:00
Daniel J. Hofmann 1dfa2d6e91 Catch bad_alloc and provide human reasable error messages 2015-10-19 18:18:11 +02:00
Daniel J. Hofmann 79650ca3fd Flatten main executable entry points by using functional try blocks 2015-10-19 18:18:11 +02:00
Patrick Niklaus fd84827e51 Don't use stalling in core search 2015-10-19 17:11:03 +02:00
Daniel J. Hofmann 78283a0e0e Check if memory locking should be done before locking unconditionally 2015-10-19 16:23:18 +02:00
Daniel J. Hofmann 993321e971 Lock by default, set fail on error 2015-10-19 16:23:18 +02:00
Daniel J. Hofmann f7a1e2f652 Flatten routed by using functional try-catch blocks 2015-10-19 16:23:18 +02:00
Daniel J. Hofmann e75be68466 Only lock the virtual address space when shared memory was requested
In addition, some improvements:

- unlock only when locking succeeded
- scoped exception safe RAII locker

Reference:

- https://github.com/Project-OSRM/osrm-backend/issues/1698#issuecomment-144003177
2015-10-19 16:23:18 +02:00
Daniel J. Hofmann 74ac283c52 We are on v4.8.1. 2015-10-09 16:53:17 +02:00
Patrick Niklaus 9ef1f8cba3 Fix fore core factors < 0.3 2015-10-08 20:58:21 +02:00
Daniel Patterson e45656e5bf Refactor edge expansion into extract phase. New temporary file is generated - '.osrm.ebg' which is used by 2015-10-06 09:23:17 -07:00
Patrick Niklaus cdc4fb45f2 Merge pull request #1720 from jordanmarkov/fix/invalid_nodes_left_in_data
Fixed a bug when extracting data from a file with cut streets (with m…
2015-10-06 11:44:51 +02:00
Daniel J. Hofmann 5379a555db Use ccache by default if available and a suitable compiler is used.
This checks if `ccache` is available, and if so uses it.
The user can stil disable it via the ccache env variable, quoting:

    disable (CCACHE_DISABLE) [boolean]
        When true, ccache will just call the real compiler, bypassing the cache completely. The default is false.

At least Clang required `CCACHE_CPP2`.

The user does not have to set up anything, just to install ccache.
Of course, things like the cache's max size, its location and so on can
be configured.

References:

- https://ccache.samba.org/manual.html
2015-10-06 11:18:43 +02:00
Daniel Patterson d07c0bde80 Adds support for a new b= parameter on the viaroute and match
plugins, allowing for better nearest neighbor matching when a heading
is known.
2015-10-06 11:15:10 +02:00
Patrick Niklaus 7015ed203a Don't count ferries as public transportation 2015-10-06 11:13:39 +02:00
Johan Uhle 1ead4cbb14 osrm-components: remove unused param
We don't use restrictions anymore
2015-10-06 11:12:56 +02:00
Jordan Markov 84ebca0dd2 Fixed a bug when extracting data from a file with cut streets (with missing nodes). 2015-10-06 09:42:52 +03:00
Daniel Patterson cf45b2cddb Properly initialize UUID used in Fingerprint class. Fixes #1721 2015-10-03 09:18:10 -07:00
Daniel J. Hofmann 8f8bd05f83 Silence warnings with GCC, LTO does not yet respect the -isystem switch 2015-09-30 18:22:26 +02:00
Daniel J. Hofmann b1155a202c Re-enable manual -fPIC flag from cae59c7. 2015-09-30 18:22:26 +02:00
Daniel J. Hofmann d4aaaf16f8 Revert "Re-enable position independent code, but in a portable way."
This reverts commit 2143dc97fa65c786c6566db1343ad270347dcfd3.
2015-09-30 18:22:26 +02:00
Daniel J. Hofmann 119fb63576 LTO is broken on GCC < 4.9.0, disable it.
References:

- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57038
- https://github.com/Project-OSRM/node-osrm/pull/112
2015-09-30 18:22:26 +02:00
Daniel J. Hofmann 3f7afd47d2 Do not violate the One Definition Rule (ODR).
By linking in the coordinate object file twice, we violate the ODR,
resulting in our program to not be "well-formed" in language lawyer
speak (hint: bad, very bad).

(How come no one noticed this all the time, this was introduced
somewhere between v4.5.0 and v4.6.0 from a quick look...)

References:

- C++14 standard (N3936.pfd): 3.2 One definition rule [basic.def.odr]
- http://eel.is/c++draft/basic.def.odr
2015-09-30 18:22:26 +02:00
Daniel J. Hofmann ca0f8ed653 Immensly increase lua/luabind detection and check in buildsystem.
Instead of including the `luabind.hpp` header that transitively includes
basically everything else, we now only include the appropriate header
for luabind's open function.

It is important that this function is declared in the header but the
definition comes from the luabind shared object (library), such that we
can detect linker errors, too.

By only including this header, we also no longer transitively include
the header for the `luaL_newstate` function, with we have to add
manually.

With these changes, detecting, compiling, linking and checking for
lua/luabind with cmake now works instantly, instead of the 3-4
seconds as it was before! Yay, progress!
2015-09-30 18:22:26 +02:00
Daniel J. Hofmann 809bdb7c1f Fixes version generation, no longer derives version on git tags.
We were stuck on the 4.5.0 tag from develop, since we searched for the
latest tag, but release tags are done on the master branch.

This commit rips out all the code for deriving the version on git tags.

Instead, we define major, minor, and patch versions in the CMakeLists
and then pass it on to:

- the `libosrm.pc` `pkg-config` file

- a `version.hpp` header that makes use of the preprocessor's string
  concatenation to provide an easy way for generating version string
  literals such as "v4.8.0".

That is, in the source code please now use the following defines:

    #define OSRM_VERSION_MAJOR "@OSRM_VERSION_MAJOR@"
    #define OSRM_VERSION_MINOR "@OSRM_VERSION_MINOR@"
    #define OSRM_VERSION_PATCH "@OSRM_VERSION_PATCH@"

    #define OSRM_VERSION "v" OSRM_VERSION_MAJOR "." OSRM_VERSION_MINOR "." OSRM_VERSION_PATCH
2015-09-30 18:22:25 +02:00
Daniel J. Hofmann 0424ff0818 Do not pass linker flags for static libraries.
Static libraries get the linker flags from the user / pkg-config.
2015-09-30 18:20:00 +02:00
Daniel J. Hofmann 9b952ff48c Improve debug build performance while keeping symbols.
- remove profiling/coverage mix from debug build, as it is useless as of
  now, re-enable this for a separate coverage build in the future

- use gcc's `-ggdb` and `-Og` flag (requires recent gcc) to provide
  better debug information targeted for gdb and optimize what we can

- use `-fno-inline` and `-fno-omit-stack-pointer`, in order to be able
  to jump around in gdb without functions being gone and keeping the
  stack reference
2015-09-30 18:20:00 +02:00
Daniel J. Hofmann c5064710a8 Re-enable position independent code, but in a portable way.
CMake 2.8.9 introduce a `POSITION_INDEPENDENT_CODE` property.

This sets `-fPIE` on executables, giving us back optimizations such as
inlining of global variables and functions, while setting `-fPIC` on
libraries.

Although we do not need position independent code on executables, it
seems like some gcc versions (like 4.9.2) have issues in combinations
with `_FORTIFY_SOURCE`.

On shared libraries, CMake should per documentation even use position
independent code by default.

References:

- http://www.cmake.org/cmake/help/v3.0/prop_tgt/POSITION_INDEPENDENT_CODE.html#prop_tgt:POSITION_INDEPENDENT_CODE
- http://public.kitware.com/pipermail/cmake-developers/2012-May/015839.html
- https://github.com/Project-OSRM/osrm-backend/pull/1647
- https://github.com/Project-OSRM/osrm-backend/commit/cae59c73953b02f18025a1ef1bbf2ca4ee8f239a
2015-09-30 18:20:00 +02:00
Daniel J. Hofmann 57e522065a Add linker optimizations and dead code and data elimination.
Linkers also have options we can configure! The most usefull feature is
to give every function its own section. This results in some bloat at
compile time, but at link time now the linker can do dead code and data
elimination by simply discarding appropriate sections.

This works by splitting the `.text` section in a way that makes it
possible to later only pull in sections that are actually referenced.

That is, the basic idea is to keep the matching between sections and
functions intact, so we can optimize based on it in the linking stage.

Note: there's still an issue with how `libOSRM.a` gets build. CMake
currently passes the linker flags on to ar, in order to create a static
library. But ar does not understand the linker's flags.

Referenes:

- https://sourceware.org/binutils/docs/ld/Options.html#Options
- http://elinux.org/images/2/2d/ELC2010-gc-sections_Denys_Vlasenko.pdfMCþ"
- http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_EXE_LINKER_FLAGS.html
- http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_MODULE_LINKER_FLAGS.html
- http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_SHARED_LINKER_FLAGS.html
- http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_STATIC_LINKER_FLAGS.html
2015-09-30 18:20:00 +02:00
Daniel J. Hofmann 7143daf500 There is no CMAKE_LINKER_FLAGS variable.
There really isn't; deal with it.

Also, those are not linker flags but instead meant for the compiler.

References:

- http://www.cmake.org/cmake/help/v3.0/manual/cmake-variables.7.html
2015-09-30 18:20:00 +02:00
Daniel J. Hofmann 71a00fc01b Make lto detection more robust and not resetting cxx flags when lto fails.
This refines the last commit of parallelizing lto.

Discussion: this is ugly as hell, dispatching 1/ on the availability of
the `-flto` flag, then 2/ on the compiler since GCC allows `-flto=n`
whereas Clang for example does not.

I tried setting the CMake property `INTERPROCEDURAL_OPTIMIZATION`,
without any effect. All I could see was some lto related utilities in
the cmake debug output, but not in the actual compiler or linker
invocation.

This would eliminate the need for our hacks, with 1/ using an option
`WITH_LTO` setting `ON` by default, and based on this value setting the
`INTERPROCEDURAL_OPTIMIZATION` flag with CMake doing the actual work of
selecting the best LTO method on the target platform.

By the way, this also fixes a bug where we reset the `CMAKE_CXX_FLAGS`
to a variable that was never defined, resulting in setting the flags to
an empty string. Yay CMake, as usual.

References:

- http://www.cmake.org/cmake/help/v3.0/prop_tgt/INTERPROCEDURAL_OPTIMIZATION.html
2015-09-30 18:20:00 +02:00
Daniel J. Hofmann 941483c14d Parallelize optimization and code generation for link time optimization.
This parallelizes the `-flto` feature resulting in parallel optimization
and code generation for link time optimization based on the number of
logical processors available.

Note: this has the side-effect of using more memory during linking.

References:

- https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html (see: -flto)
- http://www.cmake.org/cmake/help/v3.0/module/ProcessorCount.htmMC
2015-09-30 18:20:00 +02:00
Daniel J. Hofmann 17d8e65c64 Silence unused variable warnings 2015-09-30 18:20:00 +02:00
Daniel J. Hofmann 72c0feb048 Silence warnings for system headers that we or third_party transitively includes.
GCC with link time optimizations does not to respect this mode
unfortunately, reuslting in warnings in release (default) build
mode from system includes such as boost, luabind and so on.
2015-09-30 18:18:36 +02:00
Daniel J. Hofmann 9e20dbe226 Remove -fPIC flag from build system.
This remove the `-fPIC` flag, indicating position independant code
generation, from the build system.

Citing GCC's official code generation docs:

> This option makes a difference on the m68k, PowerPC and SPARC.

We do not support any of these architectures, so remove the flag!

References:

- https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options
2015-09-30 18:18:36 +02:00
Daniel J. Hofmann 06f2738c03 Add stricter compiler warnings to build system.
These are for standard compliance and should on by default:

    -Wall -Wextra -pedantic

The problem is that even `-Wall` and `-Wextra` does not cover all
warnings, as to not break backward compatibility. Clang therefore
has the `-Weverything` flag, that really includes everything but is
overkill for the day to day development.

Thus, we in addition add:

    -Wuninitialized -Wunreachable-code

to guard against undefined behavior from reading uninitialized variables
and warn for unreachable code.

With:

    -Wstrict-overflow=1

the compiler warns us when it's doing optimizations based on the fact
that signed integer overflows are undefined behavior.

With:

    -D_FORTIFY_SOURCE=2

we tell the compiler to replace functions like strcpy with strncpy where
it can do so, resulting in cheap and useful buffer overflow protection.

References:

- https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
- https://securityblog.redhat.com/2014/03/26/fortify-and-you/
- https://wiki.debian.org/Hardening
2015-09-30 18:18:36 +02:00
Daniel J. Hofmann 5a257416ca Completely rip out Boost's Spirit / Karma for casting.
This rips out the Bost Spirit / Karma conversion code, using the stdlib
and lightweight alternatives instead.

The main benefit is an immense decrease in compilation times, for every
translation unit that requires the `util/cast.hpp` header.

Note: compared to the version before, there is a minor change in
behavior: the double `-0` was printed as `0` before and is now printed
as `-0`. This comes from the IEE754 standard, specifying signed zeros,
that is `+0` and `-0`. Interesting for us: JavaScript uses IEE754,
resulting in no breakage if used in arithmetic.

Small test case, left hand side was before, right hand side is now:

    $ ./a.out
    -1.123457 vs -1.123457
    -1 vs -1
    -1.3 vs -1.3
    0 vs -0
    0 vs 0
    0 vs 0
    1.3 vs 1.3
    1.123457 vs 1.123457

References:

- https://en.wikipedia.org/wiki/Signed_zero
- http://www.boost.org/doc/libs/1_59_0/doc/html/boost/algorithm/trim_right_if.html
- http://www.boost.org/doc/libs/1_59_0/doc/html/boost/algorithm/is_any_of.html
2015-09-29 16:15:54 +02:00
Daniel J. Hofmann f9f0ffb64d Remove hand written conversion code and replace with stdlib features.
With C++11 the stdlib gains:

- `std::stoi` function family to convert from `std::string` to integral type

- `std::to_string` to convert from number types to `std::string`

The only reason for hand-writing the conversion code therefore is
performance. I benchmarked an `osrm-extract` with the hand-written code
against one with the stdlib conversion features and could not find any
significant difference (we switch back and forth between C++ and Lua,
shaving off a few us in conversion doesn't gain us much).

Formatting arithmetic types in the default format with given precision
requires streams, but is doable in a few lines of idiomatic stdlib code.

For this, there is now the following function template available:

    template <Arithmetic T, int Precision = 6>
    inline std::string to_string_with_precision(const T);

that requires integral or floating point types and returns a formatted
string in the defaukt format with the given precision applied.

In addition this completely rips out Boost.Spirit from the `casts.hpp`
header, resulting in faster compile times.

Boom!

References:

- http://en.cppreference.com/w/cpp/string/basic_string/stol
- http://en.cppreference.com/w/cpp/string/basic_string/to_string
- http://www.kumobius.com/2013/08/c-string-to-int/
2015-09-29 16:15:54 +02:00
Daniel J. Hofmann 31cf8a8813 Remove Boost.Filesystem v3 fix for Boost < 1.48, refactor call sites.
We needed this for Boost < 1.48, but per our Wiki on building OSRM:

> On Ubuntu 12.04 you will be limited to OSRM tag v0.3.10 because
> later versions **require Boost v1.49+** and installing this
> causes problems with libluabind-dev package.

Thus, rip it out!

To keep the commits atomic and isolated, I also refactored all call
sites that used the functionality from the portability fix.

While doing this, I also simplified the monster of around ~100 lines of
file path checking --- lambda's are awesome' use them!

References:

- http://stackoverflow.com/a/1750710
- https://github.com/Project-OSRM/osrm-backend/wiki/Building-on-Ubuntu
2015-09-29 16:15:54 +02:00
Daniel J. Hofmann 98b7e0a407 Refactor bearing implementation.
- removes `noexcept` specifier as we can not guarantee for not throwing

- uses a namespace instead of a struct + static function combination

- asserts for heading degree in [0, 360] range (both sides inclusive!)

- header only since implementation does not hide anything

- adds `inline` specifier as compiler hint
2015-09-29 16:15:54 +02:00
Daniel J. Hofmann 7ed63d2ab5 Remove TBB usage from hot code paths 2015-09-28 20:37:09 +02:00
Daniel J. Hofmann 6e6b38e8e9 Revert the usage of TBB's iterator pair taking overloads.
This reverts the range based overload usage introduced in @6b2bf495.

Old TBB versions do not provide the range overloads.
2015-09-28 20:37:09 +02:00
Daniel J. Hofmann 829b9d96e4 Revert parallelization on algorithms that are used in the server. Let node do this.
This reverts @6b2bf49 on the server algorithms.
2015-09-28 20:26:29 +02:00
Daniel J. Hofmann 85cef7e37c Revert parallelization on util that is used in the server. Let node do this.
This reverts @6b2bf49 on the server component utils.
2015-09-28 20:26:29 +02:00
Daniel J. Hofmann c526bec798 Revert parallelization on server part. Let node do this.
This reverts @6b2bf49 on the server components.

We do not want to parallelize there, as node should be used for
parallelizing the user requests onto multiple processes.
2015-09-28 20:26:03 +02:00
Daniel J. Hofmann 9231335eef Use Intel TBB's parallel_sort even for nested parallelism.
TBB has a global task scheduler (that's one of the reason TBB is not
linked statically but dyanmically instead). This allows control over all
running threads, enabling us to use nested parallelism and the scheduler
doing all the task allocation itself.

That is, nested parallel execution such as in

    parallel_for(seq, [](const auto& rng){
      parallel_sort(rng);
    });

is no problem at all, as the scheduler still claims control over the
global environment.

Therefore, use `parallel_sort` Range overload where possible.

References:

- https://www.threadingbuildingblocks.org/docs/help/hh_goto.htm#reference/algorithms.htm
- https://www.threadingbuildingblocks.org/docs/help/hh_goto.htm#reference/algorithms/parallel_sort_func.htm
- https://www.threadingbuildingblocks.org/docs/help/hh_goto.htm#reference/task_scheduler.htm
- https://www.threadingbuildingblocks.org/docs/help/hh_goto.htm#reference/task_scheduler/task_scheduler_init_cls.htm
- https://www.threadingbuildingblocks.org/docs/help/hh_goto.htm#tbb_userguide/Initializing_and_Terminating_the_Library.htm
2015-09-28 20:26:03 +02:00
Daniel J. Hofmann dfac34beac Do not use an incomplete type with value semantics 2015-09-28 16:50:36 +02:00
Daniel J. Hofmann 82dd5d8ccf Use Boost.Optional instead of custom optional monad implementation.
This switches out the `<variant/optional.hpp>` implementation of the
optional monad to the one from Boost.

The following trick makes sure we keep compile times down:

- use `<boost/optional/optional_fwd.hpp>` to forward declare the
  optional type in header, then include the full blown optional header
  only in the implementation file.

- do the same for the files we touch, e.g. forward declare osmium types,
  allowing us to remove the osmium header dependency from our headers:

      `namespace osmium { class Relation; }

  and then include the appropriate osmium headers in the implementation
  file only. We should do this globally...

References:

- http://www.boost.org/doc/libs/1_59_0/libs/optional/doc/html/index.html
- https://github.com/osmcode/libosmium/issues/123
2015-09-28 15:00:21 +02:00
Daniel J. Hofmann be506f7121 Change integer_range's .size() member function return type to size_t.
Instead of the return type being the templated `Integer` parameter.

The integer type and the size of the range are not connected.
2015-09-28 15:00:21 +02:00
Daniel J. Hofmann 2470494009 Implement saity checks for irange and its returned type iterator_range.
The implementation does not support backwards counting ranges, but fails
to assert on this condition. Fix this once and for all.
2015-09-28 15:00:21 +02:00
Daniel J. Hofmann f95a4b9b46 Remove iterator_range dead code 2015-09-28 15:00:21 +02:00
Daniel J. Hofmann 6b444a0877 Do not include Boost.Thread is a sub-header is good enough.
`boost::thread_specific_ptr` lives in `<boost/thread/tss.hpp>`.

In addition, fix the includes in the touched header.

Reference:

- http://www.boost.org/doc/libs/1_59_0/doc/html/thread/thread_local_storage.html
2015-09-28 15:00:20 +02:00
Daniel J. Hofmann 5c4a845b55 Remove template-heavy Boost.MPL headers where not needed.
This removed mpl headers from the code base, where not needed.

This mostly affects unit tests, where mpl's type list is actually only
used once to automatically generate tests for multiple types (see ref).

In addition, this commit also fixes the includes in the touched headers.

Resulting in 1/ reduces build times and 2/ proper includes.

Reference:

- http://www.boost.org/doc/libs/1_59_0/libs/test/doc/html/boost_test/tests_organization/test_cases/test_organization_templates.html#ref_BOOST_AUTO_TEST_CASE_TEMPLATE
2015-09-28 15:00:20 +02:00
Daniel J. Hofmann 468c01056f Replace custom replace utility with the stdlib's replace algorithm.
This removes the custom `replaceAll` function, replacing it with
`std::replace` from the stdlib's `<algorithm>` header.

This also removes the respective unit test.

More importantly, this removes the dependency on the
`<boost/algorithm/string.hpp>` header in the `string_util.hpp` header.
2015-09-28 15:00:20 +02:00
Daniel J. Hofmann 397078758e Remove boost/thread from rtree, include header for hash_combine in unit test.
The `static_rtree.hpp` header included `<booost/thread.hpp>` without using
anything from this header.

Removing it showed why:

the unit test for the rtree no longer built, since it was missing symbols
for Boost's `hash_combine`, used in the unit test.

Instead of relying on `<boost/thread.hpp>` including the proper header
for `hash_combine` by chance that we only use in the unit test, do the
following:

- remove `<boost/thread.hpp>` from the rtree implementation
- add `<boost/functional/hash.hpp>` to the rtree unit test

As always, include what you use.
2015-09-28 15:00:20 +02:00
Daniel J. Hofmann c9af06c9e0 Remove hand-written ConcurrentQueue class template.
We already rely on Intel TBB, which provides battle-tested
concurrency containers, such as:

- `concurrent_queue`,
- `concurrent_bounded_queue`,
- `concurrent_priority_queue`.

The `ConcurrentQueue` class template was never used. If the need
comes up again, we should strongly prefer those instead of writing
one ourselves.

References:

- https://www.threadingbuildingblocks.org/docs/help/reference/containers_overview/concurrent_queue_cls.htm
- https://www.threadingbuildingblocks.org/docs/help/reference/containers_overview/concurrent_bounded_queue_cls.htm
- https://www.threadingbuildingblocks.org/docs/help/reference/containers_overview/concurrent_priority_queue_cls.htm
2015-09-28 15:00:20 +02:00
Patrick Niklaus 5a7e663b1d Merge pull request #1707 from arnekaiser/develop
Bugfix: allow POST request without POST data
2015-09-27 17:57:31 +02:00
akaiser e0550cd20b Bugfix: allow POST request without POST data 2015-09-24 14:40:35 +02:00
Daniel Patterson 5844231a37 Include (road) name of matched nodes in addition to coordinate. 2015-09-23 17:53:34 +02:00
Lauren Budorick 8d435638e1 Delete accidental/extraneous files 2015-09-23 10:33:27 -04:00
Freenerd 55cad1b3ac Refactor alternative route test 2015-09-23 15:54:23 +02:00
Daniel J. Hofmann 9deadc1371 Static analysis: integration with the Static Analyzer.
This provides a wrapper script to invoke the Static Analyzer on the code
base. The script simply wraps your commands, that is you have to do the
following:

    ..scripts/analyze cmake ..
    ..scripts/analyze cmake --build .

Note: the Static Analyzer is integrated in Xcode, so if you are on a
Mac, consider using Xcode natively instead of this wrapper script that
will only give you HTML output.

Reference:

- http://clang-analyzer.llvm.org/
2015-09-22 17:32:32 +02:00
Daniel J. Hofmann 998abf05ba Integration scripts for Clang's Modernize and Tidy tool.
New directory: `scripts/`, in which small scripts for developers reside.

- `modernize`: runs all cpp files through `clang-modernize`, respecting
  out targeted compiler versions, applying C++11 transformations, doing
  syntax checks and formatting --- in parallel.

- `tidy`: runs all cpp files through `clang-tidy`, with selected
  warnings only, since we do not want to warn on every small detail.

Please check the talk slides for `clang-tidy` linked in the references!

References:

- http://clang.llvm.org/extra/clang-tidy/
- http://llvm.org/devmtg/2014-04/PDFs/Talks/clang-tidy%20LLVM%20Euro%202014.pdf
- http://clang.llvm.org/extra/clang-tidy/checks/list.html
- https://github.com/Project-OSRM/osrm-backend/pull/1603
2015-09-22 17:32:32 +02:00
Daniel J. Hofmann aab5092da3 Use Readme.md as mainpage untill we have something better. 2015-09-22 16:26:21 +02:00
Daniel J. Hofmann 65ee5c4bbb Exclude unit tests and benchmarks from doxygen and make it more robust.
Only specify the flags we change from the default.

    doxygen -g Doxyfile

Generates a default Doxyfile.

Also, make the docs not depend on `dot`, but conditionally create graphs
if `dot` is available, and if not still generate docs.
2015-09-22 16:26:21 +02:00
Daniel J. Hofmann 42ab938a19 No longer generate XML from Doxygen, was used for Breathe+Sphinx integration. 2015-09-22 16:26:21 +02:00
Daniel J. Hofmann 2891de2fcd Add dependency on Dot to CMakeLists for Doxygen integration.
Reference:

- http://www.cmake.org/cmake/help/v3.0/module/FindDoxygen.html
2015-09-22 16:26:21 +02:00
Daniel J. Hofmann ed3758874d Target developers with doxygen output, more callgraphs, internals.
See the changed flags for their detailed description, in short: this
makes the doxygen output even more awesome for developers.
2015-09-22 16:26:21 +02:00
Daniel Patterson 895d8179a2 Adds basic Doxygen support. Run and docs will end up in 2015-09-22 16:26:21 +02:00
Patrick Niklaus 8f6fc0146b Merge branch 'develop' 2015-09-20 13:30:19 +02:00
Freenerd e1ac1c4fdc Test that alternative route exists
Complement to a6b44a1470
2015-09-18 17:30:53 +02:00
Daniel Patterson a6b44a1470 Revert alternative instructions array nesting to previous behaviour. 2015-09-17 09:06:51 -07:00
Daniel J. Hofmann e8834a68f3 Script for fully automated test bisecting.
Automate cucumber tests bisecting by providing a `git bisect` script.

Because it is stored in source control, but bisecting changes the HEAD,
it is advised to first copy over the script to a place outside source
control, e.g. `/tmp`.

Usage:

    git bisect start HEAD HEAD~10
    bit bisect run /tmp/bisect_cucumber.sh

This automatically configures and builds OSRM, spawns the cucumber tests
and communicates with `git bisect` based on its return code.

Reference:

- man git-bisect
2015-09-16 19:13:31 +02:00
Patrick Niklaus 6ad1cd3fb5 Merge branch 'develop' 2015-09-16 18:18:54 +02:00
Daniel J. Hofmann 3279cbac24 Extend compressed output lifetime till the async write function finishes.
This extends the compressed output vector's lifetime, as we issue an
asynchronous write operation that only receives a non-owning buffer to
the compressed data.

When the compressed output vector then goes out of scope, its destructor
is called and the data gets (potentially) destroyed. If the asynchronous
write happens afterwards, it's accessing data that is no longer there.

This is the reason for race conditions --- well, for undefined behavior
in general, but it manifests in the routed _sometimes_ not responding at
all.

The fix works like this: keep the compressed output associated with a
connection. Connections inherit from `std::enable_shared_from_this` and
issues a `shared_from_this()` call, passing a `std::shared_ptr` to the
asynchronous write function, thus extending their lifetime.

Connecitons thus manage their lifetime by themselves, extending it when
needed (and of course via the `std::shared_pointers` pointing to it).

Buffer's non owning property, from the `async_write` documentation:

> One or more buffers containing the data to be written. Although
> the buffers object may be copied as necessary, ownership of the
> underlying memory blocks is retained by the caller, which must
> guarantee that they remain valid until the handler is called.

Reference:

- http://www.boost.org/doc/libs/1_59_0/doc/html/boost_asio/reference/async_write/overload1.html
2015-09-16 02:06:58 +02:00
bergwerkgis 5094bad838 kick off AppVeyor to test new binary Windows deps package, refs #1628 2015-09-15 12:23:25 +00:00
Daniel J. Hofmann 94af9b7f13 Caches iterators instead of invoking function calls on every iteration.
This caches iterators, i.e. especially the end iterator when possible.

The problem:

    for (auto it = begin(seq); it != end(seq); ++it)

this has to call `end(seq)` on every iteration, since the compiler is
not able to reason about the call's site effects (to bad, huh).

Instead do it like this:

    for (auto it = begin(seq), end = end(seq); it != end; ++it)

caching the end iterator.

Of course, still better would be:

    for (auto&& each : seq)

if all you want is value semantics.

Why `auto&&` you may ask? Because it binds to everything and never copies!

Skim the referenced proposal (that was rejected, but nevertheless) for a
detailed explanation on range-based for loops and why `auto&&` is great.

Reference:

- http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3853.htm
2015-09-15 12:09:39 +02:00
Patrick Niklaus 8e02263084 Fix off-by one error in decoder and make padding deterministic. 2015-09-14 23:01:38 +02:00
Patrick Niklaus fe0fe1873a Add simplification reset that was accidentally removed 2015-09-11 01:34:10 +02:00
Andreas Gruß de29574314 tests + instructions for map matching 2015-09-11 01:34:10 +02:00
Lauren Budorick 5ac024788e Parse specific restriction:* tags based on profile exceptions 2015-09-10 15:52:26 -07:00
Patrick Niklaus a1e273e983 Add switch for handling fallback name 2015-09-10 14:11:18 +02:00
Patrick Niklaus a95bf64ccf Fix processing for data files with incorrect node references 2015-09-10 12:22:03 +02:00
Daniel J. Hofmann 4fa9022932 Use iterator pair taking parallel_sort, old TBB versions have no range overload. 2015-09-10 11:04:50 +02:00
Daniel J. Hofmann f10fb77a81 Ownership: vector already owns, no need for wrapping in unique_ptr.
Removes the pointless `std::unique_ptr<std::vector<T>>` usage,
as a `std::vector` already owns its resources and manages them.

Results in one indirection less (hint: good).
2015-09-09 18:53:11 +02:00
Daniel J. Hofmann db092c828e Don't pass by const-value for a read-only view.
I can't see a reason we pass by const-value here.

Note: changes API because of the `route_parameters` header.
2015-09-08 23:34:20 +02:00
bergwerkgis bed0598530 AppVeyor: make tests pass again 2015-09-07 19:45:54 +02:00
bergwerkgis b734d4bbc1 [skip ci] AppVeyor: fail again, if tests fail 2015-09-07 14:43:24 +00:00
bergwerkgis d2080808db AppVeyor: include osrm.lib in artifact. don't stick to AppVeyor directory structure in build scripts. 2015-09-07 14:26:47 +00:00
Daniel J. Hofmann 345d5e8d9e Make an exception for block barriers in bicycle and foot profile.
This adds `barrier=block` exceptions to the respective white lists.

In addition this adds tests to check for the exception in bicycle and
foot profiles and makes sure cars are still not able to cross them.

Checked with:

    cucumber --tags @barrier -p verify

References:

- https://github.com/Project-OSRM/osrm-backend/issues/1643
- http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dblock
2015-09-07 12:23:21 +02:00
Daniel J. Hofmann bcc41bf3d1 Fixes undefined behavior from shifting into signed bit; use unsigned literal instead 2015-09-06 01:11:54 +02:00
Daniel Patterson b2d444d782 Only replace fingerprint file when MD5 changes. Avoids rebuilding several things if nothing has actually changes, as cmake is only looking at timestamps. 2015-09-04 14:07:40 +02:00
Lauren Budorick bac6703f8e Implement raster source feature to read data from third-party sources, to be used in lua profiles.
* Adds a data structure, RasterSource, to store parsed + queryable data
* Adds bindings for that and relevant data structures as well as source_function and segment_function
* Adds relevant unit tests and cucumber tests
* Bring-your-own-data feature
2015-09-03 22:28:18 -07:00
Daniel J. Hofmann 6cbbd1e5a1 Move destination to access tag white list instead of making exception in car profile.
Tested with:

    cucumber --tags @access -p verify

References:

- https://github.com/Project-OSRM/osrm-backend/issues/1617
- https://github.com/Project-OSRM/osrm-backend/pull/1639
2015-09-03 17:46:20 +02:00
Daniel J. Hofmann b6ef558c86 Make pedestrian roads marked as destination routable with car profile.
Check provided tests with:

    cucumber --tags @access -p verify

References:

- https://github.com/Project-OSRM/osrm-backend/issues/1617
- http://wiki.openstreetmap.org/wiki/Tag:highway%3Dpedestrian
- http://wiki.openstreetmap.org/wiki/Key:motorcar
- http://wiki.openstreetmap.org/wiki/Key:access
2015-09-03 17:46:20 +02:00
Patrick Niklaus 70bb082973 Fix endless loop 2015-09-03 17:02:34 +02:00
Patrick Niklaus 8b8a19c75d Fix failing matching tests due to gps precision 2015-09-03 17:02:34 +02:00
Patrick Niklaus 0b53242564 Move distance calculation out of loop 2015-09-03 17:02:34 +02:00
Patrick Niklaus f11bd509b0 Also prune on MAX_DOUBLE 2015-09-03 17:02:33 +02:00
Patrick Niklaus 57608628a4 Use median sample time instead of average to harden against outliers 2015-09-03 17:02:33 +02:00
Patrick Niklaus f167c3e12e Move heap initialization out of loop 2015-09-03 17:02:33 +02:00
Patrick Niklaus 262b380280 Candidate query for match is now only depending on gps_precision 2015-09-03 17:02:33 +02:00
Patrick Niklaus ee0c20ae44 Fix typo 2015-09-03 17:02:33 +02:00
Patrick Niklaus c30c144120 Move matching default in route_parameters.cpp 2015-09-03 17:02:33 +02:00
Patrick Niklaus a5ee82b0d1 Make matching thresholds adaptable to different sample lengths 2015-09-03 17:02:33 +02:00
Patrick Niklaus a4f558181d Add status field to match plugin response 2015-09-03 17:02:33 +02:00
Daniel Patterson 120303e6e3 Fixed test case that uses the car profile. 2015-09-03 17:01:11 +02:00
Daniel Patterson b3822d5802 Enable turn penalties on car profile, using values tuned by comparing real-world sample routes with map-matched routes. 2015-09-03 17:01:11 +02:00
Daniel J. Hofmann 980e4ee89a Don't mix signed and unsigned in comparisons as signed is converted first to unsigned.
This is true:

    -1 > 1u

because the integer literal `-1` is first converted to a large unsigned
value and then compared to the unsigned `1`.

This patch fixes several of those isses in the farthest insertion
algorithm.

`-Wsign-compare` catches those issues.

References:

- http://stackoverflow.com/a/5416498
- C++14 standard
2015-09-02 16:33:03 +02:00
Daniel J. Hofmann bb1428eeb1 Remove unneeded semicola from profiles.
Nothing fancy, does what it says.
2015-09-02 12:23:26 +02:00
Huyen Chau Nguyen f6a90e9b42 add missing include and clang-format 2015-09-01 15:20:35 +02:00
Huyen Chau Nguyen a71159667d add cucumber test for the trip plugin 2015-09-01 15:20:35 +02:00
Huyen Chau Nguyen 74e00cf652 fix some small issues:
remove empty unit test

remove compiler directives

move trip related files from routing_algorithms to algorithms

run clang-format on files

fix all std::size_t related issues

improve code by adding std::move()s

clean up includes

fixing several code stye and improvement issues

add several small code improvements

return single scc in SplitUnaccessibleLocations() when theres only one

change ComputeRoute() to return an InternalRouteResult by value

improve some code style issues
2015-09-01 15:20:35 +02:00
Huyen Chau Nguyen e773a80b06 remove possibility to choose algorithm but only use brute force and farthest insertion 2015-09-01 15:20:34 +02:00
Huyen Chau Nguyen e6eea67eeb rename all names with round_trip, trip or tsp to trip to standardize the naming 2015-09-01 15:20:34 +02:00
Huyen Chau Nguyen 8429a1e792 add assertions 2015-09-01 15:20:34 +02:00
Huyen Chau Nguyen 47fbd2a2b5 fix json output such that each trip returns a json object with all information of the trip 2015-09-01 15:20:34 +02:00
Huyen Chau Nguyen 93835b9b94 change input param for tsp algos from a vector to a begin and an end iterator 2015-09-01 15:20:34 +02:00
Huyen Chau Nguyen 2de3fc9f6f fix GetAdjacendEdgeRange of matrix wrapper for tarjan scc and fix wrongly solved merge conflict 2015-09-01 15:20:34 +02:00
Huyen Chau Nguyen 78a8cf6982 add a wrapper for the distance table for better access 2015-09-01 15:20:34 +02:00
Huyen Chau Nguyen 99cf3219d4 have less redundant code for requests with one or multiple SCCs 2015-09-01 15:20:34 +02:00
Huyen Chau Nguyen 7587e97d46 use typedefs from typedefs.h
return roundtrip result as a return parameter and not as an input parameter
2015-09-01 15:20:34 +02:00
Huyen Chau Nguyen 3061c8b854 solve merge conflicts 2015-09-01 15:20:34 +02:00
Huyen Chau Nguyen 77e9e95067 fix bugs
and add todos of code review session with daniel-j-h
2015-09-01 15:20:33 +02:00
Chau Nguyen 6191b6bee2 add parameter to choose algorithm for tsp calculation and remove redundant code 2015-09-01 15:20:33 +02:00
Chau Nguyen b15f8f68e4 refactor and improve the round trip computation of multiple SCCs
Problem:
- old solution was slow
- depending on the result of TarjanSCC, new distance tables and new phantom node vectors were created to run tsp on it

Solution:
- dont create new distance tables and phantom node vectors
- pass an additional vector with the information which locations are in the same component and ignore all others

fix bug for scc split computation
2015-09-01 15:20:33 +02:00
Chau Nguyen 84c12793e8 clean up some code 2015-09-01 15:20:33 +02:00
Chau Nguyen 6eeadddd4d remove attention on unaccessible locations as we filter them beforehand 2015-09-01 15:20:33 +02:00
Chau Nguyen a40b3a98dc split algorithms in different plugins for better evaluation
split tsp brute force algorithm for better testing

refactor and clean up
2015-09-01 15:20:33 +02:00
Chau Nguyen f0d66ff0fb move implementation of algorithms to own hpp in routing_algorithms folder
add changes to improve readability
2015-09-01 15:20:33 +02:00
Chau Nguyen d3ebd360b2 add brute force algorithm for tsp for small tests 2015-09-01 15:20:33 +02:00
chaupow ebbe1692c8 add description of farthest insertion algorithm
add farthest insertion algorithm for round trip

farthest insertion: always add the node that add the biggest distance to the total route

farthest insertion: remove total distance computation and compute only diff instead
2015-09-01 15:20:33 +02:00
chaupow ca7d406787 add timer to check runtime of round trip algorithm 2015-09-01 15:20:33 +02:00
chaupow a2dc8378f5 rename result_table to dist_table 2015-09-01 15:20:33 +02:00
chaupow b570e89dbd capsule tsp round trip computation in a private method 2015-09-01 15:20:32 +02:00
chaupow 108f87678a fix bugs and add comments
rename subroute to via_point

merge is_lonely_island and is_connected to make code easier to understand
2015-09-01 15:20:32 +02:00
chaupow 00146ae87c add support for locations that are not reachable as well as information about location permutaton 2015-09-01 15:20:32 +02:00
chaupow e3757fbbfa add round trip plugin with greedy approximation 2015-09-01 15:20:32 +02:00
Daniel J. Hofmann ac64e8b15e Remove protobuf dependencies from travis config 2015-08-31 16:57:42 +02:00
Daniel J. Hofmann c39ca7189b Remove protobuf dependencies from build system 2015-08-31 16:54:22 +02:00
Daniel J. Hofmann 03c8fdd30a Remove protobuf dependencies from docker setup 2015-08-31 16:48:27 +02:00
Patrick Niklaus 788bc67faa Squashed 'third_party/libosmium/' changes from 8bcd4ea..c43f8db
c43f8db Release v2.3.0
44c135f Update README to show dependencies used internally.
ece54cd Add external licenses.
908cd5f Updated change log.
96dbf0e Change %-escape in OPL format.
98f6e27 Change write benchmark to interleave reading and writing.
39620ce Make writing of metadata configurable for XML and OPL output.
e5a4e5e Add debug output format.
597390f Remove superfluous include and pragmas.
ecc57b0 Update pbf reader/writer to use new protozero functions.
5d1e8d2 Update protozero from upstream.
ef8746b Fix build on Windows.
ddba46f Remove superfluous include.
098c57f Add some paranoia checks to pbf reader.
0f804c2 Try building with newer boost library on travis.
6f79d63 Use explicit return types on lambdas.
355f3b1 New PBF reader and writer based on protozero.
71d719b Add pbf writing benchmark.
f014b4c Fix iwyu.sh script: Works now if build directory doesn't exist.
a0ace49 Use utf8cpp header-only lib instead of boost for utf8 decoding.
796f18e Bugfix: Reading large XML files could block.
5a2bcbe Replace strcmp by std::string comparison in test.
bc49e2c Bugfix: XML writer was not writing whitespace correctly.
61222f8 Fix 64bit byte swap.
e56f090 Fix new CRC code on OSX and Windows.
70229aa Add low-level building blocks that allow calculating CRC of OSM data.
0968a66 Remove assert checking for unset version.
62e0261 Refactor test case.
4bfc7fc Allow instantiating osmium::geom::GEOSFactory with existing GEOS factory.
e70af0c Remove calls to protobuf cleanup function im benchmarks and examples.
718518d Bugfix in OPL output. Relation member roles were not encoded.
759d5cb Rename parameter that had the same name as a type.
7054cab Provide (Typed)MemoryMapping constructors for backwards compatibility.
d09f5d1 Fix typo.
b4e578f Make memory mapping utility class more flexible.
633fa8e Travis build without sudo.
7ff23f1 Improved code setting file format from suffix/format argument.
90ef3b9 Remove some tests that didn't test much and failed on FreeBSD.
af86273 Add some pragmas to disable warnings for GCC.
efac7fd Fix some include problems found by IWYU.
79d2f4c Changed add_user() and add_role() in builders. Add add_member().
9375d00 Add function to set tags from ptr + length. Improve TagBuilder tests.
bafca20 Test helper: Use more const and have sub-builders in their own scope.
f73c993 Simplify code.
fee1710 Disable warning only when compiling with GCC.
74402f3 Merge pull request #98 from dforsi/master
2c4b449 Update to new upstream catch.hpp version.
1318732 Release v2.2.0
1873998 Add missing test.
2e5ea1d Do not add timestamp to html doc pages.
1b2ea89 Remove debug output.
0be9599 Improved parsing of ids, versions, uids, etc. from strings.
4308d80 Add second version of split_string utility function.
f18c9e5 Move part of pbf.hpp into new pbf_type_conv.hpp.
d201152 Use new DeltaEncode class in pbf writer.
e205610 Add DeltaEncode/DeltaDecode utility classes.
32905d6 Bugfix: Actually throw the exception we are creating...
d3e86d8 Add functions to convert item_type to zero-based index.
daddf07 Bugfix: Programs writing OSM files can stall up to a second after writing.
00b0247 Add function to set the id of a relation member.
f85316a Fix error message.
19bc6cc Fix name of travis install script.
719cd33 spatialite-bin package now available on travis
cb03821 Shorten long test string (MSVC doesn't like it).
c3440a6 Add BoolVector index class.
da08073 Add min_op/max_op utility functions.
411d112 AppVeyor.yml: new links for binary deps
7d9095f add test for badly formatted timestamps
a073f73 Add helper methods to DiffObject.
3b9819a Add GeoJSON factory using the RapidJSON library.
107bca5 Use a reference instead of a copy.
a6943a4 Mark a few variables that are not changing as const.
51b7e53 Improved error message for geometry exceptions.
5c37a13 Some minor spelling fixes
8ae5723 Bugfix: Dense location store was written out only partially.
5994322 Add support for tiles.
2168bac Add has_map_type() method to map factory.
a9634bd Add more tests for mercator projection.
3c13e4d Add functionality to create simple polygons from ways in geom factories.
e8c5bb1 Use uint64_t as counter, so there can be no overflows.
07fc9b9 libsparsehash-dev now in travis package whitelist
820e112 Add coverage support to CMake config.
5e9f943 Bugfix: Use the right include to really allow any input file type.
d4b48eb CMake: Make version string a cached variable.
e6baccb Add (c)begin/end functions to TypedMemoryMapping. Removed get_addr().
3e32710 Use size() from MemoryMapping in TypedMemoryMapping.
96390db Improve MemoryMapping class documentation.
60a6217 Do not round memory mapped files to page size boundaries.
4907cbe Bugfix: function name.
cac01d8 Use _filelengthi64 on Windows instead of fstat(2).
6a25bdf Windows: Put invalid parameter handler into wrapper class. Re-enable test.
110df9b Add invalid parameter handler on Windows to test.
549ed5f Disable some tests (to find which one fails on appveyor).
a5b8873 Use resize_file() in memory mapping test instead of ftruncate directly.
40e41d3 Use _chsize_s() instead of _chsize() on Windows.
048397e Refactoring: Use low-level util functions in DataFile.
6a033f9 Remove now unused Windows implementation of mmap.
3eccdbb Move dword_hi/lo functions into osmium::util namespace.
be7351b Remove unused code.
b859b18 Make dword_hi/lo functions inline.
2e3bc37 Simplify mmap_vector_base/anon/file.
f819cf3 Always map full pages. Make sure files behind mapping are large enough.
d0c84b6 Add some low-level helper functions for file system access.
62e8d91 Make DataFile constructor explicit.
fba684c Fix memory mapping test for windows.
78a7fd5 Add constructor to DataFile to create tmp file with given size.
f911893 Bugfix: typo.
1cf2739 Add AnonymousMemoryMapping class.
56eac30 Implement MemoryMapping::resize() function.
1a73262 Bugfix: Counter variables were too small.
1ade32c Fix include position.
b03aec3 Fixed some bugs in new DataFile class/tests.
f109534 Add DataFile utility class.
9ed3c43 Fix/cleanup some code.
4f326c9 Fix bug: Copy-and-paste error.
78a5b2f Use reinterpret_cast instead of static_cast to get HANDLE on Windows.
7baa318 Fix typo.
e669069 Make huge value even huger to see if code reliable fails then.
66137ad Improved documentation of MemoryMapping and TypedMemoryMapping classes.
3121393 Add TypedMemoryMapping class.
f45335e Default for get_addr() template type.
685bbaf Remove unused code from tests.
ce65bd4 Fix some issue with new MemoryMapping class.
e7b8e15 Added MemoryMapping wrapper class for mmap() and Windows equivalent.
6b1effe typo fixed
33d479d Refactored travis build.
4348522 Fix xml data test.
769b1e8 Bugfix: Better check for invalid locations.
bba7e68 Appveyor: Disable test failing because of missing dependency.
3d40dc7 Link with /debug on MSVC, add note about LNK4099 warnings.
5ef051f Appveyor: Disable header builds, add benchmarks.
ce7485e Reformat Appveyor config.
c60e505 use shallow clones for faster git fetch
3b18bca Travis cleanups.
b8dfac0 Cleanup travis build.
5f19838 Trying to fix travis gcc build...
d4255a4 Remove -Wno-return-type from recommended options.
5f1a41b Add dump_as_array() function to maps.
ff22f76 Add constructors and begin()/end() functions to VectorBasedSparseMultimap.
c7e05dd Bugfix: Make REGISTER_MAP() macro work when called several time with same name parameter.
abdc317 Bugfix: Mark cbegin() and cend() of mmap_vector_base as const functions.
d81d439 Add close() function to mmap_vector_base class.
d74cff2 Add function on Buffer to get iterator to specific offset.

git-subtree-dir: third_party/libosmium
git-subtree-split: c43f8db50d93912a8bec5cd9fea733f7fec05549
2015-08-28 12:42:03 +02:00
Patrick Niklaus 048be2da2c Merge commit '788bc67faa7738cf7c6b2a192ecf3e3567d1c20e' into develop 2015-08-28 12:42:03 +02:00
Patrick Niklaus 8e1f70865e Use curl instead of http in update script. 2015-08-28 12:40:40 +02:00
bergwerkgis 6143f1ff5b AppVeyor: try "os:VS2015" 2015-08-28 12:15:42 +02:00
Daniel J. Hofmann db30836b53 Add rising bollard exception to barriers for car profile.
This handles `barrier=bollard` with `bollard=rising`, by making an
exception to the barrier whitelist. Barriers tagged as such do no longer
require an explicit access tag.

This also adds corresponding tests, check this out:

    cucumber --tags @barrier

References:

- http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dbollard
- http://wiki.openstreetmap.org/wiki/Key:bollard
- https://github.com/Project-OSRM/osrm-backend/issues/1616
2015-08-25 14:52:45 +02:00
Daniel J. Hofmann 3e8ef5e462 Remove unused obey_bollards from profiles, already handled via barrier_whitelist. 2015-08-25 14:24:43 +02:00
Lauren Budorick 0a53dccd4c Use .round instead of .to_i for cucumber speeds 2015-08-25 00:06:57 +02:00
Wilhelm Berg 2b5aa142fb appveyor.yml update url to binary deps 2015-08-24 23:29:30 +02:00
Wilhelm Berg 40443d1e25 appveyor.yml update url to binary deps 2015-08-24 21:23:12 +02:00
Daniel J. Hofmann cb4e7614ee Actually do the subtree pull instead of just notifying the user 2015-08-21 12:16:19 +02:00
Daniel J. Hofmann 3d84dbc73f Check for releases and request user confirmation before updating subtrees 2015-08-21 12:16:19 +02:00
Daniel J. Hofmann beb2ab9ad5 Add script to update subtree-ed third party dependencies more easily.
Note: this updates the subtrees immediately.

Discussion: would it make sense to do something along the lines of:

    $ http --body https://api.github.com/repos/mapbox/variant/releases/latest | jq ".tag_name"
    "v1.0"

And warn the user if the latest release tag is not the tag the update
script was called with. Or at least ask for confirmation?
2015-08-21 12:16:19 +02:00
Daniel J. Hofmann 9a0877379c Remove dead code. 2015-08-20 16:15:20 +02:00
Patrick Niklaus bbd0239ece Fix Coverity warning in EBGF 2015-08-20 12:28:14 +02:00
Patrick Niklaus 92956f2b45 Also support loading core information into shared memory 2015-08-19 12:27:44 +02:00
Patrick Niklaus 48d1a5ec5d Make sure to terminate when the core heaps are empty 2015-08-19 12:27:44 +02:00
Patrick Niklaus 2ff2ce460c Add .core to cucumber renaming 2015-08-19 12:27:44 +02:00
Patrick Niklaus 7cc875b8db Initial version of core based search 2015-08-19 12:27:44 +02:00
Patrick Niklaus 9387f583fa Add loading of .core file to InternalDataFacade 2015-08-19 12:27:44 +02:00
Patrick Niklaus 707dd700b0 Write number of markers to .core file 2015-08-19 12:27:44 +02:00
Patrick Niklaus ddff9b612f Serialize out .core file containing core node markers 2015-08-19 12:27:44 +02:00
Patrick Niklaus 338ac5d4a3 Rename map to describe what it actually does 2015-08-19 12:27:44 +02:00
Patrick Niklaus ca7abd727a Merge pull request #1603 from Project-OSRM/refactor/clang_modernize
Modernize the code base to C++11 standards and beyond.
2015-08-19 12:26:58 +02:00
Daniel J. Hofmann 62b20769ee Modernize the code base to C++11 standards and beyond.
Apply `clang-modernize` (based on Clang 3.6) transformations to the
codebase while making sure to support Clang>=3.4 and GCC>=4.8.

We apply the transformations in parallel to speed up the quite
time consuming process, and use our `clang-format` style file
to automatically format the code respecting our coding conventions.

We use the following self-explanatory transformations:

* AddOverride
* LoopConvert
* PassByValue
* ReplaceAutoPtr
* UseAuto
* UseNullptr

This required a `compile_commands.json` compilation database, e.g.

    ccmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=1

for CMake or check Bear for a Makefile based solution (or even Ninja).

    git ls-files -x '*.cpp|*.h' | \
      xargs -I{} -P $(nproc) clang-modernize -p build -final-syntax-check -format -style=file -summary -for-compilers=clang-3.4,gcc-4.8 -include . -exclude third_party {}

Boom!

References:

* http://clang.llvm.org/extra/clang-modernize.html
* http://clang.llvm.org/extra/ModernizerUsage.html
2015-08-18 12:56:34 +02:00
Patrick Niklaus 4ec323c5cc Merge commit '9958937fd1c1f9dd60126a56e1c4f25ceefaf70e' 2015-08-15 00:11:31 +02:00
Patrick Niklaus 84e72ede72 Warn if an edge references a missing node 2015-08-14 23:57:01 +02:00
Patrick Niklaus bd37c48596 Add test for mode change 2015-08-12 13:02:18 +02:00
Patrick Niklaus e30f0e8e11 Always announce a turn on mode change
Fixes #1558
2015-08-12 13:02:18 +02:00
Patrick Niklaus c43a2513a8 Rename tiny_components.hpp to tarjan_scc.hpp
Fixes #1561
2015-08-12 13:02:18 +02:00
Patrick Niklaus 4b4bc0dde2 Fix postgis lua example
Fixes #1573.
2015-08-12 13:02:18 +02:00
Patrick Niklaus 49adf2192a Move calculate_coordinate to algorithms/
Fixes #1367
2015-08-12 13:02:18 +02:00
Andreas Gruß a7eabeb73f gps_precision and matching_beta can be used as a float value 2015-08-11 11:06:11 +02:00
Patrick Niklaus f838f3427b Fix static graph test 2015-08-06 15:09:28 +02:00
Patrick Niklaus 1cc75ca636 Only swap nodes if it contains a big component 2015-08-06 13:20:29 +02:00
Patrick Niklaus d4356b0453 Move comparators to struct 2015-08-06 11:13:25 +02:00
Patrick Niklaus 35542e5823 Change interface of Tarjan get_component_size to take component id 2015-08-06 11:13:25 +02:00
Patrick Niklaus c80c2233c5 Find components on edge-expanded graph 2015-08-06 11:13:25 +02:00
Patrick Niklaus c2f0e4f683 Implement correct const iterator for DeallocatingVector 2015-08-06 11:13:25 +02:00
Patrick Niklaus 2621f4a2fa Allow any input format for StaticGraph and check if edge list is sorted 2015-08-06 11:13:25 +02:00
Patrick Niklaus 3c055642d5 Remove reference to restrictions and bollard nodes because it does not work 2015-08-06 11:13:25 +02:00
Patrick Niklaus 43b881d0cd Simplify test.sh 2015-08-02 14:45:27 +02:00
Patrick Niklaus 8b7b32e225 Added ccmake to docker image 2015-08-02 14:45:27 +02:00
Patrick Niklaus 00b0ff50f3 Add clang and README 2015-08-02 14:45:27 +02:00
Patrick Niklaus 1acde593b5 Fix docker run step 2015-08-02 14:45:27 +02:00
Patrick Niklaus c43c043521 Add docker port of build instructions 2015-08-02 14:45:26 +02:00
MoKob b526cadebd Initial version of core ch
This improves preprocessing times in favour of worse query performance.
Core size can be set over the --core parameater, default is the old
behaviour to fully contract the graph.
2015-08-01 18:00:48 +02:00
Patrick Niklaus 94f44e1d5d Make sure to capture floating point return values from lua 2015-08-01 17:46:47 +02:00
bergwerkgis 0352d9c99e AppVeyor: wrong paths when creating artifacts 2015-07-13 14:49:30 +00:00
bergwerkgis 0cd3f37e1b AppVeyor: create artifacts 2015-07-13 16:03:18 +02:00
Patrick Niklaus 486d7b6d62 Fix typo in foot profile that removed traffic lights 2015-07-09 21:24:07 +02:00
Patrick Niklaus 8f4e332409 Link restrictions to datastore test 2015-07-08 20:26:54 +02:00
Patrick Niklaus f0389c0b2f Restructure CMakeFile to fix shared library linking errors 2015-07-08 18:26:25 +02:00
Patrick Niklaus 922e8a4912 Return the correct size 2015-07-01 18:07:29 +02:00
Patrick Niklaus 021a1c7a39 Restructure the construction of the undirected graph 2015-07-01 18:07:29 +02:00
Patrick Niklaus 4a7451682b Fix data_structure test thanks to new assertion 2015-07-01 18:07:29 +02:00
Patrick Niklaus faa880d60a Remove unused memebers and rename to currrent style convention 2015-07-01 18:07:29 +02:00
Patrick Niklaus fd30e82836 Add graph compressor unit tests 2015-07-01 18:07:29 +02:00
Patrick Niklaus 3ef34fbb56 Rename GeometryCompressor and add unit tests 2015-07-01 18:07:29 +02:00
Patrick Niklaus 7345dc6861 Move graph compression code outside of EBGF 2015-07-01 18:07:29 +02:00
Patrick Niklaus 9958937fd1 At least check 4*LEAF_SIZE edges before returning none. 2015-07-01 17:57:03 +02:00
Patrick Niklaus f19c57200d Fix endless loop 2015-06-30 00:22:40 +02:00
Patrick Niklaus 8a2652f53d Only penaltize bidirectional ways if they have 1 lane 2015-06-27 16:26:18 +02:00
Patrick Niklaus dddde4ddab Fix backwards speed on oneway=-1 streets 2015-06-27 16:26:18 +02:00
Patrick Niklaus 300d901618 Merge branch 'develop' 2015-06-22 13:06:50 +02:00
Patrick Niklaus 1cb72acd27 Remove unused header 2015-06-22 08:36:21 +02:00
Patrick Niklaus a17776cb5f Check if FingerPrint is trivial. TODO: Add this for all other data that is going to be serialized 2015-06-19 18:10:49 +02:00
Patrick Niklaus 94b749ab00 Fix magic number check for fingerprint 2015-06-19 17:51:35 +02:00
Patrick Niklaus 5fc0d284cb Revert "Simplify offeset calculation logic a little bit"
This reverts commit 8ade26b4a4.
One of the assertions triggers when run on an extract of Serok. Since
this code does not fix any bugs, I'll just revert this for now.
This definetly needs investigation.
2015-06-19 16:50:48 +02:00
Patrick Niklaus bbe1211451 Merge pull request #1534 from Project-OSRM/profile/lane-penalty
Profile/lane penalty
2015-06-19 00:25:32 +02:00
Patrick Niklaus ce152b205f Merge pull request #1535 from Project-OSRM/develop-vs2015
make AppVeyor green again
2015-06-19 00:25:11 +02:00
bergwerkgis a5fd7cf4e9 make AppVeyor green again 2015-06-18 18:16:51 +02:00
Dane Springmeyer da38a1367a try building with vs2015 as CTP_Nov2013 appears broken now on appveyor 2015-06-18 18:15:34 +02:00
Patrick Niklaus 1445f11c19 Add test for lane penalty 2015-06-18 17:35:39 +02:00
Patrick Niklaus 86df55f5cc Add penalty if there is only one lane for both directions 2015-06-18 17:31:49 +02:00
Patrick Niklaus cf294c938e Merge pull request #1508 from agruss/geometry_string
Polyline string as parameter
2015-06-18 16:29:29 +02:00
Patrick Niklaus ebff45f803 Add new regression test for looping bugs 2015-06-18 00:18:54 +02:00
Patrick Niklaus 7b8021a36e Merge pull request #1531 from Project-OSRM/fix/poland-motorway-bug
Fix/poland motorway bug
2015-06-17 23:25:41 +02:00
Patrick Niklaus 5c77bb7c67 Fix inversion of sign 2015-06-17 23:25:16 +02:00
Patrick Niklaus 8ade26b4a4 Simplify offeset calculation logic a little bit 2015-06-17 23:25:16 +02:00
Patrick Niklaus bdbc60b4f7 Fix comments in edge based graph factory 2015-06-17 23:25:16 +02:00
Patrick Niklaus 373fa7a7d9 Merge pull request #1502 from agruss/develop
Accepting HTTP Post Request
2015-06-17 23:24:41 +02:00
Lauren Budorick eec4f173a7 Fix tag misspellings in profiles + tests: forestry, pebblestone 2015-06-09 20:16:58 -07:00
Andreas Gruß d726ce6340 removed send_simple_request 2015-06-07 12:20:03 +02:00
Andreas Gruß b406844c96 rearranged send_request parameters 2015-06-07 11:06:37 +02:00
Andreas Gruß 153d38f10c post/get handler added, background section for HTTP request 2015-06-05 13:26:27 +02:00
Andreas Gruß dce917eb74 post tests via query options available 2015-06-04 17:39:54 +02:00
Andreas Gruß eb711787ae tests added 2015-06-03 15:31:20 +02:00
Patrick Niklaus 9967dbbaa9 Don't remove small segments at start/begin if they are vias 2015-06-02 17:51:17 +02:00
Patrick Niklaus 71dc10ebea Add failing test case 2015-06-02 16:59:30 +02:00
Andreas Gruß 782fba2ce7 updated to 1E6 based polyline format 2015-06-02 13:15:31 +02:00
Andreas Gruß 4d73f98050 made geometry_string a const reference 2015-06-02 13:06:06 +02:00
Andreas Gruß 79d2083a00 changed parameter from geometry_string to locs 2015-06-02 12:10:28 +02:00
Andreas Gruß ee3b296a99 fixed values of test 2015-06-02 12:10:13 +02:00
Andreas Gruß 8b62d04453 test added 2015-06-02 12:09:59 +02:00
Andreas Gruß 9b0d3dfaeb polyline string as parameter added 2015-06-02 12:09:46 +02:00
Patrick Niklaus b1ef4cfee9 Remove debugging code 2015-06-01 17:22:12 +02:00
Patrick Niklaus f12f6a56ba Fix debug message 2015-06-01 17:22:12 +02:00
Patrick Niklaus 2777d53a12 Direct edges in contractor correctly and add better graph validation. 2015-06-01 17:22:12 +02:00
Patrick Niklaus aba3ec692f Verify graph before compression 2015-06-01 17:22:12 +02:00
Patrick Niklaus b7c8fcd062 Also print edge source/target for suspicious edge weights 2015-06-01 17:22:12 +02:00
Patrick Niklaus 3065de63dd Move renumbering and edge deduplication in extractor 2015-06-01 17:22:12 +02:00
Patrick Niklaus a57fb4f1ab First step into overhauling the edge storage 2015-06-01 17:22:12 +02:00
Patrick Niklaus c493a22765 Add test case for leisure=track 2015-06-01 11:20:17 +02:00
Patrick Niklaus d85e5def5d Add running tracks to foot profile 2015-06-01 11:20:17 +02:00
Patrick Niklaus 0aba499c8e Use spaces instead of tabs 2015-06-01 11:20:17 +02:00
Patrick Niklaus 4146695f34 Add test to check new way naming convention 2015-06-01 11:19:27 +02:00
Patrick Niklaus 4e57e10ba8 Use 'name (ref)' if both are present 2015-06-01 11:19:27 +02:00
Andreas Gruß daa6d02887 Content Type validation added 2015-06-01 09:42:22 +02:00
Daniel Patterson a87d89302f Handle POST request when spanning multiple packets 2015-05-31 21:34:38 +02:00
Patrick Niklaus 2a9b1311d3 Add test for ignoring crossing nodes 2015-05-30 19:30:33 +02:00
Patrick Niklaus 7d73501b87 Update bicycle profile to ignore crossing nodes 2015-05-30 19:26:56 +02:00
Daniel Patterson 039d6acd3e Fix test case, it was missing 'via' instructions 2015-05-29 16:52:08 +02:00
Daniel Patterson 405fcdc483 We really need to run these tests. 2015-05-29 16:52:08 +02:00
Daniel Patterson f52abc1a62 When replacing packed_path1/2, also need to replace distance1/2 to properly track. 2015-05-29 16:52:08 +02:00
Daniel Patterson e763953562 Address #1424 by using the original fix 2015-05-29 16:52:08 +02:00
Patrick Niklaus 4cab617c25 Fix Coverity issue by initializing member 2015-05-29 09:13:28 +02:00
Patrick Niklaus 0190b5e5af Merge pull request #1501 from Project-OSRM/refactor/contractor
First part of the contractor refactor
2015-05-29 01:08:55 +02:00
Patrick Niklaus abc0952247 Fix accessing DeallocatingVector 2015-05-28 22:22:02 +02:00
Patrick Niklaus 6ce2726a87 Fix return codes for osrm-prepare 2015-05-28 15:18:48 +02:00
Patrick Niklaus 17a4463f59 More assertions 2015-05-28 15:18:48 +02:00
Patrick Niklaus e76d8df246 Fix tools to build with new graph reader interface 2015-05-28 15:18:48 +02:00
Patrick Niklaus a46bcf45d5 Move option parsing to own class 2015-05-28 15:18:48 +02:00
Patrick Niklaus 1f985d04a2 Move writing graph to an own function 2015-05-28 15:18:48 +02:00
Patrick Niklaus d64e6e6c1f Move more function from Run in subfunctions 2015-05-28 15:18:48 +02:00
Patrick Niklaus 1164a65df8 Refactor processing_chain by splitting into sub functions 2015-05-28 15:18:48 +02:00
Patrick Niklaus d57f07d57e Merge pull request #1500 from Project-OSRM/fix/scc-only-barrier
Enable barrier check for TarjanSCC
2015-05-28 15:17:36 +02:00
Patrick Niklaus 5c0a964321 Remove unused code SimpleNodeBasedDynamicGraph 2015-05-28 12:43:55 +02:00
Patrick Niklaus cf3b8d09d9 Also run the algorithm tests on travis 2015-05-28 12:43:27 +02:00
Patrick Niklaus 1c7397fb21 Enable barrier check for TarjanSCC
Re-enabling turn restrictions as well requires some further work to
extend the algorithm.
2015-05-28 12:31:59 +02:00
Andreas Gruß 6a08d93e2c http post requests implemented 2015-05-27 15:40:10 +02:00
Patrick Niklaus 4c03ace9eb Remove pruning in IncrementalFindPhantomNode 2015-05-25 02:07:01 +02:00
Patrick Niklaus 2cd616dd30 Merge pull request #1485 from danpat/fix/lua_err_display
Return error message when lua error occurs.
2015-05-22 09:45:26 +02:00
Daniel Patterson eab87c0827 Return error message when lua error occurs.
The error may not be the first item in the stack while we're inside the error handler.  ::from_stack() works OK outside the error callback, but not inside.
2015-05-21 15:39:23 -07:00
Patrick Niklaus 8b8188710e Merge pull request #1481 from Project-OSRM/fix/no-big-cc-pruning
Only activate pruning for big cc after one was found
2015-05-18 16:18:17 +02:00
Patrick Niklaus fd9bb3ac43 Only activate pruning for big cc after one was found 2015-05-18 09:41:41 +02:00
Patrick Niklaus 6d9c3bca33 Merge pull request #1478 from Project-OSRM/fix/profiles-cleanup
Cleanup the profiles
2015-05-18 00:09:45 +02:00
Patrick Niklaus dd33a45644 Revert "fix incorrect behavior when via point was on same one-way street as destination but should have been reached before, closes #1424"
This reopens #1424 but potentially fixes #1429.

This reverts commit 11c671354b.
2015-05-17 23:35:31 +02:00
Patrick Niklaus 074c7a9c40 Fix access module 2015-05-17 17:26:10 +02:00
Patrick Niklaus de2f06970d Fix missing values and activate fallback names by default 2015-05-16 14:39:49 +02:00
Patrick Niklaus 6166d946f7 Fix access tag check 2015-05-16 14:39:49 +02:00
Patrick Niklaus c778ab9622 Make bicycle profile backwards compatible 2015-05-16 14:39:49 +02:00
Patrick Niklaus aad846b968 Fix call to function and transportation if clause 2015-05-16 14:39:49 +02:00
Patrick Niklaus f04a3e3d2e Fix bicycle profile syntax 2015-05-16 14:39:49 +02:00
Patrick Niklaus 7ad52de2b1 Cleanup the profiles 2015-05-16 14:39:49 +02:00
Patrick Niklaus 0706ba9bec Merge pull request #1457 from Project-OSRM/develop-lua52
Modify profiles to use Lua 5.2+ without needing compatibility flags
2015-05-16 14:29:32 +02:00
Patrick Niklaus ed53888fce Follow symlinks 2015-05-15 15:30:41 +02:00
Lauren Budorick fd76fba235 Keep apt-get 5.1 for now 2015-05-15 15:02:23 +02:00
Patrick Niklaus 95088a785a Make using profile.lua work again.
Symbolic links are a _bad_ idea with lua script. Lua will search at the
place of the symbolic link for modules _not_ at the actual location of
the script.
2015-05-15 15:02:23 +02:00
Lauren Budorick f46b600ec0 Upgrade lua to 5.2 on travis 2015-05-15 15:02:23 +02:00
Lauren Budorick 566ab993df Use lua 5.2+ without needing compatibility flags. 2015-05-15 15:02:23 +02:00
Patrick Niklaus 407036e215 Merge pull request #1476 from Project-OSRM/fix/distance-based-radius
Use distance based search radius
2015-05-15 10:49:19 +02:00
Patrick Niklaus 7b1a5566fb Move nodes inside the search radius 2015-05-15 00:34:53 +02:00
Patrick Niklaus 1b0d8739c1 Increase max distance to 1100 to fix unrelated test cases 2015-05-15 00:34:34 +02:00
Patrick Niklaus 266feea397 Merge pull request #1465 from alex85k/develop
fix cucumber tests running on Windows
2015-05-14 22:25:52 +02:00
Patrick Niklaus c4c6ab2494 Use distance based search radius
This limits the nearest neighbour search to a maximum distance
of 1000 meters, but will also work in dense areas.
2015-05-14 22:24:07 +02:00
Emil Tin 079eea3f2b add test for route duration formats 2015-05-10 20:09:09 +02:00
alex85k a457d69034 fix cucumber tests running on Windows 2015-05-09 19:22:16 +05:00
Patrick Niklaus d0175798bf Add link to documentation in the wiki 2015-05-02 15:18:13 +02:00
Patrick Niklaus 80e07943ee Make README more meaningful 2015-05-02 01:30:44 +02:00
Will White e2954211ec Fix travis links. 2015-05-01 20:04:05 +02:00
Patrick Niklaus 337bed8176 Merge pull request #1455 from Project-OSRM/fix/cucumber2.0
upgrade to cucumber 2.0
2015-05-01 18:32:26 +02:00
Emil Tin 71197e1c89 remove last use of routing_diff 2015-04-30 18:29:56 +02:00
Emil Tin e1a13f5ce8 remove obsolete cucumber patch 2015-04-30 18:15:46 +02:00
Emil Tin 1ed2c16a51 upgrade to cucumber 2.0 2015-04-30 18:15:46 +02:00
Patrick Niklaus 12e1bd80b3 Send travis mails to me 2015-04-29 14:00:17 +02:00
Patrick Niklaus fd6daa580a Merge branch 'develop' 2015-04-22 10:34:56 +02:00
Patrick Niklaus d2a19ec8ec Merge pull request #1446 from Project-OSRM/fix/sharedmemory-default
Fix/sharedmemory default
2015-04-22 09:50:46 +02:00
Patrick Niklaus 8f3feac916 Ensure routed is backwards compatible 2015-04-22 09:49:08 +02:00
Patrick Niklaus c0e066440c Use shared memory if no server paths are provided.
This caused a bug in the node bindings that would invoke the constructor
without parameters.
2015-04-22 09:49:08 +02:00
Patrick Niklaus fbb4e9078a Updated restriction parser doc 2015-04-21 20:00:58 +02:00
Patrick Niklaus d96e90c6f4 Add documentation to ExtractionContainer 2015-04-21 20:00:58 +02:00
Patrick Niklaus 3b435d8956 Add documentation to ScriptingEnvironment 2015-04-21 20:00:58 +02:00
Patrick Niklaus 345dd2481b Add documentation to InputRestrictionContainer 2015-04-21 20:00:58 +02:00
Patrick Niklaus 006bcc0fc8 Add some documentation to the restriction parser 2015-04-21 20:00:58 +02:00
Patrick Niklaus c25d14e454 Remove unnecessary header include 2015-04-21 20:00:58 +02:00
Patrick Niklaus 5ff95dc32d Move string_map inside external_callbacks
It is not referenced outside this calls, thus the lifetime
can be safely handled by it.
2015-04-21 20:00:58 +02:00
Patrick Niklaus 34031aab1b Add further documentation to ExtractorCallbacks 2015-04-21 20:00:57 +02:00
Patrick Niklaus 3035219212 Add further documentation 2015-04-21 20:00:57 +02:00
Patrick Niklaus 8a608eb930 Add some doc to the extractor 2015-04-21 20:00:57 +02:00
Patrick Niklaus c2fc47df34 Merge branch 'develop' 2015-04-17 22:51:40 +02:00
Dennis Luxen d4065774ce Merge pull request #1440 from Project-OSRM/feature/check_graph_implementations
fix incorrect SCC generation
2015-04-17 09:50:46 +02:00
Patrick Niklaus 6d43d9f2b6 Add unit test for dynamic graph
Also simplify the unit tests.
2015-04-17 00:38:09 +02:00
Patrick Niklaus 94d7fd9112 Adapt osrm-components to new FindEdge interface 2015-04-17 00:25:01 +02:00
Patrick Niklaus 04b5833e98 Adapt EdgeBasedGraphFactory to new FindEdge behaviour 2015-04-17 00:23:58 +02:00
Patrick Niklaus 52592b84fd Add functions to find reverse edge to DynamicGraph 2015-04-17 00:22:51 +02:00
Patrick Niklaus f2cd68e3ec Return SPECIAL_EDGEID if no edge was found 2015-04-17 00:21:57 +02:00
Dennis Luxen aff590a44d make implementation of FindEdge consistent among graph implementations, introduce FindSmallestEdge() function to return the edge with smallest weight if there are multiple, fixes #1427 2015-04-16 16:12:08 +02:00
Dennis Luxen 0d432f6377 fix comparison to recognize small components in a static graph 2015-04-16 16:11:06 +02:00
Dennis Luxen 59bceee258 make sure GetNumberOfNodes() is only called once 2015-04-16 16:08:10 +02:00
Dennis Luxen 4a0a0bac1d clear right edge list after graph instantiation 2015-04-16 14:38:42 +02:00
Dennis Luxen c7bd96ea8b fix unintended signed/unsigned comparison 2015-04-16 14:31:13 +02:00
Dennis Luxen 0eb2106067 reorder includes, add tuple include 2015-04-16 14:30:52 +02:00
Dennis Luxen c03aec364c add comparison tool for graph classes 2015-04-16 11:25:43 +02:00
Patrick Niklaus f2cdb97867 Change max distance delta to 200m 2015-04-13 22:39:55 +02:00
Patrick Niklaus 727e284ed0 Reduce map beta, as it fits better to the intended sample rate 2015-04-13 22:39:55 +02:00
Patrick Niklaus 3248977e02 Update classifier parameters 2015-04-13 22:39:55 +02:00
Patrick Niklaus 7ee8776165 Remove second stage classifier: obsolete with trace splitting 2015-04-13 22:39:55 +02:00
Patrick Niklaus f89f4bd20b Add option to enable json logging 2015-04-13 22:39:55 +02:00
Patrick Niklaus a372ade7ce Mark suspicious transitions 2015-04-13 22:39:55 +02:00
Patrick Niklaus 61dca4a35e Merge pull request #1433 from Project-OSRM/feature/node-location
Make node location accessible
2015-04-13 16:53:02 +02:00
Dennis Luxen c0402345f7 Squashed 'third_party/libosmium/' changes from f074d94..8bcd4ea
8bcd4ea Add explicit cast operator from osmium::Timestamp to uint32_t.
0b24814 Fixed the full_queue_sleep_duration const (again).
5e19dd2 Try different workaround for windows...
df5d6c9 Fix build error on Windows.
1553adf Workaround for missing support for u8 string literals on Windows.
aa5e44a Do not build benchmarks in Appveyor to speed up build.
2b22b31 Remove warning generated by assert by casting to largest type.
148c5e3 Fix inclusion of our own css file into doxygen documentation.
13bce6f Split out test thats fails on Windows and do not run it on appveyor.
ca04757 Make CMake add_unit_test() function more flexible.
6c04a63 Tell CMake to output json file with compile commands.
c0dd848 Fix indentation in some tests.
dfa7e4b Formatting: Consistently use spaces around equal signs.
08fe6db Add change log, release version 2.1.0.
667192e Add XML tests.
28acfc7 Make sorting the PBF stringtables optional.
8184781 Fix PBFInputFormat. Use member variable instead of static variable.
2b48945 Fix comment.
6d37054 Rename m_done to m_quit_input_thread to clarify what it is for.
bc23083 Fix race condition in PBF reader.
7fc380e Add various docs, noexcepts, asserts, and tests.
aeaf4d7 Not a good idea to how overbroad patterns in .gitignore.
c1ef2f9 Bugfix: Multipolygon collector was accessing non-existent NodeRef.
0ef9a13 Add noexcept and docs to some functions in NodeRefList class.
da4d764 Workaround for Doxygen bug.
e67d5d9 use absolute paths to osmium in YouCompleteMe configuration
38abeac remove template parameter from NodeRefList
c47adf0 Add check that osm xml file has <osm> or <osmChange> as top-level element.
5e4af90 Updated version number to 2.0.0.
5b2bc3e Workaround in cmake test for sparsehash size.

git-subtree-dir: third_party/libosmium
git-subtree-split: 8bcd4ea771696812bbb08ebc58e3ee22d0538070
2015-04-13 15:44:38 +02:00
Dennis Luxen 9cc68b26e2 pull in latest osmcode/libosmium changes 2015-04-13 15:44:38 +02:00
Dennis Luxen 27c9230a82 pull latest mapbox/variant changes in 2015-04-13 15:37:43 +02:00
Dennis Luxen e985c9714b Squashed 'third_party/variant/' changes from 3b02ca0..bf485df
bf485df Revert "pass F (functor) by ref/const ref"
e031c53 Revert "pass by const ref in 'apply_const'"
a3014f5 pass by const ref in 'apply_const'
2e0ce4a pass F (functor) by ref/const ref
5875195 add support for 'unwrapping' std::reference_wrapper<T> and accessing std::reference_wrapper<T>::type through get<T>() + update test
c53422f remove boost variant header
5a2d5c5 add reference_wrapper test

git-subtree-dir: third_party/variant
git-subtree-split: bf485dfb59aef26f3ef2183d7c8c1111ad97062b
2015-04-13 15:37:43 +02:00
Dennis Luxen 6c5015811e do not build concurrently on Travis, also build (but not run) benchmarks 2015-04-13 14:43:35 +02:00
Dennis Luxen 86e7de4d62 Merge branch 'revert-1375-master' into develop 2015-04-13 10:07:29 +02:00
Dennis Luxen 147d35e40d Revert "added lua binding for osmium::Way::id()" 2015-04-13 10:04:23 +02:00
Dennis Luxen b76fc724fd make node id available thru Lua bindings 2015-04-13 09:58:59 +02:00
Dennis Luxen 1bfab4e279 Merge pull request #1375 from bjtaylor1/master
added lua binding for osmium::Way::id()
2015-04-13 09:52:56 +02:00
Dennis Luxen 11bdfba37e traffic signal penalty ignored on white-listed barriers, cf. #1365 2015-04-13 09:47:12 +02:00
Patrick Niklaus 405f08b807 Make node location accessible 2015-04-10 11:45:24 +02:00
Dennis Luxen 592211cecd activate __get_cpuid on all non X64 platform, fixes #1193 2015-04-07 14:45:21 +02:00
Dennis Luxen a4f31001e8 MSVC doesnt properly support the noexcept operator 2015-04-02 15:11:23 +02:00
Dennis Luxen c2deedac8b sprinkle a number of noexcepts into the code 2015-04-02 11:36:04 +02:00
Dennis Luxen 9a61f8b894 add more const keywords, avoid implicit type conversions 2015-04-02 11:27:51 +02:00
Dennis Luxen 3a291f5c8e fix escaping of double quote in JSON response, fixes #1410 and also adds a unit test for that case. 2015-04-02 10:34:40 +02:00
Dennis Luxen 559a2dcec7 move shared lib testing to distinct port on travis 2015-03-31 17:33:56 +02:00
Dennis Luxen b7f003c4aa Merge branch 'opengisch-sharedlib' into develop 2015-03-31 17:33:36 +02:00
Matthias Kuhn d11c0bbd5c Do not compile Coordinate sources directly into the OSRM library
It is already included in the COORDINATES "OBJECT" target to which the OSRM
library is linked.
This fixes the possibility to build OSRM as a shared library.
2015-03-31 16:57:41 +02:00
Matthias Kuhn c2f775fcaa Add test for building as shared library 2015-03-31 16:57:41 +02:00
Dennis Luxen 19ac831c2e remove another quoted compare 2015-03-31 12:59:56 +02:00
Dennis Luxen 23b413a398 remove quotes from string compares against variable in CMakeLists 2015-03-31 12:35:20 +02:00
Dennis Luxen 098de196e2 reactivate profiling flags for debug build 2015-03-31 11:21:36 +02:00
Dennis Luxen 27d2c31f28 add (new) fingerprint.cpp that includes the generated headers 2015-03-31 10:47:21 +02:00
Dennis Luxen c9c9edeb23 deleted: util/fingerprint.cpp.in 2015-03-31 10:46:55 +02:00
Dennis Luxen 5adf792fad fix build issue where cmake does not pick up generated output of a custom target
renamed:    ../util/fingerprint.cpp.in -> ../util/fingerprint_impl.hpp.in
2015-03-31 10:45:35 +02:00
Dennis Luxen 81af7d73a6 make FINGERPRINT a global dependency 2015-03-30 15:55:23 +02:00
Dennis Luxen 23e4e0786d also enable C as a project language 2015-03-30 13:26:06 +02:00
Dennis Luxen 0640ce9632 set project and fingerprint target language to CXX explicitly, fixes AppVeyor build. Potentially Travis, too. 2015-03-30 13:21:03 +02:00
Dennis Luxen 3e49bf4f42 add const keywords where possible 2015-03-30 13:16:22 +02:00
Dennis Luxen 66b038a010 reorder includes 2015-03-30 13:14:13 +02:00
Dennis Luxen 9bbbebf31d use empty() instead of 1>size() to make intent more clear 2015-03-30 13:13:13 +02:00
Dennis Luxen 19765cfa14 remove unneeded include 2015-03-30 13:10:03 +02:00
Dennis Luxen d6badca610 use lamda function to do complex initialization with a (wanted) side-effect 2015-03-30 13:09:10 +02:00
Dennis Luxen 6933804aa4 remove unused html en/decoding entities, we use JSON now 2015-03-30 12:40:54 +02:00
Dennis Luxen 5bed7f292f add test for printInt() sign correctness 2015-03-30 12:37:39 +02:00
Dennis Luxen f553896e2d printInt(): fix sign issue when outputting 0, use postfix in/decrement 2015-03-30 12:36:39 +02:00
Dennis Luxen 60663b5433 reorder build dependencies 2015-03-30 11:09:41 +02:00
Dennis Luxen 1851a31e66 add unit tests for functions escape_JSON, printInt and replaceAll in string_util.hpp 2015-03-27 18:15:58 +01:00
Dennis Luxen d853310bee use range-based for in escape_JSON() function 2015-03-27 18:15:13 +01:00
Dennis Luxen 11c671354b fix incorrect behavior when via point was on same one-way street as destination but should have been reached before, closes #1424 2015-03-27 12:29:29 +01:00
Dennis Luxen b15599f01e simplify logic to compute edge offset 2015-03-27 12:28:01 +01:00
Dennis Luxen 4b957abc0c fix rounding error/uncertainty on some systems 2015-03-27 12:27:15 +01:00
Dennis Luxen 8ee82d1e03 replace old-style typefs with using 2015-03-23 17:06:10 +01:00
Dennis Luxen 5565662d87 fix compilation with CMake 3.2, closes #1422
CMake 3.2 changed the behavior of add_custom_command and ungenerated dependencies. Replaced with add_custom_target that works on version 2.8+
2015-03-23 16:14:24 +01:00
Patrick Niklaus 78735fae6b Fix match test by using the new threshold 2015-03-18 00:21:04 +01:00
Patrick Niklaus d3b9911445 Fix match geometry output 2015-03-17 23:50:59 +01:00
Patrick Niklaus 7813dafc96 Increase the time split threshold to a more reasonable value 2015-03-17 23:50:47 +01:00
Patrick Niklaus 02b561edd2 Pass route leg by reference, not by value 2015-03-17 23:24:31 +01:00
Dennis Luxen 272a1fda54 Merge pull request #1407 from Project-OSRM/feature/matching
Map Matching
2015-03-10 06:08:11 -07:00
Patrick Niklaus bc8666df83 Add tests for matching 2015-03-08 01:32:13 +01:00
Patrick Niklaus 028fad94af Fix overflows when handling size_t 2015-03-08 00:53:15 +01:00
Patrick Niklaus 0c735953c9 Make uturn detection a little less sensitive. 2015-03-08 00:51:07 +01:00
Patrick Niklaus 736bc87480 Fix inverted operator in maximum check 2015-03-07 23:02:14 +01:00
Dennis Luxen dd94a64048 remove lint from #1409
- fix copyright header
- remove dead code
2015-03-05 14:03:35 +01:00
Dennis Luxen cf9f88f8ce Merge pull request #1409 from RockLobster/develop
FIX: Moved the GeometryCompressor's free_list_maximum into a member variable of the class.
2015-03-05 14:02:34 +01:00
RockLobster 5694aeda5f FIX:
Moved the GeometryCompressor's free_list_maximum into a member variable of the class.
(+UniqueNumber() commented out since it is not being used anywhere in all of OSRM)

There was absolutely no need for free_list_maximum to be a static variable and it caused major issues in my code.
Short description:
- I ran osrm-prepare's Prepare().Process(..) function in my own code multiple times for multiple files
	=> After the first file is done, free_list_maximum is still on the same size, but a new GeometryCompressor will start at a size of 100 again.
	=> Indices broken.
2015-03-05 11:30:52 +01:00
Patrick Niklaus 7829e3c132 Add step definition and support code for matching 2015-03-05 00:12:26 +01:00
Dennis Luxen 2ce0d60db1 Squashed 'third_party/libosmium/' changes from 6522da5..f074d94
f074d94 Use shorter path names in Doxygen doc.
5117d5a Make Doxygen-generated HTML docs work better on small screens.
41607ac Appveyor config: Use lowercase command names everywhere. Filter 7z output.
9e77a39 Remove debug output.
3416c4b Revert "Comment out test to see if there are dependencies between tests."
fa49dde Comment out test to see if there are dependencies between tests.
5add75d Fix typo in appveyor conf: nul.
53b3778 Use different file names for tests.
1091c0b Fix Windows munmap() to return the same as the posix one.
14fdc4e Revert "CMake: Remove unneeded build type setting."
0270087 Workaround for MSVC.
56c2120 Another try...
8e96a6f Trying to fix test on Windows...
11a64c2 CMake workaround: Set CMAKE_CONFIGURATION_TYPES before project(). As per http://www.cmake.org/pipermail/cmake/2012-January/048856.html
3847e7a CMake: Remove unneeded build type setting.
a1bcaf1 CMake: Make CMAKE_CONFIGURATION_TYPES a cache variable.
ddab3e3 Create test file in test_typed_mmap in current dir instead of tmp.
ce1d3bd Build "RelWithDebInfo" on appveyor instead of "Release".
b6db34f Add README showing source of FindGem.cmake.
2c86c55 Better error message and some comments in CMake for sparsetable check.
b16a5a3 Fix ctest on Windows.
2203bc8 Fix FindGem.cmake.
5d1f81d Another try to fix travis build.
ddd3f5e Hopefully fix problem where travis doesn't find osm-testdata.
0e673ea More debug output to find travis problem.
eb01107 Updated data-tests README.
8a971c8 Remove special case of the multipolygon test in travis/appveyor config.
dce792c CMake: Check dependencies of multipolygon test and run as CMake script.
b967677 Add tests for thread pool.
400e9b3 Bugfix: Handle exception in one pool threads properly.
a1ba489 More detailed error reporting from zlib.
95cf621 Disable SparseMemTable if sparsetable size_type is smaller than 8.
7b601b5 Add missing overload to cast_with_assert() function.
60a7d86 Giving up on trying to remove LNK4221 warning.
35ed5df Try another way to get rid of MSV warning...
f9c7d92 Disable a warning about changed behaviour on MSVC.
c3c6b2d CTest: Only output failed tests.
9c99996 Try setting option in a different way for getting rid of LNK4221 on MSVC.
4ac563c Another ssize_t fix for Windows.
11db84f Fix mmap for windows. Convert macro to function.
95d8f75 Fix test on Windows (which doesn't have ssize_t).
df51aa4 Do not write huge files in one system call.
9c4f772 Change mmap() implementation for Windows.
5be817c Rewrote function to work on Windows without warnings.
ea84f73 Fix warnings on Windows.
572d692 Fixed the static_cast_with_assert function and added tests.
89ef86b Use SparseMemArray instead of SparseMemTable in examples.

git-subtree-dir: third_party/libosmium
git-subtree-split: f074d949a5585a81578d682035f2163de971beb3
2015-03-04 12:50:42 +01:00
Dennis Luxen 68e66dad06 upgrade libosmium dependency 2015-03-04 12:50:42 +01:00
Dennis Luxen 80db907857 upgrade variant dependency 2015-03-04 12:48:19 +01:00
Dennis Luxen 76674a3594 Squashed 'third_party/variant/' changes from 24dcab2..3b02ca0
3b02ca0 add which() method returning zero based index of stored T in Types... for boost::variant() compatibility
c117592 update unit test to match c64c74775a80474f2012c1a49ab2865e3666107a
36f1e12 add get<T>() overloads for when T is stored in recursive_wrapper<T> also makes get<T>() a compile time error where T is not in Types... (ref #24)
7dfdfa2 clean up coverage files in test directory too [skip ci]
89f8a41 add coverage report

git-subtree-dir: third_party/variant
git-subtree-split: 3b02ca0e3ab1a36dd6ec9138e7f93eb3176ae5f7
2015-03-04 12:48:18 +01:00
Patrick Niklaus 98dba11c5e Address some of the remaining issues of the code review 2015-03-04 01:34:45 +01:00
Dennis Luxen de261d28ef add override specifier 2015-03-03 18:26:38 +01:00
Dennis Luxen d43716612b several copyedits to brush up code
- remove unneeded includes
- replace size() <==> 0 comparisions with calls to empty()
- use fp instead of integer literals
- use range-based for loops with integer ranges
- add a couple of consts
2015-03-03 18:17:12 +01:00
Dennis Luxen cfaacf7cb2 put util/compute_angle.cpp into OBJECT library to avoid repetetive compiles 2015-03-03 17:58:17 +01:00
Dennis Luxen b9922bc90b replace C-style comments 2015-03-03 17:43:37 +01:00
Dennis Luxen 31cae8f05f several copy edits to brush up the code
- fix copyright header
- rename probabilityDensityFunction -> density_function
- use double-precision fp literal to indicate intent
- remove redundant enum class start value
- replace C-style comments with C++ style
- make functions const
2015-03-03 17:42:07 +01:00
Dennis Luxen 133e382aae remove constexpr qualifier as numeric_limits is not yet constexpr on MSVC compiler 2015-03-03 14:43:38 +01:00
Dennis Luxen e02c721c2b further untangle model from functionality and put classes into seperate headers
- move get_network_distance() into routing base class
- don't reallocate queues every time but clear them. Should be cheaper
2015-03-03 14:22:52 +01:00
Dennis Luxen 5af0ceb2d2 use range based for loop 2015-03-03 14:22:27 +01:00
Dennis Luxen 6460fdc62b use std::size_t for timestamps to avoid implicit casts, use range-based for loops 2015-03-03 13:03:00 +01:00
Dennis Luxen 402ca780bf fix test expectation osrm-routed help output 2015-03-03 12:56:37 +01:00
Dennis Luxen 643ab92cd2 fix default value for max_locations_map_matching 2015-03-03 12:55:42 +01:00
Dennis Luxen a9c3b343fc separate model and computation in HMM matching 2015-03-03 12:48:33 +01:00
Dennis Luxen 592bebaf29 renamed: plugins/map_matching.hpp -> plugins/match.hpp to avoid confusion with routing_algorithms/map_matching.hpp 2015-03-03 12:01:40 +01:00
Dennis Luxen 4df215e674 replace -std::numeric_limits<T>::max() with ::lowest() 2015-03-03 11:53:31 +01:00
Dennis Luxen 91792f45ea fix compilation
- missing new 10th parameter to GenerateServerProgramOptions
2015-03-03 11:50:37 +01:00
Dennis Luxen 20091e94c8 fix compilation
- remove wrong comments
- fix include guard footer
- add curly braces
- add template specialization for std::vector<bool> in make_array
- reformat
2015-03-03 11:50:02 +01:00
Dennis Luxen 76aa494be4 fix compilation
- std::log and M_PI are not constexpr's by the standard. replace by a constant
- reformat
2015-03-03 11:48:15 +01:00
Dennis Luxen 6fb8fdc2bd fix compilation
- define max_number_of_candidates where its used
- add curly braces
- reformat
2015-03-03 11:46:24 +01:00
Patrick Niklaus 0d879ed290 Split trace if timestamp delta is over threshold
Even when matching is not broken we split the trace, if the
sampling frequency goes below 2 samples/minute.
2015-03-03 00:48:57 +01:00
Patrick Niklaus d8d46e0f3e Add routed parameter to limit matching size 2015-03-03 00:48:57 +01:00
Patrick Niklaus e5830b0116 Add parameters for map matching 2015-03-03 00:48:57 +01:00
Patrick Niklaus d89b171f49 Simplify json code in map matching plugin 2015-03-03 00:48:57 +01:00
Patrick Niklaus a760aec791 Add json logger to map_matching
This adds additional data to the json response, when OSRM is compiled
in debug mode.
2015-03-03 00:48:57 +01:00
Patrick Niklaus 34d5d353af Apply clang-format and split out json_util 2015-03-03 00:48:57 +01:00
Patrick Niklaus e8e637c4f2 Replace descriptor code with code that generates only geometry 2015-03-03 00:48:57 +01:00
Patrick Niklaus adbca39fef Fix include guard 2015-03-03 00:48:57 +01:00
Dennis Luxen a2c88b607f lint corrections
- fix license header
- let shared_ptr autodestruct as it's shared
- rename fences to resemble file names
- reorder includes into lexicographic order
2015-03-03 00:48:57 +01:00
Patrick Niklaus 2115a67d24 Link libOSRM with compute_angle 2015-03-03 00:48:57 +01:00
Patrick Niklaus dec73b02e9 Rename traces to matchings in response 2015-03-03 00:48:57 +01:00
Patrick Niklaus 0e6ed53cee Adapt to JSON container rename 2015-03-03 00:48:57 +01:00
Patrick Niklaus fd6c70afe1 Fix regression in sub-matching length check 2015-03-03 00:48:57 +01:00
Patrick Niklaus c4f193b13e Fix comment 2015-03-03 00:48:57 +01:00
Patrick Niklaus 70703c39f3 Add timestamp parameters and reset to beginning of breakage 2015-03-03 00:48:57 +01:00
Patrick Niklaus d429485f0c Fix stupid error in backtracking 2015-03-03 00:48:57 +01:00
Patrick Niklaus 89460dd39c Return indices instead of points 2015-03-03 00:48:57 +01:00
Patrick Niklaus f46b259384 Fix splitting traces 2015-03-03 00:48:56 +01:00
Patrick Niklaus fb0ce48f2f Simplify matching response 2015-03-03 00:48:56 +01:00
Patrick Niklaus cb4a81008c Split traces into subtraces 2015-03-03 00:48:56 +01:00
Patrick Niklaus d620da365e Implement more general pruning 2015-03-03 00:48:56 +01:00
Patrick Niklaus 0c3102721c Make number of candidates a parameter 2015-03-03 00:48:56 +01:00
Patrick Niklaus b3fa03043d Calculate the real route length for classification 2015-03-03 00:48:56 +01:00
Patrick Niklaus 38d7db49c8 Add state position to debug output 2015-03-03 00:48:56 +01:00
Patrick Niklaus 1a8c832039 Update format of debug json ouput 2015-03-03 00:48:56 +01:00
Patrick Niklaus 6e54f8cfa6 Tighter threshold on low probability transistions 2015-03-03 00:48:56 +01:00
Patrick Niklaus 4838ffb82d Fix nan values if matched to single point 2015-03-03 00:48:56 +01:00
Patrick Niklaus 1bcf41d382 Prune low probability transitions 2015-03-03 00:48:56 +01:00
Patrick Niklaus e381566494 Eliminate branch 2015-03-03 00:48:56 +01:00
Patrick Niklaus 66d7a073d3 Move splitting candidates to plugin 2015-03-03 00:48:56 +01:00
Patrick Niklaus 0637215b85 Skip computing viterbi if viterbi of previous state is lower than lower bound
This causes a speedup of 300%.
2015-03-03 00:48:56 +01:00
Patrick Niklaus dc1405ffa8 Fix typo in debugging code 2015-03-03 00:48:56 +01:00
Patrick Niklaus 0fce20c503 Directly compute log probabilities 2015-03-03 00:48:56 +01:00
Patrick Niklaus 1b16dd126b Actually compute and transmit confidence in the response 2015-03-03 00:48:56 +01:00
Patrick Niklaus fe07f9208c Add bayes classifier 2015-03-03 00:48:56 +01:00
Patrick Niklaus f092fc3fc6 Fix minimum number of candidates 2015-03-03 00:48:56 +01:00
Patrick Niklaus b5228dcda0 Detect possible uturns in the data.
To make them work, we have to disable PhantomNode splitting
for this coordinates.
2015-03-03 00:48:56 +01:00
Patrick Niklaus a5db3ea25b Print warning when more than 10 points are removed 2015-03-03 00:48:56 +01:00
Patrick Niklaus 173fad2362 Return error when less than 2 points left. 2015-03-03 00:48:55 +01:00
Patrick Niklaus 496338d84d Implemented pruning and breakage detection 2015-03-03 00:48:55 +01:00
Patrick Niklaus 59727a6967 Get all nodes in dense areas but make sure we don't underflow in sparse ones 2015-03-03 00:48:55 +01:00
Patrick Niklaus 3a5e41ed91 Implement missing matching pieces 2015-03-03 00:48:55 +01:00
Dennis Luxen 2259bce05f Add skeleton code for matching 2015-03-03 00:48:55 +01:00
Dennis Luxen 7e00a86bb4 implement ISO 8601 durations parsing, cf. #1399 2015-03-02 17:18:52 +01:00
Dennis Luxen 73a2a938b4 use CRTP instead of virtual functions in routing plugins 2015-03-02 11:55:55 +01:00
Dennis Luxen c2098938f5 add convenience variadic template function to append elements to a container 2015-02-27 13:52:58 +01:00
Dennis Luxen 773ff182ee fix license header 2015-02-26 18:54:13 +01:00
Dennis Luxen 878c49e4e1 fix incomplete implementation of movable bridges in bike profiles, plenty of regressions 2015-02-26 17:17:43 +01:00
Dennis Luxen 023dd3e880 fix regression in bike profile 2015-02-26 16:44:26 +01:00
Dennis Luxen 6b88856c16 add support for movable bridges in the biking profile, cf #1399 2015-02-26 16:28:04 +01:00
Dennis Luxen dd5f926077 respect capacity:car for movable bridges in car profile 2015-02-26 16:22:18 +01:00
Dennis Luxen 845020b0e2 remove debug output 2015-02-26 16:17:42 +01:00
Dennis Luxen 7cf363eb06 reorder includes, fixes style regression from commit fdf2e59. 2015-02-26 16:09:48 +01:00
Dennis Luxen f67e670621 Merge pull request #1400 from Project-OSRM/feature/bridge_movable
add movable bridge support to the car profile. Implements #1399
2015-02-26 15:58:30 +01:00
Dennis Luxen 645e3ccbb3 add movable bridge support to the car profile. Implements #1399 2015-02-26 14:56:01 +01:00
Dennis Luxen ab385f2bf5 Merge pull request #1396 from RockLobster/develop
Small change in order to be able to use OSRM as submodule in other projects
2015-02-26 11:07:24 +01:00
Dennis Luxen 5080b9a82b Merge pull request #1397 from Project-OSRM/escape-fix
JSON string escape fix
2015-02-26 11:05:59 +01:00
Dennis Luxen 51e42ded44 - output only get escaped when actually output. Better seperation of functionality
- refactor facade::GetEscapeName() into get_name_for_id() call that is implemented in subclasses
- remove dead code
- fix failing tests where names got double-escaped
- fixes https://github.com/Project-OSRM/node-osrm/issues/83
2015-02-26 10:11:33 +01:00
Dennis Luxen 37fb89c691 add size() call to integer range 2015-02-26 10:10:19 +01:00
Patrick Niklaus 440eda3807 Escape string in json renderer 2015-02-25 21:11:02 +01:00
RockLobster bad2576397 Replaced CMAKE_SOURCE_DIR in osrm root dir's cmake file with CMAKE_CURRENT_SOURCE_DIR
=> Allows osrm to be used as a subproject aswell
2015-02-25 18:25:03 +01:00
Patrick Niklaus fdf2e5934d Add algorithm include for any_of 2015-02-24 20:29:43 +01:00
Dennis Luxen 3da1e8598b fix copyright year 2015-02-24 14:36:38 +01:00
Dennis Luxen 0296c767bf fix code-format regression 2015-02-24 09:08:59 +01:00
Dennis Luxen c215c42289 Merge pull request #1390 from Project-OSRM/feature/width_penalty
implements a penalty for very narrow roads
2015-02-24 08:56:11 +01:00
Dennis Luxen 8adab95973 refactor iterator range utility class 2015-02-20 11:59:03 +01:00
Dennis Luxen b89c7580e6 implement scaling for narrow roads as an alternative expected speed and take the minimum. Follows @emiltin's idea. 2015-02-20 10:33:14 +01:00
Dennis Luxen a85fe2cb08 remove debug output, thx @emiltin 2015-02-20 10:33:14 +01:00
Dennis Luxen 4c4c126361 implements a penalty for very narrow road:
- implements discussion of #1388
- implements basic test cases
2015-02-20 10:33:14 +01:00
Patrick Niklaus e9e12b88f8 Add CORS Content-Type HTTP header flag
Firefox needs this for JSON.
2015-02-20 00:36:36 +01:00
Dennis Luxen dc08c516bf use std::tie() to simplify lexicographic comparisons 2015-02-19 19:15:16 +01:00
Patrick Niklaus 9b1f108051 Allow CORS requests in osrm-routed. 2015-02-19 10:42:45 +01:00
Dennis Luxen b0f9a0feb4 rename variable name to be a little more telling 2015-02-19 10:11:49 +01:00
Dennis Luxen 3bd27ae8c5 change copyright line from personal names to project 2015-02-19 09:19:51 +01:00
Dennis Luxen 79b9bdf7ce rename JSON namespace to osrm::json to avoid namespace clash with V8 2015-02-18 17:27:31 +01:00
Dennis Luxen 9e09168597 un-lint CMakeLists.txt 2015-02-16 14:18:04 +01:00
Dennis Luxen e5f12347bd simplify code by using new phantom node ctor 2015-02-13 14:26:19 +01:00
Dennis Luxen 86d3556c6d add ctor that converts from rtree segment to phantom node 2015-02-13 14:24:05 +01:00
Dennis Luxen 45838b33b7 avoid implicit conversion to int 2015-02-12 15:40:55 +01:00
Dennis Luxen a1d4798ded refactor AlternativePathRouting step to have the same interface semantics regardless of search direction 2015-02-12 15:03:53 +01:00
Dennis Luxen 25c52b7482 rewrite sort/unique function to be more generic 2015-02-12 15:02:16 +01:00
Dennis Luxen fcf9f266ad Merge pull request #1381 from neilbu/develop
Made the request parser a member of the Connection
2015-02-12 14:26:48 +01:00
Neil Buckman fa638ae3a0 Removed debug logging 2015-02-12 09:55:13 +00:00
Neil Buckman 6d9cd504a0 Made the request parser a member of the Connection
Previously, the request parser was created on demand...but this could
cause requests to be flagged as bad requests if the string length was
large enough to cause the string to be split up into chunks by boost's
read_some method.
2015-02-12 08:01:46 +00:00
Dennis Luxen f9e9bb8870 update slack channel 2015-02-11 13:22:18 +01:00
Dennis Luxen 85ab2425a8 move travis notifications to slack 2015-02-11 11:47:25 +01:00
Dennis Luxen 9931155c68 port make_unique from libcxx 2015-02-10 18:02:23 +01:00
Dennis Luxen 56b6d928b6 add include to be self-sufficient 2015-02-10 12:34:13 +01:00
Dennis Luxen b865bea482 fix floating point comparison, remove superflous inline keywords 2015-02-10 12:29:52 +01:00
Dennis Luxen b6314e0c73 remove unnecessary casts in debug build 2015-02-10 12:27:27 +01:00
Dennis Luxen 2c773750c7 fix const correctness 2015-02-10 12:26:57 +01:00
Dennis Luxen 539b9be1d3 fix warning: use of old-style cast 2015-02-10 12:12:05 +01:00
Dennis Luxen 00e8caa0e3 fix signed/unsigned comparisons and casts 2015-02-10 12:08:17 +01:00
Dennis Luxen 1ff8b62bf5 fix warning: extra ';' after member function definition 2015-02-10 12:03:23 +01:00
Dennis Luxen 25fb985af8 fix warning: use of old-style cast 2015-02-10 12:02:13 +01:00
Dennis Luxen 858245db7d fix warning: implicit signed/unsigned warning 2015-02-10 11:58:56 +01:00
Dennis Luxen 09bea2ad5b fix warning: implicit float/double cast 2015-02-10 11:32:39 +01:00
Dennis Luxen adb520ec2a fix old-style casts 2015-02-10 11:31:36 +01:00
Dennis Luxen 5a1ff4b50d fix warning: implicit conversion changes signedness: 'int' to 'unsigned int' 2015-02-10 11:09:51 +01:00
Dennis Luxen e0f8acf733 make constant a float to avoid implicit cast 2015-02-10 11:04:49 +01:00
Dennis Luxen a81542eeee add virtual keyword to functions with override final specifiers 2015-02-10 10:07:35 +01:00
Dennis Luxen f67eeb66aa untangle includes using iwyu 2015-02-09 17:38:40 +01:00
Dennis Luxen 884c998622 Squashed 'third_party/variant/' content from commit 24dcab2
git-subtree-dir: third_party/variant
git-subtree-split: 24dcab23c4f70e54838e4a32a228aba8045ae17b
2015-02-09 15:19:35 +01:00
Dennis Luxen 88c8d73a94 Merge commit '884c9986229d4228374959265905cfd7b7c90c08' as 'third_party/variant' 2015-02-09 15:19:35 +01:00
Dennis Luxen 86576768d1 remove manually add variant dir 2015-02-09 15:19:19 +01:00
Dennis Luxen 3327c32b20 remove useless parantheses 2015-02-09 14:09:09 +01:00
Dennis Luxen 97ed6a3a4e remove method stubs 2015-02-09 14:06:14 +01:00
Dennis Luxen 85d8e0ac2c minor reformat 2015-02-09 09:21:44 +01:00
Dennis Luxen 2a68f9f532 rename variable name 2015-02-06 11:58:41 +01:00
Dennis Luxen b55d35c7bb remove a number of useless parentheses 2015-02-06 09:54:34 +01:00
Dennis Luxen 98f85d7728 remove some lint in variable names 2015-02-05 18:33:21 +01:00
Dennis Luxen 328a7caf61 rename short variable names to be more telling 2015-02-05 17:54:32 +01:00
Dennis Luxen 275ea9b0bb mark GetTravelModeForEdgeID as override final 2015-02-05 15:20:15 +01:00
Dennis Luxen bb78bc8fe3 Squashed 'third_party/libosmium/' changes from 910f8f1..6522da5
6522da5 Merge pull request #79 from DennisOSRM/master
7c8d8dc add override keyword to close(), overridden function in include/osmium/io/detail/input_format.hpp
d24841e Changes copyright dates in all files to a consistent "2013-2015".
3adc7d7 Another try to make it compile on Windows.
20dad8e Use auto instead of hard-coded types, hopefully fixes Windows build.
b73ab3f Set build config in appveyor ctest call.
3e33857 Merge pull request #76 from BergWerkGIS/master
c78ca6e Merge remote-tracking branch 'upstream/master'
cf42013 enable test again
69e4a91 include compatibility.h
6f79b5c CMake: Remove Dart include, it seems to be superfluous.
4d40a18 Explicitly set copy constructors etc. for OutputIterator and test it.
69ee34c Run tests in build directory instead of source directory.
11c44c8 Fix typo.
675cc11 Fix formatting CMake config.
7aa3cb0 Add a benchmark counting amenity=post_box tags.
89fd942 Make it more evident that we handling constant tag lists.
c72bbdf Add count() and empty() functions to Filter class.
88b9543 Disable annoying warnings from YouCompleteMe.
6cec403 Benchmarks: Only find files, not directories etc. in data dir.
09c4630 Follow redirects in benchmark download script.
a8a552e Use Approx() function from Catch framework for floating point comparisons.
7db5086 Reorder data tests so fast tests run first.
24ce403 Fix #includes.
ad9515c Add some comments in different config files to explain what they are.
987aa9c Some README updates.
3c18de7 Add configuration for YouCompleteMe Vim plugin.
433148e Explicit comparison against 0 to avoid warning with MSVC.
e64a459 Small updates in benchmarks README.
e4aff7f Add benchmark to compare static vs. dynamic index maps.
f702634 Add missing include.
95a8c3b Merge branch 'master' of github.com:osmcode/libosmium
560a2ae Merge pull request #73 from osmcode/travis-fix
f41e4ca remove incorrect cd
f826107 Add some helper functions for working with entity_bits.
8fec1c1 Updated README: Lots of documentation is now on wiki.
6110cc8 Make cmake config work if no components are given.
8136557 Use 'Libosmium' instead of 'Osmium' as project name in doc.
10e631a Improved documenation: Dependencies to link with.
41d0ca4 Merge remote-tracking branch 'upstream/master'
6768026 SLN configuration is always 'Release'
5d985cf av: show env vars.
272ac88 don't use '%CONFIGURATION%' expands to e.g. 'Dev|x86'
59b15eb use cmake 3.1.0 again. old cmake on AppVeyor doesn't know yet about VS2014 SLN
0d0d71a try building with VS, Dev works only with VS at least locally
2fe6d02 name of geos.lib changed
fc4662e test latest binary package
d4a265f Add more labels to tests.
8722a3d Only check for valgrind if testing is enabled.
cf7dc56 README improvements.
13a426e Fix cpack configuration.
ae649c8 travis build: fix double install of make package
c102040 Move cmake config for documentation into doc directory.
6064d55 Also list advanced cmake variables in travis build.
c299bfa constexprt workaround for MSVC.
afcf7a1 Cleanup/formatting of cmake config.
a536720 Fix travis build by cloning osm-testdata in the right place.
2bdbf7f cmake: Don't clone osm-testdata repository any more.
5bdbb28 Rename test/osm-testdata to test/data-tests.
0ad0020 cmake: build data tests only by default on Dev builds
2cefa50 Add some benchmarks.
3fdb6e1 Remove outdated make_osmium_project.sh script.
aca58ac Fix cmake config: overwriting of variables.
152e318 Fix compilation of examples that need wingetopt on Windows.
ae17cd0 Remove superfluous warning on Windows for header test builds.
f88d4c2 Switch to /W3 on Windows.
8edeba5 Remove duplicate copy constructor.
cdb474e Cleanup examples cmake config
ca9045a Cmake cleanup.
501eb61 Update to new version of catch unit test framework.
0646d6c Parenthesize expression to make test clearer and avoid warnings.
dfdaeae Disable a warning that gdal throws on Windows.
eacfe4f Explicitly test int !=0 to convert to bool.
b3ba693 Cleanup of cmake config (mostly warning options Linux vs. Win)
3f5cb81 Appveyor: Also show advanced cmake variables.
b544bd9 Never return valid but empty buffer from Reader.read() call.
a34bb5d Declare var in a more local scope.
b83e5f1 Merge pull request #66 from BergWerkGIS/master
04ef1b2 Last try for today, should solve geos test failures
a749d6c hey AppVeyor: what's going on?
73131fb av: boost not found?? show directory tree
5e02886 av: should solve most "***Exception: Other" except for geos.dll related problem. should solve projection test fails.
a7ae560 FlexReader now takes location handler as parameter.
6f1bd8d Disable non-existing Debian build in Makefile.
3d75178 Change warning level on MSVC.
3f0abc0 Appveyor: List cached variables from cmake.
d1e1e9f Travis/Appveyor build in Dev and Release mode. Call ctest on Appveyor.
116bcc9 Fix default node location store.
dedfe0e Make classes we submit to queue properly copyable.
8a432c9 Try the same ugly hack on OPLOutputBlock.
9c5b314 Try a hack to see whether it works on MSVC.
9592132 Give XMLOutputBlock a copy constructor.
991f91a Disable warning C4715: "not all control paths return a value"
340a4d7 Fix copy constructor.
7ceae00 Give OPLOutputBlock a copy constructor which basically does a move.
e82951a Use rvalue as paremeter for queue submit function.
54a9cec Use explicit cast to double to silence warning.
7c5d04c Simplified use of ogr includes.
43fd388 Use appveyor supplied cmake.
ce4311e cmake cleanup.
1108517 Disable warnings from MSVC in OGR headers.
2fe820c Harmonize signature of virtual member function dump_as_list().
93c31b4 Parenthesize string in pragma message.
54ae1a0 Explicitly int to bool conversion to silence warning on MSVC.
4bde9b7 Formatting: Use spaces instead of tabs.
7224d84 cmake: Don't try to set C++ version with -std= with MSVC.
53fbcfd Remove trailing semikolon (which gcc doesn't like).
3b0c9ed Removed command that doesn't work on older cmakes.
de6cc78 Merge pull request #62 from BergWerkGIS/master
9126530 Use less warning options on Windows.
6ec79fb Silence unknown pragma warning on Windows.
b611589 Add static_cast to silence warning on windows.
18e54e9 remove call to build2.bat
b0d9d28 try again with -DCMAKE_BUILD_TYPE=Release
b495018 usage installed cmake, -DCMAKE_BUILD_TYPE=Dev
5bac95d Merge remote-tracking branch 'upstream/master'
d41ea31 cmake: Do not use -Werror when using MSVC compiler
04cfe00 Provide convenience include file to include all index maps.
72fbaa7 Rename multimap indexes according to new schema.
af49a27 Make registering index map types easier.
0a35701 av: remove debug echo calls
886c15f av: ditch -DCMAKE_BUILD_TYPE=Dev
ad0a629 The great renaming of map index classes.
97b4d34 av: try again
bf243b2 Move some hpp files into detail directory and fix include guards.
64e4841 av: try again calling cmake directly
1700789 Add way to dynamically choose node location index.
da49b7f av: try again with build2.bat
4bf55f5 is appveyor working again?
5e63433 delete ws_32.lib patch. generate makefile instead of VS
1054016 Merge remote-tracking branch 'upstream/master'
8c198fc av: try even newer cmake
7cccb06 av: maybe newer cmake helps
d04967a av: no existing env var was still there
80763c6 av: no build.bat, call cmake directly
3b58fc6 av: no cmds over spanning serveral lines?
33c09a0 CALL bat
34639c6 maybe double quotes?
72572de explicitly call VS2014 cmd prompt
6955e87 1st try on AppVeyor

git-subtree-dir: third_party/libosmium
git-subtree-split: 6522da53748e12379bbfaf70ad29ee7bd98ef02d
2015-02-05 15:13:48 +01:00
Dennis Luxen 10224a692b Merge commit 'bb78bc8fe305eef39ca0a5d5e9dedc466f803dfb' into develop 2015-02-05 15:13:48 +01:00
Dennis Luxen 3eb83d0737 add override final specifier to GetTravelMode function in facades 2015-02-05 14:58:07 +01:00
Dennis Luxen f35fa0049c reformat cherry-picked commit 2015-02-05 11:54:30 +01:00
Ben d77a88c21e added lua binding for osmium::Way::id()
Conflicts:
	extractor/scripting_environment.cpp
2015-02-05 11:54:07 +01:00
Dennis Luxen 3d55622237 search quietly for OpenMP 2015-02-05 11:37:55 +01:00
Dennis Luxen bf76465029 use C++11s std::hypot() instead of hand-rolled code 2015-02-05 11:22:46 +01:00
Ben 129a6ed99e added lua binding for osmium::Way::id() 2015-02-04 19:36:39 +00:00
Dennis Luxen 9f5fc4ab0c reorder includes 2015-01-31 21:17:16 +01:00
Dennis Luxen 97f6468663 yet another try to unhack libgomp linking: use OpenMP binding if and only if present 2015-01-29 17:29:03 +01:00
Dennis Luxen a883b73981 add explicit cmake checking step for libgomp 2015-01-29 17:01:08 +01:00
Dennis Luxen 36aadc21a7 fix names of fwd declarations 2015-01-29 16:48:59 +01:00
Dennis Luxen da469911d3 always link against libgomp 2015-01-29 16:23:04 +01:00
Dennis Luxen 4195b0d0e6 Merge pull request #1364 from Project-OSRM/feature/check_libgomp
check if stxxl compiles with or without libgomp, fixes #1361
2015-01-29 12:54:27 +01:00
Dennis Luxen d241aef502 fix checking for successful compilation of stxxl with OpenMP 2015-01-29 12:52:54 +01:00
Dennis Luxen 8b2ca6b13d check if stxxl compiles with or without libgomp, fixes #1361 2015-01-29 12:52:54 +01:00
Dennis Luxen ade94c87b5 remove constexpr keyword that MSVC2013CTP isnt able to handle 2015-01-29 12:50:06 +01:00
Dennis Luxen 46f3426c35 remove Http dir 2015-01-28 12:40:42 +01:00
Dennis Luxen 3503cd9b71 remove another windows directory from ignored files/dirs 2015-01-28 12:35:52 +01:00
Dennis Luxen 73cc040792 add new lower case files and directories to .gitignore 2015-01-28 12:32:09 +01:00
Dennis Luxen 6c6029618a remove left-over directories from the renaming spree 2015-01-28 12:30:14 +01:00
Dennis Luxen 2a8084b6c6 clean up derived classed and their functions to correctly use final keyword:
functions marked as final need to be marked virtual. use override specifier to do so
2015-01-28 12:03:21 +01:00
Dennis Luxen 86ca9bd0f9 mark simple logger write function as noexcept. 2015-01-28 10:09:46 +01:00
Dennis Luxen b192678abf add dummy case to switch statement. reflects all cases are covered and should shut up compiler warnings 2015-01-27 18:44:06 +01:00
Dennis Luxen 9a998d7b41 rename short variable name to be more telling 2015-01-27 18:40:01 +01:00
Dennis Luxen 64a6859753 reduce number of old-style casts 2015-01-27 18:37:52 +01:00
Dennis Luxen b20b7e65bf renamed: Util/* -> util/* 2015-01-27 17:47:23 +01:00
Dennis Luxen 203e3ef077 fix test after header file rename 2015-01-27 17:16:50 +01:00
Dennis Luxen 7be5502a12 renamed: Util/BoostFileSystemFix.h -> Util/boost_filesystem_2_fix.hpp
renamed:    Util/TrigonometryTables.h -> Util/trigonometry_table.hpp
2015-01-27 17:14:03 +01:00
Dennis Luxen 0de6e4ccbb renamed: Util/DataStoreOptions.h -> Util/datastore_options.hpp
renamed:    Util/ProgramOptions.h -> Util/routed_options.hpp
2015-01-27 17:06:10 +01:00
Dennis Luxen c8041bacd6 renamed: Util/IniFileUtil.h -> Util/ini_file.hpp 2015-01-27 16:57:50 +01:00
Dennis Luxen 1187f83ffd renamed: Library/*.h -> library/*.hpp 2015-01-27 16:35:19 +01:00
Dennis Luxen dd3b8469dd renamed: Include/* include/* 2015-01-27 13:17:18 +01:00
Dennis Luxen 34bbd7dcaa renaming yet another variable to fix gcc name lookup 2015-01-27 13:11:04 +01:00
Dennis Luxen 8318b3ba83 rename variable to be more telling that it's not a type but a variable 2015-01-27 13:01:33 +01:00
Dennis Luxen 6768ecc3fc rename variable to make name lookup not fail on gcc 2015-01-27 12:52:55 +01:00
Dennis Luxen 9672f00ec3 renamed: Server/*/*.h -> server/*/*.hpp 2015-01-27 12:35:29 +01:00
Dennis Luxen 0c1101739d renamed: Server/DataStructures/*.h -> Server/data_structures/*.hpp 2015-01-27 12:14:08 +01:00
Dennis Luxen 872cb2d9c8 rename string literal names to replace odd camel case 2015-01-27 11:52:56 +01:00
Dennis Luxen 3e47fe54fa refactor Server/Http to remove camel case 2015-01-27 11:45:33 +01:00
Dennis Luxen f0d3d23b5f make http header parsing case insensitive, and remove some dead code (reset function) 2015-01-27 09:58:26 +01:00
Dennis Luxen 69e59b0ced rename clear() function to reduce camel case noise 2015-01-27 09:57:14 +01:00
Dennis Luxen ad4fb5afe3 revert previous commit that replace boost::array by std::array. not compatible with clang-3.5/boost1.54 2015-01-26 17:37:37 +01:00
Dennis Luxen dd6dd63798 rename iterator variable to be more telling 2015-01-26 16:35:16 +01:00
Dennis Luxen 7a3748b8f6 remove redundant c'tor call 2015-01-26 16:34:05 +01:00
Dennis Luxen 06a08a874f fix performance regression in output generation, use copy elision and return result char array 2015-01-26 13:49:07 +01:00
Dennis Luxen 37a9813482 replace boost::array by std::array 2015-01-26 13:26:21 +01:00
Dennis Luxen fe7b436a8c refactor request parser to use C++11 idioms, plus a couple of consts 2015-01-26 13:20:22 +01:00
Dennis Luxen 601eff1af6 initialize compression type to be no compression 2015-01-26 11:25:10 +01:00
Dennis Luxen 29949eae1b remove unneeded include to boost/tribool 2015-01-23 18:55:58 +01:00
Dennis Luxen 9dfe6d1e85 use std::tuple to return multiple return values, hope for copy elision. Also, removes two cases of parameter reassignment 2015-01-23 18:53:37 +01:00
Dennis Luxen fb3bc22c64 replace boost::tribool with enum based implementation 2015-01-23 18:18:29 +01:00
Dennis Luxen b89304a24b add enum class based tribool implementation 2015-01-23 17:46:23 +01:00
Dennis Luxen 69b3457e83 replace boost::tuple by std::tuple 2015-01-23 17:14:12 +01:00
Dennis Luxen cf21074f10 use enum as return code instead of boolean logic in extractor 2015-01-23 16:59:13 +01:00
Dennis Luxen dc7f21513a move initialization of extractor config into main method and out out extraction logic 2015-01-23 16:30:14 +01:00
Dennis Luxen a15450af91 manually revert previous change as g++ doesnt convert bitfields properly 2015-01-23 14:24:02 +01:00
Dennis Luxen efbcce0ffe use bitfields to reduce struct size of segment information. size goes down from 28->24 bytes 2015-01-23 13:53:02 +01:00
Dennis Luxen 1c2c87e03d fix boundary edge case 2015-01-23 13:52:44 +01:00
Dennis Luxen 93b33c0518 fix cast to be explicit 2015-01-23 13:52:28 +01:00
Dennis Luxen 53e01952be replace for loops with counters by range-based for loops 2015-01-23 12:19:01 +01:00
Dennis Luxen 1c12b468a8 replace for loop with hand-rolled pair-wise traverse of container with call to for_each_pair; fix target type of cast 2015-01-23 12:11:51 +01:00
Dennis Luxen ccd803416e fix unintended float/epsilon<double> comparison 2015-01-23 11:49:02 +01:00
Dennis Luxen 62f2a42f28 reduce cyclomatic complexity in double->string bearing conversion 2015-01-23 11:44:35 +01:00
Dennis Luxen d6e76fd1c0 add whitespace 2015-01-23 11:38:47 +01:00
Dennis Luxen 9135c56ac6 fix implicit float/double conversion, use casts 2015-01-23 11:26:47 +01:00
Dennis Luxen 0e7eff3963 rename short variable names in mercator to be more telling 2015-01-23 11:14:29 +01:00
Dennis Luxen bd1928e445 rename short variable names to be more telling 2015-01-23 09:47:44 +01:00
Dennis Luxen 8e105af232 remove redundant code from switch statement in restriction parser 2015-01-23 09:25:05 +01:00
Dennis Luxen 796cbafde4 add missing include in release build 2015-01-22 17:57:38 +01:00
Dennis Luxen 29354a1586 fix bearing computation 2015-01-22 17:07:04 +01:00
Dennis Luxen bcd73e604c reformat coordinate and rtree test code 2015-01-22 17:00:48 +01:00
Dennis Luxen e80ca6553d use new coordinate interface in unit tests 2015-01-22 16:58:45 +01:00
Dennis Luxen 90f17c2140 remove is_set() and reset() functions from coordinate 2015-01-22 16:55:34 +01:00
Dennis Luxen 2e5cc1e6ae remove redundant code and streamline coordinate interface 2015-01-22 16:48:53 +01:00
Dennis Luxen 0ea7fd9c3d remove more dead/unused functions 2015-01-22 16:41:04 +01:00
Dennis Luxen 814d9aa01b reformat code source file 2015-01-22 16:33:27 +01:00
Dennis Luxen 3fa12445a5 rename coordinate calculation functions, remove code clutter 2015-01-22 16:28:40 +01:00
Dennis Luxen 547a2aec09 remove dead/redundant code 2015-01-22 15:50:04 +01:00
Dennis Luxen 9175fb7da8 remove unused debug code 2015-01-22 15:19:43 +01:00
Dennis Luxen 887032881a use std::any_of() algorithm instead of hand-rolled logic 2015-01-22 15:09:24 +01:00
Dennis Luxen e67f82283f replace temporary variable with short name by atomic<>.load call 2015-01-22 13:47:31 +01:00
Dennis Luxen cfa83658dc Use early exit/continue to simplify code and reduce indentation 2015-01-22 12:39:41 +01:00
Dennis Luxen c881aa7b32 Use early exit/continue to simplify code and reduce indentation, move increase/decrease query count into functions 2015-01-22 12:38:48 +01:00
Dennis Luxen a8db29399f remove unneeded else block in if statement 2015-01-22 12:28:00 +01:00
Dennis Luxen baacd0e50c reformat source files 2015-01-22 12:24:54 +01:00
Dennis Luxen 0f8c3b1960 fix copyright year 2015-01-22 12:18:48 +01:00
Dennis Luxen cd523cc934 conflate collapsable if statements 2015-01-22 12:14:14 +01:00
Dennis Luxen 044271a55c specialize insert function to pass by reference for non-fundamental types by using type traits 2015-01-22 11:02:49 +01:00
Dennis Luxen f662b9a081 install libgdal-dev on Travis 2015-01-20 18:45:49 +01:00
Dennis Luxen ba10f97420 add third_party directory node to the include dirs 2015-01-20 18:23:10 +01:00
Dennis Luxen 50c460ebd5 install mapbox/variant headers from third_party directory 2015-01-20 18:07:45 +01:00
Dennis Luxen 501863a0eb move external dependence mapbox/variant into third_party directory 2015-01-20 18:06:26 +01:00
Dennis Luxen ec9b2dbe42 remove debug info from binaries 2015-01-20 17:57:47 +01:00
Dennis Luxen db2ba22bd6 fix tests to run with new header coordinate_calculations 2015-01-20 17:56:50 +01:00
Dennis Luxen 087f08dad2 also build tests on travis CI 2015-01-20 17:56:30 +01:00
Dennis Luxen bf7b146dfc Merge pull request #1350 from Project-OSRM/feature/prune_incremental_search
speed up nearest neighbor query by pruning
2015-01-20 17:36:23 +01:00
Dennis Luxen 01f3237416 speed up nearest neighbor query by pruning, move coordinate calculations away from library interface 2015-01-20 16:24:49 +01:00
Dennis Luxen 8f813fbc67 clear result nodes/way in parser for each parsed element 2015-01-20 11:25:21 +01:00
Dennis Luxen f4ff695080 replace conditional operator by explicit serialization 2015-01-20 10:50:33 +01:00
Dennis Luxen 08cc2bbd70 move thread local variables out of parsing scope 2015-01-16 18:22:37 +01:00
Dennis Luxen 46a7e46068 serialize lvalues as MSVC barfs out on serializing the return value of the conditional operator 2015-01-16 18:12:21 +01:00
Dennis Luxen 472a567f42 add cmath include to fix call to std::abs() on clang compiler, reorder includes 2015-01-16 17:23:29 +01:00
Dennis Luxen f3bc1ed3a9 make floating point number literal a float 2015-01-16 17:21:02 +01:00
Dennis Luxen 7ba9b97afc reorder members of internal extractor edge. 56->40 bytes 2015-01-16 17:11:30 +01:00
Dennis Luxen 061d281d2a serialize bitfields thru local member mockups 2015-01-16 17:10:31 +01:00
Dennis Luxen 2835508292 fixes #1346:
- use const_iterator where it makes sense
- fix renumbering of turn restriction members
- remove redundant code
- fix counting of usable turn restrictions
2015-01-16 15:56:49 +01:00
Dennis Luxen 959d9a3ad9 explicitly implement check if is_only turn is restricted 2015-01-16 15:52:41 +01:00
Dennis Luxen 7cf34a6d6f make debug output more verbose during renumbering of turn restriction members 2015-01-16 15:47:01 +01:00
Dennis Luxen 8d6d7d1f20 remove superflous inline keywords 2015-01-16 11:27:46 +01:00
Dennis Luxen b115764d9c Merge pull request #1347 from Project-OSRM/perpendicular-fix
Fix ComputePerpendicularDistance convinience function
2015-01-16 09:53:49 +01:00
Patrick Niklaus 1b5d332e93 Add regression test for FixedpointCoordinate 2015-01-16 00:49:43 +01:00
Patrick Niklaus 356dfc806d Fix ComputePerpendicularDistance convinience function
This function is used by StaticRTree and returns wrong results.
The other variation is correct. To reduce code duplication
the correct version is used instead, as the implementation is nearly
identical.
2015-01-16 00:34:07 +01:00
Dennis Luxen f2b556adfd umbenannt: UnitTests/* -> unit_tests/* 2015-01-15 18:39:26 +01:00
Dennis Luxen 1bbfced61a reorder includes 2015-01-15 18:10:22 +01:00
Dennis Luxen 800cb8c6dd renamed: ../UnitTests/data_structures/BinaryHeapTest.cpp -> ../UnitTests/data_structures/binary_heap.cpp
renamed:    ../UnitTests/data_structures/RangeTableTest.cpp -> ../UnitTests/data_structures/range_table.cpp
renamed:    ../UnitTests/data_structures/StaticGraphTest.cpp -> ../UnitTests/data_structures/static_graph.cpp
renamed:    ../UnitTests/data_structures/StaticRTreeTest.cpp -> ../UnitTests/data_structures/static_rtree.cpp
2015-01-15 18:07:47 +01:00
Dennis Luxen 6b1d672dc1 fix signed/unsigned comparison 2015-01-15 13:11:25 +01:00
Dennis Luxen 6e138bbf54 fixes data structure tests:
- MapStorage: fix returned index in peek_index() on fail
- UnorderedMapStorage: fix returned index in peek_index() on fail
- BinaryHeap: auto-deduce Index type
- ArrayStorage: replace raw array with std::vector
2015-01-15 12:59:08 +01:00
Dennis Luxen 6dabf4507a implement peek_index() functions for all binary heap storage classes 2015-01-15 11:15:48 +01:00
Dennis Luxen 527e6cbc72 xor fast hash storage: reorder initialization of elements, delete default c'tor, resetting of table may be expensive as it is rare 2015-01-14 18:14:55 +01:00
Dennis Luxen 39edbcbabd after profiling with intel vtune, mitigate some performance hotspots. may give a 10-20% performance boost during preprocessing 2015-01-14 17:26:59 +01:00
Dennis Luxen 0077856d2f Merge commit 'b65f1d7df0b997eac085da7f5a3344a86b812916' as 'Include/variant' 2015-01-14 09:36:20 +01:00
Dennis Luxen b65f1d7df0 Squashed 'Include/variant/' content from commit 00ab881
git-subtree-dir: Include/variant
git-subtree-split: 00ab88117ed25f78cdca2faa00beea0061271e85
2015-01-14 09:36:20 +01:00
Dennis Luxen 201afbbeec rm hard copy of variant. 2015-01-14 09:32:43 +01:00
Dennis Luxen f5caf96d2e add new include dir of libosmium 2015-01-13 17:14:54 +01:00
Dennis Luxen 73efcc6b0c Squashed 'third_party/libosmium/' content from commit 910f8f1
git-subtree-dir: third_party/libosmium
git-subtree-split: 910f8f1e992402e0f1acd0132eaffa7539ca83d2
2015-01-13 16:54:25 +01:00
Dennis Luxen d69510f997 Merge commit '73efcc6b0ccedf8c1b6d95abdba8340cc9adf100' as 'third_party/libosmium' 2015-01-13 16:54:25 +01:00
Dennis Luxen d6946a8aae remove copy of libosmium, to be replaced by a subtree 2015-01-13 16:50:31 +01:00
Dennis Luxen ebbc168f3f fix implicit integer cast, reorder includes 2015-01-13 16:46:44 +01:00
Dennis Luxen 347cbd37ca fix include guard naming in plugin base 2015-01-13 16:15:51 +01:00
Dennis Luxen d190e0b771 Merge pull request #1343 from Project-OSRM/feature/static_graph_components
use static graph for component exploration, closes #1288
2015-01-13 16:06:48 +01:00
Dennis Luxen 5f28a7db0d add some whitespace 2015-01-13 15:52:24 +01:00
Dennis Luxen d0c99f1999 fix linking of benchmarks and tests 2015-01-13 15:45:27 +01:00
Dennis Luxen bf71781ee9 new file: Util/mercator.cpp
renamed:    Util/MercatorUtil.h -> Util/mercator.hpp
2015-01-13 14:57:23 +01:00
Dennis Luxen fbce104f3b use static graph for component exploration, closes #1288 2015-01-13 14:24:56 +01:00
Dennis Luxen ef9074f8e4 renamed: Util/finger_print.* -> Util/fingerprint.*
thx @emiltin
2015-01-13 11:16:13 +01:00
Dennis Luxen 67f3111cc0 renamed: Util/FingerPrint.h -> Util/finger_print.hpp 2015-01-13 11:05:22 +01:00
Dennis Luxen 56d2101b1a Merge pull request #1339 from Project-OSRM/test_appveyor_default_os
remove explicit appveyor os spec to get scheduled on hyper-v
2015-01-12 16:28:27 +01:00
Emil Tin a28395b116 remove accidentally added files 2015-01-12 13:58:32 +01:00
Emil Tin eebf3a54e2 cuke: abort if bins are missing, closes #1341 2015-01-12 13:56:43 +01:00
Dennis Luxen 7e70fa63d7 Merge pull request #1338 from frodrigo/develop
Black list access=psv for car profile
2015-01-09 23:39:49 +01:00
Dennis Luxen bea4b520c0 Revert "Revert "fix #1255 assume lift gates are passable""
This reverts commit cec3d1488a.

*sigh*
2015-01-09 19:15:00 +01:00
Dennis Luxen 64c17c4ecd remove explicit appveyor os spec to get scheduled on hyper-v 2015-01-09 18:53:15 +01:00
Frederic Rodrigo 26f7ac9ca1 Black list access=psv for car profile 2015-01-09 17:14:16 +00:00
Dennis Luxen b1a12768e1 fix parameter name for maximum number of location in distance table plugin 2015-01-08 17:41:19 +01:00
Dennis Luxen 0e5a448d04 Merge pull request #1335 from Project-OSRM/feature/frodrigo-max_locations_distance_table
Feature/frodrigo max locations distance table
2015-01-08 16:07:17 +01:00
Dennis Luxen 91a89399f8 fix copyright year 2015-01-08 15:07:01 +01:00
Dennis Luxen c6bb7c5993 renamed: Include/osrm/ServerConfig.h -> Include/osrm/libosrm_config.hpp
pass lib config object by reference
2015-01-08 15:05:54 +01:00
Dennis Luxen 48b131eb5c Merge branch 'max_locations_distance_table' of https://github.com/frodrigo/osrm-backend into frodrigo-max_locations_distance_table
Conflicts:
	Library/OSRM.h
	Library/OSRM_impl.cpp
	Library/OSRM_impl.h
2015-01-08 14:49:10 +01:00
Dennis Luxen 1328be2b61 move structs into anon namespace, move containers in function scope 2015-01-07 12:30:01 +01:00
Dennis Luxen 88c1e622dd fix copyright year 2015-01-07 12:29:13 +01:00
Dennis Luxen 10672786a1 fix copyright year and include guard 2015-01-07 12:28:26 +01:00
Dennis Luxen d896a9efec remove superflous inline keywords as this DeallocatingVector is header-defined, also remove ignored const keywords 2015-01-07 12:26:49 +01:00
Dennis Luxen 0ccdd4b6ad fix implicit conversion that _may_ lose integer precision 2015-01-07 12:26:09 +01:00
Dennis Luxen 66fc676858 remove unused parameter, move previously templated function into compile unit 2015-01-06 20:05:33 +01:00
Frederic Rodrigo 12f2acc9ff Order ServerPaths members by memory size, pass ServerPaths by ref 2015-01-06 15:33:57 +00:00
Dennis Luxen b53e8bf501 remove implicit conversion 2015-01-06 15:31:55 +01:00
Dennis Luxen e296264ea6 Merge pull request #1292 from Project-OSRM/feature/json_lib_interface
Feature/json lib interface
2015-01-06 15:27:40 +01:00
Frédéric Rodrigo 598f5519d1 Remove setters from structures server_config 2015-01-06 14:11:09 +00:00
Frédéric Rodrigo ced64d7a09 Move server configuration from method parameter to a struct 2015-01-06 14:11:09 +00:00
Frédéric Rodrigo 7075a8a8ef Fix tests for new option --max_locations_distance_table 2015-01-06 14:11:09 +00:00
Frédéric Rodrigo e2605c2838 Add a commande line option to osrm-routed for max locations supported in distance table query 2015-01-06 14:11:09 +00:00
Dennis Luxen be63939441 fix includes 2015-01-06 13:35:36 +01:00
Dennis Luxen dea9c37d99 fix bad request error message 2015-01-06 13:27:51 +01:00
Dennis Luxen 4d27366ead fix compilation of benchmark tests 2015-01-06 13:27:51 +01:00
Dennis Luxen a11a8429bb remove unneeded header file 2015-01-06 13:27:51 +01:00
Dennis Luxen 6da33cafe5 rebase branch onto latest develop, report changes. hurt a little 2015-01-06 13:27:50 +01:00
Dennis Luxen 06f82d5e8a install variant by default 2015-01-06 13:22:12 +01:00
Dennis Luxen 89dd0c4a40 install headers with .hpp suffix 2015-01-06 13:22:12 +01:00
Dennis Luxen 1b10f53eff DataStructures/RawRouteData.h -> DataStructures/internal_route_result.hpp, implements #1238 2015-01-06 13:22:12 +01:00
Dennis Luxen 8bd7d57dd8 fixed compilation of simple client
- adapted to new lib interface
- fixed return codes of command line parsing
- reformatted code
2015-01-06 13:20:56 +01:00
Dennis Luxen 4a6325696e change library interface to expose json container as structure to exchange data 2015-01-06 13:19:21 +01:00
Dennis Luxen b50a907ca3 fix changed include paths 2015-01-06 13:17:12 +01:00
Dennis Luxen 59e9a67abd rename and remove include header files for stabilized lib API 2015-01-06 13:09:44 +01:00
Liu Jiaming 1d2f06df6d Fix std::list splice usage error 2015-01-06 13:02:05 +01:00
Dennis Luxen 725b93a961 Merge branch 'develop' 2015-01-06 11:03:29 +01:00
Dennis Luxen a21e4c5a0b link library against exception lib 2015-01-06 11:00:44 +01:00
Dennis Luxen 433db17083 fix initialization of simple client 2015-01-05 18:14:49 +01:00
Dennis Luxen f8753fb9f1 fix overly long line 2015-01-05 16:32:11 +01:00
Dennis Luxen 25d5653f66 rename a number of overly long variable names 2015-01-05 16:29:33 +01:00
Dennis Luxen 703a88a639 remove empty d'tor from osrm::exception 2015-01-05 15:53:28 +01:00
Dennis Luxen 25326b571b renamed: Util/OSRMException.h -> Util/osrm_exception.hpp 2015-01-05 15:40:05 +01:00
Dennis Luxen 5e2f4c9d2d fix header include 2015-01-05 14:47:05 +01:00
Dennis Luxen f43d380fe2 remove unneeded method 2015-01-05 14:46:38 +01:00
Dennis Luxen 2240d3d0d1 add new header file 2015-01-05 14:39:17 +01:00
Dennis Luxen b6eea9a880 fix unintended implicit cast from unsigned to signed 2015-01-05 14:38:24 +01:00
Dennis Luxen 6bbd7c0c0b update ignore list in git 2015-01-05 14:37:35 +01:00
Dennis Luxen 2caeb4008c renamed: Util/GitDescription.cpp.in -> Util/git_sha.cpp.in
renamed:    Util/GitDescription.h -> Util/git_sha.h
2015-01-05 14:32:04 +01:00
Dennis Luxen a4919ffb45 re-enable hintin mechanism 2015-01-05 12:59:29 +01:00
Dennis Luxen b384340cbb Revert "remove remnants of hinting mechanism"
This reverts commit 7de428233e.
2015-01-05 12:57:34 +01:00
Dennis Luxen 061f46306f remove unneeded lvalue parameter 2015-01-05 12:00:11 +01:00
Dennis Luxen fe1f11b071 renamed: Util/StringUtil.h -> Util/string_util.hpp 2015-01-05 10:22:11 +01:00
Patrick Niklaus d3f5db576a Enable gcc color output when available 2015-01-04 23:13:15 +01:00
Emil Tin 0ca586e1c8 cuke: remove unneeded @x tag 2015-01-03 16:53:01 +01:00
Emil Tin a0b55f9df3 table tests: use empty string to mean no route 2015-01-03 11:12:47 +01:00
Dennis Luxen 24943ccee6 fix use of old-style cast 2015-01-02 17:43:46 +01:00
Dennis Luxen bcaaf34fa7 implicit conversion loses integer precision 2015-01-02 17:41:11 +01:00
Dennis Luxen ea17d1f6c7 dynamic exception specifications are deprecated, use 'noexcept' instead 2015-01-02 17:39:11 +01:00
Dennis Luxen 3be734010c fix warning: 'const' type qualifier on return type has no effect 2015-01-02 17:34:21 +01:00
Dennis Luxen e79787cc77 reorder members to avoid padding class 'SimpleLogger' with 4 bytes to align 'os' 2015-01-02 17:32:52 +01:00
Dennis Luxen 7de428233e remove remnants of hinting mechanism 2015-01-02 17:10:47 +01:00
Dennis Luxen 9722f56be8 remove more debug code 2015-01-02 16:41:36 +01:00
Dennis Luxen e766d206f1 remove debug code 2015-01-02 16:06:09 +01:00
Dennis Luxen 1fa9091239 retire json hinting mechanism 2015-01-02 15:46:43 +01:00
Dennis Luxen 04e1e5e3a2 reformat code 2015-01-02 15:17:15 +01:00
Dennis Luxen fa5c0560fa use tiny cc id if all phantoms have such an id, and if and only if all ids are equal 2015-01-02 09:36:27 +01:00
Dennis Luxen 55d47b3e31 reimplement incremental nearest neighbor query 2015-01-02 09:36:27 +01:00
Dennis Luxen 5bb96fd477 reformat code of phantom node c'tor for legibility 2015-01-02 09:36:27 +01:00
Dennis Luxen 22b404a1b4 add is_in_tiny_cc() util function 2015-01-02 09:36:27 +01:00
Dennis Luxen 03dcf82602 use first phantom node of second pair 2015-01-02 09:36:26 +01:00
Dennis Luxen 95d1e8a4f1 adapt viaroute plugin to query NN search for vector of phantom nodes 2015-01-02 09:36:26 +01:00
Emil Tin 67f68b47db add fuzzy match to table tests, add more tests 2015-01-01 20:19:41 +01:00
Emil Tin 593808f24d initial support for testing distance matrices 2015-01-01 15:12:45 +01:00
Dennis Luxen 0a884cc64a don't stop traversing at bollard node 2014-12-31 16:04:53 +01:00
Dennis Luxen a54d4b98b1 add const keyword in range based for loop 2014-12-31 16:04:53 +01:00
Patrick Niklaus 23132e5292 Use >= 0 to include routes where start/end is the same 2014-12-31 15:59:42 +01:00
Dennis Luxen d741b624be pass component class by ref (not value) in edge-based graph factory 2014-12-30 11:44:11 +01:00
Patrick Niklaus 00bc394bdb Fix off-by-one in distance table plugin.
Should fix #1320.
2014-12-28 17:45:55 +01:00
Dennis Luxen d7215ad185 fix tests, temporarily disable one test case 2014-12-24 13:03:05 +01:00
Dennis Luxen 2b63eb8243 remove zoom level from nearest neighbor calls 2014-12-24 10:40:03 +01:00
Dennis Luxen 1bb3da0332 expose component_id in phantom node 2014-12-24 10:25:27 +01:00
Dennis Luxen c7d3d635f6 fix test compile 2014-12-23 17:18:32 +01:00
Dennis Luxen f4c8db6105 - serialize component_id
- remove calls to deprecated NN function in facades
2014-12-23 16:14:28 +01:00
Dennis Luxen b2637b9a43 compute component id for each SCC 2014-12-23 15:26:06 +01:00
Dennis Luxen 09d0ac3838 add aux. function to get component id for a given node 2014-12-23 15:17:38 +01:00
Dennis Luxen f42cc848d5 - correct number of components in compressed graph by number of removed nodes
- replace integer for loops by integer range-based loop
2014-12-23 14:51:25 +01:00
Dennis Luxen 4b1224f874 fix copyright year 2014-12-23 14:38:04 +01:00
Dennis Luxen 10bb2cce8e count number of removed nodes as a private member variable in EdgeBasedGraphFactory 2014-12-23 14:37:01 +01:00
Dennis Luxen 8174b3b85a output total number of compoments and those of size one 2014-12-23 14:33:38 +01:00
Dennis Luxen 71e2f2ed61 move SCC stats output out of algo implementation 2014-12-23 14:31:55 +01:00
Dennis Luxen 8d8724b3e1 use SCC code for exploration of components 2014-12-23 12:27:04 +01:00
Dennis Luxen 47f65ccba6 use restriction map in tiny components 2014-12-23 11:47:19 +01:00
Dennis Luxen df0c1106ce compile and link restriction map object to components and routes 2014-12-23 11:46:25 +01:00
Dennis Luxen 47a2271e27 copy edits: 2014-12-23 11:30:45 +01:00
Dennis Luxen ea367a7f37 add better checks for forbidden routes 2014-12-22 18:12:47 +01:00
Dennis Luxen f4b192e33c simplify code 2014-12-22 18:12:18 +01:00
Dennis Luxen a5c824f694 adapt tiny_components.hpp to have the same interface as bfs_components.hpp 2014-12-22 16:43:57 +01:00
Dennis Luxen ccc4607d6d renamed: Util/GraphLoader.h -> Util/graph_loader.hpp 2014-12-22 16:09:01 +01:00
Dennis Luxen 4ec41392f7 code cleanup in graph loading function 2014-12-22 16:03:22 +01:00
Dennis Luxen 5f2b2cd0f7 remove dead code 2014-12-22 15:53:11 +01:00
Dennis Luxen 361e3ca356 fix a copy&paste oversight, fixes #1319
remove UINT_MAX
2014-12-22 15:11:37 +01:00
Dennis Luxen 13bf4fab32 make implementation of restriction map independent of graph type 2014-12-19 16:46:12 +01:00
Dennis Luxen 4b583e8ce9 replace insecure std::rand by C++11's random number generation
fixes coverity issue 1248916 Don't call
2014-12-19 10:59:12 +01:00
Dennis Luxen d31c6fe286 fix coverity issue 1258907 Division or modulo by float zero 2014-12-19 10:49:33 +01:00
Dennis Luxen 79de97d814 move application logic, i.e. shape file generation, from SCC traversal class to calling tool code 2014-12-18 18:14:14 +01:00
Dennis Luxen 1c5d093b59 Revert "catch uncaught exception"
This reverts commit ecff2beafa.
2014-12-18 16:42:14 +01:00
Dennis Luxen ecff2beafa catch uncaught exception 2014-12-18 16:11:49 +01:00
Dennis Luxen 7e0b19c43d renamed Util/StdHashExtensions.h -> Util/std_hash.hpp 2014-12-18 10:09:31 +01:00
Dennis Luxen 2ebe2faa74 renamed Util/TimingUtil.h -> Util/timing_util.hpp 2014-12-17 17:33:31 +01:00
Dennis Luxen aec1451168 add workaround for Windows build issues. 2014-12-17 16:24:43 +01:00
Dennis Luxen 38251aa513 construct RequestParser object on demand
pass CompressionType refs instead of ptrs to parser
2014-12-17 15:48:33 +01:00
Dennis Luxen d92e8ca8d2 remove unneeded function 2014-12-17 15:09:07 +01:00
Dennis Luxen 2e5876d488 add lock_guard to protect against data races in initialization of scripting environment
rename function names to reduce camel case noise
2014-12-17 14:34:23 +01:00
Dennis Luxen 3dddd16ec7 bump osmium version 2014-12-17 11:19:08 +01:00
Dennis Luxen 40ff7ad999 update speed profile from external calibration data 2014-12-17 11:02:04 +01:00
Dennis Luxen cb79f769c9 Merge pull request #1312 from joto/const
Some cleanups in the extractor code.
2014-12-12 17:10:47 -08:00
Jochen Topf e95feff016 Use 'const' where possible in extractor and simplify iterator loop. 2014-12-13 00:23:41 +01:00
Jochen Topf f65b32c1af Use atomics for counters. 2014-12-13 00:16:32 +01:00
Dennis Luxen 46dd9b9887 remove duplicated paths 2014-12-13 00:09:25 +01:00
Dennis Luxen 4445f21e8a renamed: Tools/* -> tools/* 2014-11-28 15:36:40 +01:00
Dennis Luxen 00d3676a20 renamed: RoutingAlgorithms/* routing_algorithms/ 2014-11-28 15:33:41 +01:00
Dennis Luxen 0f7cb12e97 renamed: ThirdParty/* -> third_party/* 2014-11-28 15:22:26 +01:00
Dennis Luxen 8485e02c00 renamed: Plugins/* -> plugins/* 2014-11-28 15:14:13 +01:00
Dennis Luxen ae7300f9b4 renamed: extractor.cpp -> extract.cpp
renamed:    Extractor/* -> extractor/
2014-11-28 15:00:48 +01:00
Dennis Luxen fc796539e8 deleted: Docs/webclient.txt 2014-11-28 14:39:28 +01:00
Dennis Luxen 1d8c43b445 renamed: Descriptors/* -> descriptors/* 2014-11-28 14:36:38 +01:00
Dennis Luxen 58de37e822 renamed: DataStructures/* -> data_structures/* 2014-11-28 12:15:31 +01:00
Dennis Luxen 7b3a0c5105 renamed: Contractor/* -> contractor/* 2014-11-28 10:30:21 +01:00
Dennis Luxen 592034653c renamed: Benchmarks/* -> benchmarks/*s 2014-11-28 10:15:27 +01:00
Dennis Luxen 8d9f830c53 change includes to lower case algorithms/ 2014-11-28 10:12:08 +01:00
Dennis Luxen d8eea0ce0e renamed: Algorithms/* -> algorithms/* 2014-11-28 10:07:06 +01:00
Dennis Luxen c28c441e77 renamed: Contractor.h -> contractor.hpp 2014-11-27 19:07:59 +01:00
Dennis Luxen 1391420699 renamed: ../Benchmarks/StaticRTreeBench.cpp -> ../Benchmarks/static_rtree.cpp 2014-11-27 19:04:30 +01:00
Dennis Luxen c0be751ef4 renamed: DataStructures/SegmentInformation.h -> DataStructures/segment_information.hpp 2014-11-27 18:54:20 +01:00
Dennis Luxen 5e2462e061 renamed: DataStructures/RestrictionMap.cpp -> DataStructures/restriction_map.cpp
renamed:    DataStructures/RestrictionMap.h -> DataStructures/restriction_map.hpp
2014-11-27 18:38:21 +01:00
Dennis Luxen 5c0eb4772d renamed: Util/LuaUtil.h -> Util/lua_util.hpp 2014-11-27 18:31:01 +01:00
Dennis Luxen ef8706b4e1 fix inconsistencies with integer and iterator range header files, closes #1296 2014-11-27 09:54:57 +01:00
Dennis Luxen acd1919e8d renamed: Util/Azimuth.h -> Util/bearing.hpp 2014-11-26 16:55:18 +01:00
Dennis Luxen 459e2a322b cast computed way in a proper way, add a static assertion to check for file types via traits 2014-11-26 12:05:55 +01:00
Dennis Luxen e62caf33aa Merge pull request #1294 from alex85k/appveyor
update appveyor.yml (newer libraries, algorithm-tests)
2014-11-26 09:46:05 +01:00
alex85k 72fd0f3d41 update appveyor.yml (newer libraries, algorithm-tests) 2014-11-26 12:38:04 +03:00
Dennis Luxen 032c21c545 fix mixed up include header <numeric> <-> <cmath> 2014-11-25 14:52:21 +01:00
Dennis Luxen b391daac6d use C++11's std::round from <numeric> instead of C-style round from cstdlib 2014-11-25 14:49:33 +01:00
Dennis Luxen 8cb6959e3f untangle includes 2014-11-24 15:51:52 +01:00
Dennis Luxen 49c817a60e remove redundant clear() calls in Extractor.cpp 2014-11-24 15:42:55 +01:00
Dennis Luxen 6859b53155 use JSON container to hold all intermediate results:
- no hand-rolled GPX generation anymore
- render gpx thru a JSONContainer visitor pattern
- precursor to expose JSON containter as result from OSRM lib interface, cf. #1261
2014-11-24 15:15:57 +01:00
Dennis Luxen c581563230 fix setting of restriction end nodes, fixes #1286, and potentially #1287 2014-11-24 11:29:25 +01:00
Patrick Niklaus fc1db35f27 Add missing json dependency to cucumber 2014-11-23 13:29:22 +01:00
Patrick Niklaus 2734a4aee4 Merge pull request #1284 from Project-OSRM/algo-test-fix
Fix DP unit test
2014-11-22 16:22:07 +01:00
Patrick Niklaus 172f65969c Fix DP unit test 2014-11-22 13:47:20 +01:00
Dennis Luxen f0dbe0deb9 fix compilation 2014-11-21 09:35:20 +01:00
Dennis Luxen 8f8d81f90c renamed: Algorithms/StronglyConnectedComponents.h -> Algorithms/tiny_components.hpp 2014-11-20 17:21:35 +01:00
Dennis Luxen 665523bc7e add springclean tool to ignore list 2014-11-20 17:05:55 +01:00
Dennis Luxen 99e8fa70ba renamed: Algorithms/DouglasPeucker.cpp -> Algorithms/douglas_peucker.cpp
renamed:    Algorithms/DouglasPeucker.h -> Algorithms/douglas_peucker.hpp
2014-11-20 17:04:52 +01:00
Dennis Luxen 4c1d7c9d73 renamed: Algorithms/ExtractRouteNames.h -> Algorithms/route_name_extraction.hpp 2014-11-20 17:01:36 +01:00
Dennis Luxen d1cc8e7ad7 renamed: Algorithms/BFSComponentExplorer.h -> Algorithms/bfs_components.hpp 2014-11-20 16:58:35 +01:00
Dennis Luxen 7629e44e4c renamed: Algorithms/IteratorBasedCRC32.h -> Algorithms/crc32_processor.hpp 2014-11-20 16:17:49 +01:00
Dennis Luxen b62f6a6141 renamed: Algorithms/ObjectToBase64.h -> Algorithms/object_encoder.hpp 2014-11-20 16:10:11 +01:00
Dennis Luxen 10d7a2396c move JSON rendering code out of container header file. prerequesite to #1261 2014-11-20 15:26:30 +01:00
Dennis Luxen 007eced326 fix variant include 2014-11-20 15:14:19 +01:00
Dennis Luxen 1128270d4b fix short variable names 2014-11-20 15:06:48 +01:00
Dennis Luxen c7d889bf9e add missing break 2014-11-20 15:02:02 +01:00
Dennis Luxen 7cb585c1a1 remove constant conditional operator 2014-11-20 15:00:49 +01:00
Dennis Luxen 75157221b2 commit another if statement 2014-11-20 14:59:27 +01:00
Dennis Luxen 9807520ef0 collapse if statement 2014-11-20 14:58:32 +01:00
Dennis Luxen c658ee5c78 fix OCLint warning: short variable name, unused parameter 2014-11-20 14:55:43 +01:00
Dennis Luxen cbfbcdcff5 reformat RestrictionParser 2014-11-20 10:46:14 +01:00
Dennis Luxen 9a0581ea7f Merge pull request #1159 from Project-OSRM/feature/libosmium
parallelizing profile calls and porting lib osmium to Windows
2014-11-20 10:20:09 +01:00
Dennis Luxen 60c268ddd6 reorder some of the code 2014-11-19 11:02:38 +01:00
Dennis Luxen 0361e0204a rename Clear() method to clear() 2014-11-19 10:53:28 +01:00
Dennis Luxen 2da427134b use push_back to insert into tbb::concurrent_vector as emplace_back is not generally available 2014-11-19 10:12:08 +01:00
Dennis Luxen 4fce0dadcf remove further debug output from profiles 2014-11-19 09:58:41 +01:00
Dennis Luxen 288c241fb4 move initialization of Lua error callback into scripting environment 2014-11-19 09:49:39 +01:00
Dennis Luxen f3e3eda69e remove debug output from bike profile 2014-11-19 09:47:23 +01:00
Dennis Luxen 0f4dd8103d add cast.hpp from osmium 2014-11-19 09:44:02 +01:00
Dennis Luxen 86ee05ee5e add missing include 2014-11-19 09:22:31 +01:00
Dennis Luxen 3b9c6a6465 reformat Extractor 2014-11-18 19:03:44 +01:00
Dennis Luxen 8e73a4a19d enable relation parsing with libosmium 2014-11-18 18:53:19 +01:00
Dennis Luxen 428bb36ec6 parallelize with a vector of iterators 2014-11-18 16:54:48 +01:00
Dennis Luxen 0a24df6bd0 Merge pull request #1279 from Project-OSRM/config-parsing-fix
Fix ignored config file. Fixes issue #1276.
2014-11-18 14:09:03 +01:00
Patrick Niklaus d3ca080729 Fix windows build. 2014-11-18 11:52:39 +01:00
Patrick Niklaus 7658031784 Fix ignored config file. Fixes issue #1276. 2014-11-18 00:43:38 +01:00
Dennis Luxen 710e74219a libosmium version bump 2014-11-17 14:58:39 +01:00
Dennis Luxen 0249bed53a bump variant dependency 2014-11-17 14:58:39 +01:00
Dennis Luxen 9d14f81b79 set default timestamp for tests 2014-11-17 14:58:39 +01:00
Dennis Luxen a7c683a83c forward way ID information properly in turn restrictions parsing 2014-11-17 14:58:38 +01:00
Dennis Luxen 16631bf454 port track smoothness to new parsing 2014-11-17 14:58:38 +01:00
Dennis Luxen 3c563f7073 rebase branch onto most recent changes from develop branch 2014-11-17 14:58:38 +01:00
Dennis Luxen 344bdbb707 basic parallelization infrastructure 2014-11-17 14:58:38 +01:00
Dennis Luxen a0256dfc60 add error callback when calling get_exceptions 2014-11-17 14:58:38 +01:00
Dennis Luxen b131f27eb9 use_turn_restrictions as global in car profile 2014-11-17 14:58:38 +01:00
Dennis Luxen 0d9b70552e refactor FirstAndLastSegmentOfWay 2014-11-17 14:58:38 +01:00
Dennis Luxen ea1a89290a uncouple configuration of Extractor into compile unit 2014-11-17 14:58:38 +01:00
Dennis Luxen 59f1679d37 move LUA error callback function into anonymous namespace 2014-11-17 14:58:37 +01:00
Dennis Luxen 5121983218 Rename NodeInfo -> QueryNode 2014-11-17 14:58:37 +01:00
Dennis Luxen 0d7141ce5b Rename NodeInfo -> QueryNode 2014-11-17 14:58:37 +01:00
Dennis Luxen b4b753ce2e rename variables in ExternalMemoryNode to be more telling and consistent 2014-11-17 14:58:37 +01:00
Dennis Luxen 4f666e4d53 remove dead code 2014-11-17 14:58:37 +01:00
Dennis Luxen 874a988527 add dummy NodeID.h (to move into include) 2014-11-17 14:58:37 +01:00
Dennis Luxen 51c79f9784 rename ExtractorStructs into a more telling name 2014-11-17 14:58:37 +01:00
Dennis Luxen 4d19811026 apply reformatting 2014-11-17 14:58:37 +01:00
Dennis Luxen d1454075ab untangle function object code for stxxl comperators 2014-11-17 14:58:37 +01:00
Dennis Luxen becb6cf5bf compile renamed object file 2014-11-17 14:58:36 +01:00
Dennis Luxen a6f34d2044 rename ImportNode.h/cpp -> ExternalMemoryNode.h/cpp 2014-11-17 14:58:36 +01:00
Dennis Luxen 7300024e13 remove unneeded code: HashTable 2014-11-17 14:58:36 +01:00
Dennis Luxen 282800e6b1 replace boost::optional with mapbox::util::optional 2014-11-17 14:58:36 +01:00
Dennis Luxen e938bd3481 Revert "remove implicitly defined inline keywords from header-implemented functions in Util/ headers"
This reverts commit dc35e97ae002bdfda4bc3a68507749c464cfe371.
2014-11-17 14:58:36 +01:00
Dennis Luxen 9b501276fb upgrade variant dependency 2014-11-17 14:58:36 +01:00
Dennis Luxen 90d191f5f8 remove implicitly defined inline keywords from header-implemented functions in Extractor/ExtractionHelperFunctions.h 2014-11-17 14:58:36 +01:00
Dennis Luxen f452e7f9d2 remove implicitly defined inline keywords from header-implemented functions in Util/ headers 2014-11-17 14:58:36 +01:00
Dennis Luxen 1d25f41122 remove unused code 2014-11-17 14:58:36 +01:00
Dennis Luxen 5556785804 remove implicitly defined inline keywords from header-implemented functions in ExtractionWay 2014-11-17 14:58:35 +01:00
Dennis Luxen 22ce4c24fb move key/value wrapper function into anonymous namespace in ScriptingEnvironment 2014-11-17 14:58:35 +01:00
Dennis Luxen d4d2d127d1 pass an rvalue of a parsed node into the external memory storage 2014-11-17 14:58:35 +01:00
Dennis Luxen 3c28932862 remove errenous define in AppVeyor cmake call 2014-11-17 14:58:35 +01:00
Dennis Luxen 7e9177cb3c link against expat.lib 2014-11-17 14:58:35 +01:00
Dennis Luxen f692103c81 fix build on windows by linking against the right libs 2014-11-17 14:58:35 +01:00
Dennis Luxen 5a1dfe9b89 include variant library from a relative path 2014-11-17 14:58:35 +01:00
Dennis Luxen 7175180dc9 remove deprecated code 2014-11-17 14:58:34 +01:00
Dennis Luxen f95d1fa8ba add expat to cmake call on AppVeyor 2014-11-17 14:58:34 +01:00
Dennis Luxen 7b57068f6f manually install osmpbf, the one on Travis is outdated 2014-11-17 14:58:34 +01:00
Dennis Luxen d79eac3e26 port foot profile 2014-11-17 14:58:34 +01:00
Dennis Luxen 27c255c874 port bicycle profile 2014-11-17 14:58:34 +01:00
Dennis Luxen bdc611b23a port timestamp test to libosmium 2014-11-17 14:58:34 +01:00
Dennis Luxen 4cddf0bf5d replace explicit value fetching with wrapper call 2014-11-17 14:58:34 +01:00
Dennis Luxen 462d4c99cc port testbot profile 2014-11-17 14:58:34 +01:00
Dennis Luxen 94a2188090 explicitly specify optional parameter 2014-11-17 14:58:33 +01:00
Dennis Luxen ebcdcb5f00 port car profile 2014-11-17 14:58:33 +01:00
Dennis Luxen f9e780ed67 add a wrapper function to work around binding a function with default parameters against LuaBind 2014-11-17 14:58:33 +01:00
Dennis Luxen 18f8ce69cd remove default c'tor in ScriptingEnvironment 2014-11-17 14:58:33 +01:00
Dennis Luxen dce665f14e reformat ExtractorCallbacks 2014-11-17 14:58:33 +01:00
Dennis Luxen 80046b646b actually parse the data that flowing thru osmium 2014-11-17 14:58:33 +01:00
Dennis Luxen 06ddceeac0 reset travel modes on ExtractionWay::clear() 2014-11-17 14:58:33 +01:00
Dennis Luxen b7ea1dfcd0 fix generation of file names 2014-11-17 14:58:33 +01:00
Dennis Luxen 6d9598cd4c link against expat not libxml2, good riddance 2014-11-17 14:58:33 +01:00
Dennis Luxen 60c9701c3f reduce white space noise 2014-11-17 14:58:32 +01:00
Dennis Luxen 2a8644b72c expose libosmium types to LUA 2014-11-17 14:58:32 +01:00
Dennis Luxen b6e469abd1 implement parsing thru libosmium 2014-11-17 14:58:32 +01:00
Dennis Luxen 004c237085 implement restriction type interface in RestrictionMap 2014-11-17 14:58:32 +01:00
Dennis Luxen 398e3bdf82 implement new restriction type interface in PrepareData 2014-11-17 14:58:32 +01:00
Dennis Luxen 958350af82 add InputRestrictionContainer implementation 2014-11-17 14:58:32 +01:00
Dennis Luxen 2d677a8af9 support new restriction type in component analysis 2014-11-17 14:58:32 +01:00
Dennis Luxen 05a79f5b55 implement loader routines for new restriction type 2014-11-17 14:58:31 +01:00
Dennis Luxen ac9566d3d7 add include dir to libosmium 2014-11-17 14:58:31 +01:00
Dennis Luxen 8b7bf94aae implement new Restriction type 2014-11-17 14:58:31 +01:00
Dennis Luxen c4e785e523 remove explicit keyword from WayIDStartAndEndEdge ctor 2014-11-17 14:58:31 +01:00
Dennis Luxen 2f6f883f7f implement ExtractionWay and -Node 2014-11-17 14:58:31 +01:00
Dennis Luxen d071e92a1c implement restriction parsing 2014-11-17 14:58:31 +01:00
Dennis Luxen b18b4072e1 implement restriction parsing 2014-11-17 14:58:31 +01:00
Dennis Luxen 0a2898da17 remove legacy extrators 2014-11-17 14:58:30 +01:00
Dennis Luxen 73fb596973 add libosmium 2014-11-17 14:58:30 +01:00
Dennis Luxen c3f9dc7400 Merge pull request #1271 from alex85k/mingw-full
Support building tools on Windows, more MinGW
2014-11-17 09:18:40 +01:00
alex85k c75ce210ea support building tools on Windows 2014-11-16 21:33:41 +05:00
Dennis Luxen ffca6d8ba5 Merge pull request #1268 from alex85k/develop
fix appveyor packaging - 2
2014-11-14 09:25:01 +01:00
alex85k 1ec35befc8 package .exe, .pdb and lua profiles on AppVeyor 2014-11-14 00:37:07 +05:00
Dennis Luxen 6080eaebbd Merge pull request #1267 from alex85k/develop
fix appveyor packaging
2014-11-13 17:26:48 +01:00
alex85k 41ea339053 fix appveyor packaging 2014-11-13 20:16:40 +03:00
Dennis Luxen 75f9c08445 Merge pull request #1266 from Project-OSRM/revert-1256-patch-1
Revert "fix #1255 assume lift gates are passable"
2014-11-13 14:24:09 +01:00
Dennis Luxen cec3d1488a Revert "fix #1255 assume lift gates are passable" 2014-11-13 14:23:54 +01:00
Dennis Luxen ebec082da2 Merge pull request #1256 from AlanBell/patch-1
fix #1255 assume lift gates are passable
2014-11-13 14:23:42 +01:00
Dennis Luxen bec585e382 update distance table entries only if larger than 0. 2014-11-13 13:45:21 +01:00
Dennis Luxen 2cc8ae875a Merge pull request #1259 from Steffaan/develop
Update NearestPlugin.h to return correct names on mulitple results.
2014-11-11 10:33:49 -08:00
Dennis Luxen db8252e650 Merge branch 'AlanBell-patch-1' into develop 2014-11-11 09:47:53 -08:00
Dennis Luxen e3cb26a1c4 Merge branch 'patch-1' of https://github.com/AlanBell/osrm-backend into AlanBell-patch-1 2014-11-11 09:47:16 -08:00
Stefan 44036ae26d Update NearestPlugin.h to return correct names on mulitple results. 2014-11-11 18:22:32 +01:00
AlanBell 5b5f871a6e Merge pull request #1 from AlanBell/master
test case for lift gate access
2014-11-11 09:26:54 +00:00
AlanBell 9a8f9cae6d test case for lift gate access 2014-11-11 09:16:57 +00:00
AlanBell 8f804581c0 fix #1255 assume lift gates are passable
lift gates are commonly found on industrial parks or businesses, delivery drivers need to route to these, most gates are permissive and open in daytime, this patch won't route through gates where access is specifically no.
2014-11-07 10:29:25 +00:00
Dennis Luxen e26ef17545 reserve delta vector beforehand to avoid realocations. 2014-11-01 17:32:49 -04:00
Dennis Luxen 800bb223b5 remove unused variable 2014-11-01 17:15:20 -04:00
Dennis Luxen 75606f2100 reformatting 2014-10-31 12:15:09 -04:00
Dennis Luxen a28928e6ca use double braces for array initialization as brace elision is implemented/supported differently in GCC and Clang 2014-10-29 10:39:23 -04:00
Dennis Luxen 8700007025 Merge branch 'revert-1240-revert-1217-sketch-upstream' into develop 2014-10-29 10:18:44 -04:00
Patrick Niklaus 520f7fa2de Add UnitTest for DP
Conflicts:
	CMakeLists.txt
2014-10-29 00:40:34 +01:00
Patrick Niklaus 096208a154 Move DP thresholds back to header, since they are needed for testing
Conflicts:
	Algorithms/DouglasPeucker.cpp
2014-10-29 00:38:52 +01:00
Patrick Niklaus 27caab69ec Fix broken DP 2014-10-29 00:37:45 +01:00
Patrick Niklaus 3fe2b587cb Revert "Revert "Bring general sketch commits upstream"" 2014-10-29 00:33:43 +01:00
Dennis Luxen c791188811 separate logic between polyline compression algorithm and JSON formatting.
fixes and closes #1245
2014-10-28 17:31:51 -04:00
Dennis Luxen b227c90c18 remove redundant local variable 2014-10-28 11:11:06 -04:00
Dennis Luxen 8a5538356b remove redundant local variable 2014-10-28 10:39:29 -04:00
Dennis Luxen b257c881b5 explicit casts help mitigate MSVC warnery 2014-10-28 10:36:09 -04:00
Dennis Luxen 0f5dffb1c3 add some specific casts to avoid MSVC warnery 2014-10-28 10:36:02 -04:00
Dennis Luxen d2bd238274 Merge pull request #1244 from Project-OSRM/run_unittests_on_travis
Run unittests on travis
2014-10-28 10:35:22 -04:00
Dennis Luxen fed700440d pick different random seed to avoid edge case 2014-10-28 09:49:55 -04:00
Dennis Luxen 32a9d42412 run datastructure unit tests on travis 2014-10-28 09:14:43 -04:00
Dennis Luxen efc938d870 fix building of tests/benchmark 2014-10-28 09:11:14 -04:00
Dennis Luxen 369f669227 break out PhantomNode.h into a header/impl combo, rename to new naming scheme. 2014-10-27 17:56:06 -04:00
Dennis Luxen 1c56671f01 reformat to break overly long lines 2014-10-27 17:34:50 -04:00
Dennis Luxen 4dbc1e0e96 reformat to fix OCLint long line warning 2014-10-27 13:20:33 -04:00
Dennis Luxen 94288843f1 make entire_length variable a private member that cannot be set from the outside and only accessed thru a const getter. 2014-10-27 12:21:29 -04:00
Dennis Luxen b12decc865 Merge pull request #1240 from Project-OSRM/revert-1217-sketch-upstream
Revert "Bring general sketch commits upstream"
2014-10-27 10:08:17 -04:00
Dennis Luxen 0fc944abf3 Revert "Bring general sketch commits upstream" 2014-10-27 10:07:07 -04:00
Dennis Luxen 9f96c98f02 Merge pull request #1217 from TheMarex/sketch-upstream
Bring general sketch commits upstream
2014-10-26 10:19:24 -04:00
Patrick Niklaus 9805b05738 Reorder include and use correct datatypes 2014-10-25 10:14:31 +02:00
Patrick Niklaus 13ed186469 Fix include order in staticrtree 2014-10-25 10:14:31 +02:00
Patrick Niklaus 00a43221ac Use numeric_limits 2014-10-25 10:14:31 +02:00
Patrick Niklaus edc39112e2 Add wrapper function to DouglasPlucker for backwards-compability 2014-10-23 16:23:54 +02:00
Patrick Niklaus 3b727dea99 Make atan2_lookup inline since it is header-declared 2014-10-23 16:23:54 +02:00
Patrick Niklaus f16b2adec7 Allow empty ranges in DP 2014-10-23 16:23:54 +02:00
Patrick Niklaus 7d425aa76f Use iterators for DouglasPeucker 2014-10-23 16:23:54 +02:00
Patrick Niklaus 651c07c724 Add global timer utils
Global timers can be used to accumulate timings of the same context
in a thread-safe way.
2014-10-23 16:23:54 +02:00
Patrick Niklaus 4d27b75897 Move Rectangle2DInt to own header 2014-10-23 16:23:54 +02:00
Dennis Luxen 6f75d68d07 untangle includes 2014-10-23 16:11:54 +02:00
Dennis Luxen ae269e12bb disable debug code in rtree 2014-10-23 16:11:35 +02:00
Dennis Luxen 3a48929fe6 add benchmark for a single coordinate incremental lookup 2014-10-23 16:11:01 +02:00
Dennis Luxen be970326b6 remove superflous include from library 2014-10-22 19:28:15 +02:00
Dennis Luxen 463511871f Refactor routing plugins:
- remove superflous members from RawRouteData, partially implements #1238
- DescriptorTable moved to BaseDescriptor.h
- added templated assignment c'tor to DescriptorConfig
- refactored check for valid input coordinates, moved to BasePlugin.h
- replaced shared_ptr's to descriptors in ViaRoutePlugin.h with unique_ptr
- implemented FindIncrementalPhantomNode in facades for a single, i.e. first result
- untangled a few includes
2014-10-22 19:02:19 +02:00
Dennis Luxen 002da1e02d add range-based for_each_pair 2014-10-22 18:56:14 +02:00
Dennis Luxen b095aae5ce some minor include untangling 2014-10-21 19:05:56 +02:00
Dennis Luxen 511c21029e To arrive at a later point in time: Revert "remove inline keywords"
This reverts commit 81b0447024.
2014-10-21 18:34:50 +02:00
Dennis Luxen 81b0447024 remove inline keywords 2014-10-21 18:06:58 +02:00
Dennis Luxen d42772a261 bump variant dependency 2014-10-20 16:02:26 +02:00
Dennis Luxen c1136099a9 fix link order to make symbol available in libosrm 2014-10-20 13:26:51 +02:00
Dennis Luxen 06f8a975c0 prevent double compile of dependent compile units 2014-10-20 13:04:44 +02:00
Dennis Luxen c8cd8775f6 Merge branch 'develop' of github.com:Project-OSRM/osrm-backend into develop 2014-10-20 12:54:12 +02:00
Dennis Luxen f9900c91bd Merge branch 'alex85k-mingw-support' into develop 2014-10-20 12:53:09 +02:00
Dennis Luxen accaf6e77e Merge branch 'mingw-support' of https://github.com/alex85k/Project-OSRM into alex85k-mingw-support 2014-10-20 12:52:45 +02:00
Dennis Luxen 8490e297a9 add todo marker 2014-10-20 11:39:23 +02:00
Dennis Luxen 6d3a4b5f6c deactivate inactive includes 2014-10-20 11:25:50 +02:00
Dennis Luxen 1f36206f45 replace boost::get<> call with proper function call to mapbox::variant 2014-10-20 11:25:34 +02:00
Dennis Luxen 952e10936c rename variable 2014-10-20 10:58:45 +02:00
Dennis Luxen 2b3093a687 reformat file according to guidelines 2014-10-20 10:32:57 +02:00
Dennis Luxen d7e25772b0 remove left-over boost::noncopyable and replace by c++11 ctor deletes. 2014-10-20 10:20:58 +02:00
Dennis Luxen c66c9b0353 Merge branch 'alex85k-warning-fix' into develop 2014-10-20 10:13:36 +02:00
alex85k bbde0d75da remove unused variable in Windows code 2014-10-18 19:19:26 +06:00
alex85k c3aec4f627 do not use gcc-ar for MinGW 4.9 2014-10-18 19:13:46 +06:00
alex85k 113852eed4 use math defines on Mingw 2014-10-18 18:47:17 +06:00
Dennis Luxen 6b9b2c1468 Merge pull request #1231 from Project-OSRM/testing/smarter_caching
smarter caching of test files
2014-10-17 15:59:08 +02:00
Emil Tin 2c87b295ff add raketask for clearing test cache files 2014-10-17 15:13:06 +02:00
Emil Tin 93767d68f8 remove debug output 2014-10-17 15:07:56 +02:00
Emil Tin cc3646ca16 fix tests that use {base} expansion 2014-10-17 15:07:56 +02:00
Emil Tin 48333f73d5 rename rather than copy then when possible 2014-10-17 15:07:56 +02:00
Emil Tin 1f4241a63d smarter caching of test files 2014-10-17 15:07:56 +02:00
Dennis Luxen 8eccfaa034 fix a number of implicit conversions 2014-10-17 14:19:33 +02:00
Dennis Luxen 438d1af12a fix implicit type conversios 2014-10-17 13:03:49 +02:00
Dennis Luxen 5be6ef380f replace shared_ptr instances to make intent of single owner more obvious 2014-10-17 12:35:53 +02:00
Dennis Luxen 76419ed2fc remove unneeded member variable 2014-10-17 12:32:18 +02:00
Dennis Luxen 4684921e51 fix implicit casts 2014-10-17 12:31:02 +02:00
Dennis Luxen edd8caa2bf compile Fingerprint only once 2014-10-17 12:30:11 +02:00
Dennis Luxen cb5575ae89 remove compile-time time stamps, rely on git SHA instead, fixes #1229 2014-10-17 10:57:00 +02:00
Dennis Luxen 42e726dec5 reformat according to styleguide 2014-10-16 17:49:10 +02:00
Dennis Luxen e3d33aa171 add const keywords where possible 2014-10-16 17:43:05 +02:00
Dennis Luxen f2ceeb35da fixes issue #1167, odd routing instructions
- the turn angle for compressed edges was not computed from the uncompressed geometry
- for a given turn (a,b,c) the last compressed node for edge (a,b) and the first packed node for (b,c) is returned
- adds a cucumber test to guard against regression
2014-10-16 15:58:58 +02:00
Dennis Luxen 577cf5ddc4 retrieve first and last nodes of a compressed segment 2014-10-16 15:42:33 +02:00
Dennis Luxen 91ced39233 replace shared_ptrs with std::unique_ptr<> in Prepare 2014-10-16 12:10:43 +02:00
Dennis Luxen 4b6cb0b8b8 replace raw ptrs with std::unique_ptr<> in Prepare 2014-10-16 12:10:12 +02:00
Dennis Luxen fb81302382 fix typo: Lunux->Linux 2014-10-16 11:52:16 +02:00
Dennis Luxen dfc81f65ee Merge pull request #889 from Project-OSRM/experimental/cuke_datastore
use osrm-datastore for testing, keep osrm-routed runnning
2014-10-15 15:41:38 +02:00
Dennis Luxen 909db4c861 replace inline with anonynmous namespace to avoid duplicate symbols during linking 2014-10-15 15:15:40 +02:00
Dennis Luxen 4277eed1b6 Revert "remove whitespace from package description"
This reverts commit 6f5703a5fe.
2014-10-15 13:21:42 +02:00
Dennis Luxen 6f5703a5fe remove whitespace from package description 2014-10-15 12:55:40 +02:00
Dennis Luxen f7469f298d add a tail to the oneway circle to avoid edge cases 2014-10-15 11:33:43 +02:00
Dennis Luxen b29d5df7a2 simplify conditional operation, remove useless parantheses 2014-10-15 10:43:58 +02:00
Dennis Luxen 549ba65861 catch a number of uncaught exceptions 2014-10-15 10:23:48 +02:00
Dennis Luxen a9d99cbe54 fix inverted logic 2014-10-14 18:03:24 +02:00
Emil Tin 8438024370 avoid unnessecary process check 2014-10-14 16:05:06 +02:00
Dennis Luxen e6a00ddcfd rethrow exception, refactor default block in fully covered switch statement 2014-10-14 15:59:18 +02:00
Emil Tin 71b967d243 test both datastore and direct data load 2014-10-14 15:35:14 +02:00
Dennis Luxen 1fc1e9590a throw an exception instead of false asserts 2014-10-14 12:52:11 +02:00
Dennis Luxen 0a0099fb41 rename variable, break long lines 2014-10-14 12:49:50 +02:00
Dennis Luxen b890d394ad Add range based CRC32 computation for iterable objects 2014-10-13 18:18:15 +02:00
Dennis Luxen a7fd37ae76 make Descriptor classes final 2014-10-13 18:17:24 +02:00
Dennis Luxen 41fafae21d mark Plugin classes as final 2014-10-13 17:29:53 +02:00
Dennis Luxen a38c007f51 throw instead of assert(false) 2014-10-13 17:20:34 +02:00
Dennis Luxen c7ee402b0e make link tests less brittle, no overlapping paths 2014-10-13 14:56:17 +02:00
Dennis Luxen 1c19796e3e fix container.hpp to properly use std::next and std::end 2014-10-13 13:54:40 +02:00
Emil Tin 76fb0cb965 get process handling up to date 2014-10-13 11:19:49 +02:00
Dennis Luxen 23c79f5cc9 reformat StaticRTreeBench.cpp 2014-10-13 11:15:22 +02:00
Emil Tin 14eac50261 remove datastore test 2014-10-13 11:10:40 +02:00
Emil Tin cf3eae1c91 disable failing test 2014-10-13 10:58:03 +02:00
Emil Tin db06cdb4ce adjust datastore testing 2014-10-13 10:58:03 +02:00
Emil Tin 7ba8e51fa9 use osrm-database during testing 2014-10-13 10:58:03 +02:00
Dennis Luxen bc6466cc36 fix test to inlcude renamed headers 2014-10-13 09:45:07 +02:00
Dennis Luxen 4fbefaef9a catch an uncaught exception and give git revision in springclean tool 2014-10-13 09:42:47 +02:00
Dennis Luxen be11d3325d add mutex include 2014-10-10 19:38:59 +02:00
Dennis Luxen 274140d309 refactor SimpleLogger into simple_logger compile unit 2014-10-10 19:32:49 +02:00
Dennis Luxen ed960ccc8d refactor angle computation into class/compile unit 2014-10-10 18:47:28 +02:00
Dennis Luxen f2b72113c1 refactor ContainerUtil into container.hpp 2014-10-10 18:24:13 +02:00
Dennis Luxen 67a8d30e87 renamed file 2014-10-10 18:19:10 +02:00
Dennis Luxen dafd0e5db7 rewrite NumericUtils into floating_point.hpp 2014-10-10 18:18:56 +02:00
Dennis Luxen d6d10cbf06 reformat Coordinate class 2014-10-10 18:00:09 +02:00
Dennis Luxen 3d3ba86be4 Merge pull request #1212 from Project-OSRM/fix_997
implements and fixes #997: support base path for c'tor
2014-10-10 17:17:41 +02:00
Dennis Luxen 52ed8a7ed0 move springclean functionality in its own tools, remove from datastore 2014-10-10 16:55:24 +02:00
Dennis Luxen 9449c99e25 enable partitioning on LTO, good riddance GCC 4.7 2014-10-10 10:46:43 +02:00
Dennis Luxen 4c0846734e rework the population and checking of base paths 2014-10-10 10:41:06 +02:00
Dennis Luxen 4c64f5fe62 remove shared memory indicator member, use unique_ptr for barriers 2014-10-10 10:41:06 +02:00
Dennis Luxen 9455ea0547 fix initialization of use_shared_memory 2014-10-10 10:41:06 +02:00
Dennis Luxen c3b54a63c3 remove ServerPaths member from OSRM_impl. pass it by value to c'tor 2014-10-10 10:41:06 +02:00
Dennis Luxen b9e1d3116c implements and fixes #997
- ServerPaths object can be populated by passing base path to OSRM
- reduces code/functionality duplication in node-OSRM
2014-10-10 10:41:05 +02:00
Dennis Luxen 5bb7e62a7c fix test on 'some' Intel FPU 2014-10-10 10:36:24 +02:00
Dennis Luxen a443f3a0bb add barrier checkpoint to the white list of passable tags 2014-10-10 10:34:34 +02:00
Dennis Luxen 440244eed8 use double precision fp math for mercartor projection and point-line projections (for now), fixes #1191 2014-10-09 18:58:58 +02:00
Dennis Luxen 2b9e25300f disable checking for empty data sets to make tests pass in debug mode, #889 2014-10-09 17:27:41 +02:00
Dennis Luxen de264dbf94 untangle includes 2014-10-09 14:08:12 +02:00
Dennis Luxen 848b773e24 fix reloading of RTree from shared memory, potentially fixes a number of issue from #889 2014-10-08 19:20:15 +02:00
Dennis Luxen d92f022041 remove implicit inline keyword from header files 2014-10-08 14:47:51 +02:00
Dennis Luxen 57fab61789 move casts from/to string into static class 2014-10-08 14:47:22 +02:00
Dennis Luxen ec8f977ebe reformat StringUtil.h 2014-10-08 12:48:20 +02:00
Dennis Luxen 8dc85e7641 use C++11 type traits to reduce code size in integral->string conversion 2014-10-08 12:40:56 +02:00
Dennis Luxen 4e00ebcd74 Merge pull request #1211 from Project-OSRM/fix_1173
Fix and close #1173
2014-10-08 11:44:48 +02:00
Dennis Luxen 335e719b5d pick compressed edge-weights in correct order 2014-10-08 11:01:58 +02:00
Dennis Luxen 415f8ef2d8 add test-case for bug 2014-10-08 11:01:33 +02:00
Dennis Luxen 17615d1d4a Merge pull request #1209 from Project-OSRM/test/links
test link speeds
2014-10-07 18:08:23 +02:00
Emil Tin 5072252c72 test link speeds 2014-10-07 17:05:39 +02:00
Dennis Luxen 46e93770c9 Merge pull request #1208 from Project-OSRM/feature/surfaces
surface, tracktype, smoothness tags in car profile, closes #955, #1208, #389.
2014-10-07 15:11:55 +02:00
Emil Tin fe43734811 use nil for unlimited surface speeds 2014-10-07 13:50:53 +02:00
Emil Tin 0df81c49d5 surface, tracktype, smoothness tags in car profile 2014-10-07 10:43:47 +02:00
Dennis Luxen 5653516b32 traverse *_link roads at a significantly lower speed than the main link, fixes #1174 2014-10-06 13:42:30 +02:00
Dennis Luxen 22da5be08e Merge branch 'frodrigo-develop' into develop 2014-10-06 09:43:11 +02:00
Dennis Luxen 862656aecc Merge branch 'develop' of https://github.com/frodrigo/osrm-backend into frodrigo-develop 2014-10-06 09:42:55 +02:00
Frédéric Rodrigo ec119a6d52 Add test for maxspeed like 'countrycode:zone type' for car profile 2014-10-04 21:17:18 +02:00
Frédéric Rodrigo 6b98b5f4c7 Parse maxspeed value like FR:urban on car profile 2014-10-04 14:12:14 +02:00
Dennis Luxen 5effe95f2c reformat JSONContainer.h 2014-10-03 11:13:50 +02:00
Dennis Luxen f22e3fd3ff mark Renderer c'tors in JSONContainer as explicit 2014-10-03 11:02:28 +02:00
Dennis Luxen 0047040af9 encapsulate base64 encoding into class to remove static functions from global namespace 2014-10-03 10:38:37 +02:00
Dennis Luxen 60987e6b9b mark c'tors explicit 2014-10-03 10:27:24 +02:00
Dennis Luxen 27d5e2b219 fix include order 2014-10-03 10:23:21 +02:00
Dennis Luxen 53fd0c3a55 fix initialization of EdgeBasedGraphFactory 2014-10-03 10:21:15 +02:00
Dennis Luxen 63456a6d4f fix position of include guard 2014-10-03 10:19:45 +02:00
Dennis Luxen d4cd3c2f7b remove superflous include 2014-10-03 10:17:02 +02:00
Dennis Luxen dbf7137a1a fix include guard name 2014-10-03 10:15:03 +02:00
Dennis Luxen 785891c315 fix name of include guard 2014-10-03 10:03:44 +02:00
Dennis Luxen b7417ec954 fix name of include guard 2014-10-03 10:02:36 +02:00
Dennis Luxen 61b861f0e5 fix name of include guard 2014-10-03 10:01:24 +02:00
Dennis Luxen 0fea0738bf remove superflous inline keyword 2014-10-03 09:59:04 +02:00
Dennis Luxen 4f25d29815 use nullptr instead of NULL 2014-10-03 09:56:07 +02:00
Dennis Luxen 28302a5040 unique_ptr<T> should be unique_ptr<T[]> when used with array 2014-10-02 19:26:57 +02:00
Dennis Luxen 9cc5ca5c58 fix name of include guard 2014-10-02 19:24:43 +02:00
Dennis Luxen 4c4e60b3c9 fix name of include guard 2014-10-02 19:24:06 +02:00
Dennis Luxen 5689a96602 make c'tors of Descriptors explicit 2014-10-02 19:22:02 +02:00
Dennis Luxen 8b57db467a move c'tor should not take const argument 2014-10-02 19:19:52 +02:00
Dennis Luxen 50339e53e2 rename variable across all ifdef paths 2014-09-30 14:52:16 +02:00
Dennis Luxen bc9f5189a5 use irange based for loop in DouglasPeucker run 2014-09-30 14:42:55 +02:00
Dennis Luxen fee83fee40 rename short variable and reformat, OCLint 2014-09-30 14:30:15 +02:00
Dennis Luxen cd5112ab0e rename short variable, OCLint 2014-09-30 14:28:00 +02:00
Dennis Luxen a43b88f9a2 reformat 2014-09-30 14:22:11 +02:00
Dennis Luxen c20fd5dcaa fix short variable name, OCLint 2014-09-30 14:21:24 +02:00
Dennis Luxen f12e296c09 fix short variable name, OCLint 2014-09-30 14:19:49 +02:00
Dennis Luxen 9c3a572646 link unlocking tool against Threads 2014-09-29 16:59:09 +02:00
Dennis Luxen 6175faa9a4 Merge pull request #1202 from Project-OSRM/fix_1192
Fix and close #1192
2014-09-29 12:27:52 +02:00
Dennis Luxen af02fc6bbe add tests for ferry durations 2014-09-29 11:44:51 +02:00
Dennis Luxen cc0bbc42a2 add duration to backward speed, fixes #1192 2014-09-29 11:37:36 +02:00
Dennis Luxen fd747c7340 propagate Lua include dir when compile-checking Luabind, fixes #1196 2014-09-25 12:58:23 +02:00
Dennis Luxen bd33202972 make routing algorithm classes final 2014-09-24 16:03:52 +02:00
Dennis Luxen f6f0de0e38 pimpl OSRM lib with std::unique_ptr 2014-09-24 13:17:55 +02:00
Dennis Luxen 881041800b remove superflous include 2014-09-23 09:41:28 +02:00
Dennis Luxen 11f3ac16f6 add some formatting 2014-09-23 09:41:10 +02:00
Dennis Luxen 969bf95230 Merge pull request #1194 from Project-OSRM/better_luabind_check
better checking for luabind compilation, fixes some OSX woes
2014-09-19 17:08:39 +02:00
Dennis Luxen abc6b4180c better checking for luabind compilation, fixes some OSX woes 2014-09-19 16:33:24 +02:00
Dennis Luxen f74d762a92 Merge branch 'alex85k-luabind-check' into develop 2014-09-19 09:57:56 +02:00
Dennis Luxen f00892ed66 Merge branch 'luabind-check' of https://github.com/alex85k/Project-OSRM into alex85k-luabind-check 2014-09-19 09:57:43 +02:00
alex85k f14c6e6845 Auto-detect Lua compatible with installed Luabind 2014-09-18 23:34:51 +06:00
Dennis Luxen b1bbf2ef84 add relational operators 2014-09-18 11:10:23 +02:00
Dennis Luxen 201062cade make width of computation depend on base type, i.e. if its 64bit then use 64bit math 2014-09-18 10:19:40 +02:00
Dennis Luxen 8cb9198bcf allow a 64bit base type 2014-09-18 09:43:11 +02:00
Dennis Luxen f5e53c0452 make cast operators explicit 2014-09-18 09:42:38 +02:00
Dennis Luxen 41d9c00f70 FixedPointNumber implementation 2014-09-17 19:20:15 +02:00
Dennis Luxen b52f392c92 Merge branch 'srajkovic-stefan-rajkovic-multiple-nearest-points' into develop 2014-09-16 12:33:06 +02:00
Dennis Luxen efaa3b5ab2 Merge branch 'stefan-rajkovic-multiple-nearest-points' of https://github.com/srajkovic/osrm-backend into srajkovic-stefan-rajkovic-multiple-nearest-points
Conflicts:
	DataStructures/RouteParameters.cpp
	Server/APIGrammar.h
2014-09-16 12:32:40 +02:00
Dennis Luxen 36f3d8d6ac Merge pull request #1187 from Project-OSRM/upgrade_protobuf_appveyor
2nd try: upgrade to protobuf 2.5.0 on appveyor
2014-09-15 20:10:57 +02:00
Dennis Luxen e469afa4a9 upgrade to protobuf 2.5.0 on appveyor 2014-09-15 16:21:37 +02:00
Dennis Luxen 9d4b0caa5b fix #1181, uncompressed geometries regressed into array of strings 2014-09-15 14:27:27 +02:00
Dennis Luxen 392c07951e some renaming of member functions to remove ambiguity 2014-09-15 14:23:43 +02:00
Dennis Luxen 8e72c3d81e Merge pull request #1184 from Project-OSRM/cmake_object_library
use object libraries in cmake, bump cmake to 2.8.8+
2014-09-15 13:15:12 +02:00
Dennis Luxen 02428f1e06 add object library to benchmarks 2014-09-15 12:21:13 +02:00
Dennis Luxen b3aa513563 manually install cmake on Travis 2014-09-15 12:14:32 +02:00
Dennis Luxen b8b08cb114 use object libraries in cmake, bump cmake to 2.8.8+ 2014-09-15 11:34:55 +02:00
Dennis Luxen ebbbf1059d Revert "disable LUA 5.2", cf. #1179
This reverts commit 994bd0a910.
2014-09-15 10:24:44 +02:00
Dennis Luxen 37297076f8 Merge pull request #1177 from joto/patch-3
Add object_types to some tags.
2014-09-07 23:15:03 +02:00
Jochen Topf a75b2df6fe Add object_types to some tags.
The newest taginfo understand an `object_types` field to restrict the key/value to certain types of OSM objects.
2014-09-07 20:39:56 +02:00
Dennis Luxen 9ccd0f0282 bump variant version 2014-09-04 16:19:00 +02:00
Dennis Luxen e57d9f2e2e Merge pull request #1157 from Project-OSRM/fix/spelling_of_edge
fix spelling of 'edge'
2014-08-31 11:25:56 +02:00
Emil Tin cf593ba9f9 fix spelling of edge in SharedDataFacade 2014-08-31 09:09:12 +02:00
Dennis Luxen 9eb862a6a4 Merge pull request #1172 from joto/patch-2
Update taginfo.json
2014-08-25 22:07:08 +02:00
Jochen Topf bc84e08da5 Update taginfo.json 2014-08-25 21:55:07 +02:00
Dennis Luxen 24dae2f096 fix URL 2014-08-22 10:43:25 +02:00
Dennis Luxen ab24d6bd96 add JSON file for taginfo analysis 2014-08-22 10:42:43 +02:00
Dennis Luxen 7782c80c4f implement missing loading of TravelMode vector into shared memory 2014-08-22 10:31:47 +02:00
Dennis Luxen 994bd0a910 disable LUA 5.2 2014-08-22 10:31:47 +02:00
Stefan Rajkovic bc9dcba4d4 Removed unnecessary whitespace 2014-08-21 13:24:04 -04:00
Dennis Luxen 85c244ed08 Merge pull request #1166 from Project-OSRM/server_instance_unique_ptr
keep server instance in a shared_ptr
2014-08-21 19:22:37 +02:00
Stefan Rajkovic 495196193c Uses range based check for number of results 2014-08-21 13:19:05 -04:00
Stefan Rajkovic def1e5e1d8 Set restrictions on number of results possible, so 0 < number <= 100. 2014-08-21 13:15:13 -04:00
Dennis Luxen 2727091e47 Merge pull request #1154 from Project-OSRM/feature/travel_mode
travel mode, closes #569, #603 and #606. Great job!
2014-08-21 15:12:02 +02:00
Dennis Luxen d7fbd416ba fix expected values of backward speed in test 2014-08-21 12:18:19 +02:00
Dennis Luxen 6a09ce1613 fix comparison in car speed profile 2014-08-21 12:17:03 +02:00
Emil Tin 774e6346e7 more robust check for parsed ways 2014-08-20 17:10:40 +02:00
Dennis Luxen 05b939760c Revert "use more osrm::irange"
This reverts commit d6c6fbfe03.
2014-08-20 15:47:48 +02:00
Dennis Luxen d6c6fbfe03 use more osrm::irange 2014-08-20 15:34:10 +02:00
Dennis Luxen bb3cbf2dda fix indentation, remove superflous else clause 2014-08-20 14:01:40 +02:00
Dennis Luxen 39d96a45aa fix lambda syntax 2014-08-20 12:14:31 +02:00
Dennis Luxen 6a8c5c8869 fix typo 2014-08-20 11:57:46 +02:00
Dennis Luxen 96318bbe11 switch from unique to shared ptr 2014-08-20 11:57:31 +02:00
Emil Tin 00dd2463fd use lambda to decide turn value 2014-08-20 11:48:47 +02:00
Emil Tin bcd55626ef make accessors const, add comments 2014-08-20 11:37:47 +02:00
Dennis Luxen 8f8cb6a52f keep server instance in a unique_ptr 2014-08-20 11:24:29 +02:00
Emil Tin 2e3d33dfcd remove type from more structs, remove asserts 2014-08-20 11:08:59 +02:00
Emil Tin 1e40cd6f0b remove type assertion 2014-08-20 11:08:59 +02:00
Emil Tin 6e2608b2f2 fix cuke support file 2014-08-20 11:08:59 +02:00
Emil Tin 60d80cf261 code style fixes 2014-08-20 11:08:59 +02:00
Emil Tin 9c23fd4a31 remove accidentially added file 2014-08-20 11:08:59 +02:00
Emil Tin fccb1aad32 remove type attribute 2014-08-20 11:08:59 +02:00
Emil Tin 2780ff31b5 fix bug with mode of 1st instruction 2014-08-20 11:08:59 +02:00
Emil Tin c37c8dc21d add mode test 2014-08-20 11:08:59 +02:00
Emil Tin 6ee7a81f10 update foot profile, add ferry mode 2014-08-20 11:08:58 +02:00
Emil Tin 3d94638d86 update car profile, add ferry mode 2014-08-20 11:08:58 +02:00
Emil Tin 418ff95543 fix initialization order 2014-08-20 11:08:58 +02:00
Emil Tin 221113cbb7 fix assert 2014-08-20 11:08:58 +02:00
Emil Tin 13ea12cf6e fix unit test 2014-08-20 11:08:58 +02:00
Dennis Luxen 1945aae4dc reorder members of SegmentInformation, remove bit fields where possible 2014-08-20 11:08:58 +02:00
Emil Tin 30362cfc0c update lua interface to speed and mode 2014-08-20 11:08:58 +02:00
Emil Tin 6cdc590db5 typedef instead of enum for TravelMode to avoid gcc warnings 2014-08-20 11:08:58 +02:00
Emil Tin eb122a2b8c tidy feature file 2014-08-20 11:08:58 +02:00
Emil Tin feaf8711d3 announce mode changes 2014-08-20 11:08:58 +02:00
Emil Tin 6e364ff0ba rename travel mode None to Inaccessible 2014-08-20 11:08:58 +02:00
Emil Tin 6f6aff7493 remove direction field from ExtractionWay 2014-08-20 11:08:58 +02:00
Emil Tin 207cddd50b use enum for TravelMode 2014-08-20 11:08:58 +02:00
Emil Tin 35988d8f09 fix problem with mode of first instruction 2014-08-20 11:08:42 +02:00
Emil Tin bea63028c7 remove bitfield from SegmentInformation, works around compile err 2014-08-20 11:08:42 +02:00
Emil Tin 0244060806 add a few tests 2014-08-20 11:08:42 +02:00
Emil Tin bfdc296f43 reduce failing test 2014-08-20 11:08:42 +02:00
Emil Tin 8e625a5d07 rename test 2014-08-20 11:08:42 +02:00
Emil Tin 3460bd0ba9 fix problems with mode, 1 failing test left 2014-08-20 11:08:42 +02:00
Emil Tin 4dd0377eb8 fix compilation of tests 2014-08-20 11:08:42 +02:00
Emil Tin 6e1ab9fe3a profile fixes 2014-08-20 11:08:42 +02:00
Emil Tin 7a2d214cc4 reactivate assert of sizeof(NodeBasedEdgeData) 2014-08-20 11:08:42 +02:00
Emil Tin 62495a6de4 remove comment 2014-08-20 11:08:42 +02:00
Emil Tin 8ea88468f3 remove unneeded methods 2014-08-20 11:08:42 +02:00
Emil Tin 687892890b remove spurious comment 2014-08-20 11:08:42 +02:00
Emil Tin ff0dfacc48 fix initialization order to avoid compiler warning 2014-08-20 11:08:42 +02:00
Emil Tin 235a52032a more tests passing 2014-08-20 11:08:42 +02:00
Emil Tin a5ee7e78f6 fixes 2014-08-20 11:08:41 +02:00
Emil Tin 181dbe8493 improve tests for travel mode 2014-08-20 11:08:41 +02:00
Emil Tin dae9c9a7ed use 4 bits for travel mode 2014-08-20 11:08:41 +02:00
Emil Tin 6d6d299ea4 most tests passing 2014-08-20 11:08:41 +02:00
Emil Tin 6fd615b9cd first cut at porting travel mode, some tests fail 2014-08-20 11:08:41 +02:00
Emil Tin d09394ed52 add failing tests for travel mode 2014-08-20 11:08:41 +02:00
Emil Tin 3e6f27d173 rename contra_flow to travel_mode, use unsigned char 2014-08-20 11:08:41 +02:00
Dennis Luxen 82c2ae5441 first round of replacing deprecated typedefs with much nicer using statements 2014-08-19 13:01:38 +02:00
Dennis Luxen 7edf2bb2c2 Merge pull request #1164 from Project-OSRM/appveyor_nuget
Install protoc on both Travis and AppVeyor.
2014-08-19 11:00:23 +02:00
Dennis Luxen c9607b99a3 install protoc thru nuget 2014-08-19 10:11:32 +02:00
Dennis Luxen 2fe1a84dd4 adding protobuf compiler to dependencies, used in branches 2014-08-19 09:56:49 +02:00
Dennis Luxen c63218a889 add final/override keyword where possible to help compiler de-virtualize function calls 2014-08-18 10:19:33 +02:00
Dennis Luxen 5efa9664db Revert "fixing line endings"
This reverts commit dc75469e78.
2014-08-15 18:53:00 +02:00
Dennis Luxen dc75469e78 fixing line endings 2014-08-15 18:47:26 +02:00
Dennis Luxen 9d1e21b5ad Merge pull request #1104 from Project-OSRM/experimental/mapbox_variant
Experimental/mapbox variant
2014-08-14 18:57:53 +02:00
Dennis Luxen 27a367c733 enter build directory before calling tests 2014-08-14 17:29:11 +02:00
Dennis Luxen ffa0ace2a7 build tests by running msbuild on tests project file 2014-08-14 17:29:10 +02:00
Dennis Luxen 074e1e992c build test target explicitly on AppVeyor 2014-08-14 17:29:10 +02:00
Dennis Luxen cdd72c7e56 fast forward variant lib 2014-08-14 17:29:10 +02:00
Dennis Luxen a5e99a95a3 remove constexpr workaround as minimum req. is now Nov 2013 CTP 2014-08-14 17:29:10 +02:00
Dennis Luxen 1de736019d make canary static const instead of constexpr 2014-08-14 17:29:10 +02:00
Dennis Luxen d6b2712070 make msbuild less verbose 2014-08-14 17:29:10 +02:00
Dennis Luxen eda8f4ccec make integer literals static const instead of constexpr 2014-08-14 17:29:10 +02:00
Dennis Luxen 7e3f476407 use 64bit cmake generator 2014-08-14 17:29:10 +02:00
Dennis Luxen e10f36d5f0 use explicit OSRM.sln filename 2014-08-14 17:29:10 +02:00
Dennis Luxen 1bfd9abda3 replace nmake by msbuild 2014-08-14 17:29:10 +02:00
Dennis Luxen 4a1a10fde8 use Nov 2013 CTP to build 2014-08-14 17:29:10 +02:00
Dennis Luxen 4c3cb76ced remove remnants of boost::variant 2014-08-14 17:29:10 +02:00
Dennis Luxen e2794e9f06 initial checkin of mapbox::util::variant 2014-08-14 17:29:10 +02:00
Dennis Luxen 7d2c627ad2 replace boost::variant w/ mapbox::util::variant 2014-08-14 17:29:10 +02:00
Dennis Luxen b310e0f718 apply some reformatting 2014-08-14 17:12:58 +02:00
Dennis Luxen 18915ae2bd make dummy __get_cpuid available on Windows 2014-08-14 17:12:58 +02:00
Dennis Luxen 5dbda8f519 refactoring of IteratorBasedCRC32, fixes #1140 2014-08-14 17:12:58 +02:00
Dennis Luxen 82ce9dfc04 reactivate software-based CRC32 on x64 platforms without SSE4.2 2014-08-14 17:12:57 +02:00
Dennis Luxen ad5cd564ab even more reformatting 2014-08-13 16:11:56 +02:00
Dennis Luxen 6f01f580ca fix several errors reported by OCLint:
- rename variable with short name
- fix inverted logic
- rename members in SpeedProfile
2014-08-13 11:02:36 +02:00
Dennis Luxen d5130d9fe4 reformatting DescriptionFactory.cpp 2014-08-13 11:02:36 +02:00
Dennis Luxen 0341a0d5e7 reformatting DescriptionFactory.cpp 2014-08-12 19:29:54 +02:00
Dennis Luxen 32191fb05a also build tests on Travis 2014-08-12 16:17:27 +02:00
Dennis Luxen 1592fe377a Merge pull request #1150 from Project-OSRM/feature/announce_via_locations
implements announcement of waypoints, closes #584
2014-08-12 11:49:51 +02:00
Dennis Luxen 5add28410f Adapt test cases to output of way points
- waypoints are now announced in the route guidance
- implements #584
2014-08-12 09:27:17 +02:00
Dennis Luxen d54a55c12b implements announcement of waypoints, closes #584 2014-08-11 20:29:15 +02:00
Dennis Luxen aab5e8430f ignore package related files 2014-08-11 16:16:56 +02:00
Dennis Luxen 2e20fdb462 allow building of packages 2014-08-11 16:16:56 +02:00
Dennis Luxen 2ac3da7a90 update minimum compiler to gcc 4.8, take 2 2014-08-11 09:42:29 +02:00
Dennis Luxen 399b79bab2 update minimum compiler to gcc 4.8 2014-08-11 09:39:35 +02:00
Stefan Rajkovic b9eb936cac Uses current JSON format if number of results requested is 1 2014-08-08 14:06:06 -04:00
Stefan Rajkovic 38117df11b Added ability to get multiple points from /nearest by using num_results argument 2014-08-08 13:58:30 -04:00
Dennis Luxen 27d729baf0 use a return value in Prepare::BuildEdgeExpandedGraph instead of parameter re-assignment 2014-08-08 13:00:39 +02:00
Dennis Luxen d408a64c8c rename variable to have a longer, more telling name in Prepare 2014-08-08 12:41:57 +02:00
Dennis Luxen 9aeb28066d fix inverted logic 2014-08-07 19:19:21 +02:00
Dennis Luxen 6fb7c8687e fixes #1107, turn restriction combination including overlaps and one-ways 2014-08-07 18:34:56 +02:00
Dennis Luxen d9666008e3 remove left-over debug output 2014-08-07 18:17:35 +02:00
Dennis Luxen e132230651 add some minor comments to Range 2014-08-07 17:39:53 +02:00
Dennis Luxen c2877a0c22 use std::shared_ptr instead of raw ptr 2014-08-07 13:40:43 +02:00
Dennis Luxen 251fc3ec68 apply some more constness 2014-08-07 12:02:57 +02:00
Dennis Luxen 287f0a3b68 minor edit 2014-08-07 12:01:32 +02:00
Dennis Luxen b03d9fe987 replace INT_MAX by proper typedef 2014-08-07 12:01:31 +02:00
Dennis Luxen 98372ef33f replace boost::irange in Tools 2014-08-05 18:06:15 +02:00
Dennis Luxen d00f4afb84 replace C limits with STL-defined and typedef'ed limits 2014-08-05 17:20:01 +02:00
Dennis Luxen d4bf02c882 replace boost integer range 2014-08-05 17:19:09 +02:00
Dennis Luxen 284e671163 add convenience class for integer range 2014-08-04 17:27:34 +02:00
Dennis Luxen 0f112e5c9d untangle includes 2014-08-04 13:23:37 +02:00
Dennis Luxen 759449b4be remove an unneeded check in JSONDescriptor 2014-08-01 15:59:45 +02:00
Dennis Luxen 9c03f919a3 Merge pull request #1138 from dmbreaker/fix/alter_route_end
Fixes alternative route end-point (http://imgur.com/ZQhwTZi)
2014-07-31 17:07:08 +02:00
Dennis Luxen c9afd9a281 make dummy date in generated test files valid 2014-07-31 16:41:38 +02:00
dmbreaker a999cb9db9 Fixes alternative route end-point (http://imgur.com/ZQhwTZi) 2014-07-31 16:10:02 +04:00
Dennis Luxen fdc5bd6195 add try catch, fixes coverity issues 1229132 and 1229133 2014-07-30 11:28:36 +02:00
Dennis Luxen e1d94eee21 Merge branch 'Zhdanovich-scc_develop' into develop 2014-07-30 09:42:55 +02:00
Kirill Zhdanovich 885f237217 Apply diff https://github.com/Project-OSRM/osrm-backend/pull/1133 to develop branch 2014-07-29 22:12:59 +02:00
Dennis Luxen 5860a4e28e clear external vector after use, closes #1131 2014-07-28 16:15:21 +02:00
Dennis Luxen 2bebed44ff use stxxl as external data store instead of hand-rolled code in /tmp 2014-07-28 15:58:50 +02:00
Dennis Luxen 4990e544cf add a distinct tool to check if hsgr file is valid, closes #1081 2014-07-28 14:51:33 +02:00
Dennis Luxen 8010506d4e remove reverted include 2014-07-28 14:20:17 +02:00
Dennis Luxen f2f7abb9a8 remove reverted include 2014-07-28 14:19:16 +02:00
Dennis Luxen 85f6ab869e Revert "let ServerFactory return unique ptr instead of raw ptr"
This reverts commit cc7c6b9ece.
2014-07-28 14:08:54 +02:00
Dennis Luxen fc87b0a11e enabling defaultctor for Server 2014-07-28 12:04:11 +02:00
Dennis Luxen 79bc071754 enabling default copy ctor for Server 2014-07-28 11:24:49 +02:00
Dennis Luxen 797243fc9c return unique ptr instead of raw ptr 2014-07-28 11:03:53 +02:00
Dennis Luxen cc7c6b9ece let ServerFactory return unique ptr instead of raw ptr 2014-07-28 10:15:22 +02:00
Dennis Luxen 279071e5bb re-add pairwise container traversal 2014-07-28 10:14:24 +02:00
Dennis Luxen 426374ff8a register all classes at once in LUA environment 2014-07-24 18:26:40 +02:00
Dennis Luxen 1508874ebc return early if way is not either highway=* or route=* in car profile. Estimated cost saving 10% 2014-07-24 18:00:37 +02:00
Dennis Luxen bbe440cacd fix implcit conversion in DynamicGraph 2014-07-24 11:29:03 +02:00
Dennis Luxen e647e73af9 fix implcit conversion in RestrictionMap 2014-07-24 11:25:43 +02:00
Dennis Luxen 696ddfde0e mark temporaries const 2014-07-24 11:23:33 +02:00
Dennis Luxen 37d6257524 fix implicit conversion in TemporaryStorage 2014-07-24 11:23:03 +02:00
Dennis Luxen faee894052 add a couple of consts to range based for loops 2014-07-24 10:15:04 +02:00
Dennis Luxen 61f16b8c5e remove code duplication 2014-07-24 09:56:20 +02:00
Dennis Luxen 85eb38e755 reformatting code according to guidelines 2014-07-23 19:28:04 +02:00
Dennis Luxen a87cf60dfc move common code into Util header 2014-07-23 19:25:09 +02:00
Dennis Luxen 3b135447f3 use typedef Edgeweight instead of raw int 2014-07-23 14:50:45 +02:00
Dennis Luxen 0c3713f7e5 Merge branch 'TheMarex-boost-test' into develop 2014-07-22 18:55:33 +02:00
Patrick Niklaus 4d0571fd73 Fix win32 linking and run test automatically in AppVayor 2014-07-22 18:23:43 +02:00
Patrick Niklaus 4722988bf0 Try including typedefs 2014-07-22 17:17:56 +02:00
Patrick Niklaus 61151535e6 Fix include in RangeTableTest 2014-07-22 17:17:56 +02:00
Patrick Niklaus bcff6c192c Remove template paramters and constexpr in test
Stops clang from complaining about non-constexpr.
2014-07-22 17:17:56 +02:00
Patrick Niklaus 020d0cfb49 Revert "Change StaticRTree serialization constructor to static function"
This makes clang 3.4 crash on ubuntu because it can not handle lambda
expressions + binding in static member functions correctly.

This reverts commit d6dd6693b18e042c0068da579dcc64d1e5a2e002.
2014-07-22 17:17:56 +02:00
Patrick Niklaus d38e3bd729 Add tests and benchmarks to appveyor 2014-07-22 17:17:56 +02:00
Patrick Niklaus 84a604f70b Add test for new GetMinDist 2014-07-22 17:17:56 +02:00
Patrick Niklaus 782baf54a3 Remove perpendicular distance call
Since we know that the MBB is axis aligned we can compute
the distance to the line segments a lot simpler.
2014-07-22 17:17:56 +02:00
Patrick Niklaus d754e4eeca Add benchmark for StaticRTree
Build with 'make benchmarks'
2014-07-22 17:17:56 +02:00
Patrick Niklaus db98f6191e Prepare alrady writes the correct number of nodes 2014-07-22 17:17:56 +02:00
Patrick Niklaus b453a42f77 Fixed perpendicular distance calculation of segment endpoint is on equator 2014-07-22 17:17:56 +02:00
Patrick Niklaus 2a6585e664 Add regression test for 'gap' querry bug 2014-07-22 17:17:56 +02:00
Patrick Niklaus bc013925b8 Consider points on the edge of the rectangle as inside 2014-07-22 17:17:56 +02:00
Patrick Niklaus 8108ecc4d3 Add test for StaticRTree 2014-07-22 17:17:56 +02:00
Patrick Niklaus 1c80584206 Fix GetMinDistance 2014-07-22 17:17:56 +02:00
Patrick Niklaus a3dd9c3e57 Change StaticRTree serialization constructor to static function
Since the constructor does not satisfy the requirements for a
constructor (the RTree is not properly initialized) make it a
static function instead.
2014-07-22 17:17:56 +02:00
Patrick Niklaus 8f05fc0a84 Make tuning constants template agruments in StaticRTree 2014-07-22 17:17:56 +02:00
Patrick Niklaus 3c4feecda0 Make fstream non-static and StaticRTree thread-specific instead 2014-07-22 17:17:56 +02:00
Patrick Niklaus e776a51c73 Added test for StaticGraph 2014-07-22 17:17:56 +02:00
Patrick Niklaus 129e8ef98a Fix small errors in StaticGraph 2014-07-22 17:17:56 +02:00
Patrick Niklaus 69134f6d6a Add test for RangeTable 2014-07-22 17:17:56 +02:00
Patrick Niklaus b32062f875 Fix typo in RangeTable 2014-07-22 17:17:56 +02:00
Patrick Niklaus 8d46ee85f1 Add test for BinaryHeap 2014-07-22 17:17:56 +02:00
Patrick Niklaus 9f9fde1f2b Fix missing include in BinaryHeap 2014-07-22 17:17:56 +02:00
Emil Tin 2b041e09ac tests uturn query param 2014-07-22 13:24:26 +02:00
Emil Tin 73b32bb45e enable setting query params in cuke tests 2014-07-22 13:24:26 +02:00
Dennis Luxen 11e6e74f09 fix implicit conversion 2014-07-22 12:56:24 +02:00
Dennis Luxen bf3e3f0c3d fix segfault when index into packed geometry ran out of bounds 2014-07-22 11:59:31 +02:00
Dennis Luxen 2656acc321 produce stack trace if script fails during setup. partially implements #1128 2014-07-21 15:46:19 +02:00
Dennis Luxen e46c9be79f dont fail if script does not define member 2014-07-21 15:44:57 +02:00
Dennis Luxen 507167d5c1 use 64bit int types to not lose precision in for loop counting variables 2014-07-21 13:14:05 +02:00
Dennis Luxen fc90162f69 fix typo, thx @joto, see #1126 2014-07-21 10:55:13 +02:00
Dennis Luxen 1e8fb7a38c Updated README to reflect new location 2014-07-21 10:50:41 +02:00
Dennis Luxen afb6c5a09d comparison between signed and unsigned integer expressions 2014-07-18 13:58:37 +02:00
Dennis Luxen 2255ab0a37 remove unneede include 2014-07-18 11:38:05 +02:00
Dennis Luxen a6ab042078 use parallel sorting for DeallocatingVector 2014-07-18 11:37:07 +02:00
Dennis Luxen 480f70c049 fix down-sizing in resize operation 2014-07-18 11:20:27 +02:00
Dennis Luxen 0592897859 rework assignment/copy operator, add operator[] to DeallocatingVector RA-iterator 2014-07-18 10:59:46 +02:00
Dennis Luxen d5a9f8e177 refactor DeallocatingVector, apply boost::iterator_facade 2014-07-17 18:26:14 +02:00
Dennis Luxen 5840829cdc refactor DeallocatingVector, apply boost::iterator_facade 2014-07-17 18:25:23 +02:00
Dennis Luxen fd0946b770 remove unneeded includes, fix variable names 2014-07-17 14:14:14 +02:00
Dennis Luxen 293b462fd2 add timing to SCC generation 2014-07-17 11:27:06 +02:00
Dennis Luxen 3db50fdd54 rename variables in SCC class, add const to variables, reformat 2014-07-17 11:16:26 +02:00
Dennis Luxen 1540e6518c rename variables in SCC class to be more legible 2014-07-17 11:07:35 +02:00
Dennis Luxen 8b30c13cd9 make sure edges are put into shapefile once and only once. 2014-07-17 10:48:30 +02:00
Dennis Luxen a7eb89b2f0 reformat SCC class, make sure road distances are not counted twice 2014-07-17 10:43:21 +02:00
Dennis Luxen 53c102e1e9 use boost::irange and range based for loop in // for (NodeID node = 0; node < last_node; ++node) 2014-07-17 10:30:56 +02:00
Dennis Luxen 7d90737921 remove zombie code from StronglyConnectedComponents.h 2014-07-17 10:27:47 +02:00
Dennis Luxen e281f88f2e remove zombie code from StronglyConnectedComponents.h 2014-07-17 10:27:23 +02:00
Dennis Luxen 16c5c7bbb4 set projection to EPSG:4326 for created shapefile 2014-07-17 10:26:27 +02:00
Dennis Luxen 7d4dfd87f1 add c'tor to TarjanEdgeData, use emplace_back in-place construction of edges 2014-07-17 10:25:39 +02:00
Dennis Luxen 6156bf0f9d make uturn parameter optional 2014-07-16 13:01:25 +02:00
Dennis Luxen ee1fdca52e implement path query with uturns at via nodes 2014-07-16 12:53:33 +02:00
Dennis Luxen 95b5bcbd49 add and parse U-turn parameters in servers APIGrammar 2014-07-16 12:48:11 +02:00
Dennis Luxen 0c529361a3 add member variable/functions to store information if uturns are allowed 2014-07-16 12:47:10 +02:00
Dennis Luxen 7110acc94f add initialization to QueryEdge::EdgeData 2014-07-16 09:44:09 +02:00
Dennis Luxen 1188002bcb downcast position explicitly to unsigned 2014-07-15 16:48:04 +02:00
Dennis Luxen b47a3f15ce fix initialization on Windows, i.e. cannot convert from bool to bool& 2014-07-15 15:37:30 +02:00
Dennis Luxen 695a2a2b6e use correctly sized 64bit integer and avoid unintended (implicit up/down casts) 2014-07-15 15:25:44 +02:00
Dennis Luxen c8b4ef3eed add two tests for turn restrictions starting/ending on the same segment 2014-07-15 15:10:13 +02:00
Dennis Luxen 6091248493 fix range initialization on Windows 2014-07-15 15:06:34 +02:00
Dennis Luxen 32fd507ad9 apply more emplace_backs and range based for loops to Contractor 2014-07-15 12:06:52 +02:00
Dennis Luxen 0ee77a37d1 make DynamicGraph::InputEdge c'tor variadic, forward args to EdgeData type 2014-07-15 11:50:08 +02:00
Dennis Luxen 05241544c5 make DeallocatingVector::emplace_back variadic and forward Args to contained element 2014-07-15 11:47:58 +02:00
Dennis Luxen 495c872489 add c'tors to QueryEdge and its EdgeData 2014-07-15 11:46:26 +02:00
Dennis Luxen 8c09edfdbd add minor reformatting 2014-07-15 11:42:27 +02:00
Dennis Luxen 67722cf788 make c'tor of DynamicGraph::InputEdge variadic to be more flexible against changing EdgeData types 2014-07-14 17:35:26 +02:00
Dennis Luxen 8e3484b873 rename ContractorEdgeData members 2014-07-14 17:35:02 +02:00
Dennis Luxen 4622aebabb reorder members for potentially tighter alignment 2014-07-14 17:31:50 +02:00
Dennis Luxen 96f29c27cd make c'tor of StaticGraph::InputEdge variadic to be more flexible against changing EdgeData types 2014-07-14 17:16:28 +02:00
Dennis Luxen 3de98f7a9d prevent in-source builds 2014-07-14 16:21:16 +02:00
Dennis Luxen 2b33fcd92d add c'tor to InputEdge of StaticGraph 2014-07-14 14:49:53 +02:00
Dennis Luxen b1ffcd4350 rename member to distance 2014-07-14 14:44:24 +02:00
Dennis Luxen fd500001fb Revert "also build tools on Windows"
This reverts commit 54a757a917.
2014-07-14 14:43:07 +02:00
Dennis Luxen 54a757a917 also build tools on Windows 2014-07-14 14:35:51 +02:00
Dennis Luxen 98dfc218d9 install tools if activated 2014-07-11 15:25:26 +02:00
Dennis Luxen f6f0f1fb72 fix signed/unsigned comparison in assertion 2014-07-11 14:04:09 +02:00
Dennis Luxen 218c810860 rename variable in XMLParser to make sure its name reflects the actual content 2014-07-11 14:03:38 +02:00
Dennis Luxen c836b6df3b fix SCC computation in debug mode by clearing a vector 2014-07-11 14:01:28 +02:00
Dennis Luxen 637bab29c6 transform negative numbers to positives by *(-1) 2014-07-11 14:00:33 +02:00
Dennis Luxen 0061b3fcbf remove unneeded member in Extractor, move to function scope 2014-07-11 10:10:50 +02:00
Dennis Luxen 2a19ded9d5 reformat Prepare.h/cpp with clang-format 2014-07-10 15:24:30 +02:00
Dennis Luxen bda9de0775 use boost::irange and range based for loop 2014-07-10 15:22:02 +02:00
Dennis Luxen 7047610a45 header untangling 2014-07-10 15:17:57 +02:00
Dennis Luxen 903d6f9e12 make instance of Prepare object an rvalue, remove dead code 2014-07-10 15:08:55 +02:00
Dennis Luxen 7d61bb2868 Merge branch 'dmbreaker-feature/prepare' into develop 2014-07-10 15:07:24 +02:00
Dennis Luxen def7164cad Merge branch 'feature/prepare' of https://github.com/dmbreaker/Project-OSRM into dmbreaker-feature/prepare 2014-07-10 15:07:15 +02:00
Dennis Luxen fc399e01fe explicitly cast segment length from float to int 2014-07-10 15:06:20 +02:00
Dennis Luxen ffdc3eee2d use proper float literal instead of implicit cast from int 2014-07-10 15:01:38 +02:00
Dennis Luxen 1f6f44ab01 include untangling of Extractor 2014-07-10 14:45:59 +02:00
Dennis Luxen 19740758c9 Merge branch 'dmbreaker-feature/extractor' into develop 2014-07-10 14:32:20 +02:00
Dennis Luxen f618660d24 Merge branch 'feature/extractor' of https://github.com/dmbreaker/Project-OSRM into dmbreaker-feature/extractor 2014-07-10 14:32:09 +02:00
Dennis Luxen f50dbe298a properly initialize variable 2014-07-10 14:03:20 +02:00
Dennis Luxen c324fbace4 path searches were pruned too early, fixes #1117 2014-07-10 13:56:36 +02:00
Dennis Luxen d05152af71 Merge pull request #1109 from DennisOSRM/fix/update_rspec_style
update rspec matchers to use expect()
2014-07-05 15:40:37 +02:00
Dennis Luxen bf228b4ae4 fix integer range to have correct end 2014-07-04 17:41:56 +02:00
Dennis Luxen ba0c17e287 make sure all node-based edges are serialized in forward fashion 2014-07-04 17:33:18 +02:00
Dennis Luxen 6cfbd4cefe fix unpacking of local path 2014-07-04 17:31:22 +02:00
Dennis Luxen e17a2e79a0 use range based for w/ integer ranges where possible 2014-07-04 17:23:45 +02:00
Dennis Luxen 72d709ae6c use explicit NodeID type in SharedDataFacade 2014-07-04 17:20:04 +02:00
Dennis Luxen 08ca450c40 change simplified graph loader to return a list of coordinates 2014-07-04 17:19:01 +02:00
dmbreaker a2951659ac prepare.cpp refactoring 2014-07-03 15:29:15 +04:00
dmbreaker 3a6af3810f One more blank line. 2014-07-03 10:23:43 +04:00
dmbreaker 3973554f07 Added blank lines between includes. 2014-07-03 10:23:43 +04:00
dmbreaker 718cba2e36 Trying to fix win-build 2014-07-03 10:23:43 +04:00
dmbreaker d2a70d1504 Removed pragma, reorganized includes. 2014-07-03 10:23:43 +04:00
dmbreaker 4bc847ac42 extractor.cpp refactored a bit 2014-07-03 10:23:43 +04:00
Dennis Luxen c3621edf9c refactor DynamicGraph to use integer ranges where possible 2014-07-02 16:58:19 +02:00
Dennis Luxen a64f2de9e1 add function to add a node into DynamicGraph 2014-07-02 15:27:09 +02:00
Dennis Luxen ce684cf9d4 fixes #1110, linker issues on CentOS 2014-07-02 14:38:02 +02:00
Dennis Luxen 1d1be10f16 add functions to load graph into simplified data structures 2014-07-02 14:36:20 +02:00
Dennis Luxen a09f97c9d5 remove OpenMP library linking 2014-07-02 14:34:44 +02:00
Dennis Luxen 48da2d2dfb add some comment to datastore 2014-07-02 11:21:34 +02:00
Dennis Luxen 36c0edea2a collapse if statement in datastore 2014-07-02 11:18:45 +02:00
Dennis Luxen 3568dc2083 use auto keyword to make code more legible 2014-07-02 11:07:29 +02:00
Dennis Luxen 51ad72a432 remove superflous include 2014-07-02 11:06:55 +02:00
Dennis Luxen 9ce970df8f use default keyword to get rid of compiler warning of not returning a value in a non-void function 2014-07-01 16:51:18 +02:00
Dennis Luxen cfa4d80dd7 make comparion of loop safe against underflows 2014-07-01 16:30:05 +02:00
Dennis Luxen 885cd05f1a fix data race in SimpleLogger by making state indicator variable atomic 2014-07-01 16:15:56 +02:00
Dennis Luxen 21188725d5 apply a bit of code refactoring to SCC implementation 2014-07-01 15:16:41 +02:00
Dennis Luxen 70f257b62f add BUILD_TOOLS flag, retire WITH_TOOLS soon 2014-07-01 15:16:41 +02:00
Dennis Luxen e8fb8e13df deactivate unused code 2014-07-01 15:16:41 +02:00
Dennis Luxen 7b7b93e9ba remove debug.bin generation 2014-07-01 15:16:41 +02:00
Dennis Luxen 4014da3cc5 make facade d'tors virtual 2014-07-01 14:26:29 +02:00
Dennis Luxen 410120adee close LUA context to avoid memory leak on shutdown 2014-07-01 14:26:02 +02:00
Dennis Luxen a98e65aa1e make variables const 2014-07-01 13:27:08 +02:00
Emil Tin dba9998118 update rspec matchers to use expect() 2014-06-30 20:43:51 +02:00
Dennis Luxen 1c75ce5911 reformat according w/ clang-format 2014-06-30 19:25:45 +02:00
Dennis Luxen 33b30aeb95 Merge branch 'fix/shared_mem_warnings' into develop 2014-06-30 19:23:30 +02:00
Dennis Luxen abd8d3459a Merge branch 'develop' into fix/shared_mem_warnings 2014-06-30 19:23:15 +02:00
Dennis Luxen 471698c59f fix picking of second route name 2014-06-30 16:05:26 +02:00
Dennis Luxen e67cf578ae remove explicit c'tor from Coordinate, use initializer list in PolylineCompressor 2014-06-30 15:16:35 +02:00
Dennis Luxen 186ad5d444 stream-line code in PolylineCompressor, apply range-based for loop again 2014-06-30 15:10:28 +02:00
Emil Tin 7eb810c34a fix shared mem warnings 2014-06-30 13:01:59 +02:00
Dennis Luxen 7817384e3c remove debug call 2014-06-30 11:53:36 +02:00
Dennis Luxen 34256ba358 properly compute sharing of nodes in search space with packed shortest path 2014-06-27 19:41:40 +02:00
Dennis Luxen 08eb5aa7d1 use shrink_to_fit() instead of swap trick 2014-06-27 19:40:47 +02:00
Dennis Luxen 1d3932e8c5 fix an off-by-one issue in the output JSON 2014-06-27 16:18:38 +02:00
Dennis Luxen 3f85b30d4a remove some unneeded includes 2014-06-27 10:38:28 +02:00
Dennis Luxen e4c398aa23 make std::hash specialization for std::pair<> fully generic 2014-06-27 09:50:57 +02:00
Dennis Luxen f9417555d0 remove superflous include 2014-06-27 09:50:26 +02:00
Dennis Luxen 5d3123b97f reformat code using clang-format 2014-06-26 13:50:29 +02:00
dmbreaker 25080aaf1d Non-explicit constructor and hash-functions. 2014-06-26 13:50:29 +02:00
dmbreaker 05ac4b5ab6 Fixes to fulfill remarks. 2014-06-26 13:50:29 +02:00
dmbreaker 07e13e2499 Replaced std::pair with classes.
Looks like fixed wrong restriction type in CheckForEmanatingIsOnlyTurn (now RestrictionTarget instead if RestrictionSource).
2014-06-26 13:50:29 +02:00
dmbreaker 2d9645b9b0 Added structures for RestrictionTarget and RestrictionSource. 2014-06-26 13:50:29 +02:00
Dennis Luxen 65ccbedab2 Merge pull request #1103 from dmbreaker/feature/graph_comments
Added some graphical explanations for variables.
2014-06-26 12:16:44 +02:00
Dennis Luxen 631567864b Merge pull request #1098 from TheMarex/rangetable-covertity
Fix coverity warning in RangeTable
2014-06-26 12:15:35 +02:00
Dennis Luxen 39d479128c add better comment to document the source of the hash_combine work 2014-06-26 12:14:47 +02:00
Dennis Luxen 4c0b315c07 Merge pull request #1094 from gberaudo/fixes
Several fixes: remove dead code, fix Int->String conversion for INT_MIN, remove duplicated coordinate from encoded polyline.
2014-06-26 11:54:45 +02:00
dmbreaker 264e83a1f3 Added comments with graphical representation of variables. 2014-06-26 12:31:45 +04:00
Dennis Luxen 2b2ed50721 add a hash combine implementation that has some minor performance guarantees 2014-06-25 18:50:46 +02:00
Dennis Luxen 31fbf99109 fail hard when building tools and not all prequisites are met 2014-06-25 10:53:51 +02:00
Dennis Luxen 63381ad221 fix compilation on GCC 4.8.2, type of priority_queue<> is not properly deduced 2014-06-24 18:31:34 +02:00
Guillaume Beraudo 6ee2d1103e Remove duplicated point in polyline encoded data
First point was outputted twice.
Add test case.
2014-06-24 17:25:36 +02:00
Guillaume Beraudo bee18dba54 Display warning when routing without street names.
Indeed, street names are optional for routing.
2014-06-24 17:18:52 +02:00
Guillaume Beraudo 481e445e8a Fix printInt when value=INT_MIN (was overflowing) 2014-06-24 17:18:52 +02:00
Guillaume Beraudo 129f7b7441 Remove unused polyline method 2014-06-24 17:18:52 +02:00
Guillaume Beraudo d6bc3c5175 Remove unused test method 2014-06-24 17:18:52 +02:00
Dennis Luxen de7c56c6bc remove remaining NULL pointers by nullptrs 2014-06-24 16:50:00 +02:00
Dennis Luxen 0c59ecfa14 remove dead code, produce empty route when origin and destination are the same 2014-06-24 16:09:25 +02:00
Patrick Niklaus f67241a3cb Fix coverity warning in RangeTable 2014-06-24 13:26:27 +02:00
Dennis Luxen 3b2893944c remove non-existing dependency 2014-06-24 12:45:16 +02:00
Dennis Luxen dd7d6df4c6 streamline PBF parsing code 2014-06-24 12:25:19 +02:00
Dennis Luxen efbda436f3 properly cast from int to bool 2014-06-24 11:46:32 +02:00
Dane Springmeyer 2064934939 link -lrt to osrm-prepare 2014-06-23 16:02:58 -07:00
Dennis Luxen b36cf7c450 remove debug output 2014-06-23 17:34:20 +02:00
Dennis Luxen a24dd3dee2 use incremental NN query for Nearest plugin 2014-06-23 17:33:55 +02:00
Dennis Luxen 7b22f08869 remove dead code 2014-06-23 17:32:52 +02:00
Dennis Luxen 840929754a remove debug output 2014-06-23 17:32:24 +02:00
Dennis Luxen 51fd332806 add incremental query to Facades 2014-06-23 16:56:01 +02:00
Dennis Luxen 4d7e0f6b79 use incremental NN query for distance table generation 2014-06-23 16:55:38 +02:00
Dennis Luxen b74a573ec5 add typedef for an array of phantom node vectors 2014-06-23 16:54:57 +02:00
Dennis Luxen 5faf88afdb implement incremental NN query for R-tree 2014-06-23 16:54:31 +02:00
Dennis Luxen 5e1110930e use proper floating point literal instead of implicit cast from int 2014-06-23 14:42:37 +02:00
Dennis Luxen f11adf5f80 fix signed/unsigned comparison 2014-06-23 14:35:09 +02:00
Dennis Luxen 40a71e09a6 use an explicit downcast to initialize variable 2014-06-23 13:22:46 +02:00
Dennis Luxen 1231847a3c replace hashmap with a dummy vector based implementation as the number of tags per object is tiny 2014-06-23 13:22:14 +02:00
Dennis Luxen b06a73e893 replace hashmap with a dummy vector based implementation as the number of tags per object is tiny 2014-06-23 13:21:56 +02:00
Dennis Luxen f99f194927 use proper interface of HashTable, use prefix increment 2014-06-23 12:13:01 +02:00
Dennis Luxen eac7d07ef6 rename variables to cut OCLint warnings 2014-06-23 12:11:56 +02:00
Dennis Luxen 60d70a9f4c fix leak on shutdown 2014-06-20 17:32:20 +02:00
Dennis Luxen c944783590 don't downcast from std:.size_t to unsigned 2014-06-20 17:32:03 +02:00
Dennis Luxen 8104a8aea1 reformat to cut long line 2014-06-20 16:49:33 +02:00
Dennis Luxen a4db678895 reformat to cut long line 2014-06-20 16:48:34 +02:00
Dennis Luxen da33d02461 reformat to cut long line 2014-06-20 16:47:09 +02:00
Dennis Luxen 9b4071006e reformat to cut long line 2014-06-20 16:39:58 +02:00
Dennis Luxen b3cdd5b3bf reformat to cut long line 2014-06-20 16:36:15 +02:00
Dennis Luxen 93e53ec612 fix comparison to accept 0 distance results in distance table 2014-06-19 19:52:15 +02:00
Dennis Luxen ea8319e2b9 add more asserts to test for data corruption during MBR merging in StaticRTree 2014-06-19 17:52:59 +02:00
Dennis Luxen 2fae253c62 use std::size_t consistently and avoid possible loss of data 2014-06-19 11:14:28 +02:00
Dennis Luxen e204b257ad add proper size_t->unsigned cast 2014-06-19 10:40:24 +02:00
Dennis Luxen dd83d8ed61 make size of table compact 2014-06-19 10:40:04 +02:00
Dennis Luxen 61f3d85af1 add even more cast sanity 2014-06-18 11:49:01 +02:00
Dennis Luxen 804e515847 stream line code a bit in Reply 2014-06-18 11:25:56 +02:00
Dennis Luxen 35977b6c7f add explicit cast 2014-06-18 11:24:50 +02:00
Dennis Luxen 23f1d3d83b add explicit cast 2014-06-18 11:20:24 +02:00
Dennis Luxen b8ea935424 cast bearing to unsigned 2014-06-18 11:17:51 +02:00
Dennis Luxen 7c0866f626 stream line code a bit in Reply 2014-06-18 11:17:23 +02:00
Dennis Luxen 0f2062b739 round bearing value to integers 2014-06-18 11:00:13 +02:00
Dennis Luxen e91454eeee use auto keyword to deduce types automatically 2014-06-18 10:59:43 +02:00
Dennis Luxen 58134200df use float consistently in DescriptionFactory 2014-06-18 10:44:46 +02:00
Dennis Luxen f6bab21928 use double consistently in JSONDescriptor 2014-06-18 10:44:09 +02:00
Dennis Luxen 011910811b use float consistently in Contractor 2014-06-18 10:43:26 +02:00
Dennis Luxen bbc0ba147a reformat Descriptors/JSONDescriptor.h 2014-06-18 10:15:38 +02:00
Dennis Luxen 922a4331db reformat source file datastore.cpp 2014-06-18 09:42:45 +02:00
Dennis Luxen 8f7f1e2683 reformat source file Server/RequestHandler.cpp 2014-06-18 09:40:53 +02:00
Dennis Luxen 1980cc007f cast parameters before c'ting Coordinate 2014-06-17 19:10:26 +02:00
Dennis Luxen 39611f7477 couple more explicit casts 2014-06-17 18:52:01 +02:00
Dennis Luxen e3d659576f cast std::size_t and unsigned in a proper way 2014-06-17 16:01:06 +02:00
Dennis Luxen 46d4670b74 cast float to unsigned in a proper way 2014-06-17 16:00:42 +02:00
Dennis Luxen 15ca6d5ca9 use explicit casts where feasible 2014-06-17 15:57:03 +02:00
Dennis Luxen 58f23cda4a use explicit casts where feasible 2014-06-17 15:51:43 +02:00
Dennis Luxen a58d8420a2 add some formatting whitespace 2014-06-17 15:48:47 +02:00
Dennis Luxen 96f834fb81 use explicit casts 2014-06-17 15:47:59 +02:00
Dennis Luxen 86617eccb1 use explicit casts 2014-06-17 15:47:40 +02:00
Dennis Luxen f2936d1c2d add disabled HipChat notifications to Windows build 2014-06-17 15:47:16 +02:00
Dennis Luxen 0fc8e04ab5 use proper data types to avoid uncessary casts 2014-06-17 15:30:28 +02:00
Dennis Luxen a65e2d3115 downcast size_t to unsigned 2014-06-17 13:19:59 +02:00
Dennis Luxen ca6e25b11c make many more conversions explicit 2014-06-17 13:18:55 +02:00
Dennis Luxen 3ec6a6f5bc remove ignored parameter 2014-06-17 13:09:58 +02:00
Dennis Luxen c12fae47e7 allow results at high latitudes to be a bit more imprecise 2014-06-17 13:00:13 +02:00
Dennis Luxen 604d2c698b replace fp divisions by multiplications 2014-06-17 12:50:29 +02:00
Dennis Luxen 5d14016366 add static_casts to avoid unnecessary conversion from double to float 2014-06-17 12:37:55 +02:00
Dennis Luxen b112becbba use explicit casts to mitigate MSVC warnings 2014-06-17 12:15:40 +02:00
Dennis Luxen e68a09fb3c fix windows deploy on develop branch, partially fixes #1085 2014-06-16 15:13:19 +02:00
Dennis Luxen 30e9b4513a Merge branch 'alex85k-develop' into develop 2014-06-16 13:43:26 +02:00
alex85k 671b14dac0 pack only develop version to zip on AppVeyor 2014-06-16 16:02:14 +06:00
Porjo 82e99988e8 Change content-type header for JSON data 2014-06-16 09:29:34 +02:00
Dennis Luxen 313a7ed7fa Merge pull request #1076 from alex85k/patch-mingw
Add Mingw support (tune libraries and disable cpuid with #ifdef)
2014-06-15 21:55:18 +02:00
Dennis Luxen cf3365574e Merge branch 'TheMarex-thread-control' into develop 2014-06-15 12:35:26 +02:00
Dennis Luxen 0e1f6f50ea Merge branch 'thread-control' of https://github.com/TheMarex/Project-OSRM into TheMarex-thread-control 2014-06-15 12:35:15 +02:00
Dennis Luxen 5b6518d4a9 Merge branch 'TheMarex-diffencoding' into develop 2014-06-15 12:10:18 +02:00
Patrick Niklaus c009dce591 Another VC2013 fix 2014-06-15 11:42:59 +02:00
Patrick Niklaus 40e2d7932b Fix VC2013 issues 2014-06-15 11:29:36 +02:00
Patrick Niklaus e29b7a6eae Fix some minor style issues 2014-06-15 11:04:10 +02:00
Patrick Niklaus a3e9cbc000 Allow user to force thread number
This allows the user to do (potentially) stupid things, but warns him.
The default is TBBs default, so probably the right thing.
To enforce thread numbers in extractor it must be passed to the child
threads.
2014-06-14 17:02:43 +02:00
Patrick Niklaus aedcc2ff40 Add array inlcude 2014-06-12 22:01:23 +02:00
Patrick Niklaus 4c17aeb180 Removed SSE code in RangeTable to rely on compiler optimazation 2014-06-12 22:01:23 +02:00
Patrick Niklaus ef60ae652c Fix edge cases in RangeTable 2014-06-12 22:01:23 +02:00
Patrick Niklaus 1d62ed028e Fix off-by-one since back() gives last value inside [begin,end) 2014-06-12 22:01:23 +02:00
Patrick Niklaus 50bf7694c2 Constify some parts of RangeTable 2014-06-12 22:01:22 +02:00
Patrick Niklaus 807f1d7c1c Initial support for SharedDataFacade
SharedDataLayout was refactored to include canary values at the
boundaries of each memory block. This makes it easy to detect overruns
and block-size mismatches between osrm-datastore and the
SharedDataFacade.
2014-06-12 22:01:22 +02:00
Patrick Niklaus 7a7d0c09d9 Integrate RangeTable into server 2014-06-12 22:00:03 +02:00
Patrick Niklaus f90ce77da4 Use differential encoding for name offsets
Each name is represented as an integer range in a vector of chars.
Instead of storing the absolute offset inside this array, we can store
only the offset to the previous entry (the string size). By doing this we reduce
the number of bytes need to store an offset from 4 to 1 bytes (if we
set a maximum string length of 255).
This is however slower, since the absolute offset must be computed on
each querry by summing up all previous lengths. To limit the
performance inpact we only do this for blocks of a certain size (16).
2014-06-12 22:00:03 +02:00
Dennis Luxen d27ac27bc7 remove one fwd decl, add more comments to Connection 2014-06-12 13:46:07 +02:00
Dennis Luxen 44c6a64bf4 make c'tor of NodeInfo explicit 2014-06-11 18:26:34 +02:00
Dennis Luxen 2d6eae9391 make conversion explicit 2014-06-11 18:15:36 +02:00
Dennis Luxen ba440550a6 make conversion explicit 2014-06-11 18:15:31 +02:00
Dennis Luxen 8e24fee9da explicitly cast from int to bool 2014-06-11 17:44:50 +02:00
alex85k 1148652101 Add Mingw support (tune libraries and disable cpuid with #ifdef) 2014-06-11 20:58:53 +06:00
Dennis Luxen ed01eeaeb3 reformat SharedMemoryFactory according to code guidelines 2014-06-11 15:22:51 +02:00
Dennis Luxen 096f187d6f remove empty line 2014-06-11 15:19:11 +02:00
Dennis Luxen fa35eb1959 adapt for merge, add deployment details 2014-06-11 15:17:51 +02:00
Dennis Luxen 8d89d30c74 Merge branch 'alex85k-win-038' into develop 2014-06-11 15:15:05 +02:00
alex85k f1bde40939 add appveyor.yml template 2014-06-11 18:38:03 +06:00
alex85k 4e7ccaa298 use std::memcpy instead of std::copy (avoid checked iterators assertions) 2014-06-11 18:38:02 +06:00
alex85k d0284991ed patch Ruby files for successful testing on Windows 2014-06-11 18:38:01 +06:00
alex85k c4998990e5 disable io-benchmark on Windows 2014-06-11 18:38:01 +06:00
alex85k 42d3ee9b94 workaround for std::packaged_task<void()> problem on MSVC 2014-06-11 18:38:00 +06:00
alex85k be5c3e41e1 Replace sizeof asserts with warning on Windows 2014-06-11 18:37:26 +06:00
alex85k 3282d410c4 Add basic shared memory support for Windows OS 2014-06-11 18:15:17 +06:00
Alexei Kasatkin 75303c95f8 Avoid constexpr by #ifdef (not supported in MSVC18) 2014-06-11 18:15:16 +06:00
Alexei Kasatkin 0209272831 fix includes and definitions (avoid unistd.h, isatty, fix min,max, round and M_PI) 2014-06-11 18:15:15 +06:00
Alexei Kasatkin 0e16c4ed97 Add more Boost libraries on Windows, fix TBB debug linking, stop building
on old Microsoft compilers
2014-06-11 18:15:14 +06:00
Dennis Luxen e49720f34a add include 2014-06-11 13:44:10 +02:00
Dennis Luxen 8aee371d81 further include untangling, chops 5sec compile time 2014-06-11 12:25:57 +02:00
Dennis Luxen 71c4f81b59 avoid signed/unsigned comparison 2014-06-10 18:08:58 +02:00
Dennis Luxen 3127fafc88 Merge branch 'patch-6' of https://github.com/alex85k/Project-OSRM into develop 2014-06-10 17:40:56 +02:00
Dennis Luxen 4e6bdf28cc fixes #1041, some only_ turn restrictions are inverted under certain conditions 2014-06-10 17:26:22 +02:00
Dennis Luxen 621a5a86a0 fixes #1041, some only_ turn restrictions are inverted under certain conditions 2014-06-10 17:26:05 +02:00
Dennis Luxen d80c8cbd2f add another turn restriction test 2014-06-10 17:23:24 +02:00
Dennis Luxen 686f1aeeb2 reformat some code 2014-06-10 17:23:07 +02:00
alex85k e27a69bab7 Use one more .string().c_str() call 2014-06-10 20:34:21 +06:00
Dennis Luxen 4ee2e1d049 fix long line 2014-06-10 10:49:45 +02:00
Dennis Luxen 2102648102 fix short variable name 2014-06-10 10:48:43 +02:00
Dennis Luxen 8611e40172 Merge branch 'TheMarex-fix-cucumber' into develop 2014-06-09 18:41:37 +02:00
Dennis Luxen 7d5b88fff8 Merge branch 'fix-cucumber' of https://github.com/TheMarex/Project-OSRM into TheMarex-fix-cucumber 2014-06-09 18:41:18 +02:00
Dennis Luxen cfd9aa31a9 add algorithm include 2014-06-09 18:32:07 +02:00
Dennis Luxen 62aea4c321 refactored function names 2014-06-09 18:10:46 +02:00
Dennis Luxen f75fcb3041 refactor RequestHandler to remove code duplication, nested blocks and object copies 2014-06-09 18:06:23 +02:00
Dennis Luxen 971c557d85 explicitly initialize Header member 2014-06-09 17:58:17 +02:00
Dennis Luxen ea05aa225e rename some function names in Reply 2014-06-09 17:57:35 +02:00
Dennis Luxen 56cdabff6a add move c'tor to Header 2014-06-09 17:57:03 +02:00
Dennis Luxen 15f62e680a use inplace construction for Headers instead of explicit objects and copying 2014-06-09 17:55:16 +02:00
Dennis Luxen 0af4e16c21 use inplace construction for Headers instead of explicit objects and copying 2014-06-09 17:54:46 +02:00
Dennis Luxen c7b90bac1a add explicit unsigned->string conversion 2014-06-09 17:50:50 +02:00
Patrick Niklaus 4b81331d53 Don't reset response, so log_fail won't crash cucumber 2014-06-09 14:33:30 +02:00
Dennis Luxen 47ab0cbf62 reduce some code duplication 2014-06-09 12:11:44 +02:00
Dennis Luxen f5b079b8e7 add more comments to reduce NCSS number 2014-06-09 11:58:23 +02:00
Emil Tin 21c4691d40 cuke: make File.tail utility more robust 2014-06-08 12:06:34 +02:00
Dennis Luxen 3726706608 remove another superflous include 2014-06-06 19:19:45 +02:00
Dennis Luxen 28a53aa147 remove superflous include 2014-06-06 19:18:44 +02:00
Dennis Luxen 2ad572490c const as const can 2014-06-06 18:06:05 +02:00
Dennis Luxen 0ed9caf969 fix a couple of implicit signed/unsigned conversions 2014-06-06 18:05:07 +02:00
Dennis Luxen 63ee376f71 removing constexpr at one position 2014-06-06 18:01:01 +02:00
Dennis Luxen 67bcb98a84 make some constants explicit floats to cut down on MSVC conversion warnings 2014-06-06 15:39:29 +02:00
Dennis Luxen 9cd91ae99c Merge pull request #1066 from alex85k/patch-path-cstr
Obtain char* from boost::filesystem::path on all systems
2014-06-06 12:02:32 +02:00
Dennis Luxen d111a0e5e6 guard against an empty alternative path in ExtractRouteNames 2014-06-06 11:50:14 +02:00
Dennis Luxen 11d4c04cea removed left-overs from win/, i.e. a previous windows porting attempt 2014-06-06 11:33:47 +02:00
Dennis Luxen 01773c2a00 fix and refactor the selection of RouteNames 2014-06-06 11:30:12 +02:00
alex85k 1079bf7843 sort vectors before using std::set_difference
discussed in https://github.com/DennisOSRM/Project-OSRM/pull/998#issuecomment-45238338
The vectors are better to be sorted up to ``name_id_comperator`` before running std::set_difference. Elsewhere we get debug checked iterator assertions on Windows and theretically possible incorrect results.
2014-06-06 10:27:35 +02:00
Dennis Luxen 05bcfd2c1c Merge pull request #1065 from alex85k/patch-skip-zero-rw
skip zero bytes reading or wrtiting
2014-06-06 10:22:49 +02:00
Alexei Kasatkin 5357a6a4fd get char* from boost::filesystem::path 2014-06-05 23:48:54 +06:00
Alexei Kasatkin b6787b0014 safeguard: do not read/write 0 bytes (iostream) 2014-06-05 23:16:19 +06:00
Dennis Luxen a32116d24c Merge pull request #1063 from alex85k/patch-6
simplify static asserts
2014-06-05 18:58:08 +02:00
alex85k a03b698e5a simplify static asserts
Simplify static asserts to make them compatible with older compilers and MSVC 2013
2014-06-05 22:55:22 +06:00
Dennis Luxen fa0c5db18c include <string> as it is needed 2014-06-05 18:29:22 +02:00
Dennis Luxen bc063ded7a make sure result is always > 0, hits when origin and destination are on the same one-way segment in reversed order 2014-06-05 18:28:54 +02:00
Dennis Luxen 846505cbc8 Merge pull request #1051 from TheMarex/linker-fix
Fix linking for linux
2014-06-05 18:14:33 +02:00
Dennis Luxen 964118d1d6 add more comments and rename a couple of badly named variables 2014-06-05 17:27:00 +02:00
Patrick Niklaus c43b67ea2e Fixes build using gcc 4.9 with LTO.
Otherwise sem_close is not found.
2014-06-05 17:26:19 +02:00
Dennis Luxen f68af08931 fix short variable names and long lines 2014-06-05 15:40:52 +02:00
Dennis Luxen cdd5a41965 remove duplicate edges from NodeBasedGraph 2014-06-05 15:33:24 +02:00
Dennis Luxen e13ee59af3 remove some code lint 2014-06-05 15:14:39 +02:00
Dennis Luxen 9eb183e01d Merge branch 'alex85k-patch-timing' into develop 2014-06-05 11:22:52 +02:00
Dennis Luxen 1163417722 Merge branch 'patch-timing' of https://github.com/alex85k/Project-OSRM into alex85k-patch-timing
Conflicts:
	extractor.cpp
2014-06-05 11:22:26 +02:00
Dennis Luxen 3edc48cda5 Merge branch 'alex85k-patch-6' into develop 2014-06-05 11:04:35 +02:00
Dennis Luxen 2c01425ee5 Merge branch 'patch-6' of https://github.com/alex85k/Project-OSRM into alex85k-patch-6 2014-06-05 11:04:17 +02:00
Dennis Luxen ed9c72814f Merge pull request #1058 from alex85k/patch-4
add a safe-guard against bad input
2014-06-05 11:02:39 +02:00
Dennis Luxen adbbe2b097 fix broken transmission of checksum/hinting mechanism on shared memory 2014-06-05 10:55:27 +02:00
alex85k 7335e0809a Globally rename UUID to FingerPrint 2014-06-05 10:31:19 +02:00
alex85k 75dabb75e2 Use TimingUtil.h for all time measurement,
and make TimingUtil.h Windows-compatible
2014-06-04 19:52:34 +06:00
alex85k 15adcd24be Remove extra mutex unlocking in ConcurrentQueue.h
As discussed in https://github.com/DennisOSRM/Project-OSRM/pull/998 , unlocking the mutex is performed on destruction. Second unlocking gives an assertion (for debug version) for Windows and FreeBSD 10.
2014-06-04 18:01:48 +06:00
alex85k e98ba99331 add a safe-guard against bad input
do not write empty original_edge_data_vector to file
2014-06-04 16:02:18 +06:00
Dennis Luxen 11459d38d0 Merge pull request #1052 from alex85k/patch-4
add a cmake option WITH_TOOLS
2014-06-03 14:58:36 +02:00
alex85k baf4ea2e8c add a cmake option WITH_TOOLS 2014-06-03 18:38:33 +06:00
Dennis Luxen 6a29168c14 use EdgeWeight typedef where possible 2014-06-03 11:28:39 +02:00
Dennis Luxen a4689c7a27 add some comments to reduce NCSS complexity 2014-06-03 10:49:25 +02:00
Dennis Luxen 8fda5a187b rename variable to a shorter name 2014-06-03 10:44:09 +02:00
Dennis Luxen 7b78270f4b safe-guard against broken input data 2014-06-02 19:23:50 +02:00
Dennis Luxen afd3599a9c remove depth of nested block 2014-06-02 18:18:27 +02:00
Dennis Luxen 4bc8562cd0 further reduce lint 2014-06-02 18:18:03 +02:00
Dennis Luxen 11fed4c06c remove variable name lint 2014-06-02 16:05:19 +02:00
Dennis Luxen 9416a983c6 rename one char variable names 2014-06-02 16:04:44 +02:00
Dennis Luxen 8108c6320d use lambda for complex initialization 2014-06-02 15:56:06 +02:00
Dennis Luxen b40b931568 unlinting DouglasPeucker 2014-06-02 09:48:43 +02:00
Dennis Luxen 282f70ea91 remove debug output 2014-05-30 19:48:34 +02:00
Dennis Luxen a671f63a3e Apply strong heuristics to speed up line generalization 2014-05-30 19:10:37 +02:00
Dennis Luxen f3ad14cb7f use integer approximation for polyline generalization 2014-05-30 14:34:04 +02:00
Dennis Luxen 21eb5b661d add integer based approximation for perpendicular distance 2014-05-30 14:33:37 +02:00
Dennis Luxen 87fe073118 re-layout parameters 2014-05-30 13:30:54 +02:00
Dennis Luxen 507dadebf4 fix a couple of variable names 2014-05-30 10:15:35 +02:00
Dennis Luxen 7dac8c621c fix a couple of OCLint warning, i.e. short variable names and useless parantheses 2014-05-30 10:01:55 +02:00
Dennis Luxen 19f4ebf3c5 make threshold values floats by construction 2014-05-30 10:01:18 +02:00
Dennis Luxen c21b40bebc further renaming of variable names, reduces legacy lint 2014-05-29 19:25:17 +02:00
Dennis Luxen 0766c3c62d refactor member names in ImportEdge 2014-05-29 18:46:20 +02:00
Dennis Luxen cc40eb709c moved ImportNode/Edge into compile units 2014-05-29 18:31:20 +02:00
Dennis Luxen 3625308585 moved ImportNode/Edge into compile units 2014-05-29 18:31:02 +02:00
Dennis Luxen df3a7676eb streamline branch-and-bound query code in R-tree 2014-05-29 17:16:24 +02:00
Dennis Luxen 8f6077e973 add proper c'tor to PhantomNode 2014-05-29 17:15:41 +02:00
Dennis Luxen e6689144c4 remove debug output 2014-05-29 16:27:08 +02:00
Dennis Luxen a67de410bf move TreeNode exploration into its own function, fix performance regression 2014-05-29 15:36:14 +02:00
Dennis Luxen 54ec1a89de use complex const variable initialization w/ lambda functions instead of conditional operator 2014-05-29 12:47:03 +02:00
Dennis Luxen 4b5f744c6f move distance calculations to float 2014-05-28 18:34:48 +02:00
Dennis Luxen df978345d7 rename start->source 2014-05-28 18:20:47 +02:00
Dennis Luxen facc07c60d use correct edge weight type in PathData 2014-05-28 18:20:29 +02:00
Dennis Luxen 2f203ac22c rename start->source 2014-05-28 18:19:27 +02:00
Dennis Luxen cc864191b8 remove some unneeded flags when compiling with clang 2014-05-28 18:18:57 +02:00
Dennis Luxen 547455245e link against UUID (needed in node-OSRM) 2014-05-28 16:09:51 +02:00
Dennis Luxen b0d7449bb4 add type traits include 2014-05-28 12:53:18 +02:00
Dennis Luxen aed04c7d55 server cast int to string only where it is needed 2014-05-28 12:34:48 +02:00
Dennis Luxen bb5973f2fd rename variable 2014-05-28 12:34:24 +02:00
Dennis Luxen f801fd1f0d fix inverted logic 2014-05-28 12:06:57 +02:00
Dennis Luxen 44ca12ead6 fix inverted logic 2014-05-28 12:05:42 +02:00
Dennis Luxen 9c48389f74 collapse if statements 2014-05-28 12:03:07 +02:00
Dennis Luxen acefb5a5f3 remove debug output 2014-05-27 19:05:37 +02:00
Dennis Luxen 3d691a3aec implements #947, free osrm-datastore's shared memory 2014-05-27 18:14:43 +02:00
Dennis Luxen 38ebdbb563 implements #949, wrong duration on first segment 2014-05-27 16:54:10 +02:00
Dennis Luxen 1090325c31 remove superflous check 2014-05-27 14:50:59 +02:00
Dennis Luxen f8ba4b9312 use C++11 shrinktofit() instead of swap tricks 2014-05-27 12:16:53 +02:00
Dennis Luxen 49a1dfff60 fix off-by-one issue related to #1020 2014-05-27 12:09:05 +02:00
Dennis Luxen 5f4d342d45 move last leg handling into DescribeLeg() function 2014-05-27 11:48:19 +02:00
Dennis Luxen e1c1f79068 remove todo marker 2014-05-27 11:44:47 +02:00
Dennis Luxen a716fa252f implements #792 2014-05-27 11:16:55 +02:00
Dennis Luxen 0b12e4d8be remove assert 2014-05-27 10:45:57 +02:00
Dennis Luxen 6ad6c94355 further CMakeLists.txt lint removal 2014-05-26 18:42:29 +02:00
Dennis Luxen 78270c8155 fix unneeded variable warning in release build 2014-05-26 18:40:21 +02:00
Dennis Luxen 4573ae21e6 unlinting CMakeLists.txt 2014-05-26 18:36:11 +02:00
Dennis Luxen 0ab6220635 add some more constness 2014-05-26 18:35:37 +02:00
Dennis Luxen 3b51976b96 remove unneeded include 2014-05-26 18:11:32 +02:00
Dennis Luxen c35211b2f6 add some const keywords where applicable 2014-05-26 17:37:44 +02:00
Dennis Luxen f62515e13b commented assertion that is triggered on trivial instances 2014-05-26 16:03:08 +02:00
Dennis Luxen 7f2daf8926 some variables renamed to replace camel case 2014-05-26 16:02:15 +02:00
Dennis Luxen 0325861ef3 remove an unneeded parameter 2014-05-26 15:31:30 +02:00
Dennis Luxen 37f8285a6e implements #1020 2014-05-26 15:31:09 +02:00
Dennis Luxen d3906cffdc add property to mark end of leg 2014-05-26 15:30:06 +02:00
Dennis Luxen bee1c77efe make variable const 2014-05-26 15:29:28 +02:00
Dennis Luxen 7250a82286 remove dead code 2014-05-26 13:08:10 +02:00
Dennis Luxen 984457f9c6 remove useless parantheses, straighten includes 2014-05-26 12:49:49 +02:00
Dennis Luxen 5db23f7e46 make short variable names more legible 2014-05-26 12:49:24 +02:00
Dennis Luxen f4f49b2b46 remove unused variable 2014-05-26 12:42:47 +02:00
Dennis Luxen 58b35f6e2d make short variable names more legible 2014-05-26 12:41:25 +02:00
Dennis Luxen b51ad16756 remove useless parantheses 2014-05-26 12:37:00 +02:00
Dennis Luxen d790bda7d2 implements #986, streamline error messages 2014-05-26 12:33:35 +02:00
Dennis Luxen 15ce232f61 partially fixes #1034 2014-05-26 11:59:13 +02:00
Dennis Luxen d999a47600 partially fixes #1034 2014-05-26 11:47:01 +02:00
Dennis Luxen 644286111f add test for #1034 2014-05-26 11:46:01 +02:00
Dennis Luxen 917b1cbd6c fix index of instructions 2014-05-26 11:38:35 +02:00
Dennis Luxen 6d1b585212 remove unneeded output 2014-05-26 10:19:45 +02:00
Dennis Luxen 6ca35a6264 remove debug output 2014-05-26 09:25:42 +02:00
Dennis Luxen 0290b1b4e0 Merge branch 'dmbreaker-develop' into develop 2014-05-23 14:50:23 +02:00
Dennis Luxen 1d86bf3e56 Merge branch 'develop' of https://github.com/dmbreaker/Project-OSRM into dmbreaker-develop 2014-05-23 14:50:05 +02:00
Dennis Luxen 3fd8ab8d3a use parallel sorting when loading OSRM data files 2014-05-23 14:49:50 +02:00
Dennis Luxen d240ae3b03 sort edges in StaticGraph in parallel 2014-05-23 14:32:40 +02:00
Emil Tin b875765c52 update test to avoid single ring 2014-05-23 12:52:32 +02:00
shipenok 2bdec31219 minor fix to open result in browser 2014-05-23 14:27:55 +04:00
Emil Tin a9eebdb1fa fix test related to via points and #1034 2014-05-23 11:45:18 +02:00
Emil Tin b25f3a9e91 update test related to via points and #1034 2014-05-23 11:42:44 +02:00
Emil Tin 06f3375a97 test showing bug related to via points. see #1034 2014-05-23 11:23:11 +02:00
Dennis Luxen 5057ae920c replace a couple of std::sort calls with tbb::parallel_sort 2014-05-22 19:07:29 +02:00
Dennis Luxen 6a03f13d55 fixes #1032:
- remove left-overs from OpenMP
- replace omp_* calls with TBB equivalents
2014-05-22 18:39:11 +02:00
Dennis Luxen 20cbfd95d6 remove OpenMP references from CMakeLists.txt 2014-05-22 18:39:11 +02:00
Dennis Luxen 885dbe1e65 Merge pull request #1028 from TheMarex/tbb-port
Port from OpenMP to TBB
2014-05-22 16:57:06 +02:00
Dennis Luxen 7d7cce5c72 add better and more precise comments to Restrictionmap 2014-05-22 14:53:53 +02:00
Dennis Luxen 0c66f84555 add static assertions to SearchEngine 2014-05-22 14:41:27 +02:00
Dennis Luxen 044e41c079 make temporary variables const 2014-05-22 14:41:02 +02:00
Dennis Luxen 8dc631e13c pull math functions from std namespace 2014-05-22 14:22:10 +02:00
Dennis Luxen d93b4feb99 add some static asserts to guard against memory usage regressions 2014-05-22 12:41:25 +02:00
Dennis Luxen 0b873f590c fix typo in error message 2014-05-22 12:24:34 +02:00
Dennis Luxen f52d637f58 do less work when compressing geometries 2014-05-22 11:41:32 +02:00
Patrick Niklaus e2daf5c2fc Make some temporary variables const 2014-05-21 21:49:22 +02:00
Patrick Niklaus bef113001a Add TBB to travis.ymk 2014-05-21 21:49:22 +02:00
Patrick Niklaus f0b403bc2e Set requested threads in TBB 2014-05-21 21:49:22 +02:00
Patrick Niklaus a21fb5fc89 Use append operator instead of function, because function is inplace. 2014-05-21 21:49:22 +02:00
Patrick Niklaus bbc0424563 Set number of threads in TBB 2014-05-21 21:49:22 +02:00
Patrick Niklaus f487845e9d Port Contractor to TBB 2014-05-21 21:49:22 +02:00
Patrick Niklaus 77641a9fce Port StaticRTree to use TBB 2014-05-21 21:49:22 +02:00
Patrick Niklaus 56d93eb18b Replace omp atomic with std variant 2014-05-21 21:49:22 +02:00
Patrick Niklaus da1fd96d4e Port extractor to TBB 2014-05-21 21:49:22 +02:00
Dennis Luxen d1fdc7061f fix signed/unsigned comparison 2014-05-21 14:23:09 +02:00
Dennis Luxen 2822382797 Merge pull request #1030 from DennisOSRM/features/json-generator
Distance tables and JSON generator
2014-05-21 14:10:03 +02:00
Dennis Luxen 35c9021bdf reduce debug verbosity in RestrictionMap 2014-05-21 12:39:52 +02:00
Dennis Luxen 493b13364f move geographical distance computation to floats 2014-05-21 12:33:54 +02:00
Dennis Luxen a8ff3231a8 reduce debug verbosity 2014-05-21 12:33:14 +02:00
Dennis Luxen c2a750a690 use 100 locations at max for dist table 2014-05-21 12:29:45 +02:00
Dennis Luxen 6a9541833a add a leg to roundabout to remove edge case 2014-05-21 10:47:34 +02:00
Dennis Luxen 9117b45899 move more distance calculations to float 2014-05-21 10:03:30 +02:00
Dennis Luxen 812cf36d52 use floats instead of doubles for distance computations 2014-05-20 19:29:09 +02:00
Dennis Luxen 4aa7420d6a remove unneeded includes 2014-05-20 18:54:03 +02:00
Dennis Luxen 1802839a22 add approximator for perpendicular distance 2014-05-20 16:23:47 +02:00
Dennis Luxen 9a2d701e2e fix issue #1025:
- add function to count directed outgoing edges
- generate correct instruction for staying on a roundabout
- move test from @bug namespace to the general one
2014-05-20 15:40:14 +02:00
Dennis Luxen 69ad3f3365 add curly braces to one line if 2014-05-20 15:37:18 +02:00
Dennis Luxen d53eb881c2 revert to old boost based regex as GCC does not properly implement it prior to GCC 4.90 2014-05-20 14:33:03 +02:00
Dennis Luxen e28e45f38e remove unused variable 2014-05-20 14:33:03 +02:00
Dennis Luxen bf6ca22b00 fix #1021, always check if files exist 2014-05-20 14:33:03 +02:00
Dennis Luxen b8acbae3e8 fix #1021, always check if files exist 2014-05-20 14:33:03 +02:00
Dennis Luxen 4ec9f2c00f fix #1021, always check if files exist 2014-05-20 14:33:03 +02:00
Dennis Luxen 4fc329a1eb remove superflous way in test setup 2014-05-20 14:33:02 +02:00
Dennis Luxen 0574a60bc2 replace boost::unordered_map, move hash function for pairs into its own header 2014-05-20 14:33:02 +02:00
Dennis Luxen e490c4afed use consistent typedef'ed types 2014-05-20 14:33:02 +02:00
Dennis Luxen d028a30f87 fixes issue #1019:
- fix ignored turn restriction on chains of degree-2 nodes
- add a cucumber test to test for potential regressions
2014-05-20 14:33:02 +02:00
Dennis Luxen 75a2d4d00a minor code refactoring, wip 2014-05-20 14:33:02 +02:00
Dennis Luxen a122a1e8c7 remove comment 2014-05-20 14:33:02 +02:00
Dennis Luxen 8fe09c85b6 move atan2 lookup into trig header 2014-05-20 14:33:02 +02:00
Dennis Luxen bc951de2a5 use trig functions from std namespace 2014-05-20 14:33:01 +02:00
Dennis Luxen c970cd13cc flip bearings by 180 2014-05-20 14:33:01 +02:00
Dennis Luxen 8983c0f927 move GetBearing(.) function into FixedPointCoordinate 2014-05-20 14:33:01 +02:00
Dennis Luxen a47467f29b store facade ptr in c'tor, save a param in sub-sequent function calls 2014-05-20 14:33:01 +02:00
Dennis Luxen ef206eb4d9 clean up code a bit 2014-05-20 14:33:01 +02:00
Dennis Luxen da5eec1c5f refactor route name extraction into its own class, fix name extraction 2014-05-20 14:33:01 +02:00
Dennis Luxen a69b3535a5 fix typo 2014-05-20 14:33:01 +02:00
Dennis Luxen f4c23f3259 fix comparison 2014-05-20 14:33:01 +02:00
Dennis Luxen e36e9fd629 make comparsion explicitly unsigned 2014-05-20 14:33:00 +02:00
Dennis Luxen d2f19353ed remove some debug output 2014-05-20 14:33:00 +02:00
Dennis Luxen 2d498cb88b adapt JSON parsing in tests to allow for omitted fields 2014-05-20 14:33:00 +02:00
Dennis Luxen a80815d57a implements output generation through a dedicated JSON container:
- JSON syntax is not scattered over several files, but one place
- Reduces code duplication
- breaking changes:
  - new property in json(p) formatted response: "found_alternative": True/False
  - returned filenames now response.js(on) or route.gpx
  - /hello plugin returns JSON now
2014-05-20 14:33:00 +02:00
Dennis Luxen acab77f4f8 add simple isValid() function to PhantomNodes 2014-05-20 14:33:00 +02:00
Emil Tin bddad0c57c add test for roundabout with oneone links 2014-05-20 13:27:32 +02:00
Dennis Luxen 3968349480 deactivate LTO on debug build 2014-05-16 15:00:31 +02:00
Dennis Luxen 3ae17761b3 rename variables 2014-05-14 08:54:36 +02:00
Dennis Luxen 9a28bdbf76 reorder some includes 2014-05-14 08:53:26 +02:00
Dennis Luxen e769821e0f use range based for loops to traverse graphs 2014-05-13 16:56:30 +02:00
Dennis Luxen 9b68821f05 move common code into its own header 2014-05-13 13:30:52 +02:00
Dennis Luxen b2adb22b2d remove whitespace 2014-05-13 12:41:40 +02:00
Dennis Luxen 981941edf4 leave early to reduce scope nesting 2014-05-13 12:22:42 +02:00
Dennis Luxen 111dea89a9 use std::abs instead of hand-rolled substitute 2014-05-13 12:22:14 +02:00
Dennis Luxen 2720f4de9c add parantheses to fix compiler warning 2014-05-13 10:22:54 +02:00
Dennis Luxen 21645643b0 minor reformatting 2014-05-13 10:20:39 +02:00
Dennis Luxen c6a07acd90 use std::packaged_task and std::future to simulate boost::thread::timed_join() 2014-05-13 10:03:37 +02:00
Dennis Luxen 1816e6607e remove boost::thread from Server 2014-05-13 10:02:36 +02:00
Dennis Luxen 37dd05a9b5 Merge branch 'TheMarex-atan-perf' into develop 2014-05-13 10:00:45 +02:00
Patrick Niklaus 529997de9b Add atan based on lookup table. Again 6% improvement. 2014-05-13 02:20:33 +02:00
Patrick Niklaus 4f37270300 Simple fix that improves runtime of edge based egde generation by 26% 2014-05-13 01:00:24 +02:00
Dennis Luxen faf9c96442 fix regression in debug build 2014-05-12 18:09:25 +02:00
Dennis Luxen f7e09686e5 Merge branch 'TheMarex-lto-fix' into develop 2014-05-12 11:05:26 +02:00
Dennis Luxen 8eef8204e7 Merge branch 'lto-fix' of https://github.com/TheMarex/Project-OSRM into TheMarex-lto-fix 2014-05-12 11:05:15 +02:00
Dennis Luxen 8b8e08f0f5 use less than 4GB on 32 bits. fixes #1008 2014-05-12 10:57:02 +02:00
Dennis Luxen a6bfec22b5 return gracefully instead of failing of geometry is only a single node 2014-05-12 10:33:37 +02:00
Patrick Niklaus d05c4fa9ed Fix lto option in gcc 4.9 by using gcc-ar / gcc-ranlib 2014-05-11 21:56:09 +02:00
Dennis Luxen 07231d3706 reformatting RequestHandler 2014-05-11 18:06:52 +02:00
Dennis Luxen 584ba10726 reformatting RequestHandler 2014-05-11 18:03:05 +02:00
Dennis Luxen 24a61dc650 remove unused function parameters 2014-05-11 17:58:37 +02:00
Dennis Luxen 7e7aa6aaee workaround incomplete std::shared_ptr compatibility of old boost versions 2014-05-11 16:51:14 +02:00
Dennis Luxen 35c5be6475 add missing includes <string> and <limits> 2014-05-10 14:54:46 +02:00
Dennis Luxen fcf3eb6193 fix yet another missing include on GCC 4.7 (again) 2014-05-09 19:55:27 +02:00
Dennis Luxen 5226b200e7 fix yet another missing include on GCC 4.7 2014-05-09 19:50:16 +02:00
Dennis Luxen 5f57152156 fix missing include 2014-05-09 19:46:37 +02:00
Dennis Luxen 633ef26054 fix compile warning 2014-05-09 19:42:15 +02:00
Dennis Luxen 285bd4f542 further climits madness 2014-05-09 19:41:36 +02:00
Dennis Luxen e706fb973f build fixes on GCC 2014-05-09 19:35:09 +02:00
Dennis Luxen 8dc7afed4e remove even more climits 2014-05-09 19:26:37 +02:00
Dennis Luxen 0c7f996de6 use std numeric limits instead of climits 2014-05-09 19:22:38 +02:00
Dennis Luxen 985a8e9f97 removing boost cref and betting on move semantics 2014-05-09 19:10:11 +02:00
Dennis Luxen 5e26e4c22d replacing all boost unordereds 2014-05-09 18:40:07 +02:00
Dennis Luxen 00e27e4b5c replace left-overs from boost::shared_ptr usage 2014-05-09 17:04:55 +02:00
Dennis Luxen b3ec9c9323 reformat 2014-05-09 16:48:58 +02:00
Dennis Luxen 84ffedd95d replace boost::shared_ptr 2014-05-09 16:47:42 +02:00
Dennis Luxen 455dc26a5d add constexpr for invalid name id 2014-05-09 16:18:06 +02:00
Dennis Luxen 0fccd0f0d2 refactor Extractor/ 2014-05-09 16:17:31 +02:00
Dennis Luxen 7e639d6bc1 remove white space 2014-05-09 16:16:51 +02:00
Dennis Luxen 694ce9d04f add forgotten include 2014-05-09 15:12:42 +02:00
Dennis Luxen aebe8572f9 reformat NodeBasedGraph 2014-05-09 14:21:52 +02:00
Dennis Luxen c98eed612a C++11-fy Contractor/ 2014-05-09 14:21:33 +02:00
Dennis Luxen 5f0ee417b1 move BFS component exploration into Algorithms/ 2014-05-09 14:21:02 +02:00
Dennis Luxen a6b4658138 move BFS component exploration into Algorithms/ 2014-05-09 14:20:45 +02:00
Dennis Luxen 1a57aff0f4 remove unneeded boost include 2014-05-09 14:12:10 +02:00
Dennis Luxen afc0bac232 remove boost/noncopyable, fwd decl 2014-05-09 14:08:56 +02:00
Dennis Luxen ac1c59b724 port TimingUtil header to C++11s <chrono> 2014-05-09 11:49:03 +02:00
Dennis Luxen 1f9806386e port TimingUtil header to C++11s <chrono> 2014-05-09 11:48:48 +02:00
Dennis Luxen 1b67120704 readd <chrono> include lost in rebase 2014-05-09 11:31:37 +02:00
Dennis Luxen 5579388896 Merge branch 'TheMarex-ebgf-refactor' into develop 2014-05-09 11:29:48 +02:00
Dennis Luxen 49c972983d Merge branch 'ebgf-refactor' of https://github.com/TheMarex/Project-OSRM into TheMarex-ebgf-refactor 2014-05-09 11:29:30 +02:00
Dennis Luxen 3cb34f8036 remove debug output 2014-05-09 11:23:56 +02:00
Dennis Luxen 3c5b2286a3 adjust speeds to universally use 4/5th of the free-flow speed as expected avg speed
- this is a workaround until we get more thourough work done on the cost model
- this is related to #955 and #989
2014-05-09 11:11:14 +02:00
Patrick Niklaus 845972daa5 Add timing to EBGF 2014-05-09 00:56:07 +02:00
Patrick Niklaus e00ef38305 Apply clang-format on BFSComponentExplorer and RestrictionMap 2014-05-09 00:37:05 +02:00
Patrick Niklaus 22d0861f6d Move BFSComponentExplorer to Contractor/ 2014-05-09 00:37:05 +02:00
Patrick Niklaus 5265f38c35 Switched to std::shared_ptr in Contractor/ 2014-05-09 00:37:05 +02:00
Patrick Niklaus d13cd4d4b3 Apply clang-format on Contractor/ 2014-05-09 00:31:52 +02:00
Patrick Niklaus 79d33d669c Apply clang-modernize to Contractor/ 2014-05-09 00:06:25 +02:00
Patrick Niklaus 439f6e62bc Replace numeric_limits with SPECIAL_NODEID / SPECIAL_EDGEID 2014-05-09 00:06:25 +02:00
Patrick Niklaus 3ef054bbac Split EBGF::Run into smaller sub-functions
I'm not too happy with this yet. It is not really clear cut.
Also, I would like to move the logging in ::Run, seems messy in the
sub-functions.
2014-05-09 00:05:27 +02:00
Patrick Niklaus 5a13c6cc3f Move BFSComponentExplorer to own header. 2014-05-09 00:05:27 +02:00
Patrick Niklaus b7750ff742 Reorder initialization to fix warnings 2014-05-09 00:05:27 +02:00
Patrick Niklaus 2c0fa2a9f6 Split RestrictionMap and NodeBasedGraph from EdgeBasedGraphFactory
First step in an effort to simplify EdgeBasedGraphFactory.
2014-05-09 00:05:27 +02:00
Dennis Luxen 881a57bf8d refactor and migrate root directory 2014-05-08 19:40:32 +02:00
Dennis Luxen c924b2067c refactor and migrate root directory 2014-05-08 19:40:29 +02:00
Dennis Luxen fdd0c8470f refactor Tools dir for C++11 2014-05-08 18:34:58 +02:00
Dennis Luxen 1960c38468 refactor Tools dir for C++11 2014-05-08 18:33:38 +02:00
Dennis Luxen 3074a0146e remove superflous boost include 2014-05-08 18:26:07 +02:00
Dennis Luxen f060dfda40 refactor list of const static int into scoped enum 2014-05-08 18:04:05 +02:00
Dennis Luxen b0ead129ca use proper types instead of implicit casts 2014-05-08 16:39:38 +02:00
Dennis Luxen abe9c4d53c use nullptr instead of NULL 2014-05-08 16:39:17 +02:00
Dennis Luxen 15a95ff425 remove superflous includes 2014-05-08 15:49:32 +02:00
Dennis Luxen 37b8f97d60 C++11 migration:
- use lambda functions instead of binding member functions
- replace boost::mutex by STLs <mutex>
- reformat according to new guidelines
2014-05-08 15:47:48 +02:00
Dennis Luxen 88a4bb4d12 implement locking properly with std::mutex and std::lock_guard<> 2014-05-08 15:25:06 +02:00
Dennis Luxen 50594febc7 consequently use emplace back instead of push 2014-05-08 11:18:46 +02:00
Dennis Luxen 9587923e55 make variable names consistent, migrate Plugins 2014-05-08 11:15:19 +02:00
Dennis Luxen 2850a074ea make sure parameter is not negative
- fixes coverity issue 1198843 Argument cannot be negative
2014-05-08 08:56:51 +02:00
Dennis Luxen bed5c8002f pass parameter by ref instead of by val:
- fixes coverity issue 1212009 Big parameter passed by value
2014-05-08 08:48:55 +02:00
Dennis Luxen cc982a578d deactivate the cool put_time thing in C++11 as GCC craps out again 2014-05-07 19:30:22 +02:00
Dennis Luxen e12ad48822 migrate DataStructures to C++11 2014-05-07 18:39:16 +02:00
Dennis Luxen 6abbb06ff6 replace UINT_MAX by numeric limits max() 2014-05-07 17:25:35 +02:00
Dennis Luxen 3d68769503 reformat Server source and migrate it to C++11 2014-05-07 17:14:57 +02:00
Dennis Luxen bd316e7e98 reformat Server/RequestHandler according to guideline 2014-05-07 17:08:30 +02:00
Dennis Luxen 3f4c4d675b reformat Server/APIGrammar according to guideline 2014-05-07 17:06:28 +02:00
Dennis Luxen 4b7e5b7445 reformat Server/APIGrammar according to guideline 2014-05-07 17:05:33 +02:00
Dennis Luxen 996dbdde00 reformat Server/DataStructure according to guideline 2014-05-07 17:03:58 +02:00
Dennis Luxen db67f2ddf1 reformat files according to guidelines, remove superflous inclue 2014-05-07 16:58:32 +02:00
Dennis Luxen 7b9b2fd23a use C++11's put time to put the timestamp 2014-05-07 16:50:48 +02:00
Dennis Luxen 700747801c use proper include prefix 2014-05-07 16:46:52 +02:00
Dennis Luxen cb30f4668e fix broken include 2014-05-07 16:45:48 +02:00
Dennis Luxen 9710f39cad remove (almost) all BOOST_FOREACH calls 2014-05-07 16:17:47 +02:00
Dennis Luxen e3244dd649 migrate Library dir to C++11, use fwd decls 2014-05-07 16:17:14 +02:00
Dennis Luxen abd20776a2 reformat file in Include 2014-05-07 15:37:39 +02:00
Dennis Luxen 5d8b4cb261 use numeric limits instead of C-style UINT_MAX 2014-05-07 15:37:22 +02:00
Dennis Luxen 9ee615020f break out RouteParameters into compile unit 2014-05-07 15:36:53 +02:00
Dennis Luxen acef734643 break out RouteParameters into compile unit 2014-05-07 15:33:24 +02:00
Dennis Luxen 0ff7ac6aad migrate HilbertValue class to C++11, use fwd decl, remove boost/integer 2014-05-07 14:47:23 +02:00
Dennis Luxen 859502c504 remove boost/integer include 2014-05-07 14:46:46 +02:00
Dennis Luxen 9c2926ef8a remove boost/integer include 2014-05-07 14:44:18 +02:00
Dennis Luxen 3188bc5aba add include for Linux 2014-05-07 14:30:38 +02:00
Dennis Luxen bf9d9512a0 fix typo 2014-05-07 14:24:04 +02:00
Dennis Luxen ba03f99e09 migrate UUID class to C++11, untangle includes, cut back compile time 2014-05-07 14:13:41 +02:00
Dennis Luxen 8e89f80588 make space usage more tight in Coordinate->String conversion 2014-05-07 14:12:57 +02:00
Dennis Luxen 07e245eb02 migrate StringUtil.h to C++11 2014-05-07 14:12:28 +02:00
Dennis Luxen ea12c6fde6 untangle includes a bit 2014-05-07 14:11:59 +02:00
Dennis Luxen 38c7d07e50 remove old way to delete copy c'tor 2014-05-07 12:32:39 +02:00
Dennis Luxen a0a835bbe6 migrate SimpleLogger to C++11 2014-05-07 12:18:13 +02:00
Dennis Luxen c09e897dab migrate ProgramOptions to C++11 2014-05-07 12:05:51 +02:00
Dennis Luxen c5a3937c80 use constexpr to aid compiler 2014-05-07 12:04:42 +02:00
Dennis Luxen 8e6cc09d2f reformat OSRMException.h 2014-05-07 11:55:29 +02:00
Dennis Luxen dee3529f14 reformat OpenMPWrapper.h 2014-05-07 11:42:41 +02:00
Dennis Luxen bf5d83d228 reformat MercartorUtil.h 2014-05-07 11:42:13 +02:00
Dennis Luxen c2b7336817 reformat MachineInfo.h 2014-05-07 11:38:22 +02:00
Dennis Luxen fc6017c0dd reformat LuaUtil.h 2014-05-07 11:38:11 +02:00
Dennis Luxen 821cc3a177 add missing semi-colon 2014-05-07 10:39:35 +02:00
Dennis Luxen 8939cef020 further C++11 migration 2014-05-07 10:39:35 +02:00
Dennis Luxen fb17653651 add chrono in more places 2014-05-07 10:39:35 +02:00
Dennis Luxen f8a07c7a03 add chrono include 2014-05-07 10:39:35 +02:00
Dennis Luxen eb89436df3 replace all timing by C++11's chrono 2014-05-07 10:39:35 +02:00
Dennis Luxen c1e7ba7118 replace all timing by C++11's chrono 2014-05-07 10:39:34 +02:00
Dennis Luxen ffddea75a4 remove dead code 2014-05-07 10:39:34 +02:00
Dennis Luxen 380111a604 move Azimuth.h to C++11 2014-05-07 10:39:34 +02:00
Dennis Luxen dd4461d473 remove broken assert 2014-05-07 10:39:34 +02:00
Dennis Luxen 2706a0bec1 revert:
- GCC <4.8 does not support thread_local keyword.
- sticking with boost::thread_specific_ptr<> for now
2014-05-07 10:39:34 +02:00
Dennis Luxen 46b207e08e mega-patch:
- fix regression that turned tree into binary search
- use C++11 emplace and thread local facility
- sort out includes
- use much faster approximations to save on trigonometry
- use higher fan-out but make leafs a little more compact
- replace raw C-style array by C++11's std::array
2014-05-07 10:39:34 +02:00
Dennis Luxen d3eda80969 fix include order 2014-05-07 10:38:32 +02:00
Dennis Luxen 66fb5fc9c8 allow approximation of euclidian distances by lat/lon components 2014-05-07 10:38:31 +02:00
Dennis Luxen 2d3fb858ad move StaticGraph to C++11 2014-05-07 10:38:31 +02:00
Dennis Luxen 7bf74c0917 replace UINT_MAX with proper numeric limits call 2014-05-07 10:38:31 +02:00
Dennis Luxen 5b22dffa6f move BinaryHeap to C++11 2014-05-07 10:38:31 +02:00
Dennis Luxen 3ca9420801 fix signed/unsigned comparison 2014-05-07 10:38:31 +02:00
Dennis Luxen 3c948a82c0 reintroduce pesky cmath include 2014-05-07 10:38:31 +02:00
Dennis Luxen c33c6188a8 migrating Algorithms directory to C++11 2014-05-07 10:38:31 +02:00
Dennis Luxen 0d8f2e1b18 remove debug counter, thx @springmeyer 2014-05-07 10:38:31 +02:00
Dennis Luxen 17ed4f908c (partially) migrate Descriptors to use C++11 syntax 2014-05-07 10:38:31 +02:00
Dennis Luxen 946bfb9a26 migrate plugins directory to C++11 2014-05-07 10:38:31 +02:00
Dennis Luxen 6c2c48a611 install luabind manually on Travis 2014-05-07 10:38:30 +02:00
Dennis Luxen 1f36cf9242 bump boost to 1.54 on Travis 2014-05-07 10:38:30 +02:00
Dennis Luxen 3ddac9ac5d fix typo 2014-05-07 10:38:30 +02:00
Dennis Luxen 1b22b348b0 pull boost 1.54 from correct ppa 2014-05-07 10:38:30 +02:00
Dennis Luxen f68721af07 ignore patch if already applied 2014-05-07 10:38:30 +02:00
Dennis Luxen d53b7de5ec patch boost the correct way 2014-05-07 10:38:30 +02:00
Dennis Luxen b25f3891c8 don't install unnecessary libs, patch boost 2014-05-07 10:38:30 +02:00
Dennis Luxen ca58c9ce09 install all libboost 1.49 more explicitly on travis 2014-05-07 10:38:30 +02:00
Dennis Luxen 7a2a535f87 install all libboost 1.49 explicitly on travis 2014-05-07 10:38:30 +02:00
Dennis Luxen 17d220187a install libboost 1.49 explicitly on travis 2014-05-07 10:38:29 +02:00
Dennis Luxen d3a4857826 bump min boost version to 1.49, install from ppa 2014-05-07 10:38:29 +02:00
Dennis Luxen e64fec15b0 pick up g++-4.7 thru cmake variable 2014-05-07 10:38:29 +02:00
Dennis Luxen 3d5f566d86 pick up g++-4.7 thru environment variable 2014-05-07 10:38:29 +02:00
Dennis Luxen c87b63cb24 add ppa quietly 2014-05-07 10:38:29 +02:00
Dennis Luxen cd95f9310b bump builds on travis to gcc/g++ 4.7 2014-05-07 10:38:29 +02:00
Dennis Luxen 297128c19c activate C+11 flags by default 2014-05-07 10:38:29 +02:00
Dennis Luxen 25a385c940 activate C+11 flags by default 2014-05-07 10:38:29 +02:00
Dennis Luxen 181e814139 fix twisted conversion, fixes #1000 2014-05-07 10:38:29 +02:00
Patrick Niklaus 52e5483dfb Display number threads that are really used 2014-05-07 10:38:29 +02:00
Patrick Niklaus 56f6c795ed Fix typos 2014-05-07 10:38:29 +02:00
Dennis Luxen 5d8cfa465b flush less often to disk 2014-05-07 10:38:28 +02:00
Dennis Luxen b6ca4a7a46 fix potential resource leak 2014-05-07 10:38:28 +02:00
Dennis Luxen a45508a96b fix coverity issues 2014-05-07 10:38:28 +02:00
Dennis Luxen a45d274847 fix Linux cmath include 2014-05-07 10:38:28 +02:00
Dennis Luxen e3cc896a42 consolidate duplicated distance calculations 2014-05-07 10:38:28 +02:00
Dennis Luxen 99a47ae87b reduce debug verbosity 2014-05-07 10:38:28 +02:00
Emil Tin b1388b6f30 remove spurious test file 2014-05-07 10:38:28 +02:00
Emil Tin 2cddf90e49 test different status message and query parsing 2014-05-07 10:38:28 +02:00
Emil Tin 85148d1283 tests covering no route found 2014-05-07 10:38:28 +02:00
Dennis Luxen 7b0b378abc fix a performance regression 2014-05-07 10:35:56 +02:00
Dennis Luxen a1ecab2f95 refactor xml parser, uses faster string to double conversion 2014-04-29 16:05:34 +02:00
Dennis Luxen b7704f0c7f fix regression that seg faults if path not found 2014-04-29 11:46:05 +02:00
Dennis Luxen d6962f3a09 fix geometry load on shared memory 2014-04-29 09:50:29 +02:00
Dennis Luxen e44ebe0743 minor refactoring of code layout 2014-04-28 19:37:42 +02:00
Dennis Luxen f02ec41fbc move raw pointer to smart ptrs 2014-04-28 19:37:23 +02:00
Dennis Luxen d0b4ffd154 fix openmp woes on linux 2014-04-28 18:23:56 +02:00
Dennis Luxen 265af1f790 minor refactoring 2014-04-28 17:27:15 +02:00
Dennis Luxen 241d6b482e reenable traffic signal penalty in car profile 2014-04-28 17:26:31 +02:00
Dennis Luxen 45f0af2afc remove unnecessary else statements 2014-04-28 15:08:54 +02:00
Dennis Luxen 7955066d5c remove bitwise operator in conditional 2014-04-28 15:06:26 +02:00
Dennis Luxen ec3f9695cd remove redundant local variable 2014-04-28 13:26:20 +02:00
Dennis Luxen 018c144c76 minor refactoring 2014-04-28 13:19:35 +02:00
Dennis Luxen 56e88b2a56 minor refactoring 2014-04-28 13:19:26 +02:00
Dennis Luxen a2bdc5d8d9 minor refactoring 2014-04-28 13:08:25 +02:00
Dennis Luxen 1b257f7547 fix inverted logic 2014-04-28 13:03:20 +02:00
Dennis Luxen 5d6b05979d remove unused variable 2014-04-28 12:59:24 +02:00
Dennis Luxen 538f8d040a avoid short variable name 2014-04-28 12:58:40 +02:00
Dennis Luxen 7d52aa1272 avoid short variable name 2014-04-28 12:58:00 +02:00
Dennis Luxen d316202834 avoid private static function 2014-04-28 12:56:32 +02:00
Dennis Luxen 0167dfc3c9 shorten line 2014-04-28 12:54:11 +02:00
Dennis Luxen 02dc3dee04 shorten line 2014-04-28 12:52:55 +02:00
Dennis Luxen a5d3bc9578 make function call more legible 2014-04-28 12:52:06 +02:00
Dennis Luxen cfbc6b0441 remove useless parantheses 2014-04-28 12:50:44 +02:00
Dennis Luxen 8c5f8e995e stream-lined error messages: partially implements #986 2014-04-28 11:55:46 +02:00
Dennis Luxen b77dd6699d Merge pull request #992 from DennisOSRM/feature/remove_geometry
Feature/remove geometry
2014-04-28 11:34:49 +02:00
Dennis Luxen 9a153708e6 minor reformatting / shaping up 2014-04-25 16:00:39 +02:00
Dennis Luxen e0027a78e1 fix signed unsigned comparison 2014-04-25 15:48:10 +02:00
Dennis Luxen 51e8113a69 make tests use fuzzy matching instead of tweaked expectations 2014-04-25 15:24:18 +02:00
Dennis Luxen 78f5753a3a fix signed/unsigned comparison 2014-04-25 14:42:06 +02:00
Dennis Luxen 16ca8da438 remove deactivated debug out for good 2014-04-25 13:31:08 +02:00
Dennis Luxen ca6515c58a fix tests to reflect proper rounding of travel times 2014-04-25 13:23:27 +02:00
Dennis Luxen 2ec952032a fix rounding of travel times 2014-04-25 13:22:58 +02:00
Dennis Luxen b0b67a0cdc fix typo setting potentially wrong flags in debug build 2014-04-24 18:14:35 +02:00
Dennis Luxen 0eed39cdf1 rebase branch onto develop 2014-04-24 18:13:50 +02:00
Dennis Luxen ace59411cb fix and/or remove unused variables 2014-04-24 13:31:04 +02:00
Dennis Luxen ef7619d664 fix signed/unsigned comparison 2014-04-24 13:31:04 +02:00
Dennis Luxen 0f8a32f38c shape up code 2014-04-24 13:31:04 +02:00
Dennis Luxen c6a58ff1b4 remove debug lint again 2014-04-24 13:31:04 +02:00
Dennis Luxen 45f751720a fix unpacking of geometry for shared memory 2014-04-24 13:31:04 +02:00
Dennis Luxen ca016e2818 fix unpacking of geometry for shared memory 2014-04-24 13:31:04 +02:00
Dennis Luxen 5da01946b8 fix unpacking of geometry for shared memory 2014-04-24 13:17:11 +02:00
Dennis Luxen 8b3002a685 fix unpacking of geometry for shared memory 2014-04-24 13:17:11 +02:00
Dennis Luxen ede5cca2e7 fix unpacking of geometry for shared memory 2014-04-24 13:17:11 +02:00
Dennis Luxen d0e158ca07 fix unpacking of geometry for shared memory 2014-04-24 13:17:11 +02:00
Dennis Luxen 09dc21af31 remove debug lint 2014-04-24 13:17:11 +02:00
Dennis Luxen 2435fadfbd use boost filesystem specialization instead of the ones from std 2014-04-24 13:15:26 +02:00
Dennis Luxen edef9c11f7 add default clause to switch statement albeit technically superflous 2014-04-24 13:06:57 +02:00
Dennis Luxen 2c9edcaf23 remove debug code 2014-04-24 13:06:57 +02:00
Dennis Luxen 18861d58b5 compile fix for linux / wrong include 2014-04-24 13:06:57 +02:00
Dennis Luxen 9b3dab8055 implement loading of compressed geometries 2014-04-24 13:06:56 +02:00
Dennis Luxen 7a6a5f6612 implement population of shared vector<bool> overload (manually, yikes) 2014-04-24 13:06:56 +02:00
Dennis Luxen f468fcc2b6 implement more details of shared memory store 2014-04-24 13:06:56 +02:00
Dennis Luxen 5d93c68790 remove further debug things 2014-04-24 13:06:56 +02:00
Dennis Luxen fa04706484 remove debug code, add C++11 todo 2014-04-24 13:06:56 +02:00
Dennis Luxen d09be5a80e remove debug code, make variables const 2014-04-24 13:06:56 +02:00
Dennis Luxen a4d6e5c9cc reformat geometry compressor according to new guidelines 2014-04-24 13:06:56 +02:00
Dennis Luxen 4f85fd28cf add todo for the switch to C++11 2014-04-24 13:06:56 +02:00
Dennis Luxen 39914cd933 remove some debug code 2014-04-24 13:06:56 +02:00
Dennis Luxen 038e8cc8b8 remove unneeded edge-offset during query 2014-04-24 13:06:55 +02:00
Dennis Luxen db5fd5506d partial implementation of new datastore functions 2014-04-24 13:06:55 +02:00
Dennis Luxen f2be495e95 implement shared data facade geometry loader and getter functions 2014-04-24 13:06:55 +02:00
Dennis Luxen 6d8465a04d implement geometry uncompressing using STL 2014-04-24 13:06:55 +02:00
Dennis Luxen 4bb5270f25 cut back debug verbosity 2014-04-24 13:06:55 +02:00
Dennis Luxen 0f06c71796 remove debug output 2014-04-24 13:06:55 +02:00
Dennis Luxen 5b8d8a83dd fix mangled offsets and edge weights on compressed edges (all tests passing) 2014-04-24 13:06:55 +02:00
Dennis Luxen 8ec3d549a6 further fixes but forward/reverse edge weights are reversed 2014-04-24 13:06:55 +02:00
Dennis Luxen 394e369b54 fix edge-expanded offsets 2014-04-24 13:06:55 +02:00
Dennis Luxen 899ab9ddc0 remove some uncommented code 2014-04-24 13:06:54 +02:00
Dennis Luxen 8ae467985f turn off colored logging if output is redirected to file 2014-04-24 13:06:54 +02:00
Dennis Luxen 9ccc8a7404 remove first segment if distance is 0 (down to 7 failed) 2014-04-24 12:55:53 +02:00
Dennis Luxen 0b89a9d554 ignore last edge-expanded segment if it spans over to undistinguishable node-based nodes (down to 9 failed) 2014-04-24 12:55:53 +02:00
Dennis Luxen 752fb880be switch edge-expanded street name indexes to be first segment names (18 failed tests left) 2014-04-24 12:55:53 +02:00
Dennis Luxen 549bcb502b minor renaming efforts 2014-04-24 12:55:53 +02:00
Dennis Luxen 44077cb007 refactor and streamline use of TurnInstructionsClass members 2014-04-24 12:55:53 +02:00
Dennis Luxen 7b5902a580 rename phantom nodes members 2014-04-24 12:55:53 +02:00
Dennis Luxen 2861bacd2a fix check for invalid phantom nodes (20 failed left) 2014-04-24 12:55:53 +02:00
Dennis Luxen 776ac3bb2a remove superflous include 2014-04-24 12:55:52 +02:00
Dennis Luxen b429d9f509 remove unreachable code 2014-04-24 12:55:52 +02:00
Dennis Luxen 26397e4692 remove debug output 2014-04-24 12:55:52 +02:00
Dennis Luxen 48d23194af fix traffic signal penalty in compressed graph 2014-04-24 12:55:52 +02:00
Dennis Luxen bcaea1a617 remove debug output 2014-04-24 12:54:25 +02:00
Dennis Luxen 12b43d206c unpack properly when source and target are reversed on same edge 2014-04-24 12:54:24 +02:00
Dennis Luxen 9cc49f6ff3 remove debug output 2014-04-24 12:54:24 +02:00
Dennis Luxen 87f036e538 fixing sentinel nodes in adjacency list graph data structure 2014-04-24 12:54:24 +02:00
Dennis Luxen fdebec6448 correct partial distances 2014-04-24 12:51:18 +02:00
Dennis Luxen ba37836e24 allow graphs with zero edges to load 2014-04-24 12:51:18 +02:00
Dennis Luxen b60cfd9294 last segment gets it proper name now 2014-04-24 12:51:17 +02:00
Dennis Luxen bc0665cd9f fix offsets for start and end 2014-04-24 12:51:17 +02:00
Dennis Luxen 0dbe5e6593 fix shortest ch query for certain cases 2014-04-24 12:51:17 +02:00
Dennis Luxen 9b33aaa11a fix test for borked lat/lons 2014-04-24 12:51:17 +02:00
Dennis Luxen 024b78da7c Forward decl to cut compile times 2014-04-24 12:51:17 +02:00
Dennis Luxen 2a64297506 Forward decl to cut compile times 2014-04-24 12:51:17 +02:00
Dennis Luxen 09c76939f1 minor code beauty issue 2014-04-24 12:51:17 +02:00
Dennis Luxen 0b3f3bdf92 fix test for borked lat/lons 2014-04-24 12:51:17 +02:00
Dennis Luxen 3b29eeb6b6 unpacking start and target edge fixes plus some refactoring 2014-04-24 12:51:16 +02:00
Dennis Luxen 985270bb02 parse maxspeed in LUA 2014-04-24 12:51:16 +02:00
Dennis Luxen 6b91d6692f unpacking target correctly, also partial unpacking origin and destination are on the very same packed edge 2014-04-24 12:47:36 +02:00
Dennis Luxen eca09e6c81 unpacking of target segment works 2014-04-24 12:47:00 +02:00
Dennis Luxen 874c579f86 correctly unpacking the first segment 2014-04-24 12:15:48 +02:00
Dennis Luxen a0bddab169 3/4 unpack cases working 2014-04-24 12:15:04 +02:00
Dennis Luxen b679a94930 first segment needs to be properly cut 2014-04-24 12:15:04 +02:00
Dennis Luxen 5bde545ce3 All good, but needs unpacking of start and end 2014-04-24 12:07:46 +02:00
Dennis Luxen e68c750389 remove boost typedefs 2014-04-24 12:05:43 +02:00
Dennis Luxen f16cb3c52d compressed geometries get serialized in R-tree 2014-04-24 12:05:43 +02:00
Dennis Luxen f7d5b0db9c uncompressed edges get serialized correctly'ish 2014-04-24 12:05:43 +02:00
Dennis Luxen ba0b664e3f further copy edits 2014-04-24 12:05:43 +02:00
Dennis Luxen 149d037824 further copy edits 2014-04-24 12:05:43 +02:00
Dennis Luxen d0349d9b0d further copy edits 2014-04-24 12:05:42 +02:00
Dennis Luxen c71c8b0047 Unpacking of intermediate paths 2014-04-24 12:03:19 +02:00
Dennis Luxen 3be644265b remove remnants of C-Style includes 2014-04-24 11:38:54 +02:00
Dennis Luxen cd6874ca60 remove remnants of C-Style includes 2014-04-24 11:28:12 +02:00
Dennis Luxen 7083978f9d remove remnants of C-Style includes 2014-04-24 11:28:12 +02:00
Dennis Luxen 4d132489c1 remove remnants of C-Style includes 2014-04-24 11:28:11 +02:00
Dennis Luxen b5170ed1fd remove trivial geometry nodes 2014-04-24 11:28:11 +02:00
Dennis Luxen cc915dbef2 take 2: workaround platform dependend outputs, discussed in #986 2014-04-21 19:25:24 +02:00
Dennis Luxen 9a5bf1ee95 workaround platform dependend outputs, discussed in #986 2014-04-21 18:31:45 +02:00
Dennis Luxen a14b6af5c0 Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2014-04-21 17:41:54 +02:00
Dennis Luxen ec372ad01d implement tests marked todo, implements #986 2014-04-21 17:40:08 +02:00
Dennis Luxen 8a412ef69e implementing option tests marked @todo 2014-04-21 17:40:08 +02:00
Dennis Luxen c978364f49 implementing option tests marked @todo 2014-04-21 17:40:07 +02:00
Emil Tin 61d2a99dd4 remove left-over feature file 2014-04-21 17:40:07 +02:00
Emil Tin fdba916d83 cuke: fix options test, should use osrm file, not osm 2014-04-21 17:40:07 +02:00
Emil Tin a12209e61d cuke: test options for osrm-extract and osrm-prepare 2014-04-21 17:40:07 +02:00
Patrick Niklaus fc6607ce9e better error messages for extractor
Previously extractor would just crash because of unhandled exceptions.
Now it displays meaningful error messages.
2014-04-21 17:40:07 +02:00
Dennis Luxen 62ccbc7490 use insert(.) on unordered map instead of access operator, potential resource leak 2014-04-21 17:40:07 +02:00
Dennis Luxen b2b36984e1 make single parameter c'tor explicit 2014-04-21 17:40:07 +02:00
Dennis Luxen c10208407d Revert "fix resource leak, coverity issue 1198844"
This reverts commit 3a1a51ac46.
2014-04-21 17:40:07 +02:00
Dennis Luxen 64720c2d2e several lints fixed that were detected by facebook's flint 2014-04-21 17:40:07 +02:00
Dennis Luxen da81e4839a reverse include order 2014-04-21 17:40:07 +02:00
Dennis Luxen 25013afdd2 make single argument c'tor explicit (thx flint) 2014-04-21 17:40:06 +02:00
Dennis Luxen 678829ab28 fix include order (thx flint) 2014-04-21 17:40:06 +02:00
Dennis Luxen d8dffa9d71 make single paramter c'tors explicit (thx flint) 2014-04-21 17:40:06 +02:00
Dennis Luxen be8810077a make single paramter c'tors explicit (thx flint) 2014-04-21 17:40:06 +02:00
Dennis Luxen ee4ecb9783 fix inverted logic 2014-04-21 17:40:06 +02:00
Dennis Luxen eaed8572f0 make all error messages JSON 2014-04-21 17:40:06 +02:00
Dennis Luxen e91e6fb068 check for invalid parameter, coverity issue 1198843, also reformat source 2014-04-21 17:40:06 +02:00
Dennis Luxen cb17a0a49b fix resource leak, coverity issue 1198844 2014-04-21 17:40:06 +02:00
Dennis Luxen 248df9ca2d catch exceptions that may occur, coverity issue 1198845 2014-04-21 17:40:06 +02:00
Dennis Luxen fa615ed9f4 don't binpack parameters on 100 column width 2014-04-21 17:40:05 +02:00
Dennis Luxen 65aa4af6d9 allow 120 char wide columns 2014-04-21 17:40:05 +02:00
Dennis Luxen df56ad476e add clang format style file (to change) 2014-04-21 17:40:05 +02:00
Dennis Luxen 8e20fa89e8 catch exceptions that may occur, coverity issue 1198846 2014-04-21 17:40:05 +02:00
Dennis Luxen 76058729e0 dont reset coloring when it wasn't set in the first place, partially fixes Windows woes. See #979 2014-04-21 17:40:05 +02:00
Dennis Luxen 88a0cc8c9c dont reset coloring when it wasn't set in the first place 2014-04-21 17:40:05 +02:00
Dennis Luxen 2ea45c0c58 implement tests marked todo, implements #986 2014-04-21 17:29:48 +02:00
Dennis Luxen bf27f41f52 implementing option tests marked @todo 2014-04-21 17:21:02 +02:00
Dennis Luxen 853f6012d5 implementing option tests marked @todo 2014-04-21 17:20:15 +02:00
Emil Tin 14ad02777f remove left-over feature file 2014-04-21 17:18:30 +02:00
Emil Tin c1eb00f6d5 cuke: fix options test, should use osrm file, not osm 2014-04-21 16:07:03 +02:00
Emil Tin e5adaf974d cuke: test options for osrm-extract and osrm-prepare 2014-04-21 15:24:42 +02:00
Patrick Niklaus 727a29600d better error messages for extractor
Previously extractor would just crash because of unhandled exceptions.
Now it displays meaningful error messages.
2014-04-19 13:19:48 +02:00
Dennis Luxen a5ebdb9243 use insert(.) on unordered map instead of access operator, potential resource leak 2014-04-17 11:05:26 +02:00
Dennis Luxen 2ef37ee798 make single parameter c'tor explicit 2014-04-17 10:30:15 +02:00
Dennis Luxen c23575786c Revert "fix resource leak, coverity issue 1198844"
This reverts commit 3a1a51ac46.
2014-04-16 18:13:59 +02:00
Dennis Luxen 5a0d693c93 several lints fixed that were detected by facebook's flint 2014-04-16 16:59:40 +02:00
Dennis Luxen c6902528b3 reverse include order 2014-04-16 16:22:13 +02:00
Dennis Luxen f90993be86 make single argument c'tor explicit (thx flint) 2014-04-16 16:21:16 +02:00
Dennis Luxen e7db076648 fix include order (thx flint) 2014-04-16 16:16:42 +02:00
Dennis Luxen 6d52a7d3d4 make single paramter c'tors explicit (thx flint) 2014-04-16 16:15:49 +02:00
Dennis Luxen 3368b492b9 make single paramter c'tors explicit (thx flint) 2014-04-16 16:13:48 +02:00
Dennis Luxen 1222aa6d25 fix inverted logic 2014-04-09 23:10:58 -04:00
Dennis Luxen 67efd150d4 make all error messages JSON 2014-04-09 18:12:45 -04:00
Dennis Luxen 9894f2e053 check for invalid parameter, coverity issue 1198843, also reformat source 2014-04-09 12:03:19 -04:00
Dennis Luxen 3a1a51ac46 fix resource leak, coverity issue 1198844 2014-04-09 11:59:48 -04:00
Dennis Luxen a1b5429f4e catch exceptions that may occur, coverity issue 1198845 2014-04-09 11:57:15 -04:00
Dennis Luxen b11e39554f don't binpack parameters on 100 column width 2014-04-09 11:55:59 -04:00
Dennis Luxen a92c764945 allow 120 char wide columns 2014-04-09 11:48:48 -04:00
Dennis Luxen f581396f1d add clang format style file (to change) 2014-04-09 11:44:56 -04:00
Dennis Luxen 6814926f05 catch exceptions that may occur, coverity issue 1198846 2014-04-09 11:34:15 -04:00
Dennis Luxen b8f882dba4 dont reset coloring when it wasn't set in the first place, partially fixes Windows woes. See #979 2014-04-07 15:11:04 -04:00
Dennis Luxen 783e8edf71 dont reset coloring when it wasn't set in the first place 2014-04-07 15:07:07 -04:00
Dennis Luxen 966f1d654e Merge branch 'develop' for release v0.3.8 2014-04-04 15:35:37 +02:00
Dennis Luxen 02adaac468 remove an empty line to test jenkins web hook, take 2 2014-04-03 19:45:00 +02:00
Dennis Luxen 2b2a0d685f remove an empty line to test jenkins web hook 2014-04-03 19:27:13 +02:00
Dennis Luxen 6f2ec17640 pass path as ref to JSONDescriptor.h 2014-04-03 18:28:16 +02:00
Dennis Luxen 6c158f5a1b move typedef into a single line 2014-04-03 12:08:51 +02:00
Emil Tin df83dfdfe8 cuke: test travel time of individual instructions 2014-04-02 16:05:09 +02:00
Dennis Luxen 165c252fc8 disable lto partitioning when possible (fixes GCC < 4.8 issues, e.g. Debian stock compiler) 2014-04-02 10:49:32 +02:00
Dennis Luxen d21f63d327 activate LTO on platforms that support it, ie. most recent compilers 2014-04-01 18:11:45 +02:00
Dennis Luxen 05c33bee78 Merge pull request #973 from DennisOSRM/fix/clean_profile_indentation
cleanup indentation of lua profiles
2014-04-01 17:07:39 +02:00
Emil Tin 762dd17512 cleanup indentation of lua profiles 2014-04-01 15:40:52 +02:00
Emil Tin 5f7065848e clean cucumber comments, fixes 'file to long' problem with latest version of cucumber 2014-04-01 15:30:55 +02:00
Emil Tin 65e020a627 cuke: use new speed tests where relevant 2014-04-01 14:56:25 +02:00
Emil Tin 793e477898 active tests for fixed bugs 2014-04-01 14:56:25 +02:00
Dennis Luxen a5232f857e failed tests fail the build, see #970 2014-04-01 12:41:48 +02:00
Dennis Luxen 0ef7a72b33 Merge PR #970 'experimental/cuke_import_format' into develop 2014-04-01 12:02:56 +02:00
Emil Tin 717787ff62 travis: set osrm timeout to 60s 2014-03-31 21:46:01 +02:00
Emil Tin 2d599a5190 cuke: optional timeout 2014-03-31 21:45:53 +02:00
Emil Tin e73145d558 travis: set osrm timeout to 60s 2014-03-31 16:55:39 +02:00
Emil Tin 220e7748a9 cuke: use .osm by default, add tests for .pbf 2014-03-31 16:55:39 +02:00
Emil Tin 72f41c5b4f check for empty input in extractor, same msg in prepare 2014-03-31 16:55:39 +02:00
Emil Tin 775627473a remove .osm deprecation warning 2014-03-31 16:55:39 +02:00
Emil Tin ba2356d2ba cuke: optional timeout 2014-03-31 16:55:01 +02:00
Emil Tin 179f53b21b cuke: fix test for -v on travis 2014-03-31 15:29:00 +02:00
Emil Tin 3ccd3b5650 cuke: increase osrm launch/shutdown timeout 2014-03-31 13:55:29 +02:00
Dennis Luxen 224655f8cb fix osmosis install on Travis CI. May fix #970 2014-03-31 11:53:10 +02:00
Emil Tin fd96c7c488 fix travel speeds for cars 2014-03-27 18:22:04 +01:00
Emil Tin 45c96f73c2 cuke test showing odd car speeds 2014-03-27 18:02:42 +01:00
Emil Tin c5893ef6e8 cuke: check for invalid expectation formats 2014-03-27 17:32:37 +01:00
Emil Tin 8b1f09d302 cuke: test speed, fix logging, clear log files on each run 2014-03-27 10:38:03 +01:00
Emil Tin cb1b824a75 cuke: improve routability tables, test for speed 2014-03-27 10:38:02 +01:00
Emil Tin b0ce9e4af7 cuke: don't use scenario outlines, to fix problem with jenkins 2014-03-27 10:38:02 +01:00
Dennis Luxen aae3637e0c implements #958 2014-03-25 14:54:52 +01:00
Dennis Luxen 33faa2f252 set output size on StockReplies properly 2014-03-24 18:13:40 +01:00
andrewbts 482d79ef4b Fix comment typo
SharedDataFacade.h is for the shared memory case; old comment implied the opposite.
2014-03-24 15:52:54 +01:00
Dennis Luxen 6bdd517c43 new cucumber profile for Jenkins that doesn't fail because of an old Gherkin bug 2014-03-24 14:29:19 +01:00
Dennis Luxen a337109618 implements #961 2014-03-24 12:16:30 +01:00
Dennis Luxen 0ae5ace520 Merge PR #960 2014-03-24 11:30:55 +01:00
Dennis Luxen a4306cddef remove NO-BREAK SPACE (U+00A0) that broke testing 2014-03-24 10:16:32 +01:00
Dennis Luxen 1f97c5518e fixes build errors from 9e10b94 2014-03-24 10:06:42 +01:00
Clint Harris 1823a4da36 Added missing Boost date_time component. Resolves issue #925. 2014-03-22 12:30:24 -04:00
Clint Harris d60caf7095 CMake now adds RPATH info to executables. Resolves issue #960. 2014-03-22 11:44:51 -04:00
Emil Tin 9e10b94339 cuke: test file options 2014-03-22 12:01:07 +01:00
Emil Tin 7048dd754d cuke: check exit code as last step, add step to non-existing file 2014-03-22 00:47:20 +01:00
Emil Tin de29e17d95 cuke: add a few options steps 2014-03-22 00:38:53 +01:00
Emil Tin c299989ff7 reorganize options tests 2014-03-22 00:33:23 +01:00
Emil Tin 0b655ea6a1 trial option 2014-03-22 00:16:45 +01:00
Dennis Luxen 538827942a workaround for inconsistent error messages across boost versions 2014-03-20 14:38:16 +01:00
Dennis Luxen 8bd5f69e04 fixes #958, activates 2 additional tests 2014-03-20 13:19:36 +01:00
Dennis Luxen c470ea9fa1 lock to RAM on Linux only after options are parsed 2014-03-20 09:53:05 +01:00
Emil Tin c1806476af cuke: test osrm-routed options 2014-03-19 19:28:24 +01:00
Emil Tin af41c9f6e4 cuke: detach osrm-routed to avoid zombie processes 2014-03-19 18:03:47 +01:00
Dennis Luxen 823e8d24b5 deactivate file validation as it is externally handled 2014-03-18 16:27:46 +01:00
Dennis Luxen 4028c0b24f implement proper checks for conflicting inputs 2014-03-18 16:22:42 +01:00
Dennis Luxen 2e4ff30103 fix parameter regression when using shared memory 2014-03-18 10:51:36 +01:00
Dennis Luxen 121dcca7e3 refactor a bit for better readability 2014-03-17 15:46:13 +01:00
Dennis Luxen 5adfe2d46b transfrom short switch statements into readable if statements 2014-03-17 15:45:47 +01:00
Dennis Luxen 03f4aaa2d6 make functions const, make short variable name more telling 2014-03-17 15:31:13 +01:00
Dennis Luxen d67c3f36ff call function object instead of static function 2014-03-17 15:28:42 +01:00
Dennis Luxen e199d30beb move static function into funtion object 2014-03-17 15:27:33 +01:00
Dennis Luxen 27e2de2b1f fix inverted logic 2014-03-17 15:19:24 +01:00
Dennis Luxen 8a6d07342e remove redundant local variable 2014-03-17 15:14:29 +01:00
Dennis Luxen ab39457fe1 move bit-wise operator out of conditions 2014-03-17 15:13:36 +01:00
Dennis Luxen e6933ea413 avoid private static member functions 2014-03-17 15:12:13 +01:00
Dennis Luxen 422e0c44d5 reverse inverted logic 2014-03-17 14:55:33 +01:00
Dennis Luxen ad03b409ab make variable names more telling 2014-03-17 14:42:24 +01:00
Dennis Luxen 38ae213260 make variable names more telling 2014-03-17 14:40:10 +01:00
Dennis Luxen 6a0a59896e make variable names more telling 2014-03-17 14:39:24 +01:00
Dennis Luxen 187cb56364 split long line in two 2014-03-17 14:37:33 +01:00
Dennis Luxen 1fe96d0d22 remove collapsable if statement 2014-03-17 14:36:34 +01:00
Dennis Luxen 52b859b3e6 remove pesky fun ptr from CRC32 computation 2014-03-17 11:07:01 +01:00
Dennis Luxen 9483b781e2 provide better feedback on command lines 2014-03-14 11:14:19 +01:00
Dennis Luxen 791f475168 implement #951, better command line handling 2014-03-14 10:15:39 +01:00
Dennis Luxen 6b69d6dce2 implements #951 2014-03-13 22:48:09 +01:00
Dennis Luxen 720abbc81e minor tweak to disable C++11 flag on demand 2014-03-13 22:08:03 +01:00
Dennis Luxen e3183cfd16 set stdlib explicitly, fix indentations 2014-03-13 13:28:58 +01:00
Dennis Luxen e07423f260 minor copy-edits to PR #946 2014-03-12 13:56:25 +01:00
Daniel Karch ecfda146b2 minor change 2014-03-12 10:48:54 +01:00
Daniel Karch f923f508f5 applied requested changes to EdgeBasedNode.h 2014-03-12 10:24:35 +01:00
Daniel Karch b465dabe77 Refactored the EdgeBasedNode class.
This includes more robust computations in ComputePerpendicularDistance.
There were cases where ComputePerpendicularDistance divided by zero and had
to handle special cases, even though this was not necessary.
2014-03-11 16:40:20 +01:00
Dennis Luxen d8d6b91257 std lib adjustable on all versions of OS X 2014-03-06 14:48:20 +01:00
Dennis Luxen 0946fac11f Escape characters in JSON instead of HTML-entetizing, implements #895 2014-03-04 14:54:41 +01:00
Dennis Luxen c50b69c654 Escape characters in JSON instead of HTML-entetizing, implements #895 2014-03-04 14:54:34 +01:00
Dennis Luxen 32bf99ba40 decode all URIs, fixes #937, 386 2014-03-04 13:56:11 +01:00
Dennis Luxen 0baa8215ef fix unitialized variable warning 2014-03-04 13:52:41 +01:00
Dennis Luxen 85a007d87b set backward speed properly, partially fixes #936 2014-03-03 15:31:57 +01:00
Dennis Luxen 7b14de13ec assign complete edge data if duplicate shortcut edge has lower weight 2014-03-03 14:08:34 +01:00
Dennis Luxen 117ebe1c32 add switch to override stdlib implementation on OS X < 10.9 2014-02-27 11:07:53 +01:00
Dennis Luxen 2b010811d8 fixes #932, and partially also fixes #921 2014-02-25 12:50:08 +01:00
Dennis Luxen 4b94f1fa83 implements compilation issues on non-X86(-64) targets, also see #921 2014-02-25 10:57:57 +01:00
Dennis Luxen d73f3ebd1b fix tests for scaled maxspeeds 2014-02-14 18:23:25 +01:00
Dennis Luxen 4c48cda4cd refactor HashTable facade class 2014-02-14 18:18:26 +01:00
Dennis Luxen 9e64ccdbf2 scale maxspeeds to 2/3 to be more realistic and in sync with the default profile 2014-02-14 18:17:37 +01:00
Dennis Luxen aedf9d3a91 run debug build on different port 2014-02-14 18:17:00 +01:00
Dennis Luxen 0ee94a5729 add new tool to ignore list 2014-02-13 18:11:53 +01:00
Dennis Luxen 2130630293 run tests on different ports 2014-02-12 16:34:46 +01:00
Dennis Luxen 445cf5d42c ignore broken osmosis from Travis CI repo 2014-02-12 16:25:57 +01:00
Dennis Luxen 08f13a1776 install osmosis manually 2014-02-12 16:22:26 +01:00
Dennis Luxen f406dc51fa Merge branch 'patch-1' of https://github.com/alex85k/Project-OSRM into alex85k-patch-1 2014-02-12 15:27:12 +01:00
Dennis Luxen 7580777e43 implement and use portable implementation of canonical file paths, see #909, this time against dev branch 2014-02-11 15:55:22 +01:00
Dennis Luxen ea30005762 fixes and closes #914 and updates #907 2014-02-11 14:34:47 +01:00
Dennis Luxen 7794cd6274 do not instantiate shared memory facility in routed, fixes #905 and #910 2014-02-11 11:35:29 +01:00
Dennis Luxen 45a4fe44f7 disable cucumber tests until the travis CI issues are sorted out 2014-02-10 16:53:29 +01:00
Dennis Luxen 1d225078eb install osmosis manually, take three 2014-02-10 16:01:48 +01:00
Dennis Luxen 533caf8c0f install osmosis manually, take two 2014-02-10 15:45:24 +01:00
Dennis Luxen e6c25ae290 install osmosis manually 2014-02-10 15:35:36 +01:00
Dennis Luxen 264077acac install libpostgis-java to fulfil dependencies 2014-02-10 15:21:48 +01:00
Dennis Luxen 0ff18881b6 explicit rvm use, workaround for Travis CI testing woes 2014-02-10 15:02:05 +01:00
Dennis Luxen 9e0e536dbc fix yml syntax 2014-02-10 11:58:56 +01:00
Dennis Luxen 1a9e54ba33 install bundler without sudo, change Travis environment 2014-02-10 11:57:48 +01:00
Dennis Luxen 9378af1057 fixes #907, segfault when ampersands where missing 2014-02-10 11:43:26 +01:00
Dennis Luxen cd6075a884 Merge pull request #906 from andrewbts/patch-1
Fix comment typo
2014-02-05 20:41:12 +01:00
andrewbts 1da3a00b92 Fix comment typo
SharedDataFacade.h is for the shared memory case; old comment implied the opposite.
2014-02-05 11:19:33 -08:00
alex85k 275961f088 Fix assertion in debug version
When running tests on FreeBSD 10 on debug verion I got boost assertion errors in mutex.hpp:79 . 

It seems that mutex unlock is not needed (it is already unlocked and behavior is undefined).
2014-02-04 19:56:23 +06:00
Dennis Luxen f14fac3f7d fixes off-by-one and testing issue discussed in 889 2014-02-01 16:02:43 +01:00
Dennis Luxen ce784e0491 distinguish between left and right, thx @emiltin 2014-01-27 12:58:23 +01:00
Dennis Luxen 65ad3bb941 fix test regression 2014-01-27 12:55:17 +01:00
Dennis Luxen b5b4280c3b remove c-style calls to fabs 2014-01-27 11:26:34 +01:00
Dennis Luxen 0649f6e607 preparing call of turn penalty function 2014-01-27 11:18:26 +01:00
Dennis Luxen 22c2efded9 Some mild refactoring of the BinaryHeap code. style only 2014-01-24 11:24:23 +01:00
Dennis Luxen 7825279405 reverting back to two cores on travis 2014-01-24 10:17:57 +01:00
Dennis Luxen 2623c7023c compile on travis with the maximum number of cores 2014-01-23 13:47:05 +01:00
Dennis Luxen 2138fdfadf re-enable cucumber tests on travis CI 2014-01-23 13:44:40 +01:00
Dennis Luxen 40517e3010 implements #872 2014-01-23 13:31:29 +01:00
Dennis Luxen 1341214044 Add fwd decl to slash compile time 2014-01-23 13:30:38 +01:00
Dennis Luxen 34e2ef13cf use z0 parameters on z0 2014-01-23 13:20:57 +01:00
Dennis Luxen 058219528d fix floating point accuracy woes on certain hardware platforms 2014-01-22 19:35:30 +01:00
Dennis Luxen f4bd175616 fixes #881 2014-01-22 14:52:31 +01:00
Dennis Luxen fea0c07e1c implements #386 2014-01-21 16:31:29 +01:00
Dennis Luxen f684fa9a7b fix tests to resemble the fixed duration calculation 2014-01-21 16:11:51 +01:00
Dennis Luxen 2855b94aa8 remove disabled debug output 2014-01-21 15:12:06 +01:00
Dennis Luxen 9958aaae4f fixes #871 2014-01-20 19:24:20 +01:00
Dennis Luxen 289e5ada2c catch prev. uncaught exception, coverity issue 1121925 2014-01-09 18:21:07 +01:00
Dennis Luxen 648eed6532 fix resource leak, performance issue, alternative route success rate. coverity issue 971431 2014-01-09 18:05:29 +01:00
Dennis Luxen d94955d51e fix resource leak, coverity issue #1121924 2014-01-09 17:11:31 +01:00
Dennis Luxen 046fe93f1f refactor ExtractorStructs.h for faster compiles. achieves approx. 10 secs 2014-01-09 16:13:35 +01:00
Dennis Luxen ce60af5029 fixes issues #770 and #856 2014-01-08 17:18:59 +01:00
Dennis Luxen dbe70ffc8a save 4 bytes per internal edge 2014-01-08 17:11:31 +01:00
Dennis Luxen 8acf081be3 remove dead function decl 2013-12-27 15:47:51 +01:00
Dennis Luxen c5f6065280 reorder code to make it a bit more readable 2013-12-27 12:38:08 +01:00
Dennis Luxen 07509ba5c9 remove left-over debug output 2013-12-27 12:15:17 +01:00
Dennis Luxen 8b3c8f7093 refactoring variable names and layout to be more readable 2013-12-23 17:55:29 +01:00
Dane Springmeyer c3e0b68399 fix pkg-config --static when pthread is reported 2013-12-21 13:14:48 -05:00
Dane Springmeyer f0dd1fdfc7 pkg-config fixes 2013-12-20 14:00:30 -05:00
DennisOSRM 5fd8c0938a include and typo fixes 2013-12-20 18:14:09 +01:00
DennisOSRM b3f4aa4504 further include cleanup 2013-12-20 18:01:53 +01:00
DennisOSRM 4718cf6cc0 fixed signed/unsigned comparison 2013-12-20 15:30:39 +01:00
DennisOSRM ac07c78664 build libOSRM static library implicitly. Overridable by -DBUILD_SHARED_LIBS:BOOL=OFF 2013-12-20 13:24:25 +01:00
DennisOSRM 4a3db7e2c3 Merging PR #847 manually 2013-12-20 13:15:57 +01:00
DennisOSRM a23158f986 remove deleted files 2013-12-20 13:14:02 +01:00
DennisOSRM 838322299a generate pkgconfig file 2013-12-20 13:13:35 +01:00
DennisOSRM 41f3f53540 move includes to include/osrm 2013-12-20 13:12:56 +01:00
Dennis Luxen a26d982f52 deactivate dead code 2013-12-19 19:19:26 +01:00
Dane Springmeyer 5e4121ac58 libosrm as static lib 2013-12-18 18:08:25 -05:00
Dennis Luxen 81d8c8f9bf don't inline code in debug build 2013-12-18 18:33:24 +01:00
Dennis Luxen 0c34addfa7 fix signed/unsigned comparison 2013-12-18 15:50:14 +01:00
Dennis Luxen 6a68fe6a4f fix comparison between signed and unsigned integer 2013-12-18 13:19:23 +01:00
Dennis Luxen 0d246a4422 enable profiling information in debug build 2013-12-18 13:16:32 +01:00
Dennis Luxen 991c9f2f8b remove superflous include 2013-12-18 12:01:16 +01:00
Dennis Luxen ffd36b5489 add missing include 2013-12-18 12:00:58 +01:00
Dennis Luxen b9149658a8 remove unused variable 2013-12-18 12:00:35 +01:00
Dennis Luxen 21ff3fbccd un-lint'ing CMakeLists.txt 2013-12-17 21:42:00 +01:00
Dennis Luxen 90efbefbec install includes to include/osrm 2013-12-17 20:26:15 +01:00
Dennis Luxen 8f89d75edc remove deleted files from repo 2013-12-17 18:02:49 +01:00
Dennis Luxen 5d082f53ae remove deleted files from repo 2013-12-17 18:02:34 +01:00
Dennis Luxen 591d79ba49 remove deleted files from repo 2013-12-17 18:02:24 +01:00
Dennis Luxen 5ee6ede824 remove deleted files from repo 2013-12-17 18:02:01 +01:00
Dennis Luxen 095a58b1bd remove deleted files from repo 2013-12-17 18:01:42 +01:00
Dennis Luxen fd2f000075 install lib header files with make install target 2013-12-17 17:59:44 +01:00
Dane Springmeyer bb244646df bake gitdescription and uuid into OSRM library to avoid failure points of linking them directly 2013-12-16 18:49:35 -05:00
Dane Springmeyer 238dd07cf6 fix linking order to unbreak linux builds against static protobuf and libz 2013-12-16 17:03:17 -05:00
Dennis Luxen aea5e446e5 minor efficiency improvements 2013-12-16 19:52:57 +01:00
Dennis Luxen 203beff4d2 remove dead code 2013-12-16 18:33:08 +01:00
Dennis Luxen cb6f4ad646 (partially) sanitize capitalization 2013-12-16 17:58:57 +01:00
Dennis Luxen f7b72dd136 minor typo 2013-12-16 17:52:45 +01:00
Dennis Luxen 96aff57275 fixes #731, perpendicular projection to nearest location 2013-12-16 17:36:36 +01:00
Dennis Luxen 4b46d07380 remove debug output 2013-12-16 17:32:55 +01:00
Dennis Luxen 204f7c918e remove empty line 2013-12-16 17:26:18 +01:00
Dennis Luxen b1c83e6588 link against right pthreads library 2013-12-16 17:25:17 +01:00
Dennis Luxen c55bd11377 Merge PR 838
Conflicts:
	CMakeLists.txt
2013-12-16 12:52:41 +01:00
Dennis Luxen 885a9df356 remove duplicate symbol 2013-12-16 11:39:38 +01:00
Dennis Luxen 0a373018c6 properly link osrm-prepare 2013-12-16 11:36:59 +01:00
Dennis Luxen 8c4c1a56fd reduce compile time by using fwd decls 2013-12-16 11:29:38 +01:00
Dennis Luxen de790c7c19 delete file 2013-12-16 11:21:46 +01:00
Dennis Luxen 3c2bf76103 implements #839, check for 32 bits properly, bump required boost version to 1.46 2013-12-16 11:21:30 +01:00
Dane Springmeyer 13bc41fc36 CMake: Respect CXXFLAGS set in environment
Without this change the `CXXFLAGS` environment setting is not respected (tested on OS X 10.8/clang++)
2013-12-15 15:32:15 -05:00
Dennis Luxen 758027e2e0 untangling includes to cut down compile time 2013-12-13 18:49:05 -05:00
Dennis Luxen 25b352aeab add/delete several files 2013-12-13 17:27:31 -05:00
Dennis Luxen b030fe7db2 break out Coordinate in compile unit 2013-12-13 17:26:57 -05:00
Dennis Luxen 9b09c9f0c3 move includes into compile unit 2013-12-13 12:34:21 -05:00
Dennis Luxen de73809bb9 remove unneeded includes 2013-12-13 12:33:41 -05:00
Dennis Luxen 7144f69683 movve osrm class into hidden object 2013-12-13 12:32:24 -05:00
Dennis Luxen c3396fa6fd add compile targets for the main binaries (not the aux utils) 2013-12-13 10:55:57 -05:00
Dennis Luxen 924a41a2f4 Initialize pointer always 2013-12-13 09:52:57 -05:00
Dennis Luxen a492bf3885 kill superflous semicolon 2013-12-13 09:52:22 -05:00
Dennis Luxen 662714fca3 add another minor viaroute check 2013-12-12 18:37:36 -05:00
Dennis Luxen 4fc4e93ab5 adapt tests to changed output, killed version and transactionId 2013-12-12 18:37:00 -05:00
Dennis Luxen d0b5929a9e explicitly give the locations of all via locations in response 2013-12-12 18:35:23 -05:00
Dennis Luxen 58dc98460b remove left-over todo marker 2013-12-12 18:33:27 -05:00
Dennis Luxen e0dd4848b0 add function to set edge target 2013-12-12 18:32:12 -05:00
Dennis Luxen cef01f5dbc remove superflous blank padding 2013-12-12 18:31:08 -05:00
Dennis Luxen 88af9c545b add util funtion to iterate adjacent pairs of a stl compliant container 2013-12-12 18:29:51 -05:00
Dennis Luxen cd1f45e248 Util/ContainerUtils.h 2013-12-12 18:28:39 -05:00
Dennis Luxen d5eee3138f fixes issues #768, #794, #812 2013-12-11 15:36:32 -05:00
Dennis Luxen fdfe0ce63d Implements #822 (partially) 2013-12-09 14:20:35 -05:00
Dennis Luxen ba6641ed9a fix node-OSRM build, https://github.com/DennisOSRM/node-OSRM/issues/19 2013-12-09 12:03:02 -05:00
Dennis Luxen fb13e3ddb8 add new include 2013-12-09 11:47:42 -05:00
Dennis Luxen ca17efd764 break out OriginalEdgeData class into its own include 2013-12-09 11:45:45 -05:00
Dennis Luxen dd104a49f6 break-out Requesthandler into compile unit 2013-12-09 10:54:17 -05:00
Dennis Luxen b849d008d2 break-out Requesthandler into compile unit 2013-12-09 10:48:32 -05:00
Dennis Luxen 1e09935501 make counters available in release and debug build, take2 2013-12-09 09:17:38 -05:00
Dennis Luxen d7e558350b make counters available in release and debug build 2013-12-09 09:04:44 -05:00
Dennis Luxen 04afe8fbf1 remove pesky sstream 2013-12-08 19:43:43 +01:00
Dennis Luxen 392726bad3 remove pesky sstream 2013-12-08 19:42:48 +01:00
Dennis Luxen 19285d61ab reorder includes to cut compile time 2013-12-08 19:38:13 +01:00
Dennis Luxen 015b29e8a3 remove superflous ifdef 2013-12-08 19:12:01 +01:00
Dennis Luxen aff61dbc3e remove unused include 2013-12-08 19:11:38 +01:00
Dennis Luxen 37f5d755f1 break out header file in compile unit 2013-12-08 19:11:22 +01:00
Dennis Luxen 98cd3465d3 remove dead code 2013-12-08 19:11:03 +01:00
Dennis Luxen 009f08dca3 Refactoring PathData class 2013-12-08 19:10:10 +01:00
Dennis Luxen 2edf4906a4 refactoring SegmentInformation to fit into a cache line 2013-12-08 18:33:53 +01:00
Dennis Luxen ee6c15b997 remove self include 2013-12-08 16:30:08 +01:00
Dennis Luxen 03df07e4b6 rebasing develop on master branch. 2013-12-08 15:52:53 +01:00
Dennis Luxen 501f2f8267 workaround for #783 2013-12-08 15:52:23 +01:00
Dennis Luxen e949677c48 fixes #808 2013-12-08 15:52:23 +01:00
Dennis Luxen b2512915ae cache dependencies on travis ci 2013-12-08 15:52:23 +01:00
Dennis Luxen dc9db06cc8 reverting skeleton, introducing later 2013-12-08 15:52:23 +01:00
Dennis Luxen cb5931aaeb add skeleton for geometry compression 2013-12-08 15:52:23 +01:00
Dennis Luxen da17e55657 don't use clang specific defines 2013-12-08 15:52:22 +01:00
Dennis Luxen f47d944349 do not seek in temporary storage 2013-12-08 15:52:22 +01:00
Dennis Luxen 682079adc6 add buffering to temporary storage 2013-12-08 15:52:22 +01:00
Dennis Luxen f0fb97e67c add buffering to temporary storage 2013-12-08 15:52:22 +01:00
Dennis Luxen 6e5058f95f further refactoring and code simplification 2013-12-08 15:52:22 +01:00
Dennis Luxen 31b8997518 partially fixes #768, #794, #812 2013-12-08 15:52:22 +01:00
Dennis Luxen 76a9723268 remove dead code 2013-12-08 15:52:22 +01:00
Dennis Luxen 5fe79764de implements #801 2013-12-08 15:52:22 +01:00
Dennis Luxen 186859fcf0 clean up of build config 2013-12-08 15:52:22 +01:00
Dennis Luxen b545d60453 temporarily fixes #811 plus 16 others 2013-12-08 15:52:22 +01:00
DennisOSRM f68a046080 cast to larger data type on 32bits, probably fixes #809 2013-12-08 15:52:22 +01:00
Dennis Luxen f77fa5b34c clear memory early by swap trick 2013-12-08 15:52:21 +01:00
Dennis Luxen 38bf0c276c moving BFS exploration into its own function 2013-12-08 15:52:21 +01:00
Dennis Luxen ef5c8c24a8 fixing coverity issue 2013-12-08 15:52:21 +01:00
Dennis Luxen 4e8fb92e07 renaming file 2013-12-08 15:52:21 +01:00
Dennis Luxen 4f1ff5b24c renaming file 2013-12-08 15:52:21 +01:00
Dennis Luxen 22abc27b6b use explicit unsigned type in max operation 2013-12-08 15:52:21 +01:00
Dennis Luxen 19f6d885fe remove potential division by zero 2013-12-08 15:52:21 +01:00
Dennis Luxen b19a633441 add geometry compressor 2013-12-08 15:52:21 +01:00
Dennis Luxen 997dcad799 make rtree query do O(1) allocations only 2013-12-08 15:52:21 +01:00
Dennis Luxen e35efd001c move implementation details out of templat'ized container code 2013-12-08 15:52:21 +01:00
Dennis Luxen 50d6b10be4 move distance computation from r-tree to element type class 2013-12-08 15:52:21 +01:00
Dennis Luxen 5ef7ea794a move Hilbert curve computation in compile unit 2013-12-08 15:52:20 +01:00
Dennis Luxen e70485f1fd workaround for #783 2013-12-06 15:08:36 +01:00
Rodolphe Quiedeville f55f8a3629 [options] string is more explicit 2013-12-06 13:23:25 +01:00
Dennis Luxen fbbd6caf97 Merge pull request #818 from rodo/master
Add missing option '-p' in help message
2013-12-06 04:14:59 -08:00
Dennis Luxen bde3f95ae9 fixes #808 2013-12-06 12:06:51 +01:00
Dennis Luxen a5c406a4dd cache dependencies on travis ci 2013-12-06 10:14:42 +01:00
Rodolphe Quiedeville 58a57543ce [options] string is more explicit 2013-12-04 15:48:28 +01:00
Dennis Luxen e32bc5e186 reverting skeleton, introducing later 2013-11-29 19:00:00 +01:00
Dennis Luxen 7a5f45ac94 add skeleton for geometry compression 2013-11-29 18:49:02 +01:00
Dennis Luxen 657f7577bf don't use clang specific defines 2013-11-29 16:37:36 +01:00
Dennis Luxen 48355447f9 do not seek in temporary storage 2013-11-29 16:27:26 +01:00
Dennis Luxen c8f7e6331b add buffering to temporary storage 2013-11-29 15:38:21 +01:00
Dennis Luxen 40bb27c95f add buffering to temporary storage 2013-11-29 15:38:15 +01:00
Dennis Luxen 78f8124c63 further refactoring and code simplification 2013-11-28 18:50:12 +01:00
Dennis Luxen 94d5bcbf1c partially fixes #768, #794, #812 2013-11-28 15:26:13 +01:00
Dennis Luxen ad5d8c6f9a remove dead code 2013-11-28 15:24:23 +01:00
Dennis Luxen 4911601b24 implements #801 2013-11-27 23:24:00 +01:00
Dennis Luxen cb86d3d829 clean up of build config 2013-11-27 17:27:47 +01:00
Dennis Luxen 24c6314f1a Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2013-11-27 16:37:48 +01:00
Dennis Luxen 02e2b3bd47 temporarily fixes #811 plus 16 others 2013-11-27 16:37:40 +01:00
DennisOSRM ec84b3a0ca cast to larger data type on 32bits, probably fixes #809 2013-11-26 22:41:01 +01:00
Dennis Luxen 4455e816aa clear memory early by swap trick 2013-11-26 19:56:45 +01:00
Dennis Luxen 3df89c0dfe moving BFS exploration into its own function 2013-11-26 19:43:30 +01:00
Dennis Luxen f5d22c904f fixing coverity issue 2013-11-26 19:41:55 +01:00
Dennis Luxen 2233c44d36 renaming file 2013-11-26 19:41:36 +01:00
Dennis Luxen d5f6c1c15c renaming file 2013-11-26 19:41:32 +01:00
Dennis Luxen e36a27307b use explicit unsigned type in max operation 2013-11-26 14:27:19 +01:00
Dennis Luxen cf527ed819 remove potential division by zero 2013-11-26 14:25:53 +01:00
Dennis Luxen a8e8833a8d add geometry compressor 2013-11-25 19:05:58 +01:00
Dennis Luxen 349df0dc94 make rtree query do O(1) allocations only 2013-11-22 18:58:58 +01:00
Dennis Luxen 0e33f638e6 move implementation details out of templat'ized container code 2013-11-22 18:43:01 +01:00
Dennis Luxen 50ccfbf554 move distance computation from r-tree to element type class 2013-11-22 18:05:47 +01:00
Dennis Luxen e2c093856c move Hilbert curve computation in compile unit 2013-11-22 18:05:41 +01:00
1076 changed files with 137948 additions and 27352 deletions
+90
View File
@@ -0,0 +1,90 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: true
BreakBeforeBinaryOperators: false
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^<'
Priority: 3
- Regex: '^"(osrm|util|engine|extract|contract)/'
Priority: 2
- Regex: '.*'
Priority: 1
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...
+4
View File
@@ -0,0 +1,4 @@
---
Checks: '-clang-analyzer-*,google-*,llvm-*,misc-*,readability-*,-google-build-explicit-make-pair,-google-explicit-constructor,-google-readability-braces-around-statements,-google-readability-casting,-google-readability-namespace-comments,-google-readability-function,-google-readability-todo,-google-runtime-int,-llvm-namespace-comment,-llvm-header-guard,-llvm-twine-local,-misc-argument-comment,-readability-braces-around-statements,-readability-identifier-naming'
...
+14
View File
@@ -0,0 +1,14 @@
# Kind-specific patterns to check AST nodes against. Both python-clang and
# libclang docs explain CursorKind, with differences in detail. See also:
# - https://github.com/llvm-mirror/clang/blob/aca4fe314a55cacae29e1548cb7bfd2119c6df4c/bindings/python/clang/cindex.py#L599
# - http://clang.llvm.org/doxygen/group__CINDEX.html#gaaccc432245b4cd9f2d470913f9ef0013
# - https://docs.python.org/2/library/re.html#regular-expression-syntax
class_decl: '^([A-Z]+[a-z]+)+$'
struct_decl: '^([A-Z]+[a-z]+)+$'
field_decl: '^[a-z_]+$'
var_decl: '^[a-z]+[a-z0-9_]*$'
parm_decl: '^[a-z]*[a-z0-9_]*$'
namespace: '^[a-z_]*$'
cxx_method: '^([A-Z]+[a-z]+)+$'
function_decl: '^[a-z]+([A-Z]+[a-z]+)*$'
+28
View File
@@ -0,0 +1,28 @@
{
"rules": {
"indent": [
2,
4
],
"quotes": [
1,
"single"
],
"linebreak-style": [
2,
"unix"
],
"semi": [
2,
"always"
],
"no-console": [
1
]
},
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended"
}
+20 -20
View File
@@ -1,3 +1,7 @@
# pre compiled dependencies #
#############################
osrm-deps
# Compiled source #
###################
*.com
@@ -36,8 +40,9 @@ Thumbs.db
# build related files #
#######################
/build/
/Util/UUID.cpp
/Util/GitDescription.cpp
/example/build/
/test/data/monaco*
/cmake/postinst
# Eclipse related files #
#########################
@@ -52,40 +57,35 @@ Thumbs.db
stxxl.log
stxxl.errlog
# compiled protobuffers #
#########################
/DataStructures/pbf-proto/*.pb.h
/DataStructures/pbf-proto/*.pb.cc
# External Libs #
#################
/lib/
/win/lib
# Visual Studio Temp + build Files #
# Compiled Binary Files #
####################################
/win/*.user
/win/*.ncb
/win/*.suo
/win/Debug/
/win/Release/
/win/bin/
/win/bin-debug/
/osrm-extract
/osrm-io-benchmark
/osrm-components
/osrm-routed
/osrm-datastore
/osrm-prepare
/osrm-unlock-all
/osrm-cli
/osrm-check-hsgr
/osrm-springclean
/nohup.out
# Sandbox folder #
###################
/sandbox/
# Test related files #
######################
/test/profile.lua
/test/cache
/test/speeds.csv
/test/penalties.csv
/test/data/monaco.*
node_modules
# Deprecated config file #
##########################
/server.ini
*.swp
+182 -31
View File
@@ -1,36 +1,187 @@
language: cpp
compiler:
- gcc
# - clang
# Make sure CMake is installed
install:
- sudo apt-get update >/dev/null
- sudo apt-get -q install libprotoc-dev libprotobuf7 protobuf-compiler libprotobuf-dev libosmpbf-dev libpng12-dev libbz2-dev libstxxl-dev libstxxl-doc libstxxl1 libxml2-dev libzip-dev libboost1.46-all-dev lua5.1 liblua5.1-0-dev libluabind-dev rubygems osmosis
before_script:
- sudo gem install bundler
- bundle install
- mkdir build
- cd build
- cmake .. $CMAKEOPTIONS
script: make
git:
depth: 10
# sudo:required is needed for trusty images
sudo: required
dist: trusty
notifications:
email: false
branches:
only:
- master
- develop
env:
- CMAKEOPTIONS="-DCMAKE_BUILD_TYPE=Release"
- CMAKEOPTIONS="-DCMAKE_BUILD_TYPE=Debug"
notifications:
irc:
channels:
- irc.oftc.net#osrm
on_success: change
on_failure: always
use_notice: true
skip_join: false
- "5.2"
recipients:
- dennis@mapbox.com
email:
on_success: change
on_failure: always
cache:
ccache: true
apt: true
directories:
- test/cache
env:
global:
- CCACHE_TEMPDIR=/tmp/.ccache-temp
- CCACHE_COMPRESS=1
- JOBS=4
matrix:
fast_finish: true
# We override the compiler names here to yield better ccache behavior, which uses this as key
include:
# Debug Builds
- os: linux
compiler: "gcc-5-debug"
addons: &gcc5
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache']
env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5' BUILD_TYPE='Debug' COVERAGE=ON
- os: linux
compiler: "gcc-4.8-debug"
addons: &gcc48
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.8', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache']
env: CCOMPILER='gcc-4.8' CXXCOMPILER='g++-4.8' BUILD_TYPE='Debug'
- os: linux
compiler: "clang-3.8-debug"
addons: &clang38
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache']
env: CLANG_VERSION='3.8.0' BUILD_TYPE='Debug' RUN_CLANG_FORMAT=ON
- os: osx
osx_image: xcode7.3
compiler: clang
env: CCOMPILER='clang' CXXCOMPILER='clang++' BUILD_TYPE='Debug' JOBS=1 CUCUMBER_TIMEOUT=60000
# Release Builds
- os: linux
compiler: "gcc-5-release"
addons: &gcc5
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache']
env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5' BUILD_TYPE='Release'
# Disabled because of CI slowness
#- os: linux
#- compiler: gcc
#- addons: &gcc48
#- apt:
#- sources: ['ubuntu-toolchain-r-test']
#- packages: ['g++-4.8', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
#- env: CCOMPILER='gcc-4.8' CXXCOMPILER='g++-4.8' BUILD_TYPE='Release'
# Disabled because of CI slowness
#- os: linux
#- compiler: clang
#- addons: &clang38
#- apt:
#- sources: ['llvm-toolchain-precise-3.8', 'ubuntu-toolchain-r-test']
#- packages: ['clang-3.8', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
#- env: CCOMPILER='clang-3.8' CXXCOMPILER='clang++-3.8' BUILD_TYPE='Release'
# Disabled because of CI slowness
#- os: osx
#- osx_image: xcode7.3
#- compiler: clang
#- env: CCOMPILER='clang' CXXCOMPILER='clang++' BUILD_TYPE='Release'
# Shared Library
- os: linux
compiler: "gcc-5-release-shared"
addons: &gcc5
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache']
env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
# Disabled because CI slowness
#- os: linux
#- compiler: clang
#- addons: &clang38
#- apt:
#- sources: ['llvm-toolchain-precise-3.8', 'ubuntu-toolchain-r-test']
#- packages: ['clang-3.8', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
#- env: CCOMPILER='clang-3.8' CXXCOMPILER='clang++-3.8' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
before_install:
- if [[ $(uname -s) == 'Darwin' ]]; then sudo mdutil -i off /; fi;
- source ./scripts/install_node.sh 4
- npm install
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- export PATH=${DEPS_DIR}/bin:${PATH} && mkdir -p ${DEPS_DIR}
- CMAKE_URL="https://mason-binaries.s3.amazonaws.com/${TRAVIS_OS_NAME}-x86_64/cmake/3.5.2.tar.gz"
- travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${DEPS_DIR}
- |
if [[ ${CLANG_VERSION:-false} != false ]]; then
export CCOMPILER='clang'
export CXXCOMPILER='clang++'
CLANG_URL="https://mason-binaries.s3.amazonaws.com/${TRAVIS_OS_NAME}-x86_64/clang/${CLANG_VERSION}.tar.gz"
travis_retry wget --quiet -O - ${CLANG_URL} | tar --strip-components=1 -xz -C ${DEPS_DIR}
fi
- |
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
# implicit deps, but seem to be installed by default with recent images: libxml2 GDAL boost
brew install libzip libstxxl lua51 luabind tbb md5sha1sum ccache
fi
install:
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
./scripts/check_taginfo.py taginfo.json profiles/car.lua
fi
- mkdir build && pushd build
- export CC=${CCOMPILER} CXX=${CXXCOMPILER}
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} -DCOVERAGE=${COVERAGE:-OFF} -DBUILD_TOOLS=1 -DENABLE_CCACHE=ON
- echo "travis_fold:start:MAKE"
- make osrm-extract --jobs=3
- make --jobs=${JOBS}
- make tests --jobs=${JOBS}
- make benchmarks --jobs=${JOBS}
- echo "travis_fold:end:MAKE"
- ccache -s
- sudo make install
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
sudo ldconfig
fi
- popd
- mkdir example/build && pushd example/build
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
- make
- popd
script:
- echo "travis_fold:start:BENCHMARK"
- make -C test/data benchmark
- echo "travis_fold:end:BENCHMARK"
- ./example/build/osrm-example test/data/monaco.osrm
# All tests assume to be run from the build directory
- pushd build
- ./unit_tests/library-tests ../test/data/monaco.osrm
- ./unit_tests/extractor-tests
- ./unit_tests/engine-tests
- ./unit_tests/util-tests
- ./unit_tests/server-tests
- popd
- npm test
after_success:
- |
if [ -n "${RUN_CLANG_FORMAT}" ]; then
./scripts/format.sh # we don't want to fail just yet
fi
- |
if [ -n "${COVERAGE}" ]; then
bash <(curl -s https://codecov.io/bash)
fi
-69
View File
@@ -1,69 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DOUGLASPEUCKER_H_
#define DOUGLASPEUCKER_H_
#include "../DataStructures/Coordinate.h"
#include "../DataStructures/SegmentInformation.h"
#include <boost/assert.hpp>
#include <cmath>
#include <limits>
#include <stack>
#include <vector>
/*This class object computes the bitvector of indicating generalized input points
* according to the (Ramer-)Douglas-Peucker algorithm.
*
* Input is vector of pairs. Each pair consists of the point information and a bit
* indicating if the points is present in the generalization.
* Note: points may also be pre-selected*/
class DouglasPeucker {
private:
typedef std::pair<std::size_t, std::size_t> PairOfPoints;
//Stack to simulate the recursion
std::stack<PairOfPoints > recursion_stack;
/**
* This distance computation does integer arithmetic only and is about twice as fast as
* the other distance function. It is an approximation only, but works more or less ok.
*/
int fastDistance(
const FixedPointCoordinate& point,
const FixedPointCoordinate& segA,
const FixedPointCoordinate& segB
) const;
public:
void Run(std::vector<SegmentInformation> & input_geometry, const unsigned zoom_level);
};
#endif /* DOUGLASPEUCKER_H_ */
-166
View File
@@ -1,166 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "DouglasPeucker.h"
//These thresholds are more or less heuristically chosen.
static double DouglasPeuckerThresholds[19] = {
32000000., //z0
16240000., //z1
8240000., //z2
4240000., //z3
2000000., //z4
1000000., //z5
500000., //z6
240000., //z7
120000., //z8
60000., //z9
30000., //z10
19000., //z11
5000., //z12
2000., //z13
200., //z14
16., //z15
6., //z16
3., //z17
3. //z18
};
/**
* This distance computation does integer arithmetic only and is about twice as
* fast as the other distance function. It is an approximation only, but works
* more or less ok.
*/
int DouglasPeucker::fastDistance(
const FixedPointCoordinate& point,
const FixedPointCoordinate& segA,
const FixedPointCoordinate& segB
) const {
const int p2x = (segB.lon - segA.lon);
const int p2y = (segB.lat - segA.lat);
const int something = p2x*p2x + p2y*p2y;
double u = ( 0 == something ? 0 : ((point.lon - segA.lon) * p2x + (point.lat - segA.lat) * p2y) / something);
if (u > 1) {
u = 1;
} else if (u < 0) {
u = 0;
}
const int x = segA.lon + u * p2x;
const int y = segA.lat + u * p2y;
const int dx = x - point.lon;
const int dy = y - point.lat;
const int dist = (dx*dx + dy*dy);
return dist;
}
void DouglasPeucker::Run(
std::vector<SegmentInformation> & input_geometry,
const unsigned zoom_level
) {
{
BOOST_ASSERT_MSG(zoom_level < 19, "unsupported zoom level");
BOOST_ASSERT_MSG(1 < input_geometry.size(), "geometry invalid");
std::size_t left_border = 0;
std::size_t right_border = 1;
//Sweep linerarily over array and identify those ranges that need to be checked
do {
BOOST_ASSERT_MSG(
input_geometry[left_border].necessary,
"left border must be necessary"
);
BOOST_ASSERT_MSG(
input_geometry.back().necessary,
"right border must be necessary"
);
if(input_geometry[right_border].necessary) {
recursion_stack.push(std::make_pair(left_border, right_border));
left_border = right_border;
}
++right_border;
} while( right_border < input_geometry.size());
}
while(!recursion_stack.empty()) {
//pop next element
const PairOfPoints pair = recursion_stack.top();
recursion_stack.pop();
BOOST_ASSERT_MSG(
input_geometry[pair.first].necessary,
"left border mus be necessary"
);
BOOST_ASSERT_MSG(
input_geometry[pair.second].necessary,
"right border must be necessary"
);
BOOST_ASSERT_MSG(
pair.second < input_geometry.size(),
"right border outside of geometry"
);
BOOST_ASSERT_MSG(
pair.first < pair.second,
"left border on the wrong side"
);
int max_distance = INT_MIN;
std::size_t farthest_element_index = pair.second;
//find index idx of element with max_distance
for(std::size_t i = pair.first+1; i < pair.second; ++i){
const int temp_dist = fastDistance(
input_geometry[i].location,
input_geometry[pair.first].location,
input_geometry[pair.second].location
);
const double distance = std::fabs(temp_dist);
if(
distance > DouglasPeuckerThresholds[zoom_level] &&
distance > max_distance
) {
farthest_element_index = i;
max_distance = distance;
}
}
if (max_distance > DouglasPeuckerThresholds[zoom_level]) {
// mark idx as necessary
input_geometry[farthest_element_index].necessary = true;
if (1 < (farthest_element_index - pair.first) ) {
recursion_stack.push(
std::make_pair(pair.first, farthest_element_index)
);
}
if (1 < (pair.second - farthest_element_index) ) {
recursion_stack.push(
std::make_pair(farthest_element_index, pair.second)
);
}
}
}
}
-117
View File
@@ -1,117 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ITERATORBASEDCRC32_H_
#define ITERATORBASEDCRC32_H_
#include "../Util/SimpleLogger.h"
#include <boost/crc.hpp> // for boost::crc_32_type
#include <iostream>
template<class ContainerT>
class IteratorbasedCRC32 {
private:
typedef typename ContainerT::iterator ContainerT_iterator;
unsigned crc;
typedef boost::crc_optimal<32, 0x1EDC6F41, 0x0, 0x0, true, true> my_crc_32_type;
typedef unsigned (IteratorbasedCRC32::*CRC32CFunctionPtr)(char *str, unsigned len, unsigned crc);
unsigned SoftwareBasedCRC32(char *str, unsigned len, unsigned ){
boost::crc_optimal<32, 0x1EDC6F41, 0x0, 0x0, true, true> CRC32_Processor;
CRC32_Processor.process_bytes( str, len);
return CRC32_Processor.checksum();
}
unsigned SSEBasedCRC32( char *str, unsigned len, unsigned crc){
unsigned q=len/sizeof(unsigned),
r=len%sizeof(unsigned),
*p=(unsigned*)str/*, crc*/;
//crc=0;
while (q--) {
__asm__ __volatile__(
".byte 0xf2, 0xf, 0x38, 0xf1, 0xf1;"
:"=S"(crc)
:"0"(crc), "c"(*p)
);
++p;
}
str=(char*)p;
while (r--) {
__asm__ __volatile__(
".byte 0xf2, 0xf, 0x38, 0xf1, 0xf1;"
:"=S"(crc)
:"0"(crc), "c"(*str)
);
++str;
}
return crc;
}
unsigned cpuid(unsigned functionInput){
unsigned eax;
unsigned ebx;
unsigned ecx;
unsigned edx;
asm("cpuid" : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (functionInput));
return ecx;
}
CRC32CFunctionPtr detectBestCRC32C(){
static const int SSE42_BIT = 20;
unsigned ecx = cpuid(1);
bool hasSSE42 = ecx & (1 << SSE42_BIT);
if (hasSSE42) {
SimpleLogger().Write() << "using hardware based CRC32 computation";
return &IteratorbasedCRC32::SSEBasedCRC32; //crc32 hardware accelarated;
} else {
SimpleLogger().Write() << "using software based CRC32 computation";
return &IteratorbasedCRC32::SoftwareBasedCRC32; //crc32cSlicingBy8;
}
}
CRC32CFunctionPtr crcFunction;
public:
IteratorbasedCRC32(): crc(0) {
crcFunction = detectBestCRC32C();
}
virtual ~IteratorbasedCRC32() { }
unsigned operator()( ContainerT_iterator iter, const ContainerT_iterator end) {
unsigned crc = 0;
while(iter != end) {
char * data = reinterpret_cast<char*>(&(*iter) );
crc =((*this).*(crcFunction))(data, sizeof(typename ContainerT::value_type*), crc);
++iter;
}
return crc;
}
};
#endif /* ITERATORBASEDCRC32_H_ */
-100
View File
@@ -1,100 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef OBJECTTOBASE64_H_
#define OBJECTTOBASE64_H_
#include "../Util/StringUtil.h"
#include <boost/assert.hpp>
#include <boost/archive/iterators/base64_from_binary.hpp>
#include <boost/archive/iterators/binary_from_base64.hpp>
#include <boost/archive/iterators/transform_width.hpp>
#include <boost/foreach.hpp>
#include <algorithm>
#include <string>
#include <vector>
typedef
boost::archive::iterators::base64_from_binary<
boost::archive::iterators::transform_width<const char *, 6, 8>
> base64_t;
typedef
boost::archive::iterators::transform_width<
boost::archive::iterators::binary_from_base64<
std::string::const_iterator>, 8, 6
> binary_t;
template<class ObjectT>
static void EncodeObjectToBase64(const ObjectT & object, std::string& encoded) {
const char * char_ptr_to_object = (const char *)&object;
std::vector<unsigned char> data(sizeof(object));
std::copy(
char_ptr_to_object,
char_ptr_to_object + sizeof(ObjectT),
data.begin()
);
unsigned char number_of_padded_chars = 0; // is in {0,1,2};
while(data.size() % 3 != 0) {
++number_of_padded_chars;
data.push_back(0x00);
}
BOOST_ASSERT_MSG(
0 == data.size() % 3,
"base64 input data size is not a multiple of 3!"
);
encoded.resize(sizeof(ObjectT));
encoded.assign(
base64_t( &data[0] ),
base64_t( &data[0] + (data.size() - number_of_padded_chars) )
);
replaceAll(encoded, "+", "-");
replaceAll(encoded, "/", "_");
}
template<class ObjectT>
static void DecodeObjectFromBase64(const std::string& input, ObjectT & object) {
try {
std::string encoded(input);
//replace "-" with "+" and "_" with "/"
replaceAll(encoded, "-", "+");
replaceAll(encoded, "_", "/");
std::copy (
binary_t( encoded.begin() ),
binary_t( encoded.begin() + encoded.length() - 1),
(char *)&object
);
} catch(...) { }
}
#endif /* OBJECTTOBASE64_H_ */
-147
View File
@@ -1,147 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "PolylineCompressor.h"
void PolylineCompressor::encodeVectorSignedNumber(
std::vector<int> & numbers,
std::string & output
) const {
for(unsigned i = 0; i < numbers.size(); ++i) {
numbers[i] <<= 1;
if (numbers[i] < 0) {
numbers[i] = ~(numbers[i]);
}
}
for(unsigned i = 0; i < numbers.size(); ++i) {
encodeNumber(numbers[i], output);
}
}
void PolylineCompressor::encodeNumber(int number_to_encode, std::string & output) const {
while (number_to_encode >= 0x20) {
int nextValue = (0x20 | (number_to_encode & 0x1f)) + 63;
output += static_cast<char>(nextValue);
if(92 == nextValue) {
output += static_cast<char>(nextValue);
}
number_to_encode >>= 5;
}
number_to_encode += 63;
output += static_cast<char>(number_to_encode);
if(92 == number_to_encode) {
output += static_cast<char>(number_to_encode);
}
}
void PolylineCompressor::printEncodedString(
const std::vector<SegmentInformation> & polyline,
std::string & output
) const {
std::vector<int> deltaNumbers;
output += "\"";
if(!polyline.empty()) {
FixedPointCoordinate lastCoordinate = polyline[0].location;
deltaNumbers.push_back( lastCoordinate.lat );
deltaNumbers.push_back( lastCoordinate.lon );
for(unsigned i = 1; i < polyline.size(); ++i) {
if(!polyline[i].necessary) {
continue;
}
deltaNumbers.push_back(polyline[i].location.lat - lastCoordinate.lat);
deltaNumbers.push_back(polyline[i].location.lon - lastCoordinate.lon);
lastCoordinate = polyline[i].location;
}
encodeVectorSignedNumber(deltaNumbers, output);
}
output += "\"";
}
void PolylineCompressor::printEncodedString(
const std::vector<FixedPointCoordinate>& polyline,
std::string &output
) const {
std::vector<int> deltaNumbers(2*polyline.size());
output += "\"";
if(!polyline.empty()) {
deltaNumbers[0] = polyline[0].lat;
deltaNumbers[1] = polyline[0].lon;
for(unsigned i = 1; i < polyline.size(); ++i) {
deltaNumbers[(2*i)] = (polyline[i].lat - polyline[i-1].lat);
deltaNumbers[(2*i)+1] = (polyline[i].lon - polyline[i-1].lon);
}
encodeVectorSignedNumber(deltaNumbers, output);
}
output += "\"";
}
void PolylineCompressor::printUnencodedString(
const std::vector<FixedPointCoordinate> & polyline,
std::string & output
) const {
output += "[";
std::string tmp;
for(unsigned i = 0; i < polyline.size(); i++) {
convertInternalLatLonToString(polyline[i].lat, tmp);
output += "[";
output += tmp;
convertInternalLatLonToString(polyline[i].lon, tmp);
output += ", ";
output += tmp;
output += "]";
if( i < polyline.size()-1 ) {
output += ",";
}
}
output += "]";
}
void PolylineCompressor::printUnencodedString(
const std::vector<SegmentInformation> & polyline,
std::string & output
) const {
output += "[";
std::string tmp;
for(unsigned i = 0; i < polyline.size(); i++) {
if(!polyline[i].necessary) {
continue;
}
convertInternalLatLonToString(polyline[i].location.lat, tmp);
output += "[";
output += tmp;
convertInternalLatLonToString(polyline[i].location.lon, tmp);
output += ", ";
output += tmp;
output += "]";
if( i < polyline.size()-1 ) {
output += ",";
}
}
output += "]";
}
-69
View File
@@ -1,69 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef POLYLINECOMPRESSOR_H_
#define POLYLINECOMPRESSOR_H_
#include "../DataStructures/SegmentInformation.h"
#include "../Util/StringUtil.h"
#include <string>
#include <vector>
class PolylineCompressor {
private:
void encodeVectorSignedNumber(
std::vector<int> & numbers,
std::string & output
) const;
void encodeNumber(int number_to_encode, std::string & output) const;
public:
void printEncodedString(
const std::vector<SegmentInformation> & polyline,
std::string & output
) const;
void printEncodedString(
const std::vector<FixedPointCoordinate>& polyline,
std::string &output
) const;
void printUnencodedString(
const std::vector<FixedPointCoordinate> & polyline,
std::string & output
) const;
void printUnencodedString(
const std::vector<SegmentInformation> & polyline,
std::string & output
) const;
};
#endif /* POLYLINECOMPRESSOR_H_ */
-500
View File
@@ -1,500 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef STRONGLYCONNECTEDCOMPONENTS_H_
#define STRONGLYCONNECTEDCOMPONENTS_H_
#include "../DataStructures/Coordinate.h"
#include "../DataStructures/DeallocatingVector.h"
#include "../DataStructures/DynamicGraph.h"
#include "../DataStructures/ImportEdge.h"
#include "../DataStructures/QueryNode.h"
#include "../DataStructures/Percent.h"
#include "../DataStructures/Restriction.h"
#include "../DataStructures/TurnInstructions.h"
#include "../Util/SimpleLogger.h"
#include <boost/assert.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/integer.hpp>
#include <boost/make_shared.hpp>
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#ifdef __APPLE__
#include <gdal.h>
#include <ogrsf_frmts.h>
#else
#include <gdal/gdal.h>
#include <gdal/ogrsf_frmts.h>
#endif
#include <stack>
#include <vector>
class TarjanSCC {
private:
struct TarjanNode {
TarjanNode() : index(UINT_MAX), lowlink(UINT_MAX), onStack(false) {}
unsigned index;
unsigned lowlink;
bool onStack;
};
struct TarjanEdgeData {
int distance;
unsigned nameID:31;
bool shortcut:1;
short type;
bool isAccessRestricted:1;
bool forward:1;
bool backward:1;
bool roundabout:1;
bool ignoreInGrid:1;
bool reversedEdge:1;
};
struct TarjanStackFrame {
explicit TarjanStackFrame(
NodeID v,
NodeID parent
) : v(v), parent(parent) { }
NodeID v;
NodeID parent;
};
typedef DynamicGraph<TarjanEdgeData> TarjanDynamicGraph;
typedef TarjanDynamicGraph::InputEdge TarjanEdge;
typedef std::pair<NodeID, NodeID> RestrictionSource;
typedef std::pair<NodeID, bool> restriction_target;
typedef std::vector<restriction_target> EmanatingRestrictionsVector;
typedef boost::unordered_map<RestrictionSource, unsigned > RestrictionMap;
std::vector<NodeInfo> m_coordinate_list;
std::vector<EmanatingRestrictionsVector> m_restriction_bucket_list;
boost::shared_ptr<TarjanDynamicGraph> m_node_based_graph;
boost::unordered_set<NodeID> m_barrier_node_list;
boost::unordered_set<NodeID> m_traffic_light_list;
unsigned m_restriction_counter;
RestrictionMap m_restriction_map;
struct EdgeBasedNode {
bool operator<(const EdgeBasedNode & other) const {
return other.id < id;
}
bool operator==(const EdgeBasedNode & other) const {
return id == other.id;
}
NodeID id;
int lat1;
int lat2;
int lon1;
int lon2:31;
bool belongsToTinyComponent:1;
NodeID nameID;
unsigned weight:31;
bool ignoreInGrid:1;
};
public:
TarjanSCC(
int number_of_nodes,
std::vector<NodeBasedEdge> & input_edges,
std::vector<NodeID> & bn,
std::vector<NodeID> & tl,
std::vector<TurnRestriction> & irs,
std::vector<NodeInfo> & nI
) :
m_coordinate_list(nI),
m_restriction_counter(irs.size())
{
BOOST_FOREACH(const TurnRestriction & restriction, irs) {
std::pair<NodeID, NodeID> restrictionSource = std::make_pair(
restriction.fromNode, restriction.viaNode
);
unsigned index;
RestrictionMap::iterator restriction_iterator = m_restriction_map.find(restrictionSource);
if(restriction_iterator == m_restriction_map.end()) {
index = m_restriction_bucket_list.size();
m_restriction_bucket_list.resize(index+1);
m_restriction_map[restrictionSource] = index;
} else {
index = restriction_iterator->second;
//Map already contains an is_only_*-restriction
if(m_restriction_bucket_list.at(index).begin()->second) {
continue;
} else if(restriction.flags.isOnly) {
//We are going to insert an is_only_*-restriction. There can be only one.
m_restriction_bucket_list.at(index).clear();
}
}
m_restriction_bucket_list.at(index).push_back(
std::make_pair(restriction.toNode, restriction.flags.isOnly)
);
}
m_barrier_node_list.insert(bn.begin(), bn.end());
m_traffic_light_list.insert(tl.begin(), tl.end());
DeallocatingVector< TarjanEdge > edge_list;
BOOST_FOREACH(const NodeBasedEdge & input_edge, input_edges) {
TarjanEdge edge;
if(!input_edge.isForward()) {
edge.source = input_edge.target();
edge.target = input_edge.source();
edge.data.backward = input_edge.isForward();
edge.data.forward = input_edge.isBackward();
} else {
edge.source = input_edge.source();
edge.target = input_edge.target();
edge.data.forward = input_edge.isForward();
edge.data.backward = input_edge.isBackward();
}
if(edge.source == edge.target) {
continue;
}
edge.data.distance = (std::max)((int)input_edge.weight(), 1 );
BOOST_ASSERT( edge.data.distance > 0 );
edge.data.shortcut = false;
edge.data.roundabout = input_edge.isRoundabout();
edge.data.ignoreInGrid = input_edge.ignoreInGrid();
edge.data.nameID = input_edge.name();
edge.data.type = input_edge.type();
edge.data.isAccessRestricted = input_edge.isAccessRestricted();
edge.data.reversedEdge = false;
edge_list.push_back( edge );
if( edge.data.backward ) {
std::swap( edge.source, edge.target );
edge.data.forward = input_edge.isBackward();
edge.data.backward = input_edge.isForward();
edge.data.reversedEdge = true;
edge_list.push_back( edge );
}
}
std::vector<NodeBasedEdge>().swap(input_edges);
BOOST_ASSERT_MSG(
0 == input_edges.size() && 0 == input_edges.capacity(),
"input edge vector not properly deallocated"
);
std::sort( edge_list.begin(), edge_list.end() );
m_node_based_graph = boost::make_shared<TarjanDynamicGraph>(
number_of_nodes,
edge_list
);
}
~TarjanSCC() {
m_node_based_graph.reset();
}
void Run() {
//remove files from previous run if exist
DeleteFileIfExists("component.dbf");
DeleteFileIfExists("component.shx");
DeleteFileIfExists("component.shp");
Percent p(m_node_based_graph->GetNumberOfNodes());
OGRRegisterAll();
const char *pszDriverName = "ESRI Shapefile";
OGRSFDriver * poDriver = OGRSFDriverRegistrar::GetRegistrar()->
GetDriverByName( pszDriverName );
if( NULL == poDriver ) {
throw OSRMException("ESRI Shapefile driver not available");
}
OGRDataSource * poDS = poDriver->CreateDataSource(
"component.shp",
NULL
);
if( NULL == poDS ) {
throw OSRMException("Creation of output file failed");
}
OGRLayer * poLayer = poDS->CreateLayer(
"component",
NULL,
wkbLineString,
NULL
);
if( NULL == poLayer ) {
throw OSRMException("Layer creation failed.");
}
//The following is a hack to distinguish between stuff that happens
//before the recursive call and stuff that happens after
std::stack<std::pair<bool, TarjanStackFrame> > recursion_stack;
//true = stuff before, false = stuff after call
std::stack<NodeID> tarjan_stack;
std::vector<unsigned> components_index(
m_node_based_graph->GetNumberOfNodes(),
UINT_MAX
);
std::vector<NodeID> component_size_vector;
std::vector<TarjanNode> tarjan_node_list(
m_node_based_graph->GetNumberOfNodes()
);
unsigned component_index = 0, size_of_current_component = 0;
int index = 0;
for(
NodeID node = 0, last_node = m_node_based_graph->GetNumberOfNodes();
node < last_node;
++node
) {
if(UINT_MAX == components_index[node]) {
recursion_stack.push(
std::make_pair(true, TarjanStackFrame(node,node))
);
}
while(!recursion_stack.empty()) {
bool before_recursion = recursion_stack.top().first;
TarjanStackFrame currentFrame = recursion_stack.top().second;
NodeID v = currentFrame.v;
recursion_stack.pop();
if(before_recursion) {
//Mark frame to handle tail of recursion
recursion_stack.push(std::make_pair(false, currentFrame));
//Mark essential information for SCC
tarjan_node_list[v].index = index;
tarjan_node_list[v].lowlink = index;
tarjan_stack.push(v);
tarjan_node_list[v].onStack = true;
++index;
//Traverse outgoing edges
for(
TarjanDynamicGraph::EdgeIterator e2 = m_node_based_graph->BeginEdges(v);
e2 < m_node_based_graph->EndEdges(v);
++e2
) {
const TarjanDynamicGraph::NodeIterator vprime =
m_node_based_graph->GetTarget(e2);
if(UINT_MAX == tarjan_node_list[vprime].index) {
recursion_stack.push(
std::make_pair(
true,
TarjanStackFrame(vprime, v)
)
);
} else {
if(
tarjan_node_list[vprime].onStack &&
tarjan_node_list[vprime].index < tarjan_node_list[v].lowlink
) {
tarjan_node_list[v].lowlink = tarjan_node_list[vprime].index;
}
}
}
} else {
tarjan_node_list[currentFrame.parent].lowlink =
std::min(
tarjan_node_list[currentFrame.parent].lowlink,
tarjan_node_list[v].lowlink
);
//after recursion, lets do cycle checking
//Check if we found a cycle. This is the bottom part of the recursion
if(tarjan_node_list[v].lowlink == tarjan_node_list[v].index) {
NodeID vprime;
do {
vprime = tarjan_stack.top(); tarjan_stack.pop();
tarjan_node_list[vprime].onStack = false;
components_index[vprime] = component_index;
++size_of_current_component;
} while( v != vprime);
component_size_vector.push_back(size_of_current_component);
if(size_of_current_component > 1000) {
SimpleLogger().Write() <<
"large component [" << component_index << "]=" <<
size_of_current_component;
}
++component_index;
size_of_current_component = 0;
}
}
}
}
SimpleLogger().Write() <<
"identified: " << component_size_vector.size() <<
" many components, marking small components";
unsigned size_one_counter = 0;
for(unsigned i = 0, end = component_size_vector.size(); i < end; ++i){
if(1 == component_size_vector[i]) {
++size_one_counter;
}
}
SimpleLogger().Write() <<
"identified " << size_one_counter << " SCCs of size 1";
uint64_t total_network_distance = 0;
p.reinit(m_node_based_graph->GetNumberOfNodes());
for(
TarjanDynamicGraph::NodeIterator u = 0, last_u_node = m_node_based_graph->GetNumberOfNodes();
u < last_u_node;
++u
) {
p.printIncrement();
for(
TarjanDynamicGraph::EdgeIterator e1 = m_node_based_graph->BeginEdges(u), last_edge = m_node_based_graph->EndEdges(u);
e1 < last_edge;
++e1
) {
if(!m_node_based_graph->GetEdgeData(e1).reversedEdge) {
continue;
}
const TarjanDynamicGraph::NodeIterator v = m_node_based_graph->GetTarget(e1);
total_network_distance += 100*ApproximateDistance(
m_coordinate_list[u].lat,
m_coordinate_list[u].lon,
m_coordinate_list[v].lat,
m_coordinate_list[v].lon
);
if( SHRT_MAX != m_node_based_graph->GetEdgeData(e1).type ) {
BOOST_ASSERT(e1 != UINT_MAX);
BOOST_ASSERT(u != UINT_MAX);
BOOST_ASSERT(v != UINT_MAX);
const unsigned size_of_containing_component =
std::min(
component_size_vector[components_index[u]],
component_size_vector[components_index[v]]
);
//edges that end on bollard nodes may actually be in two distinct components
if(size_of_containing_component < 10) {
OGRLineString lineString;
lineString.addPoint(
m_coordinate_list[u].lon/COORDINATE_PRECISION,
m_coordinate_list[u].lat/COORDINATE_PRECISION
);
lineString.addPoint(
m_coordinate_list[v].lon/COORDINATE_PRECISION,
m_coordinate_list[v].lat/COORDINATE_PRECISION
);
OGRFeature * poFeature = OGRFeature::CreateFeature(
poLayer->GetLayerDefn()
);
poFeature->SetGeometry( &lineString );
if( OGRERR_NONE != poLayer->CreateFeature(poFeature) ) {
throw OSRMException(
"Failed to create feature in shapefile."
);
}
OGRFeature::DestroyFeature( poFeature );
}
}
}
}
OGRDataSource::DestroyDataSource( poDS );
std::vector<NodeID>().swap(component_size_vector);
BOOST_ASSERT_MSG(
0 == component_size_vector.size() &&
0 == component_size_vector.capacity(),
"component_size_vector not properly deallocated"
);
std::vector<NodeID>().swap(components_index);
BOOST_ASSERT_MSG(
0 == components_index.size() && 0 == components_index.capacity(),
"icomponents_index not properly deallocated"
);
SimpleLogger().Write()
<< "total network distance: " <<
(uint64_t)total_network_distance/100/1000. <<
" km";
}
private:
unsigned CheckForEmanatingIsOnlyTurn(const NodeID u, const NodeID v) const {
std::pair < NodeID, NodeID > restriction_source = std::make_pair(u, v);
RestrictionMap::const_iterator restriction_iterator = m_restriction_map.find(restriction_source);
if (restriction_iterator != m_restriction_map.end()) {
const unsigned index = restriction_iterator->second;
BOOST_FOREACH(
const RestrictionSource & restriction_target,
m_restriction_bucket_list.at(index)
) {
if(restriction_target.second) {
return restriction_target.first;
}
}
}
return UINT_MAX;
}
bool CheckIfTurnIsRestricted(
const NodeID u,
const NodeID v,
const NodeID w
) const {
//only add an edge if turn is not a U-turn except it is the end of dead-end street.
std::pair < NodeID, NodeID > restriction_source = std::make_pair(u, v);
RestrictionMap::const_iterator restriction_iterator = m_restriction_map.find(restriction_source);
if (restriction_iterator != m_restriction_map.end()) {
const unsigned index = restriction_iterator->second;
BOOST_FOREACH(
const restriction_target & restriction_target,
m_restriction_bucket_list.at(index)
) {
if(w == restriction_target.first) {
return true;
}
}
}
return false;
}
void DeleteFileIfExists(const std::string & file_name) const {
if (boost::filesystem::exists(file_name) ) {
boost::filesystem::remove(file_name);
}
}
};
#endif /* STRONGLYCONNECTEDCOMPONENTS_H_ */
+241
View File
@@ -0,0 +1,241 @@
# 5.2.5
- Bugfixes
- Fixes a segfault caused by incorrect trimming logic for very short steps.
# 5.2.4
Changes from 5.2.3:
- Bugfixes:
- Fixed a crash that arised on roundabouts in combination with intermediate intersections and sliproads
- Fixed #2518: Invalid bilinear interpolation when using raster data
- Fixed #2546: The geometry returned by the match service was missing the last coordinate.
BREAKING: The data format changed between 5.2.3 and 5.2.4, you need to reprocess.
# 5.2.3
- Bugfixes:
- Fixed an issue with name changes in roundabouts that could result in crashes
# 5.2.2
Changes from 5.2.1
- Bugfixes:
- Buffer overrun in tile plugin response handling
# 5.2.1
Changes from 5.2.0
- Bugfixes:
- Removed debug statement that was spamming the console
# 5.2.0
Changes from 5.2.0 RC2
- Bugfixes:
- Fixed crash when loading shared memory caused by invalid OSM IDs segment size.
- Various small instructions handling fixes
Changes from 5.1.0
- API:
- new parameter `annotations` for `route`, `trip` and `match` requests. Returns additional data about each
coordinate along the selected/matched route line per `RouteLeg`:
- duration of each segment
- distance of each segment
- OSM node ids of all segment endpoints
- Introducing Intersections for Route Steps. This changes the API format in multiple ways.
- `bearing_before`/`bearing_after` of `StepManeuver` are now deprecated and will be removed in the next major release
- `location` of `StepManeuvers` is now deprecated and will be removed in the next major release
- every `RouteStep` now has property `intersections` containing a list of `Intersection` objects.
- Support for destination signs. New member `destinations` in `RouteStep`, based on `destination` and `destination:ref`
- Support for name pronunciations. New member `pronunciation` in `RouteStep`, based on `name:pronunciation`
- Profile changes:
- duration parser now accepts P[n]DT[n]H[n]M[n]S, P[n]W, PTHHMMSS and PTHH:MM:SS ISO8601 formats.
- `result.destinations` allows you to set a way's destinations
- `result.pronunciation` allows you to set way name pronunciations
- `highway=motorway_link` no longer implies `oneway` as per the OSM Wiki
- Infrastructure:
- BREAKING: Changed the on-disk encoding of the StaticRTree to reduce ramIndex file size. This breaks the **data format**
- BREAKING: Intersection Classification adds a new file to the mix (osrm.icd). This breaks the fileformat for older versions.
- Better support for osrm-routed binary upgrade on the fly [UNIX specific]:
- Open sockets with SO_REUSEPORT to allow multiple osrm-routed processes serving requests from the same port.
- Add SIGNAL_PARENT_WHEN_READY environment variable to enable osrm-routed signal its parent with USR1 when it's running and waiting for requests.
- Disable http access logging via DISABLE_ACCESS_LOGGING environment variable.
- Guidance:
- BREAKING: modifies the file format with new internal identifiers
- improved detection of turning streets, not reporting new-name in wrong situations
- improved handling of sliproads (emit turns instead of 'take the ramp')
- improved collapsing of instructions. Some 'new name' instructions will be suppressed if they are without alternative and the segment is short
- Bugfixes
- fixed broken summaries for very short routes
# 5.2.0 RC2
Changes from 5.2.0 RC1
- Guidance:
- improved handling of sliproads (emit turns instead of 'take the ramp')
- improved collapsing of instructions. Some 'new name' instructions will be suppressed if they are without alternative and the segment is short
- BREAKING: modifies the file format with new internal identifiers
- API:
- paramater `annotate` was renamed to `annotations`.
- `annotation` as accidentally placed in `Route` instead of `RouteLeg`
- Support for destination signs. New member `destinations` in `RouteStep`, based on `destination` and `destination:ref`
- Support for name pronunciations. New member `pronunciation` in `RouteStep`, based on `name:pronunciation`
- Add `nodes` property to `annotation` in `RouteLeg` containing the ids of nodes covered by the route
- Profile changes:
- `result.destinations` allows you to set a way's destinations
- `result.pronunciation` allows you to set way name pronunciations
- `highway=motorway_link` no longer implies `oneway` as per the OSM Wiki
- Infrastructure
- BREAKING: Changed the on-disk encoding of the StaticRTree to reduce ramIndex file size. This breaks the **data format**
- Bugfixes
- fixed broken summaries for very short routes
# 5.2.0 RC1
Changes from 5.1.0
- API:
- new parameter `annotate` for `route` and `match` requests. Returns additional data about each
coordinate along the selected/matched route line.
- Introducing Intersections for Route Steps. This changes the API format in multiple ways.
- `bearing_before`/`bearing_after` of `StepManeuver` are now deprecated and will be removed in the next major release
- `location` of `StepManeuvers` is now deprecated and will be removed in the next major release
- every `RouteStep` now has property `intersections` containing a list of `Intersection` objects.
- Profile changes:
- duration parser now accepts P[n]DT[n]H[n]M[n]S, P[n]W, PTHHMMSS and PTHH:MM:SS ISO8601 formats.
- Infrastructure:
- Better support for osrm-routed binary upgrade on the fly [UNIX specific]:
- Open sockets with SO_REUSEPORT to allow multiple osrm-routed processes serving requests from the same port.
- Add SIGNAL_PARENT_WHEN_READY environment variable to enable osrm-routed signal its parent with USR1 when it's running and waiting for requests.
- BREAKING: Intersection Classification adds a new file to the mix (osrm.icd). This breaks the fileformat for older versions.
- Disable http access logging via DISABLE_ACCESS_LOGGING environment
variable.
- Guidance:
- improved detection of turning streets, not reporting new-name in wrong situations
# 5.1.0
Changes with regard to 5.0.0
- API:
- added StepManeuver type `roundabout turn`. The type indicates a small roundabout that is treated as an intersection
(turn right at the roundabout for first exit, go straight at the roundabout...)
- added StepManeuver type `on ramp` and `off ramp` to distinguish between ramps that enter and exit a highway.
- reduced new name instructions for trivial changes
- combined multiple turns into a single instruction at segregated roads`
- Profile Changes:
- introduced a suffix_list / get_name_suffix_list to specify name suffices to be suppressed in name change announcements
- street names are now consistently assembled for the car, bike and walk profile as: "Name (Ref)" as in "Berlin (A5)"
- new `car.lua` dependency `lib/destination.lua`
- register a way's .nodes() function for use in the profile's way_function.
- Infrastructure
- BREAKING: reordered internal instruction types. This breaks the **data format**
- BREAKING: Changed the on-disk encoding of the StaticRTree for better performance. This breaks the **data format**
- Fixes:
- Issue #2310: post-processing for local paths, fixes #2310
- Issue #2309: local path looping, fixes #2309
- Issue #2356: Make hint values optional
- Issue #2349: Segmentation fault in some requests
- Issue #2335: map matching was using shortest path with uturns disabled
- Issue #2193: Fix syntax error position indicators in parameters queries
- Fix search with u-turn
- PhantomNode packing in MSVC now the same on other platforms
- Summary is now not malformed when including unnamed roads
- Emit new-name on when changing fron unanmed road to named road
# 5.0.0
Changes with regard 5.0.0 RC2:
- API:
- if `geometry=geojson` is passed the resulting geometry can be a LineString or Point
depending on how many coordinates are present.
- the removal of the summary field was revered. for `steps=flase` the field will always be an empty string.
Changes with regard to 4.9.1:
- API:
- BREAKING: Complete rewrite of the HTTP and library API. See detailed documentation in the wiki.
- BREAKING: The default coordinate order is now `longitude, latidue`. Exception: Polyline geometry
which follow the original Google specification of `latitdue, longitude`.
- BREAKING: Polyline geometries now use precision 5, instead of previously 6
- BREAKING: Removed GPX support
- New service `tile` which serves debug vector tiles of the road network
- Completely new engine for guidance generation:
- Support for highway ramps
- Support for different intersection types (end of street, forks, merges)
- Instruction post-processing to merge unimportant instructions
- Improved handling of roundabouts
- Tools:
- BREAKING: Renamed osrm-prepare to osrm-contract
- BREAKING: Removes profiles from osrm-contract, only needed in osrm-extract.
- Abort processing in osrm-extract if there are no snappable edges remaining.
- Added .properties file to osrm-extract ouput.
- Enables the use of multiple segment-speed-files on the osrm-contract command line
- Profile changes:
- Remove movable bridge mode
- Add `maxspeed=none` tag to car profile.
- A `side_road` tag support for the OSRM car profile.
- Fixes:
- Issue #2150: Prevents routing over delivery ways and nodes
- Issue #1972: Provide uninstall target
- Issue #2072: Disable alternatives by default and if core factor < 1.0
- Issue #1999: Fix unpacking for self-loop nodes not in core.
- Infrastructure:
- Cucumber test suit is now based on cucumber-js, removes Ruby as dependency
- Updated to mapbox/variant v1.1
- Updated to libosmium v2.6.1
- Remove GeoJSON based debugging output, replaced by debug tiles
# 5.0.0 RC2
- Profiles:
- `properties.allow_uturns_at_via` -> `properties.continue_straight_at_waypoint` (value is inverted!)
- API:
- Removed summary from legs property
- Disable steps and alternatives by default
- Fix `code` field: 'ok' -> 'Ok'
- Allow 4.json and 4.3.json format
- Conform to v5 spec and support "unlimited" as radiuses value.
- `uturns` parameter was replaced by `continue_straight` (value is inverted!)
- Features:
- Report progress for gennerating edge expanded edges in the edge based graph factory
- Add maxspeed=none tag to car profile.
- Optimize StaticRTree code: speedup 2x (to RC1)
- Optimize DouglasPeucker code: speedup 10x (to RC1)
- Optimize WebMercator projection: speedup 2x (to RC1)
- Bugs:
- #2195: Resolves issues with multiple includedirs in pkg-config file
- #2219: Internal server error when using the match plugin
- #2027: basename -> filename
- #2168: Report correct position where parsing failed
- #2036: Add license to storage and storage config exposed in public API
- Fix uturn detection in match plugin
- Add missing -lz to fix linking of server-tests
# 5.0.0 RC1
- Renamed osrm-prepare into osrm-contract
- osrm-contract does not need a profile parameter anymore
- New public HTTP API, find documentation [here](https://github.com/Project-OSRM/osrm-backend/wiki/New-Server-api)
- POST support is discontinued, please use library bindings for more complex requests
- Removed timestamp plugin
- Coordinate order is now Longitude,Latitude
- Cucumber tests now based on Javascript (run with `npm test`)
- Profile API changed:
- `forward_mode` and `backward_mode` now need to be selected from a pre-defined list
- Global profile properties are now stored in a global `properties` element. This includes:
- `properties.traffic_signal_penalty`
- `properties.use_turn_restrictions`
- `properties.u_turn_penalty`
- `properties.allow_u_turn_at_via`
+464 -172
View File
@@ -1,207 +1,499 @@
cmake_minimum_required(VERSION 2.6)
project(OSRM)
cmake_minimum_required(VERSION 2.8.11)
# we depend on 2.8.11 introducing target_include_directories
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
message(FATAL_ERROR "In-source builds are not allowed.
Please create a directory and run cmake from there, passing the path to this source directory as the last argument.
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'. Please delete them.")
endif()
project(OSRM C CXX)
set(OSRM_VERSION_MAJOR 5)
set(OSRM_VERSION_MINOR 2)
set(OSRM_VERSION_PATCH 5)
# these two functions build up custom variables:
# OSRM_INCLUDE_PATHS and OSRM_DEFINES
# These variables we want to pass to
# include_directories and add_definitions for both
# this build and for sharing externally via pkg-config
function(add_dependency_includes includes)
list(APPEND OSRM_INCLUDE_PATHS "${includes}")
set(OSRM_INCLUDE_PATHS "${OSRM_INCLUDE_PATHS}" PARENT_SCOPE)
endfunction(add_dependency_includes)
function(add_dependency_defines defines)
list(APPEND OSRM_DEFINES "${defines}")
set(OSRM_DEFINES "${OSRM_DEFINES}" PARENT_SCOPE)
endfunction(add_dependency_defines)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(CheckCXXCompilerFlag)
include(FindPackageHandleStandardArgs)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include(GetGitRevisionDescription)
git_describe(GIT_DESCRIPTION)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
TRY_RUN(SHARED_LIBRARY_PATH_TYPE SHARED_LIBRARY_PATH_INFO_COMPILED ${PROJECT_BINARY_DIR}/CMakeTmp ${PROJECT_SOURCE_DIR}/cmake/size.cpp OUTPUT_VARIABLE IS_64_SYSTEM)
if(IS_64_SYSTEM)
message(STATUS "System supports 64 bits.")
set( HAS64BITS 1 )
else(IS_64_SYSTEM)
MESSAGE(WARNING "Compiling on a 32 bit system is unsupported!")
set( HAS64BITS 0 )
endif(IS_64_SYSTEM)
set(bitness 32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(bitness 64)
message(STATUS "Building on a 64 bit system")
else()
message(WARNING "Building on a 32 bit system is unsupported")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
if(WIN32 AND MSVC_VERSION LESS 1900)
message(FATAL_ERROR "Building with Microsoft compiler needs Latest Visual Studio 2015 (Community or better)")
endif()
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/Util/UUID.cpp UUID.cpp.alwaysbuild
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/UUID-Config.cmake
DEPENDS
${CMAKE_SOURCE_DIR}/Util/UUID.cpp.in
${CMAKE_SOURCE_DIR}/cmake/UUID-Config.cmake
COMMENT "Configuring UUID.cpp"
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
option(ENABLE_JSON_LOGGING "Adds additional JSON debug logging to the response" OFF)
option(BUILD_TOOLS "Build OSRM tools" OFF)
option(BUILD_COMPONENTS "Build osrm-components" OFF)
option(ENABLE_ASSERTIONS OFF)
option(COVERAGE OFF)
option(SANITIZER OFF)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/)
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/)
add_custom_target(FingerPrintConfigure ALL ${CMAKE_COMMAND}
"-DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR}"
"-DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/FingerPrint-Config.cmake"
COMMENT "Configuring revision fingerprint"
VERBATIM)
add_custom_target(UUIDConfigure DEPENDS ${CMAKE_SOURCE_DIR}/Util/UUID.cpp )
set(BOOST_COMPONENTS date_time filesystem iostreams program_options regex system thread)
set(BOOST_COMPONENTS filesystem iostreams program_options regex system thread)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/util/version.hpp.in
${CMAKE_CURRENT_BINARY_DIR}/include/util/version.hpp
)
file(GLOB UtilGlob src/util/*.cpp src/util/*/*.cpp)
file(GLOB ExtractorGlob src/extractor/*.cpp src/extractor/*/*.cpp)
file(GLOB ContractorGlob src/contractor/*.cpp)
file(GLOB StorageGlob src/storage/*.cpp)
file(GLOB ServerGlob src/server/*.cpp src/server/**/*.cpp)
file(GLOB EngineGlob src/engine/*.cpp src/engine/**/*.cpp)
configure_file(Util/GitDescription.cpp.in ${CMAKE_SOURCE_DIR}/Util/GitDescription.cpp)
file(GLOB ExtractorGlob Extractor/*.cpp)
set(ExtractorSources extractor.cpp ${ExtractorGlob})
add_executable(osrm-extract ${ExtractorSources} )
add_library(UTIL OBJECT ${UtilGlob})
add_library(EXTRACTOR OBJECT ${ExtractorGlob})
add_library(CONTRACTOR OBJECT ${ContractorGlob})
add_library(STORAGE OBJECT ${StorageGlob})
add_library(ENGINE OBJECT ${EngineGlob})
add_library(SERVER OBJECT ${ServerGlob})
file( GLOB PrepareGlob Contractor/*.cpp )
set( PrepareSources prepare.cpp ${PrepareGlob} )
add_executable( osrm-prepare ${PrepareSources} )
add_dependencies(UTIL FingerPrintConfigure)
set_target_properties(UTIL PROPERTIES LINKER_LANGUAGE CXX)
file(GLOB ServerGlob Server/*.cpp)
file(GLOB DescriptorGlob Descriptors/*.cpp)
file(GLOB DatastructureGlob DataStructures/*.cpp)
file(GLOB AlgorithmGlob Algorithms/*.cpp)
file(GLOB HttpGlob Server/Http/*.cpp)
file(GLOB LibOSRMGlob Library/*.cpp)
set(OSRMSources ${LibOSRMGlob} ${DescriptorGlob} ${DatastructureGlob} ${AlgorithmGlob} ${HttpGlob})
add_library( OSRM SHARED ${OSRMSources} )
add_library( UUID STATIC Util/UUID.cpp )
add_library( GITDESCRIPTION STATIC Util/GitDescription.cpp )
add_dependencies( UUID UUIDConfigure )
add_dependencies( GITDESCRIPTION GIT_DESCRIPTION )
add_executable(osrm-routed routed.cpp ${ServerGlob})
set_target_properties(osrm-routed PROPERTIES COMPILE_FLAGS -DROUTED)
add_executable(osrm-datastore datastore.cpp)
add_executable(osrm-extract src/tools/extract.cpp)
add_executable(osrm-contract src/tools/contract.cpp)
add_executable(osrm-routed src/tools/routed.cpp $<TARGET_OBJECTS:SERVER> $<TARGET_OBJECTS:UTIL>)
add_executable(osrm-datastore src/tools/store.cpp $<TARGET_OBJECTS:UTIL>)
add_library(osrm src/osrm/osrm.cpp $<TARGET_OBJECTS:ENGINE> $<TARGET_OBJECTS:UTIL> $<TARGET_OBJECTS:STORAGE>)
add_library(osrm_extract $<TARGET_OBJECTS:EXTRACTOR> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_contract $<TARGET_OBJECTS:CONTRACTOR> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_store $<TARGET_OBJECTS:STORAGE> $<TARGET_OBJECTS:UTIL>)
# Check the release mode
if(NOT CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_BUILD_TYPE Release)
endif(NOT CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_BUILD_TYPE Release)
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug)
message(STATUS "Configuring OSRM in debug mode")
endif(CMAKE_BUILD_TYPE MATCHES Debug)
if(CMAKE_BUILD_TYPE MATCHES Release)
message(STATUS "Configuring OSRM in release mode")
endif(CMAKE_BUILD_TYPE MATCHES Release)
message(STATUS "Configuring OSRM in debug mode")
set(ENABLE_ASSERTIONS ON)
if(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
# set compile switches
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# not using Visual Studio C++
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fPIC")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-inline -fno-omit-frame-pointer")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ggdb")
endif()
endif()
endif()
if(CMAKE_BUILD_TYPE MATCHES Release)
message(STATUS "Configuring OSRM in release mode")
# Check if LTO is available
check_cxx_compiler_flag("-flto" LTO_AVAILABLE)
if(LTO_AVAILABLE)
set(OLD_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# GCC in addition allows parallelizing LTO
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
include(ProcessorCount)
ProcessorCount(NPROC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto=${NPROC}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
endif()
set(CHECK_LTO_SRC "int main(){return 0;}")
check_cxx_source_compiles("${CHECK_LTO_SRC}" LTO_WORKS)
if(LTO_WORKS)
message(STATUS "LTO working")
else()
message(STATUS "LTO broken")
set(CMAKE_CXX_FLAGS "${OLD_CXX_FLAGS}")
endif()
# Since gcc 4.9 the LTO format is non-standart ('slim'), so we need to use the build-in tools
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND
NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9.0" AND NOT MINGW)
message(STATUS "Using gcc specific binutils for LTO.")
set(CMAKE_AR "/usr/bin/gcc-ar")
set(CMAKE_RANLIB "/usr/bin/gcc-ranlib")
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9.0")
message(STATUS "Disabling LTO on GCC < 4.9.0 since it is broken, see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57038")
set(CMAKE_CXX_FLAGS "${OLD_CXX_FLAGS}")
endif()
endif()
endif()
set(MAYBE_COVERAGE_LIBRARIES "")
if (COVERAGE)
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
message(ERROR "COVERAGE=ON only make sense with a Debug build")
endif()
message(INFO "Enabling coverage")
set(MAYBE_COVERAGE_LIBRARIES "gcov")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs")
endif()
if (SANITIZER)
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
message(ERROR "SANITIZER=ON only make sense with a Debug build")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
endif()
# Configuring compilers
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# using Clang
set(CMAKE_CXX_FLAGS "-Wall -Wno-unknown-pragmas -Wno-unneeded-internal-declaration")
message(STATUS "OpenMP parallelization not available using clang++")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# using GCC
set(CMAKE_CXX_FLAGS "-Wall -fopenmp -pedantic")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
# using Intel C++
set(CMAKE_CXX_FLAGS "-static-intel -wd10237 -Wall -openmp -ipo")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wuninitialized -Wunreachable-code -Wstrict-overflow=2 -D_FORTIFY_SOURCE=2 -fPIC -fcolor-diagnostics")
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
set(COLOR_FLAG "-fdiagnostics-color=auto")
check_cxx_compiler_flag("-fdiagnostics-color=auto" HAS_COLOR_FLAG)
if(NOT HAS_COLOR_FLAG)
set(COLOR_FLAG "")
endif()
# using GCC
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wuninitialized -Wunreachable-code -Wstrict-overflow=1 -D_FORTIFY_SOURCE=2 ${COLOR_FLAG} -fPIC")
if(WIN32) # using mingw
add_dependency_defines(-DWIN32)
set(OPTIONAL_SOCKET_LIBS ws2_32 wsock32)
endif()
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
# using Intel C++
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-intel -wd10237 -Wall -ipo -fPIC")
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
# using Visual Studio C++
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} date_time chrono zlib)
add_dependency_defines(-DBOOST_LIB_DIAGNOSTIC)
add_dependency_defines(-D_CRT_SECURE_NO_WARNINGS)
add_dependency_defines(-DNOMINMAX) # avoid min and max macros that can break compilation
add_dependency_defines(-D_USE_MATH_DEFINES) #needed for M_PI with cmath.h
add_dependency_defines(-D_WIN32_WINNT=0x0501)
add_dependency_defines(-DXML_STATIC)
find_library(ws2_32_LIBRARY_PATH ws2_32)
target_link_libraries(osrm-extract wsock32 ws2_32)
endif()
# Configuring linker
execute_process(COMMAND ${CMAKE_CXX_COMPILER} "-Wl,--version" ERROR_QUIET OUTPUT_VARIABLE LINKER_VERSION)
# For ld.gold and ld.bfs (the GNU linkers) we optimize hard
if("${LINKER_VERSION}" MATCHES "GNU gold" OR "${LINKER_VERSION}" MATCHES "GNU ld")
message(STATUS "Setting linker optimizations")
if(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
# Tell compiler to put every function in separate section, linker can then match sections and functions
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
# Tell linker to do dead code and data eminination during link time discarding sections
set(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--gc-sections")
endif()
# Default linker optimization flags
set(LINKER_FLAGS "${LINKER_FLAGS} -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common")
else()
message(STATUS "Using unknown linker, not setting linker optimizations")
endif ()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")
# Activate C++11
if(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
# Configuring other platform dependencies
if(APPLE)
SET(CMAKE_OSX_ARCHITECTURES "x86_64")
message(STATUS "Set Architecture to x64 on OS X")
EXEC_PROGRAM(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
STRING(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
IF (DARWIN_VERSION GREATER 12)
MESSAGE(STATUS "Activating -std=c++11 flag for >= OS X 10.9")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
ENDIF (DARWIN_VERSION GREATER 12)
set(CMAKE_OSX_ARCHITECTURES "x86_64")
message(STATUS "Set Architecture to x64 on OS X")
exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
if(OSXLIBSTD)
message(STATUS "linking against ${OSXLIBSTD}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=${OSXLIBSTD}")
elseif(DARWIN_VERSION GREATER 12)
message(STATUS "linking against libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
endif()
if(UNIX AND NOT APPLE)
target_link_libraries( osrm-datastore rt )
target_link_libraries( OSRM rt )
endif(UNIX AND NOT APPLE)
set(MAYBE_RT_LIBRARY rt)
endif()
#Check Boost
set(BOOST_MIN_VERSION "1.44.0")
find_package( Boost ${BOOST_MIN_VERSION} COMPONENTS ${BOOST_COMPONENTS} REQUIRED )
if (NOT Boost_FOUND)
message(FATAL_ERROR "Fatal error: Boost (version >= 1.44.0) required.\n")
endif (NOT Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
IF( APPLE )
target_link_libraries( OSRM ${Boost_LIBRARIES} UUID )
ELSE( APPLE )
target_link_libraries( OSRM ${Boost_LIBRARIES} )
ENDIF( APPLE )
target_link_libraries( osrm-extract ${Boost_LIBRARIES} UUID GITDESCRIPTION )
target_link_libraries( osrm-prepare ${Boost_LIBRARIES} UUID GITDESCRIPTION )
target_link_libraries( osrm-routed ${Boost_LIBRARIES} OSRM UUID GITDESCRIPTION )
target_link_libraries( osrm-datastore ${Boost_LIBRARIES} UUID GITDESCRIPTION )
find_package ( BZip2 REQUIRED )
include_directories(${BZIP_INCLUDE_DIRS})
target_link_libraries (osrm-extract ${BZIP2_LIBRARIES})
find_package( ZLIB REQUIRED )
include_directories(${ZLIB_INCLUDE_DIRS})
target_link_libraries (osrm-extract ${ZLIB_LIBRARY})
target_link_libraries (osrm-routed ${ZLIB_LIBRARY})
find_package( Threads REQUIRED )
target_link_libraries (osrm-extract ${Threads_LIBRARY})
find_package( Lua52 )
IF ( NOT LUA52_FOUND )
find_package( Lua51 REQUIRED )
IF (NOT APPLE)
find_package( LuaJIT 5.1 )
ENDIF ( NOT APPLE )
ELSE( NOT LUA52_FOUND )
IF(NOT APPLE)
find_package( LuaJIT 5.2 )
ENDIF(NOT APPLE)
ENDIF( NOT LUA52_FOUND )
IF ( LUAJIT_FOUND )
target_link_libraries( osrm-extract ${LUAJIT_LIBRARIES} )
target_link_libraries( osrm-prepare ${LUAJIT_LIBRARIES} )
ELSE ()
target_link_libraries( osrm-extract ${LUA_LIBRARY} )
target_link_libraries( osrm-prepare ${LUA_LIBRARY} )
ENDIF ()
include_directories(${LUA_INCLUDE_DIR})
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/cmake")
set(OSMIUM_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include")
find_package(Osmium REQUIRED COMPONENTS io)
add_dependency_includes(${OSMIUM_INCLUDE_DIR})
find_package( LibXml2 REQUIRED )
include_directories(${LIBXML2_INCLUDE_DIR})
target_link_libraries (osrm-extract ${LIBXML2_LIBRARIES})
find_package(Boost 1.49.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
find_package( Luabind REQUIRED )
include_directories(${LUABIND_INCLUDE_DIR})
target_link_libraries (osrm-extract ${LUABIND_LIBRARY})
target_link_libraries (osrm-prepare ${LUABIND_LIBRARY})
# collect a subset of the boost libraries needed
# by libosrm
foreach(lib ${Boost_LIBRARIES})
if(NOT WIN32)
if(lib MATCHES filesystem OR lib MATCHES thread OR lib MATCHES iostreams OR lib MATCHES system)
list(APPEND BOOST_ENGINE_LIBRARIES "${lib}")
endif()
else()
list(APPEND BOOST_ENGINE_LIBRARIES "${lib}")
endif()
endforeach(lib)
find_package( Protobuf REQUIRED )
include_directories(${PROTOBUF_INCLUDE_DIRS})
target_link_libraries (osrm-extract ${PROTOBUF_LIBRARY})
target_link_libraries (osrm-prepare ${PROTOBUF_LIBRARY})
if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS)
add_dependency_defines(-DBOOST_TEST_DYN_LINK)
endif()
add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3)
add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE)
add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED)
add_dependency_includes(${Boost_INCLUDE_DIRS})
find_package( STXXL REQUIRED )
include_directories(${STXXL_INCLUDE_DIR})
target_link_libraries (OSRM ${STXXL_LIBRARY})
target_link_libraries (osrm-extract ${STXXL_LIBRARY})
target_link_libraries (osrm-prepare ${STXXL_LIBRARY})
find_package(Threads REQUIRED)
find_package( OSMPBF REQUIRED )
include_directories(${OSMPBF_INCLUDE_DIR})
target_link_libraries (osrm-extract ${OSMPBF_LIBRARY})
target_link_libraries (osrm-prepare ${OSMPBF_LIBRARY})
find_package(TBB REQUIRED)
add_dependency_includes(${TBB_INCLUDE_DIR})
if(WIN32 AND CMAKE_BUILD_TYPE MATCHES Debug)
set(TBB_LIBRARIES ${TBB_DEBUG_LIBRARIES})
endif()
if(WITH_TOOLS)
message(STATUS "Activating OSRM internal tools")
find_package( GDAL )
if(GDAL_FOUND)
add_executable(osrm-components Tools/componentAnalysis.cpp)
include_directories(${GDAL_INCLUDE_DIR})
target_link_libraries(
osrm-components ${GDAL_LIBRARIES} ${Boost_LIBRARIES} UUID GITDESCRIPTION
)
endif(GDAL_FOUND)
add_executable ( osrm-cli Tools/simpleclient.cpp)
target_link_libraries( osrm-cli ${Boost_LIBRARIES} OSRM UUID GITDESCRIPTION )
add_executable ( osrm-io-benchmark Tools/io-benchmark.cpp )
target_link_libraries( osrm-io-benchmark ${Boost_LIBRARIES} GITDESCRIPTION)
add_executable ( osrm-unlock-all Tools/unlock_all_mutexes.cpp )
target_link_libraries( osrm-unlock-all ${Boost_LIBRARIES} GITDESCRIPTION)
if(UNIX AND NOT APPLE)
target_link_libraries( osrm-unlock-all rt )
endif(UNIX AND NOT APPLE)
endif(WITH_TOOLS)
find_package(Luabind REQUIRED)
include(check_luabind)
add_dependency_includes(${LUABIND_INCLUDE_DIR})
set(USED_LUA_LIBRARIES ${LUA_LIBRARY})
if(LUAJIT_FOUND)
set(USED_LUA_LIBRARIES, LUAJIT_LIBRARIES)
endif()
add_dependency_includes(${LUA_INCLUDE_DIR})
find_package(EXPAT REQUIRED)
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
find_package(STXXL REQUIRED)
add_dependency_includes(${STXXL_INCLUDE_DIR})
set(OpenMP_FIND_QUIETLY ON)
find_package(OpenMP)
if(OPENMP_FOUND)
message(STATUS "OpenMP support found. Linking just in case for stxxl")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
find_package(BZip2 REQUIRED)
add_dependency_includes(${BZIP2_INCLUDE_DIR})
find_package(ZLIB REQUIRED)
add_dependency_includes(${ZLIB_INCLUDE_DIRS})
if (ENABLE_JSON_LOGGING)
message(STATUS "Enabling json logging")
add_dependency_defines(-DENABLE_JSON_LOGGING)
endif()
add_definitions(${OSRM_DEFINES})
include_directories(SYSTEM ${OSRM_INCLUDE_PATHS})
# Binaries
target_link_libraries(osrm-datastore osrm_store ${Boost_LIBRARIES})
target_link_libraries(osrm-extract osrm_extract ${Boost_LIBRARIES})
target_link_libraries(osrm-contract osrm_contract ${Boost_LIBRARIES})
target_link_libraries(osrm-routed osrm ${Boost_LIBRARIES} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY})
set(EXTRACTOR_LIBRARIES
${BZIP2_LIBRARIES}
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${EXPAT_LIBRARIES}
${LUABIND_LIBRARY}
${USED_LUA_LIBRARIES}
${OSMIUM_LIBRARIES}
${STXXL_LIBRARY}
${TBB_LIBRARIES}
${ZLIB_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES})
set(CONTRACTOR_LIBRARIES
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${LUABIND_LIBRARY}
${USED_LUA_LIBRARIES}
${STXXL_LIBRARY}
${TBB_LIBRARIES}
${MAYBE_RT_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES})
set(ENGINE_LIBRARIES
${BOOST_ENGINE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${TBB_LIBRARIES}
${MAYBE_RT_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES}
${ZLIB_LIBRARY})
set(STORAGE_LIBRARIES
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${TBB_LIBRARIES}
${MAYBE_RT_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES})
set(UTIL_LIBRARIES
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${STXXL_LIBRARY}
${TBB_LIBRARIES}
${MAYBE_COVERAGE_LIBRARIES})
# Libraries
target_link_libraries(osrm ${ENGINE_LIBRARIES})
target_link_libraries(osrm_contract ${CONTRACTOR_LIBRARIES})
target_link_libraries(osrm_extract ${EXTRACTOR_LIBRARIES})
target_link_libraries(osrm_store ${STORAGE_LIBRARIES})
if(BUILD_COMPONENTS)
find_package(GDAL)
if(GDAL_FOUND)
add_executable(osrm-components src/tools/components.cpp $<TARGET_OBJECTS:UTIL>)
target_link_libraries(osrm-components ${TBB_LIBRARIES})
include_directories(SYSTEM ${GDAL_INCLUDE_DIR})
target_link_libraries(osrm-components ${GDAL_LIBRARIES} ${Boost_LIBRARIES})
install(TARGETS osrm-components DESTINATION bin)
else()
message(WARNING "libgdal and/or development headers not found")
endif()
endif()
if(BUILD_TOOLS)
message(STATUS "Activating OSRM internal tools")
add_executable(osrm-io-benchmark src/tools/io-benchmark.cpp $<TARGET_OBJECTS:UTIL>)
target_link_libraries(osrm-io-benchmark ${Boost_LIBRARIES})
add_executable(osrm-unlock-all src/tools/unlock_all_mutexes.cpp $<TARGET_OBJECTS:UTIL>)
target_link_libraries(osrm-unlock-all ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
if(UNIX AND NOT APPLE)
target_link_libraries(osrm-unlock-all rt)
endif()
add_executable(osrm-springclean src/tools/springclean.cpp $<TARGET_OBJECTS:UTIL>)
target_link_libraries(osrm-springclean ${Boost_LIBRARIES})
install(TARGETS osrm-io-benchmark DESTINATION bin)
install(TARGETS osrm-unlock-all DESTINATION bin)
install(TARGETS osrm-springclean DESTINATION bin)
endif()
if (ENABLE_ASSERTIONS)
message(STATUS "Enabling assertions")
add_definitions(-DBOOST_ENABLE_ASSERT_HANDLER)
endif()
# Add RPATH info to executables so that when they are run after being installed
# (i.e., from /usr/local/bin/) the linker can find library dependencies. For
# more info see http://www.cmake.org/Wiki/CMake_RPATH_handling
set_property(TARGET osrm-extract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
set_property(TARGET osrm-contract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
set_property(TARGET osrm-datastore PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
file(GLOB VariantGlob third_party/variant/*.hpp)
file(GLOB LibraryGlob include/osrm/*.hpp)
file(GLOB ParametersGlob include/engine/api/*_parameters.hpp)
set(EngineHeader include/engine/status.hpp include/engine/engine_config.hpp include/engine/hint.hpp include/engine/bearing.hpp include/engine/phantom_node.hpp)
set(UtilHeader include/util/coordinate.hpp include/util/json_container.hpp include/util/typedefs.hpp include/util/strong_typedef.hpp)
set(ExtractorHeader include/extractor/extractor.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp)
set(ContractorHeader include/contractor/contractor.hpp include/contractor/contractor_config.hpp)
set(StorageHeader include/storage/storage.hpp include/storage/storage_config.hpp)
install(FILES ${EngineHeader} DESTINATION include/osrm/engine)
install(FILES ${UtilHeader} DESTINATION include/osrm/util)
install(FILES ${StorageHeader} DESTINATION include/osrm/storage)
install(FILES ${ExtractorHeader} DESTINATION include/osrm/extractor)
install(FILES ${ContractorHeader} DESTINATION include/osrm/contractor)
install(FILES ${LibraryGlob} DESTINATION include/osrm)
install(FILES ${ParametersGlob} DESTINATION include/osrm/engine/api)
install(FILES ${VariantGlob} DESTINATION include/variant)
install(TARGETS osrm-extract DESTINATION bin)
install(TARGETS osrm-contract DESTINATION bin)
install(TARGETS osrm-datastore DESTINATION bin)
install(TARGETS osrm-routed DESTINATION bin)
install(TARGETS osrm DESTINATION lib)
install(TARGETS osrm_extract DESTINATION lib)
install(TARGETS osrm_contract DESTINATION lib)
install(TARGETS osrm_store DESTINATION lib)
list(GET ENGINE_LIBRARIES 1 ENGINE_LIBRARY_FIRST)
foreach(lib ${ENGINE_LIBRARIES})
get_filename_component(ENGINE_LIBRARY_PATH "${ENGINE_LIBRARY_FIRST}" PATH)
get_filename_component(ENGINE_LIBRARY_NAME "${lib}" NAME_WE)
string(REPLACE "lib" "" ENGINE_LIBRARY_NAME ${ENGINE_LIBRARY_NAME})
string(REPLACE "-l" "" ENGINE_LIBRARY_NAME ${ENGINE_LIBRARY_NAME})
set(ENGINE_LIBRARY_LISTING "${ENGINE_LIBRARY_LISTING} -L${ENGINE_LIBRARY_PATH} -l${ENGINE_LIBRARY_NAME}")
endforeach()
if(BUILD_DEBIAN_PACKAGE)
include(CPackDebianConfig)
include(CPack)
endif()
function(JOIN VALUES GLUE OUTPUT)
string (REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}")
set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
endfunction()
# Set up variables, then write to pkgconfig file
JOIN("${OSRM_DEFINES}" " " OSRM_DEFINES_STRING)
JOIN("-I${OSRM_INCLUDE_PATHS}" " -I" OSRM_INCLUDE_PATHS_STRING)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in libosrm.pc @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION lib/pkgconfig)
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif()
# prefix compilation with ccache by default if available and on clang or gcc
if(ENABLE_CCACHE AND (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU"))
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
message(STATUS "Using ccache to speed up incremental builds")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
set(ENV{CCACHE_CPP2} "true")
endif()
endif()
# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake)
# Modular build system: each directory registered here provides its own CMakeLists.txt
add_subdirectory(unit_tests)
add_subdirectory(src/benchmarks)
-792
View File
@@ -1,792 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CONTRACTOR_H_INCLUDED
#define CONTRACTOR_H_INCLUDED
#include "TemporaryStorage.h"
#include "../DataStructures/BinaryHeap.h"
#include "../DataStructures/DeallocatingVector.h"
#include "../DataStructures/DynamicGraph.h"
#include "../DataStructures/Percent.h"
#include "../DataStructures/XORFastHash.h"
#include "../DataStructures/XORFastHashStorage.h"
#include "../Util/OpenMPWrapper.h"
#include "../Util/SimpleLogger.h"
#include "../Util/StringUtil.h"
#include <boost/assert.hpp>
#include <boost/foreach.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp>
#include <ctime>
#include <algorithm>
#include <limits>
#include <vector>
class Contractor {
private:
struct _ContractorEdgeData {
_ContractorEdgeData() :
distance(0), id(0), originalEdges(0), shortcut(0), forward(0), backward(0), originalViaNodeID(false) {}
_ContractorEdgeData( unsigned _distance, unsigned _originalEdges, unsigned _id, bool _shortcut, bool _forward, bool _backward) :
distance(_distance), id(_id), originalEdges(std::min((unsigned)1<<28, _originalEdges) ), shortcut(_shortcut), forward(_forward), backward(_backward), originalViaNodeID(false) {}
unsigned distance;
unsigned id;
unsigned originalEdges:28;
bool shortcut:1;
bool forward:1;
bool backward:1;
bool originalViaNodeID:1;
} data;
struct _HeapData {
short hop;
bool target;
_HeapData() : hop(0), target(false) {}
_HeapData( short h, bool t ) : hop(h), target(t) {}
};
typedef DynamicGraph< _ContractorEdgeData > _DynamicGraph;
// typedef BinaryHeap< NodeID, NodeID, int, _HeapData, ArrayStorage<NodeID, NodeID> > _Heap;
typedef BinaryHeap< NodeID, NodeID, int, _HeapData, XORFastHashStorage<NodeID, NodeID> > _Heap;
typedef _DynamicGraph::InputEdge _ContractorEdge;
struct _ThreadData {
_Heap heap;
std::vector< _ContractorEdge > insertedEdges;
std::vector< NodeID > neighbours;
_ThreadData( NodeID nodes ): heap( nodes ) { }
};
struct _PriorityData {
int depth;
_PriorityData() : depth(0) { }
};
struct _ContractionInformation {
int edgesDeleted;
int edgesAdded;
int originalEdgesDeleted;
int originalEdgesAdded;
_ContractionInformation() : edgesDeleted(0), edgesAdded(0), originalEdgesDeleted(0), originalEdgesAdded(0) {}
};
struct _RemainingNodeData {
_RemainingNodeData() : id (0), isIndependent(false) {}
NodeID id:31;
bool isIndependent:1;
};
struct _NodePartitionor {
inline bool operator()(_RemainingNodeData & nodeData ) const {
return !nodeData.isIndependent;
}
};
public:
template<class ContainerT >
Contractor( int nodes, ContainerT& inputEdges) {
std::vector< _ContractorEdge > edges;
edges.reserve(inputEdges.size()*2);
typename ContainerT::deallocation_iterator diter = inputEdges.dbegin();
typename ContainerT::deallocation_iterator dend = inputEdges.dend();
_ContractorEdge newEdge;
while(diter!=dend) {
newEdge.source = diter->source();
newEdge.target = diter->target();
newEdge.data = _ContractorEdgeData( (std::max)((int)diter->weight(), 1 ), 1, diter->id(), false, diter->isForward(), diter->isBackward());
BOOST_ASSERT_MSG( newEdge.data.distance > 0, "edge distance < 1" );
#ifndef NDEBUG
if ( newEdge.data.distance > 24 * 60 * 60 * 10 ) {
SimpleLogger().Write(logWARNING) <<
"Edge weight large -> " << newEdge.data.distance;
}
#endif
edges.push_back( newEdge );
std::swap( newEdge.source, newEdge.target );
newEdge.data.forward = diter->isBackward();
newEdge.data.backward = diter->isForward();
edges.push_back( newEdge );
++diter;
}
//clear input vector and trim the current set of edges with the well-known swap trick
inputEdges.clear();
sort( edges.begin(), edges.end() );
NodeID edge = 0;
for ( NodeID i = 0; i < edges.size(); ) {
const NodeID source = edges[i].source;
const NodeID target = edges[i].target;
const NodeID id = edges[i].data.id;
//remove eigenloops
if ( source == target ) {
i++;
continue;
}
_ContractorEdge forwardEdge;
_ContractorEdge backwardEdge;
forwardEdge.source = backwardEdge.source = source;
forwardEdge.target = backwardEdge.target = target;
forwardEdge.data.forward = backwardEdge.data.backward = true;
forwardEdge.data.backward = backwardEdge.data.forward = false;
forwardEdge.data.shortcut = backwardEdge.data.shortcut = false;
forwardEdge.data.id = backwardEdge.data.id = id;
forwardEdge.data.originalEdges = backwardEdge.data.originalEdges = 1;
forwardEdge.data.distance = backwardEdge.data.distance = std::numeric_limits< int >::max();
//remove parallel edges
while ( i < edges.size() && edges[i].source == source && edges[i].target == target ) {
if ( edges[i].data.forward) {
forwardEdge.data.distance = std::min( edges[i].data.distance, forwardEdge.data.distance );
}
if ( edges[i].data.backward) {
backwardEdge.data.distance = std::min( edges[i].data.distance, backwardEdge.data.distance );
}
++i;
}
//merge edges (s,t) and (t,s) into bidirectional edge
if ( forwardEdge.data.distance == backwardEdge.data.distance ) {
if ( (int)forwardEdge.data.distance != std::numeric_limits< int >::max() ) {
forwardEdge.data.backward = true;
edges[edge++] = forwardEdge;
}
} else { //insert seperate edges
if ( ((int)forwardEdge.data.distance) != std::numeric_limits< int >::max() ) {
edges[edge++] = forwardEdge;
}
if ( (int)backwardEdge.data.distance != std::numeric_limits< int >::max() ) {
edges[edge++] = backwardEdge;
}
}
}
std::cout << "merged " << edges.size() - edge << " edges out of " << edges.size() << std::endl;
edges.resize( edge );
_graph = boost::make_shared<_DynamicGraph>( nodes, edges );
edges.clear();
std::vector<_ContractorEdge>().swap(edges);
// unsigned maxdegree = 0;
// NodeID highestNode = 0;
//
// for(unsigned i = 0; i < _graph->GetNumberOfNodes(); ++i) {
// unsigned degree = _graph->EndEdges(i) - _graph->BeginEdges(i);
// if(degree > maxdegree) {
// maxdegree = degree;
// highestNode = i;
// }
// }
//
// SimpleLogger().Write() << "edges at node with id " << highestNode << " has degree " << maxdegree;
// for(unsigned i = _graph->BeginEdges(highestNode); i < _graph->EndEdges(highestNode); ++i) {
// SimpleLogger().Write() << " ->(" << highestNode << "," << _graph->GetTarget(i) << "); via: " << _graph->GetEdgeData(i).via;
// }
//Create temporary file
// GetTemporaryFileName(temporaryEdgeStorageFilename);
temporaryStorageSlotID = TemporaryStorage::GetInstance().allocateSlot();
std::cout << "contractor finished initalization" << std::endl;
}
~Contractor() {
//Delete temporary file
// remove(temporaryEdgeStorageFilename.c_str());
TemporaryStorage::GetInstance().deallocateSlot(temporaryStorageSlotID);
}
void Run() {
const NodeID numberOfNodes = _graph->GetNumberOfNodes();
Percent p (numberOfNodes);
const unsigned maxThreads = omp_get_max_threads();
std::vector < _ThreadData* > threadData;
for ( unsigned threadNum = 0; threadNum < maxThreads; ++threadNum ) {
threadData.push_back( new _ThreadData( numberOfNodes ) );
}
std::cout << "Contractor is using " << maxThreads << " threads" << std::endl;
NodeID numberOfContractedNodes = 0;
std::vector< _RemainingNodeData > remainingNodes( numberOfNodes );
std::vector< float > nodePriority( numberOfNodes );
std::vector< _PriorityData > nodeData( numberOfNodes );
//initialize the variables
#pragma omp parallel for schedule ( guided )
for ( int x = 0; x < ( int ) numberOfNodes; ++x ) {
remainingNodes[x].id = x;
}
std::cout << "initializing elimination PQ ..." << std::flush;
#pragma omp parallel
{
_ThreadData* data = threadData[omp_get_thread_num()];
#pragma omp parallel for schedule ( guided )
for ( int x = 0; x < ( int ) numberOfNodes; ++x ) {
nodePriority[x] = _Evaluate( data, &nodeData[x], x );
}
}
std::cout << "ok" << std::endl << "preprocessing " << numberOfNodes << " nodes ..." << std::flush;
bool flushedContractor = false;
while ( numberOfNodes > 2 && numberOfContractedNodes < numberOfNodes ) {
if(!flushedContractor && (numberOfContractedNodes > (numberOfNodes*0.65) ) ){
DeallocatingVector<_ContractorEdge> newSetOfEdges; //this one is not explicitely cleared since it goes out of scope anywa
std::cout << " [flush " << numberOfContractedNodes << " nodes] " << std::flush;
//Delete old heap data to free memory that we need for the coming operations
BOOST_FOREACH(_ThreadData * data, threadData)
delete data;
threadData.clear();
//Create new priority array
std::vector<float> newNodePriority(remainingNodes.size());
//this map gives the old IDs from the new ones, necessary to get a consistent graph at the end of contraction
oldNodeIDFromNewNodeIDMap.resize(remainingNodes.size());
//this map gives the new IDs from the old ones, necessary to remap targets from the remaining graph
std::vector<NodeID> newNodeIDFromOldNodeIDMap(numberOfNodes, UINT_MAX);
//build forward and backward renumbering map and remap ids in remainingNodes and Priorities.
for(unsigned newNodeID = 0; newNodeID < remainingNodes.size(); ++newNodeID) {
//create renumbering maps in both directions
oldNodeIDFromNewNodeIDMap[newNodeID] = remainingNodes[newNodeID].id;
newNodeIDFromOldNodeIDMap[remainingNodes[newNodeID].id] = newNodeID;
newNodePriority[newNodeID] = nodePriority[remainingNodes[newNodeID].id];
remainingNodes[newNodeID].id = newNodeID;
}
TemporaryStorage & tempStorage = TemporaryStorage::GetInstance();
//Write dummy number of edges to temporary file
// std::ofstream temporaryEdgeStorage(temporaryEdgeStorageFilename.c_str(), std::ios::binary);
uint64_t initialFilePosition = tempStorage.tell(temporaryStorageSlotID);
unsigned numberOfTemporaryEdges = 0;
tempStorage.writeToSlot(temporaryStorageSlotID, (char*)&numberOfTemporaryEdges, sizeof(unsigned));
//walk over all nodes
for(unsigned i = 0; i < _graph->GetNumberOfNodes(); ++i) {
const NodeID start = i;
for(_DynamicGraph::EdgeIterator currentEdge = _graph->BeginEdges(start); currentEdge < _graph->EndEdges(start); ++currentEdge) {
_DynamicGraph::EdgeData & data = _graph->GetEdgeData(currentEdge);
const NodeID target = _graph->GetTarget(currentEdge);
if(UINT_MAX == newNodeIDFromOldNodeIDMap[i] ){
//Save edges of this node w/o renumbering.
tempStorage.writeToSlot(temporaryStorageSlotID, (char*)&start, sizeof(NodeID));
tempStorage.writeToSlot(temporaryStorageSlotID, (char*)&target, sizeof(NodeID));
tempStorage.writeToSlot(temporaryStorageSlotID, (char*)&data, sizeof(_DynamicGraph::EdgeData));
++numberOfTemporaryEdges;
}else {
//node is not yet contracted.
//add (renumbered) outgoing edges to new DynamicGraph.
_ContractorEdge newEdge;
newEdge.source = newNodeIDFromOldNodeIDMap[start];
newEdge.target = newNodeIDFromOldNodeIDMap[target];
newEdge.data = data;
newEdge.data.originalViaNodeID = true;
BOOST_ASSERT_MSG(
UINT_MAX != newNodeIDFromOldNodeIDMap[start],
"new start id not resolveable"
);
BOOST_ASSERT_MSG(
UINT_MAX != newNodeIDFromOldNodeIDMap[target],
"new target id not resolveable"
);
newSetOfEdges.push_back(newEdge);
}
}
}
//Note the number of temporarily stored edges
tempStorage.seek(temporaryStorageSlotID, initialFilePosition);
tempStorage.writeToSlot(temporaryStorageSlotID, (char*)&numberOfTemporaryEdges, sizeof(unsigned));
//Delete map from old NodeIDs to new ones.
std::vector<NodeID>().swap(newNodeIDFromOldNodeIDMap);
//Replace old priorities array by new one
nodePriority.swap(newNodePriority);
//Delete old nodePriority vector
std::vector<float>().swap(newNodePriority);
//old Graph is removed
_graph.reset();
//create new graph
std::sort(newSetOfEdges.begin(), newSetOfEdges.end());
_graph = boost::make_shared<_DynamicGraph>(remainingNodes.size(), newSetOfEdges);
newSetOfEdges.clear();
flushedContractor = true;
//INFO: MAKE SURE THIS IS THE LAST OPERATION OF THE FLUSH!
//reinitialize heaps and ThreadData objects with appropriate size
for ( unsigned threadNum = 0; threadNum < maxThreads; ++threadNum ) {
threadData.push_back( new _ThreadData( _graph->GetNumberOfNodes() ) );
}
}
const int last = ( int ) remainingNodes.size();
#pragma omp parallel
{
//determine independent node set
_ThreadData* const data = threadData[omp_get_thread_num()];
#pragma omp for schedule ( guided )
for ( int i = 0; i < last; ++i ) {
const NodeID node = remainingNodes[i].id;
remainingNodes[i].isIndependent = _IsIndependent( nodePriority/*, nodeData*/, data, node );
}
}
_NodePartitionor functor;
const std::vector < _RemainingNodeData >::const_iterator first = stable_partition( remainingNodes.begin(), remainingNodes.end(), functor );
const int firstIndependent = first - remainingNodes.begin();
//contract independent nodes
#pragma omp parallel
{
_ThreadData* data = threadData[omp_get_thread_num()];
#pragma omp for schedule ( guided ) nowait
for ( int position = firstIndependent ; position < last; ++position ) {
NodeID x = remainingNodes[position].id;
_Contract< false > ( data, x );
//nodePriority[x] = -1;
}
std::sort( data->insertedEdges.begin(), data->insertedEdges.end() );
}
#pragma omp parallel
{
_ThreadData* data = threadData[omp_get_thread_num()];
#pragma omp for schedule ( guided ) nowait
for ( int position = firstIndependent ; position < last; ++position ) {
NodeID x = remainingNodes[position].id;
_DeleteIncomingEdges( data, x );
}
}
//insert new edges
for ( unsigned threadNum = 0; threadNum < maxThreads; ++threadNum ) {
_ThreadData& data = *threadData[threadNum];
BOOST_FOREACH(const _ContractorEdge& edge, data.insertedEdges) {
_DynamicGraph::EdgeIterator currentEdgeID = _graph->FindEdge(edge.source, edge.target);
if(currentEdgeID < _graph->EndEdges(edge.source) ) {
_DynamicGraph::EdgeData & currentEdgeData = _graph->GetEdgeData(currentEdgeID);
if( currentEdgeData.shortcut
&& edge.data.forward == currentEdgeData.forward
&& edge.data.backward == currentEdgeData.backward ) {
currentEdgeData.distance = std::min(currentEdgeData.distance, edge.data.distance);
continue;
}
}
_graph->InsertEdge( edge.source, edge.target, edge.data );
}
data.insertedEdges.clear();
}
//update priorities
#pragma omp parallel
{
_ThreadData* data = threadData[omp_get_thread_num()];
#pragma omp for schedule ( guided ) nowait
for ( int position = firstIndependent ; position < last; ++position ) {
NodeID x = remainingNodes[position].id;
_UpdateNeighbours( nodePriority, nodeData, data, x );
}
}
//remove contracted nodes from the pool
numberOfContractedNodes += last - firstIndependent;
remainingNodes.resize( firstIndependent );
std::vector< _RemainingNodeData>( remainingNodes ).swap( remainingNodes );
// unsigned maxdegree = 0;
// unsigned avgdegree = 0;
// unsigned mindegree = UINT_MAX;
// unsigned quaddegree = 0;
//
// for(unsigned i = 0; i < remainingNodes.size(); ++i) {
// unsigned degree = _graph->EndEdges(remainingNodes[i].first) - _graph->BeginEdges(remainingNodes[i].first);
// if(degree > maxdegree)
// maxdegree = degree;
// if(degree < mindegree)
// mindegree = degree;
//
// avgdegree += degree;
// quaddegree += (degree*degree);
// }
//
// avgdegree /= std::max((unsigned)1,(unsigned)remainingNodes.size() );
// quaddegree /= std::max((unsigned)1,(unsigned)remainingNodes.size() );
//
// SimpleLogger().Write() << "rest: " << remainingNodes.size() << ", max: " << maxdegree << ", min: " << mindegree << ", avg: " << avgdegree << ", quad: " << quaddegree;
p.printStatus(numberOfContractedNodes);
}
BOOST_FOREACH(_ThreadData * data, threadData) {
delete data;
}
threadData.clear();
}
template< class Edge >
inline void GetEdges( DeallocatingVector< Edge >& edges ) {
Percent p (_graph->GetNumberOfNodes());
SimpleLogger().Write() << "Getting edges of minimized graph";
NodeID numberOfNodes = _graph->GetNumberOfNodes();
if(_graph->GetNumberOfNodes()) {
for ( NodeID node = 0; node < numberOfNodes; ++node ) {
p.printStatus(node);
for ( _DynamicGraph::EdgeIterator edge = _graph->BeginEdges( node ), endEdges = _graph->EndEdges( node ); edge < endEdges; ++edge ) {
const NodeID target = _graph->GetTarget( edge );
const _DynamicGraph::EdgeData& data = _graph->GetEdgeData( edge );
Edge newEdge;
if(0 != oldNodeIDFromNewNodeIDMap.size()) {
newEdge.source = oldNodeIDFromNewNodeIDMap[node];
newEdge.target = oldNodeIDFromNewNodeIDMap[target];
} else {
newEdge.source = node;
newEdge.target = target;
}
BOOST_ASSERT_MSG(
UINT_MAX != newEdge.source,
"Source id invalid"
);
BOOST_ASSERT_MSG(
UINT_MAX != newEdge.target,
"Target id invalid"
);
newEdge.data.distance = data.distance;
newEdge.data.shortcut = data.shortcut;
if(!data.originalViaNodeID && oldNodeIDFromNewNodeIDMap.size()) {
newEdge.data.id = oldNodeIDFromNewNodeIDMap[data.id];
} else {
newEdge.data.id = data.id;
}
BOOST_ASSERT_MSG(
newEdge.data.id != INT_MAX, //2^31
"edge id invalid"
);
newEdge.data.forward = data.forward;
newEdge.data.backward = data.backward;
edges.push_back( newEdge );
}
}
}
_graph.reset();
std::vector<NodeID>().swap(oldNodeIDFromNewNodeIDMap);
TemporaryStorage & tempStorage = TemporaryStorage::GetInstance();
//Also get the edges from temporary storage
unsigned numberOfTemporaryEdges = 0;
tempStorage.readFromSlot(temporaryStorageSlotID, (char*)&numberOfTemporaryEdges, sizeof(unsigned));
//loads edges of graph before renumbering, no need for further numbering action.
NodeID start;
NodeID target;
//edges.reserve(edges.size()+numberOfTemporaryEdges);
_DynamicGraph::EdgeData data;
for(unsigned i = 0; i < numberOfTemporaryEdges; ++i) {
tempStorage.readFromSlot(temporaryStorageSlotID, (char*)&start, sizeof(NodeID));
tempStorage.readFromSlot(temporaryStorageSlotID, (char*)&target, sizeof(NodeID));
tempStorage.readFromSlot(temporaryStorageSlotID, (char*)&data, sizeof(_DynamicGraph::EdgeData));
Edge newEdge;
newEdge.source = start;
newEdge.target = target;
newEdge.data.distance = data.distance;
newEdge.data.shortcut = data.shortcut;
newEdge.data.id = data.id;
newEdge.data.forward = data.forward;
newEdge.data.backward = data.backward;
edges.push_back( newEdge );
}
tempStorage.deallocateSlot(temporaryStorageSlotID);
}
private:
inline void _Dijkstra( const int maxDistance, const unsigned numTargets, const int maxNodes, _ThreadData* const data, const NodeID middleNode ){
_Heap& heap = data->heap;
int nodes = 0;
unsigned targetsFound = 0;
while ( heap.Size() > 0 ) {
const NodeID node = heap.DeleteMin();
const int distance = heap.GetKey( node );
const short currentHop = heap.GetData( node ).hop+1;
if ( ++nodes > maxNodes )
return;
//Destination settled?
if ( distance > maxDistance )
return;
if ( heap.GetData( node ).target ) {
++targetsFound;
if ( targetsFound >= numTargets ) {
return;
}
}
//iterate over all edges of node
for ( _DynamicGraph::EdgeIterator edge = _graph->BeginEdges( node ), endEdges = _graph->EndEdges( node ); edge != endEdges; ++edge ) {
const _ContractorEdgeData& data = _graph->GetEdgeData( edge );
if ( !data.forward ){
continue;
}
const NodeID to = _graph->GetTarget( edge );
if(middleNode == to) {
continue;
}
const int toDistance = distance + data.distance;
//New Node discovered -> Add to Heap + Node Info Storage
if ( !heap.WasInserted( to ) ) {
heap.Insert( to, toDistance, _HeapData(currentHop, false) );
}
//Found a shorter Path -> Update distance
else if ( toDistance < heap.GetKey( to ) ) {
heap.DecreaseKey( to, toDistance );
heap.GetData( to ).hop = currentHop;
}
}
}
}
inline float _Evaluate( _ThreadData* const data, _PriorityData* const nodeData, const NodeID node){
_ContractionInformation stats;
//perform simulated contraction
_Contract< true> ( data, node, &stats );
// Result will contain the priority
float result;
if ( 0 == (stats.edgesDeleted*stats.originalEdgesDeleted) )
result = 1 * nodeData->depth;
else
result = 2 * ((( float ) stats.edgesAdded ) / stats.edgesDeleted ) + 4 * ((( float ) stats.originalEdgesAdded ) / stats.originalEdgesDeleted ) + 1 * nodeData->depth;
assert( result >= 0 );
return result;
}
template< bool Simulate >
inline bool _Contract( _ThreadData* data, NodeID node, _ContractionInformation* stats = NULL ) {
_Heap& heap = data->heap;
int insertedEdgesSize = data->insertedEdges.size();
std::vector< _ContractorEdge >& insertedEdges = data->insertedEdges;
for ( _DynamicGraph::EdgeIterator inEdge = _graph->BeginEdges( node ), endInEdges = _graph->EndEdges( node ); inEdge != endInEdges; ++inEdge ) {
const _ContractorEdgeData& inData = _graph->GetEdgeData( inEdge );
const NodeID source = _graph->GetTarget( inEdge );
if ( Simulate ) {
assert( stats != NULL );
++stats->edgesDeleted;
stats->originalEdgesDeleted += inData.originalEdges;
}
if ( !inData.backward )
continue;
heap.Clear();
heap.Insert( source, 0, _HeapData() );
int maxDistance = 0;
unsigned numTargets = 0;
for ( _DynamicGraph::EdgeIterator outEdge = _graph->BeginEdges( node ), endOutEdges = _graph->EndEdges( node ); outEdge != endOutEdges; ++outEdge ) {
const _ContractorEdgeData& outData = _graph->GetEdgeData( outEdge );
if ( !outData.forward ) {
continue;
}
const NodeID target = _graph->GetTarget( outEdge );
const int pathDistance = inData.distance + outData.distance;
maxDistance = std::max( maxDistance, pathDistance );
if ( !heap.WasInserted( target ) ) {
heap.Insert( target, INT_MAX, _HeapData( 0, true ) );
++numTargets;
}
}
if( Simulate ) {
_Dijkstra( maxDistance, numTargets, 1000, data, node );
} else {
_Dijkstra( maxDistance, numTargets, 2000, data, node );
}
for ( _DynamicGraph::EdgeIterator outEdge = _graph->BeginEdges( node ), endOutEdges = _graph->EndEdges( node ); outEdge != endOutEdges; ++outEdge ) {
const _ContractorEdgeData& outData = _graph->GetEdgeData( outEdge );
if ( !outData.forward ) {
continue;
}
const NodeID target = _graph->GetTarget( outEdge );
const int pathDistance = inData.distance + outData.distance;
const int distance = heap.GetKey( target );
if ( pathDistance < distance ) {
if ( Simulate ) {
assert( stats != NULL );
stats->edgesAdded+=2;
stats->originalEdgesAdded += 2* ( outData.originalEdges + inData.originalEdges );
} else {
_ContractorEdge newEdge;
newEdge.source = source;
newEdge.target = target;
newEdge.data = _ContractorEdgeData( pathDistance, outData.originalEdges + inData.originalEdges, node/*, 0, inData.turnInstruction*/, true, true, false);;
insertedEdges.push_back( newEdge );
std::swap( newEdge.source, newEdge.target );
newEdge.data.forward = false;
newEdge.data.backward = true;
insertedEdges.push_back( newEdge );
}
}
}
}
if ( !Simulate ) {
for ( int i = insertedEdgesSize, iend = insertedEdges.size(); i < iend; ++i ) {
bool found = false;
for ( int other = i + 1 ; other < iend ; ++other ) {
if ( insertedEdges[other].source != insertedEdges[i].source )
continue;
if ( insertedEdges[other].target != insertedEdges[i].target )
continue;
if ( insertedEdges[other].data.distance != insertedEdges[i].data.distance )
continue;
if ( insertedEdges[other].data.shortcut != insertedEdges[i].data.shortcut )
continue;
insertedEdges[other].data.forward |= insertedEdges[i].data.forward;
insertedEdges[other].data.backward |= insertedEdges[i].data.backward;
found = true;
break;
}
if ( !found ) {
insertedEdges[insertedEdgesSize++] = insertedEdges[i];
}
}
insertedEdges.resize( insertedEdgesSize );
}
return true;
}
inline void _DeleteIncomingEdges( _ThreadData* data, const NodeID node ) {
std::vector< NodeID >& neighbours = data->neighbours;
neighbours.clear();
//find all neighbours
for ( _DynamicGraph::EdgeIterator e = _graph->BeginEdges( node ) ; e < _graph->EndEdges( node ) ; ++e ) {
const NodeID u = _graph->GetTarget( e );
if ( u != node )
neighbours.push_back( u );
}
//eliminate duplicate entries ( forward + backward edges )
std::sort( neighbours.begin(), neighbours.end() );
neighbours.resize( std::unique( neighbours.begin(), neighbours.end() ) - neighbours.begin() );
for ( int i = 0, e = ( int ) neighbours.size(); i < e; ++i ) {
_graph->DeleteEdgesTo( neighbours[i], node );
}
}
inline bool _UpdateNeighbours( std::vector< float > & priorities, std::vector< _PriorityData > & nodeData, _ThreadData* const data, const NodeID node) {
std::vector< NodeID >& neighbours = data->neighbours;
neighbours.clear();
//find all neighbours
for ( _DynamicGraph::EdgeIterator e = _graph->BeginEdges( node ), endEdges = _graph->EndEdges( node ) ; e < endEdges ; ++e ) {
const NodeID u = _graph->GetTarget( e );
if ( u == node )
continue;
neighbours.push_back( u );
nodeData[u].depth = (std::max)(nodeData[node].depth + 1, nodeData[u].depth );
}
//eliminate duplicate entries ( forward + backward edges )
std::sort( neighbours.begin(), neighbours.end() );
neighbours.resize( std::unique( neighbours.begin(), neighbours.end() ) - neighbours.begin() );
BOOST_FOREACH(const NodeID u, neighbours) {
priorities[u] = _Evaluate( data, &( nodeData )[u], u );
}
return true;
}
inline bool _IsIndependent( const std::vector< float >& priorities/*, const std::vector< _PriorityData >& nodeData*/, _ThreadData* const data, NodeID node ) const {
const double priority = priorities[node];
std::vector< NodeID >& neighbours = data->neighbours;
neighbours.clear();
for ( _DynamicGraph::EdgeIterator e = _graph->BeginEdges( node ) ; e < _graph->EndEdges( node ) ; ++e ) {
const NodeID target = _graph->GetTarget( e );
if(node==target)
continue;
const double targetPriority = priorities[target];
assert( targetPriority >= 0 );
//found a neighbour with lower priority?
if ( priority > targetPriority )
return false;
//tie breaking
if ( fabs(priority - targetPriority) < std::numeric_limits<double>::epsilon() && bias(node, target) ) {
return false;
}
neighbours.push_back( target );
}
std::sort( neighbours.begin(), neighbours.end() );
neighbours.resize( std::unique( neighbours.begin(), neighbours.end() ) - neighbours.begin() );
//examine all neighbours that are at most 2 hops away
BOOST_FOREACH(const NodeID u, neighbours) {
for ( _DynamicGraph::EdgeIterator e = _graph->BeginEdges( u ) ; e < _graph->EndEdges( u ) ; ++e ) {
const NodeID target = _graph->GetTarget( e );
if(node==target)
continue;
const double targetPriority = priorities[target];
assert( targetPriority >= 0 );
//found a neighbour with lower priority?
if ( priority > targetPriority)
return false;
//tie breaking
if ( fabs(priority - targetPriority) < std::numeric_limits<double>::epsilon() && bias(node, target) ) {
return false;
}
}
}
return true;
}
/**
* This bias function takes up 22 assembly instructions in total on X86
*/
inline bool bias(const NodeID a, const NodeID b) const {
unsigned short hasha = fastHash(a);
unsigned short hashb = fastHash(b);
//The compiler optimizes that to conditional register flags but without branching statements!
if(hasha != hashb)
return hasha < hashb;
return a < b;
}
boost::shared_ptr<_DynamicGraph> _graph;
std::vector<_DynamicGraph::InputEdge> contractedEdges;
unsigned temporaryStorageSlotID;
std::vector<NodeID> oldNodeIDFromNewNodeIDMap;
XORFastHash fastHash;
};
#endif // CONTRACTOR_H_INCLUDED
-578
View File
@@ -1,578 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "EdgeBasedGraphFactory.h"
EdgeBasedGraphFactory::EdgeBasedGraphFactory(
int number_of_nodes,
std::vector<ImportEdge> & input_edge_list,
std::vector<NodeID> & barrier_node_list,
std::vector<NodeID> & traffic_light_node_list,
std::vector<TurnRestriction> & input_restrictions_list,
std::vector<NodeInfo> & m_node_info_list,
SpeedProfileProperties speed_profile
) : speed_profile(speed_profile),
m_turn_restrictions_count(0),
m_node_info_list(m_node_info_list)
{
BOOST_FOREACH(const TurnRestriction & restriction, input_restrictions_list) {
std::pair<NodeID, NodeID> restriction_source =
std::make_pair(restriction.fromNode, restriction.viaNode);
unsigned index;
RestrictionMap::iterator restriction_iter = m_restriction_map.find(restriction_source);
if(restriction_iter == m_restriction_map.end()) {
index = m_restriction_bucket_list.size();
m_restriction_bucket_list.resize(index+1);
m_restriction_map.emplace(restriction_source, index);
} else {
index = restriction_iter->second;
//Map already contains an is_only_*-restriction
if(m_restriction_bucket_list.at(index).begin()->second) {
continue;
} else if(restriction.flags.isOnly) {
//We are going to insert an is_only_*-restriction. There can be only one.
m_turn_restrictions_count -= m_restriction_bucket_list.at(index).size();
m_restriction_bucket_list.at(index).clear();
}
}
++m_turn_restrictions_count;
m_restriction_bucket_list.at(index).push_back(
std::make_pair( restriction.toNode, restriction.flags.isOnly)
);
}
m_barrier_nodes.insert(
barrier_node_list.begin(),
barrier_node_list.end()
);
m_traffic_lights.insert(
traffic_light_node_list.begin(),
traffic_light_node_list.end()
);
DeallocatingVector< NodeBasedEdge > edges_list;
NodeBasedEdge edge;
BOOST_FOREACH(const ImportEdge & import_edge, input_edge_list) {
if(!import_edge.isForward()) {
edge.source = import_edge.target();
edge.target = import_edge.source();
edge.data.backward = import_edge.isForward();
edge.data.forward = import_edge.isBackward();
} else {
edge.source = import_edge.source();
edge.target = import_edge.target();
edge.data.forward = import_edge.isForward();
edge.data.backward = import_edge.isBackward();
}
if(edge.source == edge.target) {
continue;
}
edge.data.distance = (std::max)((int)import_edge.weight(), 1 );
assert( edge.data.distance > 0 );
edge.data.shortcut = false;
edge.data.roundabout = import_edge.isRoundabout();
edge.data.ignoreInGrid = import_edge.ignoreInGrid();
edge.data.nameID = import_edge.name();
edge.data.type = import_edge.type();
edge.data.isAccessRestricted = import_edge.isAccessRestricted();
edge.data.edgeBasedNodeID = edges_list.size();
edge.data.contraFlow = import_edge.isContraFlow();
edges_list.push_back( edge );
if( edge.data.backward ) {
std::swap( edge.source, edge.target );
edge.data.forward = import_edge.isBackward();
edge.data.backward = import_edge.isForward();
edge.data.edgeBasedNodeID = edges_list.size();
edges_list.push_back( edge );
}
}
std::vector<ImportEdge>().swap(input_edge_list);
std::sort( edges_list.begin(), edges_list.end() );
m_node_based_graph = boost::make_shared<NodeBasedDynamicGraph>(
number_of_nodes, edges_list
);
}
void EdgeBasedGraphFactory::GetEdgeBasedEdges(
DeallocatingVector< EdgeBasedEdge >& output_edge_list
) {
BOOST_ASSERT_MSG(
0 == output_edge_list.size(),
"Vector is not empty"
);
m_edge_based_edge_list.swap(output_edge_list);
}
void EdgeBasedGraphFactory::GetEdgeBasedNodes( std::vector<EdgeBasedNode> & nodes) {
#ifndef NDEBUG
BOOST_FOREACH(const EdgeBasedNode & node, m_edge_based_node_list){
assert(node.lat1 != INT_MAX); assert(node.lon1 != INT_MAX);
assert(node.lat2 != INT_MAX); assert(node.lon2 != INT_MAX);
}
#endif
nodes.swap(m_edge_based_node_list);
}
NodeID EdgeBasedGraphFactory::CheckForEmanatingIsOnlyTurn(
const NodeID u,
const NodeID v
) const {
const std::pair < NodeID, NodeID > restriction_source = std::make_pair(u, v);
RestrictionMap::const_iterator restriction_iter = m_restriction_map.find(restriction_source);
if (restriction_iter != m_restriction_map.end()) {
const unsigned index = restriction_iter->second;
BOOST_FOREACH(
const RestrictionSource & restriction_target,
m_restriction_bucket_list.at(index)
) {
if(restriction_target.second) {
return restriction_target.first;
}
}
}
return UINT_MAX;
}
bool EdgeBasedGraphFactory::CheckIfTurnIsRestricted(
const NodeID u,
const NodeID v,
const NodeID w
) const {
//only add an edge if turn is not a U-turn except it is the end of dead-end street.
const std::pair < NodeID, NodeID > restriction_source = std::make_pair(u, v);
RestrictionMap::const_iterator restriction_iter = m_restriction_map.find(restriction_source);
if (restriction_iter != m_restriction_map.end()) {
const unsigned index = restriction_iter->second;
BOOST_FOREACH(
const RestrictionTarget & restriction_target,
m_restriction_bucket_list.at(index)
) {
if(w == restriction_target.first) {
return true;
}
}
}
return false;
}
void EdgeBasedGraphFactory::InsertEdgeBasedNode(
EdgeIterator e1,
NodeIterator u,
NodeIterator v,
bool belongsToTinyComponent) {
EdgeData & data = m_node_based_graph->GetEdgeData(e1);
EdgeBasedNode currentNode;
currentNode.nameID = data.nameID;
currentNode.lat1 = m_node_info_list[u].lat;
currentNode.lon1 = m_node_info_list[u].lon;
currentNode.lat2 = m_node_info_list[v].lat;
currentNode.lon2 = m_node_info_list[v].lon;
currentNode.belongsToTinyComponent = belongsToTinyComponent;
currentNode.id = data.edgeBasedNodeID;
currentNode.ignoreInGrid = data.ignoreInGrid;
currentNode.weight = data.distance;
m_edge_based_node_list.push_back(currentNode);
}
void EdgeBasedGraphFactory::Run(
const char * original_edge_data_filename,
lua_State *lua_state
) {
SimpleLogger().Write() << "Identifying components of the road network";
Percent p(m_node_based_graph->GetNumberOfNodes());
unsigned skipped_turns_counter = 0;
unsigned node_based_edge_counter = 0;
unsigned original_edges_counter = 0;
std::ofstream edge_data_file(
original_edge_data_filename,
std::ios::binary
);
//writes a dummy value that is updated later
edge_data_file.write(
(char*)&original_edges_counter,
sizeof(unsigned)
);
unsigned current_component = 0, current_component_size = 0;
//Run a BFS on the undirected graph and identify small components
std::queue<std::pair<NodeID, NodeID> > bfs_queue;
std::vector<unsigned> component_index_list(
m_node_based_graph->GetNumberOfNodes(),
UINT_MAX
);
std::vector<NodeID> component_size_list;
//put unexplorered node with parent pointer into queue
for(
NodeID node = 0,
last_node = m_node_based_graph->GetNumberOfNodes();
node < last_node;
++node
) {
if(UINT_MAX == component_index_list[node]) {
bfs_queue.push(std::make_pair(node, node));
//mark node as read
component_index_list[node] = current_component;
p.printIncrement();
while(!bfs_queue.empty()) {
//fetch element from BFS queue
std::pair<NodeID, NodeID> current_queue_item = bfs_queue.front();
bfs_queue.pop();
// SimpleLogger().Write() << "sizeof queue: " << bfs_queue.size() <<
// ", current_component_sizes: " << current_component_size <<
//", settled nodes: " << settledNodes++ << ", max: " << endNodes;
const NodeID v = current_queue_item.first; //current node
const NodeID u = current_queue_item.second; //parent
//increment size counter of current component
++current_component_size;
const bool is_barrier_node = (m_barrier_nodes.find(v) != m_barrier_nodes.end());
if(!is_barrier_node) {
const NodeID to_node_of_only_restriction = CheckForEmanatingIsOnlyTurn(u, v);
//relaxieren edge outgoing edge like below where edge-expanded graph
for(
EdgeIterator e2 = m_node_based_graph->BeginEdges(v);
e2 < m_node_based_graph->EndEdges(v);
++e2
) {
NodeIterator w = m_node_based_graph->GetTarget(e2);
if(
to_node_of_only_restriction != UINT_MAX &&
w != to_node_of_only_restriction
) {
//We are at an only_-restriction but not at the right turn.
continue;
}
if( u != w ) {
//only add an edge if turn is not a U-turn except
//when it is at the end of a dead-end street.
if (!CheckIfTurnIsRestricted(u, v, w) ) {
//only add an edge if turn is not prohibited
if(UINT_MAX == component_index_list[w]) {
//insert next (node, parent) only if w has
//not yet been explored
//mark node as read
component_index_list[w] = current_component;
bfs_queue.push(std::make_pair(w,v));
p.printIncrement();
}
}
}
}
}
}
//push size into vector
component_size_list.push_back(current_component_size);
//reset counters;
current_component_size = 0;
++current_component;
}
}
SimpleLogger().Write() <<
"identified: " << component_size_list.size() << " many components";
SimpleLogger().Write() <<
"generating edge-expanded nodes";
p.reinit(m_node_based_graph->GetNumberOfNodes());
//loop over all edges and generate new set of nodes.
for(
NodeIterator u = 0,
number_of_nodes = m_node_based_graph->GetNumberOfNodes();
u < number_of_nodes;
++u
) {
p.printIncrement();
for(
EdgeIterator e1 = m_node_based_graph->BeginEdges(u),
last_edge = m_node_based_graph->EndEdges(u);
e1 < last_edge;
++e1
) {
NodeIterator v = m_node_based_graph->GetTarget(e1);
if(m_node_based_graph->GetEdgeData(e1).type != SHRT_MAX) {
BOOST_ASSERT_MSG(e1 != UINT_MAX, "edge id invalid");
BOOST_ASSERT_MSG(u != UINT_MAX, "souce node invalid");
BOOST_ASSERT_MSG(v != UINT_MAX, "target node invalid");
//Note: edges that end on barrier nodes or on a turn restriction
//may actually be in two distinct components. We choose the smallest
const unsigned size_of_component = std::min(
component_size_list[component_index_list[u]],
component_size_list[component_index_list[v]]
);
InsertEdgeBasedNode( e1, u, v, size_of_component < 1000 );
}
}
}
SimpleLogger().Write()
<< "Generated " << m_edge_based_node_list.size() << " nodes in " <<
"edge-expanded graph";
SimpleLogger().Write() <<
"generating edge-expanded edges";
std::vector<NodeID>().swap(component_size_list);
BOOST_ASSERT_MSG(
0 == component_size_list.capacity(),
"component size vector not deallocated"
);
std::vector<NodeID>().swap(component_index_list);
BOOST_ASSERT_MSG(
0 == component_index_list.capacity(),
"component index vector not deallocated"
);
std::vector<OriginalEdgeData> original_edge_data_vector;
original_edge_data_vector.reserve(10000);
//Loop over all turns and generate new set of edges.
//Three nested loop look super-linear, but we are dealing with a (kind of)
//linear number of turns only.
p.reinit(m_node_based_graph->GetNumberOfNodes());
for(
NodeIterator u = 0,
last_node = m_node_based_graph->GetNumberOfNodes();
u < last_node;
++u
) {
for(
EdgeIterator e1 = m_node_based_graph->BeginEdges(u),
last_edge_u = m_node_based_graph->EndEdges(u);
e1 < last_edge_u;
++e1
) {
++node_based_edge_counter;
NodeIterator v = m_node_based_graph->GetTarget(e1);
bool is_barrier_node = (m_barrier_nodes.find(v) != m_barrier_nodes.end());
NodeID to_node_of_only_restriction = CheckForEmanatingIsOnlyTurn(u, v);
for(
EdgeIterator e2 = m_node_based_graph->BeginEdges(v),
last_edge_v = m_node_based_graph->EndEdges(v);
e2 < last_edge_v;
++e2
) {
const NodeIterator w = m_node_based_graph->GetTarget(e2);
if(
to_node_of_only_restriction != UINT_MAX &&
w != to_node_of_only_restriction
) {
//We are at an only_-restriction but not at the right turn.
++skipped_turns_counter;
continue;
}
if(u == w && 1 != m_node_based_graph->GetOutDegree(v) ) {
continue;
}
if( !is_barrier_node ) {
//only add an edge if turn is not a U-turn except when it is
//at the end of a dead-end street
if (
!CheckIfTurnIsRestricted(u, v, w) ||
(to_node_of_only_restriction != UINT_MAX && w == to_node_of_only_restriction)
) { //only add an edge if turn is not prohibited
const EdgeData edge_data1 = m_node_based_graph->GetEdgeData(e1);
const EdgeData edge_data2 = m_node_based_graph->GetEdgeData(e2);
assert(edge_data1.edgeBasedNodeID < m_node_based_graph->GetNumberOfEdges());
assert(edge_data2.edgeBasedNodeID < m_node_based_graph->GetNumberOfEdges());
if(!edge_data1.forward || !edge_data2.forward) {
continue;
}
unsigned distance = edge_data1.distance;
if(m_traffic_lights.find(v) != m_traffic_lights.end()) {
distance += speed_profile.trafficSignalPenalty;
}
const unsigned penalty =
GetTurnPenalty(u, v, w, lua_state);
TurnInstruction turnInstruction = AnalyzeTurn(u, v, w);
if(turnInstruction == TurnInstructions.UTurn){
distance += speed_profile.uTurnPenalty;
}
distance += penalty;
assert(edge_data1.edgeBasedNodeID != edge_data2.edgeBasedNodeID);
original_edge_data_vector.push_back(
OriginalEdgeData(
v,
edge_data2.nameID,
turnInstruction
)
);
++original_edges_counter;
if(original_edge_data_vector.size() > 100000) {
edge_data_file.write(
(char*)&(original_edge_data_vector[0]),
original_edge_data_vector.size()*sizeof(OriginalEdgeData)
);
original_edge_data_vector.clear();
}
m_edge_based_edge_list.push_back(
EdgeBasedEdge(
edge_data1.edgeBasedNodeID,
edge_data2.edgeBasedNodeID,
m_edge_based_edge_list.size(),
distance,
true,
false
)
);
} else {
++skipped_turns_counter;
}
}
}
}
p.printIncrement();
}
edge_data_file.write(
(char*)&(original_edge_data_vector[0]),
original_edge_data_vector.size()*sizeof(OriginalEdgeData)
);
edge_data_file.seekp(std::ios::beg);
edge_data_file.write(
(char*)&original_edges_counter,
sizeof(unsigned)
);
edge_data_file.close();
SimpleLogger().Write() <<
"Generated " << m_edge_based_node_list.size() << " edge based nodes";
SimpleLogger().Write() <<
"Node-based graph contains " << node_based_edge_counter << " edges";
SimpleLogger().Write() <<
"Edge-expanded graph ...";
SimpleLogger().Write() <<
" contains " << m_edge_based_edge_list.size() << " edges";
SimpleLogger().Write() <<
" skips " << skipped_turns_counter << " turns, "
"defined by " << m_turn_restrictions_count << " restrictions";
}
int EdgeBasedGraphFactory::GetTurnPenalty(
const NodeID u,
const NodeID v,
const NodeID w,
lua_State *lua_state
) const {
const double angle = GetAngleBetweenThreeFixedPointCoordinates (
m_node_info_list[u],
m_node_info_list[v],
m_node_info_list[w]
);
if( speed_profile.has_turn_penalty_function ) {
try {
//call lua profile to compute turn penalty
return luabind::call_function<int>(
lua_state,
"turn_function",
180.-angle
);
} catch (const luabind::error &er) {
SimpleLogger().Write(logWARNING) << er.what();
}
}
return 0;
}
TurnInstruction EdgeBasedGraphFactory::AnalyzeTurn(
const NodeID u,
const NodeID v,
const NodeID w
) const {
if(u == w) {
return TurnInstructions.UTurn;
}
EdgeIterator edge1 = m_node_based_graph->FindEdge(u, v);
EdgeIterator edge2 = m_node_based_graph->FindEdge(v, w);
EdgeData & data1 = m_node_based_graph->GetEdgeData(edge1);
EdgeData & data2 = m_node_based_graph->GetEdgeData(edge2);
if(!data1.contraFlow && data2.contraFlow) {
return TurnInstructions.EnterAgainstAllowedDirection;
}
if(data1.contraFlow && !data2.contraFlow) {
return TurnInstructions.LeaveAgainstAllowedDirection;
}
//roundabouts need to be handled explicitely
if(data1.roundabout && data2.roundabout) {
//Is a turn possible? If yes, we stay on the roundabout!
if( 1 == m_node_based_graph->GetOutDegree(v) ) {
//No turn possible.
return TurnInstructions.NoTurn;
}
return TurnInstructions.StayOnRoundAbout;
}
//Does turn start or end on roundabout?
if(data1.roundabout || data2.roundabout) {
//We are entering the roundabout
if( (!data1.roundabout) && data2.roundabout) {
return TurnInstructions.EnterRoundAbout;
}
//We are leaving the roundabout
if(data1.roundabout && (!data2.roundabout) ) {
return TurnInstructions.LeaveRoundAbout;
}
}
//If street names stay the same and if we are certain that it is not a
//a segment of a roundabout, we skip it.
if( data1.nameID == data2.nameID ) {
//TODO: Here we should also do a small graph exploration to check for
// more complex situations
if( 0 != data1.nameID ) {
return TurnInstructions.NoTurn;
} else if (m_node_based_graph->GetOutDegree(v) <= 2) {
return TurnInstructions.NoTurn;
}
}
const double angle = GetAngleBetweenThreeFixedPointCoordinates (
m_node_info_list[u],
m_node_info_list[v],
m_node_info_list[w]
);
return TurnInstructions.GetTurnDirectionOfInstruction(angle);
}
unsigned EdgeBasedGraphFactory::GetNumberOfNodes() const {
return m_node_based_graph->GetNumberOfEdges();
}
-166
View File
@@ -1,166 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// This class constructs the edge-expanded routing graph
#ifndef EDGEBASEDGRAPHFACTORY_H_
#define EDGEBASEDGRAPHFACTORY_H_
#include "../typedefs.h"
#include "../DataStructures/DeallocatingVector.h"
#include "../DataStructures/DynamicGraph.h"
#include "../DataStructures/EdgeBasedNode.h"
#include "../Extractor/ExtractorStructs.h"
#include "../DataStructures/HashTable.h"
#include "../DataStructures/ImportEdge.h"
#include "../DataStructures/QueryEdge.h"
#include "../DataStructures/Percent.h"
#include "../DataStructures/TurnInstructions.h"
#include "../Util/LuaUtil.h"
#include "../Util/SimpleLogger.h"
#include <boost/foreach.hpp>
#include <boost/make_shared.hpp>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#include <algorithm>
#include <fstream>
#include <queue>
#include <vector>
class EdgeBasedGraphFactory : boost::noncopyable {
public:
struct SpeedProfileProperties{
SpeedProfileProperties() :
trafficSignalPenalty(0),
uTurnPenalty(0),
has_turn_penalty_function(false)
{ }
int trafficSignalPenalty;
int uTurnPenalty;
bool has_turn_penalty_function;
} speed_profile;
explicit EdgeBasedGraphFactory(
int number_of_nodes,
std::vector<ImportEdge> & input_edge_list,
std::vector<NodeID> & barrier_node_list,
std::vector<NodeID> & traffic_light_node_list,
std::vector<TurnRestriction> & input_restrictions_list,
std::vector<NodeInfo> & m_node_info_list,
SpeedProfileProperties speed_profile
);
void Run(const char * originalEdgeDataFilename, lua_State *myLuaState);
void GetEdgeBasedEdges( DeallocatingVector< EdgeBasedEdge >& edges );
void GetEdgeBasedNodes( std::vector< EdgeBasedNode> & nodes);
void GetOriginalEdgeData( std::vector<OriginalEdgeData> & originalEdgeData);
TurnInstruction AnalyzeTurn(
const NodeID u,
const NodeID v,
const NodeID w
) const;
int GetTurnPenalty(
const NodeID u,
const NodeID v,
const NodeID w,
lua_State *myLuaState
) const;
unsigned GetNumberOfNodes() const;
private:
struct NodeBasedEdgeData {
int distance;
unsigned edgeBasedNodeID;
unsigned nameID;
short type;
bool isAccessRestricted:1;
bool shortcut:1;
bool forward:1;
bool backward:1;
bool roundabout:1;
bool ignoreInGrid:1;
bool contraFlow:1;
};
struct _EdgeBasedEdgeData {
int distance;
unsigned via;
unsigned nameID;
bool forward;
bool backward;
TurnInstruction turnInstruction;
};
unsigned m_turn_restrictions_count;
typedef DynamicGraph<NodeBasedEdgeData> NodeBasedDynamicGraph;
typedef NodeBasedDynamicGraph::InputEdge NodeBasedEdge;
typedef NodeBasedDynamicGraph::NodeIterator NodeIterator;
typedef NodeBasedDynamicGraph::EdgeIterator EdgeIterator;
typedef NodeBasedDynamicGraph::EdgeData EdgeData;
typedef std::pair<NodeID, NodeID> RestrictionSource;
typedef std::pair<NodeID, bool> RestrictionTarget;
typedef std::vector<RestrictionTarget> EmanatingRestrictionsVector;
typedef boost::unordered_map<RestrictionSource, unsigned > RestrictionMap;
std::vector<NodeInfo> m_node_info_list;
std::vector<EmanatingRestrictionsVector> m_restriction_bucket_list;
std::vector<EdgeBasedNode> m_edge_based_node_list;
DeallocatingVector<EdgeBasedEdge> m_edge_based_edge_list;
boost::shared_ptr<NodeBasedDynamicGraph> m_node_based_graph;
boost::unordered_set<NodeID> m_barrier_nodes;
boost::unordered_set<NodeID> m_traffic_lights;
RestrictionMap m_restriction_map;
NodeID CheckForEmanatingIsOnlyTurn(
const NodeID u,
const NodeID v
) const;
bool CheckIfTurnIsRestricted(
const NodeID u,
const NodeID v,
const NodeID w
) const;
void InsertEdgeBasedNode(
NodeBasedDynamicGraph::EdgeIterator e1,
NodeBasedDynamicGraph::NodeIterator u,
NodeBasedDynamicGraph::NodeIterator v,
bool belongsToTinyComponent);
};
#endif /* EDGEBASEDGRAPHFACTORY_H_ */
-140
View File
@@ -1,140 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "TemporaryStorage.h"
TemporaryStorage::TemporaryStorage() {
tempDirectory = boost::filesystem::temp_directory_path();
}
TemporaryStorage & TemporaryStorage::GetInstance(){
static TemporaryStorage runningInstance;
return runningInstance;
}
TemporaryStorage::~TemporaryStorage() {
removeAll();
}
void TemporaryStorage::removeAll() {
boost::mutex::scoped_lock lock(mutex);
for(unsigned slot_id = 0; slot_id < vectorOfStreamDatas.size(); ++slot_id) {
deallocateSlot(slot_id);
}
vectorOfStreamDatas.clear();
}
int TemporaryStorage::allocateSlot() {
boost::mutex::scoped_lock lock(mutex);
try {
vectorOfStreamDatas.push_back(StreamData());
//SimpleLogger().Write() << "created new temporary file: " << vectorOfStreamDatas.back().pathToTemporaryFile;
} catch(boost::filesystem::filesystem_error & e) {
abort(e);
}
return vectorOfStreamDatas.size() - 1;
}
void TemporaryStorage::deallocateSlot(int slotID) {
try {
StreamData & data = vectorOfStreamDatas[slotID];
boost::mutex::scoped_lock lock(*data.readWriteMutex);
if(!boost::filesystem::exists(data.pathToTemporaryFile)) {
return;
}
if(data.streamToTemporaryFile->is_open()) {
data.streamToTemporaryFile->close();
}
boost::filesystem::remove(data.pathToTemporaryFile);
} catch(boost::filesystem::filesystem_error & e) {
abort(e);
}
}
void TemporaryStorage::writeToSlot(int slotID, char * pointer, std::streamsize size) {
try {
StreamData & data = vectorOfStreamDatas[slotID];
boost::mutex::scoped_lock lock(*data.readWriteMutex);
BOOST_ASSERT_MSG(
data.writeMode,
"Writing after first read is not allowed"
);
data.streamToTemporaryFile->write(pointer, size);
} catch(boost::filesystem::filesystem_error & e) {
abort(e);
}
}
void TemporaryStorage::readFromSlot(int slotID, char * pointer, std::streamsize size) {
try {
StreamData & data = vectorOfStreamDatas[slotID];
boost::mutex::scoped_lock lock(*data.readWriteMutex);
if(data.writeMode) {
data.writeMode = false;
data.streamToTemporaryFile->seekg(0, data.streamToTemporaryFile->beg);
}
data.streamToTemporaryFile->read(pointer, size);
} catch(boost::filesystem::filesystem_error & e) {
abort(e);
}
}
unsigned TemporaryStorage::getFreeBytesOnTemporaryDevice() {
boost::filesystem::space_info tempSpaceInfo;
try {
tempSpaceInfo = boost::filesystem::space(tempDirectory);
} catch(boost::filesystem::filesystem_error & e) {
abort(e);
}
return tempSpaceInfo.available;
}
boost::filesystem::fstream::pos_type TemporaryStorage::tell(int slotID) {
boost::filesystem::fstream::pos_type position;
try {
StreamData & data = vectorOfStreamDatas[slotID];
boost::mutex::scoped_lock lock(*data.readWriteMutex);
position = data.streamToTemporaryFile->tellp();
} catch(boost::filesystem::filesystem_error & e) {
abort(e);
}
return position;
}
void TemporaryStorage::abort(boost::filesystem::filesystem_error& ) {
removeAll();
}
void TemporaryStorage::seek(int slotID, boost::filesystem::fstream::pos_type position) {
try {
StreamData & data = vectorOfStreamDatas[slotID];
boost::mutex::scoped_lock lock(*data.readWriteMutex);
data.streamToTemporaryFile->seekg(position);
} catch(boost::filesystem::filesystem_error & e) {
abort(e);
}
}
-125
View File
@@ -1,125 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef TEMPORARYSTORAGE_H_
#define TEMPORARYSTORAGE_H_
#include <vector>
#include <fstream>
#include <boost/assert.hpp>
#include <boost/foreach.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread/mutex.hpp>
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
#include "../typedefs.h"
//This is one big workaround for latest boost renaming woes.
#if BOOST_FILESYSTEM_VERSION < 3
#warning Boost Installation with Filesystem3 missing, activating workaround
#include <cstdio>
namespace boost {
namespace filesystem {
inline path temp_directory_path() {
char * buffer;
buffer = tmpnam (NULL);
return path(buffer);
}
inline path unique_path(const path&) {
return temp_directory_path();
}
}
}
#endif
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 3
#endif
/**
* This class implements a singleton file storage for temporary data.
* temporary slots can be accessed by other objects through an int
* On deallocation every slot gets deallocated
*
* Access is sequential, which means, that there is no random access
* -> Data is written in first phase and reread in second.
*/
static boost::filesystem::path tempDirectory;
static std::string TemporaryFilePattern("OSRM-%%%%-%%%%-%%%%");
class TemporaryStorage {
public:
static TemporaryStorage & GetInstance();
virtual ~TemporaryStorage();
int allocateSlot();
void deallocateSlot(int slotID);
void writeToSlot(int slotID, char * pointer, std::streamsize size);
void readFromSlot(int slotID, char * pointer, std::streamsize size);
//returns the number of free bytes
unsigned getFreeBytesOnTemporaryDevice();
boost::filesystem::fstream::pos_type tell(int slotID);
void seek(int slotID, boost::filesystem::fstream::pos_type);
void removeAll();
private:
TemporaryStorage();
TemporaryStorage(TemporaryStorage const &){};
TemporaryStorage& operator=(TemporaryStorage const &) {
return *this;
}
void abort(boost::filesystem::filesystem_error& e);
struct StreamData {
bool writeMode;
boost::filesystem::path pathToTemporaryFile;
boost::shared_ptr<boost::filesystem::fstream> streamToTemporaryFile;
boost::shared_ptr<boost::mutex> readWriteMutex;
StreamData() :
writeMode(true),
pathToTemporaryFile (boost::filesystem::unique_path(tempDirectory.append(TemporaryFilePattern.begin(), TemporaryFilePattern.end()))),
streamToTemporaryFile(new boost::filesystem::fstream(pathToTemporaryFile, std::ios::in | std::ios::out | std::ios::trunc | std::ios::binary)),
readWriteMutex(new boost::mutex)
{
if(streamToTemporaryFile->fail()) {
throw OSRMException("temporary file could not be created");
}
}
};
//vector of file streams that is used to store temporary data
std::vector<StreamData> vectorOfStreamDatas;
boost::mutex mutex;
};
#endif /* TEMPORARYSTORAGE_H_ */
-280
View File
@@ -1,280 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BINARYHEAP_H_INCLUDED
#define BINARYHEAP_H_INCLUDED
//Not compatible with non contiguous node ids
#include <boost/unordered_map.hpp>
#include <boost/assert.hpp>
#include <algorithm>
#include <limits>
#include <map>
#include <vector>
template< typename NodeID, typename Key >
class ArrayStorage {
public:
ArrayStorage( size_t size ) : positions( new Key[size] ) {
memset(positions, 0, size*sizeof(Key));
}
~ArrayStorage() {
delete[] positions;
}
Key &operator[]( NodeID node ) {
return positions[node];
}
void Clear() {}
private:
Key* positions;
};
template< typename NodeID, typename Key >
class MapStorage {
public:
MapStorage( size_t ) {}
Key &operator[]( NodeID node ) {
return nodes[node];
}
void Clear() {
nodes.clear();
}
private:
std::map< NodeID, Key > nodes;
};
template< typename NodeID, typename Key >
class UnorderedMapStorage {
public:
UnorderedMapStorage( size_t ) {
//hash table gets 1000 Buckets
nodes.rehash(1000);
}
Key &operator[]( const NodeID node ) {
return nodes[node];
}
void Clear() {
nodes.clear();
}
private:
boost::unordered_map< NodeID, Key > nodes;
};
template<typename NodeID = unsigned>
struct _SimpleHeapData {
NodeID parent;
_SimpleHeapData( NodeID p ) : parent(p) { }
};
template < typename NodeID, typename Key, typename Weight, typename Data, typename IndexStorage = ArrayStorage<NodeID, NodeID> >
class BinaryHeap {
private:
BinaryHeap( const BinaryHeap& right );
void operator=( const BinaryHeap& right );
public:
typedef Weight WeightType;
typedef Data DataType;
BinaryHeap( size_t maxID )
: nodeIndex( maxID ) {
Clear();
}
void Clear() {
heap.resize( 1 );
insertedNodes.clear();
heap[0].weight = std::numeric_limits< Weight >::min();
nodeIndex.Clear();
}
Key Size() const {
return static_cast<Key>( heap.size() - 1 );
}
bool Empty() const {
return 0 == Size();
}
void Insert( NodeID node, Weight weight, const Data &data ) {
HeapElement element;
element.index = static_cast<NodeID>(insertedNodes.size());
element.weight = weight;
const Key key = static_cast<Key>(heap.size());
heap.push_back( element );
insertedNodes.push_back( HeapNode( node, key, weight, data ) );
nodeIndex[node] = element.index;
Upheap( key );
CheckHeap();
}
Data& GetData( NodeID node ) {
const Key index = nodeIndex[node];
return insertedNodes[index].data;
}
Weight& GetKey( NodeID node ) {
const Key index = nodeIndex[node];
return insertedNodes[index].weight;
}
bool WasRemoved( const NodeID node ) {
BOOST_ASSERT( WasInserted( node ) );
const Key index = nodeIndex[node];
return insertedNodes[index].key == 0;
}
bool WasInserted( const NodeID node ) {
const Key index = nodeIndex[node];
if ( index >= static_cast<Key> (insertedNodes.size()) )
return false;
return insertedNodes[index].node == node;
}
NodeID Min() const {
BOOST_ASSERT( heap.size() > 1 );
return insertedNodes[heap[1].index].node;
}
NodeID DeleteMin() {
BOOST_ASSERT( heap.size() > 1 );
const Key removedIndex = heap[1].index;
heap[1] = heap[heap.size()-1];
heap.pop_back();
if ( heap.size() > 1 )
Downheap( 1 );
insertedNodes[removedIndex].key = 0;
CheckHeap();
return insertedNodes[removedIndex].node;
}
void DeleteAll() {
for ( typename std::vector< HeapElement >::iterator i = heap.begin() + 1, iend = heap.end(); i != iend; ++i )
insertedNodes[i->index].key = 0;
heap.resize( 1 );
heap[0].weight = (std::numeric_limits< Weight >::min)();
}
void DecreaseKey( NodeID node, Weight weight ) {
BOOST_ASSERT( UINT_MAX != node );
const Key & index = nodeIndex[node];
Key & key = insertedNodes[index].key;
BOOST_ASSERT ( key >= 0 );
insertedNodes[index].weight = weight;
heap[key].weight = weight;
Upheap( key );
CheckHeap();
}
private:
class HeapNode {
public:
HeapNode() {
}
HeapNode( NodeID n, Key k, Weight w, Data d )
: node( n ), key( k ), weight( w ), data( d ) {
}
NodeID node;
Key key;
Weight weight;
Data data;
};
struct HeapElement {
Key index;
Weight weight;
};
std::vector< HeapNode > insertedNodes;
std::vector< HeapElement > heap;
IndexStorage nodeIndex;
void Downheap( Key key ) {
const Key droppingIndex = heap[key].index;
const Weight weight = heap[key].weight;
Key nextKey = key << 1;
while ( nextKey < static_cast<Key>( heap.size() ) ) {
const Key nextKeyOther = nextKey + 1;
if ( ( nextKeyOther < static_cast<Key> ( heap.size() ) )&& ( heap[nextKey].weight > heap[nextKeyOther].weight) )
nextKey = nextKeyOther;
if ( weight <= heap[nextKey].weight )
break;
heap[key] = heap[nextKey];
insertedNodes[heap[key].index].key = key;
key = nextKey;
nextKey <<= 1;
}
heap[key].index = droppingIndex;
heap[key].weight = weight;
insertedNodes[droppingIndex].key = key;
}
void Upheap( Key key ) {
const Key risingIndex = heap[key].index;
const Weight weight = heap[key].weight;
Key nextKey = key >> 1;
while ( heap[nextKey].weight > weight ) {
BOOST_ASSERT( nextKey != 0 );
heap[key] = heap[nextKey];
insertedNodes[heap[key].index].key = key;
key = nextKey;
nextKey >>= 1;
}
heap[key].index = risingIndex;
heap[key].weight = weight;
insertedNodes[risingIndex].key = key;
}
void CheckHeap() {
#ifndef NDEBUG
for ( Key i = 2; i < (Key) heap.size(); ++i ) {
BOOST_ASSERT( heap[i].weight >= heap[i >> 1].weight );
}
#endif
}
};
#endif //#ifndef BINARYHEAP_H_INCLUDED
-99
View File
@@ -1,99 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CONCURRENTQUEUE_H_
#define CONCURRENTQUEUE_H_
#include "../typedefs.h"
#include <boost/bind.hpp>
#include <boost/circular_buffer.hpp>
#include <boost/thread/condition.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
template<typename Data>
class ConcurrentQueue {
public:
ConcurrentQueue(const size_t max_size) : m_internal_queue(max_size) { }
inline void push(const Data & data) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_full.wait(
lock,
boost::bind(&ConcurrentQueue<Data>::is_not_full, this)
);
m_internal_queue.push_back(data);
lock.unlock();
m_not_empty.notify_one();
}
inline bool empty() const {
return m_internal_queue.empty();
}
inline void wait_and_pop(Data & popped_value) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_empty.wait(
lock,
boost::bind(&ConcurrentQueue<Data>::is_not_empty, this)
);
popped_value = m_internal_queue.front();
m_internal_queue.pop_front();
lock.unlock();
m_not_full.notify_one();
}
inline bool try_pop(Data& popped_value) {
boost::mutex::scoped_lock lock(m_mutex);
if(m_internal_queue.empty()) {
return false;
}
popped_value=m_internal_queue.front();
m_internal_queue.pop_front();
lock.unlock();
m_not_full.notify_one();
return true;
}
private:
inline bool is_not_empty() const {
return !m_internal_queue.empty();
}
inline bool is_not_full() const {
return m_internal_queue.size() < m_internal_queue.capacity();
}
boost::circular_buffer<Data> m_internal_queue;
boost::mutex m_mutex;
boost::condition m_not_empty;
boost::condition m_not_full;
};
#endif /* CONCURRENTQUEUE_H_ */
-170
View File
@@ -1,170 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FIXED_POINT_COORDINATE_H_
#define FIXED_POINT_COORDINATE_H_
#include "../DataStructures/MercatorUtil.h"
#include "../Util/StringUtil.h"
#include <boost/assert.hpp>
#include <cmath>
#include <climits>
#include <iostream>
static const double COORDINATE_PRECISION = 1000000.;
struct FixedPointCoordinate {
int lat;
int lon;
FixedPointCoordinate () : lat(INT_MIN), lon(INT_MIN) {}
explicit FixedPointCoordinate (int lat, int lon) : lat(lat) , lon(lon) {}
void Reset() {
lat = INT_MIN;
lon = INT_MIN;
}
bool isSet() const {
return (INT_MIN != lat) && (INT_MIN != lon);
}
inline bool isValid() const {
if(
lat > 90*COORDINATE_PRECISION ||
lat < -90*COORDINATE_PRECISION ||
lon > 180*COORDINATE_PRECISION ||
lon < -180*COORDINATE_PRECISION
) {
return false;
}
return true;
}
bool operator==(const FixedPointCoordinate & other) const {
return lat == other.lat && lon == other.lon;
}
};
inline std::ostream & operator<<(std::ostream & out, const FixedPointCoordinate & c){
out << "(" << c.lat << "," << c.lon << ")";
return out;
}
inline double ApproximateDistance( const int lat1, const int lon1, const int lat2, const int lon2 ) {
BOOST_ASSERT(lat1 != INT_MIN);
BOOST_ASSERT(lon1 != INT_MIN);
BOOST_ASSERT(lat2 != INT_MIN);
BOOST_ASSERT(lon2 != INT_MIN);
double RAD = 0.017453292519943295769236907684886;
double lt1 = lat1/COORDINATE_PRECISION;
double ln1 = lon1/COORDINATE_PRECISION;
double lt2 = lat2/COORDINATE_PRECISION;
double ln2 = lon2/COORDINATE_PRECISION;
double dlat1=lt1*(RAD);
double dlong1=ln1*(RAD);
double dlat2=lt2*(RAD);
double dlong2=ln2*(RAD);
double dLong=dlong1-dlong2;
double dLat=dlat1-dlat2;
double aHarv= pow(sin(dLat/2.0),2.0)+cos(dlat1)*cos(dlat2)*pow(sin(dLong/2.),2);
double cHarv=2.*atan2(sqrt(aHarv),sqrt(1.0-aHarv));
//earth's radius from wikipedia varies between 6,356.750 km — 6,378.135 km (˜3,949.901 — 3,963.189 miles)
//The IUGG value for the equatorial radius of the Earth is 6378.137 km (3963.19 mile)
const double earth=6372797.560856;//I am doing miles, just change this to radius in kilometers to get distances in km
double distance=earth*cHarv;
return distance;
}
inline double ApproximateDistance(const FixedPointCoordinate &c1, const FixedPointCoordinate &c2) {
return ApproximateDistance( c1.lat, c1.lon, c2.lat, c2.lon );
}
inline double ApproximateEuclideanDistance(const FixedPointCoordinate &c1, const FixedPointCoordinate &c2) {
BOOST_ASSERT(c1.lat != INT_MIN);
BOOST_ASSERT(c1.lon != INT_MIN);
BOOST_ASSERT(c2.lat != INT_MIN);
BOOST_ASSERT(c2.lon != INT_MIN);
const double RAD = 0.017453292519943295769236907684886;
const double lat1 = (c1.lat/COORDINATE_PRECISION)*RAD;
const double lon1 = (c1.lon/COORDINATE_PRECISION)*RAD;
const double lat2 = (c2.lat/COORDINATE_PRECISION)*RAD;
const double lon2 = (c2.lon/COORDINATE_PRECISION)*RAD;
const double x = (lon2-lon1) * cos((lat1+lat2)/2.);
const double y = (lat2-lat1);
const double earthRadius = 6372797.560856;
const double d = sqrt(x*x + y*y) * earthRadius;
return d;
}
static inline void convertInternalLatLonToString(const int value, std::string & output) {
char buffer[100];
buffer[11] = 0; // zero termination
char* string = printInt< 11, 6 >( buffer, value );
output = string;
}
static inline void convertInternalCoordinateToString(const FixedPointCoordinate & coord, std::string & output) {
std::string tmp;
convertInternalLatLonToString(coord.lon, tmp);
output = tmp;
output += ",";
convertInternalLatLonToString(coord.lat, tmp);
output += tmp;
output += " ";
}
static inline void convertInternalReversedCoordinateToString(const FixedPointCoordinate & coord, std::string & output) {
std::string tmp;
convertInternalLatLonToString(coord.lat, tmp);
output = tmp;
output += ",";
convertInternalLatLonToString(coord.lon, tmp);
output += tmp;
output += " ";
}
/* Get angle of line segment (A,C)->(C,B), atan2 magic, formerly cosine theorem*/
template<class CoordinateT>
static inline double GetAngleBetweenThreeFixedPointCoordinates (
const CoordinateT & A,
const CoordinateT & C,
const CoordinateT & B
) {
const double v1x = (A.lon - C.lon)/COORDINATE_PRECISION;
const double v1y = lat2y(A.lat/COORDINATE_PRECISION) - lat2y(C.lat/COORDINATE_PRECISION);
const double v2x = (B.lon - C.lon)/COORDINATE_PRECISION;
const double v2y = lat2y(B.lat/COORDINATE_PRECISION) - lat2y(C.lat/COORDINATE_PRECISION);
double angle = (atan2(v2y,v2x) - atan2(v1y,v1x) )*180/M_PI;
while(angle < 0)
angle += 360;
return angle;
}
#endif /* FIXED_POINT_COORDINATE_H_ */
-324
View File
@@ -1,324 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DEALLOCATINGVECTOR_H_
#define DEALLOCATINGVECTOR_H_
#include <boost/assert.hpp>
#include <cstring>
#include <vector>
#if __cplusplus > 199711L
#define DEALLOCATION_VECTOR_NULL_PTR nullptr
#else
#define DEALLOCATION_VECTOR_NULL_PTR NULL
#endif
template<typename ElementT, std::size_t bucketSizeC = 8388608/sizeof(ElementT), bool DeallocateC = false>
class DeallocatingVectorIterator : public std::iterator<std::random_access_iterator_tag, ElementT> {
protected:
class DeallocatingVectorIteratorState {
private:
//make constructors explicit, so we do not mix random access and deallocation iterators.
DeallocatingVectorIteratorState();
public:
explicit DeallocatingVectorIteratorState(const DeallocatingVectorIteratorState &r) : /*mData(r.mData),*/ mIndex(r.mIndex), mBucketList(r.mBucketList) {}
explicit DeallocatingVectorIteratorState(const std::size_t idx, std::vector<ElementT *> & input_list) : /*mData(DEALLOCATION_VECTOR_NULL_PTR),*/ mIndex(idx), mBucketList(input_list) {
}
std::size_t mIndex;
std::vector<ElementT *> & mBucketList;
inline bool operator!=(const DeallocatingVectorIteratorState &other) {
return mIndex != other.mIndex;
}
inline bool operator==(const DeallocatingVectorIteratorState &other) {
return mIndex == other.mIndex;
}
bool operator<(const DeallocatingVectorIteratorState &other) const {
return mIndex < other.mIndex;
}
bool operator>(const DeallocatingVectorIteratorState &other) const {
return mIndex > other.mIndex;
}
bool operator>=(const DeallocatingVectorIteratorState &other) const {
return mIndex >= other.mIndex;
}
//This is a hack to make assignment operator possible with reference member
inline DeallocatingVectorIteratorState& operator= (const DeallocatingVectorIteratorState &a) {
if (this != &a) {
this->DeallocatingVectorIteratorState::~DeallocatingVectorIteratorState(); // explicit non-virtual destructor
new (this) DeallocatingVectorIteratorState(a); // placement new
}
return *this;
}
};
DeallocatingVectorIteratorState mState;
public:
typedef std::random_access_iterator_tag iterator_category;
typedef typename std::iterator<std::random_access_iterator_tag, ElementT>::value_type value_type;
typedef typename std::iterator<std::random_access_iterator_tag, ElementT>::difference_type difference_type;
typedef typename std::iterator<std::random_access_iterator_tag, ElementT>::reference reference;
typedef typename std::iterator<std::random_access_iterator_tag, ElementT>::pointer pointer;
DeallocatingVectorIterator() {}
template<typename T2>
DeallocatingVectorIterator(const DeallocatingVectorIterator<T2> & r) : mState(r.mState) {}
DeallocatingVectorIterator(std::size_t idx, std::vector<ElementT *> & input_list) : mState(idx, input_list) {}
DeallocatingVectorIterator(const DeallocatingVectorIteratorState & r) : mState(r) {}
template<typename T2>
DeallocatingVectorIterator& operator=(const DeallocatingVectorIterator<T2> &r) {
if(DeallocateC) BOOST_ASSERT(false);
mState = r.mState; return *this;
}
inline DeallocatingVectorIterator& operator++() { //prefix
++mState.mIndex;
return *this;
}
inline DeallocatingVectorIterator& operator--() { //prefix
if(DeallocateC) BOOST_ASSERT(false);
--mState.mIndex;
return *this;
}
inline DeallocatingVectorIterator operator++(int) { //postfix
DeallocatingVectorIteratorState _myState(mState);
mState.mIndex++;
return DeallocatingVectorIterator(_myState);
}
inline DeallocatingVectorIterator operator--(int) { //postfix
if(DeallocateC) BOOST_ASSERT(false);
DeallocatingVectorIteratorState _myState(mState);
mState.mIndex--;
return DeallocatingVectorIterator(_myState);
}
inline DeallocatingVectorIterator operator+(const difference_type& n) const {
DeallocatingVectorIteratorState _myState(mState);
_myState.mIndex+=n;
return DeallocatingVectorIterator(_myState);
}
inline DeallocatingVectorIterator& operator+=(const difference_type& n) {
mState.mIndex+=n; return *this;
}
inline DeallocatingVectorIterator operator-(const difference_type& n) const {
if(DeallocateC) BOOST_ASSERT(false);
DeallocatingVectorIteratorState _myState(mState);
_myState.mIndex-=n;
return DeallocatingVectorIterator(_myState);
}
inline DeallocatingVectorIterator& operator-=(const difference_type &n) const {
if(DeallocateC) BOOST_ASSERT(false);
mState.mIndex-=n; return *this;
}
inline reference operator*() const {
std::size_t _bucket = mState.mIndex/bucketSizeC;
std::size_t _index = mState.mIndex%bucketSizeC;
return (mState.mBucketList[_bucket][_index]);
}
inline pointer operator->() const {
std::size_t _bucket = mState.mIndex/bucketSizeC;
std::size_t _index = mState.mIndex%bucketSizeC;
return &(mState.mBucketList[_bucket][_index]);
}
inline bool operator!=(const DeallocatingVectorIterator & other) {
return mState != other.mState;
}
inline bool operator==(const DeallocatingVectorIterator & other) {
return mState == other.mState;
}
inline bool operator<(const DeallocatingVectorIterator & other) const {
return mState < other.mState;
}
inline bool operator>(const DeallocatingVectorIterator & other) const {
return mState > other.mState;
}
inline bool operator>=(const DeallocatingVectorIterator & other) const {
return mState >= other.mState;
}
difference_type operator-(const DeallocatingVectorIterator & other) {
if(DeallocateC) BOOST_ASSERT(false);
return mState.mIndex-other.mState.mIndex;
}
};
template<typename ElementT, std::size_t bucketSizeC = 8388608/sizeof(ElementT) >
class DeallocatingVector {
private:
std::size_t mCurrentSize;
std::vector<ElementT *> mBucketList;
public:
typedef ElementT value_type;
typedef DeallocatingVectorIterator<ElementT, bucketSizeC, false> iterator;
typedef DeallocatingVectorIterator<ElementT, bucketSizeC, false> const_iterator;
//this iterator deallocates all buckets that have been visited. Iterators to visited objects become invalid.
typedef DeallocatingVectorIterator<ElementT, bucketSizeC, true> deallocation_iterator;
DeallocatingVector() : mCurrentSize(0) {
//initial bucket
mBucketList.push_back(new ElementT[bucketSizeC]);
}
~DeallocatingVector() {
clear();
}
inline void swap(DeallocatingVector<ElementT, bucketSizeC> & other) {
std::swap(mCurrentSize, other.mCurrentSize);
mBucketList.swap(other.mBucketList);
}
inline void clear() {
//Delete[]'ing ptr's to all Buckets
for(unsigned i = 0; i < mBucketList.size(); ++i) {
if(DEALLOCATION_VECTOR_NULL_PTR != mBucketList[i]) {
delete[] mBucketList[i];
mBucketList[i] = DEALLOCATION_VECTOR_NULL_PTR;
}
}
//Removing all ptrs from vector
std::vector<ElementT *>().swap(mBucketList);
mCurrentSize = 0;
}
inline void push_back(const ElementT & element) {
std::size_t _capacity = capacity();
if(mCurrentSize == _capacity) {
mBucketList.push_back(new ElementT[bucketSizeC]);
}
std::size_t _index = size()%bucketSizeC;
mBucketList.back()[_index] = element;
++mCurrentSize;
}
inline void reserve(const std::size_t) const {
//don't do anything
}
inline void resize(const std::size_t new_size) {
if(new_size > mCurrentSize) {
while(capacity() < new_size) {
mBucketList.push_back(new ElementT[bucketSizeC]);
}
mCurrentSize = new_size;
}
if(new_size < mCurrentSize) {
std::size_t number_of_necessary_buckets = 1+(new_size / bucketSizeC);
for(unsigned i = number_of_necessary_buckets; i < mBucketList.size(); ++i) {
delete[] mBucketList[i];
}
mBucketList.resize(number_of_necessary_buckets);
mCurrentSize = new_size;
}
}
inline std::size_t size() const {
return mCurrentSize;
}
inline std::size_t capacity() const {
return mBucketList.size() * bucketSizeC;
}
inline iterator begin() {
return iterator(static_cast<std::size_t>(0), mBucketList);
}
inline iterator end() {
return iterator(size(), mBucketList);
}
inline deallocation_iterator dbegin() {
return deallocation_iterator(static_cast<std::size_t>(0), mBucketList);
}
inline deallocation_iterator dend() {
return deallocation_iterator(size(), mBucketList);
}
inline const_iterator begin() const {
return const_iterator(static_cast<std::size_t>(0), mBucketList);
}
inline const_iterator end() const {
return const_iterator(size(), mBucketList);
}
inline ElementT & operator[](const std::size_t index) {
std::size_t _bucket = index / bucketSizeC;
std::size_t _index = index % bucketSizeC;
return (mBucketList[_bucket][_index]);
}
const inline ElementT & operator[](const std::size_t index) const {
std::size_t _bucket = index / bucketSizeC;
std::size_t _index = index % bucketSizeC;
return (mBucketList[_bucket][_index]);
}
inline ElementT & back() {
std::size_t _bucket = mCurrentSize / bucketSizeC;
std::size_t _index = mCurrentSize % bucketSizeC;
return (mBucketList[_bucket][_index]);
}
const inline ElementT & back() const {
std::size_t _bucket = mCurrentSize / bucketSizeC;
std::size_t _index = mCurrentSize % bucketSizeC;
return (mBucketList[_bucket][_index]);
}
};
#endif /* DEALLOCATINGVECTOR_H_ */
-240
View File
@@ -1,240 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DYNAMICGRAPH_H_INCLUDED
#define DYNAMICGRAPH_H_INCLUDED
#include "../DataStructures/DeallocatingVector.h"
#include <boost/assert.hpp>
#include <boost/integer.hpp>
#include <algorithm>
#include <limits>
#include <vector>
template< typename EdgeDataT>
class DynamicGraph {
public:
typedef EdgeDataT EdgeData;
typedef uint32_t NodeIterator;
typedef uint32_t EdgeIterator;
class InputEdge {
public:
NodeIterator source;
NodeIterator target;
EdgeDataT data;
bool operator<( const InputEdge& right ) const {
if ( source != right.source )
return source < right.source;
return target < right.target;
}
};
//Constructs an empty graph with a given number of nodes.
DynamicGraph( int32_t nodes ) : m_numNodes(nodes), m_numEdges(0) {
m_nodes.reserve( m_numNodes );
m_nodes.resize( m_numNodes );
m_edges.reserve( m_numNodes * 1.1 );
m_edges.resize( m_numNodes );
}
template<class ContainerT>
DynamicGraph( const int32_t nodes, const ContainerT &graph ) {
m_numNodes = nodes;
m_numEdges = ( EdgeIterator ) graph.size();
m_nodes.reserve( m_numNodes +1);
m_nodes.resize( m_numNodes +1);
EdgeIterator edge = 0;
EdgeIterator position = 0;
for ( NodeIterator node = 0; node < m_numNodes; ++node ) {
EdgeIterator lastEdge = edge;
while ( edge < m_numEdges && graph[edge].source == node ) {
++edge;
}
m_nodes[node].firstEdge = position;
m_nodes[node].edges = edge - lastEdge;
position += m_nodes[node].edges;
}
m_nodes.back().firstEdge = position;
m_edges.reserve( position * 1.1 );
m_edges.resize( position );
edge = 0;
for ( NodeIterator node = 0; node < m_numNodes; ++node ) {
for ( EdgeIterator i = m_nodes[node].firstEdge, e = m_nodes[node].firstEdge + m_nodes[node].edges; i != e; ++i ) {
m_edges[i].target = graph[edge].target;
m_edges[i].data = graph[edge].data;
BOOST_ASSERT_MSG(
graph[edge].data.distance > 0,
"edge distance invalid"
);
++edge;
}
}
}
~DynamicGraph(){ }
uint32_t GetNumberOfNodes() const {
return m_numNodes;
}
uint32_t GetNumberOfEdges() const {
return m_numEdges;
}
uint32_t GetOutDegree( const NodeIterator n ) const {
return m_nodes[n].edges;
}
NodeIterator GetTarget( const EdgeIterator e ) const {
return NodeIterator( m_edges[e].target );
}
EdgeDataT &GetEdgeData( const EdgeIterator e ) {
return m_edges[e].data;
}
const EdgeDataT &GetEdgeData( const EdgeIterator e ) const {
return m_edges[e].data;
}
EdgeIterator BeginEdges( const NodeIterator n ) const {
return EdgeIterator( m_nodes[n].firstEdge );
}
EdgeIterator EndEdges( const NodeIterator n ) const {
return EdgeIterator( m_nodes[n].firstEdge + m_nodes[n].edges );
}
//adds an edge. Invalidates edge iterators for the source node
EdgeIterator InsertEdge( const NodeIterator from, const NodeIterator to, const EdgeDataT &data ) {
Node &node = m_nodes[from];
EdgeIterator newFirstEdge = node.edges + node.firstEdge;
if ( newFirstEdge >= m_edges.size() || !isDummy( newFirstEdge ) ) {
if ( node.firstEdge != 0 && isDummy( node.firstEdge - 1 ) ) {
node.firstEdge--;
m_edges[node.firstEdge] = m_edges[node.firstEdge + node.edges];
} else {
EdgeIterator newFirstEdge = ( EdgeIterator ) m_edges.size();
uint32_t newSize = node.edges * 1.1 + 2;
EdgeIterator requiredCapacity = newSize + m_edges.size();
EdgeIterator oldCapacity = m_edges.capacity();
if ( requiredCapacity >= oldCapacity ) {
m_edges.reserve( requiredCapacity * 1.1 );
}
m_edges.resize( m_edges.size() + newSize );
for ( EdgeIterator i = 0; i < node.edges; ++i ) {
m_edges[newFirstEdge + i ] = m_edges[node.firstEdge + i];
makeDummy( node.firstEdge + i );
}
for ( EdgeIterator i = node.edges + 1; i < newSize; ++i )
makeDummy( newFirstEdge + i );
node.firstEdge = newFirstEdge;
}
}
Edge &edge = m_edges[node.firstEdge + node.edges];
edge.target = to;
edge.data = data;
++m_numEdges;
++node.edges;
return EdgeIterator( node.firstEdge + node.edges );
}
//removes an edge. Invalidates edge iterators for the source node
void DeleteEdge( const NodeIterator source, const EdgeIterator e ) {
Node &node = m_nodes[source];
--m_numEdges;
--node.edges;
const uint32_t last = node.firstEdge + node.edges;
//swap with last edge
m_edges[e] = m_edges[last];
makeDummy( last );
}
//removes all edges (source,target)
int32_t DeleteEdgesTo( const NodeIterator source, const NodeIterator target ) {
int32_t deleted = 0;
for ( EdgeIterator i = BeginEdges( source ), iend = EndEdges( source ); i < iend - deleted; ++i ) {
if ( m_edges[i].target == target ) {
do {
deleted++;
m_edges[i] = m_edges[iend - deleted];
makeDummy( iend - deleted );
} while ( i < iend - deleted && m_edges[i].target == target );
}
}
#pragma omp atomic
m_numEdges -= deleted;
m_nodes[source].edges -= deleted;
return deleted;
}
//searches for a specific edge
EdgeIterator FindEdge( const NodeIterator from, const NodeIterator to ) const {
for ( EdgeIterator i = BeginEdges( from ), iend = EndEdges( from ); i != iend; ++i ) {
if ( to == m_edges[i].target ) {
return i;
}
}
return EndEdges( from );
}
protected:
bool isDummy( const EdgeIterator edge ) const {
return m_edges[edge].target == (std::numeric_limits< NodeIterator >::max)();
}
void makeDummy( const EdgeIterator edge ) {
m_edges[edge].target = (std::numeric_limits< NodeIterator >::max)();
}
struct Node {
//index of the first edge
EdgeIterator firstEdge;
//amount of edges
uint32_t edges;
};
struct Edge {
NodeIterator target;
EdgeDataT data;
};
NodeIterator m_numNodes;
EdgeIterator m_numEdges;
std::vector< Node > m_nodes;
DeallocatingVector< Edge > m_edges;
};
#endif // DYNAMICGRAPH_H_INCLUDED
-51
View File
@@ -1,51 +0,0 @@
#ifndef EDGE_BASED_NODE_H
#define EDGE_BASED_NODE_H
#include "Coordinate.h"
struct EdgeBasedNode {
EdgeBasedNode() :
id(INT_MAX),
lat1(INT_MAX),
lat2(INT_MAX),
lon1(INT_MAX),
lon2(INT_MAX >> 1),
belongsToTinyComponent(false),
nameID(UINT_MAX),
weight(UINT_MAX >> 1),
ignoreInGrid(false)
{ }
bool operator<(const EdgeBasedNode & other) const {
return other.id < id;
}
bool operator==(const EdgeBasedNode & other) const {
return id == other.id;
}
inline FixedPointCoordinate Centroid() const {
FixedPointCoordinate centroid;
//The coordinates of the midpoint are given by:
//x = (x1 + x2) /2 and y = (y1 + y2) /2.
centroid.lon = (std::min(lon1, lon2) + std::max(lon1, lon2))/2;
centroid.lat = (std::min(lat1, lat2) + std::max(lat1, lat2))/2;
return centroid;
}
inline bool isIgnored() const {
return ignoreInGrid;
}
NodeID id;
int lat1;
int lat2;
int lon1;
int lon2:31;
bool belongsToTinyComponent:1;
NodeID nameID;
unsigned weight:31;
bool ignoreInGrid:1;
};
#endif //EDGE_BASED_NODE_H
-67
View File
@@ -1,67 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef HASHTABLE_H_
#define HASHTABLE_H_
#include <boost/ref.hpp>
#include <boost/unordered_map.hpp>
template<typename keyT, typename valueT>
class HashTable : public boost::unordered_map<keyT, valueT> {
private:
typedef boost::unordered_map<keyT, valueT> super;
public:
HashTable() : super() { }
HashTable(const unsigned size) : super(size) { }
HashTable &operator=(const HashTable &other) {
super::operator = (other);
return *this;
}
inline void Add(const keyT& key, const valueT& value){
super::insert(std::make_pair(key, value));
}
inline valueT Find(const keyT& key) const {
if(super::find(key) == super::end()) {
return valueT();
}
return boost::ref(super::find(key)->second);
}
inline bool Holds(const keyT& key) const {
if(super::find(key) == super::end()) {
return false;
}
return true;
}
};
#endif /* HASHTABLE_H_ */
-97
View File
@@ -1,97 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef HILBERTVALUE_H_
#define HILBERTVALUE_H_
#include "Coordinate.h"
#include <boost/integer.hpp>
#include <boost/noncopyable.hpp>
// computes a 64 bit value that corresponds to the hilbert space filling curve
class HilbertCode : boost::noncopyable {
public:
static uint64_t GetHilbertNumberForCoordinate(
const FixedPointCoordinate & current_coordinate
) {
unsigned location[2];
location[0] = current_coordinate.lat+( 90*COORDINATE_PRECISION);
location[1] = current_coordinate.lon+(180*COORDINATE_PRECISION);
TransposeCoordinate(location);
const uint64_t result = BitInterleaving(location[0], location[1]);
return result;
}
private:
static inline uint64_t BitInterleaving(const uint32_t a, const uint32_t b) {
uint64_t result = 0;
for(int8_t index = 31; index >= 0; --index){
result |= (a >> index) & 1;
result <<= 1;
result |= (b >> index) & 1;
if(0 != index){
result <<= 1;
}
}
return result;
}
static inline void TransposeCoordinate( uint32_t * X) {
uint32_t M = 1 << (32-1), P, Q, t;
int i;
// Inverse undo
for( Q = M; Q > 1; Q >>= 1 ) {
P=Q-1;
for( i = 0; i < 2; ++i ) {
if( X[i] & Q ) {
X[0] ^= P; // invert
} else {
t = (X[0]^X[i]) & P;
X[0] ^= t;
X[i] ^= t;
}
} // exchange
}
// Gray encode
for( i = 1; i < 2; ++i ) {
X[i] ^= X[i-1];
}
t=0;
for( Q = M; Q > 1; Q >>= 1 ) {
if( X[2-1] & Q ) {
t ^= Q-1;
}
} //check if this for loop is wrong
for( i = 0; i < 2; ++i ) {
X[i] ^= t;
}
}
};
#endif /* HILBERTVALUE_H_ */
-185
View File
@@ -1,185 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef IMPORT_EDGE_H
#define IMPORT_EDGE_H
#include "../Util/OSRMException.h"
#include "../typedefs.h"
#include <boost/assert.hpp>
class NodeBasedEdge {
public:
bool operator< (const NodeBasedEdge& e) const {
if (source() == e.source()) {
if (target() == e.target()) {
if (weight() == e.weight()) {
return (isForward() && isBackward() &&
((! e.isForward()) || (! e.isBackward())));
}
return (weight() < e.weight());
}
return (target() < e.target());
}
return (source() < e.source());
}
explicit NodeBasedEdge(
NodeID s,
NodeID t,
NodeID n,
EdgeWeight w,
bool f,
bool b,
short ty,
bool ra,
bool ig,
bool ar,
bool cf
) : _source(s),
_target(t),
_name(n),
_weight(w),
_type(ty),
forward(f),
backward(b),
_roundabout(ra),
_ignoreInGrid(ig),
_accessRestricted(ar),
_contraFlow(cf)
{
if(ty < 0) {
throw OSRMException("negative edge type");
}
}
NodeID target() const {return _target; }
NodeID source() const {return _source; }
NodeID name() const { return _name; }
EdgeWeight weight() const {return _weight; }
short type() const {
BOOST_ASSERT_MSG(_type >= 0, "type of ImportEdge invalid");
return _type; }
bool isBackward() const { return backward; }
bool isForward() const { return forward; }
bool isLocatable() const { return _type != 14; }
bool isRoundabout() const { return _roundabout; }
bool ignoreInGrid() const { return _ignoreInGrid; }
bool isAccessRestricted() const { return _accessRestricted; }
bool isContraFlow() const { return _contraFlow; }
//TODO: names need to be fixed.
NodeID _source;
NodeID _target;
NodeID _name;
EdgeWeight _weight;
short _type;
bool forward:1;
bool backward:1;
bool _roundabout:1;
bool _ignoreInGrid:1;
bool _accessRestricted:1;
bool _contraFlow:1;
private:
NodeBasedEdge() { }
};
class EdgeBasedEdge {
public:
bool operator< (const EdgeBasedEdge& e) const {
if (source() == e.source()) {
if (target() == e.target()) {
if (weight() == e.weight()) {
return (isForward() && isBackward() &&
((! e.isForward()) || (! e.isBackward())));
}
return (weight() < e.weight());
}
return (target() < e.target());
}
return (source() < e.source());
}
template<class EdgeT>
EdgeBasedEdge(const EdgeT & myEdge ) :
m_source(myEdge.source),
m_target(myEdge.target),
m_edgeID(myEdge.data.via),
m_weight(myEdge.data.distance),
m_forward(myEdge.data.forward),
m_backward(myEdge.data.backward)
{ }
/** Default constructor. target and weight are set to 0.*/
EdgeBasedEdge() :
m_source(0),
m_target(0),
m_edgeID(0),
m_weight(0),
m_forward(false),
m_backward(false)
{ }
explicit EdgeBasedEdge(
const NodeID s,
const NodeID t,
const NodeID v,
const EdgeWeight w,
const bool f,
const bool b
) :
m_source(s),
m_target(t),
m_edgeID(v),
m_weight(w),
m_forward(f),
m_backward(b)
{}
NodeID target() const { return m_target; }
NodeID source() const { return m_source; }
EdgeWeight weight() const { return m_weight; }
NodeID id() const { return m_edgeID; }
bool isBackward() const { return m_backward; }
bool isForward() const { return m_forward; }
private:
NodeID m_source;
NodeID m_target;
NodeID m_edgeID;
EdgeWeight m_weight:30;
bool m_forward:1;
bool m_backward:1;
};
typedef NodeBasedEdge ImportEdge;
#endif /* IMPORT_EDGE_H */
-77
View File
@@ -1,77 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef IMPORTNODE_H_
#define IMPORTNODE_H_
#include "QueryNode.h"
#include "../DataStructures/HashTable.h"
struct ExternalMemoryNode : NodeInfo {
ExternalMemoryNode(
int lat,
int lon,
unsigned int id,
bool bollard,
bool traffic_light
) :
NodeInfo(lat, lon, id),
bollard(bollard),
trafficLight(traffic_light)
{ }
ExternalMemoryNode() : bollard(false), trafficLight(false) {}
static ExternalMemoryNode min_value() {
return ExternalMemoryNode(0,0,0, false, false);
}
static ExternalMemoryNode max_value() {
return ExternalMemoryNode(
std::numeric_limits<int>::max(),
std::numeric_limits<int>::max(),
std::numeric_limits<unsigned>::max(),
false,
false
);
}
NodeID key() const {
return id;
}
bool bollard;
bool trafficLight;
};
struct ImportNode : public ExternalMemoryNode {
HashTable<std::string, std::string> keyVals;
inline void Clear() {
keyVals.clear();
lat = 0; lon = 0; id = 0; bollard = false; trafficLight = false;
}
};
#endif /* IMPORTNODE_H_ */
-102
View File
@@ -1,102 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef INPUTREADERFACTORY_H
#define INPUTREADERFACTORY_H
#include <bzlib.h>
#include <libxml/xmlreader.h>
struct BZ2Context {
FILE* file;
BZFILE* bz2;
int error;
int nUnused;
char unused[BZ_MAX_UNUSED];
};
int readFromBz2Stream( void* pointer, char* buffer, int len ) {
void *unusedTmpVoid=NULL;
char *unusedTmp=NULL;
BZ2Context* context = (BZ2Context*) pointer;
int read = 0;
while(0 == read && !(BZ_STREAM_END == context->error && 0 == context->nUnused && feof(context->file))) {
read = BZ2_bzRead(&context->error, context->bz2, buffer, len);
if(BZ_OK == context->error) {
return read;
} else if(BZ_STREAM_END == context->error) {
BZ2_bzReadGetUnused(&context->error, context->bz2, &unusedTmpVoid, &context->nUnused);
if(BZ_OK != context->error) {std::cerr << "Could not BZ2_bzReadGetUnused" <<std::endl; exit(-1);};
unusedTmp = (char*)unusedTmpVoid;
for(int i=0;i<context->nUnused;i++) {
context->unused[i] = unusedTmp[i];
}
BZ2_bzReadClose(&context->error, context->bz2);
if(BZ_OK != context->error) {std::cerr << "Could not BZ2_bzReadClose" <<std::endl; exit(-1);};
context->error = BZ_STREAM_END; // set to the stream end for next call to this function
if(0 == context->nUnused && feof(context->file)) {
return read;
} else {
context->bz2 = BZ2_bzReadOpen(&context->error, context->file, 0, 0, context->unused, context->nUnused);
if(NULL == context->bz2){std::cerr << "Could not open file" <<std::endl; exit(-1);};
}
} else { std::cerr << "Could not read bz2 file" << std::endl; exit(-1); }
}
return read;
}
int closeBz2Stream( void *pointer )
{
BZ2Context* context = (BZ2Context*) pointer;
fclose( context->file );
delete context;
return 0;
}
xmlTextReaderPtr inputReaderFactory( const char* name )
{
std::string inputName(name);
if(inputName.find(".osm.bz2")!=std::string::npos)
{
BZ2Context* context = new BZ2Context();
context->error = false;
context->file = fopen( name, "r" );
int error;
context->bz2 = BZ2_bzReadOpen( &error, context->file, 0, 0, context->unused, context->nUnused );
if ( context->bz2 == NULL || context->file == NULL ) {
delete context;
return NULL;
}
return xmlReaderForIO( readFromBz2Stream, closeBz2Stream, (void*) context, NULL, NULL, 0 );
} else {
return xmlNewTextReaderFilename(name);
}
}
#endif // INPUTREADERFACTORY_H
-89
View File
@@ -1,89 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LRUCACHE_H
#define LRUCACHE_H
#include <list>
#include <boost/unordered_map.hpp>
template<typename KeyT, typename ValueT>
class LRUCache {
private:
struct CacheEntry {
CacheEntry(KeyT k, ValueT v) : key(k), value(v) {}
KeyT key;
ValueT value;
};
unsigned capacity;
std::list<CacheEntry> itemsInCache;
boost::unordered_map<KeyT, typename std::list<CacheEntry>::iterator > positionMap;
public:
LRUCache(unsigned c) : capacity(c) {}
bool Holds(KeyT key) {
if(positionMap.find(key) != positionMap.end()) {
return true;
}
return false;
}
void Insert(const KeyT key, ValueT &value) {
itemsInCache.push_front(CacheEntry(key, value));
positionMap.insert(std::make_pair(key, itemsInCache.begin()));
if(itemsInCache.size() > capacity) {
positionMap.erase(itemsInCache.back().key);
itemsInCache.pop_back();
}
}
void Insert(const KeyT key, ValueT value) {
itemsInCache.push_front(CacheEntry(key, value));
positionMap.insert(std::make_pair(key, itemsInCache.begin()));
if(itemsInCache.size() > capacity) {
positionMap.erase(itemsInCache.back().key);
itemsInCache.pop_back();
}
}
bool Fetch(const KeyT key, ValueT& result) {
if(Holds(key)) {
CacheEntry e = *(positionMap.find(key)->second);
result = e.value;
//move to front
itemsInCache.splice(positionMap.find(key)->second, itemsInCache, itemsInCache.begin());
positionMap.find(key)->second = itemsInCache.begin();
return true;
}
return false;
}
unsigned Size() const {
return itemsInCache.size();
}
};
#endif //LRUCACHE_H
-99
View File
@@ -1,99 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PERCENT_H
#define PERCENT_H
#include "../Util/OpenMPWrapper.h"
#include <iostream>
class Percent {
public:
/**
* Constructor.
* @param maxValue the value that corresponds to 100%
* @param step the progress is shown in steps of 'step' percent
*/
Percent(unsigned maxValue, unsigned step = 5) {
reinit(maxValue, step);
}
/** Reinitializes this object. */
void reinit(unsigned maxValue, unsigned step = 5) {
_maxValue = maxValue;
_current_value = 0;
_intervalPercent = _maxValue / 100;
_nextThreshold = _intervalPercent;
_lastPercent = 0;
_step = step;
}
/** If there has been significant progress, display it. */
void printStatus(unsigned currentValue) {
if (currentValue >= _nextThreshold) {
_nextThreshold += _intervalPercent;
printPercent( currentValue / (double)_maxValue * 100 );
}
if (currentValue + 1 == _maxValue)
std::cout << " 100%" << std::endl;
}
void printIncrement() {
#pragma omp atomic
++_current_value;
printStatus(_current_value);
}
void printAddition(const unsigned addition) {
#pragma omp atomic
_current_value += addition;
printStatus(_current_value);
}
private:
unsigned _current_value;
unsigned _maxValue;
unsigned _intervalPercent;
unsigned _nextThreshold;
unsigned _lastPercent;
unsigned _step;
/** Displays the new progress. */
void printPercent(double percent) {
while (percent >= _lastPercent+_step) {
_lastPercent+=_step;
if (_lastPercent % 10 == 0) {
std::cout << " " << _lastPercent << "% ";
}
else {
std::cout << ".";
}
std::cout.flush();
}
}
};
#endif // PERCENT_H
-102
View File
@@ -1,102 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PHANTOMNODES_H_
#define PHANTOMNODES_H_
#include "Coordinate.h"
struct PhantomNode {
PhantomNode() :
edgeBasedNode(UINT_MAX),
nodeBasedEdgeNameID(UINT_MAX),
weight1(INT_MAX),
weight2(INT_MAX),
ratio(0.)
{ }
NodeID edgeBasedNode;
unsigned nodeBasedEdgeNameID;
int weight1;
int weight2;
double ratio;
FixedPointCoordinate location;
void Reset() {
edgeBasedNode = UINT_MAX;
nodeBasedEdgeNameID = UINT_MAX;
weight1 = INT_MAX;
weight2 = INT_MAX;
ratio = 0.;
location.Reset();
}
bool isBidirected() const {
return weight2 != INT_MAX;
}
bool isValid(const unsigned numberOfNodes) const {
return location.isValid() && (edgeBasedNode < numberOfNodes) && (weight1 != INT_MAX) && (ratio >= 0.) && (ratio <= 1.) && (nodeBasedEdgeNameID != UINT_MAX);
}
bool operator==(const PhantomNode & other) const {
return location == other.location;
}
};
struct PhantomNodes {
PhantomNode startPhantom;
PhantomNode targetPhantom;
void Reset() {
startPhantom.Reset();
targetPhantom.Reset();
}
bool PhantomsAreOnSameNodeBasedEdge() const {
return (startPhantom.edgeBasedNode == targetPhantom.edgeBasedNode);
}
bool AtLeastOnePhantomNodeIsUINTMAX() const {
return !(startPhantom.edgeBasedNode == UINT_MAX || targetPhantom.edgeBasedNode == UINT_MAX);
}
bool PhantomNodesHaveEqualLocation() const {
return startPhantom == targetPhantom;
}
};
inline std::ostream& operator<<(std::ostream &out, const PhantomNodes & pn){
out << "Node1: " << pn.startPhantom.edgeBasedNode << std::endl;
out << "Node2: " << pn.targetPhantom.edgeBasedNode << std::endl;
out << "startCoord: " << pn.startPhantom.location << std::endl;
out << "targetCoord: " << pn.targetPhantom.location << std::endl;
return out;
}
inline std::ostream& operator<<(std::ostream &out, const PhantomNode & pn){
out << "node: " << pn.edgeBasedNode << ", name: " << pn.nodeBasedEdgeNameID << ", w1: " << pn.weight1 << ", w2: " << pn.weight2 << ", ratio: " << pn.ratio << ", loc: " << pn.location;
return out;
}
#endif /* PHANTOMNODES_H_ */
-74
View File
@@ -1,74 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef QUERYEDGE_H_
#define QUERYEDGE_H_
#include "TurnInstructions.h"
#include "../typedefs.h"
#include <climits>
struct OriginalEdgeData{
explicit OriginalEdgeData(
NodeID viaNode,
unsigned nameID,
TurnInstruction turnInstruction
) : viaNode(viaNode), nameID(nameID), turnInstruction(turnInstruction) {}
OriginalEdgeData() : viaNode(UINT_MAX), nameID(UINT_MAX), turnInstruction(UCHAR_MAX) {}
NodeID viaNode;
unsigned nameID;
TurnInstruction turnInstruction;
};
struct QueryEdge {
NodeID source;
NodeID target;
struct EdgeData {
NodeID id:31;
bool shortcut:1;
int distance:30;
bool forward:1;
bool backward:1;
} data;
bool operator<( const QueryEdge& right ) const {
if ( source != right.source ) {
return source < right.source;
}
return target < right.target;
}
bool operator== ( const QueryEdge& right ) const {
return ( source == right.source && target == right.target && data.distance == right.data.distance &&
data.shortcut == right.data.shortcut && data.forward == right.data.forward && data.backward == right.data.backward
&& data.id == right.data.id
);
}
};
#endif /* QUERYEDGE_H_ */
-85
View File
@@ -1,85 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _NODE_COORDS_H
#define _NODE_COORDS_H
#include "Coordinate.h"
#include "../typedefs.h"
#include <boost/assert.hpp>
#include <cstddef>
#include <climits>
#include <limits>
struct NodeInfo {
typedef NodeID key_type; //type of NodeID
typedef int value_type; //type of lat,lons
NodeInfo(int _lat, int _lon, NodeID _id) : lat(_lat), lon(_lon), id(_id) {}
NodeInfo() : lat(INT_MAX), lon(INT_MAX), id(UINT_MAX) {}
int lat;
int lon;
NodeID id;
static NodeInfo min_value() {
return NodeInfo(
-90*COORDINATE_PRECISION,
-180*COORDINATE_PRECISION,
std::numeric_limits<NodeID>::min()
);
}
static NodeInfo max_value() {
return NodeInfo(
90*COORDINATE_PRECISION,
180*COORDINATE_PRECISION,
std::numeric_limits<NodeID>::max()
);
}
value_type operator[](const std::size_t n) const {
switch(n) {
case 1:
return lat;
break;
case 0:
return lon;
break;
default:
BOOST_ASSERT_MSG(false, "should not happen");
return UINT_MAX;
break;
}
BOOST_ASSERT_MSG(false, "should not happen");
return UINT_MAX;
}
};
#endif //_NODE_COORDS_H
-56
View File
@@ -1,56 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef RAWROUTEDATA_H_
#define RAWROUTEDATA_H_
#include "../DataStructures/Coordinate.h"
#include "../DataStructures/PhantomNodes.h"
#include "../typedefs.h"
#include <vector>
struct _PathData {
_PathData(NodeID no, unsigned na, unsigned tu, unsigned dur) : node(no), nameID(na), durationOfSegment(dur), turnInstruction(tu) { }
NodeID node;
unsigned nameID;
unsigned durationOfSegment;
short turnInstruction;
};
struct RawRouteData {
std::vector< _PathData > computedShortestPath;
std::vector< _PathData > computedAlternativePath;
std::vector< PhantomNodes > segmentEndCoordinates;
std::vector< FixedPointCoordinate > rawViaNodeCoordinates;
unsigned checkSum;
int lengthOfShortestPath;
int lengthOfAlternativePath;
RawRouteData() : checkSum(UINT_MAX), lengthOfShortestPath(INT_MAX), lengthOfAlternativePath(INT_MAX) {}
};
#endif /* RAWROUTEDATA_H_ */
-146
View File
@@ -1,146 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef RESTRICTION_H_
#define RESTRICTION_H_
#include "../typedefs.h"
#include <climits>
struct TurnRestriction {
NodeID viaNode;
NodeID fromNode;
NodeID toNode;
struct Bits { //mostly unused
Bits()
:
isOnly(false),
unused1(false),
unused2(false),
unused3(false),
unused4(false),
unused5(false),
unused6(false),
unused7(false)
{ }
bool isOnly:1;
bool unused1:1;
bool unused2:1;
bool unused3:1;
bool unused4:1;
bool unused5:1;
bool unused6:1;
bool unused7:1;
} flags;
TurnRestriction(NodeID viaNode) :
viaNode(viaNode),
fromNode(UINT_MAX),
toNode(UINT_MAX) {
}
TurnRestriction(const bool isOnly = false) :
viaNode(UINT_MAX),
fromNode(UINT_MAX),
toNode(UINT_MAX) {
flags.isOnly = isOnly;
}
};
struct InputRestrictionContainer {
EdgeID fromWay;
EdgeID toWay;
unsigned viaNode;
TurnRestriction restriction;
InputRestrictionContainer(
EdgeID fromWay,
EdgeID toWay,
NodeID vn,
unsigned vw
) :
fromWay(fromWay),
toWay(toWay),
viaNode(vw)
{
restriction.viaNode = vn;
}
InputRestrictionContainer(
bool isOnly = false
) :
fromWay(UINT_MAX),
toWay(UINT_MAX),
viaNode(UINT_MAX)
{
restriction.flags.isOnly = isOnly;
}
static InputRestrictionContainer min_value() {
return InputRestrictionContainer(0, 0, 0, 0);
}
static InputRestrictionContainer max_value() {
return InputRestrictionContainer(UINT_MAX, UINT_MAX, UINT_MAX, UINT_MAX);
}
};
struct CmpRestrictionContainerByFrom :
public std::binary_function<InputRestrictionContainer, InputRestrictionContainer, bool>
{
typedef InputRestrictionContainer value_type;
inline bool operator()(
const InputRestrictionContainer & a,
const InputRestrictionContainer & b
) const {
return a.fromWay < b.fromWay;
}
inline value_type max_value() const {
return InputRestrictionContainer::max_value();
}
inline value_type min_value() const {
return InputRestrictionContainer::min_value();
}
};
struct CmpRestrictionContainerByTo: public std::binary_function<InputRestrictionContainer, InputRestrictionContainer, bool> {
typedef InputRestrictionContainer value_type;
inline bool operator ()(
const InputRestrictionContainer & a,
const InputRestrictionContainer & b
) const {
return a.toWay < b.toWay;
}
value_type max_value() const {
return InputRestrictionContainer::max_value();
}
value_type min_value() const {
return InputRestrictionContainer::min_value();
}
};
#endif /* RESTRICTION_H_ */
-67
View File
@@ -1,67 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "SearchEngineData.h"
void SearchEngineData::InitializeOrClearFirstThreadLocalStorage(const unsigned number_of_nodes) {
if(!forwardHeap.get()) {
forwardHeap.reset(new QueryHeap(number_of_nodes));
} else {
forwardHeap->Clear();
}
if(!backwardHeap.get()) {
backwardHeap.reset(new QueryHeap(number_of_nodes));
} else {
backwardHeap->Clear();
}
}
void SearchEngineData::InitializeOrClearSecondThreadLocalStorage(const unsigned number_of_nodes) {
if(!forwardHeap2.get()) {
forwardHeap2.reset(new QueryHeap(number_of_nodes));
} else {
forwardHeap2->Clear();
}
if(!backwardHeap2.get()) {
backwardHeap2.reset(new QueryHeap(number_of_nodes));
} else {
backwardHeap2->Clear();
}
}
void SearchEngineData::InitializeOrClearThirdThreadLocalStorage(const unsigned number_of_nodes) {
if(!forwardHeap3.get()) {
forwardHeap3.reset(new QueryHeap(number_of_nodes));
} else {
forwardHeap3->Clear();
}
if(!backwardHeap3.get()) {
backwardHeap3.reset(new QueryHeap(number_of_nodes));
} else {
backwardHeap3->Clear();
}
}
-67
View File
@@ -1,67 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SEARCH_ENGINE_DATA_H
#define SEARCH_ENGINE_DATA_H
#include "BinaryHeap.h"
#include "QueryEdge.h"
#include "StaticGraph.h"
#include "../typedefs.h"
#include <boost/thread.hpp>
#include <string>
#include <vector>
struct _HeapData {
NodeID parent;
_HeapData( NodeID p ) : parent(p) { }
};
// typedef StaticGraph<QueryEdge::EdgeData> QueryGraph;
struct SearchEngineData {
typedef BinaryHeap< NodeID, NodeID, int, _HeapData, UnorderedMapStorage<NodeID, int> > QueryHeap;
typedef boost::thread_specific_ptr<QueryHeap> SearchEngineHeapPtr;
static SearchEngineHeapPtr forwardHeap;
static SearchEngineHeapPtr backwardHeap;
static SearchEngineHeapPtr forwardHeap2;
static SearchEngineHeapPtr backwardHeap2;
static SearchEngineHeapPtr forwardHeap3;
static SearchEngineHeapPtr backwardHeap3;
void InitializeOrClearFirstThreadLocalStorage(const unsigned number_of_nodes);
void InitializeOrClearSecondThreadLocalStorage(const unsigned number_of_nodes);
void InitializeOrClearThirdThreadLocalStorage(const unsigned number_of_nodes);
};
#endif // SEARCH_ENGINE_DATA_H
-51
View File
@@ -1,51 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SEGMENTINFORMATION_H_
#define SEGMENTINFORMATION_H_
#include "Coordinate.h"
#include "TurnInstructions.h"
#include "../typedefs.h"
#include <climits>
struct SegmentInformation {
FixedPointCoordinate location;
NodeID nameID;
double length;
unsigned duration;
double bearing;
TurnInstruction turnInstruction;
bool necessary;
SegmentInformation(const FixedPointCoordinate & loc, const NodeID nam, const double len, const unsigned dur, const TurnInstruction tInstr, const bool nec) :
location(loc), nameID(nam), length(len), duration(dur), bearing(0.), turnInstruction(tInstr), necessary(nec) {}
SegmentInformation(const FixedPointCoordinate & loc, const NodeID nam, const double len, const unsigned dur, const TurnInstruction tInstr) :
location(loc), nameID(nam), length(len), duration(dur), bearing(0.), turnInstruction(tInstr), necessary(tInstr != 0) {}
};
#endif /* SEGMENTINFORMATION_H_ */
-250
View File
@@ -1,250 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SHARED_MEMORY_FACTORY_H
#define SHARED_MEMORY_FACTORY_H
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
#include <boost/noncopyable.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/integer.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include <boost/interprocess/xsi_shared_memory.hpp>
#ifdef __linux__
#include <sys/ipc.h>
#include <sys/shm.h>
#endif
#include <cstring>
#include <algorithm>
#include <exception>
struct OSRMLockFile {
boost::filesystem::path operator()() {
boost::filesystem::path temp_dir =
boost::filesystem::temp_directory_path();
boost::filesystem::path lock_file = temp_dir / "osrm.lock";
return lock_file;
}
};
class SharedMemory : boost::noncopyable {
//Remove shared memory on destruction
class shm_remove : boost::noncopyable {
private:
int m_shmid;
bool m_initialized;
public:
void SetID(int shmid) {
m_shmid = shmid;
m_initialized = true;
}
shm_remove() : m_shmid(INT_MIN), m_initialized(false) {}
~shm_remove(){
if(m_initialized) {
SimpleLogger().Write(logDEBUG) <<
"automatic memory deallocation";
if(!boost::interprocess::xsi_shared_memory::remove(m_shmid)) {
SimpleLogger().Write(logDEBUG) << "could not deallocate id " << m_shmid;
}
}
}
};
public:
void * Ptr() const {
return region.get_address();
}
template<typename IdentifierT >
SharedMemory(
const boost::filesystem::path & lock_file,
const IdentifierT id,
const uint64_t size = 0,
bool read_write = false,
bool remove_prev = true
) : key(
lock_file.string().c_str(),
id
) {
if( 0 == size ){ //read_only
shm = boost::interprocess::xsi_shared_memory (
boost::interprocess::open_only,
key
);
region = boost::interprocess::mapped_region (
shm,
(
read_write ?
boost::interprocess::read_write :
boost::interprocess::read_only
)
);
} else { //writeable pointer
//remove previously allocated mem
if( remove_prev ) {
Remove(key);
}
shm = boost::interprocess::xsi_shared_memory (
boost::interprocess::open_or_create,
key,
size
);
#ifdef __linux__
if( -1 == shmctl(shm.get_shmid(), SHM_LOCK, 0) ) {
if( ENOMEM == errno ) {
SimpleLogger().Write(logWARNING) <<
"could not lock shared memory to RAM";
}
}
#endif
region = boost::interprocess::mapped_region (
shm,
boost::interprocess::read_write
);
remover.SetID( shm.get_shmid() );
SimpleLogger().Write(logDEBUG) <<
"writeable memory allocated " << size << " bytes";
}
}
template<typename IdentifierT >
static bool RegionExists(
const IdentifierT id
) {
bool result = true;
try {
OSRMLockFile lock_file;
boost::interprocess::xsi_key key( lock_file().string().c_str(), id );
result = RegionExists(key);
} catch(...) {
result = false;
}
return result;
}
template<typename IdentifierT >
static bool Remove(
const IdentifierT id
) {
OSRMLockFile lock_file;
boost::interprocess::xsi_key key( lock_file().string().c_str(), id );
return Remove(key);
}
private:
static bool RegionExists( const boost::interprocess::xsi_key &key ) {
bool result = true;
try {
boost::interprocess::xsi_shared_memory shm(
boost::interprocess::open_only,
key
);
} catch(...) {
result = false;
}
return result;
}
static bool Remove(
const boost::interprocess::xsi_key &key
) {
bool ret = false;
try{
SimpleLogger().Write(logDEBUG) << "deallocating prev memory";
boost::interprocess::xsi_shared_memory xsi(
boost::interprocess::open_only,
key
);
ret = boost::interprocess::xsi_shared_memory::remove(xsi.get_shmid());
} catch(const boost::interprocess::interprocess_exception &e){
if(e.get_error_code() != boost::interprocess::not_found_error) {
throw;
}
}
return ret;
}
boost::interprocess::xsi_key key;
boost::interprocess::xsi_shared_memory shm;
boost::interprocess::mapped_region region;
shm_remove remover;
};
template<class LockFileT = OSRMLockFile>
class SharedMemoryFactory_tmpl : boost::noncopyable {
public:
template<typename IdentifierT >
static SharedMemory * Get(
const IdentifierT & id,
const uint64_t size = 0,
bool read_write = false,
bool remove_prev = true
) {
try {
LockFileT lock_file;
if(!boost::filesystem::exists(lock_file()) ) {
if( 0 == size ) {
throw OSRMException("lock file does not exist, exiting");
} else {
boost::filesystem::ofstream ofs(lock_file());
ofs.close();
}
}
return new SharedMemory(
lock_file(),
id,
size,
read_write,
remove_prev
);
} catch(const boost::interprocess::interprocess_exception &e){
SimpleLogger().Write(logWARNING) <<
"caught exception: " << e.what() <<
", code " << e.get_error_code();
throw OSRMException(e.what());
}
}
private:
SharedMemoryFactory_tmpl() {}
};
typedef SharedMemoryFactory_tmpl<> SharedMemoryFactory;
#endif /* SHARED_MEMORY_POINTER_FACTORY_H */
-139
View File
@@ -1,139 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SHARED_MEMORY_VECTOR_WRAPPER_H
#define SHARED_MEMORY_VECTOR_WRAPPER_H
#include "../Util/SimpleLogger.h"
#include <boost/assert.hpp>
#include <boost/type_traits.hpp>
#include <algorithm>
#include <iterator>
#include <vector>
template<typename DataT>
class ShMemIterator : public std::iterator<std::input_iterator_tag, DataT> {
DataT * p;
public:
ShMemIterator(DataT * x) : p(x) {}
ShMemIterator(const ShMemIterator & mit) : p(mit.p) {}
ShMemIterator& operator++() {
++p;
return *this;
}
ShMemIterator operator++(int) {
ShMemIterator tmp(*this);
operator++();
return tmp;
}
ShMemIterator operator+(std::ptrdiff_t diff) {
ShMemIterator tmp(p+diff);
return tmp;
}
bool operator==(const ShMemIterator& rhs) {
return p==rhs.p;
}
bool operator!=(const ShMemIterator& rhs) {
return p!=rhs.p;
}
DataT& operator*() {
return *p;
}
};
template<typename DataT>
class SharedMemoryWrapper {
private:
DataT * m_ptr;
std::size_t m_size;
public:
SharedMemoryWrapper() :
m_ptr(NULL),
m_size(0)
{ }
SharedMemoryWrapper(DataT * ptr, std::size_t size) :
m_ptr(ptr),
m_size(size)
{ }
void swap( SharedMemoryWrapper<DataT> & other ) {
BOOST_ASSERT_MSG(m_size != 0 || other.size() != 0, "size invalid");
std::swap( m_size, other.m_size);
std::swap( m_ptr , other.m_ptr );
}
// void SetData(const DataT * ptr, const std::size_t size) {
// BOOST_ASSERT_MSG( 0 == m_size, "vector not empty");
// BOOST_ASSERT_MSG( 0 < size , "new vector empty");
// m_ptr.reset(ptr);
// m_size = size;
// }
DataT & at(const std::size_t index) {
return m_ptr[index];
}
const DataT & at(const std::size_t index) const {
return m_ptr[index];
}
ShMemIterator<DataT> begin() const {
return ShMemIterator<DataT>(m_ptr);
}
ShMemIterator<DataT> end() const {
return ShMemIterator<DataT>(m_ptr+m_size);
}
std::size_t size() const { return m_size; }
DataT & operator[](const unsigned index) {
BOOST_ASSERT_MSG(index < m_size, "invalid size");
return m_ptr[index];
}
const DataT & operator[](const unsigned index) const {
BOOST_ASSERT_MSG(index < m_size, "invalid size");
return m_ptr[index];
}
};
template<typename DataT, bool UseSharedMemory>
struct ShM {
typedef typename boost::conditional<
UseSharedMemory,
SharedMemoryWrapper<DataT>,
std::vector<DataT>
>::type vector;
};
#endif //SHARED_MEMORY_VECTOR_WRAPPER_H
-204
View File
@@ -1,204 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef STATICGRAPH_H_INCLUDED
#define STATICGRAPH_H_INCLUDED
#include "../DataStructures/Percent.h"
#include "../DataStructures/SharedMemoryVectorWrapper.h"
#include "../Util/SimpleLogger.h"
#include "../typedefs.h"
#include <algorithm>
#include <vector>
template< typename EdgeDataT, bool UseSharedMemory = false>
class StaticGraph {
public:
typedef NodeID NodeIterator;
typedef NodeID EdgeIterator;
typedef EdgeDataT EdgeData;
class InputEdge {
public:
EdgeDataT data;
NodeIterator source;
NodeIterator target;
bool operator<( const InputEdge& right ) const {
if ( source != right.source ) {
return source < right.source;
}
return target < right.target;
}
};
struct _StrNode {
//index of the first edge
EdgeIterator firstEdge;
};
struct _StrEdge {
NodeID target;
EdgeDataT data;
};
StaticGraph( const int nodes, std::vector< InputEdge > &graph ) {
std::sort( graph.begin(), graph.end() );
_numNodes = nodes;
_numEdges = ( EdgeIterator ) graph.size();
_nodes.resize( _numNodes + 1);
EdgeIterator edge = 0;
EdgeIterator position = 0;
for ( NodeIterator node = 0; node <= _numNodes; ++node ) {
EdgeIterator lastEdge = edge;
while ( edge < _numEdges && graph[edge].source == node )
++edge;
_nodes[node].firstEdge = position; //=edge
position += edge - lastEdge; //remove
}
_edges.resize( position ); //(edge)
edge = 0;
for ( NodeIterator node = 0; node < _numNodes; ++node ) {
for ( EdgeIterator i = _nodes[node].firstEdge, e = _nodes[node+1].firstEdge; i != e; ++i ) {
_edges[i].target = graph[edge].target;
_edges[i].data = graph[edge].data;
assert(_edges[i].data.distance > 0);
edge++;
}
}
}
StaticGraph(
typename ShM<_StrNode, UseSharedMemory>::vector & nodes,
typename ShM<_StrEdge, UseSharedMemory>::vector & edges
) {
_numNodes = nodes.size()-1;
_numEdges = edges.size();
_nodes.swap(nodes);
_edges.swap(edges);
#ifndef NDEBUG
Percent p(GetNumberOfNodes());
for(unsigned u = 0; u < GetNumberOfNodes(); ++u) {
for(unsigned eid = BeginEdges(u); eid < EndEdges(u); ++eid) {
unsigned v = GetTarget(eid);
EdgeData & data = GetEdgeData(eid);
if(data.shortcut) {
unsigned eid2 = FindEdgeInEitherDirection(u, data.id);
if(eid2 == UINT_MAX) {
SimpleLogger().Write(logWARNING) <<
"cannot find first segment of edge (" <<
u << "," << data.id << "," << v << ")";
data.shortcut = false;
}
eid2 = FindEdgeInEitherDirection(data.id, v);
if(eid2 == UINT_MAX) {
SimpleLogger().Write(logWARNING) <<
"cannot find second segment of edge (" <<
u << "," << data.id << "," << v << ")";
data.shortcut = false;
}
}
}
p.printIncrement();
}
#endif
}
unsigned GetNumberOfNodes() const {
return _numNodes;
}
unsigned GetNumberOfEdges() const {
return _numEdges;
}
unsigned GetOutDegree( const NodeIterator n ) const {
return BeginEdges(n)-EndEdges(n) - 1;
}
inline NodeIterator GetTarget( const EdgeIterator e ) const {
return NodeIterator( _edges[e].target );
}
inline EdgeDataT &GetEdgeData( const EdgeIterator e ) {
return _edges[e].data;
}
const EdgeDataT &GetEdgeData( const EdgeIterator e ) const {
return _edges[e].data;
}
EdgeIterator BeginEdges( const NodeIterator n ) const {
return EdgeIterator( _nodes[n].firstEdge );
}
EdgeIterator EndEdges( const NodeIterator n ) const {
return EdgeIterator( _nodes[n+1].firstEdge );
}
//searches for a specific edge
EdgeIterator FindEdge( const NodeIterator from, const NodeIterator to ) const {
EdgeIterator smallestEdge = SPECIAL_EDGEID;
EdgeWeight smallestWeight = UINT_MAX;
for ( EdgeIterator edge = BeginEdges( from ); edge < EndEdges(from); edge++ ) {
const NodeID target = GetTarget(edge);
const EdgeWeight weight = GetEdgeData(edge).distance;
if(target == to && weight < smallestWeight) {
smallestEdge = edge; smallestWeight = weight;
}
}
return smallestEdge;
}
EdgeIterator FindEdgeInEitherDirection( const NodeIterator from, const NodeIterator to ) const {
EdgeIterator tmp = FindEdge( from, to );
return (UINT_MAX != tmp ? tmp : FindEdge( to, from ));
}
EdgeIterator FindEdgeIndicateIfReverse( const NodeIterator from, const NodeIterator to, bool & result ) const {
EdgeIterator tmp = FindEdge( from, to );
if(UINT_MAX == tmp) {
tmp = FindEdge( to, from );
if(UINT_MAX != tmp) {
result = true;
}
}
return tmp;
}
private:
NodeIterator _numNodes;
EdgeIterator _numEdges;
typename ShM< _StrNode, UseSharedMemory >::vector _nodes;
typename ShM< _StrEdge, UseSharedMemory >::vector _edges;
};
#endif // STATICGRAPH_H_INCLUDED
-230
View File
@@ -1,230 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// KD Tree coded by Christian Vetter, Monav Project
#ifndef STATICKDTREE_H_INCLUDED
#define STATICKDTREE_H_INCLUDED
#include <boost/assert.hpp>
#include <vector>
#include <algorithm>
#include <stack>
#include <limits>
namespace KDTree {
#define KDTREE_BASESIZE (8)
template< unsigned k, typename T >
class BoundingBox {
public:
BoundingBox() {
for ( unsigned dim = 0; dim < k; ++dim ) {
min[dim] = std::numeric_limits< T >::min();
max[dim] = std::numeric_limits< T >::max();
}
}
T min[k];
T max[k];
};
struct NoData {};
template< unsigned k, typename T >
class EuclidianMetric {
public:
double operator() ( const T left[k], const T right[k] ) {
double result = 0;
for ( unsigned i = 0; i < k; ++i ) {
double temp = (double)left[i] - (double)right[i];
result += temp * temp;
}
return result;
}
double operator() ( const BoundingBox< k, T > &box, const T point[k] ) {
T nearest[k];
for ( unsigned dim = 0; dim < k; ++dim ) {
if ( point[dim] < box.min[dim] )
nearest[dim] = box.min[dim];
else if ( point[dim] > box.max[dim] )
nearest[dim] = box.max[dim];
else
nearest[dim] = point[dim];
}
return operator() ( point, nearest );
}
};
template < unsigned k, typename T, typename Data = NoData, typename Metric = EuclidianMetric< k, T > >
class StaticKDTree {
public:
struct InputPoint {
T coordinates[k];
Data data;
bool operator==( const InputPoint& right )
{
for ( int i = 0; i < k; i++ ) {
if ( coordinates[i] != right.coordinates[i] )
return false;
}
return true;
}
};
StaticKDTree( std::vector< InputPoint > * points ){
BOOST_ASSERT( k > 0 );
BOOST_ASSERT ( points->size() > 0 );
size = points->size();
kdtree = new InputPoint[size];
for ( Iterator i = 0; i != size; ++i ) {
kdtree[i] = points->at(i);
for ( unsigned dim = 0; dim < k; ++dim ) {
if ( kdtree[i].coordinates[dim] < boundingBox.min[dim] )
boundingBox.min[dim] = kdtree[i].coordinates[dim];
if ( kdtree[i].coordinates[dim] > boundingBox.max[dim] )
boundingBox.max[dim] = kdtree[i].coordinates[dim];
}
}
std::stack< Tree > s;
s.push ( Tree ( 0, size, 0 ) );
while ( !s.empty() ) {
Tree tree = s.top();
s.pop();
if ( tree.right - tree.left < KDTREE_BASESIZE )
continue;
Iterator middle = tree.left + ( tree.right - tree.left ) / 2;
std::nth_element( kdtree + tree.left, kdtree + middle, kdtree + tree.right, Less( tree.dimension ) );
s.push( Tree( tree.left, middle, ( tree.dimension + 1 ) % k ) );
s.push( Tree( middle + 1, tree.right, ( tree.dimension + 1 ) % k ) );
}
}
~StaticKDTree(){
delete[] kdtree;
}
bool NearestNeighbor( InputPoint* result, const InputPoint& point ) {
Metric distance;
bool found = false;
double nearestDistance = std::numeric_limits< T >::max();
std::stack< NNTree > s;
s.push ( NNTree ( 0, size, 0, boundingBox ) );
while ( !s.empty() ) {
NNTree tree = s.top();
s.pop();
if ( distance( tree.box, point.coordinates ) >= nearestDistance )
continue;
if ( tree.right - tree.left < KDTREE_BASESIZE ) {
for ( unsigned i = tree.left; i < tree.right; i++ ) {
double newDistance = distance( kdtree[i].coordinates, point.coordinates );
if ( newDistance < nearestDistance ) {
nearestDistance = newDistance;
*result = kdtree[i];
found = true;
}
}
continue;
}
Iterator middle = tree.left + ( tree.right - tree.left ) / 2;
double newDistance = distance( kdtree[middle].coordinates, point.coordinates );
if ( newDistance < nearestDistance ) {
nearestDistance = newDistance;
*result = kdtree[middle];
found = true;
}
Less comperator( tree.dimension );
if ( !comperator( point, kdtree[middle] ) ) {
NNTree first( middle + 1, tree.right, ( tree.dimension + 1 ) % k, tree.box );
NNTree second( tree.left, middle, ( tree.dimension + 1 ) % k, tree.box );
first.box.min[tree.dimension] = kdtree[middle].coordinates[tree.dimension];
second.box.max[tree.dimension] = kdtree[middle].coordinates[tree.dimension];
s.push( second );
s.push( first );
}
else {
NNTree first( middle + 1, tree.right, ( tree.dimension + 1 ) % k, tree.box );
NNTree second( tree.left, middle, ( tree.dimension + 1 ) % k, tree.box );
first.box.min[tree.dimension] = kdtree[middle].coordinates[tree.dimension];
second.box.max[tree.dimension] = kdtree[middle].coordinates[tree.dimension];
s.push( first );
s.push( second );
}
}
return found;
}
private:
typedef unsigned Iterator;
struct Tree {
Iterator left;
Iterator right;
unsigned dimension;
Tree() {}
Tree( Iterator l, Iterator r, unsigned d ): left( l ), right( r ), dimension( d ) {}
};
struct NNTree {
Iterator left;
Iterator right;
unsigned dimension;
BoundingBox< k, T > box;
NNTree() {}
NNTree( Iterator l, Iterator r, unsigned d, const BoundingBox< k, T >& b ): left( l ), right( r ), dimension( d ), box ( b ) {}
};
class Less {
public:
Less( unsigned d ) {
dimension = d;
BOOST_ASSERT( dimension < k );
}
bool operator() ( const InputPoint& left, const InputPoint& right ) {
BOOST_ASSERT( dimension < k );
return left.coordinates[dimension] < right.coordinates[dimension];
}
private:
unsigned dimension;
};
BoundingBox< k, T > boundingBox;
InputPoint* kdtree;
Iterator size;
};
}
#endif // STATICKDTREE_H_INCLUDED
-975
View File
@@ -1,975 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef STATICRTREE_H_
#define STATICRTREE_H_
#include "Coordinate.h"
#include "DeallocatingVector.h"
#include "HilbertValue.h"
#include "MercatorUtil.h"
#include "PhantomNodes.h"
#include "SharedMemoryFactory.h"
#include "SharedMemoryVectorWrapper.h"
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
#include "../Util/TimingUtil.h"
#include "../typedefs.h"
#include <boost/assert.hpp>
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/algorithm/minmax.hpp>
#include <boost/algorithm/minmax_element.hpp>
#include <boost/range/algorithm_ext/erase.hpp>
#include <boost/noncopyable.hpp>
#include <boost/thread.hpp>
#include <boost/type_traits.hpp>
#include <algorithm>
#include <limits>
#include <queue>
#include <string>
#include <vector>
//tuning parameters
const static uint32_t RTREE_BRANCHING_FACTOR = 50;
const static uint32_t RTREE_LEAF_NODE_SIZE = 1170;
// Implements a static, i.e. packed, R-tree
static boost::thread_specific_ptr<boost::filesystem::ifstream> thread_local_rtree_stream;
template<class DataT, bool UseSharedMemory = false>
class StaticRTree : boost::noncopyable {
public:
struct RectangleInt2D {
RectangleInt2D() :
min_lon(INT_MAX),
max_lon(INT_MIN),
min_lat(INT_MAX),
max_lat(INT_MIN) {}
int32_t min_lon, max_lon;
int32_t min_lat, max_lat;
inline void InitializeMBRectangle(
const DataT * objects,
const uint32_t element_count
) {
for(uint32_t i = 0; i < element_count; ++i) {
min_lon = std::min(
min_lon, std::min(objects[i].lon1, objects[i].lon2)
);
max_lon = std::max(
max_lon, std::max(objects[i].lon1, objects[i].lon2)
);
min_lat = std::min(
min_lat, std::min(objects[i].lat1, objects[i].lat2)
);
max_lat = std::max(
max_lat, std::max(objects[i].lat1, objects[i].lat2)
);
}
}
inline void AugmentMBRectangle(const RectangleInt2D & other) {
min_lon = std::min(min_lon, other.min_lon);
max_lon = std::max(max_lon, other.max_lon);
min_lat = std::min(min_lat, other.min_lat);
max_lat = std::max(max_lat, other.max_lat);
}
inline FixedPointCoordinate Centroid() const {
FixedPointCoordinate centroid;
//The coordinates of the midpoints are given by:
//x = (x1 + x2) /2 and y = (y1 + y2) /2.
centroid.lon = (min_lon + max_lon)/2;
centroid.lat = (min_lat + max_lat)/2;
return centroid;
}
inline bool Intersects(const RectangleInt2D & other) const {
FixedPointCoordinate upper_left (other.max_lat, other.min_lon);
FixedPointCoordinate upper_right(other.max_lat, other.max_lon);
FixedPointCoordinate lower_right(other.min_lat, other.max_lon);
FixedPointCoordinate lower_left (other.min_lat, other.min_lon);
return (
Contains(upper_left)
|| Contains(upper_right)
|| Contains(lower_right)
|| Contains(lower_left)
);
}
inline double GetMinDist(const FixedPointCoordinate & location) const {
bool is_contained = Contains(location);
if (is_contained) {
return 0.0;
}
double min_dist = std::numeric_limits<double>::max();
min_dist = std::min(
min_dist,
ApproximateDistance(
location.lat,
location.lon,
max_lat,
min_lon
)
);
min_dist = std::min(
min_dist,
ApproximateDistance(
location.lat,
location.lon,
max_lat,
max_lon
)
);
min_dist = std::min(
min_dist,
ApproximateDistance(
location.lat,
location.lon,
min_lat,
max_lon
)
);
min_dist = std::min(
min_dist,
ApproximateDistance(
location.lat,
location.lon,
min_lat,
min_lon
)
);
return min_dist;
}
inline double GetMinMaxDist(const FixedPointCoordinate & location) const {
double min_max_dist = std::numeric_limits<double>::max();
//Get minmax distance to each of the four sides
FixedPointCoordinate upper_left (max_lat, min_lon);
FixedPointCoordinate upper_right(max_lat, max_lon);
FixedPointCoordinate lower_right(min_lat, max_lon);
FixedPointCoordinate lower_left (min_lat, min_lon);
min_max_dist = std::min(
min_max_dist,
std::max(
ApproximateDistance(location, upper_left ),
ApproximateDistance(location, upper_right)
)
);
min_max_dist = std::min(
min_max_dist,
std::max(
ApproximateDistance(location, upper_right),
ApproximateDistance(location, lower_right)
)
);
min_max_dist = std::min(
min_max_dist,
std::max(
ApproximateDistance(location, lower_right),
ApproximateDistance(location, lower_left )
)
);
min_max_dist = std::min(
min_max_dist,
std::max(
ApproximateDistance(location, lower_left ),
ApproximateDistance(location, upper_left )
)
);
return min_max_dist;
}
inline bool Contains(const FixedPointCoordinate & location) const {
bool lats_contained =
(location.lat > min_lat) && (location.lat < max_lat);
bool lons_contained =
(location.lon > min_lon) && (location.lon < max_lon);
return lats_contained && lons_contained;
}
inline friend std::ostream & operator<< (
std::ostream & out,
const RectangleInt2D & rect
) {
out << rect.min_lat/COORDINATE_PRECISION << ","
<< rect.min_lon/COORDINATE_PRECISION << " "
<< rect.max_lat/COORDINATE_PRECISION << ","
<< rect.max_lon/COORDINATE_PRECISION;
return out;
}
};
typedef RectangleInt2D RectangleT;
struct TreeNode {
TreeNode() : child_count(0), child_is_on_disk(false) {}
RectangleT minimum_bounding_rectangle;
uint32_t child_count:31;
bool child_is_on_disk:1;
uint32_t children[RTREE_BRANCHING_FACTOR];
};
private:
struct WrappedInputElement {
explicit WrappedInputElement(
const uint32_t _array_index,
const uint64_t _hilbert_value
) : m_array_index(_array_index), m_hilbert_value(_hilbert_value) {}
WrappedInputElement() : m_array_index(UINT_MAX), m_hilbert_value(0) {}
uint32_t m_array_index;
uint64_t m_hilbert_value;
inline bool operator<(const WrappedInputElement & other) const {
return m_hilbert_value < other.m_hilbert_value;
}
};
struct LeafNode {
LeafNode() : object_count(0) {}
uint32_t object_count;
DataT objects[RTREE_LEAF_NODE_SIZE];
};
struct QueryCandidate {
explicit QueryCandidate(
const uint32_t n_id,
const double dist
) : node_id(n_id), min_dist(dist) {}
QueryCandidate() : node_id(UINT_MAX), min_dist(std::numeric_limits<double>::max()) {}
uint32_t node_id;
double min_dist;
inline bool operator<(const QueryCandidate & other) const {
return min_dist < other.min_dist;
}
};
typename ShM<TreeNode, UseSharedMemory>::vector m_search_tree;
uint64_t m_element_count;
const std::string m_leaf_node_filename;
public:
//Construct a packed Hilbert-R-Tree with Kamel-Faloutsos algorithm [1]
explicit StaticRTree(
std::vector<DataT> & input_data_vector,
const std::string tree_node_filename,
const std::string leaf_node_filename
)
: m_element_count(input_data_vector.size()),
m_leaf_node_filename(leaf_node_filename)
{
SimpleLogger().Write() <<
"constructing r-tree of " << m_element_count <<
" elements";
double time1 = get_timestamp();
std::vector<WrappedInputElement> input_wrapper_vector(m_element_count);
//generate auxiliary vector of hilbert-values
#pragma omp parallel for schedule(guided)
for(uint64_t element_counter = 0; element_counter < m_element_count; ++element_counter) {
input_wrapper_vector[element_counter].m_array_index = element_counter;
//Get Hilbert-Value for centroid in mercartor projection
DataT & current_element = input_data_vector[element_counter];
FixedPointCoordinate current_centroid = current_element.Centroid();
current_centroid.lat = COORDINATE_PRECISION*lat2y(current_centroid.lat/COORDINATE_PRECISION);
uint64_t current_hilbert_value = HilbertCode::GetHilbertNumberForCoordinate(current_centroid);
input_wrapper_vector[element_counter].m_hilbert_value = current_hilbert_value;
}
//open leaf file
boost::filesystem::ofstream leaf_node_file(leaf_node_filename, std::ios::binary);
leaf_node_file.write((char*) &m_element_count, sizeof(uint64_t));
//sort the hilbert-value representatives
std::sort(input_wrapper_vector.begin(), input_wrapper_vector.end());
std::vector<TreeNode> tree_nodes_in_level;
//pack M elements into leaf node and write to leaf file
uint64_t processed_objects_count = 0;
while(processed_objects_count < m_element_count) {
LeafNode current_leaf;
TreeNode current_node;
for(uint32_t current_element_index = 0; RTREE_LEAF_NODE_SIZE > current_element_index; ++current_element_index) {
if(m_element_count > (processed_objects_count + current_element_index)) {
uint32_t index_of_next_object = input_wrapper_vector[processed_objects_count + current_element_index].m_array_index;
current_leaf.objects[current_element_index] = input_data_vector[index_of_next_object];
++current_leaf.object_count;
}
}
//generate tree node that resemble the objects in leaf and store it for next level
current_node.minimum_bounding_rectangle.InitializeMBRectangle(current_leaf.objects, current_leaf.object_count);
current_node.child_is_on_disk = true;
current_node.children[0] = tree_nodes_in_level.size();
tree_nodes_in_level.push_back(current_node);
//write leaf_node to leaf node file
leaf_node_file.write((char*)&current_leaf, sizeof(current_leaf));
processed_objects_count += current_leaf.object_count;
}
//close leaf file
leaf_node_file.close();
uint32_t processing_level = 0;
while(1 < tree_nodes_in_level.size()) {
std::vector<TreeNode> tree_nodes_in_next_level;
uint32_t processed_tree_nodes_in_level = 0;
while(processed_tree_nodes_in_level < tree_nodes_in_level.size()) {
TreeNode parent_node;
//pack RTREE_BRANCHING_FACTOR elements into tree_nodes each
for(
uint32_t current_child_node_index = 0;
RTREE_BRANCHING_FACTOR > current_child_node_index;
++current_child_node_index
) {
if(processed_tree_nodes_in_level < tree_nodes_in_level.size()) {
TreeNode & current_child_node = tree_nodes_in_level[processed_tree_nodes_in_level];
//add tree node to parent entry
parent_node.children[current_child_node_index] = m_search_tree.size();
m_search_tree.push_back(current_child_node);
//augment MBR of parent
parent_node.minimum_bounding_rectangle.AugmentMBRectangle(current_child_node.minimum_bounding_rectangle);
//increase counters
++parent_node.child_count;
++processed_tree_nodes_in_level;
}
}
tree_nodes_in_next_level.push_back(parent_node);
}
tree_nodes_in_level.swap(tree_nodes_in_next_level);
++processing_level;
}
BOOST_ASSERT_MSG(1 == tree_nodes_in_level.size(), "tree broken, more than one root node");
//last remaining entry is the root node, store it
m_search_tree.push_back(tree_nodes_in_level[0]);
//reverse and renumber tree to have root at index 0
std::reverse(m_search_tree.begin(), m_search_tree.end());
#pragma omp parallel for schedule(guided)
for(uint32_t i = 0; i < m_search_tree.size(); ++i) {
TreeNode & current_tree_node = m_search_tree[i];
for(uint32_t j = 0; j < current_tree_node.child_count; ++j) {
const uint32_t old_id = current_tree_node.children[j];
const uint32_t new_id = m_search_tree.size() - old_id - 1;
current_tree_node.children[j] = new_id;
}
}
//open tree file
boost::filesystem::ofstream tree_node_file(
tree_node_filename,
std::ios::binary
);
uint32_t size_of_tree = m_search_tree.size();
BOOST_ASSERT_MSG(0 < size_of_tree, "tree empty");
tree_node_file.write((char *)&size_of_tree, sizeof(uint32_t));
tree_node_file.write((char *)&m_search_tree[0], sizeof(TreeNode)*size_of_tree);
//close tree node file.
tree_node_file.close();
double time2 = get_timestamp();
SimpleLogger().Write() <<
"finished r-tree construction in " << (time2-time1) << " seconds";
}
//Read-only operation for queries
explicit StaticRTree(
const boost::filesystem::path & node_file,
const boost::filesystem::path & leaf_file
) : m_leaf_node_filename(leaf_file.string()) {
//open tree node file and load into RAM.
if ( !boost::filesystem::exists( node_file ) ) {
throw OSRMException("ram index file does not exist");
}
if ( 0 == boost::filesystem::file_size( node_file ) ) {
throw OSRMException("ram index file is empty");
}
boost::filesystem::ifstream tree_node_file( node_file, std::ios::binary );
uint32_t tree_size = 0;
tree_node_file.read((char*)&tree_size, sizeof(uint32_t));
//SimpleLogger().Write() << "reading " << tree_size << " tree nodes in " << (sizeof(TreeNode)*tree_size) << " bytes";
m_search_tree.resize(tree_size);
tree_node_file.read((char*)&m_search_tree[0], sizeof(TreeNode)*tree_size);
tree_node_file.close();
//open leaf node file and store thread specific pointer
if ( !boost::filesystem::exists( leaf_file ) ) {
throw OSRMException("mem index file does not exist");
}
if ( 0 == boost::filesystem::file_size( leaf_file ) ) {
throw OSRMException("mem index file is empty");
}
boost::filesystem::ifstream leaf_node_file( leaf_file, std::ios::binary );
leaf_node_file.read((char*)&m_element_count, sizeof(uint64_t));
leaf_node_file.close();
//SimpleLogger().Write() << tree_size << " nodes in search tree";
//SimpleLogger().Write() << m_element_count << " elements in leafs";
}
explicit StaticRTree(
TreeNode * tree_node_ptr,
const uint32_t number_of_nodes,
const boost::filesystem::path & leaf_file
) : m_search_tree(tree_node_ptr, number_of_nodes),
m_leaf_node_filename(leaf_file.string())
{
//open leaf node file and store thread specific pointer
if ( !boost::filesystem::exists( leaf_file ) ) {
throw OSRMException("mem index file does not exist");
}
if ( 0 == boost::filesystem::file_size( leaf_file ) ) {
throw OSRMException("mem index file is empty");
}
boost::filesystem::ifstream leaf_node_file( leaf_file, std::ios::binary );
leaf_node_file.read((char*)&m_element_count, sizeof(uint64_t));
leaf_node_file.close();
if( thread_local_rtree_stream.get() ) {
thread_local_rtree_stream->close();
}
//SimpleLogger().Write() << tree_size << " nodes in search tree";
//SimpleLogger().Write() << m_element_count << " elements in leafs";
}
//Read-only operation for queries
/*
inline void FindKNearestPhantomNodesForCoordinate(
const FixedPointCoordinate & location,
const unsigned zoom_level,
const unsigned candidate_count,
std::vector<std::pair<PhantomNode, double> > & result_vector
) const {
bool ignore_tiny_components = (zoom_level <= 14);
DataT nearest_edge;
uint32_t io_count = 0;
uint32_t explored_tree_nodes_count = 0;
SimpleLogger().Write() << "searching for coordinate " << input_coordinate;
double min_dist = std::numeric_limits<double>::max();
double min_max_dist = std::numeric_limits<double>::max();
bool found_a_nearest_edge = false;
FixedPointCoordinate nearest, current_start_coordinate, current_end_coordinate;
//initialize queue with root element
std::priority_queue<QueryCandidate> traversal_queue;
traversal_queue.push(QueryCandidate(0, m_search_tree[0].minimum_bounding_rectangle.GetMinDist(input_coordinate)));
BOOST_ASSERT_MSG(std::numberic_limits<double>::epsilon() > (0. - traversal_queue.top().min_dist), "Root element in NN Search has min dist != 0.");
while(!traversal_queue.empty()) {
const QueryCandidate current_query_node = traversal_queue.top(); traversal_queue.pop();
++explored_tree_nodes_count;
bool prune_downward = (current_query_node.min_dist >= min_max_dist);
bool prune_upward = (current_query_node.min_dist >= min_dist);
if( !prune_downward && !prune_upward ) { //downward pruning
TreeNode & current_tree_node = m_search_tree[current_query_node.node_id];
if (current_tree_node.child_is_on_disk) {
LeafNode current_leaf_node;
LoadLeafFromDisk(current_tree_node.children[0], current_leaf_node);
++io_count;
for(uint32_t i = 0; i < current_leaf_node.object_count; ++i) {
DataT & current_edge = current_leaf_node.objects[i];
if(ignore_tiny_components && current_edge.belongsToTinyComponent) {
continue;
}
double current_ratio = 0.;
double current_perpendicular_distance = ComputePerpendicularDistance(
input_coordinate,
FixedPointCoordinate(current_edge.lat1, current_edge.lon1),
FixedPointCoordinate(current_edge.lat2, current_edge.lon2),
nearest,
&current_ratio
);
if(
current_perpendicular_distance < min_dist
&& !DoubleEpsilonCompare(
current_perpendicular_distance,
min_dist
)
) { //found a new minimum
min_dist = current_perpendicular_distance;
result_phantom_node.edgeBasedNode = current_edge.id;
result_phantom_node.nodeBasedEdgeNameID = current_edge.nameID;
result_phantom_node.weight1 = current_edge.weight;
result_phantom_node.weight2 = INT_MAX;
result_phantom_node.location = nearest;
current_start_coordinate.lat = current_edge.lat1;
current_start_coordinate.lon = current_edge.lon1;
current_end_coordinate.lat = current_edge.lat2;
current_end_coordinate.lon = current_edge.lon2;
nearest_edge = current_edge;
found_a_nearest_edge = true;
} else if(
DoubleEpsilonCompare(current_perpendicular_distance, min_dist) &&
1 == abs(current_edge.id - result_phantom_node.edgeBasedNode )
&& CoordinatesAreEquivalent(
current_start_coordinate,
FixedPointCoordinate(
current_edge.lat1,
current_edge.lon1
),
FixedPointCoordinate(
current_edge.lat2,
current_edge.lon2
),
current_end_coordinate
)
) {
result_phantom_node.edgeBasedNode = std::min(current_edge.id, result_phantom_node.edgeBasedNode);
result_phantom_node.weight2 = current_edge.weight;
}
}
} else {
//traverse children, prune if global mindist is smaller than local one
for (uint32_t i = 0; i < current_tree_node.child_count; ++i) {
const int32_t child_id = current_tree_node.children[i];
TreeNode & child_tree_node = m_search_tree[child_id];
RectangleT & child_rectangle = child_tree_node.minimum_bounding_rectangle;
const double current_min_dist = child_rectangle.GetMinDist(input_coordinate);
const double current_min_max_dist = child_rectangle.GetMinMaxDist(input_coordinate);
if( current_min_max_dist < min_max_dist ) {
min_max_dist = current_min_max_dist;
}
if (current_min_dist > min_max_dist) {
continue;
}
if (current_min_dist > min_dist) { //upward pruning
continue;
}
traversal_queue.push(QueryCandidate(child_id, current_min_dist));
}
}
}
}
const double distance_to_edge =
ApproximateDistance (
FixedPointCoordinate(nearest_edge.lat1, nearest_edge.lon1),
result_phantom_node.location
);
const double length_of_edge =
ApproximateDistance(
FixedPointCoordinate(nearest_edge.lat1, nearest_edge.lon1),
FixedPointCoordinate(nearest_edge.lat2, nearest_edge.lon2)
);
const double ratio = (found_a_nearest_edge ?
std::min(1., distance_to_edge/ length_of_edge ) : 0 );
result_phantom_node.weight1 *= ratio;
if(INT_MAX != result_phantom_node.weight2) {
result_phantom_node.weight2 *= (1.-ratio);
}
result_phantom_node.ratio = ratio;
//Hack to fix rounding errors and wandering via nodes.
if(std::abs(input_coordinate.lon - result_phantom_node.location.lon) == 1) {
result_phantom_node.location.lon = input_coordinate.lon;
}
if(std::abs(input_coordinate.lat - result_phantom_node.location.lat) == 1) {
result_phantom_node.location.lat = input_coordinate.lat;
}
SimpleLogger().Write() << "mindist: " << min_distphantom_node.isBidirected() ? "yes" : "no");
return found_a_nearest_edge;
}
*/
bool LocateClosestEndPointForCoordinate(
const FixedPointCoordinate & input_coordinate,
FixedPointCoordinate & result_coordinate,
const unsigned zoom_level
) {
bool ignore_tiny_components = (zoom_level <= 14);
DataT nearest_edge;
double min_dist = std::numeric_limits<double>::max();
double min_max_dist = std::numeric_limits<double>::max();
bool found_a_nearest_edge = false;
//initialize queue with root element
std::priority_queue<QueryCandidate> traversal_queue;
double current_min_dist = m_search_tree[0].minimum_bounding_rectangle.GetMinDist(input_coordinate);
traversal_queue.push(
QueryCandidate(0, current_min_dist)
);
BOOST_ASSERT_MSG(
std::numeric_limits<double>::epsilon() > (0. - traversal_queue.top().min_dist),
"Root element in NN Search has min dist != 0."
);
while(!traversal_queue.empty()) {
const QueryCandidate current_query_node = traversal_queue.top();
traversal_queue.pop();
const bool prune_downward = (current_query_node.min_dist >= min_max_dist);
const bool prune_upward = (current_query_node.min_dist >= min_dist);
if( !prune_downward && !prune_upward ) { //downward pruning
TreeNode & current_tree_node = m_search_tree[current_query_node.node_id];
if (current_tree_node.child_is_on_disk) {
LeafNode current_leaf_node;
LoadLeafFromDisk(
current_tree_node.children[0],
current_leaf_node
);
for(uint32_t i = 0; i < current_leaf_node.object_count; ++i) {
const DataT & current_edge = current_leaf_node.objects[i];
if(
ignore_tiny_components &&
current_edge.belongsToTinyComponent
) {
continue;
}
if(current_edge.isIgnored()) {
continue;
}
double current_minimum_distance = ApproximateDistance(
input_coordinate.lat,
input_coordinate.lon,
current_edge.lat1,
current_edge.lon1
);
if( current_minimum_distance < min_dist ) {
//found a new minimum
min_dist = current_minimum_distance;
result_coordinate.lat = current_edge.lat1;
result_coordinate.lon = current_edge.lon1;
found_a_nearest_edge = true;
}
current_minimum_distance = ApproximateDistance(
input_coordinate.lat,
input_coordinate.lon,
current_edge.lat2,
current_edge.lon2
);
if( current_minimum_distance < min_dist ) {
//found a new minimum
min_dist = current_minimum_distance;
result_coordinate.lat = current_edge.lat2;
result_coordinate.lon = current_edge.lon2;
found_a_nearest_edge = true;
}
}
} else {
//traverse children, prune if global mindist is smaller than local one
for (uint32_t i = 0; i < current_tree_node.child_count; ++i) {
const int32_t child_id = current_tree_node.children[i];
const TreeNode & child_tree_node = m_search_tree[child_id];
const RectangleT & child_rectangle = child_tree_node.minimum_bounding_rectangle;
const double current_min_dist = child_rectangle.GetMinDist(input_coordinate);
const double current_min_max_dist = child_rectangle.GetMinMaxDist(input_coordinate);
if( current_min_max_dist < min_max_dist ) {
min_max_dist = current_min_max_dist;
}
if (current_min_dist > min_max_dist) {
continue;
}
if (current_min_dist > min_dist) { //upward pruning
continue;
}
traversal_queue.push(
QueryCandidate(child_id, current_min_dist)
);
}
}
}
}
return found_a_nearest_edge;
}
bool FindPhantomNodeForCoordinate(
const FixedPointCoordinate & input_coordinate,
PhantomNode & result_phantom_node,
const unsigned zoom_level
) {
bool ignore_tiny_components = (zoom_level <= 14);
DataT nearest_edge;
uint32_t io_count = 0;
uint32_t explored_tree_nodes_count = 0;
//SimpleLogger().Write() << "searching for coordinate " << input_coordinate;
double min_dist = std::numeric_limits<double>::max();
double min_max_dist = std::numeric_limits<double>::max();
bool found_a_nearest_edge = false;
FixedPointCoordinate nearest, current_start_coordinate, current_end_coordinate;
//initialize queue with root element
std::priority_queue<QueryCandidate> traversal_queue;
double current_min_dist = m_search_tree[0].minimum_bounding_rectangle.GetMinDist(input_coordinate);
traversal_queue.push(
QueryCandidate(0, current_min_dist)
);
BOOST_ASSERT_MSG(
std::numeric_limits<double>::epsilon() > (0. - traversal_queue.top().min_dist),
"Root element in NN Search has min dist != 0."
);
while(!traversal_queue.empty()) {
const QueryCandidate current_query_node = traversal_queue.top(); traversal_queue.pop();
++explored_tree_nodes_count;
bool prune_downward = (current_query_node.min_dist >= min_max_dist);
bool prune_upward = (current_query_node.min_dist >= min_dist);
if( !prune_downward && !prune_upward ) { //downward pruning
TreeNode & current_tree_node = m_search_tree[current_query_node.node_id];
if (current_tree_node.child_is_on_disk) {
LeafNode current_leaf_node;
LoadLeafFromDisk(current_tree_node.children[0], current_leaf_node);
++io_count;
for(uint32_t i = 0; i < current_leaf_node.object_count; ++i) {
DataT & current_edge = current_leaf_node.objects[i];
if(ignore_tiny_components && current_edge.belongsToTinyComponent) {
continue;
}
if(current_edge.isIgnored()) {
continue;
}
double current_ratio = 0.;
double current_perpendicular_distance = ComputePerpendicularDistance(
input_coordinate,
FixedPointCoordinate(current_edge.lat1, current_edge.lon1),
FixedPointCoordinate(current_edge.lat2, current_edge.lon2),
nearest,
&current_ratio
);
if(
current_perpendicular_distance < min_dist
&& !DoubleEpsilonCompare(
current_perpendicular_distance,
min_dist
)
) { //found a new minimum
min_dist = current_perpendicular_distance;
result_phantom_node.edgeBasedNode = current_edge.id;
result_phantom_node.nodeBasedEdgeNameID = current_edge.nameID;
result_phantom_node.weight1 = current_edge.weight;
result_phantom_node.weight2 = INT_MAX;
result_phantom_node.location = nearest;
current_start_coordinate.lat = current_edge.lat1;
current_start_coordinate.lon = current_edge.lon1;
current_end_coordinate.lat = current_edge.lat2;
current_end_coordinate.lon = current_edge.lon2;
nearest_edge = current_edge;
found_a_nearest_edge = true;
} else if(
DoubleEpsilonCompare(current_perpendicular_distance, min_dist) &&
1 == abs(current_edge.id - result_phantom_node.edgeBasedNode )
&& CoordinatesAreEquivalent(
current_start_coordinate,
FixedPointCoordinate(
current_edge.lat1,
current_edge.lon1
),
FixedPointCoordinate(
current_edge.lat2,
current_edge.lon2
),
current_end_coordinate
)
) {
BOOST_ASSERT_MSG(current_edge.id != result_phantom_node.edgeBasedNode, "IDs not different");
result_phantom_node.weight2 = current_edge.weight;
if(current_edge.id < result_phantom_node.edgeBasedNode) {
result_phantom_node.edgeBasedNode = current_edge.id;
std::swap(result_phantom_node.weight1, result_phantom_node.weight2);
std::swap(current_end_coordinate, current_start_coordinate);
}
}
}
} else {
//traverse children, prune if global mindist is smaller than local one
for (uint32_t i = 0; i < current_tree_node.child_count; ++i) {
const int32_t child_id = current_tree_node.children[i];
TreeNode & child_tree_node = m_search_tree[child_id];
RectangleT & child_rectangle = child_tree_node.minimum_bounding_rectangle;
const double current_min_dist = child_rectangle.GetMinDist(input_coordinate);
const double current_min_max_dist = child_rectangle.GetMinMaxDist(input_coordinate);
if( current_min_max_dist < min_max_dist ) {
min_max_dist = current_min_max_dist;
}
if (current_min_dist > min_max_dist) {
continue;
}
if (current_min_dist > min_dist) { //upward pruning
continue;
}
traversal_queue.push(QueryCandidate(child_id, current_min_dist));
}
}
}
}
const double ratio = (found_a_nearest_edge ?
std::min(1., ApproximateDistance(current_start_coordinate,
result_phantom_node.location)/ApproximateDistance(current_start_coordinate, current_end_coordinate)
) : 0
);
result_phantom_node.weight1 *= ratio;
if(INT_MAX != result_phantom_node.weight2) {
result_phantom_node.weight2 *= (1.-ratio);
}
result_phantom_node.ratio = ratio;
//Hack to fix rounding errors and wandering via nodes.
if(std::abs(input_coordinate.lon - result_phantom_node.location.lon) == 1) {
result_phantom_node.location.lon = input_coordinate.lon;
}
if(std::abs(input_coordinate.lat - result_phantom_node.location.lat) == 1) {
result_phantom_node.location.lat = input_coordinate.lat;
}
return found_a_nearest_edge;
}
private:
inline void LoadLeafFromDisk(const uint32_t leaf_id, LeafNode& result_node) {
if(
!thread_local_rtree_stream.get() ||
!thread_local_rtree_stream->is_open()
) {
thread_local_rtree_stream.reset(
new boost::filesystem::ifstream(
m_leaf_node_filename,
std::ios::in | std::ios::binary
)
);
}
if(!thread_local_rtree_stream->good()) {
thread_local_rtree_stream->clear(std::ios::goodbit);
SimpleLogger().Write(logDEBUG) << "Resetting stale filestream";
}
uint64_t seek_pos = sizeof(uint64_t) + leaf_id*sizeof(LeafNode);
thread_local_rtree_stream->seekg(seek_pos);
thread_local_rtree_stream->read((char *)&result_node, sizeof(LeafNode));
}
inline double ComputePerpendicularDistance(
const FixedPointCoordinate& inputPoint,
const FixedPointCoordinate& source,
const FixedPointCoordinate& target,
FixedPointCoordinate& nearest, double *r) const {
const double x = inputPoint.lat/COORDINATE_PRECISION;
const double y = inputPoint.lon/COORDINATE_PRECISION;
const double a = source.lat/COORDINATE_PRECISION;
const double b = source.lon/COORDINATE_PRECISION;
const double c = target.lat/COORDINATE_PRECISION;
const double d = target.lon/COORDINATE_PRECISION;
double p,q,mX,nY;
if(std::fabs(a-c) > std::numeric_limits<double>::epsilon() ){
const double m = (d-b)/(c-a); // slope
// Projection of (x,y) on line joining (a,b) and (c,d)
p = ((x + (m*y)) + (m*m*a - m*b))/(1. + m*m);
q = b + m*(p - a);
} else {
p = c;
q = y;
}
nY = (d*p - c*q)/(a*d - b*c);
mX = (p - nY*a)/c;// These values are actually n/m+n and m/m+n , we need
// not calculate the explicit values of m an n as we
// are just interested in the ratio
if(std::isnan(mX)) {
*r = (target == inputPoint) ? 1. : 0.;
} else {
*r = mX;
}
if(*r<=0.){
nearest.lat = source.lat;
nearest.lon = source.lon;
return ((b - y)*(b - y) + (a - x)*(a - x));
// return std::sqrt(((b - y)*(b - y) + (a - x)*(a - x)));
} else if(*r >= 1.){
nearest.lat = target.lat;
nearest.lon = target.lon;
return ((d - y)*(d - y) + (c - x)*(c - x));
// return std::sqrt(((d - y)*(d - y) + (c - x)*(c - x)));
}
// point lies in between
nearest.lat = p*COORDINATE_PRECISION;
nearest.lon = q*COORDINATE_PRECISION;
// return std::sqrt((p-x)*(p-x) + (q-y)*(q-y));
return (p-x)*(p-x) + (q-y)*(q-y);
}
inline bool CoordinatesAreEquivalent(const FixedPointCoordinate & a, const FixedPointCoordinate & b, const FixedPointCoordinate & c, const FixedPointCoordinate & d) const {
return (a == b && c == d) || (a == c && b == d) || (a == d && b == c);
}
inline bool DoubleEpsilonCompare(const double d1, const double d2) const {
return (std::fabs(d1 - d2) < std::numeric_limits<double>::epsilon() );
}
};
//[1] "On Packing R-Trees"; I. Kamel, C. Faloutsos; 1993; DOI: 10.1145/170088.170403
//[2] "Nearest Neighbor Queries", N. Roussopulos et al; 1995; DOI: 10.1145/223784.223794
#endif /* STATICRTREE_H_ */
-97
View File
@@ -1,97 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef TURNINSTRUCTIONS_H_
#define TURNINSTRUCTIONS_H_
#include <boost/noncopyable.hpp>
typedef unsigned char TurnInstruction;
//This is a hack until c++0x is available enough to use scoped enums
struct TurnInstructionsClass : boost::noncopyable {
const static TurnInstruction NoTurn = 0; //Give no instruction at all
const static TurnInstruction GoStraight = 1; //Tell user to go straight!
const static TurnInstruction TurnSlightRight = 2;
const static TurnInstruction TurnRight = 3;
const static TurnInstruction TurnSharpRight = 4;
const static TurnInstruction UTurn = 5;
const static TurnInstruction TurnSharpLeft = 6;
const static TurnInstruction TurnLeft = 7;
const static TurnInstruction TurnSlightLeft = 8;
const static TurnInstruction ReachViaPoint = 9;
const static TurnInstruction HeadOn = 10;
const static TurnInstruction EnterRoundAbout = 11;
const static TurnInstruction LeaveRoundAbout = 12;
const static TurnInstruction StayOnRoundAbout = 13;
const static TurnInstruction StartAtEndOfStreet = 14;
const static TurnInstruction ReachedYourDestination = 15;
const static TurnInstruction EnterAgainstAllowedDirection = 16;
const static TurnInstruction LeaveAgainstAllowedDirection = 17;
const static TurnInstruction AccessRestrictionFlag = 128;
const static TurnInstruction InverseAccessRestrictionFlag = 0x7f; // ~128 does not work without a warning.
const static int AccessRestrictionPenalty = 1 << 15; //unrelated to the bit set in the restriction flag
static inline TurnInstruction GetTurnDirectionOfInstruction( const double angle ) {
if(angle >= 23 && angle < 67) {
return TurnSharpRight;
}
if (angle >= 67 && angle < 113) {
return TurnRight;
}
if (angle >= 113 && angle < 158) {
return TurnSlightRight;
}
if (angle >= 158 && angle < 202) {
return GoStraight;
}
if (angle >= 202 && angle < 248) {
return TurnSlightLeft;
}
if (angle >= 248 && angle < 292) {
return TurnLeft;
}
if (angle >= 292 && angle < 336) {
return TurnSharpLeft;
}
return UTurn;
}
static inline bool TurnIsNecessary ( const short turnInstruction ) {
if(NoTurn == turnInstruction || StayOnRoundAbout == turnInstruction)
return false;
return true;
}
};
static TurnInstructionsClass TurnInstructions;
#endif /* TURNINSTRUCTIONS_H_ */
-102
View File
@@ -1,102 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FASTXORHASH_H_
#define FASTXORHASH_H_
#include <algorithm>
#include <vector>
/*
This is an implementation of Tabulation hashing, which has suprising properties like universality.
The space requirement is 2*2^16 = 256 kb of memory, which fits into L2 cache.
Evaluation boils down to 10 or less assembly instruction on any recent X86 CPU:
1: movq table2(%rip), %rdx
2: movl %edi, %eax
3: movzwl %di, %edi
4: shrl $16, %eax
5: movzwl %ax, %eax
6: movzbl (%rdx,%rax), %eax
7: movq table1(%rip), %rdx
8: xorb (%rdx,%rdi), %al
9: movzbl %al, %eax
10: ret
*/
class XORFastHash { //65k entries
std::vector<unsigned short> table1;
std::vector<unsigned short> table2;
public:
XORFastHash() {
table1.resize(2 << 16);
table2.resize(2 << 16);
for(unsigned i = 0; i < (2 << 16); ++i) {
table1[i] = i; table2[i] = i;
}
std::random_shuffle(table1.begin(), table1.end());
std::random_shuffle(table2.begin(), table2.end());
}
inline unsigned short operator()(const unsigned originalValue) const {
unsigned short lsb = ((originalValue) & 0xffff);
unsigned short msb = (((originalValue) >> 16) & 0xffff);
return table1[lsb] ^ table2[msb];
}
};
class XORMiniHash { //256 entries
std::vector<unsigned char> table1;
std::vector<unsigned char> table2;
std::vector<unsigned char> table3;
std::vector<unsigned char> table4;
public:
XORMiniHash() {
table1.resize(1 << 8);
table2.resize(1 << 8);
table3.resize(1 << 8);
table4.resize(1 << 8);
for(unsigned i = 0; i < (1 << 8); ++i) {
table1[i] = i; table2[i] = i;
table3[i] = i; table4[i] = i;
}
std::random_shuffle(table1.begin(), table1.end());
std::random_shuffle(table2.begin(), table2.end());
std::random_shuffle(table3.begin(), table3.end());
std::random_shuffle(table4.begin(), table4.end());
}
unsigned char operator()(const unsigned originalValue) const {
unsigned char byte1 = ((originalValue) & 0xff);
unsigned char byte2 = ((originalValue >> 8) & 0xff);
unsigned char byte3 = ((originalValue >> 16) & 0xff);
unsigned char byte4 = ((originalValue >> 24) & 0xff);
return table1[byte1] ^ table2[byte2] ^ table3[byte3] ^ table4[byte4];
}
};
#endif /* FASTXORHASH_H_ */
-87
View File
@@ -1,87 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef XORFASTHASHSTORAGE_H_
#define XORFASTHASHSTORAGE_H_
#include "XORFastHash.h"
#include <climits>
#include <vector>
#include <bitset>
template< typename NodeID, typename Key >
class XORFastHashStorage {
public:
struct HashCell{
Key key;
NodeID id;
unsigned time;
HashCell() : key(UINT_MAX), id(UINT_MAX), time(UINT_MAX) {}
HashCell(const HashCell & other) : key(other.key), id(other.id), time(other.time) { }
inline operator Key() const {
return key;
}
inline void operator=(const Key & keyToInsert) {
key = keyToInsert;
}
};
XORFastHashStorage( size_t ) : positions(2<<16), currentTimestamp(0) { }
inline HashCell& operator[]( const NodeID node ) {
unsigned short position = fastHash(node);
while((positions[position].time == currentTimestamp) && (positions[position].id != node)){
++position %= (2<<16);
}
positions[position].id = node;
positions[position].time = currentTimestamp;
return positions[position];
}
inline void Clear() {
++currentTimestamp;
if(UINT_MAX == currentTimestamp) {
positions.clear();
positions.resize((2<<16));
}
}
private:
XORFastHashStorage() : positions(2<<16), currentTimestamp(0) {}
std::vector<HashCell> positions;
XORFastHash fastHash;
unsigned currentTimestamp;
};
#endif /* XORFASTHASHSTORAGE_H_ */
-72
View File
@@ -1,72 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BASE_DESCRIPTOR_H_
#define BASE_DESCRIPTOR_H_
#include "../DataStructures/HashTable.h"
#include "../DataStructures/PhantomNodes.h"
#include "../DataStructures/RawRouteData.h"
#include "../Server/Http/Reply.h"
#include "../Util/StringUtil.h"
#include "../typedefs.h"
#include <cmath>
#include <cstdio>
#include <string>
#include <vector>
struct DescriptorConfig {
DescriptorConfig() :
instructions(true),
geometry(true),
encode_geometry(true),
zoom_level(18)
{ }
bool instructions;
bool geometry;
bool encode_geometry;
unsigned short zoom_level;
};
template<class DataFacadeT>
class BaseDescriptor {
public:
BaseDescriptor() { }
//Maybe someone can explain the pure virtual destructor thing to me (dennis)
virtual ~BaseDescriptor() { }
virtual void Run(
http::Reply & reply,
const RawRouteData &rawRoute,
PhantomNodes &phantomNodes,
const DataFacadeT * facade
) = 0;
virtual void SetConfig(const DescriptorConfig & config) = 0;
};
#endif /* BASE_DESCRIPTOR_H_ */
-253
View File
@@ -1,253 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "DescriptionFactory.h"
DescriptionFactory::DescriptionFactory() : entireLength(0) { }
DescriptionFactory::~DescriptionFactory() { }
inline double DescriptionFactory::DegreeToRadian(const double degree) const {
return degree * (M_PI/180);
}
inline double DescriptionFactory::RadianToDegree(const double radian) const {
return radian * (180/M_PI);
}
double DescriptionFactory::GetBearing(
const FixedPointCoordinate & A,
const FixedPointCoordinate & B
) const {
double deltaLong = DegreeToRadian(B.lon/COORDINATE_PRECISION - A.lon/COORDINATE_PRECISION);
const double lat1 = DegreeToRadian(A.lat/COORDINATE_PRECISION);
const double lat2 = DegreeToRadian(B.lat/COORDINATE_PRECISION);
const double y = sin(deltaLong) * cos(lat2);
const double x = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(deltaLong);
double result = RadianToDegree(atan2(y, x));
while(result < 0.) {
result += 360.;
}
while(result >= 360.) {
result -= 360.;
}
return result;
}
void DescriptionFactory::SetStartSegment(const PhantomNode & sph) {
start_phantom = sph;
AppendSegment(
sph.location,
_PathData(0, sph.nodeBasedEdgeNameID, 10, sph.weight1)
);
}
void DescriptionFactory::SetEndSegment(const PhantomNode & tph) {
target_phantom = tph;
pathDescription.push_back(
SegmentInformation(
tph.location,
tph.nodeBasedEdgeNameID,
0,
tph.weight1,
0,
true
)
);
}
void DescriptionFactory::AppendSegment(
const FixedPointCoordinate & coordinate,
const _PathData & data
) {
if(1 == pathDescription.size() && pathDescription.back().location == coordinate) {
pathDescription.back().nameID = data.nameID;
} else {
pathDescription.push_back(SegmentInformation(coordinate, data.nameID, 0, data.durationOfSegment, data.turnInstruction) );
}
}
void DescriptionFactory::AppendEncodedPolylineString(
const bool return_encoded,
std::vector<std::string> & output
) {
std::string temp;
if(return_encoded) {
polyline_compressor.printEncodedString(pathDescription, temp);
} else {
polyline_compressor.printUnencodedString(pathDescription, temp);
}
output.push_back(temp);
}
void DescriptionFactory::AppendEncodedPolylineString(
std::vector<std::string> &output
) const {
std::string temp;
polyline_compressor.printEncodedString(pathDescription, temp);
output.push_back(temp);
}
void DescriptionFactory::AppendUnencodedPolylineString(
std::vector<std::string>& output
) const {
std::string temp;
polyline_compressor.printUnencodedString(pathDescription, temp);
output.push_back(temp);
}
// void DescriptionFactory::Run(const SearchEngine &sEngine, const unsigned zoomLevel) {
// if(0 == pathDescription.size())
// return;
// // unsigned entireLength = 0;
// /** starts at index 1 */
// pathDescription[0].length = 0;
// for(unsigned i = 1; i < pathDescription.size(); ++i) {
// pathDescription[i].length = ApproximateEuclideanDistance(pathDescription[i-1].location, pathDescription[i].location);
// }
// double lengthOfSegment = 0;
// unsigned durationOfSegment = 0;
// unsigned indexOfSegmentBegin = 0;
// std::string string0 = sEngine.GetEscapedNameForNameID(pathDescription[0].nameID);
// std::string string1;
// /*Simplify turn instructions
// Input :
// 10. Turn left on B 36 for 20 km
// 11. Continue on B 35; B 36 for 2 km
// 12. Continue on B 36 for 13 km
// becomes:
// 10. Turn left on B 36 for 35 km
// */
// //TODO: rework to check only end and start of string.
// // stl string is way to expensive
// // unsigned lastTurn = 0;
// // for(unsigned i = 1; i < pathDescription.size(); ++i) {
// // string1 = sEngine.GetEscapedNameForNameID(pathDescription[i].nameID);
// // if(TurnInstructionsClass::GoStraight == pathDescription[i].turnInstruction) {
// // if(std::string::npos != string0.find(string1+";")
// // || std::string::npos != string0.find(";"+string1)
// // || std::string::npos != string0.find(string1+" ;")
// // || std::string::npos != string0.find("; "+string1)
// // ){
// // SimpleLogger().Write() << "->next correct: " << string0 << " contains " << string1;
// // for(; lastTurn != i; ++lastTurn)
// // pathDescription[lastTurn].nameID = pathDescription[i].nameID;
// // pathDescription[i].turnInstruction = TurnInstructionsClass::NoTurn;
// // } else if(std::string::npos != string1.find(string0+";")
// // || std::string::npos != string1.find(";"+string0)
// // || std::string::npos != string1.find(string0+" ;")
// // || std::string::npos != string1.find("; "+string0)
// // ){
// // SimpleLogger().Write() << "->prev correct: " << string1 << " contains " << string0;
// // pathDescription[i].nameID = pathDescription[i-1].nameID;
// // pathDescription[i].turnInstruction = TurnInstructionsClass::NoTurn;
// // }
// // }
// // if (TurnInstructionsClass::NoTurn != pathDescription[i].turnInstruction) {
// // lastTurn = i;
// // }
// // string0 = string1;
// // }
// for(unsigned i = 1; i < pathDescription.size(); ++i) {
// entireLength += pathDescription[i].length;
// lengthOfSegment += pathDescription[i].length;
// durationOfSegment += pathDescription[i].duration;
// pathDescription[indexOfSegmentBegin].length = lengthOfSegment;
// pathDescription[indexOfSegmentBegin].duration = durationOfSegment;
// if(TurnInstructionsClass::NoTurn != pathDescription[i].turnInstruction) {
// //SimpleLogger().Write() << "Turn after " << lengthOfSegment << "m into way with name id " << segment.nameID;
// assert(pathDescription[i].necessary);
// lengthOfSegment = 0;
// durationOfSegment = 0;
// indexOfSegmentBegin = i;
// }
// }
// // SimpleLogger().Write() << "#segs: " << pathDescription.size();
// //Post-processing to remove empty or nearly empty path segments
// if(FLT_EPSILON > pathDescription.back().length) {
// // SimpleLogger().Write() << "#segs: " << pathDescription.size() << ", last ratio: " << target_phantom.ratio << ", length: " << pathDescription.back().length;
// if(pathDescription.size() > 2){
// pathDescription.pop_back();
// pathDescription.back().necessary = true;
// pathDescription.back().turnInstruction = TurnInstructions.NoTurn;
// target_phantom.nodeBasedEdgeNameID = (pathDescription.end()-2)->nameID;
// // SimpleLogger().Write() << "Deleting last turn instruction";
// }
// } else {
// pathDescription[indexOfSegmentBegin].duration *= (1.-target_phantom.ratio);
// }
// if(FLT_EPSILON > pathDescription[0].length) {
// //TODO: this is never called actually?
// if(pathDescription.size() > 2) {
// pathDescription.erase(pathDescription.begin());
// pathDescription[0].turnInstruction = TurnInstructions.HeadOn;
// pathDescription[0].necessary = true;
// start_phantom.nodeBasedEdgeNameID = pathDescription[0].nameID;
// // SimpleLogger().Write() << "Deleting first turn instruction, ratio: " << start_phantom.ratio << ", length: " << pathDescription[0].length;
// }
// } else {
// pathDescription[0].duration *= start_phantom.ratio;
// }
// //Generalize poly line
// dp.Run(pathDescription, zoomLevel);
// //fix what needs to be fixed else
// for(unsigned i = 0; i < pathDescription.size()-1 && pathDescription.size() >= 2; ++i){
// if(pathDescription[i].necessary) {
// double angle = GetBearing(pathDescription[i].location, pathDescription[i+1].location);
// pathDescription[i].bearing = angle;
// }
// }
// // BuildRouteSummary(entireLength, duration);
// return;
// }
void DescriptionFactory::BuildRouteSummary(
const double distance,
const unsigned time
) {
summary.startName = start_phantom.nodeBasedEdgeNameID;
summary.destName = target_phantom.nodeBasedEdgeNameID;
summary.BuildDurationAndLengthStrings(distance, time);
}
-220
View File
@@ -1,220 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DESCRIPTIONFACTORY_H_
#define DESCRIPTIONFACTORY_H_
#include "../Algorithms/DouglasPeucker.h"
#include "../Algorithms/PolylineCompressor.h"
#include "../DataStructures/Coordinate.h"
#include "../DataStructures/PhantomNodes.h"
#include "../DataStructures/RawRouteData.h"
#include "../DataStructures/SegmentInformation.h"
#include "../DataStructures/TurnInstructions.h"
#include "../Util/SimpleLogger.h"
#include "../typedefs.h"
#include <limits>
#include <vector>
/* This class is fed with all way segments in consecutive order
* and produces the description plus the encoded polyline */
class DescriptionFactory {
DouglasPeucker polyline_generalizer;
PolylineCompressor polyline_compressor;
PhantomNode start_phantom, target_phantom;
double DegreeToRadian(const double degree) const;
double RadianToDegree(const double degree) const;
public:
struct RouteSummary {
std::string lengthString;
std::string durationString;
unsigned startName;
unsigned destName;
RouteSummary() :
lengthString("0"),
durationString("0"),
startName(0),
destName(0)
{}
void BuildDurationAndLengthStrings(
const double distance,
const unsigned time
) {
//compute distance/duration for route summary
intToString(round(distance), lengthString);
int travelTime = time/10 + 1;
intToString(travelTime, durationString);
}
} summary;
double entireLength;
//I know, declaring this public is considered bad. I'm lazy
std::vector <SegmentInformation> pathDescription;
DescriptionFactory();
virtual ~DescriptionFactory();
double GetBearing(const FixedPointCoordinate& C, const FixedPointCoordinate& B) const;
void AppendEncodedPolylineString(std::vector<std::string> &output) const;
void AppendUnencodedPolylineString(std::vector<std::string> &output) const;
void AppendSegment(const FixedPointCoordinate & coordinate, const _PathData & data);
void BuildRouteSummary(const double distance, const unsigned time);
void SetStartSegment(const PhantomNode & start_phantom);
void SetEndSegment(const PhantomNode & start_phantom);
void AppendEncodedPolylineString(
const bool return_encoded,
std::vector<std::string> & output
);
template<class DataFacadeT>
void Run(const DataFacadeT * facade, const unsigned zoomLevel) {
if( pathDescription.empty() ) {
return;
}
// unsigned entireLength = 0;
/** starts at index 1 */
pathDescription[0].length = 0;
for(unsigned i = 1; i < pathDescription.size(); ++i) {
pathDescription[i].length = ApproximateEuclideanDistance(pathDescription[i-1].location, pathDescription[i].location);
}
double lengthOfSegment = 0;
unsigned durationOfSegment = 0;
unsigned indexOfSegmentBegin = 0;
// std::string string0 = facade->GetEscapedNameForNameID(pathDescription[0].nameID);
// std::string string1;
/*Simplify turn instructions
Input :
10. Turn left on B 36 for 20 km
11. Continue on B 35; B 36 for 2 km
12. Continue on B 36 for 13 km
becomes:
10. Turn left on B 36 for 35 km
*/
//TODO: rework to check only end and start of string.
// stl string is way to expensive
// unsigned lastTurn = 0;
// for(unsigned i = 1; i < pathDescription.size(); ++i) {
// string1 = sEngine.GetEscapedNameForNameID(pathDescription[i].nameID);
// if(TurnInstructionsClass::GoStraight == pathDescription[i].turnInstruction) {
// if(std::string::npos != string0.find(string1+";")
// || std::string::npos != string0.find(";"+string1)
// || std::string::npos != string0.find(string1+" ;")
// || std::string::npos != string0.find("; "+string1)
// ){
// SimpleLogger().Write() << "->next correct: " << string0 << " contains " << string1;
// for(; lastTurn != i; ++lastTurn)
// pathDescription[lastTurn].nameID = pathDescription[i].nameID;
// pathDescription[i].turnInstruction = TurnInstructionsClass::NoTurn;
// } else if(std::string::npos != string1.find(string0+";")
// || std::string::npos != string1.find(";"+string0)
// || std::string::npos != string1.find(string0+" ;")
// || std::string::npos != string1.find("; "+string0)
// ){
// SimpleLogger().Write() << "->prev correct: " << string1 << " contains " << string0;
// pathDescription[i].nameID = pathDescription[i-1].nameID;
// pathDescription[i].turnInstruction = TurnInstructionsClass::NoTurn;
// }
// }
// if (TurnInstructionsClass::NoTurn != pathDescription[i].turnInstruction) {
// lastTurn = i;
// }
// string0 = string1;
// }
for(unsigned i = 1; i < pathDescription.size(); ++i) {
entireLength += pathDescription[i].length;
lengthOfSegment += pathDescription[i].length;
durationOfSegment += pathDescription[i].duration;
pathDescription[indexOfSegmentBegin].length = lengthOfSegment;
pathDescription[indexOfSegmentBegin].duration = durationOfSegment;
if(TurnInstructionsClass::NoTurn != pathDescription[i].turnInstruction) {
//SimpleLogger().Write() << "Turn after " << lengthOfSegment << "m into way with name id " << pathDescription[i].nameID;
assert(pathDescription[i].necessary);
lengthOfSegment = 0;
durationOfSegment = 0;
indexOfSegmentBegin = i;
}
}
// SimpleLogger().Write() << "#segs: " << pathDescription.size();
//Post-processing to remove empty or nearly empty path segments
if(std::numeric_limits<double>::epsilon() > pathDescription.back().length) {
// SimpleLogger().Write() << "#segs: " << pathDescription.size() << ", last ratio: " << target_phantom.ratio << ", length: " << pathDescription.back().length;
if(pathDescription.size() > 2){
pathDescription.pop_back();
pathDescription.back().necessary = true;
pathDescription.back().turnInstruction = TurnInstructions.NoTurn;
target_phantom.nodeBasedEdgeNameID = (pathDescription.end()-2)->nameID;
// SimpleLogger().Write() << "Deleting last turn instruction";
}
} else {
pathDescription[indexOfSegmentBegin].duration *= (1.-target_phantom.ratio);
}
if(std::numeric_limits<double>::epsilon() > pathDescription[0].length) {
//TODO: this is never called actually?
if(pathDescription.size() > 2) {
pathDescription.erase(pathDescription.begin());
pathDescription[0].turnInstruction = TurnInstructions.HeadOn;
pathDescription[0].necessary = true;
start_phantom.nodeBasedEdgeNameID = pathDescription[0].nameID;
// SimpleLogger().Write() << "Deleting first turn instruction, ratio: " << start_phantom.ratio << ", length: " << pathDescription[0].length;
}
} else {
pathDescription[0].duration *= start_phantom.ratio;
}
//Generalize poly line
polyline_generalizer.Run(pathDescription, zoomLevel);
//fix what needs to be fixed else
for(unsigned i = 0; i < pathDescription.size()-1 && pathDescription.size() >= 2; ++i){
if(pathDescription[i].necessary) {
double angle = GetBearing(pathDescription[i].location, pathDescription[i+1].location);
pathDescription[i].bearing = angle;
}
}
// BuildRouteSummary(entireLength, duration);
return;
}
};
#endif /* DESCRIPTIONFACTORY_H_ */
-103
View File
@@ -1,103 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef GPX_DESCRIPTOR_H_
#define GPX_DESCRIPTOR_H_
#include "BaseDescriptor.h"
#include <boost/foreach.hpp>
template<class DataFacadeT>
class GPXDescriptor : public BaseDescriptor<DataFacadeT> {
private:
DescriptorConfig config;
FixedPointCoordinate current;
std::string tmp;
public:
void SetConfig(const DescriptorConfig & c) { config = c; }
//TODO: reorder parameters
void Run(
http::Reply & reply,
const RawRouteData &rawRoute,
PhantomNodes &phantomNodes,
const DataFacadeT * facade
) {
reply.content.push_back("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
reply.content.push_back(
"<gpx creator=\"OSRM Routing Engine\" version=\"1.1\" "
"xmlns=\"http://www.topografix.com/GPX/1/1\" "
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
"xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 gpx.xsd"
"\">");
reply.content.push_back(
"<metadata><copyright author=\"Project OSRM\"><license>Data (c)"
" OpenStreetMap contributors (ODbL)</license></copyright>"
"</metadata>");
reply.content.push_back("<rte>");
bool found_route = (rawRoute.lengthOfShortestPath != INT_MAX) &&
(rawRoute.computedShortestPath.size() );
if( found_route ) {
convertInternalLatLonToString(
phantomNodes.startPhantom.location.lat,
tmp
);
reply.content.push_back("<rtept lat=\"" + tmp + "\" ");
convertInternalLatLonToString(
phantomNodes.startPhantom.location.lon,
tmp
);
reply.content.push_back("lon=\"" + tmp + "\"></rtept>");
BOOST_FOREACH(
const _PathData & pathData,
rawRoute.computedShortestPath
) {
current = facade->GetCoordinateOfNode(pathData.node);
convertInternalLatLonToString(current.lat, tmp);
reply.content.push_back("<rtept lat=\"" + tmp + "\" ");
convertInternalLatLonToString(current.lon, tmp);
reply.content.push_back("lon=\"" + tmp + "\"></rtept>");
}
convertInternalLatLonToString(
phantomNodes.targetPhantom.location.lat,
tmp
);
reply.content.push_back("<rtept lat=\"" + tmp + "\" ");
convertInternalLatLonToString(
phantomNodes.targetPhantom.location.lon,
tmp
);
reply.content.push_back("lon=\"" + tmp + "\"></rtept>");
}
reply.content.push_back("</rte></gpx>");
}
};
#endif // GPX_DESCRIPTOR_H_
-466
View File
@@ -1,466 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef JSON_DESCRIPTOR_H_
#define JSON_DESCRIPTOR_H_
#include "BaseDescriptor.h"
#include "DescriptionFactory.h"
#include "../Algorithms/ObjectToBase64.h"
#include "../DataStructures/SegmentInformation.h"
#include "../DataStructures/TurnInstructions.h"
#include "../Util/Azimuth.h"
#include "../Util/StringUtil.h"
#include <boost/bind.hpp>
#include <boost/lambda/lambda.hpp>
#include <algorithm>
template<class DataFacadeT>
class JSONDescriptor : public BaseDescriptor<DataFacadeT> {
private:
DescriptorConfig config;
DescriptionFactory description_factory;
DescriptionFactory alternateDescriptionFactory;
FixedPointCoordinate current;
unsigned entered_restricted_area_count;
struct RoundAbout{
RoundAbout() :
start_index(INT_MAX),
name_id(INT_MAX),
leave_at_exit(INT_MAX)
{}
int start_index;
int name_id;
int leave_at_exit;
} roundAbout;
struct Segment {
Segment() : name_id(-1), length(-1), position(-1) {}
Segment(int n, int l, int p) : name_id(n), length(l), position(p) {}
int name_id;
int length;
int position;
};
std::vector<Segment> shortest_path_segments, alternative_path_segments;
struct RouteNames {
std::string shortestPathName1;
std::string shortestPathName2;
std::string alternativePathName1;
std::string alternativePathName2;
};
public:
JSONDescriptor() : entered_restricted_area_count(0) {}
void SetConfig(const DescriptorConfig & c) { config = c; }
//TODO: reorder parameters
void Run(
http::Reply & reply,
const RawRouteData & raw_route_information,
PhantomNodes & phantom_nodes,
const DataFacadeT * facade
) {
WriteHeaderToOutput(reply.content);
if(raw_route_information.lengthOfShortestPath != INT_MAX) {
description_factory.SetStartSegment(phantom_nodes.startPhantom);
reply.content.push_back("0,"
"\"status_message\": \"Found route between points\",");
//Get all the coordinates for the computed route
BOOST_FOREACH(const _PathData & path_data, raw_route_information.computedShortestPath) {
current = facade->GetCoordinateOfNode(path_data.node);
description_factory.AppendSegment(current, path_data );
}
description_factory.SetEndSegment(phantom_nodes.targetPhantom);
} else {
//We do not need to do much, if there is no route ;-)
reply.content.push_back("207,"
"\"status_message\": \"Cannot find route between points\",");
}
description_factory.Run(facade, config.zoom_level);
reply.content.push_back("\"route_geometry\": ");
if(config.geometry) {
description_factory.AppendEncodedPolylineString(
config.encode_geometry,
reply.content
);
} else {
reply.content.push_back("[]");
}
reply.content.push_back(","
"\"route_instructions\": [");
entered_restricted_area_count = 0;
if(config.instructions) {
BuildTextualDescription(
description_factory,
reply,
raw_route_information.lengthOfShortestPath,
facade,
shortest_path_segments
);
} else {
BOOST_FOREACH(
const SegmentInformation & segment,
description_factory.pathDescription
) {
TurnInstruction current_instruction = segment.turnInstruction & TurnInstructions.InverseAccessRestrictionFlag;
entered_restricted_area_count += (current_instruction != segment.turnInstruction);
}
}
reply.content.push_back("],");
description_factory.BuildRouteSummary(
description_factory.entireLength,
raw_route_information.lengthOfShortestPath - ( entered_restricted_area_count*TurnInstructions.AccessRestrictionPenalty)
);
reply.content.push_back("\"route_summary\":");
reply.content.push_back("{");
reply.content.push_back("\"total_distance\":");
reply.content.push_back(description_factory.summary.lengthString);
reply.content.push_back(","
"\"total_time\":");
reply.content.push_back(description_factory.summary.durationString);
reply.content.push_back(","
"\"start_point\":\"");
reply.content.push_back(
facade->GetEscapedNameForNameID(description_factory.summary.startName)
);
reply.content.push_back("\","
"\"end_point\":\"");
reply.content.push_back(
facade->GetEscapedNameForNameID(description_factory.summary.destName)
);
reply.content.push_back("\"");
reply.content.push_back("}");
reply.content.push_back(",");
//only one alternative route is computed at this time, so this is hardcoded
if(raw_route_information.lengthOfAlternativePath != INT_MAX) {
alternateDescriptionFactory.SetStartSegment(phantom_nodes.startPhantom);
//Get all the coordinates for the computed route
BOOST_FOREACH(const _PathData & path_data, raw_route_information.computedAlternativePath) {
current = facade->GetCoordinateOfNode(path_data.node);
alternateDescriptionFactory.AppendSegment(current, path_data );
}
alternateDescriptionFactory.SetEndSegment(phantom_nodes.targetPhantom);
}
alternateDescriptionFactory.Run(facade, config.zoom_level);
//give an array of alternative routes
reply.content.push_back("\"alternative_geometries\": [");
if(config.geometry && INT_MAX != raw_route_information.lengthOfAlternativePath) {
//Generate the linestrings for each alternative
alternateDescriptionFactory.AppendEncodedPolylineString(
config.encode_geometry,
reply.content
);
}
reply.content.push_back("],");
reply.content.push_back("\"alternative_instructions\":[");
entered_restricted_area_count = 0;
if(INT_MAX != raw_route_information.lengthOfAlternativePath) {
reply.content.push_back("[");
//Generate instructions for each alternative
if(config.instructions) {
BuildTextualDescription(
alternateDescriptionFactory,
reply,
raw_route_information.lengthOfAlternativePath,
facade,
alternative_path_segments
);
} else {
BOOST_FOREACH(const SegmentInformation & segment, alternateDescriptionFactory.pathDescription) {
TurnInstruction current_instruction = segment.turnInstruction & TurnInstructions.InverseAccessRestrictionFlag;
entered_restricted_area_count += (current_instruction != segment.turnInstruction);
}
}
reply.content.push_back("]");
}
reply.content.push_back("],");
reply.content.push_back("\"alternative_summaries\":[");
if(INT_MAX != raw_route_information.lengthOfAlternativePath) {
//Generate route summary (length, duration) for each alternative
alternateDescriptionFactory.BuildRouteSummary(alternateDescriptionFactory.entireLength, raw_route_information.lengthOfAlternativePath - ( entered_restricted_area_count*TurnInstructions.AccessRestrictionPenalty));
reply.content.push_back("{");
reply.content.push_back("\"total_distance\":");
reply.content.push_back(alternateDescriptionFactory.summary.lengthString);
reply.content.push_back(","
"\"total_time\":");
reply.content.push_back(alternateDescriptionFactory.summary.durationString);
reply.content.push_back(","
"\"start_point\":\"");
reply.content.push_back(facade->GetEscapedNameForNameID(description_factory.summary.startName));
reply.content.push_back("\","
"\"end_point\":\"");
reply.content.push_back(facade->GetEscapedNameForNameID(description_factory.summary.destName));
reply.content.push_back("\"");
reply.content.push_back("}");
}
reply.content.push_back("],");
//Get Names for both routes
RouteNames routeNames;
GetRouteNames(shortest_path_segments, alternative_path_segments, facade, routeNames);
reply.content.push_back("\"route_name\":[\"");
reply.content.push_back(routeNames.shortestPathName1);
reply.content.push_back("\",\"");
reply.content.push_back(routeNames.shortestPathName2);
reply.content.push_back("\"],"
"\"alternative_names\":[");
reply.content.push_back("[\"");
reply.content.push_back(routeNames.alternativePathName1);
reply.content.push_back("\",\"");
reply.content.push_back(routeNames.alternativePathName2);
reply.content.push_back("\"]");
reply.content.push_back("],");
//list all viapoints so that the client may display it
reply.content.push_back("\"via_points\":[");
std::string tmp;
if(config.geometry && INT_MAX != raw_route_information.lengthOfShortestPath) {
for(unsigned i = 0; i < raw_route_information.segmentEndCoordinates.size(); ++i) {
reply.content.push_back("[");
if(raw_route_information.segmentEndCoordinates[i].startPhantom.location.isSet())
convertInternalReversedCoordinateToString(raw_route_information.segmentEndCoordinates[i].startPhantom.location, tmp);
else
convertInternalReversedCoordinateToString(raw_route_information.rawViaNodeCoordinates[i], tmp);
reply.content.push_back(tmp);
reply.content.push_back("],");
}
reply.content.push_back("[");
if(raw_route_information.segmentEndCoordinates.back().startPhantom.location.isSet())
convertInternalReversedCoordinateToString(raw_route_information.segmentEndCoordinates.back().targetPhantom.location, tmp);
else
convertInternalReversedCoordinateToString(raw_route_information.rawViaNodeCoordinates.back(), tmp);
reply.content.push_back(tmp);
reply.content.push_back("]");
}
reply.content.push_back("],");
reply.content.push_back("\"hint_data\": {");
reply.content.push_back("\"checksum\":");
intToString(raw_route_information.checkSum, tmp);
reply.content.push_back(tmp);
reply.content.push_back(", \"locations\": [");
std::string hint;
for(unsigned i = 0; i < raw_route_information.segmentEndCoordinates.size(); ++i) {
reply.content.push_back("\"");
EncodeObjectToBase64(raw_route_information.segmentEndCoordinates[i].startPhantom, hint);
reply.content.push_back(hint);
reply.content.push_back("\", ");
}
EncodeObjectToBase64(raw_route_information.segmentEndCoordinates.back().targetPhantom, hint);
reply.content.push_back("\"");
reply.content.push_back(hint);
reply.content.push_back("\"]");
reply.content.push_back("},");
reply.content.push_back("\"transactionId\": \"OSRM Routing Engine JSON Descriptor (v0.3)\"");
reply.content.push_back("}");
}
// construct routes names
void GetRouteNames(
std::vector<Segment> & shortest_path_segments,
std::vector<Segment> & alternative_path_segments,
const DataFacadeT * facade,
RouteNames & routeNames
) {
Segment shortestSegment1, shortestSegment2;
Segment alternativeSegment1, alternativeSegment2;
if(0 < shortest_path_segments.size()) {
sort(shortest_path_segments.begin(), shortest_path_segments.end(), boost::bind(&Segment::length, _1) > boost::bind(&Segment::length, _2) );
shortestSegment1 = shortest_path_segments[0];
if(0 < alternative_path_segments.size()) {
sort(alternative_path_segments.begin(), alternative_path_segments.end(), boost::bind(&Segment::length, _1) > boost::bind(&Segment::length, _2) );
alternativeSegment1 = alternative_path_segments[0];
}
std::vector<Segment> shortestDifference(shortest_path_segments.size());
std::vector<Segment> alternativeDifference(alternative_path_segments.size());
std::set_difference(shortest_path_segments.begin(), shortest_path_segments.end(), alternative_path_segments.begin(), alternative_path_segments.end(), shortestDifference.begin(), boost::bind(&Segment::name_id, _1) < boost::bind(&Segment::name_id, _2) );
int size_of_difference = shortestDifference.size();
if(0 < size_of_difference ) {
int i = 0;
while( i < size_of_difference && shortestDifference[i].name_id == shortest_path_segments[0].name_id) {
++i;
}
if(i < size_of_difference ) {
shortestSegment2 = shortestDifference[i];
}
}
std::set_difference(alternative_path_segments.begin(), alternative_path_segments.end(), shortest_path_segments.begin(), shortest_path_segments.end(), alternativeDifference.begin(), boost::bind(&Segment::name_id, _1) < boost::bind(&Segment::name_id, _2) );
size_of_difference = alternativeDifference.size();
if(0 < size_of_difference ) {
int i = 0;
while( i < size_of_difference && alternativeDifference[i].name_id == alternative_path_segments[0].name_id) {
++i;
}
if(i < size_of_difference ) {
alternativeSegment2 = alternativeDifference[i];
}
}
if(shortestSegment1.position > shortestSegment2.position)
std::swap(shortestSegment1, shortestSegment2);
if(alternativeSegment1.position > alternativeSegment2.position)
std::swap(alternativeSegment1, alternativeSegment2);
routeNames.shortestPathName1 = facade->GetEscapedNameForNameID(
shortestSegment1.name_id
);
routeNames.shortestPathName2 = facade->GetEscapedNameForNameID(
shortestSegment2.name_id
);
routeNames.alternativePathName1 = facade->GetEscapedNameForNameID(
alternativeSegment1.name_id
);
routeNames.alternativePathName2 = facade->GetEscapedNameForNameID(
alternativeSegment2.name_id
);
}
}
inline void WriteHeaderToOutput(std::vector<std::string> & output) {
output.push_back(
"{"
"\"version\": 0.3,"
"\"status\":"
);
}
//TODO: reorder parameters
inline void BuildTextualDescription(
DescriptionFactory & description_factory,
http::Reply & reply,
const int route_length,
const DataFacadeT * facade,
std::vector<Segment> & route_segments_list
) {
//Segment information has following format:
//["instruction","streetname",length,position,time,"length","earth_direction",azimuth]
//Example: ["Turn left","High Street",200,4,10,"200m","NE",22.5]
//See also: http://developers.cloudmade.com/wiki/navengine/JSON_format
unsigned prefixSumOfNecessarySegments = 0;
roundAbout.leave_at_exit = 0;
roundAbout.name_id = 0;
std::string tmpDist, tmpLength, tmpDuration, tmpBearing, tmpInstruction;
//Fetch data from Factory and generate a string from it.
BOOST_FOREACH(const SegmentInformation & segment, description_factory.pathDescription) {
TurnInstruction current_instruction = segment.turnInstruction & TurnInstructions.InverseAccessRestrictionFlag;
entered_restricted_area_count += (current_instruction != segment.turnInstruction);
if(TurnInstructions.TurnIsNecessary( current_instruction) ) {
if(TurnInstructions.EnterRoundAbout == current_instruction) {
roundAbout.name_id = segment.nameID;
roundAbout.start_index = prefixSumOfNecessarySegments;
} else {
if(0 != prefixSumOfNecessarySegments){
reply.content.push_back(",");
}
reply.content.push_back("[\"");
if(TurnInstructions.LeaveRoundAbout == current_instruction) {
intToString(TurnInstructions.EnterRoundAbout, tmpInstruction);
reply.content.push_back(tmpInstruction);
reply.content.push_back("-");
intToString(roundAbout.leave_at_exit+1, tmpInstruction);
reply.content.push_back(tmpInstruction);
roundAbout.leave_at_exit = 0;
} else {
intToString(current_instruction, tmpInstruction);
reply.content.push_back(tmpInstruction);
}
reply.content.push_back("\",\"");
reply.content.push_back(facade->GetEscapedNameForNameID(segment.nameID));
reply.content.push_back("\",");
intToString(segment.length, tmpDist);
reply.content.push_back(tmpDist);
reply.content.push_back(",");
intToString(prefixSumOfNecessarySegments, tmpLength);
reply.content.push_back(tmpLength);
reply.content.push_back(",");
intToString(segment.duration/10, tmpDuration);
reply.content.push_back(tmpDuration);
reply.content.push_back(",\"");
intToString(segment.length, tmpLength);
reply.content.push_back(tmpLength);
reply.content.push_back("m\",\"");
reply.content.push_back(Azimuth::Get(segment.bearing));
reply.content.push_back("\",");
intToString(round(segment.bearing), tmpBearing);
reply.content.push_back(tmpBearing);
reply.content.push_back("]");
route_segments_list.push_back(
Segment(
segment.nameID,
segment.length,
route_segments_list.size()
)
);
}
} else if(TurnInstructions.StayOnRoundAbout == current_instruction) {
++roundAbout.leave_at_exit;
}
if(segment.necessary)
++prefixSumOfNecessarySegments;
}
if(INT_MAX != route_length) {
reply.content.push_back(",[\"");
intToString(TurnInstructions.ReachedYourDestination, tmpInstruction);
reply.content.push_back(tmpInstruction);
reply.content.push_back("\",\"");
reply.content.push_back("\",");
reply.content.push_back("0");
reply.content.push_back(",");
intToString(prefixSumOfNecessarySegments-1, tmpLength);
reply.content.push_back(tmpLength);
reply.content.push_back(",");
reply.content.push_back("0");
reply.content.push_back(",\"");
reply.content.push_back("\",\"");
reply.content.push_back(Azimuth::Get(0.0));
reply.content.push_back("\",");
reply.content.push_back("0.0");
reply.content.push_back("]");
}
}
};
#endif /* JSON_DESCRIPTOR_H_ */
-3
View File
@@ -1,3 +0,0 @@
The javascript based web client is a seperate project available at
https://github.com/DennisSchiefer/Project-OSRM-Web
+44
View File
@@ -0,0 +1,44 @@
PROJECT_NAME = "Project OSRM"
PROJECT_BRIEF = "Open Source Routing Machine"
BUILTIN_STL_SUPPORT = YES
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_PACKAGE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_ANON_NSPACES = YES
QUIET = YES
INPUT = @CMAKE_CURRENT_SOURCE_DIR@
USE_MDFILE_AS_MAINPAGE = @CMAKE_CURRENT_SOURCE_DIR@/README.md
FILE_PATTERNS = *.h *.hpp *.c *.cc *.cpp *.md
RECURSIVE = YES
EXCLUDE = @CMAKE_CURRENT_SOURCE_DIR@/third_party \
@CMAKE_CURRENT_SOURCE_DIR@/build \
@CMAKE_CURRENT_SOURCE_DIR@/node_modules \
@CMAKE_CURRENT_SOURCE_DIR@/unit_tests \
@CMAKE_CURRENT_SOURCE_DIR@/benchmarks \
@CMAKE_CURRENT_SOURCE_DIR@/features
SOURCE_BROWSER = YES
CLANG_ASSISTED_PARSING = NO
HTML_COLORSTYLE_HUE = 217
HTML_COLORSTYLE_SAT = 71
HTML_COLORSTYLE_GAMMA = 50
GENERATE_TREEVIEW = YES
HAVE_DOT = @DOXYGEN_DOT_FOUND@
CALL_GRAPH = YES
CALLER_GRAPH = YES
DOT_IMAGE_FORMAT = svg
INTERACTIVE_SVG = YES
DOT_GRAPH_MAX_NODES = 500
DOT_TRANSPARENT = YES
DOT_MULTI_TARGETS = YES
-104
View File
@@ -1,104 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "BaseParser.h"
BaseParser::BaseParser(ExtractorCallbacks* ec, ScriptingEnvironment& se) :
extractor_callbacks(ec), scriptingEnvironment(se), luaState(NULL), use_turn_restrictions(true) {
luaState = se.getLuaStateForThreadID(0);
ReadUseRestrictionsSetting();
ReadRestrictionExceptions();
}
void BaseParser::ReadUseRestrictionsSetting() {
if( 0 != luaL_dostring( luaState, "return use_turn_restrictions\n") ) {
throw OSRMException(
/*lua_tostring( luaState, -1 ) + */"ERROR occured in scripting block"
);
}
if( lua_isboolean( luaState, -1) ) {
use_turn_restrictions = lua_toboolean(luaState, -1);
}
if( use_turn_restrictions ) {
SimpleLogger().Write() << "Using turn restrictions";
} else {
SimpleLogger().Write() << "Ignoring turn restrictions";
}
}
void BaseParser::ReadRestrictionExceptions() {
if(lua_function_exists(luaState, "get_exceptions" )) {
//get list of turn restriction exceptions
luabind::call_function<void>(
luaState,
"get_exceptions",
boost::ref(restriction_exceptions)
);
SimpleLogger().Write() << "Found " << restriction_exceptions.size() << " exceptions to turn restriction";
BOOST_FOREACH(const std::string & str, restriction_exceptions) {
SimpleLogger().Write() << " " << str;
}
} else {
SimpleLogger().Write() << "Found no exceptions to turn restrictions";
}
}
void BaseParser::report_errors(lua_State *L, const int status) const {
if( 0!=status ) {
std::cerr << "-- " << lua_tostring(L, -1) << std::endl;
lua_pop(L, 1); // remove error message
}
}
void BaseParser::ParseNodeInLua(ImportNode& n, lua_State* localLuaState) {
luabind::call_function<void>( localLuaState, "node_function", boost::ref(n) );
}
void BaseParser::ParseWayInLua(ExtractionWay& w, lua_State* localLuaState) {
luabind::call_function<void>( localLuaState, "way_function", boost::ref(w) );
}
bool BaseParser::ShouldIgnoreRestriction(const std::string & except_tag_string) const {
//should this restriction be ignored? yes if there's an overlap between:
//a) the list of modes in the except tag of the restriction (except_tag_string), ex: except=bus;bicycle
//b) the lua profile defines a hierachy of modes, ex: [access, vehicle, bicycle]
if( "" == except_tag_string ) {
return false;
}
//Be warned, this is quadratic work here, but we assume that
//only a few exceptions are actually defined.
std::vector<std::string> exceptions;
boost::algorithm::split_regex(exceptions, except_tag_string, boost::regex("[;][ ]*"));
BOOST_FOREACH(std::string& str, exceptions) {
if( restriction_exceptions.end() != std::find(restriction_exceptions.begin(), restriction_exceptions.end(), str) ) {
return true;
}
}
return false;
}
-68
View File
@@ -1,68 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BASEPARSER_H_
#define BASEPARSER_H_
#include "ExtractorCallbacks.h"
#include "ScriptingEnvironment.h"
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
extern "C" {
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}
#include <boost/noncopyable.hpp>
class BaseParser : boost::noncopyable {
public:
BaseParser(ExtractorCallbacks* ec, ScriptingEnvironment& se);
virtual ~BaseParser() {}
virtual bool ReadHeader() = 0;
virtual bool Parse() = 0;
virtual void ParseNodeInLua(ImportNode& n, lua_State* luaStateForThread);
virtual void ParseWayInLua(ExtractionWay& n, lua_State* luaStateForThread);
virtual void report_errors(lua_State *L, const int status) const;
protected:
virtual void ReadUseRestrictionsSetting();
virtual void ReadRestrictionExceptions();
virtual bool ShouldIgnoreRestriction(const std::string& except_tag_string) const;
ExtractorCallbacks* extractor_callbacks;
ScriptingEnvironment& scriptingEnvironment;
lua_State* luaState;
std::vector<std::string> restriction_exceptions;
bool use_turn_restrictions;
};
#endif /* BASEPARSER_H_ */
-435
View File
@@ -1,435 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "ExtractionContainers.h"
void ExtractionContainers::PrepareData(
const std::string & output_file_name,
const std::string & restrictions_file_name
) {
try {
unsigned number_of_used_nodes = 0;
unsigned number_of_used_edges = 0;
double time = get_timestamp();
std::cout << "[extractor] Sorting used nodes ... " << std::flush;
stxxl::sort(
used_node_id_list.begin(),
used_node_id_list.end(),
Cmp(),
4294967296
);
std::cout << "ok, after " << get_timestamp() - time << "s" << std::endl;
time = get_timestamp();
std::cout << "[extractor] Erasing duplicate nodes ... " << std::flush;
stxxl::vector<NodeID>::iterator NewEnd = std::unique ( used_node_id_list.begin(),used_node_id_list.end() ) ;
used_node_id_list.resize ( NewEnd - used_node_id_list.begin() );
std::cout << "ok, after " << get_timestamp() - time << "s" << std::endl;
time = get_timestamp();
std::cout << "[extractor] Sorting all nodes ... " << std::flush;
stxxl::sort(
all_nodes_list.begin(),
all_nodes_list.end(),
CmpNodeByID(),
4294967296
);
std::cout << "ok, after " << get_timestamp() - time << "s" << std::endl;
time = get_timestamp();
std::cout << "[extractor] Sorting used ways ... " << std::flush;
stxxl::sort(
way_start_end_id_list.begin(),
way_start_end_id_list.end(),
CmpWayByID(),
4294967296
);
std::cout << "ok, after " << get_timestamp() - time << "s" << std::endl;
std::cout << "[extractor] Sorting restrctns. by from... " << std::flush;
stxxl::sort(
restrictions_list.begin(),
restrictions_list.end(),
CmpRestrictionContainerByFrom(),
4294967296
);
std::cout << "ok, after " << get_timestamp() - time << "s" << std::endl;
std::cout << "[extractor] Fixing restriction starts ... " << std::flush;
STXXLRestrictionsVector::iterator restrictions_iterator = restrictions_list.begin();
STXXLWayIDStartEndVector::iterator way_start_and_end_iterator = way_start_end_id_list.begin();
while(
way_start_and_end_iterator != way_start_end_id_list.end() &&
restrictions_iterator != restrictions_list.end()
) {
if(way_start_and_end_iterator->wayID < restrictions_iterator->fromWay){
++way_start_and_end_iterator;
continue;
}
if(way_start_and_end_iterator->wayID > restrictions_iterator->fromWay) {
++restrictions_iterator;
continue;
}
BOOST_ASSERT(way_start_and_end_iterator->wayID == restrictions_iterator->fromWay);
NodeID via_node_id = restrictions_iterator->restriction.viaNode;
if(way_start_and_end_iterator->firstStart == via_node_id) {
restrictions_iterator->restriction.fromNode = way_start_and_end_iterator->firstTarget;
} else if(way_start_and_end_iterator->firstTarget == via_node_id) {
restrictions_iterator->restriction.fromNode = way_start_and_end_iterator->firstStart;
} else if(way_start_and_end_iterator->lastStart == via_node_id) {
restrictions_iterator->restriction.fromNode = way_start_and_end_iterator->lastTarget;
} else if(way_start_and_end_iterator->lastTarget == via_node_id) {
restrictions_iterator->restriction.fromNode = way_start_and_end_iterator->lastStart;
}
++restrictions_iterator;
}
std::cout << "ok, after " << get_timestamp() - time << "s" << std::endl;
time = get_timestamp();
std::cout << "[extractor] Sorting restrctns. by to ... " << std::flush;
stxxl::sort(
restrictions_list.begin(),
restrictions_list.end(),
CmpRestrictionContainerByTo(),
4294967296
);
std::cout << "ok, after " << get_timestamp() - time << "s" << std::endl;
time = get_timestamp();
unsigned usableRestrictionsCounter(0);
std::cout << "[extractor] Fixing restriction ends ... " << std::flush;
restrictions_iterator = restrictions_list.begin();
way_start_and_end_iterator = way_start_end_id_list.begin();
while(
way_start_and_end_iterator != way_start_end_id_list.end() &&
restrictions_iterator != restrictions_list.end()
) {
if(way_start_and_end_iterator->wayID < restrictions_iterator->toWay){
++way_start_and_end_iterator;
continue;
}
if(way_start_and_end_iterator->wayID > restrictions_iterator->toWay) {
++restrictions_iterator;
continue;
}
NodeID via_node_id = restrictions_iterator->restriction.viaNode;
if(way_start_and_end_iterator->lastStart == via_node_id) {
restrictions_iterator->restriction.toNode = way_start_and_end_iterator->lastTarget;
} else if(way_start_and_end_iterator->lastTarget == via_node_id) {
restrictions_iterator->restriction.toNode = way_start_and_end_iterator->lastStart;
} else if(way_start_and_end_iterator->firstStart == via_node_id) {
restrictions_iterator->restriction.toNode = way_start_and_end_iterator->firstTarget;
} else if(way_start_and_end_iterator->firstTarget == via_node_id) {
restrictions_iterator->restriction.toNode = way_start_and_end_iterator->firstStart;
}
if(
UINT_MAX != restrictions_iterator->restriction.fromNode &&
UINT_MAX != restrictions_iterator->restriction.toNode
) {
++usableRestrictionsCounter;
}
++restrictions_iterator;
}
std::cout << "ok, after " << get_timestamp() - time << "s" << std::endl;
SimpleLogger().Write() << "usable restrictions: " << usableRestrictionsCounter;
//serialize restrictions
std::ofstream restrictions_out_stream;
restrictions_out_stream.open(restrictions_file_name.c_str(), std::ios::binary);
restrictions_out_stream.write((char*)&uuid, sizeof(UUID));
restrictions_out_stream.write(
(char*)&usableRestrictionsCounter,
sizeof(unsigned)
);
for(
restrictions_iterator = restrictions_list.begin();
restrictions_iterator != restrictions_list.end();
++restrictions_iterator
) {
if(
UINT_MAX != restrictions_iterator->restriction.fromNode &&
UINT_MAX != restrictions_iterator->restriction.toNode
) {
restrictions_out_stream.write(
(char *)&(restrictions_iterator->restriction),
sizeof(TurnRestriction)
);
}
}
restrictions_out_stream.close();
std::ofstream file_out_stream;
file_out_stream.open(output_file_name.c_str(), std::ios::binary);
file_out_stream.write((char*)&uuid, sizeof(UUID));
file_out_stream.write((char*)&number_of_used_nodes, sizeof(unsigned));
time = get_timestamp();
std::cout << "[extractor] Confirming/Writing used nodes ... " << std::flush;
//identify all used nodes by a merging step of two sorted lists
STXXLNodeVector::iterator node_iterator = all_nodes_list.begin();
STXXLNodeIDVector::iterator node_id_iterator = used_node_id_list.begin();
while(
node_id_iterator != used_node_id_list.end() &&
node_iterator != all_nodes_list.end()
) {
if(*node_id_iterator < node_iterator->id){
++node_id_iterator;
continue;
}
if(*node_id_iterator > node_iterator->id) {
++node_iterator;
continue;
}
BOOST_ASSERT( *node_id_iterator == node_iterator->id);
file_out_stream.write(
(char*)&(*node_iterator),
sizeof(ExternalMemoryNode)
);
++number_of_used_nodes;
++node_id_iterator;
++node_iterator;
}
std::cout << "ok, after " << get_timestamp() - time << "s" << std::endl;
std::cout << "[extractor] setting number of nodes ... " << std::flush;
std::ios::pos_type previous_file_position = file_out_stream.tellp();
file_out_stream.seekp(std::ios::beg+sizeof(UUID));
file_out_stream.write((char*)&number_of_used_nodes, sizeof(unsigned));
file_out_stream.seekp(previous_file_position);
std::cout << "ok" << std::endl;
time = get_timestamp();
// Sort edges by start.
std::cout << "[extractor] Sorting edges by start ... " << std::flush;
stxxl::sort(
all_edges_list.begin(),
all_edges_list.end(),
CmpEdgeByStartID(),
4294967296
);
std::cout << "ok, after " << get_timestamp() - time << "s" << std::endl;
time = get_timestamp();
std::cout << "[extractor] Setting start coords ... " << std::flush;
file_out_stream.write((char*)&number_of_used_edges, sizeof(unsigned));
// Traverse list of edges and nodes in parallel and set start coord
node_iterator = all_nodes_list.begin();
STXXLEdgeVector::iterator edge_iterator = all_edges_list.begin();
while(
edge_iterator != all_edges_list.end() &&
node_iterator != all_nodes_list.end()
) {
if(edge_iterator->start < node_iterator->id){
++edge_iterator;
continue;
}
if(edge_iterator->start > node_iterator->id) {
node_iterator++;
continue;
}
BOOST_ASSERT(edge_iterator->start == node_iterator->id);
edge_iterator->startCoord.lat = node_iterator->lat;
edge_iterator->startCoord.lon = node_iterator->lon;
++edge_iterator;
}
std::cout << "ok, after " << get_timestamp() - time << "s" << std::endl;
time = get_timestamp();
// Sort Edges by target
std::cout << "[extractor] Sorting edges by target ... " << std::flush;
stxxl::sort(
all_edges_list.begin(),
all_edges_list.end(),
CmpEdgeByTargetID(),
4294967296
);
std::cout << "ok, after " << get_timestamp() - time << "s" << std::endl;
time = get_timestamp();
std::cout << "[extractor] Setting target coords ... " << std::flush;
// Traverse list of edges and nodes in parallel and set target coord
node_iterator = all_nodes_list.begin();
edge_iterator = all_edges_list.begin();
while(
edge_iterator != all_edges_list.end() &&
node_iterator != all_nodes_list.end()
) {
if(edge_iterator->target < node_iterator->id){
++edge_iterator;
continue;
}
if(edge_iterator->target > node_iterator->id) {
++node_iterator;
continue;
}
BOOST_ASSERT(edge_iterator->target == node_iterator->id);
if(edge_iterator->startCoord.lat != INT_MIN && edge_iterator->startCoord.lon != INT_MIN) {
edge_iterator->targetCoord.lat = node_iterator->lat;
edge_iterator->targetCoord.lon = node_iterator->lon;
const double distance = ApproximateDistance(
edge_iterator->startCoord.lat,
edge_iterator->startCoord.lon,
node_iterator->lat,
node_iterator->lon
);
BOOST_ASSERT(edge_iterator->speed != -1);
const double weight = ( distance * 10. ) / (edge_iterator->speed / 3.6);
int integer_weight = std::max( 1, (int)std::floor((edge_iterator->isDurationSet ? edge_iterator->speed : weight)+.5) );
int integer_distance = std::max( 1, (int)distance );
short zero = 0;
short one = 1;
file_out_stream.write((char*)&edge_iterator->start, sizeof(unsigned));
file_out_stream.write((char*)&edge_iterator->target, sizeof(unsigned));
file_out_stream.write((char*)&integer_distance, sizeof(int));
switch(edge_iterator->direction) {
case ExtractionWay::notSure:
file_out_stream.write((char*)&zero, sizeof(short));
break;
case ExtractionWay::oneway:
file_out_stream.write((char*)&one, sizeof(short));
break;
case ExtractionWay::bidirectional:
file_out_stream.write((char*)&zero, sizeof(short));
break;
case ExtractionWay::opposite:
file_out_stream.write((char*)&one, sizeof(short));
break;
default:
throw OSRMException("edge has broken direction");
break;
}
file_out_stream.write(
(char*)&integer_weight, sizeof(int)
);
BOOST_ASSERT(edge_iterator->type >= 0);
file_out_stream.write(
(char*)&edge_iterator->type,
sizeof(short)
);
file_out_stream.write(
(char*)&edge_iterator->nameID,
sizeof(unsigned)
);
file_out_stream.write(
(char*)&edge_iterator->isRoundabout,
sizeof(bool)
);
file_out_stream.write(
(char*)&edge_iterator->ignoreInGrid,
sizeof(bool)
);
file_out_stream.write(
(char*)&edge_iterator->isAccessRestricted,
sizeof(bool)
);
file_out_stream.write(
(char*)&edge_iterator->isContraFlow,
sizeof(bool)
);
++number_of_used_edges;
}
++edge_iterator;
}
std::cout << "ok, after " << get_timestamp() - time << "s" << std::endl;
std::cout << "[extractor] setting number of edges ... " << std::flush;
file_out_stream.seekp(previous_file_position);
file_out_stream.write((char*)&number_of_used_edges, sizeof(unsigned));
file_out_stream.close();
std::cout << "ok" << std::endl;
time = get_timestamp();
std::cout << "[extractor] writing street name index ... " << std::flush;
std::string name_file_streamName = (output_file_name + ".names");
boost::filesystem::ofstream name_file_stream(
name_file_streamName,
std::ios::binary
);
//write number of names
const unsigned number_of_names = name_list.size()+1;
name_file_stream.write((char *)&(number_of_names), sizeof(unsigned));
//compute total number of chars
unsigned total_number_of_chars = 0;
BOOST_FOREACH(const std::string & temp_string, name_list) {
total_number_of_chars += temp_string.length();
}
//write total number of chars
name_file_stream.write(
(char *)&(total_number_of_chars),
sizeof(unsigned)
);
//write prefixe sums
unsigned name_lengths_prefix_sum = 0;
BOOST_FOREACH(const std::string & temp_string, name_list) {
name_file_stream.write(
(char *)&(name_lengths_prefix_sum),
sizeof(unsigned)
);
name_lengths_prefix_sum += temp_string.length();
}
//duplicate on purpose!
name_file_stream.write(
(char *)&(name_lengths_prefix_sum),
sizeof(unsigned)
);
//write all chars consecutively
BOOST_FOREACH(const std::string & temp_string, name_list) {
const unsigned string_length = temp_string.length();
name_file_stream.write(temp_string.c_str(), string_length);
}
name_file_stream.close();
std::cout << "ok, after " << get_timestamp() - time << "s" << std::endl;
SimpleLogger().Write() << "Processed " <<
number_of_used_nodes << " nodes and " <<
number_of_used_edges << " edges";
} catch ( const std::exception& e ) {
std::cerr << "Caught Execption:" << e.what() << std::endl;
}
}
-82
View File
@@ -1,82 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef EXTRACTIONCONTAINERS_H_
#define EXTRACTIONCONTAINERS_H_
#include "ExtractorStructs.h"
#include "../Util/SimpleLogger.h"
#include "../Util/TimingUtil.h"
#include "../Util/UUID.h"
#include <boost/assert.hpp>
#include <boost/foreach.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <stxxl/sort>
#include <stxxl/vector>
class ExtractionContainers {
public:
typedef stxxl::vector<NodeID> STXXLNodeIDVector;
typedef stxxl::vector<ExternalMemoryNode> STXXLNodeVector;
typedef stxxl::vector<InternalExtractorEdge> STXXLEdgeVector;
typedef stxxl::vector<std::string> STXXLStringVector;
typedef stxxl::vector<InputRestrictionContainer> STXXLRestrictionsVector;
typedef stxxl::vector<_WayIDStartAndEndEdge> STXXLWayIDStartEndVector;
STXXLNodeIDVector used_node_id_list;
STXXLNodeVector all_nodes_list;
STXXLEdgeVector all_edges_list;
STXXLStringVector name_list;
STXXLRestrictionsVector restrictions_list;
STXXLWayIDStartEndVector way_start_end_id_list;
const UUID uuid;
ExtractionContainers() {
//Check if stxxl can be instantiated
stxxl::vector<unsigned> dummy_vector;
name_list.push_back("");
}
virtual ~ExtractionContainers() {
used_node_id_list.clear();
all_nodes_list.clear();
all_edges_list.clear();
name_list.clear();
restrictions_list.clear();
way_start_end_id_list.clear();
}
void PrepareData(
const std::string & output_file_name,
const std::string & restrictions_file_name
);
};
#endif /* EXTRACTIONCONTAINERS_H_ */
-87
View File
@@ -1,87 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef EXTRACTIONHELPERFUNCTIONS_H_
#define EXTRACTIONHELPERFUNCTIONS_H_
#include "../Util/StringUtil.h"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string_regex.hpp>
#include <boost/regex.hpp>
#include <climits>
namespace qi = boost::spirit::qi;
//TODO: Move into LUA
inline bool durationIsValid(const std::string &s) {
boost::regex e ("((\\d|\\d\\d):(\\d|\\d\\d):(\\d|\\d\\d))|((\\d|\\d\\d):(\\d|\\d\\d))|(\\d|\\d\\d)",boost::regex_constants::icase|boost::regex_constants::perl);
std::vector< std::string > result;
boost::algorithm::split_regex( result, s, boost::regex( ":" ) ) ;
bool matched = regex_match(s, e);
return matched;
}
inline unsigned parseDuration(const std::string &s) {
unsigned hours = 0;
unsigned minutes = 0;
unsigned seconds = 0;
boost::regex e ("((\\d|\\d\\d):(\\d|\\d\\d):(\\d|\\d\\d))|((\\d|\\d\\d):(\\d|\\d\\d))|(\\d|\\d\\d)",boost::regex_constants::icase|boost::regex_constants::perl);
std::vector< std::string > result;
boost::algorithm::split_regex( result, s, boost::regex( ":" ) ) ;
bool matched = regex_match(s, e);
if(matched) {
if(1 == result.size()) {
minutes = stringToInt(result[0]);
}
if(2 == result.size()) {
minutes = stringToInt(result[1]);
hours = stringToInt(result[0]);
}
if(3 == result.size()) {
seconds = stringToInt(result[2]);
minutes = stringToInt(result[1]);
hours = stringToInt(result[0]);
}
return 10*(3600*hours+60*minutes+seconds);
}
return UINT_MAX;
}
inline int parseMaxspeed(std::string input) { //call-by-value on purpose.
boost::algorithm::to_lower(input);
int n = stringToInt(input);
if (input.find("mph") != std::string::npos || input.find("mp/h") != std::string::npos) {
n = (n*1609)/1000;
}
return n;
}
#endif /* EXTRACTIONHELPERFUNCTIONS_H_ */
-130
View File
@@ -1,130 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "ExtractorCallbacks.h"
ExtractorCallbacks::ExtractorCallbacks() {externalMemory = NULL; stringMap = NULL; }
ExtractorCallbacks::ExtractorCallbacks(ExtractionContainers * ext, StringMap * strMap) {
externalMemory = ext;
stringMap = strMap;
}
ExtractorCallbacks::~ExtractorCallbacks() { }
/** warning: caller needs to take care of synchronization! */
void ExtractorCallbacks::nodeFunction(const ExternalMemoryNode &n) {
if(n.lat <= 85*COORDINATE_PRECISION && n.lat >= -85*COORDINATE_PRECISION) {
externalMemory->all_nodes_list.push_back(n);
}
}
bool ExtractorCallbacks::restrictionFunction(const InputRestrictionContainer &r) {
externalMemory->restrictions_list.push_back(r);
return true;
}
/** warning: caller needs to take care of synchronization! */
void ExtractorCallbacks::wayFunction(ExtractionWay &parsed_way) {
if((0 < parsed_way.speed) || (0 < parsed_way.duration)) { //Only true if the way is specified by the speed profile
if(UINT_MAX == parsed_way.id){
SimpleLogger().Write(logDEBUG) <<
"found bogus way with id: " << parsed_way.id <<
" of size " << parsed_way.path.size();
return;
}
if(0 < parsed_way.duration) {
//TODO: iterate all way segments and set duration corresponding to the length of each segment
parsed_way.speed = parsed_way.duration/(parsed_way.path.size()-1);
}
if(std::numeric_limits<double>::epsilon() >= fabs(-1. - parsed_way.speed)){
SimpleLogger().Write(logDEBUG) <<
"found way with bogus speed, id: " << parsed_way.id;
return;
}
//Get the unique identifier for the street name
const StringMap::const_iterator string_map_iterator = stringMap->find(parsed_way.name);
if(stringMap->end() == string_map_iterator) {
parsed_way.nameID = externalMemory->name_list.size();
externalMemory->name_list.push_back(parsed_way.name);
stringMap->insert(std::make_pair(parsed_way.name, parsed_way.nameID));
} else {
parsed_way.nameID = string_map_iterator->second;
}
if(ExtractionWay::opposite == parsed_way.direction) {
std::reverse( parsed_way.path.begin(), parsed_way.path.end() );
parsed_way.direction = ExtractionWay::oneway;
}
const bool split_bidirectional_edge = (parsed_way.backward_speed > 0) && (parsed_way.speed != parsed_way.backward_speed);
for(std::vector< NodeID >::size_type n = 0; n < parsed_way.path.size()-1; ++n) {
externalMemory->all_edges_list.push_back(
InternalExtractorEdge(parsed_way.path[n],
parsed_way.path[n+1],
parsed_way.type,
(split_bidirectional_edge ? ExtractionWay::oneway : parsed_way.direction),
parsed_way.speed,
parsed_way.nameID,
parsed_way.roundabout,
parsed_way.ignoreInGrid,
(0 < parsed_way.duration),
parsed_way.isAccessRestricted
)
);
externalMemory->used_node_id_list.push_back(parsed_way.path[n]);
}
externalMemory->used_node_id_list.push_back(parsed_way.path.back());
//The following information is needed to identify start and end segments of restrictions
externalMemory->way_start_end_id_list.push_back(_WayIDStartAndEndEdge(parsed_way.id, parsed_way.path[0], parsed_way.path[1], parsed_way.path[parsed_way.path.size()-2], parsed_way.path.back()));
if(split_bidirectional_edge) { //Only true if the way should be split
std::reverse( parsed_way.path.begin(), parsed_way.path.end() );
for(std::vector< NodeID >::size_type n = 0; n < parsed_way.path.size()-1; ++n) {
externalMemory->all_edges_list.push_back(
InternalExtractorEdge(parsed_way.path[n],
parsed_way.path[n+1],
parsed_way.type,
ExtractionWay::oneway,
parsed_way.backward_speed,
parsed_way.nameID,
parsed_way.roundabout,
parsed_way.ignoreInGrid,
(0 < parsed_way.duration),
parsed_way.isAccessRestricted,
(ExtractionWay::oneway == parsed_way.direction)
)
);
}
externalMemory->way_start_end_id_list.push_back(_WayIDStartAndEndEdge(parsed_way.id, parsed_way.path[0], parsed_way.path[1], parsed_way.path[parsed_way.path.size()-2], parsed_way.path.back()));
}
}
}
-231
View File
@@ -1,231 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef EXTRACTORSTRUCTS_H_
#define EXTRACTORSTRUCTS_H_
#include "../DataStructures/Coordinate.h"
#include "../DataStructures/HashTable.h"
#include "../DataStructures/ImportNode.h"
#include "../DataStructures/QueryNode.h"
#include "../DataStructures/Restriction.h"
#include "../typedefs.h"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/regex.hpp>
#include <boost/regex.hpp>
#include <boost/unordered_map.hpp>
#include <climits>
#include <string>
typedef boost::unordered_map<std::string, NodeID > StringMap;
typedef boost::unordered_map<std::string, std::pair<int, short> > StringToIntPairMap;
struct ExtractionWay {
ExtractionWay() {
Clear();
}
inline void Clear(){
id = UINT_MAX;
nameID = UINT_MAX;
path.clear();
keyVals.clear();
direction = ExtractionWay::notSure;
speed = -1;
backward_speed = -1;
duration = -1;
type = -1;
access = true;
roundabout = false;
isAccessRestricted = false;
ignoreInGrid = false;
}
enum Directions {
notSure = 0, oneway, bidirectional, opposite
};
Directions direction;
unsigned id;
unsigned nameID;
std::string name;
double speed;
double backward_speed;
double duration;
short type;
bool access;
bool roundabout;
bool isAccessRestricted;
bool ignoreInGrid;
std::vector< NodeID > path;
HashTable<std::string, std::string> keyVals;
};
struct ExtractorRelation {
ExtractorRelation() : type(unknown){}
enum {
unknown = 0, ferry, turnRestriction
} type;
HashTable<std::string, std::string> keyVals;
};
struct InternalExtractorEdge {
InternalExtractorEdge() : start(0), target(0), type(0), direction(0), speed(0), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false), isAccessRestricted(false), isContraFlow(false) {};
InternalExtractorEdge(NodeID s, NodeID t) : start(s), target(t), type(0), direction(0), speed(0), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false), isAccessRestricted(false), isContraFlow(false) { }
InternalExtractorEdge(NodeID s, NodeID t, short tp, short d, double sp): start(s), target(t), type(tp), direction(d), speed(sp), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false), isAccessRestricted(false), isContraFlow(false) { }
InternalExtractorEdge(NodeID s, NodeID t, short tp, short d, double sp, unsigned nid, bool isra, bool iing, bool ids, bool iar): start(s), target(t), type(tp), direction(d), speed(sp), nameID(nid), isRoundabout(isra), ignoreInGrid(iing), isDurationSet(ids), isAccessRestricted(iar), isContraFlow(false) {
assert(0 <= type);
}
InternalExtractorEdge(NodeID s, NodeID t, short tp, short d, double sp, unsigned nid, bool isra, bool iing, bool ids, bool iar, bool icf): start(s), target(t), type(tp), direction(d), speed(sp), nameID(nid), isRoundabout(isra), ignoreInGrid(iing), isDurationSet(ids), isAccessRestricted(iar), isContraFlow(icf) {
assert(0 <= type);
}
NodeID start;
NodeID target;
short type;
short direction;
double speed;
unsigned nameID;
bool isRoundabout;
bool ignoreInGrid;
bool isDurationSet;
bool isAccessRestricted;
bool isContraFlow;
FixedPointCoordinate startCoord;
FixedPointCoordinate targetCoord;
static InternalExtractorEdge min_value() {
return InternalExtractorEdge(0,0);
}
static InternalExtractorEdge max_value() {
return InternalExtractorEdge((std::numeric_limits<unsigned>::max)(), (std::numeric_limits<unsigned>::max)());
}
};
struct _WayIDStartAndEndEdge {
unsigned wayID;
NodeID firstStart;
NodeID firstTarget;
NodeID lastStart;
NodeID lastTarget;
_WayIDStartAndEndEdge() : wayID(UINT_MAX), firstStart(UINT_MAX), firstTarget(UINT_MAX), lastStart(UINT_MAX), lastTarget(UINT_MAX) {}
_WayIDStartAndEndEdge(unsigned w, NodeID fs, NodeID ft, NodeID ls, NodeID lt) : wayID(w), firstStart(fs), firstTarget(ft), lastStart(ls), lastTarget(lt) {}
static _WayIDStartAndEndEdge min_value() {
return _WayIDStartAndEndEdge((std::numeric_limits<unsigned>::min)(), (std::numeric_limits<unsigned>::min)(), (std::numeric_limits<unsigned>::min)(), (std::numeric_limits<unsigned>::min)(), (std::numeric_limits<unsigned>::min)());
}
static _WayIDStartAndEndEdge max_value() {
return _WayIDStartAndEndEdge((std::numeric_limits<unsigned>::max)(), (std::numeric_limits<unsigned>::max)(), (std::numeric_limits<unsigned>::max)(), (std::numeric_limits<unsigned>::max)(), (std::numeric_limits<unsigned>::max)());
}
};
struct CmpWayByID : public std::binary_function<_WayIDStartAndEndEdge, _WayIDStartAndEndEdge, bool> {
typedef _WayIDStartAndEndEdge value_type;
bool operator () (const _WayIDStartAndEndEdge & a, const _WayIDStartAndEndEdge & b) const {
return a.wayID < b.wayID;
}
value_type max_value() {
return _WayIDStartAndEndEdge::max_value();
}
value_type min_value() {
return _WayIDStartAndEndEdge::min_value();
}
};
struct Cmp : public std::binary_function<NodeID, NodeID, bool> {
typedef NodeID value_type;
bool operator () (const NodeID a, const NodeID b) const {
return a < b;
}
value_type max_value() {
return 0xffffffff;
}
value_type min_value() {
return 0x0;
}
};
struct CmpNodeByID : public std::binary_function<ExternalMemoryNode, ExternalMemoryNode, bool> {
typedef ExternalMemoryNode value_type;
bool operator () (
const ExternalMemoryNode & a,
const ExternalMemoryNode & b
) const {
return a.id < b.id;
}
value_type max_value() {
return ExternalMemoryNode::max_value();
}
value_type min_value() {
return ExternalMemoryNode::min_value();
}
};
struct CmpEdgeByStartID : public std::binary_function<InternalExtractorEdge, InternalExtractorEdge, bool> {
typedef InternalExtractorEdge value_type;
bool operator () (const InternalExtractorEdge & a, const InternalExtractorEdge & b) const {
return a.start < b.start;
}
value_type max_value() {
return InternalExtractorEdge::max_value();
}
value_type min_value() {
return InternalExtractorEdge::min_value();
}
};
struct CmpEdgeByTargetID : public std::binary_function<InternalExtractorEdge, InternalExtractorEdge, bool> {
typedef InternalExtractorEdge value_type;
bool operator () (const InternalExtractorEdge & a, const InternalExtractorEdge & b) const {
return a.target < b.target;
}
value_type max_value() {
return InternalExtractorEdge::max_value();
}
value_type min_value() {
return InternalExtractorEdge::min_value();
}
};
inline std::string GetRandomString() {
char s[128];
static const char alphanum[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < 127; ++i) {
s[i] = alphanum[rand() % (sizeof(alphanum) - 1)];
}
s[127] = 0;
return std::string(s);
}
#endif /* EXTRACTORSTRUCTS_H_ */
-504
View File
@@ -1,504 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "PBFParser.h"
PBFParser::PBFParser(const char * fileName, ExtractorCallbacks* ec, ScriptingEnvironment& se) : BaseParser( ec, se ) {
GOOGLE_PROTOBUF_VERIFY_VERSION;
//TODO: What is the bottleneck here? Filling the queue or reading the stuff from disk?
//NOTE: With Lua scripting, it is parsing the stuff. I/O is virtually for free.
threadDataQueue = boost::make_shared<ConcurrentQueue<_ThreadData*> >( 2500 ); /* Max 2500 items in queue, hardcoded. */
input.open(fileName, std::ios::in | std::ios::binary);
if (!input) {
throw OSRMException("pbf file not found.");
}
#ifndef NDEBUG
blockCount = 0;
groupCount = 0;
#endif
}
PBFParser::~PBFParser() {
if(input.is_open()) {
input.close();
}
// Clean up any leftover ThreadData objects in the queue
_ThreadData* td;
while (threadDataQueue->try_pop(td)) {
delete td;
}
google::protobuf::ShutdownProtobufLibrary();
#ifndef NDEBUG
SimpleLogger().Write(logDEBUG) <<
"parsed " << blockCount <<
" blocks from pbf with " << groupCount <<
" groups";
#endif
}
inline bool PBFParser::ReadHeader() {
_ThreadData initData;
/** read Header */
if(!readPBFBlobHeader(input, &initData)) {
return false;
}
if(readBlob(input, &initData)) {
if(!initData.PBFHeaderBlock.ParseFromArray(&(initData.charBuffer[0]), initData.charBuffer.size() ) ) {
std::cerr << "[error] Header not parseable!" << std::endl;
return false;
}
for(int i = 0, featureSize = initData.PBFHeaderBlock.required_features_size(); i < featureSize; ++i) {
const std::string& feature = initData.PBFHeaderBlock.required_features( i );
bool supported = false;
if ( "OsmSchema-V0.6" == feature ) {
supported = true;
}
else if ( "DenseNodes" == feature ) {
supported = true;
}
if ( !supported ) {
std::cerr << "[error] required feature not supported: " << feature.data() << std::endl;
return false;
}
}
} else {
std::cerr << "[error] blob not loaded!" << std::endl;
}
return true;
}
inline void PBFParser::ReadData() {
bool keepRunning = true;
do {
_ThreadData *threadData = new _ThreadData();
keepRunning = readNextBlock(input, threadData);
if (keepRunning) {
threadDataQueue->push(threadData);
} else {
threadDataQueue->push(NULL); // No more data to read, parse stops when NULL encountered
delete threadData;
}
} while(keepRunning);
}
inline void PBFParser::ParseData() {
while (true) {
_ThreadData *threadData;
threadDataQueue->wait_and_pop(threadData);
if( NULL==threadData ) {
SimpleLogger().Write() << "Parse Data Thread Finished";
threadDataQueue->push(NULL); // Signal end of data for other threads
break;
}
loadBlock(threadData);
for(int i = 0, groupSize = threadData->PBFprimitiveBlock.primitivegroup_size(); i < groupSize; ++i) {
threadData->currentGroupID = i;
loadGroup(threadData);
if(threadData->entityTypeIndicator == TypeNode) {
parseNode(threadData);
}
if(threadData->entityTypeIndicator == TypeWay) {
parseWay(threadData);
}
if(threadData->entityTypeIndicator == TypeRelation) {
parseRelation(threadData);
}
if(threadData->entityTypeIndicator == TypeDenseNode) {
parseDenseNode(threadData);
}
}
delete threadData;
threadData = NULL;
}
}
inline bool PBFParser::Parse() {
// Start the read and parse threads
boost::thread readThread(boost::bind(&PBFParser::ReadData, this));
//Open several parse threads that are synchronized before call to
boost::thread parseThread(boost::bind(&PBFParser::ParseData, this));
// Wait for the threads to finish
readThread.join();
parseThread.join();
return true;
}
inline void PBFParser::parseDenseNode(_ThreadData * threadData) {
const OSMPBF::DenseNodes& dense = threadData->PBFprimitiveBlock.primitivegroup( threadData->currentGroupID ).dense();
int denseTagIndex = 0;
int64_t m_lastDenseID = 0;
int64_t m_lastDenseLatitude = 0;
int64_t m_lastDenseLongitude = 0;
const int number_of_nodes = dense.id_size();
std::vector<ImportNode> extracted_nodes_vector(number_of_nodes);
for(int i = 0; i < number_of_nodes; ++i) {
m_lastDenseID += dense.id( i );
m_lastDenseLatitude += dense.lat( i );
m_lastDenseLongitude += dense.lon( i );
extracted_nodes_vector[i].id = m_lastDenseID;
extracted_nodes_vector[i].lat = COORDINATE_PRECISION*( ( double ) m_lastDenseLatitude * threadData->PBFprimitiveBlock.granularity() + threadData->PBFprimitiveBlock.lat_offset() ) / NANO;
extracted_nodes_vector[i].lon = COORDINATE_PRECISION*( ( double ) m_lastDenseLongitude * threadData->PBFprimitiveBlock.granularity() + threadData->PBFprimitiveBlock.lon_offset() ) / NANO;
while (denseTagIndex < dense.keys_vals_size()) {
const int tagValue = dense.keys_vals( denseTagIndex );
if( 0 == tagValue ) {
++denseTagIndex;
break;
}
const int keyValue = dense.keys_vals ( denseTagIndex+1 );
const std::string & key = threadData->PBFprimitiveBlock.stringtable().s(tagValue);
const std::string & value = threadData->PBFprimitiveBlock.stringtable().s(keyValue);
extracted_nodes_vector[i].keyVals.emplace(key, value);
denseTagIndex += 2;
}
}
#pragma omp parallel for schedule ( guided )
for(int i = 0; i < number_of_nodes; ++i) {
ImportNode &n = extracted_nodes_vector[i];
ParseNodeInLua( n, scriptingEnvironment.getLuaStateForThreadID(omp_get_thread_num()) );
}
BOOST_FOREACH(const ImportNode &n, extracted_nodes_vector) {
extractor_callbacks->nodeFunction(n);
}
}
inline void PBFParser::parseNode(_ThreadData * ) {
throw OSRMException(
"Parsing of simple nodes not supported. PBF should use dense nodes"
);
}
inline void PBFParser::parseRelation(_ThreadData * threadData) {
//TODO: leave early, if relation is not a restriction
//TODO: reuse rawRestriction container
if( !use_turn_restrictions ) {
return;
}
const OSMPBF::PrimitiveGroup& group = threadData->PBFprimitiveBlock.primitivegroup( threadData->currentGroupID );
for(int i = 0, relation_size = group.relations_size(); i < relation_size; ++i ) {
std::string except_tag_string;
const OSMPBF::Relation& inputRelation = threadData->PBFprimitiveBlock.primitivegroup( threadData->currentGroupID ).relations(i);
bool isRestriction = false;
bool isOnlyRestriction = false;
for(int k = 0, endOfKeys = inputRelation.keys_size(); k < endOfKeys; ++k) {
const std::string & key = threadData->PBFprimitiveBlock.stringtable().s(inputRelation.keys(k));
const std::string & val = threadData->PBFprimitiveBlock.stringtable().s(inputRelation.vals(k));
if ("type" == key) {
if( "restriction" == val) {
isRestriction = true;
} else {
break;
}
}
if ("restriction" == key) {
if(val.find("only_") == 0) {
isOnlyRestriction = true;
}
}
if ("except" == key) {
except_tag_string = val;
}
}
if( isRestriction && ShouldIgnoreRestriction(except_tag_string) ) {
continue;
}
if(isRestriction) {
int64_t lastRef = 0;
InputRestrictionContainer currentRestrictionContainer(isOnlyRestriction);
for(
int rolesIndex = 0, last_role = inputRelation.roles_sid_size();
rolesIndex < last_role;
++rolesIndex
) {
const std::string & role = threadData->PBFprimitiveBlock.stringtable().s( inputRelation.roles_sid( rolesIndex ) );
lastRef += inputRelation.memids(rolesIndex);
if(!("from" == role || "to" == role || "via" == role)) {
continue;
}
switch(inputRelation.types(rolesIndex)) {
case 0: //node
if("from" == role || "to" == role) { //Only via should be a node
continue;
}
assert("via" == role);
if(UINT_MAX != currentRestrictionContainer.viaNode) {
currentRestrictionContainer.viaNode = UINT_MAX;
}
assert(UINT_MAX == currentRestrictionContainer.viaNode);
currentRestrictionContainer.restriction.viaNode = lastRef;
break;
case 1: //way
assert("from" == role || "to" == role || "via" == role);
if("from" == role) {
currentRestrictionContainer.fromWay = lastRef;
}
if ("to" == role) {
currentRestrictionContainer.toWay = lastRef;
}
if ("via" == role) {
assert(currentRestrictionContainer.restriction.toNode == UINT_MAX);
currentRestrictionContainer.viaNode = lastRef;
}
break;
case 2: //relation, not used. relations relating to relations are evil.
continue;
assert(false);
break;
default: //should not happen
assert(false);
break;
}
}
if(!extractor_callbacks->restrictionFunction(currentRestrictionContainer)) {
std::cerr << "[PBFParser] relation not parsed" << std::endl;
}
}
}
}
inline void PBFParser::parseWay(_ThreadData * threadData) {
const int number_of_ways = threadData->PBFprimitiveBlock.primitivegroup( threadData->currentGroupID ).ways_size();
std::vector<ExtractionWay> parsed_way_vector(number_of_ways);
for(int i = 0; i < number_of_ways; ++i) {
const OSMPBF::Way& inputWay = threadData->PBFprimitiveBlock.primitivegroup( threadData->currentGroupID ).ways( i );
parsed_way_vector[i].id = inputWay.id();
unsigned pathNode(0);
const int number_of_referenced_nodes = inputWay.refs_size();
for(int j = 0; j < number_of_referenced_nodes; ++j) {
pathNode += inputWay.refs(j);
parsed_way_vector[i].path.push_back(pathNode);
}
assert(inputWay.keys_size() == inputWay.vals_size());
const int number_of_keys = inputWay.keys_size();
for(int j = 0; j < number_of_keys; ++j) {
const std::string & key = threadData->PBFprimitiveBlock.stringtable().s(inputWay.keys(j));
const std::string & val = threadData->PBFprimitiveBlock.stringtable().s(inputWay.vals(j));
parsed_way_vector[i].keyVals.emplace(key, val);
}
}
#pragma omp parallel for schedule ( guided )
for(int i = 0; i < number_of_ways; ++i) {
ExtractionWay & w = parsed_way_vector[i];
if(2 > w.path.size()) {
continue;
}
ParseWayInLua( w, scriptingEnvironment.getLuaStateForThreadID( omp_get_thread_num()) );
}
BOOST_FOREACH(ExtractionWay & w, parsed_way_vector) {
if(2 > w.path.size()) {
continue;
}
extractor_callbacks->wayFunction(w);
}
}
inline void PBFParser::loadGroup(_ThreadData * threadData) {
#ifndef NDEBUG
++groupCount;
#endif
const OSMPBF::PrimitiveGroup& group = threadData->PBFprimitiveBlock.primitivegroup( threadData->currentGroupID );
threadData->entityTypeIndicator = TypeDummy;
if ( 0 != group.nodes_size() ) {
threadData->entityTypeIndicator = TypeNode;
}
if ( 0 != group.ways_size() ) {
threadData->entityTypeIndicator = TypeWay;
}
if ( 0 != group.relations_size() ) {
threadData->entityTypeIndicator = TypeRelation;
}
if ( group.has_dense() ) {
threadData->entityTypeIndicator = TypeDenseNode;
assert( 0 != group.dense().id_size() );
}
assert( threadData->entityTypeIndicator != TypeDummy );
}
inline void PBFParser::loadBlock(_ThreadData * threadData) {
#ifndef NDEBUG
++blockCount;
#endif
threadData->currentGroupID = 0;
threadData->currentEntityID = 0;
}
inline bool PBFParser::readPBFBlobHeader(std::fstream& stream, _ThreadData * threadData) {
int size(0);
stream.read((char *)&size, sizeof(int));
size = swapEndian(size);
if(stream.eof()) {
return false;
}
if ( size > MAX_BLOB_HEADER_SIZE || size < 0 ) {
return false;
}
char *data = new char[size];
stream.read(data, size*sizeof(data[0]));
bool dataSuccessfullyParsed = (threadData->PBFBlobHeader).ParseFromArray( data, size);
delete[] data;
return dataSuccessfullyParsed;
}
inline bool PBFParser::unpackZLIB(std::fstream &, _ThreadData * threadData) {
unsigned rawSize = threadData->PBFBlob.raw_size();
char* unpackedDataArray = new char[rawSize];
z_stream compressedDataStream;
compressedDataStream.next_in = ( unsigned char* ) threadData->PBFBlob.zlib_data().data();
compressedDataStream.avail_in = threadData->PBFBlob.zlib_data().size();
compressedDataStream.next_out = ( unsigned char* ) unpackedDataArray;
compressedDataStream.avail_out = rawSize;
compressedDataStream.zalloc = Z_NULL;
compressedDataStream.zfree = Z_NULL;
compressedDataStream.opaque = Z_NULL;
int ret = inflateInit( &compressedDataStream );
if ( ret != Z_OK ) {
std::cerr << "[error] failed to init zlib stream" << std::endl;
delete[] unpackedDataArray;
return false;
}
ret = inflate( &compressedDataStream, Z_FINISH );
if ( ret != Z_STREAM_END ) {
std::cerr << "[error] failed to inflate zlib stream" << std::endl;
std::cerr << "[error] Error type: " << ret << std::endl;
delete[] unpackedDataArray;
return false;
}
ret = inflateEnd( &compressedDataStream );
if ( ret != Z_OK ) {
std::cerr << "[error] failed to deinit zlib stream" << std::endl;
delete[] unpackedDataArray;
return false;
}
threadData->charBuffer.clear(); threadData->charBuffer.resize(rawSize);
std::copy(unpackedDataArray, unpackedDataArray + rawSize, threadData->charBuffer.begin());
delete[] unpackedDataArray;
return true;
}
inline bool PBFParser::unpackLZMA(std::fstream &, _ThreadData * ) {
return false;
}
inline bool PBFParser::readBlob(std::fstream& stream, _ThreadData * threadData) {
if(stream.eof()) {
return false;
}
const int size = threadData->PBFBlobHeader.datasize();
if ( size < 0 || size > MAX_BLOB_SIZE ) {
std::cerr << "[error] invalid Blob size:" << size << std::endl;
return false;
}
char* data = new char[size];
stream.read(data, sizeof(data[0])*size);
if ( !threadData->PBFBlob.ParseFromArray( data, size ) ) {
std::cerr << "[error] failed to parse blob" << std::endl;
delete[] data;
return false;
}
if ( threadData->PBFBlob.has_raw() ) {
const std::string& data = threadData->PBFBlob.raw();
threadData->charBuffer.clear();
threadData->charBuffer.resize( data.size() );
std::copy(data.begin(), data.end(), threadData->charBuffer.begin());
} else if ( threadData->PBFBlob.has_zlib_data() ) {
if ( !unpackZLIB(stream, threadData) ) {
std::cerr << "[error] zlib data encountered that could not be unpacked" << std::endl;
delete[] data;
return false;
}
} else if ( threadData->PBFBlob.has_lzma_data() ) {
if ( !unpackLZMA(stream, threadData) ) {
std::cerr << "[error] lzma data encountered that could not be unpacked" << std::endl;
}
delete[] data;
return false;
} else {
std::cerr << "[error] Blob contains no data" << std::endl;
delete[] data;
return false;
}
delete[] data;
return true;
}
bool PBFParser::readNextBlock(std::fstream& stream, _ThreadData * threadData) {
if(stream.eof()) {
return false;
}
if ( !readPBFBlobHeader(stream, threadData) ){
return false;
}
if ( threadData->PBFBlobHeader.type() != "OSMData" ) {
return false;
}
if ( !readBlob(stream, threadData) ) {
return false;
}
if ( !threadData->PBFprimitiveBlock.ParseFromArray( &(threadData->charBuffer[0]), threadData-> charBuffer.size() ) ) {
std::cerr << "failed to parse PrimitiveBlock" << std::endl;
return false;
}
return true;
}
-112
View File
@@ -1,112 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PBFPARSER_H_
#define PBFPARSER_H_
#include "BaseParser.h"
#include "../DataStructures/Coordinate.h"
#include "../DataStructures/HashTable.h"
#include "../DataStructures/ConcurrentQueue.h"
#include "../Util/MachineInfo.h"
#include "../Util/OpenMPWrapper.h"
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
#include "../typedefs.h"
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/ref.hpp>
#include <osmpbf/fileformat.pb.h>
#include <osmpbf/osmformat.pb.h>
#include <zlib.h>
class PBFParser : public BaseParser {
enum EntityType {
TypeDummy = 0,
TypeNode = 1,
TypeWay = 2,
TypeRelation = 4,
TypeDenseNode = 8
};
struct _ThreadData {
int currentGroupID;
int currentEntityID;
EntityType entityTypeIndicator;
OSMPBF::BlobHeader PBFBlobHeader;
OSMPBF::Blob PBFBlob;
OSMPBF::HeaderBlock PBFHeaderBlock;
OSMPBF::PrimitiveBlock PBFprimitiveBlock;
std::vector<char> charBuffer;
};
public:
PBFParser(const char * fileName, ExtractorCallbacks* ec, ScriptingEnvironment& se);
virtual ~PBFParser();
inline bool ReadHeader();
inline bool Parse();
private:
inline void ReadData();
inline void ParseData();
inline void parseDenseNode (_ThreadData * threadData);
inline void parseNode (_ThreadData * threadData);
inline void parseRelation (_ThreadData * threadData);
inline void parseWay (_ThreadData * threadData);
inline void loadGroup (_ThreadData * threadData);
inline void loadBlock (_ThreadData * threadData);
inline bool readPBFBlobHeader(std::fstream & stream, _ThreadData * threadData);
inline bool unpackZLIB (std::fstream & stream, _ThreadData * threadData);
inline bool unpackLZMA (std::fstream & stream, _ThreadData * threadData);
inline bool readBlob (std::fstream & stream, _ThreadData * threadData);
inline bool readNextBlock (std::fstream & stream, _ThreadData * threadData);
static const int NANO = 1000 * 1000 * 1000;
static const int MAX_BLOB_HEADER_SIZE = 64 * 1024;
static const int MAX_BLOB_SIZE = 32 * 1024 * 1024;
#ifndef NDEBUG
/* counting the number of read blocks and groups */
unsigned groupCount;
unsigned blockCount;
#endif
std::fstream input; // the input stream to parse
boost::shared_ptr<ConcurrentQueue < _ThreadData* > > threadDataQueue;
};
#endif /* PBFPARSER_H_ */
-119
View File
@@ -1,119 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "ScriptingEnvironment.h"
ScriptingEnvironment::ScriptingEnvironment() {}
ScriptingEnvironment::ScriptingEnvironment(const char * fileName) {
SimpleLogger().Write() << "Using script " << fileName;
// Create a new lua state
for(int i = 0; i < omp_get_max_threads(); ++i) {
luaStateVector.push_back(luaL_newstate());
}
// Connect LuaBind to this lua state for all threads
#pragma omp parallel
{
lua_State * myLuaState = getLuaStateForThreadID(omp_get_thread_num());
luabind::open(myLuaState);
//open utility libraries string library;
luaL_openlibs(myLuaState);
luaAddScriptFolderToLoadPath( myLuaState, fileName );
// Add our function to the state's global scope
luabind::module(myLuaState) [
luabind::def("print", LUA_print<std::string>),
luabind::def("parseMaxspeed", parseMaxspeed),
luabind::def("durationIsValid", durationIsValid),
luabind::def("parseDuration", parseDuration)
];
luabind::module(myLuaState) [
luabind::class_<HashTable<std::string, std::string> >("keyVals")
.def("Add", &HashTable<std::string, std::string>::Add)
.def("Find", &HashTable<std::string, std::string>::Find)
.def("Holds", &HashTable<std::string, std::string>::Holds)
];
luabind::module(myLuaState) [
luabind::class_<ImportNode>("Node")
.def(luabind::constructor<>())
.def_readwrite("lat", &ImportNode::lat)
.def_readwrite("lon", &ImportNode::lon)
.def_readonly("id", &ImportNode::id)
.def_readwrite("bollard", &ImportNode::bollard)
.def_readwrite("traffic_light", &ImportNode::trafficLight)
.def_readwrite("tags", &ImportNode::keyVals)
];
luabind::module(myLuaState) [
luabind::class_<ExtractionWay>("Way")
.def(luabind::constructor<>())
.def_readonly("id", &ExtractionWay::id)
.def_readwrite("name", &ExtractionWay::name)
.def_readwrite("speed", &ExtractionWay::speed)
.def_readwrite("backward_speed", &ExtractionWay::backward_speed)
.def_readwrite("duration", &ExtractionWay::duration)
.def_readwrite("type", &ExtractionWay::type)
.def_readwrite("access", &ExtractionWay::access)
.def_readwrite("roundabout", &ExtractionWay::roundabout)
.def_readwrite("is_access_restricted", &ExtractionWay::isAccessRestricted)
.def_readwrite("ignore_in_grid", &ExtractionWay::ignoreInGrid)
.def_readwrite("tags", &ExtractionWay::keyVals)
.def_readwrite("direction", &ExtractionWay::direction)
.enum_("constants") [
luabind::value("notSure", 0),
luabind::value("oneway", 1),
luabind::value("bidirectional", 2),
luabind::value("opposite", 3)
]
];
// fails on c++11/OS X 10.9
luabind::module(myLuaState) [
luabind::class_<std::vector<std::string> >("vector")
.def("Add", static_cast<void (std::vector<std::string>::*)(const std::string&)>(&std::vector<std::string>::push_back)
)
];
if(0 != luaL_dofile(myLuaState, fileName) ) {
throw OSRMException("ERROR occured in scripting block");
}
}
}
ScriptingEnvironment::~ScriptingEnvironment() {
for(unsigned i = 0; i < luaStateVector.size(); ++i) {
// luaStateVector[i];
}
}
lua_State * ScriptingEnvironment::getLuaStateForThreadID(const int id) {
return luaStateVector[id];
}
-53
View File
@@ -1,53 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SCRIPTINGENVIRONMENT_H_
#define SCRIPTINGENVIRONMENT_H_
#include "ExtractionHelperFunctions.h"
#include "ExtractorStructs.h"
#include "../DataStructures/ImportNode.h"
#include "../Util/LuaUtil.h"
#include "../Util/OpenMPWrapper.h"
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
#include "../typedefs.h"
#include <vector>
class ScriptingEnvironment {
public:
ScriptingEnvironment();
ScriptingEnvironment(const char * fileName);
virtual ~ScriptingEnvironment();
lua_State * getLuaStateForThreadID(const int);
std::vector<lua_State *> luaStateVector;
};
#endif /* SCRIPTINGENVIRONMENT_H_ */
-284
View File
@@ -1,284 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "XMLParser.h"
#include "ExtractorStructs.h"
#include "../DataStructures/HashTable.h"
#include "../DataStructures/InputReaderFactory.h"
#include <boost/ref.hpp>
XMLParser::XMLParser(const char * filename, ExtractorCallbacks* ec, ScriptingEnvironment& se) : BaseParser(ec, se) {
SimpleLogger().Write(logWARNING) <<
"Parsing plain .osm/.osm.bz2 is deprecated. Switch to .pbf";
inputReader = inputReaderFactory(filename);
}
bool XMLParser::ReadHeader() {
return (xmlTextReaderRead( inputReader ) == 1);
}
bool XMLParser::Parse() {
while ( xmlTextReaderRead( inputReader ) == 1 ) {
const int type = xmlTextReaderNodeType( inputReader );
//1 is Element
if ( type != 1 ) {
continue;
}
xmlChar* currentName = xmlTextReaderName( inputReader );
if ( currentName == NULL ) {
continue;
}
if ( xmlStrEqual( currentName, ( const xmlChar* ) "node" ) == 1 ) {
ImportNode n = _ReadXMLNode();
ParseNodeInLua( n, luaState );
extractor_callbacks->nodeFunction(n);
// if(!extractor_callbacks->nodeFunction(n))
// std::cerr << "[XMLParser] dense node not parsed" << std::endl;
}
if ( xmlStrEqual( currentName, ( const xmlChar* ) "way" ) == 1 ) {
ExtractionWay way = _ReadXMLWay( );
ParseWayInLua( way, luaState );
extractor_callbacks->wayFunction(way);
// if(!extractor_callbacks->wayFunction(way))
// std::cerr << "[PBFParser] way not parsed" << std::endl;
}
if( use_turn_restrictions ) {
if ( xmlStrEqual( currentName, ( const xmlChar* ) "relation" ) == 1 ) {
InputRestrictionContainer r = _ReadXMLRestriction();
if(r.fromWay != UINT_MAX) {
if(!extractor_callbacks->restrictionFunction(r)) {
std::cerr << "[XMLParser] restriction not parsed" << std::endl;
}
}
}
}
xmlFree( currentName );
}
return true;
}
InputRestrictionContainer XMLParser::_ReadXMLRestriction() {
InputRestrictionContainer restriction;
std::string except_tag_string;
if ( xmlTextReaderIsEmptyElement( inputReader ) != 1 ) {
const int depth = xmlTextReaderDepth( inputReader );while ( xmlTextReaderRead( inputReader ) == 1 ) {
const int childType = xmlTextReaderNodeType( inputReader );
if ( childType != 1 && childType != 15 ) {
continue;
}
const int childDepth = xmlTextReaderDepth( inputReader );
xmlChar* childName = xmlTextReaderName( inputReader );
if ( childName == NULL ) {
continue;
}
if ( depth == childDepth && childType == 15 && xmlStrEqual( childName, ( const xmlChar* ) "relation" ) == 1 ) {
xmlFree( childName );
break;
}
if ( childType != 1 ) {
xmlFree( childName );
continue;
}
if ( xmlStrEqual( childName, ( const xmlChar* ) "tag" ) == 1 ) {
xmlChar* k = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "k" );
xmlChar* value = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "v" );
if ( k != NULL && value != NULL ) {
if(xmlStrEqual(k, ( const xmlChar* ) "restriction" )){
if(0 == std::string((const char *) value).find("only_")) {
restriction.restriction.flags.isOnly = true;
}
}
if ( xmlStrEqual(k, (const xmlChar *) "except") ) {
except_tag_string = (const char*) value;
}
}
if ( k != NULL ) {
xmlFree( k );
}
if ( value != NULL ) {
xmlFree( value );
}
} else if ( xmlStrEqual( childName, ( const xmlChar* ) "member" ) == 1 ) {
xmlChar* ref = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "ref" );
if ( ref != NULL ) {
xmlChar * role = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "role" );
xmlChar * type = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "type" );
if(xmlStrEqual(role, (const xmlChar *) "to") && xmlStrEqual(type, (const xmlChar *) "way")) {
restriction.toWay = stringToUint((const char*) ref);
}
if(xmlStrEqual(role, (const xmlChar *) "from") && xmlStrEqual(type, (const xmlChar *) "way")) {
restriction.fromWay = stringToUint((const char*) ref);
}
if(xmlStrEqual(role, (const xmlChar *) "via") && xmlStrEqual(type, (const xmlChar *) "node")) {
restriction.restriction.viaNode = stringToUint((const char*) ref);
}
if(NULL != type) {
xmlFree( type );
}
if(NULL != role) {
xmlFree( role );
}
if(NULL != ref) {
xmlFree( ref );
}
}
}
xmlFree( childName );
}
}
if( ShouldIgnoreRestriction(except_tag_string) ) {
restriction.fromWay = UINT_MAX; //workaround to ignore the restriction
}
return restriction;
}
ExtractionWay XMLParser::_ReadXMLWay() {
ExtractionWay way;
if ( xmlTextReaderIsEmptyElement( inputReader ) != 1 ) {
const int depth = xmlTextReaderDepth( inputReader );
while ( xmlTextReaderRead( inputReader ) == 1 ) {
const int childType = xmlTextReaderNodeType( inputReader );
if ( childType != 1 && childType != 15 ) {
continue;
}
const int childDepth = xmlTextReaderDepth( inputReader );
xmlChar* childName = xmlTextReaderName( inputReader );
if ( childName == NULL ) {
continue;
}
if ( depth == childDepth && childType == 15 && xmlStrEqual( childName, ( const xmlChar* ) "way" ) == 1 ) {
xmlChar* id = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "id" );
way.id = stringToUint((char*)id);
xmlFree(id);
xmlFree( childName );
break;
}
if ( childType != 1 ) {
xmlFree( childName );
continue;
}
if ( xmlStrEqual( childName, ( const xmlChar* ) "tag" ) == 1 ) {
xmlChar* k = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "k" );
xmlChar* value = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "v" );
// cout << "->k=" << k << ", v=" << value << endl;
if ( k != NULL && value != NULL ) {
way.keyVals.Add(std::string( (char *) k ), std::string( (char *) value));
}
if ( k != NULL ) {
xmlFree( k );
}
if ( value != NULL ) {
xmlFree( value );
}
} else if ( xmlStrEqual( childName, ( const xmlChar* ) "nd" ) == 1 ) {
xmlChar* ref = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "ref" );
if ( ref != NULL ) {
way.path.push_back( stringToUint(( const char* ) ref ) );
xmlFree( ref );
}
}
xmlFree( childName );
}
}
return way;
}
ImportNode XMLParser::_ReadXMLNode() {
ImportNode node;
xmlChar* attribute = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "lat" );
if ( attribute != NULL ) {
node.lat = static_cast<NodeID>(COORDINATE_PRECISION*atof(( const char* ) attribute ) );
xmlFree( attribute );
}
attribute = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "lon" );
if ( attribute != NULL ) {
node.lon = static_cast<NodeID>(COORDINATE_PRECISION*atof(( const char* ) attribute ));
xmlFree( attribute );
}
attribute = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "id" );
if ( attribute != NULL ) {
node.id = stringToUint(( const char* ) attribute );
xmlFree( attribute );
}
if ( xmlTextReaderIsEmptyElement( inputReader ) != 1 ) {
const int depth = xmlTextReaderDepth( inputReader );
while ( xmlTextReaderRead( inputReader ) == 1 ) {
const int childType = xmlTextReaderNodeType( inputReader );
// 1 = Element, 15 = EndElement
if ( childType != 1 && childType != 15 ) {
continue;
}
const int childDepth = xmlTextReaderDepth( inputReader );
xmlChar* childName = xmlTextReaderName( inputReader );
if ( childName == NULL ) {
continue;
}
if ( depth == childDepth && childType == 15 && xmlStrEqual( childName, ( const xmlChar* ) "node" ) == 1 ) {
xmlFree( childName );
break;
}
if ( childType != 1 ) {
xmlFree( childName );
continue;
}
if ( xmlStrEqual( childName, ( const xmlChar* ) "tag" ) == 1 ) {
xmlChar* k = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "k" );
xmlChar* value = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "v" );
if ( k != NULL && value != NULL ) {
node.keyVals.Add(std::string( reinterpret_cast<char*>(k) ), std::string( reinterpret_cast<char*>(value)));
}
if ( k != NULL ) {
xmlFree( k );
}
if ( value != NULL ) {
xmlFree( value );
}
}
xmlFree( childName );
}
}
return node;
}
-53
View File
@@ -1,53 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef XMLPARSER_H_
#define XMLPARSER_H_
#include "BaseParser.h"
#include "../DataStructures/Coordinate.h"
#include "../Util/SimpleLogger.h"
#include "../Util/StringUtil.h"
#include "../typedefs.h"
#include <libxml/xmlreader.h>
class XMLParser : public BaseParser {
public:
XMLParser(const char* filename, ExtractorCallbacks* ec, ScriptingEnvironment& se);
bool ReadHeader();
bool Parse();
private:
InputRestrictionContainer _ReadXMLRestriction();
ExtractionWay _ReadXMLWay();
ImportNode _ReadXMLNode();
xmlTextReaderPtr inputReader;
};
#endif /* XMLPARSER_H_ */
-7
View File
@@ -1,7 +0,0 @@
source "http://rubygems.org"
gem "cucumber"
gem "rake"
gem "osmlib-base"
gem "sys-proctable"
gem "rspec-expectations"
-30
View File
@@ -1,30 +0,0 @@
GEM
remote: http://rubygems.org/
specs:
builder (3.2.2)
cucumber (1.3.8)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.12.1)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.0.2)
diff-lcs (1.2.4)
gherkin (2.12.1)
multi_json (~> 1.3)
multi_json (1.8.0)
multi_test (0.0.2)
osmlib-base (0.1.4)
rake (10.1.0)
rspec-expectations (2.14.3)
diff-lcs (>= 1.1.3, < 2.0)
sys-proctable (0.9.3)
PLATFORMS
ruby
DEPENDENCIES
cucumber
osmlib-base
rake
rspec-expectations
sys-proctable
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
Copyright (c) 2016, Project OSRM contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
-131
View File
@@ -1,131 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "OSRM.h"
OSRM::OSRM( const ServerPaths & server_paths, const bool use_shared_memory )
:
use_shared_memory(use_shared_memory)
{
if( !use_shared_memory ) {
query_data_facade = new InternalDataFacade<QueryEdge::EdgeData>(
server_paths
);
} else {
query_data_facade = new SharedDataFacade<QueryEdge::EdgeData>( );
}
//The following plugins handle all requests.
RegisterPlugin(
new HelloWorldPlugin()
);
RegisterPlugin(
new LocatePlugin<BaseDataFacade<QueryEdge::EdgeData> >(
query_data_facade
)
);
RegisterPlugin(
new NearestPlugin<BaseDataFacade<QueryEdge::EdgeData> >(
query_data_facade
)
);
RegisterPlugin(
new TimestampPlugin<BaseDataFacade<QueryEdge::EdgeData> >(
query_data_facade
)
);
RegisterPlugin(
new ViaRoutePlugin<BaseDataFacade<QueryEdge::EdgeData> >(
query_data_facade
)
);
}
OSRM::~OSRM() {
BOOST_FOREACH(PluginMap::value_type & plugin_pointer, plugin_map) {
delete plugin_pointer.second;
}
}
void OSRM::RegisterPlugin(BasePlugin * plugin) {
SimpleLogger().Write() << "loaded plugin: " << plugin->GetDescriptor();
if( plugin_map.find(plugin->GetDescriptor()) != plugin_map.end() ) {
delete plugin_map.find(plugin->GetDescriptor())->second;
}
plugin_map.emplace(plugin->GetDescriptor(), plugin);
}
void OSRM::RunQuery(RouteParameters & route_parameters, http::Reply & reply) {
const PluginMap::const_iterator & iter = plugin_map.find(
route_parameters.service
);
if(plugin_map.end() != iter) {
reply.status = http::Reply::ok;
if( use_shared_memory ) {
// lock update pending
boost::interprocess::scoped_lock<
boost::interprocess::named_mutex
> pending_lock(barrier.pending_update_mutex);
// lock query
boost::interprocess::scoped_lock<
boost::interprocess::named_mutex
> query_lock(barrier.query_mutex);
// unlock update pending
pending_lock.unlock();
// increment query count
++(barrier.number_of_queries);
(static_cast<SharedDataFacade<QueryEdge::EdgeData>* >(query_data_facade))->CheckAndReloadFacade();
}
iter->second->HandleRequest(route_parameters, reply );
if( use_shared_memory ) {
// lock query
boost::interprocess::scoped_lock<
boost::interprocess::named_mutex
> query_lock(barrier.query_mutex);
// decrement query count
--(barrier.number_of_queries);
BOOST_ASSERT_MSG(
0 <= barrier.number_of_queries,
"invalid number of queries"
);
// notify all processes that were waiting for this condition
if (0 == barrier.number_of_queries) {
barrier.no_running_queries_condition.notify_all();
}
}
} else {
reply = http::Reply::StockReply(http::Reply::badRequest);
}
}
-80
View File
@@ -1,80 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef OSRM_H
#define OSRM_H
#include "OSRM.h"
#include "../Plugins/BasePlugin.h"
#include "../Plugins/HelloWorldPlugin.h"
#include "../Plugins/LocatePlugin.h"
#include "../Plugins/NearestPlugin.h"
#include "../Plugins/TimestampPlugin.h"
#include "../Plugins/ViaRoutePlugin.h"
#include "../Server/DataStructures/BaseDataFacade.h"
#include "../Server/DataStructures/InternalDataFacade.h"
#include "../Server/DataStructures/SharedBarriers.h"
#include "../Server/DataStructures/SharedDataFacade.h"
#include "../Server/DataStructures/RouteParameters.h"
#include "../Util/InputFileUtil.h"
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
#include <boost/assert.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
#include <vector>
class OSRM : boost::noncopyable {
private:
typedef boost::unordered_map<std::string, BasePlugin *> PluginMap;
public:
OSRM(
const ServerPaths & paths,
const bool use_shared_memory = false
);
~OSRM();
void RunQuery(RouteParameters & route_parameters, http::Reply & reply);
private:
void RegisterPlugin(BasePlugin * plugin);
PluginMap plugin_map;
bool use_shared_memory;
SharedBarriers barrier;
//base class pointer to the objects
BaseDataFacade<QueryEdge::EdgeData> * query_data_facade;
};
#endif //OSRM_H
-59
View File
@@ -1,59 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BASEPLUGIN_H_
#define BASEPLUGIN_H_
#include "../DataStructures/Coordinate.h"
#include "../Server/DataStructures/RouteParameters.h"
#include "../Server/Http/Reply.h"
#include <string>
#include <vector>
class BasePlugin {
public:
BasePlugin() { }
//Maybe someone can explain the pure virtual destructor thing to me (dennis)
virtual ~BasePlugin() { }
virtual const std::string & GetDescriptor() const = 0;
virtual void HandleRequest(const RouteParameters & routeParameters, http::Reply& reply) = 0;
inline bool checkCoord(const FixedPointCoordinate & c) {
if(
c.lat > 90*COORDINATE_PRECISION ||
c.lat < -90*COORDINATE_PRECISION ||
c.lon > 180*COORDINATE_PRECISION ||
c.lon < -180*COORDINATE_PRECISION
) {
return false;
}
return true;
}
};
#endif /* BASEPLUGIN_H_ */
-101
View File
@@ -1,101 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef HELLOWORLDPLUGIN_H_
#define HELLOWORLDPLUGIN_H_
#include "BasePlugin.h"
#include "../Util/StringUtil.h"
#include <string>
class HelloWorldPlugin : public BasePlugin {
private:
std::string temp_string;
public:
HelloWorldPlugin() : descriptor_string("hello"){}
virtual ~HelloWorldPlugin() { }
const std::string & GetDescriptor() const { return descriptor_string; }
void HandleRequest(const RouteParameters & routeParameters, http::Reply& reply) {
reply.status = http::Reply::ok;
reply.content.push_back("<html><head><title>Hello World Demonstration Document</title></head><body><h1>Hello, World!</h1>");
reply.content.push_back("<pre>");
reply.content.push_back("zoom level: ");
intToString(routeParameters.zoomLevel, temp_string);
reply.content.push_back(temp_string);
reply.content.push_back("\nchecksum: ");
intToString(routeParameters.checkSum, temp_string);
reply.content.push_back(temp_string);
reply.content.push_back("\ninstructions: ");
reply.content.push_back((routeParameters.printInstructions ? "yes" : "no"));
reply.content.push_back(temp_string);
reply.content.push_back("\ngeometry: ");
reply.content.push_back((routeParameters.geometry ? "yes" : "no"));
reply.content.push_back("\ncompression: ");
reply.content.push_back((routeParameters.compression ? "yes" : "no"));
reply.content.push_back("\noutput format: ");
reply.content.push_back(routeParameters.outputFormat);
reply.content.push_back("\njson parameter: ");
reply.content.push_back(routeParameters.jsonpParameter);
reply.content.push_back("\nlanguage: ");
reply.content.push_back(routeParameters.language);
reply.content.push_back("\nNumber of locations: ");
intToString(routeParameters.coordinates.size(), temp_string);
reply.content.push_back(temp_string);
reply.content.push_back("\n");
for(unsigned i = 0; i < routeParameters.coordinates.size(); ++i) {
reply.content.push_back( " [");
intToString(i, temp_string);
reply.content.push_back(temp_string);
reply.content.push_back("] ");
doubleToString(routeParameters.coordinates[i].lat/COORDINATE_PRECISION, temp_string);
reply.content.push_back(temp_string);
reply.content.push_back(",");
doubleToString(routeParameters.coordinates[i].lon/COORDINATE_PRECISION, temp_string);
reply.content.push_back(temp_string);
reply.content.push_back("\n");
}
reply.content.push_back( "Number of hints: ");
intToString(routeParameters.hints.size(), temp_string);
reply.content.push_back(temp_string);
reply.content.push_back("\n");
for(unsigned i = 0; i < routeParameters.hints.size(); ++i) {
reply.content.push_back( " [");
intToString(i, temp_string);
reply.content.push_back(temp_string);
reply.content.push_back("] ");
reply.content.push_back(routeParameters.hints[i]);
reply.content.push_back("\n");
}
reply.content.push_back( "</pre></body></html>");
}
private:
std::string descriptor_string;
};
#endif /* HELLOWORLDPLUGIN_H_ */
-123
View File
@@ -1,123 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LOCATEPLUGIN_H_
#define LOCATEPLUGIN_H_
#include "BasePlugin.h"
#include "../Util/StringUtil.h"
//locates the nearest node in the road network for a given coordinate.
template<class DataFacadeT>
class LocatePlugin : public BasePlugin {
public:
LocatePlugin(DataFacadeT * facade)
:
descriptor_string("locate"),
facade(facade)
{ }
const std::string & GetDescriptor() const { return descriptor_string; }
void HandleRequest(
const RouteParameters & routeParameters,
http::Reply& reply
) {
//check number of parameters
if(!routeParameters.coordinates.size()) {
reply = http::Reply::StockReply(http::Reply::badRequest);
return;
}
if(false == checkCoord(routeParameters.coordinates[0])) {
reply = http::Reply::StockReply(http::Reply::badRequest);
return;
}
//query to helpdesk
FixedPointCoordinate result;
std::string tmp;
//json
if(!routeParameters.jsonpParameter.empty()) {
reply.content.push_back(routeParameters.jsonpParameter);
reply.content.push_back("(");
}
reply.status = http::Reply::ok;
reply.content.push_back ("{");
reply.content.push_back ("\"version\":0.3,");
if(
!facade->LocateClosestEndPointForCoordinate(
routeParameters.coordinates[0],
result
)
) {
reply.content.push_back ("\"status\":207,");
reply.content.push_back ("\"mapped_coordinate\":[]");
} else {
//Write coordinate to stream
reply.status = http::Reply::ok;
reply.content.push_back ("\"status\":0,");
reply.content.push_back ("\"mapped_coordinate\":");
convertInternalLatLonToString(result.lat, tmp);
reply.content.push_back("[");
reply.content.push_back(tmp);
convertInternalLatLonToString(result.lon, tmp);
reply.content.push_back(",");
reply.content.push_back(tmp);
reply.content.push_back("]");
}
reply.content.push_back(",\"transactionId\": \"OSRM Routing Engine JSON Locate (v0.3)\"");
reply.content.push_back("}");
reply.headers.resize(3);
if(!routeParameters.jsonpParameter.empty()) {
reply.content.push_back( ")");
reply.headers[1].name = "Content-Type";
reply.headers[1].value = "text/javascript";
reply.headers[2].name = "Content-Disposition";
reply.headers[2].value = "attachment; filename=\"location.js\"";
} else {
reply.headers[1].name = "Content-Type";
reply.headers[1].value = "application/x-javascript";
reply.headers[2].name = "Content-Disposition";
reply.headers[2].value = "attachment; filename=\"location.json\"";
}
reply.headers[0].name = "Content-Length";
unsigned content_length = 0;
BOOST_FOREACH(const std::string & snippet, reply.content) {
content_length += snippet.length();
}
intToString(content_length, tmp);
reply.headers[0].value = tmp;
return;
}
private:
std::string descriptor_string;
DataFacadeT * facade;
};
#endif /* LOCATEPLUGIN_H_ */
-132
View File
@@ -1,132 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NearestPlugin_H_
#define NearestPlugin_H_
#include "BasePlugin.h"
#include "../DataStructures/PhantomNodes.h"
#include "../Util/StringUtil.h"
/*
* This Plugin locates the nearest point on a street in the road network for a given coordinate.
*/
template<class DataFacadeT>
class NearestPlugin : public BasePlugin {
public:
NearestPlugin(DataFacadeT * facade )
:
facade(facade),
descriptor_string("nearest")
{
descriptorTable.insert(std::make_pair("" , 0)); //default descriptor
descriptorTable.insert(std::make_pair("json", 1));
}
const std::string & GetDescriptor() const { return descriptor_string; }
void HandleRequest(const RouteParameters & routeParameters, http::Reply& reply) {
//check number of parameters
if(!routeParameters.coordinates.size()) {
reply = http::Reply::StockReply(http::Reply::badRequest);
return;
}
if( !checkCoord(routeParameters.coordinates[0]) ) {
reply = http::Reply::StockReply(http::Reply::badRequest);
return;
}
PhantomNode result;
facade->FindPhantomNodeForCoordinate(
routeParameters.coordinates[0],
result,
routeParameters.zoomLevel
);
std::string temp_string;
//json
if("" != routeParameters.jsonpParameter) {
reply.content.push_back(routeParameters.jsonpParameter);
reply.content.push_back("(");
}
reply.status = http::Reply::ok;
reply.content.push_back("{");
reply.content.push_back("\"version\":0.3,");
reply.content.push_back("\"status\":");
if(UINT_MAX != result.edgeBasedNode) {
reply.content.push_back("0,");
} else {
reply.content.push_back("207,");
}
reply.content.push_back("\"mapped_coordinate\":");
reply.content.push_back("[");
if(UINT_MAX != result.edgeBasedNode) {
convertInternalLatLonToString(result.location.lat, temp_string);
reply.content.push_back(temp_string);
convertInternalLatLonToString(result.location.lon, temp_string);
reply.content.push_back(",");
reply.content.push_back(temp_string);
}
reply.content.push_back("],");
reply.content.push_back("\"name\":\"");
if(UINT_MAX != result.edgeBasedNode) {
facade->GetName(result.nodeBasedEdgeNameID, temp_string);
reply.content.push_back(temp_string);
}
reply.content.push_back("\"");
reply.content.push_back(",\"transactionId\":\"OSRM Routing Engine JSON Nearest (v0.3)\"");
reply.content.push_back("}");
reply.headers.resize(3);
if( !routeParameters.jsonpParameter.empty() ) {
reply.content.push_back(")");
reply.headers[1].name = "Content-Type";
reply.headers[1].value = "text/javascript";
reply.headers[2].name = "Content-Disposition";
reply.headers[2].value = "attachment; filename=\"location.js\"";
} else {
reply.headers[1].name = "Content-Type";
reply.headers[1].value = "application/x-javascript";
reply.headers[2].name = "Content-Disposition";
reply.headers[2].value = "attachment; filename=\"location.json\"";
}
reply.headers[0].name = "Content-Length";
unsigned content_length = 0;
BOOST_FOREACH(const std::string & snippet, reply.content) {
content_length += snippet.length();
}
intToString(content_length, temp_string);
reply.headers[0].value = temp_string;
}
private:
DataFacadeT * facade;
HashTable<std::string, unsigned> descriptorTable;
std::string descriptor_string;
};
#endif /* NearestPlugin_H_ */
-84
View File
@@ -1,84 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef TIMESTAMPPLUGIN_H_
#define TIMESTAMPPLUGIN_H_
#include "BasePlugin.h"
template<class DataFacadeT>
class TimestampPlugin : public BasePlugin {
public:
TimestampPlugin(const DataFacadeT * facade)
: facade(facade), descriptor_string("timestamp")
{ }
const std::string & GetDescriptor() const { return descriptor_string; }
void HandleRequest(const RouteParameters & routeParameters, http::Reply& reply) {
std::string tmp;
//json
if("" != routeParameters.jsonpParameter) {
reply.content.push_back(routeParameters.jsonpParameter);
reply.content.push_back("(");
}
reply.status = http::Reply::ok;
reply.content.push_back("{");
reply.content.push_back("\"version\":0.3,");
reply.content.push_back("\"status\":");
reply.content.push_back("0,");
reply.content.push_back("\"timestamp\":\"");
reply.content.push_back(facade->GetTimestamp());
reply.content.push_back("\"");
reply.content.push_back(",\"transactionId\":\"OSRM Routing Engine JSON timestamp (v0.3)\"");
reply.content.push_back("}");
reply.headers.resize(3);
if("" != routeParameters.jsonpParameter) {
reply.content.push_back(")");
reply.headers[1].name = "Content-Type";
reply.headers[1].value = "text/javascript";
reply.headers[2].name = "Content-Disposition";
reply.headers[2].value = "attachment; filename=\"timestamp.js\"";
} else {
reply.headers[1].name = "Content-Type";
reply.headers[1].value = "application/x-javascript";
reply.headers[2].name = "Content-Disposition";
reply.headers[2].value = "attachment; filename=\"timestamp.json\"";
}
unsigned content_length = 0;
BOOST_FOREACH(const std::string & snippet, reply.content) {
content_length += snippet.length();
}
intToString(content_length, tmp);
reply.headers[0].value = tmp;
}
private:
const DataFacadeT * facade;
std::string descriptor_string;
};
#endif /* TIMESTAMPPLUGIN_H_ */
-237
View File
@@ -1,237 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef VIAROUTEPLUGIN_H_
#define VIAROUTEPLUGIN_H_
#include "BasePlugin.h"
#include "../Algorithms/ObjectToBase64.h"
#include "../DataStructures/QueryEdge.h"
#include "../DataStructures/SearchEngine.h"
#include "../Descriptors/BaseDescriptor.h"
#include "../Descriptors/GPXDescriptor.h"
#include "../Descriptors/JSONDescriptor.h"
#include "../Util/SimpleLogger.h"
#include "../Util/StringUtil.h"
#include <boost/unordered_map.hpp>
#include <cstdlib>
#include <string>
#include <vector>
template<class DataFacadeT>
class ViaRoutePlugin : public BasePlugin {
private:
boost::unordered_map<std::string, unsigned> descriptorTable;
SearchEngine<DataFacadeT> * search_engine_ptr;
public:
ViaRoutePlugin(DataFacadeT * facade)
:
descriptor_string("viaroute"),
facade(facade)
{
//TODO: set up an engine for each thread!!
search_engine_ptr = new SearchEngine<DataFacadeT>(facade);
descriptorTable.emplace("json", 0);
descriptorTable.emplace("gpx" , 1);
}
virtual ~ViaRoutePlugin() {
delete search_engine_ptr;
}
const std::string & GetDescriptor() const { return descriptor_string; }
void HandleRequest(
const RouteParameters & routeParameters,
http::Reply& reply
) {
//check number of parameters
if( 2 > routeParameters.coordinates.size() ) {
reply = http::Reply::StockReply(http::Reply::badRequest);
return;
}
RawRouteData rawRoute;
rawRoute.checkSum = facade->GetCheckSum();
bool checksumOK = (routeParameters.checkSum == rawRoute.checkSum);
std::vector<std::string> textCoord;
for(unsigned i = 0; i < routeParameters.coordinates.size(); ++i) {
if( !checkCoord(routeParameters.coordinates[i]) ) {
reply = http::Reply::StockReply(http::Reply::badRequest);
return;
}
rawRoute.rawViaNodeCoordinates.push_back(routeParameters.coordinates[i]);
}
std::vector<PhantomNode> phantomNodeVector(rawRoute.rawViaNodeCoordinates.size());
for(unsigned i = 0; i < rawRoute.rawViaNodeCoordinates.size(); ++i) {
if(checksumOK && i < routeParameters.hints.size() && "" != routeParameters.hints[i]) {
// SimpleLogger().Write() <<"Decoding hint: " << routeParameters.hints[i] << " for location index " << i;
DecodeObjectFromBase64(routeParameters.hints[i], phantomNodeVector[i]);
if(phantomNodeVector[i].isValid(facade->GetNumberOfNodes())) {
// SimpleLogger().Write() << "Decoded hint " << i << " successfully";
continue;
}
}
// SimpleLogger().Write() << "Brute force lookup of coordinate " << i;
facade->FindPhantomNodeForCoordinate(
rawRoute.rawViaNodeCoordinates[i],
phantomNodeVector[i],
routeParameters.zoomLevel
);
}
for(unsigned i = 0; i < phantomNodeVector.size()-1; ++i) {
PhantomNodes segmentPhantomNodes;
segmentPhantomNodes.startPhantom = phantomNodeVector[i];
segmentPhantomNodes.targetPhantom = phantomNodeVector[i+1];
rawRoute.segmentEndCoordinates.push_back(segmentPhantomNodes);
}
if(
( routeParameters.alternateRoute ) &&
(1 == rawRoute.segmentEndCoordinates.size())
) {
search_engine_ptr->alternative_path(
rawRoute.segmentEndCoordinates[0],
rawRoute
);
} else {
search_engine_ptr->shortest_path(
rawRoute.segmentEndCoordinates,
rawRoute
);
}
if(INT_MAX == rawRoute.lengthOfShortestPath ) {
SimpleLogger().Write(logDEBUG) <<
"Error occurred, single path not found";
}
reply.status = http::Reply::ok;
//TODO: Move to member as smart pointer
BaseDescriptor<DataFacadeT> * desc;
if("" != routeParameters.jsonpParameter) {
reply.content.push_back(routeParameters.jsonpParameter);
reply.content.push_back("(");
}
DescriptorConfig descriptorConfig;
unsigned descriptorType = 0;
if(descriptorTable.find(routeParameters.outputFormat) != descriptorTable.end() ) {
descriptorType = descriptorTable.find(routeParameters.outputFormat)->second;
}
descriptorConfig.zoom_level = routeParameters.zoomLevel;
descriptorConfig.instructions = routeParameters.printInstructions;
descriptorConfig.geometry = routeParameters.geometry;
descriptorConfig.encode_geometry = routeParameters.compression;
switch(descriptorType){
case 0:
desc = new JSONDescriptor<DataFacadeT>();
break;
case 1:
desc = new GPXDescriptor<DataFacadeT>();
break;
default:
desc = new JSONDescriptor<DataFacadeT>();
break;
}
PhantomNodes phantomNodes;
phantomNodes.startPhantom = rawRoute.segmentEndCoordinates[0].startPhantom;
phantomNodes.targetPhantom = rawRoute.segmentEndCoordinates[rawRoute.segmentEndCoordinates.size()-1].targetPhantom;
desc->SetConfig(descriptorConfig);
desc->Run(reply, rawRoute, phantomNodes, facade);
if("" != routeParameters.jsonpParameter) {
reply.content.push_back(")\n");
}
reply.headers.resize(3);
reply.headers[0].name = "Content-Length";
std::string tmp;
unsigned content_length = 0;
BOOST_FOREACH(const std::string & snippet, reply.content) {
content_length += snippet.length();
}
intToString(content_length, tmp);
reply.headers[0].value = tmp;
switch(descriptorType){
case 0:
if( !routeParameters.jsonpParameter.empty() ){
reply.headers[1].name = "Content-Type";
reply.headers[1].value = "text/javascript";
reply.headers[2].name = "Content-Disposition";
reply.headers[2].value = "attachment; filename=\"route.js\"";
} else {
reply.headers[1].name = "Content-Type";
reply.headers[1].value = "application/x-javascript";
reply.headers[2].name = "Content-Disposition";
reply.headers[2].value = "attachment; filename=\"route.json\"";
}
break;
case 1:
reply.headers[1].name = "Content-Type";
reply.headers[1].value = "application/gpx+xml; charset=UTF-8";
reply.headers[2].name = "Content-Disposition";
reply.headers[2].value = "attachment; filename=\"route.gpx\"";
break;
default:
if( !routeParameters.jsonpParameter.empty() ){
reply.headers[1].name = "Content-Type";
reply.headers[1].value = "text/javascript";
reply.headers[2].name = "Content-Disposition";
reply.headers[2].value = "attachment; filename=\"route.js\"";
} else {
reply.headers[1].name = "Content-Type";
reply.headers[1].value = "application/x-javascript";
reply.headers[2].name = "Content-Disposition";
reply.headers[2].value = "attachment; filename=\"route.json\"";
}
break;
}
delete desc;
return;
}
private:
std::string descriptor_string;
DataFacadeT * facade;
};
#endif /* VIAROUTEPLUGIN_H_ */
+56 -12
View File
@@ -1,12 +1,63 @@
# Readme
## About
For instructions on how to compile and run OSRM, please consult the Wiki at
The Open Source Routing Machine is a high performance routing engine written in C++11 designed to run on OpenStreetMap data.
https://github.com/DennisOSRM/Project-OSRM/wiki
## Current build status
or use our free and daily updated online service at
| build config | status |
|:-------------|:-------|
| Linux | [![Build Status](https://travis-ci.org/Project-OSRM/osrm-backend.png?branch=master)](https://travis-ci.org/Project-OSRM/osrm-backend) |
| Windows | [![Build status](https://ci.appveyor.com/api/projects/status/4iuo3s9gxprmcjjh)](https://ci.appveyor.com/project/DennisOSRM/osrm-backend) |
| Coverage | [![codecov](https://codecov.io/gh/Project-OSRM/osrm-backend/branch/master/graph/badge.svg)](https://codecov.io/gh/Project-OSRM/osrm-backend) |
http://map.project-osrm.org
## Building
For instructions on how to [build](https://github.com/Project-OSRM/osrm-backend/wiki/Building-OSRM) and [run OSRM](https://github.com/Project-OSRM/osrm-backend/wiki/Running-OSRM), please consult [the Wiki](https://github.com/Project-OSRM/osrm-backend/wiki).
To quickly try OSRM use our [free and daily updated online service](http://map.project-osrm.org)
## Documentation
### Full documentation
- [osrm-routed HTTP API documentation](docs/http.md)
- [libosrm API documentation](docs/libosrm.md)
### Quick start
Building OSRM assuming all dependencies are installed:
```
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
sudo cmake --build . --target install
```
Loading preparing a dataset and starting the server:
```
osrm-extract data.osm.pbf -p profiles/car.lua
osrm-contract data.osrm
osrm-routed data.osrm
```
Running a query on your local server:
```
curl http://127.0.0.1:5000/13.388860,52.517037;13.385983,52.496891?steps=true&alternatives=true
```
### Running a request against the Demo Server
First read the [API usage policy](https://github.com/Project-OSRM/osrm-backend/wiki/Api-usage-policy).
Then run simple query with instructions and alternatives on Berlin:
```
curl https://router.project-osrm.org/13.388860,52.517037;13.385983,52.496891?steps=true&alternatives=true
```
## References in publications
@@ -31,10 +82,3 @@ When using the code in a (scientific) publication, please cite
}
```
## Current build status
| build config | branch | status |
|:-------------|:--------|:------------|
| Project OSRM | master | [![Build Status](https://travis-ci.org/DennisOSRM/Project-OSRM.png?branch=master)](https://travis-ci.org/DennisOSRM/Project-OSRM) |
| Project OSRM | develop | [![Build Status](https://travis-ci.org/DennisOSRM/Project-OSRM.png?branch=develop)](https://travis-ci.org/DennisOSRM/Project-OSRM) |
| LUAbind fork | master | [![Build Status](https://travis-ci.org/DennisOSRM/luabind.png?branch=master)](https://travis-ci.org/DennisOSRM/luabind) |
-183
View File
@@ -1,183 +0,0 @@
require 'OSM/StreamParser'
require 'socket'
require 'digest/sha1'
require 'cucumber/rake/task'
require 'sys/proctable'
BUILD_FOLDER = 'build'
DATA_FOLDER = 'sandbox'
PROFILE = 'examples/postgis'
OSRM_PORT = 5000
PROFILES_FOLDER = '../profiles'
Cucumber::Rake::Task.new do |t|
t.cucumber_opts = %w{--format pretty}
end
areas = {
:kbh => { :country => 'denmark', :bbox => 'top=55.6972 left=12.5222 right=12.624 bottom=55.6376' },
:frd => { :country => 'denmark', :bbox => 'top=55.7007 left=12.4765 bottom=55.6576 right=12.5698' },
:regh => { :country => 'denmark', :bbox => 'top=56.164 left=11.792 bottom=55.403 right=12.731' },
:denmark => { :country => 'denmark', :bbox => nil },
:skaane => { :country => 'sweden', :bbox => 'top=56.55 left=12.4 bottom=55.3 right=14.6' }
}
osm_data_area_name = ARGV[1] ? ARGV[1].to_s.to_sym : :kbh
raise "Unknown data area." unless areas[osm_data_area_name]
osm_data_country = areas[osm_data_area_name][:country]
osm_data_area_bbox = areas[osm_data_area_name][:bbox]
task osm_data_area_name.to_sym {} #define empty task to prevent rake from whining. will break if area has same name as a task
def each_process name, &block
Sys::ProcTable.ps do |process|
if process.comm.strip == name.strip && process.state != 'zombie'
yield process.pid.to_i, process.state.strip
end
end
end
def up?
find_pid('osrm-routed') != nil
end
def find_pid name
each_process(name) { |pid,state| return pid.to_i }
return nil
end
def wait_for_shutdown name
timeout = 10
(timeout*10).times do
return if find_pid(name) == nil
sleep 0.1
end
raise "*** Could not terminate #{name}."
end
desc "Rebuild and run tests."
task :default => [:build]
desc "Build using CMake."
task :build do
if Dir.exists? BUILD_FOLDER
Dir.chdir BUILD_FOLDER do
system "make"
end
else
system "mkdir build; cd build; cmake ..; make"
end
end
desc "Setup config files."
task :setup do
end
desc "Download OSM data."
task :download do
Dir.mkdir "#{DATA_FOLDER}" unless File.exist? "#{DATA_FOLDER}"
puts "Downloading..."
puts "curl http://download.geofabrik.de/europe/#{osm_data_country}-latest.osm.pbf -o #{DATA_FOLDER}/#{osm_data_country}.osm.pbf"
raise "Error while downloading data." unless system "curl http://download.geofabrik.de/europe/#{osm_data_country}-latest.osm.pbf -o #{DATA_FOLDER}/#{osm_data_country}.osm.pbf"
if osm_data_area_bbox
puts "Cropping and converting to protobuffer..."
raise "Error while cropping data." unless system "osmosis --read-pbf file=#{DATA_FOLDER}/#{osm_data_country}.osm.pbf --bounding-box #{osm_data_area_bbox} --write-pbf file=#{DATA_FOLDER}/#{osm_data_area_name}.osm.pbf omitmetadata=true"
end
end
desc "Crop OSM data"
task :crop do
if osm_data_area_bbox
raise "Error while cropping data." unless system "osmosis --read-pbf file=#{DATA_FOLDER}/#{osm_data_country}.osm.pbf --bounding-box #{osm_data_area_bbox} --write-pbf file=#{DATA_FOLDER}/#{osm_data_area_name}.osm.pbf omitmetadata=true"
end
end
desc "Reprocess OSM data."
task :process => [:extract,:prepare] do
end
desc "Extract OSM data."
task :extract do
Dir.chdir DATA_FOLDER do
raise "Error while extracting data." unless system "../#{BUILD_FOLDER}/osrm-extract #{osm_data_area_name}.osm.pbf --profile ../profiles/#{PROFILE}.lua"
end
end
desc "Prepare OSM data."
task :prepare do
Dir.chdir DATA_FOLDER do
raise "Error while preparing data." unless system "../#{BUILD_FOLDER}/osrm-prepare #{osm_data_area_name}.osrm --profile ../profiles/#{PROFILE}.lua"
end
end
desc "Delete preprocessing files."
task :clean do
File.delete *Dir.glob("#{DATA_FOLDER}/*.osrm")
File.delete *Dir.glob("#{DATA_FOLDER}/*.osrm.*")
end
desc "Run all cucumber test"
task :test do
system "cucumber"
puts
end
desc "Run the routing server in the terminal. Press Ctrl-C to stop."
task :run do
Dir.chdir DATA_FOLDER do
system "../#{BUILD_FOLDER}/osrm-routed #{osm_data_area_name}.osrm --port #{OSRM_PORT}"
end
end
desc "Launch the routing server in the background. Use rake:down to stop it."
task :up do
Dir.chdir DATA_FOLDER do
abort("Already up.") if up?
pipe = IO.popen("../#{BUILD_FOLDER}/osrm-routed #{osm_data_area_name}.osrm --port #{OSRM_PORT} 1>>osrm-routed.log 2>>osrm-routed.log")
timeout = 5
(timeout*10).times do
begin
socket = TCPSocket.new('localhost', OSRM_PORT)
socket.puts 'ping'
rescue Errno::ECONNREFUSED
sleep 0.1
end
end
end
end
desc "Stop the routing server."
task :down do
pid = find_pid 'osrm-routed'
if pid
Process.kill 'TERM', pid
else
puts "Already down."
end
end
desc "Kill all osrm-extract, osrm-prepare and osrm-routed processes."
task :kill do
each_process('osrm-routed') { |pid,state| Process.kill 'KILL', pid }
each_process('osrm-prepare') { |pid,state| Process.kill 'KILL', pid }
each_process('osrm-extract') { |pid,state| Process.kill 'KILL', pid }
wait_for_shutdown 'osrm-routed'
wait_for_shutdown 'osrm-prepare'
wait_for_shutdown 'osrm-extract'
end
desc "Get PIDs of all osrm-extract, osrm-prepare and osrm-routed processes."
task :pid do
each_process 'osrm-routed' do |pid,state|
puts "#{pid}\t#{state}"
end
end
desc "Stop, reprocess and restart."
task :update => [:down,:process,:up] do
end
-615
View File
@@ -1,615 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ALTERNATIVEROUTES_H_
#define ALTERNATIVEROUTES_H_
#include "BasicRoutingInterface.h"
#include "../DataStructures/SearchEngineData.h"
#include <boost/unordered_map.hpp>
#include <cmath>
#include <vector>
const double VIAPATH_ALPHA = 0.15;
const double VIAPATH_EPSILON = 0.10; //alternative at most 15% longer
const double VIAPATH_GAMMA = 0.75; //alternative shares at most 75% with the shortest.
template<class DataFacadeT>
class AlternativeRouting : private BasicRoutingInterface<DataFacadeT> {
typedef BasicRoutingInterface<DataFacadeT> super;
typedef typename DataFacadeT::EdgeData EdgeData;
typedef SearchEngineData::QueryHeap QueryHeap;
typedef std::pair<NodeID, NodeID> SearchSpaceEdge;
struct RankedCandidateNode {
RankedCandidateNode(const NodeID n, const int l, const int s) :
node(n),
length(l),
sharing(s)
{ }
NodeID node;
int length;
int sharing;
bool operator<(const RankedCandidateNode& other) const {
return (2*length + sharing) < (2*other.length + other.sharing);
}
};
DataFacadeT * facade;
SearchEngineData & engine_working_data;
public:
AlternativeRouting(
DataFacadeT * facade,
SearchEngineData & engine_working_data
) :
super(facade),
facade(facade),
engine_working_data(engine_working_data)
{ }
~AlternativeRouting() {}
void operator()(
const PhantomNodes & phantom_node_pair,
RawRouteData & raw_route_data) {
if( (!phantom_node_pair.AtLeastOnePhantomNodeIsUINTMAX()) ||
phantom_node_pair.PhantomNodesHaveEqualLocation()
) {
raw_route_data.lengthOfShortestPath = INT_MAX;
raw_route_data.lengthOfAlternativePath = INT_MAX;
return;
}
std::vector<NodeID> alternative_path;
std::vector<NodeID> via_node_candidate_list;
std::vector<SearchSpaceEdge> forward_search_space;
std::vector<SearchSpaceEdge> reverse_search_space;
//Init queues, semi-expensive because access to TSS invokes a sys-call
engine_working_data.InitializeOrClearFirstThreadLocalStorage(
super::facade->GetNumberOfNodes()
);
engine_working_data.InitializeOrClearSecondThreadLocalStorage(
super::facade->GetNumberOfNodes()
);
engine_working_data.InitializeOrClearThirdThreadLocalStorage(
super::facade->GetNumberOfNodes()
);
QueryHeap & forward_heap1 = *(engine_working_data.forwardHeap);
QueryHeap & reverse_heap1 = *(engine_working_data.backwardHeap);
QueryHeap & forward_heap2 = *(engine_working_data.forwardHeap2);
QueryHeap & reverse_heap2 = *(engine_working_data.backwardHeap2);
int upper_bound_to_shortest_path_distance = INT_MAX;
NodeID middle_node = UINT_MAX;
forward_heap1.Insert(
phantom_node_pair.startPhantom.edgeBasedNode,
-phantom_node_pair.startPhantom.weight1,
phantom_node_pair.startPhantom.edgeBasedNode
);
if(phantom_node_pair.startPhantom.isBidirected() ) {
forward_heap1.Insert(
phantom_node_pair.startPhantom.edgeBasedNode+1,
-phantom_node_pair.startPhantom.weight2,
phantom_node_pair.startPhantom.edgeBasedNode+1
);
}
reverse_heap1.Insert(
phantom_node_pair.targetPhantom.edgeBasedNode,
phantom_node_pair.targetPhantom.weight1,
phantom_node_pair.targetPhantom.edgeBasedNode
);
if(phantom_node_pair.targetPhantom.isBidirected() ) {
reverse_heap1.Insert(
phantom_node_pair.targetPhantom.edgeBasedNode+1,
phantom_node_pair.targetPhantom.weight2,
phantom_node_pair.targetPhantom.edgeBasedNode+1
);
}
const int forward_offset = super::ComputeEdgeOffset(
phantom_node_pair.startPhantom
);
const int reverse_offset = super::ComputeEdgeOffset(
phantom_node_pair.targetPhantom
);
//search from s and t till new_min/(1+epsilon) > length_of_shortest_path
while(0 < (forward_heap1.Size() + reverse_heap1.Size())){
if(0 < forward_heap1.Size()){
AlternativeRoutingStep<true>(
forward_heap1,
reverse_heap1,
&middle_node,
&upper_bound_to_shortest_path_distance,
via_node_candidate_list,
forward_search_space,
forward_offset
);
}
if(0 < reverse_heap1.Size()){
AlternativeRoutingStep<false>(
reverse_heap1,
forward_heap1,
&middle_node,
&upper_bound_to_shortest_path_distance,
via_node_candidate_list,
reverse_search_space,
reverse_offset
);
}
}
sort_unique_resize(via_node_candidate_list);
std::vector<NodeID> packed_forward_path;
std::vector<NodeID> packed_reverse_path;
super::RetrievePackedPathFromSingleHeap(
forward_heap1,
middle_node,
packed_forward_path
);
super::RetrievePackedPathFromSingleHeap(
reverse_heap1,
middle_node,
packed_reverse_path
);
boost::unordered_map<NodeID, int> approximated_forward_sharing;
boost::unordered_map<NodeID, int> approximated_reverse_sharing;
unsigned index_into_forward_path = 0;
//sweep over search space, compute forward sharing for each current edge (u,v)
BOOST_FOREACH(const SearchSpaceEdge & current_edge, forward_search_space) {
const NodeID u = current_edge.first;
const NodeID v = current_edge.second;
if(packed_forward_path.size() < index_into_forward_path && current_edge == forward_search_space[index_into_forward_path]) {
//current_edge is on shortest path => sharing(u):=queue.GetKey(u);
++index_into_forward_path;
approximated_forward_sharing[v] = forward_heap1.GetKey(u);
} else {
//sharing (s) = sharing (t)
approximated_forward_sharing[v] = approximated_forward_sharing[u];
}
}
unsigned index_into_reverse_path = 0;
//sweep over search space, compute backward sharing
BOOST_FOREACH(const SearchSpaceEdge & current_edge, reverse_search_space) {
const NodeID u = current_edge.first;
const NodeID v = current_edge.second;
if(packed_reverse_path.size() < index_into_reverse_path && current_edge == reverse_search_space[index_into_reverse_path]) {
//current_edge is on shortest path => sharing(u):=queue.GetKey(u);
++index_into_reverse_path;
approximated_reverse_sharing[v] = reverse_heap1.GetKey(u);
} else {
//sharing (s) = sharing (t)
approximated_reverse_sharing[v] = approximated_reverse_sharing[u];
}
}
std::vector<NodeID> nodes_that_passed_preselection;
BOOST_FOREACH(const NodeID node, via_node_candidate_list) {
int approximated_sharing = approximated_forward_sharing[node] + approximated_reverse_sharing[node];
int approximated_length = forward_heap1.GetKey(node)+reverse_heap1.GetKey(node);
bool lengthPassed = (approximated_length < upper_bound_to_shortest_path_distance*(1+VIAPATH_EPSILON));
bool sharingPassed = (approximated_sharing <= upper_bound_to_shortest_path_distance*VIAPATH_GAMMA);
bool stretchPassed = approximated_length - approximated_sharing < (1.+VIAPATH_EPSILON)*(upper_bound_to_shortest_path_distance-approximated_sharing);
if(lengthPassed && sharingPassed && stretchPassed) {
nodes_that_passed_preselection.push_back(node);
}
}
std::vector<NodeID> & packedShortestPath = packed_forward_path;
std::reverse(packedShortestPath.begin(), packedShortestPath.end());
packedShortestPath.push_back(middle_node);
packedShortestPath.insert(packedShortestPath.end(),packed_reverse_path.begin(), packed_reverse_path.end());
std::vector<RankedCandidateNode > rankedCandidates;
//prioritizing via nodes for deep inspection
BOOST_FOREACH(const NodeID node, nodes_that_passed_preselection) {
int lengthOfViaPath = 0, sharingOfViaPath = 0;
computeLengthAndSharingOfViaPath(node, &lengthOfViaPath, &sharingOfViaPath, forward_offset+reverse_offset, packedShortestPath);
if(sharingOfViaPath <= upper_bound_to_shortest_path_distance*VIAPATH_GAMMA) {
rankedCandidates.push_back(RankedCandidateNode(node, lengthOfViaPath, sharingOfViaPath));
}
}
std::sort(rankedCandidates.begin(), rankedCandidates.end());
NodeID selectedViaNode = UINT_MAX;
int lengthOfViaPath = INT_MAX;
NodeID s_v_middle = UINT_MAX, v_t_middle = UINT_MAX;
BOOST_FOREACH(const RankedCandidateNode & candidate, rankedCandidates){
if(viaNodeCandidatePasses_T_Test(forward_heap1, reverse_heap1, forward_heap2, reverse_heap2, candidate, forward_offset+reverse_offset, upper_bound_to_shortest_path_distance, &lengthOfViaPath, &s_v_middle, &v_t_middle)) {
// select first admissable
selectedViaNode = candidate.node;
break;
}
}
//Unpack shortest path and alternative, if they exist
if(INT_MAX != upper_bound_to_shortest_path_distance) {
super::UnpackPath(packedShortestPath, raw_route_data.computedShortestPath);
raw_route_data.lengthOfShortestPath = upper_bound_to_shortest_path_distance;
} else {
raw_route_data.lengthOfShortestPath = INT_MAX;
}
if(selectedViaNode != UINT_MAX) {
retrievePackedViaPath(forward_heap1, reverse_heap1, forward_heap2, reverse_heap2, s_v_middle, v_t_middle, raw_route_data.computedAlternativePath);
raw_route_data.lengthOfAlternativePath = lengthOfViaPath;
} else {
raw_route_data.lengthOfAlternativePath = INT_MAX;
}
}
private:
//unpack <s,..,v,..,t> by exploring search spaces from v
inline void retrievePackedViaPath(QueryHeap & _forwardHeap1, QueryHeap & _backwardHeap1, QueryHeap & _forwardHeap2, QueryHeap & _backwardHeap2,
const NodeID s_v_middle, const NodeID v_t_middle, std::vector<_PathData> & unpackedPath) {
//unpack [s,v)
std::vector<NodeID> packed_s_v_path, packed_v_t_path;
super::RetrievePackedPathFromHeap(_forwardHeap1, _backwardHeap2, s_v_middle, packed_s_v_path);
packed_s_v_path.resize(packed_s_v_path.size()-1);
//unpack [v,t]
super::RetrievePackedPathFromHeap(_forwardHeap2, _backwardHeap1, v_t_middle, packed_v_t_path);
packed_s_v_path.insert(packed_s_v_path.end(),packed_v_t_path.begin(), packed_v_t_path.end() );
super::UnpackPath(packed_s_v_path, unpackedPath);
}
inline void computeLengthAndSharingOfViaPath(const NodeID via_node, int *real_length_of_via_path, int *sharing_of_via_path,
const int offset, const std::vector<NodeID> & packed_shortest_path) {
//compute and unpack <s,..,v> and <v,..,t> by exploring search spaces from v and intersecting against queues
//only half-searches have to be done at this stage
engine_working_data.InitializeOrClearSecondThreadLocalStorage(
super::facade->GetNumberOfNodes()
);
QueryHeap & existingForwardHeap = *engine_working_data.forwardHeap;
QueryHeap & existingBackwardHeap = *engine_working_data.backwardHeap;
QueryHeap & newForwardHeap = *engine_working_data.forwardHeap2;
QueryHeap & newBackwardHeap = *engine_working_data.backwardHeap2;
std::vector < NodeID > packed_s_v_path;
std::vector < NodeID > packed_v_t_path;
std::vector<NodeID> partiallyUnpackedShortestPath;
std::vector<NodeID> partiallyUnpackedViaPath;
NodeID s_v_middle = UINT_MAX;
int upperBoundFor_s_v_Path = INT_MAX;//compute path <s,..,v> by reusing forward search from s
newBackwardHeap.Insert(via_node, 0, via_node);
while (0 < newBackwardHeap.Size()) {
super::RoutingStep(newBackwardHeap, existingForwardHeap, &s_v_middle, &upperBoundFor_s_v_Path, 2 * offset, false);
}
//compute path <v,..,t> by reusing backward search from node t
NodeID v_t_middle = UINT_MAX;
int upperBoundFor_v_t_Path = INT_MAX;
newForwardHeap.Insert(via_node, 0, via_node);
while (0 < newForwardHeap.Size() ) {
super::RoutingStep(newForwardHeap, existingBackwardHeap, &v_t_middle, &upperBoundFor_v_t_Path, 2 * offset, true);
}
*real_length_of_via_path = upperBoundFor_s_v_Path + upperBoundFor_v_t_Path;
if(UINT_MAX == s_v_middle || UINT_MAX == v_t_middle)
return;
//retrieve packed paths
super::RetrievePackedPathFromHeap(existingForwardHeap, newBackwardHeap, s_v_middle, packed_s_v_path);
super::RetrievePackedPathFromHeap(newForwardHeap, existingBackwardHeap, v_t_middle, packed_v_t_path);
//partial unpacking, compute sharing
//First partially unpack s-->v until paths deviate, note length of common path.
for (unsigned i = 0, lengthOfPackedPath = std::min( packed_s_v_path.size(), packed_shortest_path.size()) - 1; (i < lengthOfPackedPath); ++i) {
if (packed_s_v_path[i] == packed_shortest_path[i] && packed_s_v_path[i + 1] == packed_shortest_path[i + 1]) {
EdgeID edgeID = facade->FindEdgeInEitherDirection(packed_s_v_path[i], packed_s_v_path[i + 1]);
*sharing_of_via_path += facade->GetEdgeData(edgeID).distance;
} else {
if (packed_s_v_path[i] == packed_shortest_path[i]) {
super::UnpackEdge(packed_s_v_path[i], packed_s_v_path[i+1], partiallyUnpackedViaPath);
super::UnpackEdge(packed_shortest_path[i], packed_shortest_path[i+1], partiallyUnpackedShortestPath);
break;
}
}
}
//traverse partially unpacked edge and note common prefix
for (int i = 0, lengthOfPackedPath = std::min( partiallyUnpackedViaPath.size(), partiallyUnpackedShortestPath.size()) - 1; (i < lengthOfPackedPath) && (partiallyUnpackedViaPath[i] == partiallyUnpackedShortestPath[i] && partiallyUnpackedViaPath[i+1] == partiallyUnpackedShortestPath[i+1]); ++i) {
EdgeID edgeID = facade->FindEdgeInEitherDirection(partiallyUnpackedViaPath[i], partiallyUnpackedViaPath[i+1]);
*sharing_of_via_path += facade->GetEdgeData(edgeID).distance;
}
//Second, partially unpack v-->t in reverse order until paths deviate and note lengths
int viaPathIndex = packed_v_t_path.size() - 1;
int shortestPathIndex = packed_shortest_path.size() - 1;
for (; viaPathIndex > 0 && shortestPathIndex > 0; --viaPathIndex,--shortestPathIndex ) {
if (packed_v_t_path[viaPathIndex - 1] == packed_shortest_path[shortestPathIndex - 1] && packed_v_t_path[viaPathIndex] == packed_shortest_path[shortestPathIndex]) {
EdgeID edgeID = facade->FindEdgeInEitherDirection( packed_v_t_path[viaPathIndex - 1], packed_v_t_path[viaPathIndex]);
*sharing_of_via_path += facade->GetEdgeData(edgeID).distance;
} else {
if (packed_v_t_path[viaPathIndex] == packed_shortest_path[shortestPathIndex]) {
super::UnpackEdge(packed_v_t_path[viaPathIndex-1], packed_v_t_path[viaPathIndex], partiallyUnpackedViaPath);
super::UnpackEdge(packed_shortest_path[shortestPathIndex-1] , packed_shortest_path[shortestPathIndex], partiallyUnpackedShortestPath);
break;
}
}
}
viaPathIndex = partiallyUnpackedViaPath.size() - 1;
shortestPathIndex = partiallyUnpackedShortestPath.size() - 1;
for (; viaPathIndex > 0 && shortestPathIndex > 0; --viaPathIndex,--shortestPathIndex) {
if (partiallyUnpackedViaPath[viaPathIndex - 1] == partiallyUnpackedShortestPath[shortestPathIndex - 1] && partiallyUnpackedViaPath[viaPathIndex] == partiallyUnpackedShortestPath[shortestPathIndex]) {
EdgeID edgeID = facade->FindEdgeInEitherDirection( partiallyUnpackedViaPath[viaPathIndex - 1], partiallyUnpackedViaPath[viaPathIndex]);
*sharing_of_via_path += facade->GetEdgeData(edgeID).distance;
} else {
break;
}
}
//finished partial unpacking spree! Amount of sharing is stored to appropriate pointer variable
}
inline int approximateAmountOfSharing(const NodeID middleNodeIDOfAlternativePath, QueryHeap & _forwardHeap, QueryHeap & _backwardHeap, const std::vector<NodeID> & packedShortestPath) {
std::vector<NodeID> packedAlternativePath;
super::RetrievePackedPathFromHeap(_forwardHeap, _backwardHeap, middleNodeIDOfAlternativePath, packedAlternativePath);
if(packedShortestPath.size() < 2 || packedAlternativePath.size() < 2)
return 0;
int sharing = 0;
int aindex = 0;
//compute forward sharing
while( (packedAlternativePath[aindex] == packedShortestPath[aindex]) && (packedAlternativePath[aindex+1] == packedShortestPath[aindex+1]) ) {
// SimpleLogger().Write() << "retrieving edge (" << packedAlternativePath[aindex] << "," << packedAlternativePath[aindex+1] << ")";
EdgeID edgeID = facade->FindEdgeInEitherDirection(packedAlternativePath[aindex], packedAlternativePath[aindex+1]);
sharing += facade->GetEdgeData(edgeID).distance;
++aindex;
}
aindex = packedAlternativePath.size()-1;
int bindex = packedShortestPath.size()-1;
//compute backward sharing
while( aindex > 0 && bindex > 0 && (packedAlternativePath[aindex] == packedShortestPath[bindex]) && (packedAlternativePath[aindex-1] == packedShortestPath[bindex-1]) ) {
EdgeID edgeID = facade->FindEdgeInEitherDirection(packedAlternativePath[aindex], packedAlternativePath[aindex-1]);
sharing += facade->GetEdgeData(edgeID).distance;
--aindex; --bindex;
}
return sharing;
}
template<bool forwardDirection>
inline void AlternativeRoutingStep(
QueryHeap & _forward_heap,
QueryHeap & _reverse_heap,
NodeID *middle_node,
int *upper_bound_to_shortest_path_distance,
std::vector<NodeID>& searchSpaceIntersection,
std::vector<SearchSpaceEdge> & search_space,
const int edgeBasedOffset
) const {
const NodeID node = _forward_heap.DeleteMin();
const int distance = _forward_heap.GetKey(node);
int scaledDistance = (distance-edgeBasedOffset)/(1.+VIAPATH_EPSILON);
if(scaledDistance > *upper_bound_to_shortest_path_distance){
_forward_heap.DeleteAll();
return;
}
search_space.push_back(std::make_pair(_forward_heap.GetData( node ).parent, node));
if(_reverse_heap.WasInserted(node) ){
searchSpaceIntersection.push_back(node);
const int newDistance = _reverse_heap.GetKey(node) + distance;
if(newDistance < *upper_bound_to_shortest_path_distance ){
if(newDistance>=0 ) {
*middle_node = node;
*upper_bound_to_shortest_path_distance = newDistance;
}
}
}
for ( EdgeID edge = facade->BeginEdges( node ); edge < facade->EndEdges(node); edge++ ) {
const EdgeData & data = facade->GetEdgeData(edge);
bool forwardDirectionFlag = (forwardDirection ? data.forward : data.backward );
if(forwardDirectionFlag) {
const NodeID to = facade->GetTarget(edge);
const int edgeWeight = data.distance;
assert( edgeWeight > 0 );
const int toDistance = distance + edgeWeight;
//New Node discovered -> Add to Heap + Node Info Storage
if ( !_forward_heap.WasInserted( to ) ) {
_forward_heap.Insert( to, toDistance, node );
}
//Found a shorter Path -> Update distance
else if ( toDistance < _forward_heap.GetKey( to ) ) {
_forward_heap.GetData( to ).parent = node;
_forward_heap.DecreaseKey( to, toDistance );
//new parent
}
}
}
}
//conduct T-Test
inline bool viaNodeCandidatePasses_T_Test( QueryHeap& existingForwardHeap, QueryHeap& existingBackwardHeap, QueryHeap& newForwardHeap, QueryHeap& newBackwardHeap, const RankedCandidateNode& candidate, const int offset, const int lengthOfShortestPath, int * lengthOfViaPath, NodeID * s_v_middle, NodeID * v_t_middle) {
newForwardHeap.Clear();
newBackwardHeap.Clear();
std::vector < NodeID > packed_s_v_path;
std::vector < NodeID > packed_v_t_path;
*s_v_middle = UINT_MAX;
int upperBoundFor_s_v_Path = INT_MAX;
//compute path <s,..,v> by reusing forward search from s
newBackwardHeap.Insert(candidate.node, 0, candidate.node);
while (newBackwardHeap.Size() > 0) {
super::RoutingStep(newBackwardHeap, existingForwardHeap, s_v_middle, &upperBoundFor_s_v_Path, 2*offset, false);
}
if(INT_MAX == upperBoundFor_s_v_Path)
return false;
//compute path <v,..,t> by reusing backward search from t
*v_t_middle = UINT_MAX;
int upperBoundFor_v_t_Path = INT_MAX;
newForwardHeap.Insert(candidate.node, 0, candidate.node);
while (newForwardHeap.Size() > 0) {
super::RoutingStep(newForwardHeap, existingBackwardHeap, v_t_middle, &upperBoundFor_v_t_Path, 2*offset, true);
}
if(INT_MAX == upperBoundFor_v_t_Path)
return false;
*lengthOfViaPath = upperBoundFor_s_v_Path + upperBoundFor_v_t_Path;
//retrieve packed paths
super::RetrievePackedPathFromHeap(existingForwardHeap, newBackwardHeap, *s_v_middle, packed_s_v_path);
super::RetrievePackedPathFromHeap(newForwardHeap, existingBackwardHeap, *v_t_middle, packed_v_t_path);
NodeID s_P = *s_v_middle, t_P = *v_t_middle;
if(UINT_MAX == s_P) {
return false;
}
if(UINT_MAX == t_P) {
return false;
}
const int T_threshold = VIAPATH_EPSILON * lengthOfShortestPath;
int unpackedUntilDistance = 0;
std::stack<SearchSpaceEdge> unpackStack;
//Traverse path s-->v
for (unsigned i = packed_s_v_path.size() - 1; (i > 0) && unpackStack.empty(); --i) {
EdgeID edgeID = facade->FindEdgeInEitherDirection( packed_s_v_path[i - 1], packed_s_v_path[i]);
int lengthOfCurrentEdge = facade->GetEdgeData(edgeID).distance;
if (lengthOfCurrentEdge + unpackedUntilDistance >= T_threshold) {
unpackStack.push(std::make_pair(packed_s_v_path[i - 1], packed_s_v_path[i]));
} else {
unpackedUntilDistance += lengthOfCurrentEdge;
s_P = packed_s_v_path[i - 1];
}
}
while (!unpackStack.empty()) {
const SearchSpaceEdge viaPathEdge = unpackStack.top();
unpackStack.pop();
EdgeID edgeIDInViaPath = facade->FindEdgeInEitherDirection(viaPathEdge.first, viaPathEdge.second);
if(UINT_MAX == edgeIDInViaPath)
return false;
EdgeData currentEdgeData = facade->GetEdgeData(edgeIDInViaPath);
bool IsViaEdgeShortCut = currentEdgeData.shortcut;
if (IsViaEdgeShortCut) {
const NodeID middleOfViaPath = currentEdgeData.id;
EdgeID edgeIDOfSecondSegment = facade->FindEdgeInEitherDirection(middleOfViaPath, viaPathEdge.second);
int lengthOfSecondSegment = facade->GetEdgeData(edgeIDOfSecondSegment).distance;
//attention: !unpacking in reverse!
//Check if second segment is the one to go over treshold? if yes add second segment to stack, else push first segment to stack and add distance of second one.
if (unpackedUntilDistance + lengthOfSecondSegment >= T_threshold) {
unpackStack.push(std::make_pair(middleOfViaPath, viaPathEdge.second));
} else {
unpackedUntilDistance += lengthOfSecondSegment;
unpackStack.push(std::make_pair(viaPathEdge.first, middleOfViaPath));
}
} else {
// edge is not a shortcut, set the start node for T-Test to end of edge.
unpackedUntilDistance += currentEdgeData.distance;
s_P = viaPathEdge.first;
}
}
int lengthOfPathT_Test_Path = unpackedUntilDistance;
unpackedUntilDistance = 0;
//Traverse path s-->v
for (unsigned i = 0, lengthOfPackedPath = packed_v_t_path.size() - 1; (i < lengthOfPackedPath) && unpackStack.empty(); ++i) {
EdgeID edgeID = facade->FindEdgeInEitherDirection( packed_v_t_path[i], packed_v_t_path[i + 1]);
int lengthOfCurrentEdge = facade->GetEdgeData(edgeID).distance;
if (lengthOfCurrentEdge + unpackedUntilDistance >= T_threshold) {
unpackStack.push( std::make_pair(packed_v_t_path[i], packed_v_t_path[i + 1]));
} else {
unpackedUntilDistance += lengthOfCurrentEdge;
t_P = packed_v_t_path[i + 1];
}
}
while (!unpackStack.empty()) {
const SearchSpaceEdge viaPathEdge = unpackStack.top();
unpackStack.pop();
EdgeID edgeIDInViaPath = facade->FindEdgeInEitherDirection(viaPathEdge.first, viaPathEdge.second);
if(UINT_MAX == edgeIDInViaPath)
return false;
EdgeData currentEdgeData = facade->GetEdgeData(edgeIDInViaPath);
const bool IsViaEdgeShortCut = currentEdgeData.shortcut;
if (IsViaEdgeShortCut) {
const NodeID middleOfViaPath = currentEdgeData.id;
EdgeID edgeIDOfFirstSegment = facade->FindEdgeInEitherDirection(viaPathEdge.first, middleOfViaPath);
int lengthOfFirstSegment = facade->GetEdgeData( edgeIDOfFirstSegment).distance;
//Check if first segment is the one to go over treshold? if yes first segment to stack, else push second segment to stack and add distance of first one.
if (unpackedUntilDistance + lengthOfFirstSegment >= T_threshold) {
unpackStack.push( std::make_pair(viaPathEdge.first, middleOfViaPath));
} else {
unpackedUntilDistance += lengthOfFirstSegment;
unpackStack.push( std::make_pair(middleOfViaPath, viaPathEdge.second));
}
} else {
// edge is not a shortcut, set the start node for T-Test to end of edge.
unpackedUntilDistance += currentEdgeData.distance;
t_P = viaPathEdge.second;
}
}
lengthOfPathT_Test_Path += unpackedUntilDistance;
//Run actual T-Test query and compare if distances equal.
engine_working_data.InitializeOrClearThirdThreadLocalStorage(
super::facade->GetNumberOfNodes()
);
QueryHeap& forward_heap3 = *engine_working_data.forwardHeap3;
QueryHeap& backward_heap3 = *engine_working_data.backwardHeap3;
int _upperBound = INT_MAX;
NodeID middle = UINT_MAX;
forward_heap3.Insert(s_P, 0, s_P);
backward_heap3.Insert(t_P, 0, t_P);
//exploration from s and t until deletemin/(1+epsilon) > _lengthOfShortestPath
while (forward_heap3.Size() + backward_heap3.Size() > 0) {
if (forward_heap3.Size() > 0) {
super::RoutingStep(forward_heap3, backward_heap3, &middle, &_upperBound, offset, true);
}
if (backward_heap3.Size() > 0) {
super::RoutingStep(backward_heap3, forward_heap3, &middle, &_upperBound, offset, false);
}
}
return (_upperBound <= lengthOfPathT_Test_Path);
}
};
#endif /* ALTERNATIVEROUTES_H_ */
-321
View File
@@ -1,321 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BASICROUTINGINTERFACE_H_
#define BASICROUTINGINTERFACE_H_
#include "../DataStructures/RawRouteData.h"
#include "../DataStructures/SearchEngineData.h"
#include "../Util/ContainerUtils.h"
#include "../Util/SimpleLogger.h"
#include <boost/assert.hpp>
#include <boost/noncopyable.hpp>
#include <climits>
#include <stack>
SearchEngineData::SearchEngineHeapPtr SearchEngineData::forwardHeap;
SearchEngineData::SearchEngineHeapPtr SearchEngineData::backwardHeap;
SearchEngineData::SearchEngineHeapPtr SearchEngineData::forwardHeap2;
SearchEngineData::SearchEngineHeapPtr SearchEngineData::backwardHeap2;
SearchEngineData::SearchEngineHeapPtr SearchEngineData::forwardHeap3;
SearchEngineData::SearchEngineHeapPtr SearchEngineData::backwardHeap3;
template<class DataFacadeT>
class BasicRoutingInterface : boost::noncopyable {
private:
typedef typename DataFacadeT::EdgeData EdgeData;
protected:
DataFacadeT * facade;
public:
BasicRoutingInterface( DataFacadeT * facade ) : facade(facade) { }
virtual ~BasicRoutingInterface(){ };
inline void RoutingStep(
SearchEngineData::QueryHeap & forward_heap,
SearchEngineData::QueryHeap & reverse_heap,
NodeID * middle_node_id,
int * upper_bound,
const int edge_expansion_offset,
const bool forward_direction
) const {
const NodeID node = forward_heap.DeleteMin();
const int distance = forward_heap.GetKey(node);
//SimpleLogger().Write() << "Settled (" << forward_heap.GetData( node ).parent << "," << node << ")=" << distance;
if(reverse_heap.WasInserted(node) ){
const int new_distance = reverse_heap.GetKey(node) + distance;
if(new_distance < *upper_bound ){
if( new_distance >= 0 ) {
*middle_node_id = node;
*upper_bound = new_distance;
}
}
}
if( (distance-edge_expansion_offset) > *upper_bound ){
forward_heap.DeleteAll();
return;
}
//Stalling
for(
EdgeID edge = facade->BeginEdges( node );
edge < facade->EndEdges(node);
++edge
) {
const EdgeData & data = facade->GetEdgeData(edge);
const bool reverse_flag = (!forward_direction) ? data.forward : data.backward;
if( reverse_flag ) {
const NodeID to = facade->GetTarget(edge);
const int edge_weight = data.distance;
BOOST_ASSERT_MSG( edge_weight > 0, "edge_weight invalid" );
if(forward_heap.WasInserted( to )) {
if(forward_heap.GetKey( to ) + edge_weight < distance) {
return;
}
}
}
}
for(
EdgeID edge = facade->BeginEdges(node), end_edge = facade->EndEdges(node);
edge < end_edge;
++edge
) {
const EdgeData & data = facade->GetEdgeData(edge);
bool forward_directionFlag = (forward_direction ? data.forward : data.backward );
if( forward_directionFlag ) {
const NodeID to = facade->GetTarget(edge);
const int edge_weight = data.distance;
BOOST_ASSERT_MSG( edge_weight > 0, "edge_weight invalid" );
const int to_distance = distance + edge_weight;
//New Node discovered -> Add to Heap + Node Info Storage
if ( !forward_heap.WasInserted( to ) ) {
forward_heap.Insert( to, to_distance, node );
}
//Found a shorter Path -> Update distance
else if ( to_distance < forward_heap.GetKey( to ) ) {
forward_heap.GetData( to ).parent = node;
forward_heap.DecreaseKey( to, to_distance );
//new parent
}
}
}
}
inline void UnpackPath(
const std::vector<NodeID> & packed_path,
std::vector<_PathData> & unpacked_path
) const {
const unsigned packed_path_size = packed_path.size();
std::stack<std::pair<NodeID, NodeID> > recursion_stack;
//We have to push the path in reverse order onto the stack because it's LIFO.
for(unsigned i = packed_path_size-1; i > 0; --i){
recursion_stack.push(
std::make_pair(packed_path[i-1], packed_path[i])
);
}
std::pair<NodeID, NodeID> edge;
while(!recursion_stack.empty()) {
edge = recursion_stack.top();
recursion_stack.pop();
EdgeID smaller_edge_id = SPECIAL_EDGEID;
int edge_weight = INT_MAX;
for(
EdgeID edge_id = facade->BeginEdges(edge.first);
edge_id < facade->EndEdges(edge.first);
++edge_id
){
const int weight = facade->GetEdgeData(edge_id).distance;
if(
(facade->GetTarget(edge_id) == edge.second) &&
(weight < edge_weight) &&
facade->GetEdgeData(edge_id).forward
){
smaller_edge_id = edge_id;
edge_weight = weight;
}
}
if( SPECIAL_EDGEID == smaller_edge_id ){
for(
EdgeID edge_id = facade->BeginEdges(edge.second);
edge_id < facade->EndEdges(edge.second);
++edge_id
){
const int weight = facade->GetEdgeData(edge_id).distance;
if(
(facade->GetTarget(edge_id) == edge.first) &&
(weight < edge_weight) &&
facade->GetEdgeData(edge_id).backward
){
smaller_edge_id = edge_id;
edge_weight = weight;
}
}
}
BOOST_ASSERT_MSG(edge_weight != INT_MAX, "edge id invalid");
const EdgeData& ed = facade->GetEdgeData(smaller_edge_id);
if( ed.shortcut ) {//unpack
const NodeID middle_node_id = ed.id;
//again, we need to this in reversed order
recursion_stack.push(std::make_pair(middle_node_id, edge.second));
recursion_stack.push(std::make_pair(edge.first, middle_node_id));
} else {
BOOST_ASSERT_MSG(!ed.shortcut, "edge must be a shortcut");
unpacked_path.push_back(
_PathData(
ed.id,
facade->GetNameIndexFromEdgeID(ed.id),
facade->GetTurnInstructionForEdgeID(ed.id),
ed.distance
)
);
}
}
}
inline void UnpackEdge(
const NodeID s,
const NodeID t,
std::vector<NodeID> & unpacked_path
) const {
std::stack<std::pair<NodeID, NodeID> > recursion_stack;
recursion_stack.push(std::make_pair(s,t));
std::pair<NodeID, NodeID> edge;
while(!recursion_stack.empty()) {
edge = recursion_stack.top();
recursion_stack.pop();
EdgeID smaller_edge_id = SPECIAL_EDGEID;
int edge_weight = INT_MAX;
for(
EdgeID edge_id = facade->BeginEdges(edge.first);
edge_id < facade->EndEdges(edge.first);
++edge_id
){
const int weight = facade->GetEdgeData(edge_id).distance;
if(
(facade->GetTarget(edge_id) == edge.second) &&
(weight < edge_weight) &&
facade->GetEdgeData(edge_id).forward
){
smaller_edge_id = edge_id;
edge_weight = weight;
}
}
if( SPECIAL_EDGEID == smaller_edge_id ){
for(
EdgeID edge_id = facade->BeginEdges(edge.second);
edge_id < facade->EndEdges(edge.second);
++edge_id
){
const int weight = facade->GetEdgeData(edge_id).distance;
if(
(facade->GetTarget(edge_id) == edge.first) &&
(weight < edge_weight) &&
facade->GetEdgeData(edge_id).backward
){
smaller_edge_id = edge_id;
edge_weight = weight;
}
}
}
BOOST_ASSERT_MSG(edge_weight != INT_MAX, "edge weight invalid");
const EdgeData& ed = facade->GetEdgeData(smaller_edge_id);
if(ed.shortcut) {//unpack
const NodeID middle_node_id = ed.id;
//again, we need to this in reversed order
recursion_stack.push(
std::make_pair(middle_node_id, edge.second)
);
recursion_stack.push(
std::make_pair(edge.first, middle_node_id)
);
} else {
BOOST_ASSERT_MSG(!ed.shortcut, "edge must be shortcut");
unpacked_path.push_back(edge.first );
}
}
unpacked_path.push_back(t);
}
inline void RetrievePackedPathFromHeap(
SearchEngineData::QueryHeap & forward_heap,
SearchEngineData::QueryHeap & reverse_heap,
const NodeID middle_node_id,
std::vector<NodeID> & packed_path
) const {
NodeID current_node_id = middle_node_id;
while(current_node_id != forward_heap.GetData(current_node_id).parent) {
current_node_id = forward_heap.GetData(current_node_id).parent;
packed_path.push_back(current_node_id);
}
std::reverse(packed_path.begin(), packed_path.end());
packed_path.push_back(middle_node_id);
current_node_id = middle_node_id;
while (current_node_id != reverse_heap.GetData(current_node_id).parent){
current_node_id = reverse_heap.GetData(current_node_id).parent;
packed_path.push_back(current_node_id);
}
}
//TODO: reorder parameters
inline void RetrievePackedPathFromSingleHeap(
SearchEngineData::QueryHeap & search_heap,
const NodeID middle_node_id,
std::vector<NodeID>& packed_path
) const {
NodeID current_node_id = middle_node_id;
while(current_node_id != search_heap.GetData(current_node_id).parent) {
current_node_id = search_heap.GetData(current_node_id).parent;
packed_path.push_back(current_node_id);
}
}
int ComputeEdgeOffset(const PhantomNode & phantom) const {
return phantom.weight1 + (phantom.isBidirected() ? phantom.weight2 : 0);
}
};
#endif /* BASICROUTINGINTERFACE_H_ */
-342
View File
@@ -1,342 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SHORTESTPATHROUTING_H_
#define SHORTESTPATHROUTING_H_
#include <boost/assert.hpp>
#include "BasicRoutingInterface.h"
#include "../DataStructures/SearchEngineData.h"
template<class DataFacadeT>
class ShortestPathRouting : public BasicRoutingInterface<DataFacadeT>{
typedef BasicRoutingInterface<DataFacadeT> super;
typedef SearchEngineData::QueryHeap QueryHeap;
SearchEngineData & engine_working_data;
public:
ShortestPathRouting(
DataFacadeT * facade,
SearchEngineData & engine_working_data
) :
super(facade),
engine_working_data(engine_working_data)
{}
~ShortestPathRouting() {}
void operator()(
std::vector<PhantomNodes> & phantom_nodes_vector,
RawRouteData & raw_route_data
) const {
BOOST_FOREACH(
const PhantomNodes & phantom_node_pair,
phantom_nodes_vector
){
if(!phantom_node_pair.AtLeastOnePhantomNodeIsUINTMAX()) {
raw_route_data.lengthOfShortestPath = INT_MAX;
raw_route_data.lengthOfAlternativePath = INT_MAX;
return;
}
}
int distance1 = 0;
int distance2 = 0;
bool search_from_1st_node = true;
bool search_from_2nd_node = true;
NodeID middle1 = UINT_MAX;
NodeID middle2 = UINT_MAX;
std::vector<NodeID> packed_path1;
std::vector<NodeID> packed_path2;
engine_working_data.InitializeOrClearFirstThreadLocalStorage(
super::facade->GetNumberOfNodes()
);
engine_working_data.InitializeOrClearSecondThreadLocalStorage(
super::facade->GetNumberOfNodes()
);
engine_working_data.InitializeOrClearThirdThreadLocalStorage(
super::facade->GetNumberOfNodes()
);
QueryHeap & forward_heap1 = *(engine_working_data.forwardHeap);
QueryHeap & reverse_heap1 = *(engine_working_data.backwardHeap);
QueryHeap & forward_heap2 = *(engine_working_data.forwardHeap2);
QueryHeap & reverse_heap2 = *(engine_working_data.backwardHeap2);
//Get distance to next pair of target nodes.
BOOST_FOREACH(
const PhantomNodes & phantom_node_pair,
phantom_nodes_vector
){
forward_heap1.Clear(); forward_heap2.Clear();
reverse_heap1.Clear(); reverse_heap2.Clear();
int local_upper_bound1 = INT_MAX;
int local_upper_bound2 = INT_MAX;
middle1 = UINT_MAX;
middle2 = UINT_MAX;
//insert new starting nodes into forward heap, adjusted by previous distances.
if(search_from_1st_node) {
forward_heap1.Insert(
phantom_node_pair.startPhantom.edgeBasedNode,
distance1-phantom_node_pair.startPhantom.weight1,
phantom_node_pair.startPhantom.edgeBasedNode
);
// INFO("fw1: " << phantom_node_pair.startPhantom.edgeBasedNode << "´, w: " << -phantomNodePair.startPhantom.weight1);
forward_heap2.Insert(
phantom_node_pair.startPhantom.edgeBasedNode,
distance1-phantom_node_pair.startPhantom.weight1,
phantom_node_pair.startPhantom.edgeBasedNode
);
// INFO("fw2: " << phantom_node_pair.startPhantom.edgeBasedNode << "´, w: " << -phantomNodePair.startPhantom.weight1);
}
if(phantom_node_pair.startPhantom.isBidirected() && search_from_2nd_node) {
forward_heap1.Insert(
phantom_node_pair.startPhantom.edgeBasedNode+1,
distance2-phantom_node_pair.startPhantom.weight2,
phantom_node_pair.startPhantom.edgeBasedNode+1
);
// INFO("fw1: " << phantom_node_pair.startPhantom.edgeBasedNode+1 << "´, w: " << -phantomNodePair.startPhantom.weight2);
forward_heap2.Insert(
phantom_node_pair.startPhantom.edgeBasedNode+1,
distance2-phantom_node_pair.startPhantom.weight2,
phantom_node_pair.startPhantom.edgeBasedNode+1
);
// INFO("fw2: " << phantom_node_pair.startPhantom.edgeBasedNode+1 << "´, w: " << -phantomNodePair.startPhantom.weight2);
}
//insert new backward nodes into backward heap, unadjusted.
reverse_heap1.Insert(
phantom_node_pair.targetPhantom.edgeBasedNode,
phantom_node_pair.targetPhantom.weight1,
phantom_node_pair.targetPhantom.edgeBasedNode
);
// INFO("rv1: " << phantom_node_pair.targetPhantom.edgeBasedNode << ", w;" << phantom_node_pair.targetPhantom.weight1 );
if(phantom_node_pair.targetPhantom.isBidirected() ) {
reverse_heap2.Insert(
phantom_node_pair.targetPhantom.edgeBasedNode+1,
phantom_node_pair.targetPhantom.weight2,
phantom_node_pair.targetPhantom.edgeBasedNode+1
);
// INFO("rv2: " << phantom_node_pair.targetPhantom.edgeBasedNode+1 << ", w;" << phantom_node_pair.targetPhantom.weight2 );
}
const int forward_offset = super::ComputeEdgeOffset(
phantom_node_pair.startPhantom
);
const int reverse_offset = super::ComputeEdgeOffset(
phantom_node_pair.targetPhantom
);
//run two-Target Dijkstra routing step.
while(0 < (forward_heap1.Size() + reverse_heap1.Size() )){
if( !forward_heap1.Empty()){
super::RoutingStep(
forward_heap1,
reverse_heap1,
&middle1,
&local_upper_bound1,
forward_offset,
true
);
}
if( !reverse_heap1.Empty() ){
super::RoutingStep(
reverse_heap1,
forward_heap1,
&middle1,
&local_upper_bound1,
reverse_offset,
false
);
}
}
if( !reverse_heap2.Empty() ) {
while(0 < (forward_heap2.Size() + reverse_heap2.Size() )){
if( !forward_heap2.Empty() ){
super::RoutingStep(
forward_heap2,
reverse_heap2,
&middle2,
&local_upper_bound2,
forward_offset,
true
);
}
if( !reverse_heap2.Empty() ){
super::RoutingStep(
reverse_heap2,
forward_heap2,
&middle2,
&local_upper_bound2,
reverse_offset,
false
);
}
}
}
//No path found for both target nodes?
if(
(INT_MAX == local_upper_bound1) &&
(INT_MAX == local_upper_bound2)
) {
raw_route_data.lengthOfShortestPath = INT_MAX;
raw_route_data.lengthOfAlternativePath = INT_MAX;
return;
}
if(UINT_MAX == middle1) {
search_from_1st_node = false;
}
if(UINT_MAX == middle2) {
search_from_2nd_node = false;
}
//Was at most one of the two paths not found?
BOOST_ASSERT_MSG(
(INT_MAX != distance1 || INT_MAX != distance2),
"no path found"
);
//Unpack paths if they exist
std::vector<NodeID> temporary_packed_path1;
std::vector<NodeID> temporary_packed_path2;
if(INT_MAX != local_upper_bound1) {
super::RetrievePackedPathFromHeap(
forward_heap1,
reverse_heap1,
middle1,
temporary_packed_path1
);
}
if(INT_MAX != local_upper_bound2) {
super::RetrievePackedPathFromHeap(
forward_heap2,
reverse_heap2,
middle2,
temporary_packed_path2
);
}
//if one of the paths was not found, replace it with the other one.
if( temporary_packed_path1.empty() ) {
temporary_packed_path1.insert(
temporary_packed_path1.end(),
temporary_packed_path2.begin(),
temporary_packed_path2.end()
);
local_upper_bound1 = local_upper_bound2;
}
if( temporary_packed_path2.empty() ) {
temporary_packed_path2.insert(
temporary_packed_path2.end(),
temporary_packed_path1.begin(),
temporary_packed_path1.end()
);
local_upper_bound2 = local_upper_bound1;
}
BOOST_ASSERT_MSG(
!temporary_packed_path1.empty() ||
!temporary_packed_path2.empty(),
"tempory packed paths empty"
);
//Plug paths together, s.t. end of packed path is begin of temporary packed path
if( !packed_path1.empty() && !packed_path2.empty() ) {
if(
temporary_packed_path1.front() ==
temporary_packed_path2.front()
) {
//both new route segments start with the same node
//thus, one of the packedPath must go.
BOOST_ASSERT_MSG(
(packed_path1.size() == packed_path2.size() ) ||
(packed_path1.back() != packed_path2.back() ),
"packed paths must be different"
);
if( packed_path1.back() == temporary_packed_path1.front()) {
packed_path2.clear();
packed_path2.insert(
packed_path2.end(),
packed_path1.begin(),
packed_path1.end()
);
} else {
packed_path1.clear();
packed_path1.insert(
packed_path1.end(),
packed_path2.begin(),
packed_path2.end()
);
}
} else {
//packed paths 1 and 2 may need to switch.
if( packed_path1.back() != temporary_packed_path1.front()) {
packed_path1.swap(packed_path2);
std::swap(distance1, distance2);
}
}
}
packed_path1.insert(
packed_path1.end(),
temporary_packed_path1.begin(),
temporary_packed_path1.end()
);
packed_path2.insert(
packed_path2.end(),
temporary_packed_path2.begin(),
temporary_packed_path2.end()
);
if(
(packed_path1.back() == packed_path2.back()) &&
phantom_node_pair.targetPhantom.isBidirected()
) {
const NodeID last_node_id = packed_path2.back();
search_from_1st_node &= !(last_node_id == phantom_node_pair.targetPhantom.edgeBasedNode+1);
search_from_2nd_node &= !(last_node_id == phantom_node_pair.targetPhantom.edgeBasedNode);
}
distance1 = local_upper_bound1;
distance2 = local_upper_bound2;
}
if( distance1 > distance2 ) {
std::swap( packed_path1, packed_path2 );
}
remove_consecutive_duplicates_from_vector(packed_path1);
super::UnpackPath(packed_path1, raw_route_data.computedShortestPath);
raw_route_data.lengthOfShortestPath = std::min(distance1, distance2);
}
};
#endif /* SHORTESTPATHROUTING_H_ */
-68
View File
@@ -1,68 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef APIGRAMMAR_H_
#define APIGRAMMAR_H_
#include <boost/bind.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/qi_action.hpp>
namespace qi = boost::spirit::qi;
template <typename Iterator, class HandlerT>
struct APIGrammar : qi::grammar<Iterator> {
APIGrammar(HandlerT * h) : APIGrammar::base_type(api_call), handler(h) {
api_call = qi::lit('/') >> string[boost::bind(&HandlerT::setService, handler, ::_1)] >> *(query);
query = ('?') >> (+(zoom | output | jsonp | checksum | location | hint | cmp | language | instruction | geometry | alt_route | old_API) ) ;
zoom = (-qi::lit('&')) >> qi::lit('z') >> '=' >> qi::short_[boost::bind(&HandlerT::setZoomLevel, handler, ::_1)];
output = (-qi::lit('&')) >> qi::lit("output") >> '=' >> string[boost::bind(&HandlerT::setOutputFormat, handler, ::_1)];
jsonp = (-qi::lit('&')) >> qi::lit("jsonp") >> '=' >> stringwithDot[boost::bind(&HandlerT::setJSONpParameter, handler, ::_1)];
checksum = (-qi::lit('&')) >> qi::lit("checksum") >> '=' >> qi::int_[boost::bind(&HandlerT::setChecksum, handler, ::_1)];
instruction = (-qi::lit('&')) >> qi::lit("instructions") >> '=' >> qi::bool_[boost::bind(&HandlerT::setInstructionFlag, handler, ::_1)];
geometry = (-qi::lit('&')) >> qi::lit("geometry") >> '=' >> qi::bool_[boost::bind(&HandlerT::setGeometryFlag, handler, ::_1)];
cmp = (-qi::lit('&')) >> qi::lit("compression") >> '=' >> qi::bool_[boost::bind(&HandlerT::setCompressionFlag, handler, ::_1)];
location = (-qi::lit('&')) >> qi::lit("loc") >> '=' >> (qi::double_ >> qi::lit(',') >> qi::double_)[boost::bind(&HandlerT::addCoordinate, handler, ::_1)];
hint = (-qi::lit('&')) >> qi::lit("hint") >> '=' >> stringwithDot[boost::bind(&HandlerT::addHint, handler, ::_1)];
language = (-qi::lit('&')) >> qi::lit("hl") >> '=' >> string[boost::bind(&HandlerT::setLanguage, handler, ::_1)];
alt_route = (-qi::lit('&')) >> qi::lit("alt") >> '=' >> qi::bool_[boost::bind(&HandlerT::setAlternateRouteFlag, handler, ::_1)];
old_API = (-qi::lit('&')) >> qi::lit("geomformat") >> '=' >> string[boost::bind(&HandlerT::setDeprecatedAPIFlag, handler, ::_1)];
string = +(qi::char_("a-zA-Z"));
stringwithDot = +(qi::char_("a-zA-Z0-9_.-"));
}
qi::rule<Iterator> api_call, query;
qi::rule<Iterator, std::string()> service, zoom, output, string, jsonp, checksum, location, hint,
stringwithDot, language, instruction, geometry,
cmp, alt_route, old_API;
HandlerT * handler;
};
#endif /* APIGRAMMAR_H_ */
-321
View File
@@ -1,321 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CONNECTION_H
#define CONNECTION_H
#include "Http/CompressionType.h"
#include "RequestHandler.h"
#include "RequestParser.h"
#include <boost/array.hpp>
#include <boost/asio.hpp>
#include <boost/assert.hpp>
#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
// #include <zlib.h>
#include <string>
#include <vector>
namespace http {
/// Represents a single connection from a client.
class Connection : public boost::enable_shared_from_this<Connection>,
private boost::noncopyable {
public:
explicit Connection(
boost::asio::io_service& io_service,
RequestHandler& handler
) : strand(io_service), TCP_socket(io_service), request_handler(handler) { }
boost::asio::ip::tcp::socket& socket() {
return TCP_socket;
}
/// Start the first asynchronous operation for the connection.
void start() {
TCP_socket.async_read_some(
boost::asio::buffer(incoming_data_buffer),
strand.wrap( boost::bind(
&Connection::handle_read,
this->shared_from_this(),
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred)
)
);
}
private:
void handle_read(
const boost::system::error_code& e,
std::size_t bytes_transferred
) {
if( !e ) {
CompressionType compression_type(noCompression);
boost::tribool result;
boost::tie(result, boost::tuples::ignore) = request_parser.Parse(
request,
incoming_data_buffer.data(),
incoming_data_buffer.data() + bytes_transferred,
&compression_type
);
if( result ) {
request.endpoint = TCP_socket.remote_endpoint().address();
request_handler.handle_request(request, reply);
Header compression_header;
std::vector<char> compressed_output;
std::vector<boost::asio::const_buffer> output_buffer;
switch(compression_type) {
case deflateRFC1951:
compression_header.name = "Content-Encoding";
compression_header.value = "deflate";
reply.headers.insert(
reply.headers.begin(),
compression_header
);
compressBufferCollection(
reply.content,
compression_type,
compressed_output
);
reply.setSize(compressed_output.size());
output_buffer = reply.HeaderstoBuffers();
output_buffer.push_back(
boost::asio::buffer(compressed_output)
);
boost::asio::async_write(
TCP_socket,
output_buffer,
strand.wrap(
boost::bind(
&Connection::handle_write,
this->shared_from_this(),
boost::asio::placeholders::error
)
)
);
break;
case gzipRFC1952:
compression_header.name = "Content-Encoding";
compression_header.value = "gzip";
reply.headers.insert(
reply.headers.begin(),
compression_header
);
compressBufferCollection(
reply.content,
compression_type,
compressed_output
);
reply.setSize(compressed_output.size());
output_buffer = reply.HeaderstoBuffers();
output_buffer.push_back(
boost::asio::buffer(compressed_output)
);
boost::asio::async_write(
TCP_socket,
output_buffer,
strand.wrap(
boost::bind(
&Connection::handle_write,
this->shared_from_this(),
boost::asio::placeholders::error
)
)
);
break;
case noCompression:
boost::asio::async_write(
TCP_socket,
reply.toBuffers(),
strand.wrap(
boost::bind(
&Connection::handle_write,
this->shared_from_this(),
boost::asio::placeholders::error
)
)
);
break;
}
} else if (!result) {
reply = Reply::StockReply(Reply::badRequest);
boost::asio::async_write(
TCP_socket,
reply.toBuffers(),
strand.wrap(
boost::bind(
&Connection::handle_write,
this->shared_from_this(),
boost::asio::placeholders::error
)
)
);
} else {
TCP_socket.async_read_some(
boost::asio::buffer(incoming_data_buffer),
strand.wrap(
boost::bind(
&Connection::handle_read,
this->shared_from_this(),
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred
)
)
);
}
}
}
/// Handle completion of a write operation.
void handle_write(const boost::system::error_code& e) {
if (!e) {
// Initiate graceful connection closure.
boost::system::error_code ignoredEC;
TCP_socket.shutdown(
boost::asio::ip::tcp::socket::shutdown_both,
ignoredEC
);
}
}
void compressBufferCollection(
std::vector<std::string> uncompressed_data,
CompressionType compression_type,
std::vector<char> & compressed_data
) {
boost::iostreams::gzip_params compression_parameters;
compression_parameters.level = boost::iostreams::zlib::best_speed;
if ( deflateRFC1951 == compression_type ) {
compression_parameters.noheader = true;
}
BOOST_ASSERT( compressed_data.empty() );
boost::iostreams::filtering_ostream compressing_stream;
compressing_stream.push(
boost::iostreams::gzip_compressor(compression_parameters)
);
compressing_stream.push(
boost::iostreams::back_inserter(compressed_data)
);
BOOST_FOREACH( const std::string & line, uncompressed_data) {
compressing_stream << line;
}
compressing_stream.reset();
}
// Big thanks to deusty who explains how to use gzip compression by
// the right call to deflateInit2():
// http://deusty.blogspot.com/2007/07/gzip-compressiondecompression.html
// void compressCharArray(
// const char * in_data,
// size_t in_data_size,
// std::vector<unsigned char> & buffer,
// CompressionType type
// ) {
// const size_t BUFSIZE = 128 * 1024;
// unsigned char temp_buffer[BUFSIZE];
// z_stream strm;
// strm.zalloc = Z_NULL;
// strm.zfree = Z_NULL;
// strm.opaque = Z_NULL;
// strm.total_out = 0;
// strm.next_in = (unsigned char *)(in_data);
// strm.avail_in = in_data_size;
// strm.next_out = temp_buffer;
// strm.avail_out = BUFSIZE;
// strm.data_type = Z_ASCII;
// switch(type){
// case deflateRFC1951:
// deflateInit(&strm, Z_BEST_SPEED);
// break;
// case gzipRFC1952:
// deflateInit2(
// &strm,
// Z_DEFAULT_COMPRESSION,
// Z_DEFLATED,
// (15+16),
// 9,
// Z_DEFAULT_STRATEGY
// );
// break;
// default:
// BOOST_ASSERT_MSG(false, "should not happen");
// break;
// }
// int deflate_res = Z_OK;
// do {
// if ( 0 == strm.avail_out ) {
// buffer.insert(buffer.end(), temp_buffer, temp_buffer + BUFSIZE);
// strm.next_out = temp_buffer;
// strm.avail_out = BUFSIZE;
// }
// deflate_res = deflate(&strm, Z_FINISH);
// } while (deflate_res == Z_OK);
// BOOST_ASSERT_MSG(
// deflate_res == Z_STREAM_END,
// "compression not properly finished"
// );
// buffer.insert(
// buffer.end(),
// temp_buffer,
// temp_buffer + BUFSIZE - strm.avail_out
// );
// deflateEnd(&strm);
// }
boost::asio::io_service::strand strand;
boost::asio::ip::tcp::socket TCP_socket;
RequestHandler& request_handler;
boost::array<char, 8192> incoming_data_buffer;
Request request;
RequestParser request_parser;
Reply reply;
};
} // namespace http
#endif // CONNECTION_H
-122
View File
@@ -1,122 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef QUERY_DATA_FACADE_H
#define QUERY_DATA_FACADE_H
//Exposes all data access interfaces to the algorithms via base class ptr
#include "../../DataStructures/Coordinate.h"
#include "../../DataStructures/EdgeBasedNode.h"
#include "../../DataStructures/ImportNode.h"
#include "../../DataStructures/PhantomNodes.h"
#include "../../DataStructures/TurnInstructions.h"
#include "../../Util/OSRMException.h"
#include "../../Util/StringUtil.h"
#include "../../typedefs.h"
#include <string>
template<class EdgeDataT>
class BaseDataFacade {
public:
typedef EdgeBasedNode RTreeLeaf;
typedef EdgeDataT EdgeData;
BaseDataFacade( ) { }
virtual ~BaseDataFacade() { }
//search graph access
virtual unsigned GetNumberOfNodes() const = 0;
virtual unsigned GetNumberOfEdges() const = 0;
virtual unsigned GetOutDegree( const NodeID n ) const = 0;
virtual NodeID GetTarget( const EdgeID e ) const = 0;
virtual EdgeDataT &GetEdgeData( const EdgeID e ) = 0;
// virtual const EdgeDataT &GetEdgeData( const EdgeID e ) const = 0;
virtual EdgeID BeginEdges( const NodeID n ) const = 0;
virtual EdgeID EndEdges( const NodeID n ) const = 0;
//searches for a specific edge
virtual EdgeID FindEdge( const NodeID from, const NodeID to ) const = 0;
virtual EdgeID FindEdgeInEitherDirection(
const NodeID from,
const NodeID to
) const = 0;
virtual EdgeID FindEdgeIndicateIfReverse(
const NodeID from,
const NodeID to,
bool & result
) const = 0;
//node and edge information access
virtual FixedPointCoordinate GetCoordinateOfNode(
const unsigned id
) const = 0;
virtual TurnInstruction GetTurnInstructionForEdgeID(
const unsigned id
) const = 0;
virtual bool LocateClosestEndPointForCoordinate(
const FixedPointCoordinate& input_coordinate,
FixedPointCoordinate& result,
const unsigned zoom_level = 18
) const = 0;
virtual bool FindPhantomNodeForCoordinate(
const FixedPointCoordinate & input_coordinate,
PhantomNode & resulting_phantom_node,
const unsigned zoom_level
) const = 0;
virtual unsigned GetCheckSum() const = 0;
virtual unsigned GetNameIndexFromEdgeID(const unsigned id) const = 0;
virtual void GetName(
const unsigned name_id,
std::string & result
) const = 0;
std::string GetEscapedNameForNameID(const unsigned name_id) const {
std::string temporary_string;
GetName(name_id, temporary_string);
return HTMLEntitize(temporary_string);
}
virtual std::string GetTimestamp() const = 0;
};
#endif // QUERY_DATA_FACADE_H
-396
View File
@@ -1,396 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef INTERNAL_DATA_FACADE
#define INTERNAL_DATA_FACADE
//implements all data storage when shared memory is _NOT_ used
#include "BaseDataFacade.h"
#include "../../DataStructures/Coordinate.h"
#include "../../DataStructures/QueryNode.h"
#include "../../DataStructures/QueryEdge.h"
#include "../../DataStructures/SharedMemoryVectorWrapper.h"
#include "../../DataStructures/StaticGraph.h"
#include "../../DataStructures/StaticRTree.h"
#include "../../Util/BoostFileSystemFix.h"
#include "../../Util/GraphLoader.h"
#include "../../Util/IniFile.h"
#include "../../Util/ProgramOptions.h"
#include "../../Util/SimpleLogger.h"
template<class EdgeDataT>
class InternalDataFacade : public BaseDataFacade<EdgeDataT> {
private:
typedef BaseDataFacade<EdgeDataT> super;
typedef StaticGraph<typename super::EdgeData> QueryGraph;
typedef typename QueryGraph::InputEdge InputEdge;
typedef typename super::RTreeLeaf RTreeLeaf;
InternalDataFacade() { }
unsigned m_check_sum;
unsigned m_number_of_nodes;
QueryGraph * m_query_graph;
std::string m_timestamp;
ShM<FixedPointCoordinate, false>::vector m_coordinate_list;
ShM<NodeID, false>::vector m_via_node_list;
ShM<unsigned, false>::vector m_name_ID_list;
ShM<TurnInstruction, false>::vector m_turn_instruction_list;
ShM<char, false>::vector m_names_char_list;
ShM<unsigned, false>::vector m_name_begin_indices;
StaticRTree<RTreeLeaf, false> * m_static_rtree;
void LoadTimestamp(const boost::filesystem::path & timestamp_path) {
if( boost::filesystem::exists(timestamp_path) ) {
SimpleLogger().Write() << "Loading Timestamp";
boost::filesystem::ifstream timestampInStream( timestamp_path );
if(!timestampInStream) {
SimpleLogger().Write(logWARNING) << timestamp_path << " not found";
}
getline(timestampInStream, m_timestamp);
timestampInStream.close();
}
if(m_timestamp.empty()) {
m_timestamp = "n/a";
}
if(25 < m_timestamp.length()) {
m_timestamp.resize(25);
}
}
void LoadGraph(const boost::filesystem::path & hsgr_path) {
typename ShM<typename QueryGraph::_StrNode, false>::vector node_list;
typename ShM<typename QueryGraph::_StrEdge, false>::vector edge_list;
SimpleLogger().Write() << "loading graph from " << hsgr_path.string();
m_number_of_nodes = readHSGRFromStream(
hsgr_path,
node_list,
edge_list,
&m_check_sum
);
BOOST_ASSERT_MSG(0 != node_list.size(), "node list empty");
BOOST_ASSERT_MSG(0 != edge_list.size(), "edge list empty");
SimpleLogger().Write() << "loaded " << node_list.size() << " nodes and " << edge_list.size() << " edges";
m_query_graph = new QueryGraph(node_list, edge_list);
BOOST_ASSERT_MSG(0 == node_list.size(), "node list not flushed");
BOOST_ASSERT_MSG(0 == edge_list.size(), "edge list not flushed");
SimpleLogger().Write() << "Data checksum is " << m_check_sum;
}
void LoadNodeAndEdgeInformation(
const boost::filesystem::path nodes_file,
const boost::filesystem::path edges_file
) {
boost::filesystem::ifstream nodes_input_stream(
nodes_file,
std::ios::binary
);
SimpleLogger().Write(logDEBUG) << "Loading node data";
NodeInfo current_node;
unsigned number_of_coordinates = 0;
nodes_input_stream.read(
(char *)&number_of_coordinates,
sizeof(unsigned)
);
m_coordinate_list.resize(number_of_coordinates);
for(unsigned i = 0; i < number_of_coordinates; ++i) {
nodes_input_stream.read((char *)&current_node, sizeof(NodeInfo));
m_coordinate_list[i] = FixedPointCoordinate(
current_node.lat,
current_node.lon
);
}
std::vector<FixedPointCoordinate>(m_coordinate_list).swap(m_coordinate_list);
nodes_input_stream.close();
SimpleLogger().Write(logDEBUG) << "Loading edge data";
boost::filesystem::ifstream edges_input_stream(
edges_file,
std::ios::binary
);
unsigned number_of_edges = 0;
edges_input_stream.read((char*)&number_of_edges, sizeof(unsigned));
m_via_node_list.resize(number_of_edges);
m_name_ID_list.resize(number_of_edges);
m_turn_instruction_list.resize(number_of_edges);
OriginalEdgeData current_edge_data;
for(unsigned i = 0; i < number_of_edges; ++i) {
edges_input_stream.read(
(char*)&(current_edge_data),
sizeof(OriginalEdgeData)
);
m_via_node_list[i] = current_edge_data.viaNode;
m_name_ID_list[i] = current_edge_data.nameID;
m_turn_instruction_list[i] = current_edge_data.turnInstruction;
}
edges_input_stream.close();
}
void LoadRTree(
const boost::filesystem::path & ram_index_path,
const boost::filesystem::path & file_index_path
) {
m_static_rtree = new StaticRTree<RTreeLeaf>(
ram_index_path,
file_index_path
);
}
void LoadStreetNames(
const boost::filesystem::path & names_file
) {
boost::filesystem::ifstream name_stream(names_file, std::ios::binary);
unsigned number_of_names = 0;
unsigned number_of_chars = 0;
name_stream.read((char *)&number_of_names, sizeof(unsigned));
name_stream.read((char *)&number_of_chars, sizeof(unsigned));
BOOST_ASSERT_MSG(0 != number_of_names, "name file broken");
BOOST_ASSERT_MSG(0 != number_of_chars, "name file broken");
m_name_begin_indices.resize(number_of_names);
name_stream.read(
(char*)&m_name_begin_indices[0],
number_of_names*sizeof(unsigned)
);
m_names_char_list.resize(number_of_chars+1); //+1 gives sentinel element
name_stream.read(
(char *)&m_names_char_list[0],
number_of_chars*sizeof(char)
);
BOOST_ASSERT_MSG(
0 != m_names_char_list.size(),
"could not load any names"
);
name_stream.close();
}
public:
~InternalDataFacade() {
delete m_query_graph;
delete m_static_rtree;
}
InternalDataFacade( const ServerPaths & server_paths ) {
//generate paths of data files
if( server_paths.find("hsgrdata") == server_paths.end() ) {
throw OSRMException("no hsgr file given in ini file");
}
if( server_paths.find("ramindex") == server_paths.end() ) {
throw OSRMException("no ram index file given in ini file");
}
if( server_paths.find("fileindex") == server_paths.end() ) {
throw OSRMException("no leaf index file given in ini file");
}
if( server_paths.find("nodesdata") == server_paths.end() ) {
throw OSRMException("no nodes file given in ini file");
}
if( server_paths.find("edgesdata") == server_paths.end() ) {
throw OSRMException("no edges file given in ini file");
}
if( server_paths.find("namesdata") == server_paths.end() ) {
throw OSRMException("no names file given in ini file");
}
ServerPaths::const_iterator paths_iterator = server_paths.find("hsgrdata");
BOOST_ASSERT(server_paths.end() != paths_iterator);
const boost::filesystem::path & hsgr_path = paths_iterator->second;
paths_iterator = server_paths.find("timestamp");
BOOST_ASSERT(server_paths.end() != paths_iterator);
const boost::filesystem::path & timestamp_path = paths_iterator->second;
paths_iterator = server_paths.find("ramindex");
BOOST_ASSERT(server_paths.end() != paths_iterator);
const boost::filesystem::path & ram_index_path = paths_iterator->second;
paths_iterator = server_paths.find("fileindex");
BOOST_ASSERT(server_paths.end() != paths_iterator);
const boost::filesystem::path & file_index_path = paths_iterator->second;
paths_iterator = server_paths.find("nodesdata");
BOOST_ASSERT(server_paths.end() != paths_iterator);
const boost::filesystem::path & nodes_data_path = paths_iterator->second;
paths_iterator = server_paths.find("edgesdata");
BOOST_ASSERT(server_paths.end() != paths_iterator);
const boost::filesystem::path & edges_data_path = paths_iterator->second;
paths_iterator = server_paths.find("namesdata");
BOOST_ASSERT(server_paths.end() != paths_iterator);
const boost::filesystem::path & names_data_path = paths_iterator->second;
//load data
SimpleLogger().Write() << "loading graph data";
LoadGraph(hsgr_path);
SimpleLogger().Write() << "loading egde information";
LoadNodeAndEdgeInformation(nodes_data_path, edges_data_path);
SimpleLogger().Write() << "loading r-tree";
LoadRTree(ram_index_path, file_index_path);
SimpleLogger().Write() << "loading timestamp";
LoadTimestamp(timestamp_path);
SimpleLogger().Write() << "loading street names";
LoadStreetNames(names_data_path);
}
//search graph access
unsigned GetNumberOfNodes() const {
return m_query_graph->GetNumberOfNodes();
}
unsigned GetNumberOfEdges() const {
return m_query_graph->GetNumberOfEdges();
}
unsigned GetOutDegree( const NodeID n ) const {
return m_query_graph->GetOutDegree(n);
}
NodeID GetTarget( const EdgeID e ) const {
return m_query_graph->GetTarget(e); }
EdgeDataT &GetEdgeData( const EdgeID e ) {
return m_query_graph->GetEdgeData(e);
}
const EdgeDataT &GetEdgeData( const EdgeID e ) const {
return m_query_graph->GetEdgeData(e);
}
EdgeID BeginEdges( const NodeID n ) const {
return m_query_graph->BeginEdges(n);
}
EdgeID EndEdges( const NodeID n ) const {
return m_query_graph->EndEdges(n);
}
//searches for a specific edge
EdgeID FindEdge( const NodeID from, const NodeID to ) const {
return m_query_graph->FindEdge(from, to);
}
EdgeID FindEdgeInEitherDirection(
const NodeID from,
const NodeID to
) const {
return m_query_graph->FindEdgeInEitherDirection(from, to);
}
EdgeID FindEdgeIndicateIfReverse(
const NodeID from,
const NodeID to,
bool & result
) const {
return m_query_graph->FindEdgeIndicateIfReverse(from, to, result);
}
//node and edge information access
FixedPointCoordinate GetCoordinateOfNode(
const unsigned id
) const {
const NodeID node = m_via_node_list.at(id);
return m_coordinate_list.at(node);
};
TurnInstruction GetTurnInstructionForEdgeID(
const unsigned id
) const {
return m_turn_instruction_list.at(id);
}
bool LocateClosestEndPointForCoordinate(
const FixedPointCoordinate& input_coordinate,
FixedPointCoordinate& result,
const unsigned zoom_level = 18
) const {
return m_static_rtree->LocateClosestEndPointForCoordinate(
input_coordinate,
result,
zoom_level
);
}
bool FindPhantomNodeForCoordinate(
const FixedPointCoordinate & input_coordinate,
PhantomNode & resulting_phantom_node,
const unsigned zoom_level
) const {
return m_static_rtree->FindPhantomNodeForCoordinate(
input_coordinate,
resulting_phantom_node,
zoom_level
);
}
unsigned GetCheckSum() const { return m_check_sum; }
unsigned GetNameIndexFromEdgeID(const unsigned id) const {
return m_name_ID_list.at(id);
};
void GetName( const unsigned name_id, std::string & result ) const {
if(UINT_MAX == name_id) {
result = "";
return;
}
BOOST_ASSERT_MSG(
name_id < m_name_begin_indices.size(),
"name id too high"
);
unsigned begin_index = m_name_begin_indices[name_id];
unsigned end_index = m_name_begin_indices[name_id+1];
BOOST_ASSERT_MSG(
begin_index < m_names_char_list.size(),
"begin index of name too high"
);
BOOST_ASSERT_MSG(
end_index < m_names_char_list.size(),
"end index of name too high"
);
BOOST_ASSERT_MSG(begin_index <= end_index, "string ends before begin");
result.clear();
result.resize(end_index - begin_index);
std::copy(
m_names_char_list.begin() + begin_index,
m_names_char_list.begin() + end_index,
result.begin()
);
}
std::string GetTimestamp() const {
return m_timestamp;
}
};
#endif // INTERNAL_DATA_FACADE
-123
View File
@@ -1,123 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ROUTE_PARAMETERS_H
#define ROUTE_PARAMETERS_H
#include "../../DataStructures/Coordinate.h"
#include "../../DataStructures/HashTable.h"
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/sequence/intrinsic.hpp>
#include <boost/fusion/include/at_c.hpp>
#include <string>
#include <vector>
struct RouteParameters {
RouteParameters() :
zoomLevel(18),
printInstructions(false),
alternateRoute(true),
geometry(true),
compression(true),
deprecatedAPI(false),
checkSum(-1) {}
short zoomLevel;
bool printInstructions;
bool alternateRoute;
bool geometry;
bool compression;
bool deprecatedAPI;
unsigned checkSum;
std::string service;
std::string outputFormat;
std::string jsonpParameter;
std::string language;
std::vector<std::string> hints;
std::vector<FixedPointCoordinate> coordinates;
typedef HashTable<std::string, std::string>::const_iterator OptionsIterator;
void setZoomLevel(const short i) {
if (18 > i && 0 < i) {
zoomLevel = i;
}
}
void setAlternateRouteFlag(const bool b) {
alternateRoute = b;
}
void setDeprecatedAPIFlag(const std::string &) {
deprecatedAPI = true;
}
void setChecksum(const unsigned c) {
checkSum = c;
}
void setInstructionFlag(const bool b) {
printInstructions = b;
}
void setService( const std::string & s) {
service = s;
}
void setOutputFormat(const std::string & s) {
outputFormat = s;
}
void setJSONpParameter(const std::string & s) {
jsonpParameter = s;
}
void addHint(const std::string & s) {
hints.resize(coordinates.size());
hints.back() = s;
}
void setLanguage(const std::string & s) {
language = s;
}
void setGeometryFlag(const bool b) {
geometry = b;
}
void setCompressionFlag(const bool b) {
compression = b;
}
void addCoordinate(const boost::fusion::vector < double, double > & arg_) {
int lat = COORDINATE_PRECISION*boost::fusion::at_c < 0 > (arg_);
int lon = COORDINATE_PRECISION*boost::fusion::at_c < 1 > (arg_);
coordinates.push_back(FixedPointCoordinate(lat, lon));
}
};
#endif /*ROUTE_PARAMETERS_H*/
-40
View File
@@ -1,40 +0,0 @@
#include <boost/interprocess/sync/named_mutex.hpp>
#include <boost/interprocess/sync/named_condition.hpp>
struct SharedBarriers {
SharedBarriers ()
:
pending_update_mutex(
boost::interprocess::open_or_create,
"pending_update"
),
update_mutex(
boost::interprocess::open_or_create,
"update"
),
query_mutex(
boost::interprocess::open_or_create,
"query"
),
no_running_queries_condition(
boost::interprocess::open_or_create,
"no_running_queries"
),
update_ongoing(false),
number_of_queries(0)
{ }
// Mutex to protect access to the boolean variable
boost::interprocess::named_mutex pending_update_mutex;
boost::interprocess::named_mutex update_mutex;
boost::interprocess::named_mutex query_mutex;
// Condition that no update is running
boost::interprocess::named_condition no_running_queries_condition;
// Is there an ongoing update?
bool update_ongoing;
// Is there any query?
int number_of_queries;
};
-385
View File
@@ -1,385 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SHARED_DATA_FACADE_H
#define SHARED_DATA_FACADE_H
//implements all data storage when shared memory is _NOT_ used
#include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp>
#include "BaseDataFacade.h"
#include "SharedDataType.h"
#include "../../DataStructures/StaticGraph.h"
#include "../../DataStructures/StaticRTree.h"
#include "../../Util/BoostFileSystemFix.h"
#include "../../Util/ProgramOptions.h"
#include "../../Util/SimpleLogger.h"
#include <algorithm>
template<class EdgeDataT>
class SharedDataFacade : public BaseDataFacade<EdgeDataT> {
private:
typedef EdgeDataT EdgeData;
typedef BaseDataFacade<EdgeData> super;
typedef StaticGraph<EdgeData, true> QueryGraph;
typedef typename StaticGraph<EdgeData, true>::_StrNode GraphNode;
typedef typename StaticGraph<EdgeData, true>::_StrEdge GraphEdge;
typedef typename QueryGraph::InputEdge InputEdge;
typedef typename super::RTreeLeaf RTreeLeaf;
typedef typename StaticRTree<RTreeLeaf, true>::TreeNode RTreeNode;
SharedDataLayout * data_layout;
char * shared_memory;
SharedDataTimestamp * data_timestamp_ptr;
SharedDataType CURRENT_LAYOUT;
SharedDataType CURRENT_DATA;
unsigned CURRENT_TIMESTAMP;
unsigned m_check_sum;
unsigned m_number_of_nodes;
boost::shared_ptr<QueryGraph> m_query_graph;
boost::shared_ptr<SharedMemory> m_layout_memory;
boost::shared_ptr<SharedMemory> m_large_memory;
std::string m_timestamp;
ShM<FixedPointCoordinate, true>::vector m_coordinate_list;
ShM<NodeID, true>::vector m_via_node_list;
ShM<unsigned, true>::vector m_name_ID_list;
ShM<TurnInstruction, true>::vector m_turn_instruction_list;
ShM<char, true>::vector m_names_char_list;
ShM<unsigned, true>::vector m_name_begin_indices;
boost::shared_ptr<StaticRTree<RTreeLeaf, true> > m_static_rtree;
// SharedDataFacade() { }
void LoadTimestamp() {
char * timestamp_ptr = shared_memory + data_layout->GetTimeStampOffset();
m_timestamp.resize(data_layout->timestamp_length);
std::copy(
timestamp_ptr,
timestamp_ptr+data_layout->timestamp_length,
m_timestamp.begin()
);
}
void LoadRTree(
const boost::filesystem::path & file_index_path
) {
RTreeNode * tree_ptr = (RTreeNode *)(
shared_memory + data_layout->GetRSearchTreeOffset()
);
m_static_rtree = boost::make_shared<StaticRTree<RTreeLeaf, true> >(
tree_ptr,
data_layout->r_search_tree_size,
file_index_path
);
}
void LoadGraph() {
m_number_of_nodes = data_layout->graph_node_list_size;
GraphNode * graph_nodes_ptr = (GraphNode *)(
shared_memory + data_layout->GetGraphNodeListOffset()
);
GraphEdge * graph_edges_ptr = (GraphEdge *)(
shared_memory + data_layout->GetGraphEdgeListOffsett()
);
typename ShM<GraphNode, true>::vector node_list(
graph_nodes_ptr,
data_layout->graph_node_list_size
);
typename ShM<GraphEdge, true>::vector edge_list(
graph_edges_ptr,
data_layout->graph_edge_list_size
);
m_query_graph.reset(
new QueryGraph(node_list, edge_list)
);
}
void LoadNodeAndEdgeInformation() {
FixedPointCoordinate * coordinate_list_ptr = (FixedPointCoordinate *)(
shared_memory + data_layout->GetCoordinateListOffset()
);
typename ShM<FixedPointCoordinate, true>::vector coordinate_list(
coordinate_list_ptr,
data_layout->coordinate_list_size
);
m_coordinate_list.swap( coordinate_list );
TurnInstruction * turn_instruction_list_ptr = (TurnInstruction *)(
shared_memory + data_layout->GetTurnInstructionListOffset()
);
typename ShM<TurnInstruction, true>::vector turn_instruction_list(
turn_instruction_list_ptr,
data_layout->turn_instruction_list_size
);
m_turn_instruction_list.swap(turn_instruction_list);
unsigned * name_id_list_ptr = (unsigned *)(
shared_memory + data_layout->GetNameIDListOffset()
);
typename ShM<unsigned, true>::vector name_id_list(
name_id_list_ptr,
data_layout->name_id_list_size
);
m_name_ID_list.swap(name_id_list);
}
void LoadViaNodeList() {
NodeID * via_node_list_ptr = (NodeID *)(
shared_memory + data_layout->GetViaNodeListOffset()
);
typename ShM<NodeID, true>::vector via_node_list(
via_node_list_ptr,
data_layout->via_node_list_size
);
m_via_node_list.swap(via_node_list);
}
void LoadNames() {
unsigned * street_names_index_ptr = (unsigned *)(
shared_memory + data_layout->GetNameIndexOffset()
);
typename ShM<unsigned, true>::vector name_begin_indices(
street_names_index_ptr,
data_layout->name_index_list_size
);
m_name_begin_indices.swap(name_begin_indices);
char * names_list_ptr = (char *)(
shared_memory + data_layout->GetNameListOffset()
);
typename ShM<char, true>::vector names_char_list(
names_list_ptr,
data_layout->name_char_list_size
);
m_names_char_list.swap(names_char_list);
}
public:
SharedDataFacade( ) {
data_timestamp_ptr = (SharedDataTimestamp *)SharedMemoryFactory::Get(
CURRENT_REGIONS,
sizeof(SharedDataTimestamp),
false,
false
)->Ptr();
CURRENT_LAYOUT = LAYOUT_NONE;
CURRENT_DATA = DATA_NONE;
CURRENT_TIMESTAMP = 0;
//load data
CheckAndReloadFacade();
}
void CheckAndReloadFacade() {
if(
CURRENT_LAYOUT != data_timestamp_ptr->layout ||
CURRENT_DATA != data_timestamp_ptr->data ||
CURRENT_TIMESTAMP != data_timestamp_ptr->timestamp
) {
// release the previous shared memory segments
SharedMemory::Remove(CURRENT_LAYOUT);
SharedMemory::Remove(CURRENT_DATA);
CURRENT_LAYOUT = data_timestamp_ptr->layout;
CURRENT_DATA = data_timestamp_ptr->data;
CURRENT_TIMESTAMP = data_timestamp_ptr->timestamp;
m_layout_memory.reset( SharedMemoryFactory::Get(CURRENT_LAYOUT) );
data_layout = (SharedDataLayout *)(
m_layout_memory->Ptr()
);
boost::filesystem::path ram_index_path(data_layout->ram_index_file_name);
if( !boost::filesystem::exists(ram_index_path) ) {
throw OSRMException(
"no leaf index file given. "
"Is any data loaded into shared memory?"
);
}
m_large_memory.reset( SharedMemoryFactory::Get(CURRENT_DATA) );
shared_memory = (char *)(
m_large_memory->Ptr()
);
LoadGraph();
LoadNodeAndEdgeInformation();
LoadRTree(ram_index_path);
LoadTimestamp();
LoadViaNodeList();
LoadNames();
data_layout->PrintInformation();
}
}
//search graph access
unsigned GetNumberOfNodes() const {
return m_query_graph->GetNumberOfNodes();
}
unsigned GetNumberOfEdges() const {
return m_query_graph->GetNumberOfEdges();
}
unsigned GetOutDegree( const NodeID n ) const {
return m_query_graph->GetOutDegree(n);
}
NodeID GetTarget( const EdgeID e ) const {
return m_query_graph->GetTarget(e); }
EdgeDataT &GetEdgeData( const EdgeID e ) {
return m_query_graph->GetEdgeData(e);
}
// const EdgeDataT &GetEdgeData( const EdgeID e ) const {
// return m_query_graph->GetEdgeData(e);
// }
EdgeID BeginEdges( const NodeID n ) const {
return m_query_graph->BeginEdges(n);
}
EdgeID EndEdges( const NodeID n ) const {
return m_query_graph->EndEdges(n);
}
//searches for a specific edge
EdgeID FindEdge( const NodeID from, const NodeID to ) const {
return m_query_graph->FindEdge(from, to);
}
EdgeID FindEdgeInEitherDirection(
const NodeID from,
const NodeID to
) const {
return m_query_graph->FindEdgeInEitherDirection(from, to);
}
EdgeID FindEdgeIndicateIfReverse(
const NodeID from,
const NodeID to,
bool & result
) const {
return m_query_graph->FindEdgeIndicateIfReverse(from, to, result);
}
//node and edge information access
FixedPointCoordinate GetCoordinateOfNode(
const unsigned id
) const {
const NodeID node = m_via_node_list.at(id);
return m_coordinate_list.at(node);
};
TurnInstruction GetTurnInstructionForEdgeID(
const unsigned id
) const {
return m_turn_instruction_list.at(id);
}
bool LocateClosestEndPointForCoordinate(
const FixedPointCoordinate& input_coordinate,
FixedPointCoordinate& result,
const unsigned zoom_level = 18
) const {
return m_static_rtree->LocateClosestEndPointForCoordinate(
input_coordinate,
result,
zoom_level
);
}
bool FindPhantomNodeForCoordinate(
const FixedPointCoordinate & input_coordinate,
PhantomNode & resulting_phantom_node,
const unsigned zoom_level
) const {
return m_static_rtree->FindPhantomNodeForCoordinate(
input_coordinate,
resulting_phantom_node,
zoom_level
);
}
unsigned GetCheckSum() const { return m_check_sum; }
unsigned GetNameIndexFromEdgeID(const unsigned id) const {
return m_name_ID_list.at(id);
};
void GetName( const unsigned name_id, std::string & result ) const {
if(UINT_MAX == name_id) {
result = "";
return;
}
BOOST_ASSERT_MSG(
name_id < m_name_begin_indices.size(),
"name id too high"
);
unsigned begin_index = m_name_begin_indices[name_id];
unsigned end_index = m_name_begin_indices[name_id+1];
BOOST_ASSERT_MSG(
begin_index < m_names_char_list.size(),
"begin index of name too high"
);
BOOST_ASSERT_MSG(
end_index < m_names_char_list.size(),
"end index of name too high"
);
BOOST_ASSERT_MSG(begin_index <= end_index, "string ends before begin");
result.clear();
result.resize(end_index - begin_index);
std::copy(
m_names_char_list.begin() + begin_index,
m_names_char_list.begin() + end_index,
result.begin()
);
}
std::string GetTimestamp() const {
return m_timestamp;
}
};
#endif // SHARED_DATA_FACADE_H
-229
View File
@@ -1,229 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SHARED_DATA_TYPE_H_
#define SHARED_DATA_TYPE_H_
#include "BaseDataFacade.h"
#include "../../DataStructures/Coordinate.h"
#include "../../DataStructures/QueryEdge.h"
#include "../../DataStructures/StaticGraph.h"
#include "../../DataStructures/StaticRTree.h"
#include "../../DataStructures/TurnInstructions.h"
#include "../../typedefs.h"
#include <boost/integer.hpp>
typedef BaseDataFacade<QueryEdge::EdgeData>::RTreeLeaf RTreeLeaf;
typedef StaticRTree<RTreeLeaf, true>::TreeNode RTreeNode;
typedef StaticGraph<QueryEdge::EdgeData> QueryGraph;
struct SharedDataLayout {
uint64_t name_index_list_size;
uint64_t name_char_list_size;
uint64_t name_id_list_size;
uint64_t via_node_list_size;
uint64_t graph_node_list_size;
uint64_t graph_edge_list_size;
uint64_t coordinate_list_size;
uint64_t turn_instruction_list_size;
uint64_t r_search_tree_size;
unsigned checksum;
unsigned timestamp_length;
char ram_index_file_name[1024];
SharedDataLayout() :
name_index_list_size(0),
name_char_list_size(0),
name_id_list_size(0),
via_node_list_size(0),
graph_node_list_size(0),
graph_edge_list_size(0),
coordinate_list_size(0),
turn_instruction_list_size(0),
r_search_tree_size(0),
checksum(0),
timestamp_length(0)
{
ram_index_file_name[0] = '\0';
}
void PrintInformation() const {
SimpleLogger().Write(logDEBUG) << "-";
SimpleLogger().Write(logDEBUG) << "name_index_list_size: " << name_index_list_size;
SimpleLogger().Write(logDEBUG) << "name_char_list_size: " << name_char_list_size;
SimpleLogger().Write(logDEBUG) << "name_id_list_size: " << name_id_list_size;
SimpleLogger().Write(logDEBUG) << "via_node_list_size: " << via_node_list_size;
SimpleLogger().Write(logDEBUG) << "graph_node_list_size: " << graph_node_list_size;
SimpleLogger().Write(logDEBUG) << "graph_edge_list_size: " << graph_edge_list_size;
SimpleLogger().Write(logDEBUG) << "timestamp_length: " << timestamp_length;
SimpleLogger().Write(logDEBUG) << "coordinate_list_size: " << coordinate_list_size;
SimpleLogger().Write(logDEBUG) << "turn_instruction_list_size: " << turn_instruction_list_size;
SimpleLogger().Write(logDEBUG) << "r_search_tree_size: " << r_search_tree_size;
SimpleLogger().Write(logDEBUG) << "sizeof(checksum): " << sizeof(checksum);
SimpleLogger().Write(logDEBUG) << "ram index file name: " << ram_index_file_name;
}
uint64_t GetSizeOfLayout() const {
uint64_t result =
(name_index_list_size * sizeof(unsigned) ) +
(name_char_list_size * sizeof(char) ) +
(name_id_list_size * sizeof(unsigned) ) +
(via_node_list_size * sizeof(NodeID) ) +
(graph_node_list_size * sizeof(QueryGraph::_StrNode)) +
(graph_edge_list_size * sizeof(QueryGraph::_StrEdge)) +
(timestamp_length * sizeof(char) ) +
(coordinate_list_size * sizeof(FixedPointCoordinate)) +
(turn_instruction_list_size * sizeof(TurnInstructions) ) +
(r_search_tree_size * sizeof(RTreeNode) ) +
sizeof(checksum) +
1024*sizeof(char);
return result;
}
uint64_t GetNameIndexOffset() const {
return 0;
}
uint64_t GetNameListOffset() const {
uint64_t result =
(name_index_list_size * sizeof(unsigned) );
return result;
}
uint64_t GetNameIDListOffset() const {
uint64_t result =
(name_index_list_size * sizeof(unsigned) ) +
(name_char_list_size * sizeof(char) );
return result;
}
uint64_t GetViaNodeListOffset() const {
uint64_t result =
(name_index_list_size * sizeof(unsigned) ) +
(name_char_list_size * sizeof(char) ) +
(name_id_list_size * sizeof(unsigned) );
return result;
}
uint64_t GetGraphNodeListOffset() const {
uint64_t result =
(name_index_list_size * sizeof(unsigned) ) +
(name_char_list_size * sizeof(char) ) +
(name_id_list_size * sizeof(unsigned) ) +
(via_node_list_size * sizeof(NodeID) );
return result;
}
uint64_t GetGraphEdgeListOffsett() const {
uint64_t result =
(name_index_list_size * sizeof(unsigned) ) +
(name_char_list_size * sizeof(char) ) +
(name_id_list_size * sizeof(unsigned) ) +
(via_node_list_size * sizeof(NodeID) ) +
(graph_node_list_size * sizeof(QueryGraph::_StrNode)) ;
return result;
}
uint64_t GetTimeStampOffset() const {
uint64_t result =
(name_index_list_size * sizeof(unsigned) ) +
(name_char_list_size * sizeof(char) ) +
(name_id_list_size * sizeof(unsigned) ) +
(via_node_list_size * sizeof(NodeID) ) +
(graph_node_list_size * sizeof(QueryGraph::_StrNode)) +
(graph_edge_list_size * sizeof(QueryGraph::_StrEdge));
return result;
}
uint64_t GetCoordinateListOffset() const {
uint64_t result =
(name_index_list_size * sizeof(unsigned) ) +
(name_char_list_size * sizeof(char) ) +
(name_id_list_size * sizeof(unsigned) ) +
(via_node_list_size * sizeof(NodeID) ) +
(graph_node_list_size * sizeof(QueryGraph::_StrNode)) +
(graph_edge_list_size * sizeof(QueryGraph::_StrEdge)) +
(timestamp_length * sizeof(char) );
return result;
}
uint64_t GetTurnInstructionListOffset() const {
uint64_t result =
(name_index_list_size * sizeof(unsigned) ) +
(name_char_list_size * sizeof(char) ) +
(name_id_list_size * sizeof(unsigned) ) +
(via_node_list_size * sizeof(NodeID) ) +
(graph_node_list_size * sizeof(QueryGraph::_StrNode)) +
(graph_edge_list_size * sizeof(QueryGraph::_StrEdge)) +
(timestamp_length * sizeof(char) ) +
(coordinate_list_size * sizeof(FixedPointCoordinate));
return result;
}
uint64_t GetRSearchTreeOffset() const {
uint64_t result =
(name_index_list_size * sizeof(unsigned) ) +
(name_char_list_size * sizeof(char) ) +
(name_id_list_size * sizeof(unsigned) ) +
(via_node_list_size * sizeof(NodeID) ) +
(graph_node_list_size * sizeof(QueryGraph::_StrNode)) +
(graph_edge_list_size * sizeof(QueryGraph::_StrEdge)) +
(timestamp_length * sizeof(char) ) +
(coordinate_list_size * sizeof(FixedPointCoordinate)) +
(turn_instruction_list_size * sizeof(TurnInstructions) );
return result;
}
uint64_t GetChecksumOffset() const {
uint64_t result =
(name_index_list_size * sizeof(unsigned) ) +
(name_char_list_size * sizeof(char) ) +
(name_id_list_size * sizeof(unsigned) ) +
(via_node_list_size * sizeof(NodeID) ) +
(graph_node_list_size * sizeof(QueryGraph::_StrNode)) +
(graph_edge_list_size * sizeof(QueryGraph::_StrEdge)) +
(timestamp_length * sizeof(char) ) +
(coordinate_list_size * sizeof(FixedPointCoordinate)) +
(turn_instruction_list_size * sizeof(TurnInstructions) ) +
(r_search_tree_size * sizeof(RTreeNode) );
return result;
}
};
enum SharedDataType {
CURRENT_REGIONS,
LAYOUT_1,
DATA_1,
LAYOUT_2,
DATA_2,
LAYOUT_NONE,
DATA_NONE
};
struct SharedDataTimestamp {
SharedDataType layout;
SharedDataType data;
unsigned timestamp;
};
#endif /* SHARED_DATA_TYPE_H_ */
-117
View File
@@ -1,117 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "Reply.h"
namespace http {
void Reply::setSize(const unsigned size) {
BOOST_FOREACH ( Header& h, headers) {
if("Content-Length" == h.name) {
std::string sizeString;
intToString(size,h.value);
}
}
}
std::vector<boost::asio::const_buffer> Reply::toBuffers(){
std::vector<boost::asio::const_buffer> buffers;
buffers.push_back(ToBuffer(status));
BOOST_FOREACH(const Header & h, headers) {
buffers.push_back(boost::asio::buffer(h.name));
buffers.push_back(boost::asio::buffer(seperators));
buffers.push_back(boost::asio::buffer(h.value));
buffers.push_back(boost::asio::buffer(crlf));
}
buffers.push_back(boost::asio::buffer(crlf));
BOOST_FOREACH(const std::string & line, content) {
buffers.push_back(boost::asio::buffer(line));
}
return buffers;
}
std::vector<boost::asio::const_buffer> Reply::HeaderstoBuffers(){
std::vector<boost::asio::const_buffer> buffers;
buffers.push_back(ToBuffer(status));
for (std::size_t i = 0; i < headers.size(); ++i) {
Header& h = headers[i];
buffers.push_back(boost::asio::buffer(h.name));
buffers.push_back(boost::asio::buffer(seperators));
buffers.push_back(boost::asio::buffer(h.value));
buffers.push_back(boost::asio::buffer(crlf));
}
buffers.push_back(boost::asio::buffer(crlf));
return buffers;
}
Reply Reply::StockReply(Reply::status_type status) {
Reply rep;
rep.status = status;
rep.content.clear();
rep.content.push_back( ToString(status) );
rep.headers.resize(3);
rep.headers[0].name = "Access-Control-Allow-Origin";
rep.headers[0].value = "*";
rep.headers[1].name = "Content-Length";
std::string s;
intToString(rep.content.size(), s);
rep.headers[1].value = s;
rep.headers[2].name = "Content-Type";
rep.headers[2].value = "text/html";
return rep;
}
std::string Reply::ToString(Reply::status_type status) {
switch (status) {
case Reply::ok:
return okHTML;
case Reply::badRequest:
return badRequestHTML;
default:
return internalServerErrorHTML;
}
}
boost::asio::const_buffer Reply::ToBuffer(Reply::status_type status) {
switch (status) {
case Reply::ok:
return boost::asio::buffer(okString);
case Reply::internalServerError:
return boost::asio::buffer(internalServerErrorString);
default:
return boost::asio::buffer(badRequestString);
}
}
Reply::Reply() : status(ok) {
}
}
-73
View File
@@ -1,73 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef REPLY_H
#define REPLY_H
#include "Header.h"
#include "../../Util/StringUtil.h"
#include <boost/asio.hpp>
#include <boost/foreach.hpp>
#include <vector>
namespace http {
const char okHTML[] = "";
const char badRequestHTML[] = "<html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>";
const char internalServerErrorHTML[] = "<html><head><title>Internal Server Error</title></head><body><h1>500 Internal Server Error</h1></body></html>";
const char seperators[] = { ':', ' ' };
const char crlf[] = { '\r', '\n' };
const std::string okString = "HTTP/1.0 200 OK\r\n";
const std::string badRequestString = "HTTP/1.0 400 Bad Request\r\n";
const std::string internalServerErrorString = "HTTP/1.0 500 Internal Server Error\r\n";
class Reply {
public:
enum status_type {
ok = 200,
badRequest = 400,
internalServerError = 500
} status;
std::vector<Header> headers;
std::vector<boost::asio::const_buffer> toBuffers();
std::vector<boost::asio::const_buffer> HeaderstoBuffers();
std::vector<std::string> content;
static Reply StockReply(status_type status);
void setSize(const unsigned size);
Reply();
private:
static std::string ToString(Reply::status_type status);
boost::asio::const_buffer ToBuffer(Reply::status_type status);
};
}
#endif //REPLY_H
-125
View File
@@ -1,125 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef REQUEST_HANDLER_H
#define REQUEST_HANDLER_H
#include "APIGrammar.h"
#include "DataStructures/RouteParameters.h"
#include "Http/Request.h"
#include "../Library/OSRM.h"
#include "../Util/SimpleLogger.h"
#include "../Util/StringUtil.h"
#include "../typedefs.h"
#include <boost/foreach.hpp>
#include <boost/noncopyable.hpp>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <string>
class RequestHandler : private boost::noncopyable {
public:
typedef APIGrammar<std::string::iterator, RouteParameters> APIGrammarParser;
explicit RequestHandler() : routing_machine(NULL) { }
void handle_request(const http::Request& req, http::Reply& rep){
//parse command
try {
std::string request(req.uri);
time_t ltime;
struct tm *Tm;
ltime=time(NULL);
Tm=localtime(&ltime);
SimpleLogger().Write() <<
(Tm->tm_mday < 10 ? "0" : "" ) << Tm->tm_mday << "-" <<
(Tm->tm_mon+1 < 10 ? "0" : "" ) << (Tm->tm_mon+1) << "-" <<
1900+Tm->tm_year << " " << (Tm->tm_hour < 10 ? "0" : "" ) <<
Tm->tm_hour << ":" << (Tm->tm_min < 10 ? "0" : "" ) <<
Tm->tm_min << ":" << (Tm->tm_sec < 10 ? "0" : "" ) <<
Tm->tm_sec << " " << req.endpoint.to_string() << " " <<
req.referrer << ( 0 == req.referrer.length() ? "- " :" ") <<
req.agent << ( 0 == req.agent.length() ? "- " :" ") << req.uri;
RouteParameters routeParameters;
APIGrammarParser apiParser(&routeParameters);
std::string::iterator it = request.begin();
const bool result = boost::spirit::qi::parse(
it,
request.end(),
apiParser
);
if ( !result || (it != request.end()) ) {
rep = http::Reply::StockReply(http::Reply::badRequest);
const int position = std::distance(request.begin(), it);
std::string tmp_position_string;
intToString(position, tmp_position_string);
rep.content.push_back(
"Input seems to be malformed close to position "
"<br><pre>"
);
rep.content.push_back( request );
rep.content.push_back(tmp_position_string);
rep.content.push_back("<br>");
const unsigned end = std::distance(request.begin(), it);
for(unsigned i = 0; i < end; ++i) {
rep.content.push_back("&nbsp;");
}
rep.content.push_back("^<br></pre>");
} else {
//parsing done, lets call the right plugin to handle the request
BOOST_ASSERT_MSG(
routing_machine != NULL,
"pointer not init'ed"
);
routing_machine->RunQuery(routeParameters, rep);
return;
}
} catch(std::exception& e) {
rep = http::Reply::StockReply(http::Reply::internalServerError);
SimpleLogger().Write(logWARNING) <<
"[server error] code: " << e.what() << ", uri: " << req.uri;
return;
}
};
void RegisterRoutingMachine(OSRM * osrm) {
routing_machine = osrm;
}
private:
OSRM * routing_machine;
};
#endif // REQUEST_HANDLER_H
-270
View File
@@ -1,270 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "RequestParser.h"
namespace http {
RequestParser::RequestParser() : state_(method_start) { }
void RequestParser::Reset() { state_ = method_start; }
boost::tuple<boost::tribool, char*> RequestParser::Parse(
Request& req,
char* begin,
char* end,
http::CompressionType * compressionType
) {
while (begin != end) {
boost::tribool result = consume(req, *begin++, compressionType);
if (result || !result){
return boost::make_tuple(result, begin);
}
}
boost::tribool result = boost::indeterminate;
return boost::make_tuple(result, begin);
}
boost::tribool RequestParser::consume(
Request& req, char input,
http::CompressionType * compressionType
) {
switch (state_) {
case method_start:
if (!isChar(input) || isCTL(input) || isTSpecial(input)) {
return false;
} else {
state_ = method;
return boost::indeterminate;
}
case method:
if (input == ' ') {
state_ = uri;
return boost::indeterminate;
} else if (!isChar(input) || isCTL(input) || isTSpecial(input)) {
return false;
} else {
return boost::indeterminate;
}
case uri_start:
if (isCTL(input)) {
return false;
} else {
state_ = uri;
req.uri.push_back(input);
return boost::indeterminate;
}
case uri:
if (input == ' ') {
state_ = http_version_h;
return boost::indeterminate;
} else if (isCTL(input)) {
return false;
} else {
req.uri.push_back(input);
return boost::indeterminate;
}
case http_version_h:
if (input == 'H') {
state_ = http_version_t_1;
return boost::indeterminate;
} else {
return false;
}
case http_version_t_1:
if (input == 'T') {
state_ = http_version_t_2;
return boost::indeterminate;
} else {
return false;
}
case http_version_t_2:
if (input == 'T') {
state_ = http_version_p;
return boost::indeterminate;
} else {
return false;
}
case http_version_p:
if (input == 'P') {
state_ = http_version_slash;
return boost::indeterminate;
} else {
return false;
}
case http_version_slash:
if (input == '/') {
state_ = http_version_major_start;
return boost::indeterminate;
} else {
return false;
}
case http_version_major_start:
if (isDigit(input)) {
state_ = http_version_major;
return boost::indeterminate;
} else {
return false;
}
case http_version_major:
if (input == '.') {
state_ = http_version_minor_start;
return boost::indeterminate;
} else if (isDigit(input)) {
return boost::indeterminate;
} else {
return false;
}
case http_version_minor_start:
if (isDigit(input)) {
state_ = http_version_minor;
return boost::indeterminate;
} else {
return false;
}
case http_version_minor:
if (input == '\r') {
state_ = expecting_newline_1;
return boost::indeterminate;
} else if (isDigit(input)) {
return boost::indeterminate;
}
else {
return false;
}
case expecting_newline_1:
if (input == '\n') {
state_ = header_line_start;
return boost::indeterminate;
} else {
return false;
}
case header_line_start:
if(header.name == "Accept-Encoding") {
/* giving gzip precedence over deflate */
if(header.value.find("deflate") != std::string::npos)
*compressionType = deflateRFC1951;
if(header.value.find("gzip") != std::string::npos)
*compressionType = gzipRFC1952;
}
if("Referer" == header.name)
req.referrer = header.value;
if("User-Agent" == header.name)
req.agent = header.value;
if (input == '\r') {
state_ = expecting_newline_3;
return boost::indeterminate;
} else if (!isChar(input) || isCTL(input) || isTSpecial(input)) {
return false;
} else {
state_ = header_name;
header.Clear();
header.name.push_back(input);
return boost::indeterminate;
}
case header_lws:
if (input == '\r') {
state_ = expecting_newline_2;
return boost::indeterminate;
} else if (input == ' ' || input == '\t') {
return boost::indeterminate;
}
else if (isCTL(input)) {
return false;
} else {
state_ = header_value;
return boost::indeterminate;
}
case header_name:
if (input == ':') {
state_ = space_before_header_value;
return boost::indeterminate;
} else if (!isChar(input) || isCTL(input) || isTSpecial(input)) {
return false;
} else {
header.name.push_back(input);
return boost::indeterminate;
}
case space_before_header_value:
if (input == ' ') {
state_ = header_value;
return boost::indeterminate;
} else {
return false;
}
case header_value:
if (input == '\r') {
state_ = expecting_newline_2;
return boost::indeterminate;
} else if (isCTL(input)) {
return false;
} else {
header.value.push_back(input);
return boost::indeterminate;
}
case expecting_newline_2:
if (input == '\n') {
state_ = header_line_start;
return boost::indeterminate;
} else {
return false;
}
case expecting_newline_3:
return (input == '\n');
default:
return false;
}
}
inline bool RequestParser::isChar(int c) {
return c >= 0 && c <= 127;
}
inline bool RequestParser::isCTL(int c) {
return (c >= 0 && c <= 31) || (c == 127);
}
inline bool RequestParser::isTSpecial(int c) {
switch (c) {
case '(': case ')': case '<': case '>': case '@':
case ',': case ';': case ':': case '\\': case '"':
case '/': case '[': case ']': case '?': case '=':
case '{': case '}': case ' ': case '\t':
return true;
default:
return false;
}
}
inline bool RequestParser::isDigit(int c) {
return c >= '0' && c <= '9';
}
}
-96
View File
@@ -1,96 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef REQUEST_PARSER_H
#define REQUEST_PARSER_H
#include "Http/CompressionType.h"
#include "Http/Header.h"
#include "Http/Request.h"
#include <boost/logic/tribool.hpp>
#include <boost/tuple/tuple.hpp>
namespace http {
class RequestParser {
public:
RequestParser();
void Reset();
boost::tuple<boost::tribool, char*> Parse(
Request& req,
char* begin,
char* end,
CompressionType * compressionType
);
private:
boost::tribool consume(
Request& req,
char input,
CompressionType * compressionType
);
inline bool isChar(int c);
inline bool isCTL(int c);
inline bool isTSpecial(int c);
inline bool isDigit(int c);
enum state {
method_start,
method,
uri_start,
uri,
http_version_h,
http_version_t_1,
http_version_t_2,
http_version_p,
http_version_slash,
http_version_major_start,
http_version_major,
http_version_minor_start,
http_version_minor,
expecting_newline_1,
header_line_start,
header_lws,
header_name,
space_before_header_value,
header_value,
expecting_newline_2,
expecting_newline_3
} state_;
Header header;
};
} // namespace http
#endif // REQUEST_PARSER_H
-115
View File
@@ -1,115 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SERVER_H
#define SERVER_H
#include "Connection.h"
#include "RequestHandler.h"
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
#include <vector>
class Server: private boost::noncopyable {
public:
explicit Server(
const std::string& address,
const std::string& port,
unsigned thread_pool_size
) :
threadPoolSize(thread_pool_size),
acceptor(ioService),
newConnection(new http::Connection(ioService, requestHandler)),
requestHandler()
{
boost::asio::ip::tcp::resolver resolver(ioService);
boost::asio::ip::tcp::resolver::query query(address, port);
boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(query);
acceptor.open(endpoint.protocol());
acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
acceptor.bind(endpoint);
acceptor.listen();
acceptor.async_accept(
newConnection->socket(),
boost::bind(
&Server::handleAccept,
this,
boost::asio::placeholders::error
)
);
}
void Run() {
std::vector<boost::shared_ptr<boost::thread> > threads;
for (unsigned i = 0; i < threadPoolSize; ++i) {
boost::shared_ptr<boost::thread> thread(new boost::thread(boost::bind(&boost::asio::io_service::run, &ioService)));
threads.push_back(thread);
}
for (unsigned i = 0; i < threads.size(); ++i)
threads[i]->join();
}
void Stop() {
ioService.stop();
}
RequestHandler & GetRequestHandlerPtr() {
return requestHandler;
}
private:
void handleAccept(const boost::system::error_code& e) {
if (!e) {
newConnection->start();
newConnection.reset(
new http::Connection(ioService, requestHandler)
);
acceptor.async_accept(
newConnection->socket(),
boost::bind(
&Server::handleAccept,
this,
boost::asio::placeholders::error
)
);
}
}
unsigned threadPoolSize;
boost::asio::io_service ioService;
boost::asio::ip::tcp::acceptor acceptor;
boost::shared_ptr<http::Connection> newConnection;
RequestHandler requestHandler;
};
#endif // SERVER_H
-52
View File
@@ -1,52 +0,0 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SERVERFACTORY_H_
#define SERVERFACTORY_H_
#include "Server.h"
#include "../Util/SimpleLogger.h"
#include "../Util/StringUtil.h"
#include <zlib.h>
#include <boost/noncopyable.hpp>
#include <sstream>
struct ServerFactory : boost::noncopyable {
static Server * CreateServer(std::string& ip_address, int ip_port, int threads) {
SimpleLogger().Write() <<
"http 1.1 compression handled by zlib version " << zlibVersion();
std::stringstream port_stream;
port_stream << ip_port;
return new Server( ip_address, port_stream.str(), std::min( omp_get_num_procs(), threads) );
}
};
#endif /* SERVERFACTORY_H_ */

Some files were not shown because too many files have changed in this diff Show More