Compare commits

..

3363 Commits

Author SHA1 Message Date
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
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
Dennis Luxen 992458ae4b fix indentation 2013-11-21 00:06:00 +01:00
Dennis Luxen 8c16686150 remove dead code 2013-11-21 00:05:37 +01:00
Dennis Luxen 7cbadfbd12 remove dead code 2013-11-21 00:05:28 +01:00
Dennis Luxen 0e43697ee0 fixes issue #804 2013-11-20 18:24:06 +01:00
DennisOSRM 7de27df309 fix linking on Ubuntu 13.10 2013-11-20 16:22:39 +01:00
DennisOSRM b06db1ba39 Merge branch 'dep-liblua' of https://github.com/NochEinDirk/Project-OSRM-contribute into NochEinDirk-dep-liblua 2013-11-20 10:56:47 +01:00
Dennis Luxen 5fe24cb689 report a warning if shared memory segment cannot be locked into RAM 2013-11-19 10:38:59 +01:00
Dennis Luxen 733d1384a4 fixes #803 2013-11-19 10:18:59 +01:00
Dennis Luxen 99e9d0d023 ignore impassable ways, requested by HOT 2013-11-18 16:54:52 +01:00
Dennis Luxen 2bd1e46ab9 Remove left-over merge hunk 2013-11-18 11:54:39 +01:00
Dennis Luxen cabaad4b17 replaced contigouos output data with collection of small'ish sub blocks. saves (re-)allocations. also removed a remaining stringstream 2013-11-14 17:16:26 -05:00
Dennis Luxen 8b6fe691ed add missing files 2013-11-14 12:44:36 -05:00
Dennis Luxen ccf9efdaa5 rename file, untangle more includes 2013-11-14 12:42:57 -05:00
Dennis Luxen bf66bec4c7 rename file, untangle more includes 2013-11-14 12:42:50 -05:00
Dennis Luxen 3319709526 rename file, untangle more includes 2013-11-14 12:42:33 -05:00
Dennis Luxen 7ceab5c88c lock data into RAM on Linux 2013-11-14 12:33:09 -05:00
Dennis Luxen 94d4789e68 pull include from correct position 2013-11-14 12:31:51 -05:00
Dennis Luxen b13985d550 remove old files 2013-11-14 12:31:20 -05:00
Dennis Luxen dc4a3e9b89 untangle server and http components 2013-11-14 12:29:56 -05:00
Dennis Luxen d538c35532 moving and splitting of http protocal data types 2013-11-14 12:28:28 -05:00
Dennis Luxen cfd26321b5 lock shared memory into RAM by default on Linux 2013-11-14 10:03:56 -05:00
Dennis Luxen 61d955f3de move Reply into compile unit 2013-11-13 18:42:57 -05:00
Dennis Luxen a9f54c44e9 move Reply into compile unit 2013-11-13 18:42:42 -05:00
Dennis Luxen 125877035f move polyline generalizer into compile unit 2013-11-13 17:48:58 -05:00
Dennis Luxen 8f4b0c8078 de-templetize polyline generalizer 2013-11-13 17:33:19 -05:00
Dennis Luxen 1863e85bf5 move polyline compressor into compile unit 2013-11-13 17:32:44 -05:00
Dennis Luxen 488c6099fc remove test suite from travis 2013-11-13 16:48:15 -05:00
Dennis Luxen 67abc6d2cf removing dead legacy code 2013-11-13 16:11:31 -05:00
Dennis Luxen c56a57c0ba refactor legacy code 2013-11-13 15:52:01 -05:00
Dennis Luxen 30b2c1ad61 refactor input restrictions class 2013-11-13 15:23:44 -05:00
Dennis Luxen 5e279363e4 sort data externally with 4GB of RAM 2013-11-13 11:09:20 -05:00
Dennis Luxen abb7509f03 link against libc++ on OS X Mavericks by default 2013-11-13 11:08:27 -05:00
Dennis Luxen 1cd60c05f3 renaming a couple of variables to be more obvious 2013-11-12 19:02:26 -05:00
Dennis Luxen 510cc22484 Refactor name of legacy class _Node into more telling name ExternalMemoryNode 2013-11-12 18:23:09 -05:00
Dennis Luxen 3da664236c reverting premature revert 2013-11-12 17:39:24 -05:00
Dennis Luxen 7e35a7fe0c remove deprecated stxxl calls to be ready for the 1.4.0 release 2013-11-12 17:33:03 -05:00
Dennis Luxen 58ef7db5d6 allow 64 bit sizes for shared memory regions 2013-11-12 15:01:40 -05:00
Dennis Luxen f9de4a394c minor code shrink 2013-11-11 15:50:33 -05:00
Dennis Luxen dced5816df RVO optimization of output buffer generation 2013-11-11 15:17:52 -05:00
Dennis Luxen 690ac740d2 support ANSI colors in logging class 2013-11-11 13:19:38 -05:00
Dennis Luxen 89d0412e22 fix include order 2013-11-08 10:08:27 -05:00
Dennis Luxen a305752faf access unordered map through iterators only 2013-11-08 09:47:32 -05:00
Dirk L 469b139e89 .travis.yml: Inconsistency between Master and Develop branch?! 2013-11-08 15:33:12 +01:00
Dirk L 8f5d9c4816 Merge branch 'develop' into dep-liblua 2013-11-08 15:20:56 +01:00
Dirk L 7102c77e0b Merge branch 'master' into dep-liblua 2013-11-08 15:10:53 +01:00
Dennis Luxen 115ae21f1f implements #733 2013-11-08 08:56:03 -05:00
Dennis Luxen 8d3fdf45b9 implements #781 2013-11-06 17:13:09 -05:00
Dennis Luxen 1e7e5ea57c Merge pull request #779 from springmeyer/better-file-not-found-error
Better file not found error
2013-11-05 03:03:23 -08:00
Dane Springmeyer 7c8b91456f match exact error from develop branch ~3 months ago 2013-11-04 17:06:02 -08:00
Dane Springmeyer dc960f30f5 if a file cannot be found print that preamble instead of just the filename 2013-11-04 16:56:41 -08:00
Dane Springmeyer ba12e31280 osx build: only set -std=c++11 flag for >= 10.9 2013-11-04 14:37:25 -08:00
Dennis Luxen 027a4081a2 fix loading of ini files 2013-11-01 15:24:13 +01:00
Dennis Luxen 190def17e5 fix coverity issue 1121924, Resource leak 2013-10-31 14:05:06 +01:00
Dennis Luxen 9730526d33 fix coverity issue 1121925, Uncaught exception 2013-10-31 13:21:52 +01:00
Dennis Luxen c87c843308 fix coverity issue 1121926, Uninitialized pointer field 2013-10-31 13:16:46 +01:00
Dennis Luxen 6453cdf0d6 replace all casserts with Boost.Assert 2013-10-30 18:52:23 +01:00
Dennis Luxen 5f80c33b24 lock update when queries are still running 2013-10-30 17:05:49 +01:00
Dennis Luxen a33542c9b5 link libosrm against librt on linux/gcc 2013-10-30 16:35:23 +01:00
Dennis Luxen 3a1d98648f link tool against librt on linux/gcc 2013-10-30 16:33:16 +01:00
Dennis Luxen 4ec79d61d0 Merge branch 'shared_memory' into develop 2013-10-30 15:10:07 +01:00
Dennis Luxen b4f055f80c fix check for shared or internal memory 2013-10-30 14:17:32 +01:00
Dennis Luxen 6bf35c679f add timestamp to management data structure 2013-10-30 14:15:55 +01:00
Dennis Luxen 3349d43c00 output build ID to tools 2013-10-30 13:04:22 +01:00
Dennis Luxen ced961d24c delete renamed file 2013-10-30 13:03:38 +01:00
Dennis Luxen 419f708d87 build unlock tool and link against git descriptor 2013-10-30 13:01:49 +01:00
Dennis Luxen bbc1c04042 rename tool 2013-10-30 11:52:40 +01:00
Dennis Luxen 7a6865637d release all locks 2013-10-30 11:51:20 +01:00
Dennis Luxen ae96420925 output file paths only if internal memory is used 2013-10-30 11:47:48 +01:00
Dennis Luxen 2822812d0d dont require local file parameter for shared memory input 2013-10-30 11:45:06 +01:00
Dennis Luxen c8ab430491 less verbose output 2013-10-30 11:42:05 +01:00
Dennis Luxen bb87f28e80 remove debug output 2013-10-30 11:41:06 +01:00
Dennis Luxen 6db671215a warn if shared memory segment could not be allocated properly 2013-10-29 18:52:13 +01:00
Dennis Luxen 64566ec6cf fix pesky resource leak that took me two f*#+ing days to figure out. No thanks to you, valgrind 2013-10-29 18:45:01 +01:00
Dennis Luxen faaf97ef62 return if removal of shmem segment was successful 2013-10-29 18:43:11 +01:00
Dennis Luxen 67d6efed21 make release build less verbose 2013-10-28 15:17:03 +01:00
Dennis Luxen 571d9bd610 print info on shared data only on reload 2013-10-28 15:11:53 +01:00
Dennis Luxen 4144698540 make data store less verbose in release mode 2013-10-28 14:56:25 +01:00
Dennis Luxen 9bf6bf2c78 link against on linux/gcc 2013-10-28 14:51:20 +01:00
Dennis Luxen cc9236b8db move lock outside of try/catch 2013-10-28 14:39:55 +01:00
Dennis Luxen 0103b59e61 close previously allocated filestream 2013-10-28 14:21:31 +01:00
Dennis Luxen e9f6531db7 remove comma at end of enum 2013-10-28 10:54:15 +01:00
Dennis Luxen 62c2c750ea load correct segment, remove some debug output 2013-10-25 22:26:27 +02:00
Dennis Luxen 3e5e3175e0 check for new data with every query 2013-10-25 19:32:06 +02:00
Dennis Luxen 54c5af30d9 refetch data if changed 2013-10-25 19:31:39 +02:00
Dennis Luxen ca4a3361c0 load data into other data store 2013-10-25 19:31:21 +02:00
Dennis Luxen 47d302221d add ram index file name to layout, rename data types 2013-10-25 17:45:03 +02:00
Dennis Luxen ed215657e6 remove deprecatedd swap method 2013-10-25 17:43:01 +02:00
Dennis Luxen 3e63b14192 add ability to _not_ destroy prev allocated memory 2013-10-25 14:00:34 +02:00
Dennis Luxen 86433ab3a8 fix indentation 2013-10-25 11:19:02 +02:00
Dennis Luxen 7214800d93 add marker where current shared data resides 2013-10-25 11:16:18 +02:00
Dennis Luxen 29f298fa4a load into seperate area, mark swap as todo 2013-10-23 20:06:00 +02:00
Dennis Luxen ef35bc77cb add simple lock barrier tool to block the flow of queries 2013-10-23 13:31:05 +02:00
Dennis Luxen 6ae880f61e finished locking implementation in queries. YAY\! 2013-10-23 13:22:59 +02:00
Dennis Luxen 0d1149310c implement shared lock in query 2013-10-22 19:06:47 +02:00
Dennis Luxen 51d32bb8d3 set todo marker 2013-10-22 19:06:23 +02:00
Dennis Luxen 49a8980dea use named mtx's and condition for interprocess communication 2013-10-22 13:26:39 +02:00
Dennis Luxen 9fe1680c56 remove superflous include 2013-10-21 19:08:23 +02:00
Dennis Luxen b7db65a023 rename condidition variable and add mutex for pending update 2013-10-21 19:07:49 +02:00
Dennis Luxen 4c02002265 iron out skeleton for implementation of shared sync 2013-10-21 19:06:58 +02:00
Dennis Luxen d0198649f2 use doubles in mercartor projection functions 2013-10-21 17:13:02 +02:00
Dennis Luxen 32c1fd082d fix build for tools 2013-10-21 12:01:19 +02:00
Dennis Luxen 363bf42b95 reinstate previous regex 2013-10-21 12:00:52 +02:00
Dennis Luxen a1ab2232f3 use iterator based regex replace 2013-10-21 11:46:17 +02:00
Dennis Luxen cf69f43166 add proper licence header to newly added files 2013-10-21 11:45:16 +02:00
Dennis Luxen 9833438733 add better comment 2013-10-18 21:58:07 +02:00
Emil Tin 67c5e3966a fix some indentation and spelling 2013-10-18 18:33:56 +02:00
Emil Tin aa0927911d example showing use of PostGIS data 2013-10-18 18:24:13 +02:00
Emil Tin 13c9e1ed58 allowing read-only access to osm way/node id from lua 2013-10-18 12:31:08 +02:00
Dennis Luxen 19a457ab7d implement update barrier 2013-10-17 18:11:53 +02:00
Dennis Luxen 0926bff0cc fix issue #761 2013-10-16 17:38:09 +02:00
Dennis Luxen 53a0bc963a indicate the type of memory to the user 2013-10-16 13:40:40 +02:00
Dennis Luxen a2819d822a load data from server.ini only iff no parameters are give 2013-10-16 13:27:44 +02:00
Dennis Luxen 175112d97d fix status messages during configure 2013-10-16 11:58:29 +02:00
Dennis Luxen dced47024f replace FLT_EPSILON with proper C++ variant 2013-10-15 18:42:25 +02:00
Dennis Luxen ffc361406e move git descriptor into a static library that is linked against all tools 2013-10-15 18:28:14 +02:00
Dennis Luxen 852c648235 use program options in data store tool 2013-10-15 18:24:49 +02:00
Dennis Luxen 1197b96c49 add shared memory option to command line parameters 2013-10-15 17:06:45 +02:00
Dennis Luxen f21fe81e16 remove superflous include guard 2013-10-15 17:06:22 +02:00
Dennis Luxen 593dfd0108 Merging and rebasing of develop into shared_memory
Conflicts:
	DataStructures/SearchEngine.h
	DataStructures/StaticRTree.h
	Descriptors/DescriptionFactory.cpp
	Library/OSRM.cpp
	Library/OSRM.h
	RoutingAlgorithms/BasicRoutingInterface.h
	RoutingAlgorithms/ShortestPathRouting.h
	Server/DataStructures/BaseDataFacade.h
	Server/DataStructures/InternalDataFacade.h
	Server/DataStructures/QueryObjectsStorage.cpp
	Server/DataStructures/SharedDataFacade.h
	routed.cpp
2013-10-15 17:04:53 +02:00
Dennis Luxen aaf0fb9d12 Rework facades to accept ServerPaths object as configuration 2013-10-15 15:44:40 +02:00
Dennis Luxen 02e9f8aef3 Rework facades to accept ServerPaths object as configuration 2013-10-15 15:44:35 +02:00
Dennis Luxen 424055c04e fix iterator concept implementation 2013-10-15 14:35:36 +02:00
Dennis Luxen 02daf17326 fix iterator concept implementation 2013-10-15 14:35:36 +02:00
Dennis Luxen a666f0d52e change EdgeBasedNode namespace 2013-10-15 14:35:36 +02:00
DennisOSRM 27a760c58c Move edge-based node out ouf surrounding class 2013-10-15 14:35:36 +02:00
Dennis Luxen 0ba12f48c6 state type of template class member function explicitly 2013-10-15 14:35:35 +02:00
Dennis Luxen eaaf54d886 make C++11 default on OS X 2013-10-15 14:35:35 +02:00
Dennis Luxen 4b3d634fe9 always compile with C++11 on OS X (Linux to follow) 2013-10-15 14:35:35 +02:00
Dennis Luxen f77a699ea4 remove problematic luabind code 2013-10-15 14:35:35 +02:00
Dennis Luxen e989e38cc2 further compile fixes for clang 3.3 (OS X 10.9) 2013-10-15 14:35:35 +02:00
Dennis Luxen 6a900ed6e7 remove unneeded member 2013-10-15 14:35:35 +02:00
Dennis Luxen 29e6b85f79 Add explicit shmem id for data loading 2013-10-15 14:35:34 +02:00
Dennis Luxen 2641408d53 fail gracefully when lock file is not present 2013-10-15 14:35:34 +02:00
Dennis Luxen 5b79226183 add static function to remove shared memory 2013-10-15 14:35:34 +02:00
Dennis Luxen 98f9f0cd48 make shmem swappable by ref and ptr 2013-10-15 14:35:34 +02:00
Dennis Luxen cf7e107ad1 check if shmem segment exists 2013-10-15 14:35:34 +02:00
Dennis Luxen ab66c1aa1b mild refactoring of debug outputs 2013-10-15 14:35:34 +02:00
Dennis Luxen 5b03366909 checking if data files actually exist 2013-10-15 14:35:34 +02:00
Dennis Luxen 7824e1446a removing completed todo markers 2013-10-15 14:35:34 +02:00
Dennis Luxen 59cf1a4937 deciding which memory subsystem to use depending on server.ini 2013-10-15 14:35:33 +02:00
Dennis Luxen 252113c838 implementing the fetch of name ids in shared memory 2013-10-15 14:32:45 +02:00
Dennis Luxen e2f84d1acd commenting unneeded variables 2013-10-15 14:32:45 +02:00
Dennis Luxen 204dcecb28 fixing typo in build configuration 2013-10-15 14:32:44 +02:00
Dennis Luxen 70bbfbea12 fixing include typo 2013-10-15 14:32:44 +02:00
Dennis Luxen 2221a0a908 removing extra ; 2013-10-15 14:32:44 +02:00
Dennis Luxen 203b215093 loading correct file with rtree leafs and not inner nodes 2013-10-15 14:32:44 +02:00
Dennis Luxen 76ee84dae8 printing debug output 2013-10-15 14:32:44 +02:00
Dennis Luxen 79e1c87a01 swapping correct vectors 2013-10-15 14:32:44 +02:00
Dennis Luxen ed208114be properly loading all data into shared memory 2013-10-15 14:32:44 +02:00
Dennis Luxen 7dd711b37c use only one pointer for shared layout 2013-10-15 14:32:44 +02:00
Dennis Luxen 4852802d66 load graph into shared memory 2013-10-15 14:32:44 +02:00
Dennis Luxen c495b1faab graph format now canonical 2013-10-15 14:32:43 +02:00
Dennis Luxen eb5bd8e6ac load timestamp into shared memory 2013-10-15 14:32:43 +02:00
Dennis Luxen ff7dcf9c17 load coordinate list into shared memory 2013-10-15 14:32:43 +02:00
Dennis Luxen 2b12a16c84 load orig edge information 2013-10-15 14:32:43 +02:00
Dennis Luxen 4d00b2ebbb Renaming variables to properly reflect its content 2013-10-15 14:32:43 +02:00
Dennis Luxen 1ba5abbaef add all binaries to ignore list 2013-10-15 14:32:43 +02:00
Dennis Luxen b87a98bbda street name file is now more canonical 2013-10-15 14:32:43 +02:00
Dennis Luxen f76361a345 changing file format for coordinates to be canonical 2013-10-15 14:32:43 +02:00
Dennis Luxen f25bab9555 create lock file if it does not exist 2013-10-15 14:32:42 +02:00
Dennis Luxen ed78b8429f adding proper typedefs s.t. all used types are known 2013-10-15 14:32:42 +02:00
Dennis Luxen 94e9dd8f28 store name id of edges in shmem, too 2013-10-15 14:32:42 +02:00
Dennis Luxen 90215ca0dd move shmem stored sizes to 64 bits 2013-10-15 14:32:42 +02:00
Dennis Luxen 34eb647fcb implementing loading of data into shared memory 2013-10-15 14:32:42 +02:00
Dennis Luxen 83205290de Reordering resource aquisition 2013-10-15 14:32:42 +02:00
Dennis Luxen 02fd528c32 removing debug output 2013-10-15 14:32:42 +02:00
Dennis Luxen e05193f46d osrm-datastore handles manangement of shared memory 2013-10-15 14:32:42 +02:00
Dennis Luxen 14e2d900b5 All tests are passing for internal memory\! 2013-10-15 14:32:41 +02:00
Dennis Luxen ba4290340d removing debug output and calling it a day 2013-10-15 14:32:41 +02:00
Dennis Luxen 5a04700bae create sentinel to adjancency array during preprocessing 2013-10-15 14:32:41 +02:00
Dennis Luxen 999f50dce9 inverting assertion 2013-10-15 14:32:41 +02:00
Dennis Luxen 9522e6e714 properly check for (non-)empty vectors 2013-10-15 14:32:41 +02:00
Dennis Luxen 7836ea4479 implement GetName() for shared memory (copy&paste) 2013-10-15 14:32:40 +02:00
Dennis Luxen 37e8ab8de1 implement operator()+ for shared memory iterator 2013-10-15 14:32:40 +02:00
Dennis Luxen 34048497e7 implement GetName for internal memory 2013-10-15 14:32:40 +02:00
Dennis Luxen 5197422482 fetch ptr from shared memory to via node list 2013-10-15 14:32:40 +02:00
Dennis Luxen d9987c2734 load street names into internal memory 2013-10-15 14:32:40 +02:00
Dennis Luxen c9671b4712 load via node information from shared memory 2013-10-15 14:32:40 +02:00
Dennis Luxen bbf03e3060 Load r-tree search data structure from shared memory 2013-10-15 14:32:40 +02:00
Dennis Luxen e35a78e3cf some further refactoring of variable names and code formatting 2013-10-15 14:32:40 +02:00
Dennis Luxen e318be6a88 call function in parent class 2013-10-15 14:32:40 +02:00
Dennis Luxen 1dab0ebc25 moving common code to parent class 2013-10-15 14:32:40 +02:00
Dennis Luxen 687e58e9d4 removing dead code 2013-10-15 14:32:39 +02:00
Dennis Luxen 993a4aa675 adding auxiliary typedef 2013-10-15 14:32:39 +02:00
Dennis Luxen c991510b0f minor simplification of code 2013-10-15 14:32:39 +02:00
Dennis Luxen c8025bf004 moving fwd decl of static members to root of include graph 2013-10-15 14:31:32 +02:00
Dennis Luxen 9f5767a80c remove superflous includes 2013-10-15 14:31:32 +02:00
Dennis Luxen ffb05d6271 demangling includes 2013-10-15 14:31:32 +02:00
Dennis Luxen 2dd2d3dd7b adjust facade to pass compilation 2013-10-15 14:31:32 +02:00
Dennis Luxen be29c7fca0 call facade where appropriate 2013-10-15 14:31:32 +02:00
Dennis Luxen 2c23a3c0b3 link against proper objects 2013-10-15 14:31:31 +02:00
Dennis Luxen 37e3ead8e9 use flexible shared mem interfaces 2013-10-15 14:31:31 +02:00
Dennis Luxen b018ea7b1b Give all data types in shared memory 2013-10-15 14:31:31 +02:00
Dennis Luxen d6cdca35d4 Use typedef instead of base class 2013-10-15 14:31:31 +02:00
Dennis Luxen a09d150b47 Further stl interface implementation 2013-10-15 14:31:31 +02:00
Dennis Luxen 7cf46afc48 Remove old facade from UUID generation 2013-10-15 14:31:31 +02:00
Dennis Luxen 056c95670f Added list of all data types in shared memory 2013-10-15 14:31:31 +02:00
Dennis Luxen 35dffe43d9 further implementation of the vector interface for shared memory 2013-10-15 14:31:30 +02:00
Dennis Luxen 19c26f0733 removing old data facade, good riddance 2013-10-15 14:31:30 +02:00
Dennis Luxen 388ff10ff5 const'ing new function 2013-10-15 14:31:04 +02:00
Dennis Luxen 8c7be8e45f moving common code into function 2013-10-15 14:31:04 +02:00
Dennis Luxen 579aa67cde further minor refactoring 2013-10-15 14:31:04 +02:00
Dennis Luxen 725f86a0d2 replace cassert by boost asserts 2013-10-15 14:26:27 +02:00
Dennis Luxen 50a6ef18d2 Refactoring shortest path search variable names 2013-10-15 14:24:53 +02:00
Dennis Luxen 1b3e924450 added auxiliary Empty() function 2013-10-15 14:19:54 +02:00
DennisOSRM a33e08e299 superflous typedef changed meaning of name for GCC 2013-10-15 14:19:53 +02:00
DennisOSRM 45dee5a666 Styleguide refactoring 2013-10-15 14:19:53 +02:00
DennisOSRM 642473244e fixing include typos 2013-10-15 14:19:53 +02:00
Dennis Luxen e92f344335 Workarounds for various boost versions and their lovely quirks 2013-10-15 14:19:53 +02:00
Dennis Luxen 7951795ea4 Implementation of internal data storage 2013-10-15 14:19:53 +02:00
Dennis Luxen 101fbcca90 further refactoring of variable names 2013-10-15 14:19:53 +02:00
Dennis Luxen d562132a4a further refactoring of variable names 2013-10-15 14:19:53 +02:00
Dennis Luxen 7152ab39ff further refactoring of variable names 2013-10-15 14:19:52 +02:00
Dennis Luxen 39c5279f5d further refactoring of variable names 2013-10-15 14:19:52 +02:00
Dennis Luxen fef0e16f9c replacing cassert by boost asserts 2013-10-15 14:19:52 +02:00
Dennis Luxen fb1361b00d Reworking data access to go always through facades 2013-10-15 14:19:52 +02:00
Dennis Luxen 64c75c8b57 Refactoring base descriptor class 2013-10-15 14:19:52 +02:00
Dennis Luxen f4e015a255 renamed utility class 2013-10-15 14:19:52 +02:00
Dennis Luxen 242b68c488 initial refactoring of variable names 2013-10-15 14:19:52 +02:00
Dennis Luxen 9452c7e0c7 further implementation of data facades 2013-10-15 14:19:52 +02:00
Dennis Luxen ab1d3d1ced Properly instantiate plugins 2013-10-15 14:17:44 +02:00
Dennis Luxen 41df92bb93 Use new data facade in all descriptors 2013-10-15 14:17:44 +02:00
Dennis Luxen 427db3f29a Don't build deleted classes 2013-10-15 14:14:54 +02:00
Dennis Luxen b5600bdd7f Rewiring routing algorithms 2013-10-15 14:14:54 +02:00
Dennis Luxen a2153b668a Rewiring query plugins 2013-10-15 14:14:54 +02:00
Dennis Luxen 7d52c82c3b Moving DataStructures to new data facade pattern 2013-10-15 14:14:54 +02:00
Dennis Luxen 092f1a4959 corrected include fence 2013-10-15 14:14:11 +02:00
Dennis Luxen 21bee7e40c Further includes in Facades 2013-10-15 14:14:10 +02:00
Dennis Luxen a9ac0ac725 Mockups for data facades 2013-10-15 14:12:30 +02:00
Dennis Luxen 5dc1ed6696 plugging in base facade ptr 2013-10-15 14:09:40 +02:00
Dennis Luxen b55f66e69c added graph data access 2013-10-15 14:08:49 +02:00
Dennis Luxen ab637e22b1 instantiate different inherited class at bcp that provides all data 2013-10-15 14:06:48 +02:00
Dennis Luxen fa665c5494 Facade base class to provide all data access 2013-10-15 14:05:42 +02:00
Dennis Luxen e91b75a1bb use empty() instead of comparisons 2013-10-15 14:04:12 +02:00
Dennis Luxen 4c6f85fd25 Further includes in Facades 2013-10-15 14:04:12 +02:00
Dennis Luxen f09e9b7790 make plugins templates that plug into data facade 2013-10-15 14:04:12 +02:00
Dennis Luxen b51d3da7e5 Mockups for data facades 2013-10-15 14:04:11 +02:00
Dennis Luxen 861dbd5977 plugging in base facade ptr 2013-10-15 14:02:31 +02:00
Dennis Luxen 5001fcdd53 added graph data access 2013-10-15 14:02:31 +02:00
Dennis Luxen eeb47dc724 remove unneeded white spaces 2013-10-15 14:02:31 +02:00
Dennis Luxen 5556dff11e instantiate different inherited class at bcp that provides all data 2013-10-15 14:00:50 +02:00
Dennis Luxen 18b57fa6aa Facade base class to provide all data access 2013-10-15 13:45:45 +02:00
Dennis Luxen 12bb4d75fd Adding shared memory data types 2013-10-15 13:45:45 +02:00
Dennis Luxen 411d8d4d98 fix iterator concept implementation 2013-10-15 12:00:20 +02:00
Dennis Luxen 748df0b21a fix iterator concept implementation 2013-10-15 11:56:27 +02:00
Dennis Luxen 8d98316a89 change EdgeBasedNode namespace 2013-10-15 11:52:41 +02:00
Dennis Luxen c6b45a8e09 .. 2013-10-14 17:22:10 +02:00
Dennis Luxen d42920674a compile with -std=c++11 on os x 10.9 2013-10-14 17:21:40 +02:00
Dennis Luxen c66fced161 rename createhierarchy.cpp to more canonical name 2013-10-14 17:03:46 +02:00
Dennis Luxen d3dee115ab Merging changes from develop branch to prepare for v.0.3.6 branch
Conflicts:
	README.TXT
2013-10-14 13:54:36 +02:00
Dennis Luxen 77aa965533 ../AUTHORS.TXT 2013-10-14 13:47:06 +02:00
Dennis Luxen 29499f21c5 License change to (simplified) 2-clause BSD. Good riddance, AGPL 2013-10-14 13:42:28 +02:00
DennisOSRM 18d8968ae7 add C include for NULL 2013-10-13 17:55:50 +02:00
DennisOSRM 467cf73635 load timestamp properly 2013-10-13 14:26:42 +02:00
DennisOSRM 457519eae3 Fixes resource leaks and removes deprecated c_str() calls where possible 2013-10-13 14:13:08 +02:00
DennisOSRM 2a1c24763d fix path typo 2013-10-12 15:21:36 +02:00
DennisOSRM 92196dc207 pull config from program options 2013-10-12 15:20:58 +02:00
DennisOSRM f73723f9af link simple client against git descriptor 2013-10-12 15:20:32 +02:00
DennisOSRM 26ab8755b6 move program options for routed/simpleclient into common header 2013-10-12 15:19:59 +02:00
DennisOSRM d91382208d ignore server.ini 2013-10-12 15:18:51 +02:00
Emil Tin 5f90ed8b3e support capitalized option names in extract/prepare 2013-10-12 09:59:42 +02:00
Emil Tin 644fad8355 allow old capitalized option names in routed, few other adjustments 2013-10-12 09:59:42 +02:00
Emil Tin c4904cc365 test nearest/locate with high lat/lon, fix fuzzy match of negative numbers 2013-10-12 09:59:42 +02:00
Emil Tin 613e38d7f8 use boost program_options in osrm-prepare/routed 2013-10-12 09:59:42 +02:00
DennisOSRM dee7c339b3 Move edge-based node out ouf surrounding class 2013-10-11 16:14:59 +02:00
DennisOSRM b80cda66a9 fixes issue #755 2013-10-11 14:58:19 +02:00
DennisOSRM 411bcbcbde remove debug output 2013-10-11 14:55:34 +02:00
Dennis Luxen 352bf8839b state type of template class member function explicitly 2013-10-10 17:25:02 +02:00
Dennis Luxen 18f438a528 make C++11 default on OS X 2013-10-10 15:34:10 +02:00
Dennis Luxen 076944da5d always compile with C++11 on OS X (Linux to follow) 2013-10-10 14:32:10 +02:00
Dennis Luxen acbba95032 remove problematic luabind code 2013-10-10 14:31:28 +02:00
Dennis Luxen 75f77783ff further compile fixes for clang 3.3 (OS X 10.9) 2013-10-09 18:58:37 +02:00
Dennis Luxen 87e0f074e8 remove unneeded member 2013-10-09 17:34:48 +02:00
Dennis Luxen 2211c69455 Add explicit shmem id for data loading 2013-10-08 18:10:31 +02:00
Dennis Luxen a7449c913c fail gracefully when lock file is not present 2013-10-08 16:25:02 +02:00
Dennis Luxen aaec0e641b add static function to remove shared memory 2013-10-08 15:47:43 +02:00
Dennis Luxen 5afed2d396 make shmem swappable by ref and ptr 2013-10-08 15:26:19 +02:00
Dennis Luxen 843348338a check if shmem segment exists 2013-10-08 14:40:49 +02:00
Dennis Luxen 061ebc7942 fixing #412, wrong offsets cause supoptimal routes with via points 2013-10-04 17:10:40 +02:00
Dennis Luxen 822c1c97e3 fixing #412, wrong offsets cause supoptimal routes with via points 2013-10-04 16:47:59 +02:00
Emil Tin 65df6aa4a0 failing test showing weird loop, issue 412 2013-10-04 13:32:05 +02:00
Emil Tin 32719690ac update ruby gems used for cucumber testing 2013-10-02 20:10:13 +02:00
Emil Tin f83748fdc2 change test file to cuke table 2013-10-02 20:10:01 +02:00
Emil Tin a354d7c00b use testbot for testing for weird loops 2013-10-02 19:28:41 +02:00
Dennis Luxen 41f7312263 Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2013-10-02 14:40:34 +02:00
Dennis Luxen d3804d2c2c replacing hard coded values by literal 2013-10-02 14:39:52 +02:00
Emil Tin 96184b83a3 minor whitespace cleanup 2013-10-02 13:53:09 +02:00
Emil Tin 9bcc057176 mark projection tests as todo 2013-10-02 13:48:49 +02:00
Emil Tin 20f3213477 test projection onto ways at high lat 2013-10-02 13:43:33 +02:00
Dennis Luxen bf8505a285 removing all FLT_EPSILONs 2013-10-02 13:05:54 +02:00
Dennis Luxen 770a07cc28 replacing all occurrences of DBL_MAX 2013-10-02 12:00:25 +02:00
Dennis Luxen 3f80f52ca5 refactoring some variable names 2013-10-02 11:57:34 +02:00
Dennis Luxen 52f6e149ec removing debug output 2013-10-02 11:40:05 +02:00
Dennis Luxen 6893df9103 replacing c-style numeric limits with proper C++ style 2013-10-02 11:38:09 +02:00
Dennis Luxen 60546c9788 adding data to check egressions of #726 2013-10-02 11:26:26 +02:00
Dennis Luxen 12f91564fb adding test to check regressions of #726 2013-10-02 11:25:51 +02:00
Dennis Luxen ca448e682a using wider margin for expected result 2013-10-02 11:23:13 +02:00
Dennis Luxen 2b077d140f Fixing #726, rounding woes and machine epsilon 2013-10-02 11:22:42 +02:00
Dennis Luxen 0f58ff8356 mild refactoring of debug outputs 2013-10-01 18:01:19 +02:00
Dennis Luxen 940b740b24 checking if data files actually exist 2013-10-01 17:37:52 +02:00
Dennis Luxen 0f258f94a8 removing completed todo markers 2013-10-01 16:53:15 +02:00
Dennis Luxen fd7b22f639 deciding which memory subsystem to use depending on server.ini 2013-10-01 16:48:40 +02:00
Dennis Luxen ca3464512d implementing the fetch of name ids in shared memory 2013-10-01 13:25:11 +02:00
Dennis Luxen f59cb6417f commenting unneeded variables 2013-10-01 13:24:25 +02:00
Dennis Luxen 74ccb53607 Merge branch 'shared_memory' of https://github.com/DennisOSRM/Project-OSRM into shared_memory 2013-09-30 16:12:26 +02:00
Dennis Luxen e4c6e98099 fixing typo in build configuration 2013-09-30 16:12:19 +02:00
Dennis Luxen cfab0fa245 fixing include typo 2013-09-30 16:03:46 +02:00
Dennis Luxen 08d861e87c removing extra ; 2013-09-30 16:01:51 +02:00
Dennis Luxen 73234e7782 loading correct file with rtree leafs and not inner nodes 2013-09-30 15:55:29 +02:00
Dennis Luxen de8d28ea5f printing debug output 2013-09-30 15:54:32 +02:00
Dennis Luxen ed7b478ee0 swapping correct vectors 2013-09-30 15:50:26 +02:00
Dennis Luxen ff9a216990 properly loading all data into shared memory 2013-09-30 14:21:00 +02:00
Dennis Luxen 58c94159b1 use only one pointer for shared layout 2013-09-30 11:28:53 +02:00
Dennis Luxen 7a1bd4d53a load graph into shared memory 2013-09-27 17:45:23 +02:00
Dennis Luxen 5d7c23c62a graph format now canonical 2013-09-27 15:01:25 +02:00
Dennis Luxen d91d911051 load timestamp into shared memory 2013-09-27 13:53:49 +02:00
Dennis Luxen cd0cab465d load coordinate list into shared memory 2013-09-27 13:14:30 +02:00
Dennis Luxen a45b887c5b load orig edge information 2013-09-27 12:59:33 +02:00
Dennis Luxen f965b7129b Renaming variables to properly reflect its content 2013-09-27 12:00:58 +02:00
Dennis Luxen e894ce00c9 add all binaries to ignore list 2013-09-27 11:48:25 +02:00
Dennis Luxen 333aba8be6 street name file is now more canonical 2013-09-26 18:19:51 +02:00
Dennis Luxen e9d93ae210 changing file format for coordinates to be canonical 2013-09-26 11:52:15 +02:00
Dennis Luxen 043c8be747 create lock file if it does not exist 2013-09-26 11:28:51 +02:00
Dennis Luxen 1be67518df adding proper typedefs s.t. all used types are known 2013-09-25 19:06:50 +02:00
Dennis Luxen 4bf1987bb7 store name id of edges in shmem, too 2013-09-25 18:59:07 +02:00
Dennis Luxen ae45eed2b1 move shmem stored sizes to 64 bits 2013-09-25 18:58:39 +02:00
Dennis Luxen 572a9393aa implementing loading of data into shared memory 2013-09-25 18:40:08 +02:00
Dennis Luxen 7579c41a35 Reordering resource aquisition 2013-09-25 18:26:10 +02:00
Dennis Luxen 4e589c2575 removing debug output 2013-09-25 18:00:12 +02:00
Dennis Luxen 026da34ce9 osrm-datastore handles manangement of shared memory 2013-09-25 15:31:49 +02:00
Dennis Luxen 0daf49a1da All tests are passing for internal memory\! 2013-09-25 14:31:48 +02:00
Dennis Luxen f57e4c6c14 removing debug output and calling it a day 2013-09-24 18:59:44 +02:00
Dennis Luxen 14bd1d01f2 create sentinel to adjancency array during preprocessing 2013-09-24 18:48:02 +02:00
Dennis Luxen 918e20b164 inverting assertion 2013-09-24 16:45:34 +02:00
Dennis Luxen 6a0e90ef90 properly check for (non-)empty vectors 2013-09-24 16:24:27 +02:00
Dennis Luxen 71fe8ed80d implement GetName() for shared memory (copy&paste) 2013-09-24 15:12:06 +02:00
Dennis Luxen 581c9c570b implement operator()+ for shared memory iterator 2013-09-24 15:10:06 +02:00
Dennis Luxen b25fe3d127 implement GetName for internal memory 2013-09-24 14:44:25 +02:00
Dennis Luxen fc4aef6d89 fetch ptr from shared memory to via node list 2013-09-24 13:54:28 +02:00
Dennis Luxen 6b4fa6a40d load street names into internal memory 2013-09-24 13:53:38 +02:00
Dennis Luxen 6756eea209 load via node information from shared memory 2013-09-24 13:33:38 +02:00
Dennis Luxen bf3cd37b49 Load r-tree search data structure from shared memory 2013-09-24 12:07:34 +02:00
Dennis Luxen cc7caa9e16 some further refactoring of variable names and code formatting 2013-09-24 11:02:24 +02:00
Dennis Luxen 633060562f call function in parent class 2013-09-24 10:58:24 +02:00
Dennis Luxen cc48546f62 moving common code to parent class 2013-09-24 10:57:54 +02:00
Dennis Luxen 96cc44e521 Compile fixes on RHEL5/Fedora, see #541 2013-09-24 10:33:29 +02:00
Dennis Luxen f2d9e4b2df removing dead code 2013-09-24 10:16:57 +02:00
Dennis Luxen 049c7ad1f0 adding auxiliary typedef 2013-09-24 10:16:07 +02:00
Dennis Luxen 226dad651b minor simplification of code 2013-09-24 10:10:50 +02:00
Dennis Luxen 0977cabc79 moving fwd decl of static members to root of include graph 2013-09-24 09:55:02 +02:00
Dennis Luxen 0b5e8a086e remove superflous includes 2013-09-24 09:45:33 +02:00
Dennis Luxen e024ea5ee1 demangling includes 2013-09-24 09:39:12 +02:00
Dennis Luxen 6f71092aa4 adjust facade to pass compilation 2013-09-23 19:00:08 +02:00
Dennis Luxen edce44df97 call facade where appropriate 2013-09-23 18:59:43 +02:00
Dennis Luxen 54551d9f37 link against proper objects 2013-09-23 18:59:13 +02:00
Dennis Luxen 8521b5501f use flexible shared mem interfaces 2013-09-23 18:03:07 +02:00
Dennis Luxen 396dc21903 Give all data types in shared memory 2013-09-23 18:02:45 +02:00
Dennis Luxen 5e2b0ba46c Use typedef instead of base class 2013-09-23 18:02:16 +02:00
Dennis Luxen cce5d775de Further stl interface implementation 2013-09-23 18:01:30 +02:00
Dennis Luxen 248a239c7b Remove old facade from UUID generation 2013-09-23 13:42:35 +02:00
Dennis Luxen 83655e9aef Added list of all data types in shared memory 2013-09-23 13:41:53 +02:00
Dennis Luxen 973d115edf further implementation of the vector interface for shared memory 2013-09-23 13:30:21 +02:00
Dennis Luxen aaa9f89550 removing old data facade, good riddance 2013-09-23 11:35:33 +02:00
Dennis Luxen 8afad5614a const'ing new function 2013-09-22 22:29:03 +02:00
Dennis Luxen a9fdabf926 moving common code into function 2013-09-22 22:18:54 +02:00
Dennis Luxen b5b262c722 further minor refactoring 2013-09-21 22:21:33 +02:00
Dennis Luxen d1e1190cbd replace cassert by boost asserts 2013-09-21 22:18:27 +02:00
Dennis Luxen 9812eaaca7 Refactoring shortest path search variable names 2013-09-21 22:10:41 +02:00
Dennis Luxen 4520e04d37 added auxiliary Empty() function 2013-09-21 21:51:07 +02:00
DennisOSRM 5679b5862f superflous typedef changed meaning of name for GCC 2013-09-20 21:40:27 +02:00
DennisOSRM e72dc38d77 Styleguide refactoring 2013-09-20 21:07:57 +02:00
DennisOSRM 71fcfa4935 fixing include typos 2013-09-20 21:05:47 +02:00
Dennis Luxen c4463036c3 Workarounds for various boost versions and their lovely quirks 2013-09-20 19:41:45 +02:00
Dennis Luxen b343a17b29 Implementation of internal data storage 2013-09-20 18:30:47 +02:00
Dennis Luxen 0b0fb249bf further refactoring of variable names 2013-09-20 13:13:06 +02:00
Dennis Luxen 8d689974a7 further refactoring of variable names 2013-09-20 13:11:23 +02:00
Dennis Luxen 375c81d38d further refactoring of variable names 2013-09-20 13:09:33 +02:00
Dennis Luxen 0ef4f36d44 further refactoring of variable names 2013-09-20 13:08:18 +02:00
Dennis Luxen c85f6c1228 replacing cassert by boost asserts 2013-09-20 11:35:59 +02:00
Dennis Luxen 0cabc81693 Reworking data access to go always through facades 2013-09-20 11:09:07 +02:00
Dennis Luxen 12b4fff81e Refactoring base descriptor class 2013-09-19 22:28:02 +02:00
Dennis Luxen 27b6627110 renamed utility class 2013-09-19 22:10:49 +02:00
Dennis Luxen 387014dd37 initial refactoring of variable names 2013-09-19 19:07:18 +02:00
Dennis Luxen d5c91b9bda further implementation of data facades 2013-09-19 18:55:49 +02:00
Dennis Luxen 370f4f6257 Properly instantiate plugins 2013-09-19 18:55:19 +02:00
Dennis Luxen 49a665488e Use new data facade in all descriptors 2013-09-19 18:54:30 +02:00
Dennis Luxen 29da133726 Don't build deleted classes 2013-09-19 18:54:09 +02:00
Dennis Luxen 1194bb8ae3 Rewiring routing algorithms 2013-09-19 18:53:34 +02:00
Dennis Luxen 7599124aa0 Rewiring query plugins 2013-09-19 18:53:10 +02:00
Dennis Luxen 01d2d91ecc Moving DataStructures to new data facade pattern 2013-09-19 18:52:42 +02:00
Dirk L 6980d19214 Merge branch 'develop' into develop-lua 2013-09-19 15:05:30 +02:00
Dennis Luxen ac14a7b0da corrected include fence 2013-09-19 13:59:09 +02:00
Dennis Luxen 23f00ab533 Merge branch 'shared_memory' of https://github.com/DennisOSRM/Project-OSRM into shared_memory 2013-09-19 12:01:04 +02:00
Dennis Luxen 39122bd61d use empty() instead of comparisons 2013-09-19 12:00:36 +02:00
Dennis Luxen c5824765f9 Further includes in Facades 2013-09-19 12:00:36 +02:00
Dennis Luxen 547e942c66 make plugins templates that plug into data facade 2013-09-19 12:00:36 +02:00
Dennis Luxen 2ab04e7e2f Mockups for data facades 2013-09-19 12:00:36 +02:00
Dennis Luxen a08fef172e plugging in base facade ptr 2013-09-19 12:00:35 +02:00
Dennis Luxen a04f77e7e0 added graph data access 2013-09-19 12:00:35 +02:00
Dennis Luxen 4900f3e54d remove unneeded white spaces 2013-09-19 12:00:35 +02:00
Dennis Luxen 34ee6411d5 instantiate different inherited class at bcp that provides all data 2013-09-19 12:00:35 +02:00
Dennis Luxen 5abe7bc7e5 Facade base class to provide all data access 2013-09-19 12:00:35 +02:00
Dennis Luxen a48aef4039 Adding shared memory data types 2013-09-19 12:00:35 +02:00
Dennis Luxen e1198f29ce Refactoring according to new coding guidelines 2013-09-19 11:54:24 +02:00
Dennis Luxen 329e619c8c fixing coverity issue 1046674 Uninitialized pointer field 2013-09-19 10:42:28 +02:00
Dennis Luxen 9a9e1b46ef fixing coverity issue 1061045 Resource leak 2013-09-19 10:32:27 +02:00
Dennis Luxen cc94ab6411 use empty() instead of comparisons 2013-09-19 10:19:54 +02:00
Dennis Luxen e67541e82f Further includes in Facades 2013-09-18 18:33:10 +02:00
Dennis Luxen d907be264b make plugins templates that plug into data facade 2013-09-18 18:32:50 +02:00
Dennis Luxen 003c1df53e Mockups for data facades 2013-09-18 17:49:49 +02:00
Emil Tin 6470838065 cleanup indentation of ruby files 2013-09-18 08:16:19 +02:00
Emil Tin a178555838 update text in cuke test 2013-09-17 21:04:02 +02:00
Dennis Luxen f844e9e702 plugging in base facade ptr 2013-09-17 18:55:53 +02:00
Dennis Luxen 8753dbdb0f added graph data access 2013-09-17 18:45:33 +02:00
Dennis Luxen 1bd24f7042 remove unneeded white spaces 2013-09-17 18:37:52 +02:00
Dennis Luxen 66d58bf047 instantiate different inherited class at bcp that provides all data 2013-09-17 18:37:08 +02:00
Dennis Luxen 1e5c4b0d79 Facade base class to provide all data access 2013-09-17 18:35:43 +02:00
Dennis Luxen 711d402f17 Merge branch 'shared_memory' of https://github.com/DennisOSRM/Project-OSRM into shared_memory 2013-09-17 18:34:35 +02:00
Dennis Luxen e19f54a378 Adding shared memory data types 2013-09-17 15:28:08 +02:00
Dennis Luxen 5294fc4767 Fixing another coverity issue 2013-09-17 15:27:51 +02:00
Dennis Luxen 7ed3a1df04 removing dead code 2013-09-17 15:15:52 +02:00
Dennis Luxen 2d45354f50 Fixes coverity issue 1061545 Uninitialized scalar field 2013-09-17 15:06:12 +02:00
Dennis Luxen 9f6d13f4c3 Fixes coverity issue 2013-09-17 14:47:15 +02:00
Dennis Luxen 57a31d0ec9 Fixing coverity issue 2013-09-17 14:47:15 +02:00
Dennis Luxen da277d9816 Adding shared memory data types 2013-09-17 14:23:06 +02:00
Dirk L 22dabc5180 Merge branch 'develop' into develop-lua 2013-09-13 18:44:27 +02:00
Emil Tin 47f11fc3a6 bike: normal speed on paths with asphalt, add tests 2013-09-12 14:15:50 +02:00
Dirk L 91a2e56215 Merge branch 'dep-liblua' into develop-lua 2013-09-11 18:27:51 +02:00
Dirk L e6681af9d0 CMakeLists.txt: Lua5.2 support.
Because the current Debian unstable is using

  * Luabind which is depending on Lua5.2

  * LuaJIT which has a Lua5.1 API

the code were using the Lua5.1 header files but were linked against
Lua5.2 library.

Now both are using Lua5.2 (libluajit-5.1-dev must not be installed
during CMAKE !), which seems to work for the OSRM-Extractor.
2013-09-11 17:25:33 +02:00
Dennis Luxen d9e3c43c91 further adjustments to benchmark 2013-09-11 14:27:41 +02:00
Dennis Luxen f84de4ac21 Moving timing back to reliable but uugly code 2013-09-09 16:26:44 +02:00
Dennis Luxen 3089231476 split io benchmark into two parts. also fixed things on Linux 2013-09-09 16:26:07 +02:00
Emil Tin 0f94fb9d6d update foot profile, add tests for access, barriers, ferries, names, surface, more 2013-09-08 22:51:44 +02:00
Emil Tin 01097f7225 foot tests for ferries and restrictions 2013-09-07 18:19:52 +02:00
Dennis Luxen a25e4e1ed8 Fixes #737 2013-09-07 11:16:45 +02:00
Dennis Luxen 9e75595754 explicitly use boost 1.46 2013-09-05 21:43:12 +02:00
Dennis Luxen f6d5945b59 Moving to boost 1.46 on travis 2013-09-05 21:36:21 +02:00
Dennis Luxen 250eb20851 removing boost::chrono timers 2013-09-05 21:33:10 +02:00
Dennis Luxen d2b00c4995 Moving timing back to gettimeofday instead of boost::chrono 2013-09-05 21:28:45 +02:00
Dennis Luxen 89c73d89b4 Install all boost dev packages on travis 2013-09-05 20:58:33 +02:00
Dennis Luxen fcd63bf9eb Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2013-09-05 20:22:59 +02:00
Dennis Luxen 9a0cf6a609 add correct package 2013-09-05 20:22:23 +02:00
Emil Tin 6c32d97b23 organize cuke test with @todo and @bug 2013-09-05 20:00:42 +02:00
Emil Tin c9e40d3e59 cuke profiles for running @todo or @bug tests 2013-09-05 19:18:04 +02:00
Dennis Luxen dc920a7e39 Moving repeated statistics into function 2013-09-05 14:36:18 +02:00
Dennis Luxen 07262387e0 Give read/write performance, too 2013-09-05 12:32:30 +02:00
Dennis Luxen 97e2ac689e Fixed timings to collect absolute numbers and not CPU seconds 2013-09-05 12:20:17 +02:00
Dennis Luxen 286a80d03b Fixed the way statistics are collected 2013-09-05 12:19:47 +02:00
Dennis Luxen 3aaf31fdb9 add boost timer library 2013-09-05 12:19:16 +02:00
Dennis Luxen 71ae5764cc add boost timer library 2013-09-05 12:18:37 +02:00
Dennis Luxen 2e41ed153b Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2013-09-04 14:26:31 +02:00
Dennis Luxen 9ee422e6ba Output reorder, also shows median 2013-09-04 14:26:20 +02:00
Dennis Luxen 8a008d1808 new hard disk benchmark tool 2013-09-04 12:30:16 +02:00
Emil Tin d78faea737 better regex for matching origin in cuke test 2013-09-01 21:48:19 +02:00
Emil Tin 3cf72e93e6 allow setting origin in cuke tests 2013-08-31 23:35:26 +02:00
Emil Tin caa02bbca1 test bearing at high lat 2013-08-31 12:52:36 +02:00
Emil Tin 33e64aee6f update Rakefile to work with new osrm-extract options 2013-08-30 13:02:57 +02:00
Emil Tin d17150270e enable passing .osm file to cuke tests 2013-08-30 12:56:52 +02:00
Emil Tin 463a297f0c remove incorrect cuke tag 2013-08-30 12:55:17 +02:00
Emil Tin 407d73a735 removing trailing whitespace in cuke/ruby files 2013-08-29 19:39:45 +02:00
Emil Tin b5bfdb56dc cleanup indentation of cuke files 2013-08-29 19:29:13 +02:00
Emil Tin 58b7ef8431 cuke profile for running all test (including todo/bug) 2013-08-29 16:29:59 +02:00
Emil Tin 2211dfb741 test for u-turn at via point (failing) 2013-08-29 16:29:21 +02:00
Emil Tin 1d6e602473 test nearest/locate at high lat/lon, fix fuzzy match of negative numbers 2013-08-28 09:49:56 +02:00
DennisOSRM a6c52fd154 Fixes coordinate conversion issue. Thx @kkaefer 2013-08-27 14:15:23 +02:00
Emil Tin 7a5bceae4c tests for /locate 2013-08-26 22:25:43 +02:00
DennisOSRM 6f3e7f9e56 Fixes #721 2013-08-26 14:16:34 +02:00
Dennis Luxen fb9822b507 street name list is now a char array /w indices array 2013-08-20 17:05:36 +02:00
Dennis Luxen d0db09cb92 Adds Vlad's patch from issue #709 2013-08-20 13:17:19 +02:00
Dennis Luxen 189fbb3f7e Fixes coverity issue CID 1063352, use after free bug 2013-08-20 10:04:58 +02:00
Dennis Luxen 887c95fe2a Fixes five silly Conditional jump or move depends on uninitialised value(s) 2013-08-19 18:07:54 +02:00
Dennis Luxen fdbeb951eb Fixes #655 2013-08-19 17:36:15 +02:00
Dennis Luxen 9d23dee3fc Merge branch 'develop' into experimental/program_options 2013-08-19 17:03:47 +02:00
Dennis Luxen 70b8cef318 Fixes #709, out-of-source builds from arbitrary directories 2013-08-19 16:55:56 +02:00
Dennis Luxen e1620b8fa2 Refactoring StronglyConnectedComponents.h 2013-08-19 16:04:00 +02:00
Dennis Luxen dabc9589e9 fix type in car profile 2013-08-19 13:56:57 +02:00
Dennis Luxen da98900e3a fixing regression in osrm-components 2013-08-19 13:42:34 +02:00
Dennis Luxen b584ba9149 removing super-flous returns in car profile 2013-08-16 17:10:02 +02:00
Dennis Luxen d24ba6d13d Mild perfomance fixed for PBF extraction 2013-08-16 17:09:27 +02:00
Dennis Luxen aba078a9d8 Refactoring internal style of ConcurrentQueue 2013-08-16 17:09:04 +02:00
Dennis Luxen 161487d6c2 Refactoring members of NodeInformationHelpDesk 2013-08-16 14:06:04 +02:00
Dennis Luxen d851dd7196 bit packing ImportEdge members 2013-08-16 13:34:28 +02:00
Dennis Luxen cf29621aa7 Making edge factor more verbose 2013-08-16 11:08:07 +02:00
Dennis Luxen 9e46577f43 Merge branch 'develop' 2013-08-15 15:54:31 +02:00
Dennis Luxen b7980b83df removing dead comments 2013-08-15 15:51:07 +02:00
Dennis Luxen 0a0bed7ae0 Refactoring graph factory 2013-08-14 18:43:01 +02:00
Emil Tin e42b8fc37d use boost program_options in extractor 2013-08-14 15:15:35 +02:00
Dennis Luxen b01e30acfd Moving DataStructures out of Plugin directory 2013-08-14 14:09:42 +02:00
Dennis Luxen 311c50df9f Moving DataStructures out of Plugin directory 2013-08-14 13:57:57 +02:00
Dennis Luxen c2f9467f61 Moving DataStructures out of Plugin directory 2013-08-14 13:54:59 +02:00
Dennis Luxen 06c8656b9e Moving DataStructures out of Plugin directory 2013-08-14 13:41:23 +02:00
Dennis Luxen 4748bca8a4 Refactoring _Coordinate class 2013-08-14 13:12:28 +02:00
Dennis Luxen 916387748c Refactor _Restriction class 2013-08-14 11:59:46 +02:00
Dennis Luxen 216d7dcb86 Fixing typos 2013-08-14 11:59:01 +02:00
Dennis Luxen 23f2c7e6f5 move windows specific defines behind define-fence 2013-08-14 11:58:23 +02:00
Dennis Luxen c8e0e5eca2 Export compile commands 2013-08-14 11:57:54 +02:00
Dennis Luxen 3167d3f451 Export compile commands 2013-08-14 11:57:33 +02:00
Dennis Luxen beb9c1ba74 use proper check for empty string 2013-08-13 18:37:21 +02:00
Dennis Luxen dcd88260e9 Add a few braces here and there 2013-08-13 18:36:23 +02:00
Dennis Luxen 5f4f631fc5 Remove dead code 2013-08-13 18:35:54 +02:00
Dennis Luxen dc6fda03a1 move const value to left-hand side of comparison 2013-08-13 18:35:22 +02:00
Dennis Luxen 764ad81537 Some mild refactoring 2013-08-13 18:34:33 +02:00
Dennis Luxen e26c41095f Some mild refactoring 2013-08-13 18:33:20 +02:00
Dennis Luxen d7bd78d612 correct timing of durations 2013-08-13 18:21:14 +02:00
Dennis Luxen c50b4c72d7 Refactoring of Plugins 2013-08-13 18:09:20 +02:00
Dennis Luxen 124e555ed0 Disabling debug output in release build 2013-08-13 10:48:02 +02:00
Dennis Luxen aeba3aa209 fixes #695 for bike profile 2013-08-12 18:00:56 +02:00
Emil Tin e50b5202b8 updated tests for car maxspeed forw/backw 2013-08-12 17:37:51 +02:00
Dennis Luxen 32c7578629 fixes #695, maxspeed:forward incorrectly made any way routable 2013-08-12 13:19:07 +02:00
Dennis Luxen 5bc5e0e8e9 logging into wrong channel 2013-08-11 23:25:22 +02:00
Dennis Luxen 7ee4692e84 properly order includes 2013-08-11 23:01:15 +02:00
Dennis Luxen 679688705d properly order includes 2013-08-11 22:53:31 +02:00
Dennis Luxen 83f0a2c094 Applying syntactic sugar 2013-08-11 22:49:33 +02:00
Dennis Luxen 504817058b remove checks for data that is not used here, log information through SimpleLogger 2013-08-11 22:35:13 +02:00
Dennis Luxen 45754b27de remove ignored const qualifiers 2013-08-11 22:10:05 +02:00
Dennis Luxen a75ae8bbef enable output for tools 2013-08-10 14:43:49 +02:00
Dennis Luxen c3e6dc69bb implements https://github.com/DennisOSRM/Project-OSRM/commit/0765ebf7355b0c4d70ca88f0dc78452dc84ede6c#commitcomment-3828005 2013-08-09 21:33:30 +02:00
Dennis Luxen 0285bb6ea5 Implements https://github.com/DennisOSRM/Project-OSRM/commit/34735b8aad06098d09d3fb907137697799a281e4#commitcomment-3828247 2013-08-09 20:16:26 +02:00
Dennis Luxen a542292ce2 Check if files exist and contain data, fixes #693 2013-08-09 17:47:11 +02:00
Dennis Luxen 0765ebf735 Implements #692 2013-08-09 14:47:09 +02:00
Dennis Luxen e86e8c37a8 const'ing parameters 2013-08-09 13:49:30 +02:00
Dennis Luxen 149a42cc94 Fixing coverity issue 1046672 and a potential memory leak 2013-08-09 13:24:05 +02:00
Dennis Luxen 8de4613a3e Fix coverity errors 1061543 751298 2013-08-09 12:55:08 +02:00
Dennis Luxen 60950c57e3 Fix coverity error 1061544 2013-08-09 12:53:23 +02:00
Dennis Luxen 4727bb5c9b Fix coverity error 1061545 2013-08-09 12:51:21 +02:00
Dennis Luxen 1e1e254897 Pass values by const ref 2013-08-09 12:50:21 +02:00
Dennis Luxen df5455121c Output uses new logging facility 2013-08-09 12:49:49 +02:00
Dennis Luxen 0e2570b204 enable logging for deamon 2013-08-08 16:23:28 +02:00
Dennis Luxen f57519b909 adapt tool to output logs with new mechanism 2013-08-08 16:20:05 +02:00
Dennis Luxen 088393ca12 Remove superflous output of endline 2013-08-08 16:19:25 +02:00
Dennis Luxen 375dc63db3 Make output conditional 2013-08-08 15:57:16 +02:00
Dennis Luxen 503324162f Configure project for actually different build types 2013-08-08 14:58:58 +02:00
Dennis Luxen 5445b64376 Configure project for actually different build types 2013-08-08 14:58:40 +02:00
Dennis Luxen 7fe997d38c Add missing newline on EOF 2013-08-08 14:53:49 +02:00
Dennis Luxen d7673dad7b fixing release build 2013-08-08 14:39:51 +02:00
Dennis Luxen 44eed9282b Adding new SimpleLogger class 2013-08-08 14:25:57 +02:00
Dennis Luxen 0eeb94b24c Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2013-08-08 14:18:13 +02:00
Dennis Luxen ef221e1c6c Replacing log macros by more sophisticated mechanism 2013-08-08 14:17:01 +02:00
Emil Tin 75cdefa4fe show name of missing .ini file 2013-08-07 21:33:43 +02:00
Dennis Luxen a609a1c6c2 Move common code into base class 2013-08-07 14:02:10 +02:00
Dennis Luxen f4906a97b9 pass const refs instead of copy 2013-08-07 14:01:56 +02:00
Dennis Luxen 21ffd441fa Refactoring base config class into proper ini file name 2013-08-06 17:46:49 +02:00
Dennis Luxen a82383d78e Refactoring base config class into proper ini file name 2013-08-06 17:33:26 +02:00
Dennis Luxen b405029f0f Refactoring base config class into proper ini file name 2013-08-06 17:23:40 +02:00
Dennis Luxen db7d4f56b3 Fix build with updated hash table 2013-08-06 16:58:31 +02:00
Dennis Luxen 3151197471 boost timer library not needed 2013-08-06 16:50:20 +02:00
Dennis Luxen e06fe6935a refactor Hashtable 2013-08-06 16:39:04 +02:00
Dennis Luxen e7cec83a4c Use boost timer to provide platform independent timing 2013-08-06 14:28:03 +02:00
Dennis Luxen e5f0ad4f0b Use boost timer to provide platform independent timing 2013-08-06 14:27:36 +02:00
Dennis Luxen cabbe70e47 reverting premature checkin 2013-08-06 14:01:03 +02:00
Dennis Luxen b86c3681bb reverting premature checkin 2013-08-06 13:54:04 +02:00
Dennis Luxen 0f8239bc8e Fixing build of tools 2013-08-06 12:28:19 +02:00
Dennis Luxen 13f5baf608 Moving node data structure into more meaningful class name 2013-08-05 19:35:47 +02:00
Dennis Luxen 4f5d7f79bd fixing tests for enhanced coordinate preceision 2013-08-05 19:00:09 +02:00
Dennis Luxen 23899613c3 Implement #495 2013-08-05 18:37:42 +02:00
Dennis Luxen db46a915cc simple wrapper around std::exception 2013-08-05 17:37:30 +02:00
Dennis Luxen b591aa013d Remove dead code 2013-08-05 17:35:16 +02:00
Dennis Luxen c0db8b71dd Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2013-08-05 17:30:17 +02:00
Dennis Luxen 444bf41fa4 use exceptions instead of hard abort 2013-08-05 17:29:34 +02:00
Dennis Luxen 54302a53e1 use exceptions instead of hard abort 2013-08-05 17:28:57 +02:00
Emil Tin 63059cfab3 make cuke tests work with ruby 2.x 2013-08-02 09:35:28 +02:00
Dennis Luxen ec7d3a9885 Fixing boost filesystem to work on old installations, too 2013-08-01 15:56:18 +02:00
Dennis Luxen 960b55fd6c accidentially called deprecated boost filesystem function 2013-07-31 22:55:20 +02:00
Dennis Luxen 3067ba60ae convert relative path in server.ini to absolute paths 2013-07-31 22:05:44 +02:00
Dennis Luxen c9a756eddc Updateing Readme to give proper reference (again) 2013-07-31 13:12:25 +02:00
Dennis Luxen d4ea5fc74f Updateing Readme to give proper reference 2013-07-31 13:09:25 +02:00
Dennis Luxen 92e52f1a5d Updateing Readme to display build status 2013-07-31 13:04:04 +02:00
Dennis Luxen ef1d75db83 Add proper support for travis CI
Conflicts:
	.travis.yml
2013-07-31 11:38:03 +02:00
Dennis Luxen f03d1a5d27 check release and debug builds in travis 2013-07-31 11:33:23 +02:00
Dennis Luxen 8a55b706ca testing with cucumber 2013-07-31 11:22:02 +02:00
Dennis Luxen 357133677a Add project to travis CI 2013-07-31 11:17:08 +02:00
Dennis Luxen 1b6c660a8f Merge pull request #689 from svenluzar/feature/roundabout4bikes
pull request moved to develop branch: roundabout handling from car profile moved to bike profile
2013-07-31 02:13:38 -07:00
Dennis Luxen 111e68831e Merge branch 'feature/roundabout4bikes' of https://github.com/svenluzar/Project-OSRM 2013-07-31 11:11:10 +02:00
Dennis Luxen d9f6732ce2 Add Travis CI build support 2013-07-31 11:10:49 +02:00
Sven Luzar f2b81ba86c pull request moved to develop branch: roundabout handling from car profile moved to bike profile 2013-07-30 21:37:57 +02:00
Emil Tin 2542112301 fix cuke test for roundabout/cars 2013-07-30 18:00:44 +02:00
Emil Tin a45215ddf2 cuke test roundabout exit nr 2013-07-30 17:58:00 +02:00
Emil Tin cb28b2de07 cuke test for roundabout instructions 2013-07-30 17:01:25 +02:00
Dennis Luxen bf0b43aa24 Platform specific linker flags 2013-07-23 11:49:23 +02:00
Dennis Luxen 811d6deb41 Don't link against LuaJIT on OS X 2013-07-23 11:38:15 +02:00
Dennis Luxen bcdd9374c7 Compile fixes on OS X 2013-07-23 10:18:42 +02:00
DennisOSRM f70174d1d1 Link internal tools against UUID 2013-07-22 17:54:04 +02:00
DennisOSRM 4a39a4af1c Check for valid data files. Implements #224 2013-07-22 16:34:06 +02:00
DennisOSRM 0367399c89 Partial refactoring 2013-07-22 16:32:19 +02:00
DennisOSRM c5db4dc15f Check for correct magic number 2013-07-19 18:05:54 +02:00
DennisOSRM 31fbfa3a70 Link against UUID 2013-07-19 18:05:15 +02:00
DennisOSRM 3515ddcfe6 Automatic rebuild 2013-07-19 16:58:13 +02:00
DennisOSRM 90303d5952 further addition to cmake script 2013-07-19 16:36:57 +02:00
DennisOSRM 9a02421091 Some mild refactoring 2013-07-19 15:02:45 +02:00
DennisOSRM 4961b819f3 Trigger rebuild of fingerprint everytime 2013-07-19 15:00:41 +02:00
DennisOSRM 61c2ea9225 Trigger rebuild of fingerprint everytime 2013-07-19 14:53:47 +02:00
DennisOSRM f5f7269f70 Trigger rebuild of fingerprint everytime 2013-07-19 14:38:12 +02:00
DennisOSRM 03f1430ddc Trigger rebuild of fingerprint everytime 2013-07-19 14:37:40 +02:00
DennisOSRM c3dab15eb6 Several lookup fixes and fingerprinting of files with input IO, thx @alex85k 2013-07-18 14:11:45 +02:00
DennisOSRM a4f6ec516b Remove unnecessary file 2013-07-17 16:29:11 +02:00
DennisOSRM 1ca213cec6 Remove duplicate license header 2013-07-17 16:27:50 +02:00
DennisOSRM b782c8560c add forgotten include file 2013-07-17 16:27:09 +02:00
DennisOSRM d2e68068bf fixes #659 2013-07-17 16:23:57 +02:00
DennisOSRM 129a846393 add bit size to config object 2013-07-17 15:27:38 +02:00
DennisOSRM 15308931e9 (partially) adding new fingerprint objects 2013-07-17 14:47:22 +02:00
DennisOSRM 4dffeedd1c (partially) adding new fingerprint objects 2013-07-17 14:47:13 +02:00
DennisOSRM d0c4111429 Merge branch 'patch-3' of https://github.com/tyrasd/Project-OSRM into tyrasd-patch-3 2013-07-17 13:23:06 +02:00
DennisOSRM f579b6f971 Fixes #670 2013-07-17 13:20:48 +02:00
DennisOSRM f5124de327 Partially fixes #646. Values were incorrectly casted to int32_t and not uint32_t 2013-07-09 14:25:32 +02:00
DennisOSRM 9ab86ae2bf Fixes issue #663 2013-07-09 14:08:24 +02:00
DennisOSRM 51a7d3ff50 merge conflict CMakeLists.txt 2013-07-09 13:38:44 +02:00
DennisOSRM 80b9afc14d Merge branch 'libosrm' of https://github.com/DennisOSRM/Project-OSRM into libosrm 2013-07-08 15:10:43 +02:00
DennisOSRM 92ae8f37ba Reorder parameters 2013-07-08 14:59:51 +02:00
DennisOSRM df1f828488 Pass references instead of value types 2013-07-08 14:52:43 +02:00
DennisOSRM d8c97da087 Remove dead code and reformat 2013-07-08 14:51:55 +02:00
DennisOSRM 9d29e5d87a Base64 needs 3-byte padded inputs 2013-07-08 14:51:21 +02:00
DennisOSRM bf62147802 Fixing unneeded explicit conversion 2013-07-08 10:27:41 +02:00
Dennis Luxen 34735b8aad throw an exception when server.ini is missing 2013-07-05 22:36:51 +02:00
DennisOSRM 932b2b9acf Move pointer to member variables 2013-07-03 16:56:52 +02:00
DennisOSRM 7ab4472865 Fix non-critical memory leak 2013-07-03 16:54:51 +02:00
DennisOSRM e1e79206f9 fixing include typo 2013-07-03 16:01:59 +02:00
DennisOSRM 7ebe6de022 Proper check for luajit 2013-07-03 13:46:55 +02:00
DennisOSRM b234760e92 Check if platform supports 64 bits 2013-07-03 13:32:31 +02:00
DennisOSRM 3119e4b82b Use LuaJIT if available 2013-07-03 11:41:14 +02:00
DennisOSRM 2c3f05e6f1 Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2013-07-03 10:03:08 +02:00
Dennis Luxen 5b5da8698e Fix missing profile.lua 2013-07-02 22:59:46 +02:00
Dennis Luxen c3c0c8d881 readding profile.lua 2013-07-02 22:51:52 +02:00
Dennis Luxen 9de5e31a7a readding profile.lua 2013-07-02 22:51:21 +02:00
Martin Raifer dbf15c2db2 add test case for overruled implied oneways
On a motorway `oneway=no` should overrule the implied oneway rule.
2013-06-30 10:41:29 +02:00
Emil Tin c9c900b364 default cucumber profiles doesn't run @todo or @stress tests 2013-06-30 10:37:25 +02:00
Emil Tin 5c07204351 update rakefile for convenient cmake setup 2013-06-30 10:21:21 +02:00
Dennis Luxen 828b370ea1 Merging develop branch into master for v0.3.4 release 2013-06-28 10:30:34 -04:00
Dennis Luxen de947d8b17 Add forgotten include 2013-06-28 10:23:58 -04:00
Dennis Luxen 8cb5e68b1a fixing coding style on OpenMP wrapper 2013-06-28 10:22:47 -04:00
Dennis Luxen 99aef2a178 fixing coding style on OpenMP wrapper 2013-06-28 10:14:31 -04:00
Dennis Luxen fff1460dfb ignore osrm-cli tool 2013-06-27 16:11:13 -04:00
Dennis Luxen e3b619fd54 Moved File 2013-06-27 16:09:40 -04:00
Dennis Luxen 29e363e7fb some refactoring 2013-06-27 16:09:21 -04:00
Dennis Luxen c209245b0e Moving cli client to tools directory 2013-06-27 16:09:01 -04:00
Dennis Luxen 4194ce3095 Moving cli client to tools directory 2013-06-27 16:08:33 -04:00
Dennis Luxen a0e9f59e04 Adding a simple example on how to call the lib 2013-06-27 13:21:33 -04:00
Dennis Luxen c940c2722e Fixing errors from static analysis 2013-06-27 11:44:55 -04:00
Dennis Luxen 5c84c12f40 Fixing errors from static analysis 2013-06-27 11:44:32 -04:00
Dennis Luxen 1bcacfab74 minor code massage 2013-06-27 10:57:40 -04:00
Dennis Luxen 1f5f8a76fb Removing files that are not used anymore 2013-06-27 09:54:58 -04:00
Dennis Luxen cfa8b1f0dd Moving coordinate auxiliary functions into the appropriate place 2013-06-27 09:45:28 -04:00
Dennis Luxen aecbcdd390 move OSRM core into library 2013-06-26 20:05:42 -04:00
Dennis Luxen 74729a372b some refactoring 2013-06-26 20:05:03 -04:00
Dennis Luxen 63d8abe32f First implementation of moving the algorithmic core into a library 2013-06-26 19:48:22 -04:00
Dennis Luxen 2c397bfa0b First implementation of moving the algorithmic core into a library 2013-06-26 19:48:02 -04:00
Dennis Luxen bfef8f39b7 First implementation of moving the algorithmic core into a library 2013-06-26 19:47:47 -04:00
Dennis Luxen 4430cbc3cb First implementation of moving the algorithmic core into a library 2013-06-26 19:47:16 -04:00
Dennis Luxen ae20bac3c5 disabling debug output 2013-06-26 14:08:39 -04:00
Dennis Luxen d9a26c4062 fixing bug from premature commit 2013-06-26 13:50:07 -04:00
Dennis Luxen 48cb374d94 refactored some parameter setting 2013-06-26 13:40:25 -04:00
Dennis Luxen 9d6bd91279 some optimization to speed up pbf parsing 2013-06-26 13:39:45 -04:00
Dennis Luxen 163cfda282 Fixing test to reflect new nn grid data structure 2013-06-26 11:35:25 -04:00
Dennis Luxen 72cda375c8 removing copied profile 2013-06-26 10:41:48 -04:00
Dennis Luxen ecb4a08655 const'ing several private function parameters 2013-06-26 09:52:50 -04:00
Dennis Luxen 05c50bc64f adding missing include 2013-06-26 09:50:06 -04:00
Dennis Luxen 747e4a7061 Reorder include block according to style guide 2013-06-26 09:49:00 -04:00
Dennis Luxen 2b8b876713 Reorder include block according to style guide 2013-06-26 09:43:13 -04:00
Dennis Luxen f13694b539 fixing tests to reflect new r-tree data structure 2013-06-26 09:34:01 -04:00
Dennis Luxen 648f9c9723 replacing nearest neighbor grid by static r-tree 2013-06-26 09:32:03 -04:00
Dennis Luxen 0a6c37b726 Removing unused variable 2013-06-26 09:30:03 -04:00
DennisOSRM b43a51f912 Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2013-06-25 20:49:51 +02:00
Dennis Luxen fa328c5a78 don't about if timestamp is missing, just warn 2013-06-25 13:27:39 -04:00
Dennis Luxen 728bcc2b10 Removing debug output 2013-06-25 13:27:03 -04:00
Dennis Luxen 941903a243 Give number of edges when serializing graph 2013-06-25 10:57:39 -04:00
Dennis Luxen 4c8579b340 fixing test to actually test wanted behavior 2013-06-25 10:56:02 -04:00
Dennis Luxen 17416a09f1 fixing include order 2013-06-24 17:03:24 -04:00
Dennis Luxen fdda21b114 use explicit data types 2013-06-24 17:02:28 -04:00
Dennis Luxen c75ae957f1 Remove GUARANTEE macro 2013-06-24 16:56:10 -04:00
Dennis Luxen 8c678126f1 Remove GUARANTEE macro 2013-06-24 16:55:58 -04:00
Dennis Luxen 2b0590f9bd Remove GUARANTEE macro 2013-06-24 16:55:43 -04:00
Dennis Luxen a31992aac7 Remove GUARANTEE macro 2013-06-24 16:50:07 -04:00
Dennis Luxen 829d2505e3 restructured include block 2013-06-24 16:47:35 -04:00
Dennis Luxen df30498365 counting generated edges correctly 2013-06-24 16:39:35 -04:00
Dennis Luxen 5d553bf9f2 const as const can 2013-06-24 16:39:04 -04:00
Dennis Luxen 03e3673dbb Catching any left-over exception that may occur during preprocessing (stxxl) 2013-06-24 16:16:43 -04:00
Dennis Luxen 25b8b37f00 Restructure include block 2013-06-24 16:11:50 -04:00
Dennis Luxen 665f97e782 Move lua includes where they belong 2013-06-24 16:11:33 -04:00
Dennis Luxen 48a007febd minor style fix 2013-06-24 16:11:15 -04:00
Dennis Luxen 155e0fada6 Fixed an integer overflow in assertion 2013-06-24 16:05:27 -04:00
Dennis Luxen fe2f1d32b5 80 char wrap 2013-06-24 14:52:53 -04:00
Dennis Luxen 2fcbb19e72 80 char wrap 2013-06-24 14:43:36 -04:00
Dennis Luxen 06a50d637a De-template-izing some of the code for faster (re-)compile 2013-06-24 14:12:34 -04:00
Dennis Luxen 811b33e31a De-template-izing some of the code for faster (re-)compile 2013-06-24 14:12:29 -04:00
Dennis Luxen 54c83ee940 De-template-izing some of the code for faster (re-)compile 2013-06-24 14:12:25 -04:00
Dennis Luxen 7406e83dde De-template-izing some of the code for faster (re-)compile 2013-06-24 14:12:16 -04:00
Dennis Luxen dc2c7d5339 De-template-izing some of the code for faster (re-)compile 2013-06-24 14:12:08 -04:00
Dennis Luxen aaa25e5d48 De-template-izing some of the code for faster (re-)compile 2013-06-24 14:11:53 -04:00
Dennis Luxen b757bd0ea2 Update README.TXT 2013-06-15 22:07:07 +03:00
Dennis Luxen dd971d6b7d Fixing test for new Rtree 2013-06-05 11:38:45 +02:00
Emil Tin c07966408b add test for consecutive oneways, fails for car 2013-06-03 00:00:14 +02:00
Emil Tin 2557956b68 fix failing car maxspeed test 2013-06-03 00:00:14 +02:00
Emil Tin 735260d21b fix nearest test definition 2013-06-03 00:00:14 +02:00
DennisOSRM e5b0e43e18 Removing typo 2013-05-23 13:45:16 +02:00
DennisOSRM aa42b2494c Avoids the implicit lock of #630 2013-05-22 12:06:53 +02:00
DennisOSRM f057054172 Replacing stringstream based int->string conversion with boost karma
based generator
2013-05-22 11:59:12 +02:00
DennisOSRM c39314c643 Manuelly merging branch 'remove-lexical-cast2' into develop 2013-05-22 11:56:43 +02:00
Dennis Luxen ae018b759c Merge pull request #629 from springmeyer/cmake-fixes
fix spelling error and lacking boost header includes
2013-05-15 03:55:15 -07:00
Dane Springmeyer 556b498e06 remove lexical cast, its evil 2013-05-14 20:12:47 -07:00
Dane Springmeyer 19f1110421 fix spelling error and lacking boost header includes 2013-05-14 20:09:18 -07:00
Dennis Luxen cc73ed19b3 Merge pull request #628 from springmeyer/scons-clang-avoid-exit
Allow configure to work with clang and openmp disabled
2013-05-14 13:04:40 -07:00
Dane Springmeyer ccb7cc40df allow configure to work with clang and openmp disabled 2013-05-14 11:42:38 -07:00
Dennis Luxen 6d61e950d6 Removing superflous semicolon 2013-05-13 08:06:25 -04:00
Dennis Luxen 438c6e616c Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2013-05-12 18:49:36 -04:00
Dennis Luxen 8d2396b81f Additional settings for OS X build without warnings 2013-05-12 18:49:14 -04:00
Emil Tin 9588ef00a5 use alt=false during cucumber testing 2013-05-10 17:17:24 +02:00
Emil Tin 411603ea03 new geofabrik download url 2013-05-07 14:12:27 +02:00
Emil Tin 67addfdb37 test via points 2013-05-05 11:14:09 +02:00
Emil Tin 3afcd31f61 bike: use both ref&name when available 2013-04-28 11:42:21 +02:00
Emil Tin 7ac901cb08 update rake task to work with bins in /build 2013-04-27 17:01:43 +02:00
Emil Tin fcdee8f5d5 handle surfaces in bike profile 2013-04-27 17:00:25 +02:00
Emil Tin a7c32dfa95 rake shortcut for recompiling in build folder 2013-04-26 10:31:13 +02:00
Emil Tin 36f3c0f77a make cuke use bins in build/ 2013-04-26 10:22:32 +02:00
DennisOSRM dad4981a57 remove scons files from ignored list 2013-04-23 19:04:23 +02:00
Dennis Luxen df53357ef1 Good riddance, scons. 2013-04-23 11:21:02 +02:00
Dennis Luxen 85e333127a Manually merging cmake support 2013-04-22 22:24:40 +02:00
Dennis Luxen d52d86ae82 Manually merging cmake support 2013-04-22 22:23:53 +02:00
Dennis Luxen f62293275f Template arguments were uneccessarily defined 2013-04-22 16:42:14 +02:00
Emil Tin af490bae8e fix timestamp test 2013-04-16 16:56:05 +02:00
Emil Tin edf5a0f677 test processing flow example 2013-04-13 12:13:31 +02:00
Emil Tin 5eecd0a57d cuke: keep number nodes locally, not in osm file 2013-04-13 11:38:41 +02:00
Emil Tin 1fc11a6b06 return way type in encoded form for unnamed streets 2013-04-08 16:23:42 +02:00
Emil Tin 3516538813 remove .mode reference from bike profile 2013-04-08 11:27:12 +02:00
Emil Tin e3af8cb2e8 move name test 2013-04-08 11:19:17 +02:00
Emil Tin 16cd822555 mark failing name test as todo 2013-04-08 10:54:49 +02:00
Emil Tin 5938368a09 test for way name when way+area overlap 2013-04-08 10:21:23 +02:00
Emil Tin 50f865b81c add test for pushing bikes on footways etc 2013-04-08 10:04:17 +02:00
Emil Tin 96cd09471b encode way types for unnamed ways in bike profile 2013-04-08 10:04:17 +02:00
Emil Tin cf6c1e97bb add test for current contraflow instructions 2013-04-08 10:04:17 +02:00
Emil Tin f557e1efb4 remove test tag 2013-04-06 17:49:37 +02:00
Emil Tin 8893fd1656 test for bearing param (todo) 2013-03-18 21:26:36 +01:00
Emil Tin 081831e6ea test for mode flag (todo) 2013-03-18 15:51:41 +01:00
DennisOSRM 46c3ce0e34 Fixing 32 bit node id issue 2013-03-08 11:06:14 +01:00
DennisOSRM 6031a45c68 Avoid aborts like issue #601 2013-03-06 13:50:09 +01:00
DennisOSRM ca64887cba Partially implements #569, thx @lonvia 2013-03-03 18:26:29 +01:00
DennisOSRM 3f1d67ca4c Workaround for #557 2013-03-03 18:05:36 +01:00
DennisOSRM ff09af2812 Fixes #597, compile issues with boost filesystem2. 2013-03-03 17:38:35 +01:00
DennisOSRM 42b68fa834 Merging changes for 0.3.3 2013-03-01 10:31:02 +01:00
DennisOSRM 2cc2c967d1 Compute turn angles in mercartor projection. Implements issues #596,
#532
2013-02-28 13:34:48 +01:00
DennisOSRM bec4e4437d Minor code refactoring 2013-02-27 19:47:04 +01:00
Emil Tin f9abfbf68a compute turn penalties in lua profiles 2013-02-27 19:33:33 +01:00
DennisOSRM 53af4ee39f Cleaning of several regressions in the parsing code. 2013-02-27 17:36:44 +01:00
DennisOSRM af5f2f85da Workaround for failing tests 2013-02-26 09:57:29 +01:00
DennisOSRM ea83231da5 Fixing incorrect initialization of hash function 2013-02-25 18:47:17 +01:00
Project OSRM c4693602ef Adding geometry to production rules 2013-02-25 14:52:35 +01:00
Emil Tin 3c8dd85966 respect use_restricions in xml import 2013-02-23 13:53:06 +01:00
Emil Tin 0399022d25 update turn instruction test 2013-02-23 09:00:44 +01:00
drxzcl c6840496c0 Add basic CORS headers to allow cross-site access.
Add ¨Access-Control-Allow-Origin: *¨ to the HTTP headers of all replies.
This allows use in a cross-origin AJAX situation.

In compliance with the recommendations of section 4.2 of RFC2616, the header
is added before the existing entity headers.
2013-02-22 16:01:30 +01:00
DennisOSRM f7657280b6 Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2013-02-22 15:50:07 +01:00
Emil Tin f88a4baf79 update bike tests 2013-02-22 15:49:44 +01:00
Emil Tin b051f715e6 add 'no' to barrier whitelist in bike profile 2013-02-22 15:49:44 +01:00
Emil Tin 81a05c89e4 update bike speeds 2013-02-22 15:49:44 +01:00
Emil Tin cc55b016e9 don't push against oneway flow on roundabout. fixes #591 2013-02-22 15:49:44 +01:00
DennisOSRM ae8e51074e Removing superflous inline statements 2013-02-22 15:49:44 +01:00
Emil Tin 313b93169d turn off turn restrictions for bicycle and foot, update tests 2013-02-22 15:49:44 +01:00
Emil Tin db148741e9 code cleanup 2013-02-22 15:49:43 +01:00
Emil Tin 1ecad20a0d support xml, move duplicated xml/pbf code to base 2013-02-22 15:49:43 +01:00
Emil Tin 22c5c539c2 default to using turn restrictions 2013-02-22 15:49:43 +01:00
Emil Tin d59e526e1e lua setting for using turn restrictions 2013-02-22 15:49:43 +01:00
Emil Tin 94fa0047db update bike tests 2013-02-19 08:54:23 +01:00
Emil Tin 26e2f9ddd1 add 'no' to barrier whitelist in bike profile 2013-02-19 08:38:10 +01:00
Emil Tin 23254b4f24 update bike speeds 2013-02-19 08:38:10 +01:00
Emil Tin 9a44f16846 don't push against oneway flow on roundabout. fixes #591 2013-02-15 17:02:49 +01:00
DennisOSRM cad0069be2 Minor refactoring/reordering 2013-02-14 17:12:52 +01:00
DennisOSRM f315a013b8 Refactoring InputEdge type and removing dead code 2013-02-14 17:12:12 +01:00
DennisOSRM f780aa6160 Saving 4 bytes on each original edge. Simplifying handling of original
edge data
2013-02-14 17:11:18 +01:00
DennisOSRM 0f03beb2b5 replacing c-style size_t with the one from std namespace 2013-02-12 15:46:40 +01:00
DennisOSRM 7e39c43896 allocate data in chunks of 8MB 2013-02-12 15:24:35 +01:00
DennisOSRM 906d28fa5d Correct wrong allocation, use std::vector for node array and pass PODs
by value not ref
2013-02-12 15:23:09 +01:00
DennisOSRM 4d017f5d49 Saving 4 bytes per edge 2013-02-12 11:35:59 +01:00
DennisOSRM 6410314b0b Add license attribution to GPX output 2013-02-12 10:57:33 +01:00
DennisOSRM 1c0202e790 Reordering initializations 2013-02-11 15:20:37 +01:00
DennisOSRM 918c978551 Fixes issue #585 2013-02-11 15:06:33 +01:00
DennisOSRM 3d1a85bbea Fixing compilation issues on various compilers, i.e. old GCC, clang,
ICPC
2013-02-10 18:18:39 +01:00
Dennis Luxen 1a442c36e9 Implementing #566 2013-02-10 15:05:31 +01:00
Emil Tin a4e322f085 don't allow bikes on highway=construction, fixes #582 2013-02-06 16:58:18 +01:00
DennisOSRM 0b1d268b09 Fixing issue that enters infinite loop under certain conditions 2013-02-06 15:23:57 +01:00
DennisOSRM c2be6bc019 Fixes issue #567 2013-02-05 16:06:10 +01:00
DennisOSRM 9e11e832da fixing symlink 2013-02-05 09:50:14 +01:00
DennisOSRM 348e656671 Merge branch 'feature/opposite_direction' into develop 2013-02-04 18:38:15 +01:00
DennisOSRM 54cdf6d6f2 maxspeed:forward and :backward get parsed and tests pass. Implements
#569 partially.
2013-02-04 15:58:35 +01:00
DennisOSRM 7c5ca8f199 ignore changes on profile symlink 2013-02-04 13:11:03 +01:00
DennisOSRM ee42d94e2d Fix test to reflect changed maxspeed behavior 2013-02-04 13:10:31 +01:00
DennisOSRM 91baa9dfd7 Merge completed 2013-02-04 13:05:05 +01:00
DennisOSRM 572b176401 Fixes issue #579 2013-02-04 12:13:30 +01:00
Emil Tin 97f1dc0749 update maxspeed tests, remove maxspeed from foot profile 2013-02-04 11:30:46 +01:00
Emil Tin d67ac1a708 fuzzy matching in routability tables, ported from opposite branch 2013-02-04 10:33:25 +01:00
DennisOSRM 2707001a3a Merge branch 'feature/opposite_direction' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git into feature/opposite_direction 2013-02-03 23:25:06 +01:00
Emil Tin bb1064ac42 remove a nearest test, for now 2013-02-03 21:01:10 +01:00
Emil Tin 436cc692da a few more test for nearest api 2013-02-03 20:37:22 +01:00
Emil Tin 76decf2e8b fix nearest test 2013-02-03 20:24:46 +01:00
Emil Tin ccdd0f599a test nearest API 2013-02-03 20:17:06 +01:00
Emil Tin c65fed1d38 simplify testbot maxspeed forw/back test 2013-02-03 18:23:23 +01:00
DennisOSRM c36ec7c95b Replacing profile.lua by a symlink 2013-02-03 18:17:22 +01:00
DennisOSRM 305ce04284 replacing by symlink 2013-02-03 18:16:36 +01:00
DennisOSRM 034ce137a9 removing file 2013-02-03 18:15:39 +01:00
Emil Tin 73c81a0a6c Removing debug output 2013-02-03 18:13:57 +01:00
DennisOSRM 7544727f7a Turn on all warnings during build by default 2013-02-03 17:08:15 +01:00
DennisOSRM 961a379f79 Fixing signed/unsigned comparison warnings 2013-02-03 17:07:31 +01:00
DennisOSRM 9ffcaa5550 Fixed offset, moved rvalues to the left in comparisons and const'ed a
few things.
2013-02-03 16:56:59 +01:00
DennisOSRM 2dbae6ce51 Refactoring routing algorithms, alternative computation hastened by
sweeping the search space only once. Should fix #572
2013-02-03 16:47:32 +01:00
Emil Tin f7505e8877 test car maxspeed forw/backw (@todo) 2013-02-03 15:43:12 +01:00
Emil Tin c453f8e7a9 test car maxspeed forw/backw (@todo) 2013-02-03 15:42:14 +01:00
Emil Tin 3a4695713d test bike maxspeed forw/backw (@todo) 2013-02-03 15:34:41 +01:00
DennisOSRM 7d9d0878de Adding templated utility functions for repeated operations on containers 2013-02-03 14:59:10 +01:00
DennisOSRM 26729ca482 Fixing useless comparison 2013-02-03 14:57:40 +01:00
DennisOSRM 405600783e introducing further typedefs to make code more readable 2013-02-03 14:55:49 +01:00
DennisOSRM 5b5e9296b3 Adding const to parameter and rehash to give map 1000 buckets 2013-02-03 14:54:22 +01:00
Emil Tin dd5d520b53 update profile and tests for pushing of bikes 2013-02-03 14:46:18 +01:00
Emil Tin b3d517943a fuzzy ranges on routability tables, value shortcuts 2013-02-03 14:03:37 +01:00
DennisOSRM 59ca59d431 Using unordered_set where it suffices 2013-02-03 13:19:23 +01:00
DennisOSRM 78c92be14b Fixes issue #577, syntax error in JSONP response 2013-02-01 13:21:12 +01:00
DennisOSRM adf0c726ef Further changes to duration handling 2013-01-30 14:03:21 +01:00
DennisOSRM 9ecfed4e56 linking to car profile 2013-01-30 13:47:24 +01:00
DennisOSRM 9db884f371 Fixing duration parsing 2013-01-30 13:46:20 +01:00
DennisOSRM e0c211085c Handle route=shuttle_train again 2013-01-29 17:36:28 +01:00
DennisOSRM 555bfaf37a Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2013-01-29 17:19:54 +01:00
DennisOSRM bcf4af4a2f Duration tag now handles 'hh:mm', 'mm' as well as 'hh:mm:ss' 2013-01-29 10:11:04 +01:00
DennisOSRM 6a71163912 Merging further changes 2013-01-28 11:11:11 +01:00
Emil Tin cb2fcf4f52 add @todo tag to partial way duration test 2013-01-28 09:39:18 +01:00
Emil Tin 061d78c681 test partial duration of ways 2013-01-28 08:30:34 +01:00
DennisOSRM 0ffa973ec6 Exit gracefully when data is empty 2013-01-27 23:08:45 +01:00
DennisOSRM 03de87c213 Parsing duration when present 2013-01-27 23:06:23 +01:00
DennisOSRM 59481dd762 Adding duration member to way 2013-01-27 23:05:27 +01:00
DennisOSRM 86f4aebead Fixes test to expect time in minutes not seconds 2013-01-27 23:03:04 +01:00
DennisOSRM a92950d234 Fixes how durations are parsed 2013-01-27 23:01:37 +01:00
DennisOSRM ccdc6f1a63 Removing dead code 2013-01-27 23:00:06 +01:00
DennisOSRM 62cc8f456c Rebasing branch on develop 2013-01-27 14:49:47 +01:00
DennisOSRM f7c6b9a0f7 Fixed direction flag on split edges 2013-01-27 14:36:57 +01:00
DennisOSRM 01a6e3c619 Fixed the computation of reverse edge weight 2013-01-27 14:36:57 +01:00
DennisOSRM 6948d56e5d Fixing edge array sentinel at position n+1 2013-01-27 14:36:57 +01:00
DennisOSRM 6373b3e49c Adding first implementation of back() reference function 2013-01-27 14:36:57 +01:00
DennisOSRM 91dc1b6639 Adding curly braces where appropriate 2013-01-27 14:36:57 +01:00
DennisOSRM 6317b08090 Fixing test cases to check for different speeds in opposite direction 2013-01-27 14:36:57 +01:00
Emil Tin aae0547cca better testbot maxspeed handling, fix test 2013-01-27 14:36:56 +01:00
Emil Tin 4f9c422e2f test maxspeed forward/backward 2013-01-27 14:36:56 +01:00
Emil Tin 3595ac08f7 fix tag on @opposite test 2013-01-27 14:36:56 +01:00
Emil Tin 5339f440bd test forward/backward maxspeed (car) 2013-01-27 14:36:56 +01:00
Emil Tin 86d7442a5f support comments in test tables 2013-01-27 14:36:56 +01:00
DennisOSRM e6e5626a2c Implementing logic when route is going against one-way flow (think
bikes!)
2013-01-27 14:36:56 +01:00
DennisOSRM 4a52dd1c5b Fixing constant 2013-01-27 14:36:56 +01:00
DennisOSRM dd1302e8b1 Added new TurnInstruction that indicates when to go against oneway
streets. It's important for cycling.
2013-01-27 14:36:56 +01:00
DennisOSRM 7b4b7232fc Fixing test for opposite directions 2013-01-27 14:36:56 +01:00
DennisOSRM b069725df0 Support for backward speed in extractor 2013-01-27 14:36:56 +01:00
Emil Tin aa9d8c773f fix name of duration test 2013-01-26 19:06:30 +01:00
Emil Tin c68a03d05c add test scenario matching wiki graph explanation 2013-01-26 18:59:31 +01:00
Emil Tin cbea651cf8 test duration on ways 2013-01-26 18:58:33 +01:00
DennisOSRM b4ee345966 removing left-over debug output 2013-01-23 11:52:18 +01:00
DennisOSRM 296e7ccb08 Removing dead code 2013-01-23 11:34:16 +01:00
Emil Tin 43bb53e789 better testbot maxspeed handling, fix test 2013-01-19 16:00:44 +01:00
Emil Tin 384be58230 test maxspeed forward/backward 2013-01-19 13:10:11 +01:00
Emil Tin 46d1a87b89 fix tag on @opposite test 2013-01-19 13:07:21 +01:00
Emil Tin 7c8bf18cc6 test forward/backward maxspeed (car) 2013-01-19 13:06:52 +01:00
Emil Tin 35255d052d support comments in test tables 2013-01-19 13:06:52 +01:00
DennisOSRM cf5c776990 Implementing logic when route is going against one-way flow (think
bikes!)
2013-01-18 21:28:13 +01:00
DennisOSRM 9961172d70 Fixing constant 2013-01-18 19:33:51 +01:00
DennisOSRM c1c46544a6 Further optimizations 2013-01-18 19:08:22 +01:00
DennisOSRM fc24dbf9b7 Added new TurnInstruction that indicates when to go against oneway
streets. It's important for cycling.
2013-01-18 19:06:03 +01:00
DennisOSRM 7f311551dd Fixing test for opposite directions 2013-01-18 19:01:36 +01:00
DennisOSRM 1a6c01769e Support for backward speed in extractor 2013-01-18 19:01:36 +01:00
DennisOSRM 9da4e18099 Reordering padded struct 2013-01-18 18:59:38 +01:00
DennisOSRM b19e2fbafe Fixing test for opposite directions 2013-01-18 16:42:04 +01:00
DennisOSRM 7f69857376 Support for backward speed in extractor 2013-01-18 16:40:12 +01:00
DennisOSRM a64420d700 further const'ing 2013-01-11 22:22:57 +01:00
DennisOSRM 2ccd3da5b3 replacing unsafe strcpy operations 2013-01-11 22:13:02 +01:00
DennisOSRM 845c73af73 Removing unused table, Uninitialized scalar field (UNINIT_CTOR),
Coverity CID 751302
2013-01-11 20:44:35 +01:00
DennisOSRM f7d79209dc Fixing dereference after null check (Coverity: CID 967038) 2013-01-11 20:20:22 +01:00
DennisOSRM 0017aef89a Merge branch 'develop' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git into develop 2013-01-11 18:36:17 +01:00
DennisOSRM 7449f81ed4 Reordering members in struct to actually exploit four byte padding,
partially fixes #563
2013-01-11 18:36:00 +01:00
Emil Tin 724e96f0c1 test different forw/backw settings (@todo) 2013-01-11 18:16:17 +01:00
DennisOSRM 8158e7f1c5 Using explicit 64bit integer instead of compiler-dependent long long 2013-01-11 18:16:08 +01:00
Emil Tin 7d7baa70a9 test routes parsing (@todo) 2013-01-10 17:06:16 +01:00
Emil Tin 2e3947cc6d support list of ways in relations tests 2013-01-10 17:05:41 +01:00
Emil Tin 54774726b2 test separate weight/speed, still marked as @todo 2013-01-10 14:00:48 +01:00
DennisOSRM 2af9fcad68 Saving 3 bytes per original edge. 2013-01-06 19:38:03 +01:00
DennisOSRM fd79e81fe5 Removing explicit namespace usage 2013-01-06 19:06:17 +01:00
DennisOSRM 2b5e110719 Splitting utility header with ambigious name into two files with better
names
2013-01-06 19:03:04 +01:00
DennisOSRM 864c2d9f49 stray const keyword removed that prevented build 2013-01-06 17:58:02 +01:00
DennisOSRM 764fe533e8 Adding forgotten commit 2013-01-06 17:54:17 +01:00
DennisOSRM f1f59d770e Forgotten file. 2013-01-06 17:51:45 +01:00
DennisOSRM 950baaa9fc Merge branch 'develop' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git into develop 2013-01-06 17:48:30 +01:00
DennisOSRM 5b3aacb4b2 removing stringstream 2013-01-06 17:48:18 +01:00
Emil Tin d6adc56b3a add test for multiple except tag values in restrictions 2013-01-06 15:44:15 +01:00
DennisOSRM dbe1a4255c type change 2013-01-06 13:02:10 +01:00
DennisOSRM eed20b2271 several fixes to replace copied parameters with const refs. 2013-01-06 13:00:58 +01:00
DennisOSRM e70adbb1cb Using const-refs instead of copies when iterating vectors 2013-01-06 12:59:36 +01:00
DennisOSRM 06c22a478f fixing typo 2013-01-06 12:39:12 +01:00
Emil Tin 565b0e97d1 rename @weight test to @fastest 2013-01-06 11:51:45 +01:00
DennisOSRM 00168cb12f Removing dead code. 2013-01-05 22:47:12 +01:00
DennisOSRM ffdaa71086 Implementation of turn restriction exceptions 2013-01-05 19:20:25 +01:00
DennisOSRM 5de2aa1cbf fixing test and removing todo tag 2013-01-05 17:35:50 +01:00
DennisOSRM 64988ed831 Adding functionality for turn restriction exceptions to profile 2013-01-05 17:32:39 +01:00
DennisOSRM fa050ad616 Fixing registration of package path. 2013-01-05 17:27:10 +01:00
Project OSRM d2458f3169 Merge pull request #550 from ibikecph/lua_require
easy lua require()
2013-01-05 03:03:13 -08:00
Emil Tin 551af0e45a fix a few restrictions tests 2013-01-04 16:09:00 +01:00
DennisOSRM 4ac5440a4a Removing debug output 2013-01-04 12:49:31 +01:00
DennisOSRM 7c54d4e62f Fixes the Birminingham speed limit bug reported by Philip Barnes 2013-01-04 12:31:43 +01:00
DennisOSRM 8ab5915983 Add symlink to the profile in the respective folde 2013-01-04 12:23:25 +01:00
DennisOSRM 877865a4b1 removing profile 2013-01-04 12:22:09 +01:00
Dennis Luxen 7cf4d37595 Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2013-01-02 00:41:08 +01:00
Dennis Luxen 80add9f820 Splitting monolithic extraction code into compile units 2013-01-02 00:33:39 +01:00
Dennis Luxen 12a35c1214 Splitting monolithic extraction code into compile units 2013-01-02 00:33:14 +01:00
Dennis Luxen 9379d2462e Splitting monolithic extraction code into compile units 2013-01-02 00:32:34 +01:00
Emil Tin c5e8bed1fb increase stxxl allocation used in tests, to avoid reallocation 2013-01-02 00:02:48 +01:00
Emil Tin 4aa7ade32c ordering includes alphabetically 2013-01-01 23:20:16 +01:00
Emil Tin c4ed218a7a Revert "remove unused struct MinimalEdgeData"
This reverts commit 0235cf5d8e.
2013-01-01 23:01:52 +01:00
Emil Tin ff417fac01 update ferry tests 2013-01-01 18:41:38 +01:00
Emil Tin 0f4207f85e show total running time when extracting 2013-01-01 17:25:40 +01:00
Emil Tin f4431ed837 simple rake tasks for extracting/preparing separately 2013-01-01 17:10:30 +01:00
Emil Tin 0235cf5d8e remove unused struct MinimalEdgeData 2012-12-31 11:22:56 +01:00
DennisOSRM 8fc8a4e303 Removing last remaining 'using namespace std' statement 2012-12-29 21:02:26 +01:00
DennisOSRM 943c15927a Fixing data type issue that prevented large files on windows. See issue
#55
2012-12-29 14:14:01 +01:00
Emil Tin 28f0782b17 code cleanup, merge Lua.h and LuaUtil.h 2012-12-28 22:40:00 +01:00
Emil Tin 09e331a76b fix gitignore to avoid ignoring subfolders. add missing lua file 2012-12-28 22:40:00 +01:00
Emil Tin ce43b09991 support lua require() 2012-12-28 22:40:00 +01:00
DennisOSRM f9ab8426ce Merging changes for 0.3.2 2012-12-26 18:37:57 +01:00
DennisOSRM b869184c10 Replaced submodule with a text referencing the subproject directly 2012-12-26 18:32:57 +01:00
DennisOSRM 68e39b8053 Removing Docs submodule 2012-12-26 18:29:16 +01:00
Dennis Luxen 6574436c33 Merge branch 'develop' 2012-12-24 10:35:51 +01:00
DennisOSRM 8e023418e4 Removing superflous file 2012-12-23 20:03:12 +01:00
DennisOSRM bf94866ec0 Fixing signed/unsigned comparisons 2012-12-23 19:34:26 +01:00
DennisOSRM cba3c46820 Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2012-12-23 19:32:50 +01:00
Emil Tin d4db5cca1c fixing typo in forestry access 2012-12-23 19:32:26 +01:00
Emil Tin e4fc633f68 bicycles can pass cycle_barriers 2012-12-21 13:10:42 +01:00
Emil Tin 9857fb7696 dont rehash binaries and profiles for every cucumber scenario 2012-12-19 16:09:05 +01:00
Dennis Luxen 199b1cbcf8 Fixing typo 2012-12-19 11:08:09 +01:00
Dennis Luxen 1d38ba78e8 Adding include to algo 2012-12-19 11:06:02 +01:00
Dennis Luxen c9ce018b9f Adding include 2012-12-19 11:04:02 +01:00
DennisOSRM 9b4e31c5ea Merge branch 'develop' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git into develop 2012-12-18 11:13:47 +01:00
DennisOSRM 1e7a5e881e Fixing typo. Thanks franzmh 2012-12-18 11:12:17 +01:00
Emil Tin 102e87bcc0 clean up log extracts during cuke failures 2012-12-17 19:27:18 +01:00
Emil Tin 604043e3d8 add log extracts if osrm-routed or osmosis fails during tests 2012-12-17 19:22:05 +01:00
DennisOSRM 10513784c7 Merge branch 'develop' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git into develop 2012-12-17 17:43:05 +01:00
DennisOSRM 5e3c8cdd8e errenous data check broke debug build 2012-12-17 17:41:45 +01:00
Emil Tin 5a5b4eb1f7 output last lines from log if binary exists during testing 2012-12-17 17:32:15 +01:00
DennisOSRM e839cb4b8c Removing false continue statement that broke debug build. 2012-12-17 16:47:05 +01:00
DennisOSRM 5c3dad0c61 Removing false assertion that broke the debug build 2012-12-17 16:45:47 +01:00
DennisOSRM f4a1d2df96 Allowing greater error instead of expected approximation result. 2012-12-17 13:54:03 +01:00
DennisOSRM cb6104e0ac Using vector instead of deque for path unpacking 2012-12-17 13:17:35 +01:00
DennisOSRM 00ed039621 Moving TurnInstruction to unsigned char 2012-12-17 13:14:43 +01:00
DennisOSRM b247c20dbf Removing name substitution for now; Using Euclidean distance
approximation
2012-12-17 12:37:10 +01:00
DennisOSRM 81d26d7702 Removing superflous file 2012-12-17 12:31:30 +01:00
DennisOSRM 0f106c627b Adding a distance approximation that works great for short distances and
has a lot less calls to trigonometric functions
2012-12-17 11:22:44 +01:00
Emil Tin ac06a2ef03 remove angles from a test 2012-12-16 21:03:15 +01:00
Emil Tin 2ea5714d95 use ps to check if process is still running 2012-12-16 20:51:19 +01:00
Emil Tin a51c7416d5 use ruby 1.9 and Process.spawn when running test 2012-12-16 19:45:26 +01:00
Emil Tin 2231765c9e fix empty dataset test 2012-12-16 14:10:33 +01:00
Emil Tin 18c948a211 rename stress tests 2012-12-16 13:39:28 +01:00
Emil Tin ec56478a3c cucumber cleanup, removed unused code 2012-12-16 13:36:47 +01:00
Emil Tin 7e9614b9ec kill osrm-routed if it refuses to shutdown in cuke tests 2012-12-15 17:01:24 +01:00
Emil Tin 7f7055a9e7 add a cuke profile for convenient regression testing 2012-12-15 12:38:07 +01:00
Emil Tin ae106a3a90 improve cuke process management, support OSRM_PORT 2012-12-15 12:38:07 +01:00
Emil Tin 29344f55ae fix osrm bin hashes 2012-12-15 12:38:07 +01:00
Emil Tin da6b750378 endl at launch instead of shutdown, more info during shutdown 2012-12-15 12:38:07 +01:00
Emil Tin 96c872ac37 prevent hang trying to shut down zombie processes 2012-12-15 12:38:07 +01:00
Dennis Luxen 51f67f3fa0 Remoing superflous line 2012-12-13 19:41:17 +01:00
Dennis Luxen d3dce3cc25 Remove unused defines 2012-12-11 23:45:14 +01:00
Dennis Luxen 411d4331d4 fixes regression in first fix to issue #530 2012-12-11 23:43:46 +01:00
Dennis Luxen 18aff1ae40 Remove superflous include 2012-12-11 23:23:17 +01:00
DennisOSRM 3ff7febde0 Merge branch 'develop' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git into develop 2012-12-10 17:45:10 +01:00
DennisOSRM f7fdb8b54e Fixes issue #533 2012-12-10 17:44:45 +01:00
Emil Tin cc7f761c3e revert to alt=true in cuke test 2012-12-10 17:05:22 +01:00
Emil Tin b10b716733 cuke testing of timestamp api 2012-12-10 17:05:22 +01:00
DennisOSRM a255f222ef Extending timestamp to 25 characters 2012-12-10 16:36:54 +01:00
Emil Tin b0f035bf3c mark some tests as @todo 2012-12-10 13:08:26 +01:00
Emil Tin e41d52570e support testing of turn directions 2012-12-09 18:21:56 +01:00
Dennis Luxen 824724630f Reomving the Travis CI experiment 2012-12-08 23:19:59 +01:00
Dennis Luxen 85c5da8512 removing --with-tools flag for travic CI 2012-12-08 21:10:24 +01:00
Dennis Luxen d79ebabe03 cuke dependencies for travic CI 2012-12-08 20:42:24 +01:00
Dennis Luxen f9cab44bc1 Adding irc config for Travis CI build server 2012-12-08 16:28:30 +01:00
Dennis Luxen 636f69b29f Adding config for Travis CI build server 2012-12-08 16:25:45 +01:00
DennisOSRM 86a5bbac51 fixes issue #530 2012-12-06 20:05:43 +01:00
Emil Tin b182cd1fa4 test bikes & public_transport stop_area relations 2012-12-03 11:06:25 +01:00
Emil Tin 6f5fc14f59 support regex in cuke tests 2012-12-03 10:59:24 +01:00
Emil Tin f1d47328e9 support testing of all relation types 2012-11-30 13:40:21 +01:00
Emil Tin 9a865384a1 tests for except tag on turn restrictions 2012-11-28 18:43:07 +01:00
DennisOSRM 7379c8c387 Giving name of script; fix signed/unsigned comparison 2012-11-22 19:26:06 +01:00
DennisOSRM 07f644f7d3 Set up scripting environment firsz 2012-11-22 19:24:34 +01:00
DennisOSRM 07302c3df8 Using Threads from parameter extractor.ini 2012-11-22 17:24:49 +01:00
DennisOSRM 33bd546588 Removing SRTM 2012-11-22 17:23:49 +01:00
DennisOSRM a790ffc2d1 Fetching number of threads from extractor.ini 2012-11-22 17:23:31 +01:00
DennisOSRM 6003ae7406 Using boost spirit conversions 2012-11-22 17:22:40 +01:00
DennisOSRM 3c6121d192 Reverting change that used stxxl for temporaray stuff 2012-11-22 17:21:45 +01:00
DennisOSRM 12500e4721 const'ing c'tor 2012-11-22 17:17:54 +01:00
DennisOSRM 166133a496 Setting size to zero after clear 2012-11-22 15:41:29 +01:00
Emil Tin 06914b13e0 Merge branch 'patch-1' of git://github.com/fabrik42/Project-OSRM into develop 2012-11-20 15:57:04 +01:00
Christian Bäuerlein 36856fd646 Fixes typo in Rakefile
Could not download data for skaane, as there was a `t` missing in the `country` key.
2012-11-20 15:07:32 +01:00
DennisOSRM 870ed96c24 Replacing atoi by boost::spirit::qi 2012-11-20 12:15:40 +01:00
DennisOSRM aed5848f5a Requesting instructions by default 2012-11-20 10:49:03 +01:00
Dennis Luxen 210f586d49 Removing deprecated API call from tests 2012-11-19 21:40:28 +01:00
DennisOSRM 94657a3258 Implements a shared-memory parallel LUA scripting engine using OpenMP.
See issue #506
2012-11-19 19:04:59 +01:00
DennisOSRM 7e9eaaddc4 Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2012-11-19 11:58:21 +01:00
DennisOSRM bd3f069f47 Prefer LUAjit instead of interpreter 2012-11-19 11:58:17 +01:00
DennisOSRM a2c9b5b6d1 removing dead code 2012-11-19 11:56:16 +01:00
DennisOSRM c4be1d1423 Fixes issue #504 2012-11-19 11:52:34 +01:00
DennisOSRM f9d336ff88 prefix increment instead of postfix 2012-11-19 11:45:10 +01:00
DennisOSRM 2c08adab24 Making functions const when necessary 2012-11-19 11:44:30 +01:00
DennisOSRM 5faf8d6951 Temporary edges saved in stxxl store; const & inline where feasible;
more efficient checks for divide-by-zero; witness search omits middle
node; Removed unneeded temporaries; Removed superflous includes; Saving
4 Bytes per node during contraction.
2012-11-19 11:43:46 +01:00
DennisOSRM b51f98fe0c Checking existence of file with boost filesystem to make it more
portable
2012-11-16 12:00:50 +01:00
DennisOSRM 0e3d2cf68d Initialize scripting environment _before_ loading data. 2012-11-16 11:35:14 +01:00
DennisOSRM 868d6ec776 Backporting refactoring from master branch 2012-11-15 15:10:49 +01:00
DennisOSRM e45b7b4b14 Merge branch 'master' of https://github.com/DennisOSRM/Project-OSRM
Conflicts:
	Algorithms/DouglasPeucker.h
2012-11-15 14:19:57 +01:00
DennisOSRM 3353e482ef Use luajit 2.0 if available 2012-11-15 14:13:17 +01:00
DennisOSRM 11d4d3ec30 Generate shared_ptr by make_shared macro 2012-11-15 13:43:33 +01:00
DennisOSRM 7fda7f1f9b Use DeallocatingVector in DynamicGraph 2012-11-15 13:39:23 +01:00
DennisOSRM 7752f1ade0 Merge branch 'feature/APIParsingByGrammar' of
https://github.com/DennisOSRM/Project-OSRM into
feature/APIParsingByGrammar

Conflicts:
	Plugins/RouteParameters.h
	Server/APIGrammar.h
2012-11-14 13:13:19 +01:00
DennisOSRM aeff6c8caa rebasing branch on develop and adding new API features 2012-11-14 12:01:19 +01:00
DennisOSRM 954710d6cc Renaming utility function to set the name of the used routing service
(plugin)
2012-11-14 10:53:07 +01:00
DennisOSRM 1c50c55a42 Fixing hint ordering for via routes 2012-11-14 10:53:07 +01:00
DennisOSRM 504368b293 Make hello world plugin more verbose to allow testing 2012-11-14 10:49:05 +01:00
DennisOSRM 03f8845998 API calls now get parsed through a grammar using boost::spirit::qi 2012-11-14 10:49:05 +01:00
DennisOSRM 7d0bd77643 Fixing hint ordering for via routes 2012-11-14 10:30:35 +01:00
DennisOSRM 07b6073dcf Make hello world plugin more verbose to allow testing 2012-11-14 10:30:35 +01:00
DennisOSRM 1ec49c3914 API calls now get parsed through a grammar using boost::spirit::qi 2012-11-14 10:30:35 +01:00
DennisOSRM f575da2ca8 Fixing tests that check for paths on equator and zero-meridian. It was a
forgotten corner case when checking a divide by zero. and no. that was
no fun to debug.
2012-11-12 19:17:25 +01:00
DennisOSRM 591a06b25e Removing superflous files 2012-11-12 17:45:08 +01:00
DennisOSRM cbe48decd1 Restoring softlink 2012-11-12 17:32:57 +01:00
DennisOSRM 6f8148950e Speeding up parsing of car profile by about 30% 2012-11-12 17:00:36 +01:00
DennisOSRM ac68ff192e Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2012-11-12 16:54:55 +01:00
Emil Tin 629cccc6e1 Merge remote-tracking branch 'origin/develop' into develop 2012-11-12 16:41:49 +01:00
Emil Tin 763cc86043 cuke: ignore maxspeed for cars when higher that way speed 2012-11-12 16:41:08 +01:00
DennisOSRM a82c9d55b3 Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2012-11-12 11:01:03 +01:00
Dennis Luxen 9fc3ed939a Further refactorings 2012-11-12 10:59:46 +01:00
Dennis Luxen 90b07cc6b0 Further refactorings 2012-11-12 10:59:23 +01:00
Dennis Luxen ac15c787cc Further refactorings 2012-11-12 10:59:13 +01:00
Dennis Luxen b5ed992e94 Further refactorings 2012-11-12 10:58:57 +01:00
Emil Tin 7493d8aa49 test ferry duration on part of route 2012-11-04 14:00:21 +01:00
DennisOSRM 2c61d0a79e Moving more functions into LUA 2012-11-03 08:19:01 +01:00
DennisOSRM 55e58375eb Moving more functions into LUA 2012-11-03 08:18:39 +01:00
DennisOSRM 24321d860c Moving more functions into LUA 2012-11-03 08:18:22 +01:00
DennisOSRM e8c7f7b5da Restructured calling of callback functions 2012-11-02 17:15:51 +01:00
Emil Tin 263dcbd188 test ferry durations 2012-11-02 15:57:20 +01:00
DennisOSRM 10cf41d138 Fixes issue #493 2012-11-02 09:10:19 +01:00
DennisOSRM f4fd9dbd38 Fixes issue #489 2012-10-29 13:32:34 +01:00
DennisOSRM 10b650caf4 fixes unsafe float comparisons 2012-10-29 13:25:31 +01:00
DennisOSRM 75561b8278 Fixes issues introduced with commit
48c6145bdf
2012-10-29 13:24:54 +01:00
DennisOSRM d89be86e4f Fixing typo 2012-10-27 21:06:56 +02:00
DennisOSRM 6c218960e0 Revert "Douglas Peucker now twice as fast by using integer arithmetic only"
This reverts commit 48c6145bdf.
2012-10-27 21:04:03 +02:00
DennisOSRM 92d4b40379 Revert "stray round brackets"
This reverts commit 8b2629c273.
2012-10-27 21:01:45 +02:00
Project OSRM 4c0203c108 stray round brackets
Fixing type
2012-10-27 09:34:12 +02:00
Project OSRM 8b2629c273 stray round brackets
Fixing type
2012-10-26 21:12:25 +03:00
Project OSRM c19c97804a Merge pull request #490 from DennisOSRM/develop
Develop
2012-10-26 10:52:03 -07:00
DennisOSRM 313466941b Making alternative route optional 2012-10-26 18:31:31 +02:00
DennisOSRM 48c6145bdf Douglas Peucker now twice as fast by using integer arithmetic only 2012-10-26 18:20:37 +02:00
Emil Tin 9dd45cceab fix invalid ref to numberOfSegments in foot profile 2012-10-26 13:12:52 +02:00
DennisOSRM b6303626b5 Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2012-10-20 21:12:49 +02:00
DennisOSRM d1d800025d changing gdal check to version free include dir 2012-10-20 21:11:37 +02:00
Emil Tin 57dc1e03b1 bikes, handle parking areas and train platforms 2012-10-20 12:03:36 +02:00
Emil Tin ad5b96d6f2 verify distance in traffic signal tests 2012-10-18 14:50:21 +02:00
Emil Tin b5f2a98e89 make clang++ default compiler on Mac 2012-10-17 09:50:00 +02:00
Emil Tin 3a706cade7 in tests, use profile arg instead of copying file 2012-10-13 22:41:19 +02:00
Emil Tin d9af615db9 remove incorrect @bicycle tag from car test 2012-10-11 19:22:49 +02:00
Emil Tin f40550b18c bike speeds on pedestrian areas 2012-10-11 16:52:14 +02:00
Emil Tin 3ec4a049c5 update rakefile to work with lua profiles 2012-10-11 16:52:14 +02:00
DennisOSRM dc86007fa9 Removing man_mades=* from being routable 2012-10-11 16:35:14 +02:00
DennisOSRM 64d14da0fa allowing access tags on unknown highways 2012-10-11 10:01:54 +02:00
Emil Tin c83ab666d7 bringing bikes on trains 2012-10-10 18:25:15 +02:00
Emil Tin 599b96ed95 dont use cover?() in test, to support ruby 1.8 2012-10-10 17:51:10 +02:00
DennisOSRM 38ba10ddad Updated line generalization thresholds 2012-10-08 16:25:59 +02:00
DennisOSRM 8794db633b Merge branch 'master' into develop 2012-10-08 12:07:31 +02:00
DennisOSRM c0287c0f2f Car profile does only route on known ways 2012-10-08 12:05:49 +02:00
Dennis Luxen 6fe931fe4c Implementing issue #422, also briefly discussed with @lonvia 2012-10-06 17:22:53 +02:00
Dennis Luxen 680d3e7d92 Implementing issue #422, also briefly discussed with @lonvia 2012-10-06 17:21:53 +02:00
Dennis Luxen c5b1cea58e removing default naming of unnamed streets 2012-10-06 15:01:26 +02:00
Dennis Luxen 11d45f5a10 Removed superflous files 2012-10-05 19:27:39 +02:00
Emil Tin 5c737709e2 test for bikes on trains 2012-10-05 16:28:19 +02:00
Emil Tin 7282e543ca test maxspeed for bicycles (yes it's possible) 2012-10-05 16:15:47 +02:00
Emil Tin ea90627e02 simple test for routing on areas 2012-10-05 15:52:44 +02:00
Emil Tin b95596d6b7 test for empty highway tag 2012-10-05 15:52:44 +02:00
Emil Tin 7400e60599 allow nil tags in highway columns in tests 2012-10-05 15:52:44 +02:00
DennisOSRM 6eab47d768 Fixing origin (0,0) tests 2012-10-05 15:25:12 +02:00
Emil Tin 3f039f59de add @todo tag to test for unimplemented features 2012-10-05 13:48:05 +02:00
Emil Tin 2a89aeecd8 handle cycleway tags 2012-10-05 12:09:03 +02:00
DennisOSRM 386d4c7e72 First implementation of Tarjans seminal SCC algorithm. The iterative
version was coded by brute force.
2012-10-05 11:21:07 +02:00
DennisOSRM df9a8a32eb Adding new component analysis tool
Conflicts:

	SConstruct
2012-10-05 11:20:53 +02:00
Emil Tin fa9eeb95b6 remove test for travel time at 1m scale 2012-10-04 23:18:25 +02:00
Emil Tin 13069632be reduce expected precision in distance tests 2012-10-04 23:04:32 +02:00
DennisOSRM a502da7c0f Implementing issue #428 2012-10-04 18:56:58 +02:00
DennisOSRM 0b2df9892d Changed haversine formula to be less sensitive to floating-point
inexactness.
2012-10-04 17:27:17 +02:00
DennisOSRM c6dc476704 Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2012-10-04 16:53:22 +02:00
DennisOSRM c5ebef3499 pulling in changes to add up distances in doubles 2012-10-04 16:53:13 +02:00
Emil Tin 8e756a2476 tests for cycleways 2012-10-04 15:00:46 +02:00
Emil Tin 5e1dc11000 fix a few tests 2012-10-04 14:39:59 +02:00
DennisOSRM bcddc10b6b Updateing how the access hierarchy is parsed in the car profile. Thx
@EmilTin
2012-10-04 14:18:39 +02:00
Emil Tin 8e31b8860c more access tests combinations and other modes 2012-10-04 12:07:38 +02:00
Emil Tin 794c3490fe add test for acces hierachy on nodes 2012-10-04 11:38:29 +02:00
Emil Tin 216157e00d simply access hierachy test, add tests for implied access 2012-10-04 11:30:29 +02:00
Emil Tin 8e6b7766a1 parse access tag hierachy in bike profile 2012-10-04 08:36:14 +02:00
Emil Tin c1a08af00d revert changes to car profile 2012-10-04 08:33:52 +02:00
Emil Tin 59025ca2da add tests for hierachy of access tags 2012-10-03 22:56:41 +02:00
Emil Tin 17fab42f25 fix signal penalty test 2012-10-03 19:22:36 +02:00
Emil Tin 4b00557fda better handling of access and barrier tags 2012-10-03 19:14:44 +02:00
Emil Tin 30465f08ac make distance tests without +- work 2012-10-03 09:49:45 +02:00
Emil Tin 6fb2a41a0a adding a simple 100m distance test 2012-10-03 08:52:40 +02:00
Emil Tin b70b74080e updates distance test, not using 10m steps anymore 2012-10-03 08:37:36 +02:00
Emil Tin 230fec9cdb add distance test with lots of small segments 2012-10-02 21:16:42 +02:00
DennisOSRM 17ca6b1e07 implementing #463 2012-10-02 19:11:43 +02:00
DennisOSRM 628f40f822 Removed rounding travelled distance 2012-10-02 18:09:08 +02:00
Emil Tin 0994a7a20d Only dead-end oneways doesn't return error -1 anymore, fix test 2012-10-02 16:11:56 +02:00
Emil Tin 66ff69355d use way type for unnamed strets in car profile 2012-10-02 16:08:50 +02:00
DennisOSRM 04f71e65ee Readding --march-native flag 2012-10-02 14:52:30 +02:00
DennisOSRM 2b0e46caf2 Merge branch 'develop' of https://github.com/DennisOSRM/Project-OSRM into develop 2012-10-02 14:41:56 +02:00
DennisOSRM 549ce9a4d4 checking equality of edges by end and start coord. 2012-10-02 14:40:40 +02:00
Emil Tin 50d3c2c9d1 improve test for maxspeed 2012-10-02 13:46:40 +02:00
Emil Tin 82caa357cd update test for maxspeed to use motorway speed 2012-10-02 13:41:13 +02:00
Emil Tin 217fc4a0ae update planetery test to use meters 2012-10-02 13:36:48 +02:00
Emil Tin ed8bc7ae58 fix grid city periphery test 2012-10-02 13:36:48 +02:00
DennisOSRM 87ff3f9b9b Moving check of input data to node-based graph instead of edge-expanded
graph. Makes more tests pass.
2012-10-02 12:12:42 +02:00
DennisOSRM 1bef65bf2c Fixing corner case on lookup of nearest neighbor 2012-10-02 12:11:39 +02:00
DennisOSRM b39507efc8 Doing better checks to avoid unintended U-Turns 2012-10-02 12:09:34 +02:00
Emil Tin 263409ed91 fix problem with meters and empty cells in tests 2012-10-01 18:30:32 +02:00
Emil Tin 7610af3378 distances must be specified in meters in tests 2012-10-01 18:13:44 +02:00
Emil Tin 97f04eae91 rewrite tests for access=destination 2012-10-01 16:18:36 +02:00
Emil Tin a14db578e2 move cucumber.yml info config/ 2012-10-01 16:18:36 +02:00
DennisOSRM 62f31f3e2d Fixing corner case in contractor which may have lead to an incorrect
path with correct distance. Thx @DennisSchiefer
2012-10-01 16:15:55 +02:00
DennisOSRM db9292ee86 Fixes issue #203 2012-10-01 14:55:30 +02:00
Emil Tin 1ad274ed2e more reorganizing of tests 2012-10-01 13:33:47 +02:00
Emil Tin 57d6af5486 update barrier tests 2012-10-01 12:36:06 +02:00
Emil Tin 8b482e433a cucumber config file, so you can run test in sub dirs 2012-10-01 12:36:06 +02:00
Emil Tin d4352b84ac reorganizating tests into car/bike/foot 2012-10-01 12:36:06 +02:00
Emil Tin b23a89d5a8 simplify barrier tests 2012-10-01 12:36:06 +02:00
Emil Tin 681d05f8f4 minor updates of weight tests 2012-10-01 12:36:06 +02:00
Emil Tin 81b9e3b4cb test access tags 2012-10-01 12:36:06 +02:00
DennisOSRM 2798c5a48d Fixes issue #461 and cucumber tests 2012-10-01 10:52:56 +02:00
Project OSRM 77c9f96f44 Merge pull request #460 from ibikecph/cuke_barriers
testing of barrier nodes
2012-09-29 02:49:00 -07:00
Emil Tin 098454c875 testing of barrier nodes 2012-09-29 11:32:53 +02:00
Project OSRM 6f00e8c936 Merge pull request #459 from ibikecph/cuke_cache_names
add scenario names to cache files, makes it easier to inspect .osm files...
2012-09-28 13:14:54 -07:00
Project OSRM 3c32cafc9c Merge pull request #458 from ibikecph/cuke_grid_city
add tests using a grid of ways
2012-09-28 13:14:03 -07:00
Emil Tin 585558a9ae add scenario names to cache files, makes it easier to inspect .osm files in JOSM 2012-09-28 21:23:13 +02:00
Emil Tin 6635d239b0 add tests using a grid of ways 2012-09-28 20:57:16 +02:00
Project OSRM f14c76dbca Merge pull request #457 from ibikecph/cuke_penalty_pass
fix penalty test, now passing
2012-09-28 08:37:34 -07:00
Emil Tin 0fb747834b fix penalty test, now passing 2012-09-28 17:30:53 +02:00
Project OSRM 11175748bb Merge pull request #456 from ibikecph/cuke_signal_7s
Cuke signal 7s
2012-09-28 08:11:04 -07:00
Emil Tin 49b7fffd66 fix signal penalty scenario 2012-09-28 16:52:58 +02:00
Emil Tin e69777d20a use 7s as signal penalty 2012-09-28 16:47:44 +02:00
DennisOSRM dde4a496f6 Use seconds for penalties 2012-09-28 16:38:52 +02:00
Project OSRM 48cb43cc79 Merge pull request #454 from ibikecph/cuke_signal_penalty
clean up signal penalty test
2012-09-28 07:04:23 -07:00
Project OSRM 4229b22f86 Merge pull request #453 from ibikecph/cuke_move_bearing_test
move bearing test into right file
2012-09-28 07:04:14 -07:00
Project OSRM 958e28050e Merge pull request #452 from ibikecph/cuke_bad_data
add test for process error codes
2012-09-28 07:02:56 -07:00
Emil Tin eae9e4bab7 clean up signal penalty test 2012-09-28 15:58:46 +02:00
Emil Tin c6dfc7723b move bearing test into right file 2012-09-28 15:41:52 +02:00
Emil Tin 334f02d7f8 add test for process error codes 2012-09-28 15:29:13 +02:00
DennisOSRM 4c02542dc5 removing some debug output 2012-09-28 12:29:46 +02:00
Project OSRM 84ffec81ec Merge pull request #451 from ibikecph/testbot
testbot profile and update of time tests
2012-09-28 01:59:11 -07:00
DennisOSRM 3673b1a324 Fixing cucumber test cases "Scenario: Latitudinal distances at longitude
x", also relates issues #412, #425 and probably some more.
2012-09-28 10:58:29 +02:00
Emil Tin 8cd28276ea testbot profile and update of time tests 2012-09-28 10:53:27 +02:00
DennisOSRM 2185bb3327 Parsing duration of ferries before further computation 2012-09-28 09:28:57 +02:00
DennisOSRM 2d64dca565 Fixes cucumber test features/uturn.feature:4 2012-09-27 19:47:26 +02:00
DennisOSRM fad13506a7 Simplified retrieval of packed path 2012-09-27 19:46:44 +02:00
Project OSRM ffed740fdf Merge pull request #450 from ibikecph/cuke_nearest_range
test checking the range of nearest edge search
2012-09-27 08:14:51 -07:00
Emil Tin c0eb1d6967 test checking the range of nearest edge search 2012-09-27 17:12:05 +02:00
Project OSRM e2b208280e Merge pull request #449 from ibikecph/cuke_origin
move cuke origin to 1,1, add origin tests
2012-09-27 07:47:42 -07:00
Emil Tin f9279a3646 move cuke origin to 1,1, add origin tests 2012-09-27 16:31:09 +02:00
DennisOSRM e0ff8894a2 Merge branch 'master' of https://github.com/DennisOSRM/Project-OSRM 2012-09-27 15:05:53 +02:00
Project OSRM c97d00c399 Merge pull request #448 from ibikecph/cuke_poles
Cuke poles
2012-09-27 05:58:23 -07:00
DennisOSRM c16c2adeda Fixes cucumber test features/bad.feature:15 2012-09-27 14:55:48 +02:00
Emil Tin c4326ffd0b adding nodes to make tests work 2012-09-27 14:48:29 +02:00
Emil Tin 85369d6310 test for nodes too close to the poles 2012-09-27 14:26:47 +02:00
DennisOSRM bd6f2db1d1 Ignore nodes with latitude values outside of mercartor projection 2012-09-27 14:10:25 +02:00
DennisOSRM 02c11caf7f Removing unneeded files 2012-09-27 13:51:56 +02:00
DennisOSRM 0d087fcbce Fixes failing cucumber test features/ferry.feature:4
Scenario: Use a ferry route
2012-09-27 13:49:49 +02:00
Project OSRM 9a3735aa21 Merge pull request #445 from ibikecph/cuke_winding_distances
test showing problems with total distance on winding segments
2012-09-27 04:28:26 -07:00
Emil Tin 63229c9b3a test showing problems with total distance on winding segments 2012-09-27 13:24:23 +02:00
Project OSRM 17bc61767b Merge pull request #444 from ibikecph/cuke_car_access_road
update test, dont route cars on ways with type road, since it means uncl...
2012-09-27 04:12:24 -07:00
Emil Tin 5ec198b761 update test, dont route cars on ways with type road, since it means unclasified 2012-09-27 12:53:13 +02:00
Project OSRM 8e15a32229 Merge pull request #443 from ibikecph/move_profiles
clean up duplicated lua profiles
2012-09-27 03:12:57 -07:00
Emil Tin 3c903ddffd clean up duplicated lua profiles 2012-09-27 11:35:56 +02:00
Project OSRM 28f8edf459 Merge pull request #442 from ibikecph/cuke_revive_uturn
revive deleted uturn test
2012-09-27 02:12:16 -07:00
Emil Tin dc029ebefd revive deleted uturn test 2012-09-27 11:07:41 +02:00
Project OSRM bb09cac7f4 Merge pull request #441 from ibikecph/lua_bike_oneways_and_names
update bike profile - oneways and way names
2012-09-27 00:59:36 -07:00
Project OSRM 937a3f88a4 Merge pull request #429 from ibikecph/cuke_distances
Cuke distances
2012-09-27 00:59:18 -07:00
Project OSRM 352ee956cd Merge pull request #427 from ibikecph/cuke_uturn
cucumber tests showing spurious u-turn
2012-09-27 00:58:46 -07:00
DennisOSRM a735d467bf Fixes issue #430 2012-09-27 09:16:48 +02:00
Emil Tin 71d148caa8 update bike profile - oneways and way names 2012-09-27 08:46:36 +02:00
DennisOSRM 01dc1af5f4 Fixes issue #432 2012-09-26 18:16:15 +02:00
DennisOSRM dccb9f2424 Fixes issues #434 and #431 2012-09-26 17:32:09 +02:00
DennisOSRM df819d20b5 SConstruct finds libluabind-dev on more linux distros 2012-09-26 12:18:27 +02:00
DennisOSRM 518ea7ed01 Partially fixing issues #425, #412 and probably some more 2012-09-26 12:13:13 +02:00
Emil Tin 8abbe8db4a dont quantize distance to 10m, use double for summation 2012-09-22 11:01:05 +02:00
Emil Tin e36a517e86 +-1m in distance tests, remove huge scale tests 2012-09-21 19:55:55 +02:00
Emil Tin 7e5d5a6d90 test compass and bearing as well 2012-09-21 16:07:53 +02:00
Emil Tin 51c0b129c9 cucumber tests showing spurious u-turn 2012-09-21 15:41:51 +02:00
Project OSRM 96ba31cc2b Merge pull request #423 from ibikecph/cuke_lua
update cucumber test to work with lua profiles
2012-09-20 02:25:14 -07:00
Emil Tin 74cc50f52b update cucumber test to work with lua profiles 2012-09-19 19:01:11 +02:00
DennisOSRM 75cd287ab0 Partially fixes issue #420 2012-09-19 17:06:35 +02:00
DennisOSRM 09088e71b5 Fixes building on Mac, issue #421 2012-09-19 15:19:02 +02:00
DennisOSRM 6228c2c89b Removing luajit dependency and adding additional functionality 2012-09-19 14:38:04 +02:00
DennisOSRM 44b625520b Fixing warning detected by additional compiler flags 2012-09-19 14:17:14 +02:00
DennisOSRM 1c415933da Fixing comparison of floats 2012-09-19 14:01:06 +02:00
DennisOSRM ac588911ba Fixing warning detected by additional compiler flags 2012-09-19 13:48:04 +02:00
DennisOSRM c14ceff9b3 Additional compiler flags used 2012-09-19 13:43:30 +02:00
DennisOSRM e3062cf3a2 Removing unused parameters, fixing signed-unsigned comparisons 2012-09-19 13:28:37 +02:00
DennisOSRM b448177278 Removing unused parameter 2012-09-19 12:02:50 +02:00
DennisOSRM bcc7c41140 Fixing signed-unsigned comparisons 2012-09-19 11:55:00 +02:00
DennisOSRM 71d184c39b removing old style casts and unused parameters and fixed unsafe float
comparisons
2012-09-19 11:46:41 +02:00
DennisOSRM 5423cff7a8 Removing old style cast 2012-09-19 11:25:51 +02:00
DennisOSRM aeb701f52e removing unused parameters 2012-09-19 11:18:24 +02:00
DennisOSRM b16db9fe68 Replacing old style casts and unsafe float comparison 2012-09-19 11:16:45 +02:00
DennisOSRM 2faf9ad1b6 Proper initialization of shared_ptr by boost::make_shared 2012-09-19 09:29:03 +02:00
Dennis Luxen a8a0d1b216 Removing superflous line 2012-09-18 23:39:27 +02:00
Dennis Luxen aef6d1795e Partially fixes #421 2012-09-18 23:36:57 +02:00
DennisOSRM ae8dfcb55e Iterator based CRC32 computation. Fixes issues #388, #414 and
potentially a few other.
2012-09-17 15:41:58 +02:00
DennisOSRM 9e6ac95e4f Output of used CRC32 method more verbose 2012-09-17 15:38:02 +02:00
DennisOSRM 7965e29d49 Changing names of routes according to @DennisSchiefer's suggestions. 2012-09-17 10:24:50 +02:00
DennisOSRM 6d823c62f4 Merge branch 'develop/APIParsingByGrammar' of
https://github.com/DennisOSRM/Project-OSRM into
develop/APIParsingByGrammar

Conflicts:
	Plugins/RouteParameters.h
	Server/APIGrammar.h
2012-09-13 17:19:57 +02:00
DennisOSRM cc72409980 Renaming utility function to set the name of the used routing service
(plugin)
2012-09-13 14:34:52 +02:00
DennisOSRM beadb241a8 Fixing hint ordering for via routes 2012-09-13 14:34:52 +02:00
DennisOSRM 86dbcc8df2 Make hello world plugin more verbose to allow testing 2012-09-13 14:34:52 +02:00
DennisOSRM 4a89cfee3d API calls now get parsed through a grammar using boost::spirit::qi 2012-09-13 14:34:51 +02:00
DennisOSRM 837e91f56d Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-09-13 14:12:55 +02:00
DennisOSRM 8050fec64f Forgotten file to checking. Complete removal of speedprofile.ini and
further adaption of profile.lua
2012-09-13 14:12:44 +02:00
DennisOSRM 3e0b4ee1e5 Complete removal of speedprofile.ini and further adaption of
profile.lua
2012-09-13 13:59:46 +02:00
DennisOSRM eac900c6b8 Routes are now identifiable by their two most important instruction
segments.
2012-09-13 11:32:07 +02:00
DennisOSRM 117e8380e2 Fixing hint ordering for via routes 2012-09-12 15:35:21 +02:00
DennisOSRM 69f1bfb337 Make hello world plugin more verbose to allow testing 2012-09-12 15:15:21 +02:00
DennisOSRM b78e9ce02c API calls now get parsed through a grammar using boost::spirit::qi 2012-09-12 15:01:37 +02:00
DennisOSRM 3fd2725122 Fixes issue #400 2012-09-11 15:43:52 +02:00
DennisOSRM 6f7cb3d9f2 Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-09-11 15:17:30 +02:00
DennisOSRM db0bb3d749 Fixes issue #406 2012-09-11 15:16:35 +02:00
Project OSRM e055211960 Merge pull request #395 from emiltin/cuke_lat_lon
cucumber test with specific lat/lon coordinates
2012-08-31 08:04:10 -07:00
Emil Tin 1b581b1c17 cucumber test with specific lat/lon coordinates 2012-08-31 16:54:46 +02:00
DennisOSRM d335e7d5e7 Updateing UI 2012-08-31 15:55:46 +02:00
DennisOSRM f5857da6f4 Fixes issue #394 2012-08-31 13:00:33 +02:00
DennisOSRM aad484b7f7 Minor code cleanup 2012-08-31 11:13:42 +02:00
DennisOSRM b3ae4f5c7b Fixes issue #189 2012-08-31 10:36:08 +02:00
Project OSRM 428783e183 Merge pull request #378 from emiltin/cuke_time_more_scales
add test at more grid scales
2012-08-31 01:20:37 -07:00
Project OSRM d26d3bb574 Merge pull request #393 from emiltin/cuke_ranges
add fuzzy range options to cucumber tests
2012-08-31 00:47:56 -07:00
DennisOSRM 7bd4e213c2 Fixes issue #392 2012-08-31 09:46:23 +02:00
DennisOSRM bdcbb8670c Tweaks to SConstruct 2012-08-31 09:42:16 +02:00
DennisOSRM 3edf4799d3 Fixes plain old XML parsing. 2012-08-31 09:40:17 +02:00
Emil Tin 62c12e7473 add fuzzy range options to cucumber tests 2012-08-31 08:10:55 +02:00
DennisOSRM e0f51dd5e9 Fixes issue #366 2012-08-30 18:58:42 +02:00
DennisOSRM 7222231abf Removing unnecessary defines 2012-08-30 18:58:19 +02:00
DennisOSRM 91080f0690 Further code cleanup 2012-08-30 17:34:06 +02:00
DennisOSRM 4c2c1f519c Minor code cleanup 2012-08-30 17:01:54 +02:00
DennisOSRM 0eb5d8db4e Removing unneeded dependencies 2012-08-30 17:00:32 +02:00
DennisOSRM e43d27e86d Implements way parsing through LUA scripting engine, implements issue #1 2012-08-30 16:59:41 +02:00
DennisOSRM 87df312a9d Removing Adress data type that is not needed during extraction 2012-08-29 18:43:08 +02:00
DennisOSRM 1412c5db42 Removal of v8 as it sucked big time during integration and first
(partially) working parsing with LUA as the scripting engine.
2012-08-29 18:33:18 +02:00
DennisOSRM 4c58674393 First steps towards integrating libv8 2012-08-28 11:50:23 +02:00
DennisOSRM 1fdfac4aaf Refactoring extraction stuff 2012-08-27 17:40:59 +02:00
DennisOSRM e1fe363268 Added v8 library as a depency for the extractor 2012-08-27 16:31:24 +02:00
DennisOSRM a127c705f2 backport of resize implementation 2012-08-27 16:16:59 +02:00
DennisOSRM 827b9e4be2 Removing an unnecessary sorting step. 2012-08-22 18:44:14 +02:00
DennisOSRM 417fcde9db Using DeallocatingVector class instead of doing vector-swap-tricks 2012-08-22 17:36:30 +02:00
DennisOSRM 818c66e774 Fixes issue #334 (partially) 2012-08-22 16:46:47 +02:00
DennisOSRM f69076f55c Using back reference instead of iterator arithmetic 2012-08-22 16:20:13 +02:00
Emil Tin ebafd25e77 add test at more grid scales 2012-08-21 19:23:57 +02:00
Project OSRM b055334e73 Merge pull request #377 from emiltin/cuke_row_check
add two scenarios to check row-type test mechanism
2012-08-21 09:54:16 -07:00
DennisOSRM f112f944aa Fixes issue #364 2012-08-21 18:46:46 +02:00
Emil Tin 62951f3ab9 add two scenarios to check row-type test mechanism 2012-08-21 18:43:15 +02:00
Project OSRM 3e25f85eb6 Merge pull request #376 from emiltin/cuke_spacing
readjust spacing to avoid risk of overflow
2012-08-21 09:11:41 -07:00
Project OSRM e544233abb Merge pull request #375 from emiltin/access_test_profiles
update test speedprofiles to use new accessTags
2012-08-21 09:11:33 -07:00
Emil Tin d6fd898101 readjust spacing to avoid risk of overflow 2012-08-21 18:02:36 +02:00
Emil Tin ad610ac904 update test speedprofiles to use new accessTags 2012-08-21 17:45:33 +02:00
Project OSRM 70c4b293ce Merge pull request #374 from emiltin/cuke_spacing
larger spacing when testing individual ways, avoids picking wrong one
2012-08-21 07:51:40 -07:00
Emil Tin 41e7dbf205 larger spacing when testing individual ways, avoids picking wrong one 2012-08-21 16:44:30 +02:00
DennisOSRM 2901e6891c Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-08-21 16:35:08 +02:00
DennisOSRM a911089913 Checking if input graph is empty 2012-08-21 16:34:56 +02:00
Project OSRM ac1925d4b9 Merge pull request #373 from lonvia/access-control
Extended access tag configuration
2012-08-21 07:34:25 -07:00
DennisOSRM 5d2c2a3107 Don't preprocess an empty graph. 2012-08-21 16:02:28 +02:00
DennisOSRM bab2c80857 Fixes 'ferry' test 2012-08-21 15:24:26 +02:00
DennisOSRM d3d90e10a5 Fixes issue #372 2012-08-21 15:23:27 +02:00
Project OSRM 4336931f46 Merge pull request #372 from emiltin/cuke_hangs
scenario that hangs on mac
2012-08-21 06:17:47 -07:00
Sarah Hoffmann 58dfd29a3a adapt speed profiles to extended access control 2012-08-20 21:13:54 +02:00
Sarah Hoffmann 66c23b5843 extended access handling
This adds a few more configuration options for a more flexible access
tag handling:

accessTags -
  replaces accessTag and is an ordered list of access tags to take into
  account. The first tag in the list found will determine the access.
  This allows to model OSM's access hierarchy where a more specific
  access tag might override a more general one.
accessForbiddenKeys -
  unordered list of values that disallow access (similar to
  accessRestrictionKeys). Replaces hardcoded values in extractor.
accessForbiddenDefault -
  unordered list of highway types where access is forbidden unless an
  explicit positiv access tag is given. Replaces the current track
  hack.
2012-08-20 21:13:54 +02:00
Emil Tin ea1fb0a078 scenario that hangs on mac 2012-08-20 19:12:54 +02:00
DennisOSRM 0381e0dd9d Const'ing a member function 2012-08-14 15:04:09 +02:00
DennisOSRM 595579a6c2 Partially fixes issue #339 2012-08-14 14:31:45 +02:00
DennisOSRM 2143df2e4f Removed non-informative console output 2012-08-14 13:44:34 +02:00
Project OSRM c86060f5bb Merge pull request #367 from karme/missinginitializer
missing initializers
2012-08-14 04:33:47 -07:00
DennisOSRM 4f2e9e8442 Implementing issue #272 2012-08-13 18:11:46 +02:00
DennisOSRM 411803919d Implements issue #324. Thanks tyrasd. 2012-08-13 17:31:46 +02:00
DennisOSRM ebc3d09f0f Segment duration is now given in second and not tenths of a second.
Partially fixes issue #355
2012-08-13 17:08:23 +02:00
Jens Thiele c2ab16f984 missing initializers 2012-08-13 16:47:24 +02:00
DennisOSRM 3f3da4ee0b Implements issue #352 2012-08-13 16:42:55 +02:00
DennisOSRM 922c218394 Fixing a bug that crashed the daemon once in a while. 2012-08-13 15:40:22 +02:00
DennisOSRM d5cb1fa15f Fixed a bug in the computation of routes. Fixes issue #334 and other.
Thanks apmon
2012-07-25 19:11:58 +02:00
DennisOSRM 2cf175cf91 Removing access restriction hacks. 2012-07-25 18:32:32 +02:00
DennisOSRM 0276cf579a Marking default constructor in iterator as private 2012-07-23 16:12:22 +02:00
DennisOSRM 5dd1211f46 struct was not packed and therefore allocated four excess bytes per
edge-expanded node.
2012-07-16 14:12:17 +02:00
Project OSRM 1b98bd2c68 Merge pull request #338 from 2bits/darwinLibzip
SConstruct: find Libzip on Darwin, Thanks 2bits
2012-07-16 04:44:24 -07:00
DennisOSRM 7261ce3b7f Clearing vectors as soon as data is not needed anymore. 2012-07-16 13:20:56 +02:00
nibbles 2bits 80a9317d8b SConstruct: find Libzip on Darwin
Add a `pkg-config` statement for Darwin in SConstruct to help
scons find the Libzip includes.  Patch from Homebrew.  Fixes
compile error with llvm-gcc.

Fixes #274
2012-07-13 17:19:16 -07:00
DennisOSRM 7467e11147 Exploration of tiny components. 2012-07-13 17:01:21 +02:00
DennisOSRM 6f78bd7a85 Fixes issue #331 2012-07-11 10:44:11 +02:00
DennisOSRM 03276ad386 Fast-forwarding git submodule 2012-07-11 09:38:47 +02:00
DennisOSRM 9c1caba2fa Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-07-10 14:54:26 +02:00
DennisOSRM 5ef3b12673 Fixed missing initialization that gave wrong indication of alternative
routes
2012-07-10 14:51:35 +02:00
DennisOSRM cf1e2fa930 Removed two dead storage bugs. Thanks to LLVMs very useful scan-build
static code analyzer.
2012-07-10 13:47:04 +02:00
DennisOSRM 14e110178a SConstruct now scan-build friendly 2012-07-10 13:46:14 +02:00
DennisOSRM 4e2650d6e7 Fixing missing include 2012-07-10 11:56:40 +02:00
DennisOSRM f60f676563 Cache-Aware preprocessing with less space requirements 2012-07-10 11:50:41 +02:00
DennisOSRM 7fddfd7a54 Fixes a bug caused by name changes in boost::filesystem library.
Workaround added if only V2 is avalailable. Fixes issue #327 and Rashers
complaint.
2012-07-09 21:56:27 +02:00
DennisOSRM fd88aba8a1 Implementation for issue #306 2012-07-02 19:09:13 +02:00
DennisOSRM f95c040bed Fixed some missing initializations. 2012-07-02 16:36:25 +02:00
DennisOSRM 459ebc7508 Bumping required boost version to 1.44 2012-07-02 16:01:18 +02:00
DennisOSRM 9b17543021 Fixes issue #306 2012-07-02 16:00:20 +02:00
DennisOSRM 1326c5a01f Removed all header file includes from typedef.h 2012-07-02 16:00:00 +02:00
DennisOSRM f01670db80 Reordering initializations 2012-06-29 15:32:22 +02:00
DennisOSRM bddac87321 Use libosmpbf instead of self-supplied PBF format definitions 2012-06-27 19:00:58 +02:00
DennisOSRM 176fa301d3 Merge branch 'develop/AlternativeRoutes' 2012-06-27 13:36:00 +02:00
DennisOSRM f2ce4f0ff1 Better checks for parallel edges, thanks @DennisSchiefer 2012-06-27 13:13:18 +02:00
DennisOSRM a1affa6330 Reducing cache misses during contraction 2012-06-25 11:12:59 +02:00
DennisOSRM 2c14d34f59 Code cleanup for alternative route computation 2012-06-21 12:27:43 +02:00
DennisOSRM 4a299fd4ff Output cleanup for case when no alternative is found 2012-06-21 12:26:46 +02:00
DennisOSRM cfec837278 Unpacking via path from correct queues and not from the upperbound
upward
paths.
2012-06-20 13:11:44 +02:00
DennisOSRM 1bf5ca2bec Fixing a signed-unsigned comparison 2012-06-20 13:10:38 +02:00
DennisOSRM 61efd41194 Implemented T-Test and output of route options 2012-06-19 17:26:34 +02:00
DennisOSRM 5ebc4b392f half-implemented local optimality test for single via node alternative
routes. Partial unpacking working, but actual test not yet conducted.
2012-06-18 18:51:48 +02:00
DennisOSRM 4236f92de2 Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-06-15 18:48:21 +02:00
DennisOSRM 7f0d40f459 First (buggy) implementation of single via node alternative routes.
Proof of concept which is imcomplete.
2012-06-15 18:47:27 +02:00
Project OSRM 6918c7fe1f Fixes issue #294 2012-06-13 10:51:54 +03:00
DennisOSRM fa62f70cdf Implementation of copy-insert of LRU cache 2012-06-12 13:25:38 +02:00
DennisOSRM 8ddb3fc6ad Implements feature request from issue #256 2012-06-11 17:36:41 +02:00
DennisOSRM df68c3ad48 Bearing is reported as integer only, fixes cucumber tests for issue #292 2012-06-11 16:36:33 +02:00
DennisOSRM b7bcc401e7 Print user agent into log 2012-06-08 10:12:42 +02:00
DennisOSRM 82ead0a405 Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-05-31 14:50:08 +02:00
DennisOSRM 5ff2fc9250 Fixes issue #259 2012-05-31 14:09:40 +02:00
DennisOSRM bbad30c6e0 Fixes issue #259 2012-05-31 14:01:51 +02:00
DennisOSRM a962deaffd Reordering initilizations 2012-05-31 13:27:44 +02:00
Project OSRM b353df83ee Merge pull request #264 from emiltin/cuke_bearing
cuke_bearing
2012-05-30 00:20:45 -07:00
Project OSRM 134c02a762 Merge pull request #280 from emiltin/cuke_protobuffer
convert to protobuffer before loading into osrm
2012-05-30 00:20:21 -07:00
Emil Tin 63c6c06436 convert to protobuffer before loading into osrm 2012-05-25 14:13:00 +02:00
Project OSRM 1b52f67e5d Merge pull request #275 from DennisOSRM/develop/hashBias
Develop/hash bias
2012-05-25 02:51:30 -07:00
DennisOSRM e29b19805c Moving XOR-FastHash to its own File 2012-05-25 11:41:52 +02:00
DennisOSRM 7194fe02d1 XORFastHash is now symmetric 2012-05-25 10:14:53 +02:00
DennisOSRM 863b9829ca Adding new Container 2012-05-23 21:22:33 +02:00
DennisOSRM 666371099e Independent set tie-breaker in O(1) space and time 2012-05-23 21:18:38 +02:00
DennisOSRM 0388860ea1 Fixes issue #270 2012-05-22 10:21:33 +02:00
DennisOSRM eb90be2ec3 Updateing Web UI to version 0.1.6 2012-05-18 14:41:16 +02:00
DennisOSRM 0d0a27d1c2 Re-adding sorting in NNGrid construction 2012-05-16 15:01:52 +02:00
DennisOSRM 56c81dd890 Minor infix prefix change. 2012-05-15 16:45:46 +02:00
DennisOSRM 00502e0476 Packed struct saves four bytes for each edge-expanded graph edge 2012-05-15 16:44:29 +02:00
DennisOSRM 2eb251bd7f Updated protobuffer files to newest version. 2012-05-15 16:43:52 +02:00
DennisOSRM cbddbb598f Limit length of timestamp to 15 characters 2012-05-15 16:43:25 +02:00
DennisOSRM bb5b6fef26 Removing empty line 2012-05-15 16:42:54 +02:00
DennisOSRM 4eb379a912 Print all end/via/start points 2012-05-15 16:42:31 +02:00
DennisOSRM 6769f83d5b Load timestamp string from file 2012-05-15 14:28:13 +02:00
DennisOSRM 358f12d910 Adding optional timestamp information 2012-05-15 14:14:09 +02:00
DennisOSRM fe35fefc75 Reserving additional 20% in edge-based graph factory per resize. 2012-05-15 11:40:41 +02:00
Emil Tin 5ed9c41d5e cuke_bearing 2012-05-14 22:06:56 +02:00
DennisOSRM 9776158cac Add dummy plugin to produce the timestamp of the latest consumed
minutely change set
2012-05-14 18:32:34 +02:00
DennisOSRM 486eed4875 Using memcpy to copy bytes instead of hard-coded loops. Allows compilers
to apply more magic
2012-05-14 13:48:48 +02:00
DennisOSRM f6225c0baa Parse ignoreAreas from ini file 2012-05-14 13:25:16 +02:00
DennisOSRM db2047264c Ignore areas when set so in speedprofile.ini 2012-05-14 12:01:45 +02:00
DennisOSRM 68f0cb7684 Route geometry compressed by default. 2012-05-14 11:38:29 +02:00
DennisOSRM 57b3f42b03 Freeing more memory in contractor during retrieval of edges. 2012-05-11 15:33:31 +02:00
DennisOSRM a0a0caad38 Moving repeated hashmap construction to outer loop 2012-05-11 15:32:30 +02:00
DennisOSRM 30e76b4a32 Reordering members of utility struct 2012-05-11 15:11:13 +02:00
DennisOSRM b474d7ec77 Fast-Forwarding web client to newest version 2012-05-10 11:40:37 +02:00
DennisOSRM ad3ec9d856 Removing debug output 2012-05-10 11:40:12 +02:00
DennisOSRM 9f63e5da96 Telling user next command in the tool-chain 2012-05-10 11:23:46 +02:00
DennisOSRM 2e878d8f2e removing debug output 2012-05-09 21:12:54 +02:00
DennisOSRM bfaab86330 Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-05-09 21:06:35 +02:00
DennisOSRM 78b4d715d5 Less I/O during query in NN Grid 2012-05-09 21:02:42 +02:00
DennisOSRM 6dfea376ee const'ing variable 2012-05-09 21:01:09 +02:00
DennisOSRM f0188c428f Removing some debug output 2012-05-08 19:46:01 +02:00
DennisOSRM 2987b1d425 Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-05-08 13:13:33 +02:00
Project OSRM 86128892d7 Merge pull request #245 from emiltin/cuke_profiles
speedprofiles specifically for testing
2012-05-08 02:17:27 -07:00
Project OSRM a8bdc59d5a Merge pull request #244 from emiltin/cuke_rake_edges
use .osrm.edges file in Rake task and cucumber tests
2012-05-08 02:16:47 -07:00
DennisOSRM ac6ba24861 Fixes issue #253 2012-05-08 11:14:48 +02:00
DennisOSRM 5b247a3699 Removing unnecessary over-allocation 2012-05-08 11:12:53 +02:00
Emil Tin 580a760aa1 speedprofiles specifically for testing 2012-05-05 17:05:55 +02:00
Emil Tin f5da6a0e5f use .osrm.edges file in Rake task and cucumber tests 2012-05-05 16:12:58 +02:00
DennisOSRM a394973762 Merging 4f73b47 into master 2012-05-04 22:25:56 +02:00
DennisOSRM 4f73b4725a Chopping off another 1.6ms from every nearest neighbor query. 2012-05-04 16:17:46 +02:00
Project OSRM 71b90ab216 Merge pull request #242 from DennisOSRM/develop/enhancedNearestPlugin
Develop/enhanced nearest plugin
2012-05-04 05:56:47 -07:00
DennisOSRM c4f213f64e Implements issue #173 2012-05-04 14:49:30 +02:00
DennisOSRM cacf8f17d3 First implementation. Needs sanity checks if nothing is found. 2012-05-03 23:48:20 +02:00
DennisOSRM 819c1729f1 Fixing an invalid read when contracting rather small graphs. Partially
fixes issue #218
2012-05-03 23:11:52 +02:00
DennisOSRM 765b1cb3a5 Handling default case in switch statement that should never happen. 2012-05-03 20:51:33 +02:00
DennisOSRM 908d92fa5c Fixing debug build compilation 2012-05-03 20:49:05 +02:00
DennisOSRM 98ef2e18d4 Forbid any swapping of routing deamon on Linux 2012-05-03 15:21:19 +02:00
DennisOSRM f9e1657dcc Merge branch 'master' into develop/GraphEdgeSeparation 2012-05-03 13:09:29 +02:00
DennisOSRM 0a4aa11d09 Moving verbosity to debug mode 2012-05-03 11:59:58 +02:00
DennisOSRM 200028f328 Note the referrer of the URL 2012-05-03 11:07:53 +02:00
DennisOSRM 276071b179 Updated Web UI 2012-05-02 09:54:59 +02:00
DennisOSRM 26662b7190 Original Edge Data gets written to output stream with buffering 2012-04-27 16:50:34 +02:00
DennisOSRM 8fdfff3014 Chopping off another 4 Bytes per Edge in Contractor by limiting original
Edge Count to 1<<28
2012-04-27 13:45:32 +02:00
DennisOSRM 7e0fb433e4 Forgot one change 2012-04-27 13:22:17 +02:00
DennisOSRM 0b83310100 Reverting some externalizations 2012-04-27 13:20:56 +02:00
DennisOSRM 8c2bd8bd88 Externalized even more of the temporary data structures. 2012-04-26 14:03:01 +02:00
DennisOSRM 44af60563d Downsizing Struct 2012-04-26 13:50:26 +02:00
DennisOSRM bb98bc92ef Moving temporary storage of edge-expanded graph to external memory 2012-04-26 11:19:45 +02:00
DennisOSRM 3c08b89923 more debug output added 2012-04-26 09:59:39 +02:00
DennisOSRM 7baef59b79 Merge remote-tracking branch 'origin/develop/GraphEdgeSeparation' into
develop/GraphEdgeSeparation

Conflicts:
	Contractor/EdgeBasedGraphFactory.cpp
2012-04-25 19:01:58 +02:00
DennisOSRM 6fe580bd75 Undoing wrong merge. Flushing some memory before generation of
edge-expanded graph
2012-04-25 18:56:42 +02:00
DennisOSRM 91d875c157 trivial code change 2012-04-25 18:36:18 +02:00
DennisOSRM 7fa409a72f moving back to vector 2012-04-25 18:32:59 +02:00
DennisOSRM d8927ec5f8 Merge remote-tracking branch 'origin/feature/TrivialContraction' into develop/GraphEdgeSeparation 2012-04-25 18:31:23 +02:00
DennisOSRM 15751ae1a1 Moving to vector 2012-04-25 18:30:38 +02:00
DennisOSRM bda8431d50 Moving to deque 2012-04-25 17:19:08 +02:00
DennisOSRM 492cb727df Merge remote-tracking branch 'origin/develop/GraphEdgeSeparation' into develop/GraphEdgeSeparation 2012-04-25 17:18:18 +02:00
DennisOSRM d4536ba242 Experiments with deque to see if it's more allocation friendly 2012-04-25 17:12:46 +02:00
DennisOSRM 876a551cd8 Experiments with deque to see if it's more allocation friendly 2012-04-25 17:11:14 +02:00
DennisOSRM 41eb07e35b Vector allocation is done in chunks of 10% increase 2012-04-25 16:35:13 +02:00
DennisOSRM 231c593bb3 Tighten sizes of input vectors 2012-04-25 16:29:01 +02:00
DennisOSRM 3b01d785a5 Reading restriction from input file produces packed vector with
size==capacity
2012-04-25 16:23:19 +02:00
DennisOSRM 0c0049f8cc Externalized temporary storage for edge-expanded graph 2012-04-25 16:07:43 +02:00
DennisOSRM d7c44e2bbd Minor code adjustments 2012-04-25 14:21:03 +02:00
DennisOSRM 0504923689 Removing debug output 2012-04-25 11:07:28 +02:00
DennisOSRM 7e47553c88 Further cleanup 2012-04-25 10:57:19 +02:00
DennisOSRM f8761ecea0 Routing datastructure more seperated from data of original edges 2012-04-25 10:51:16 +02:00
DennisOSRM ff0eae40ea Removing include dependencies 2012-04-24 18:00:47 +02:00
DennisOSRM 9d6402aad4 Contract trivial degree two ways. 2012-04-20 18:34:49 +02:00
DennisOSRM 1173ac17ee Fixed serious gzip compression mishap, removed linear complexity at
string length, fixed initialization of zlib stream object
2012-04-20 17:06:09 +02:00
DennisOSRM fed4a83a8f Accept-Encoding: gzip, deflate is getting parsed also when it's the last
header.
2012-04-20 16:19:56 +02:00
DennisOSRM 8343703115 Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-04-17 20:47:24 +02:00
DennisOSRM 85eb59eb40 Exchange east and west. 2012-04-17 20:47:16 +02:00
Project OSRM e11bd5d99f Merge pull request #223 from emiltin/cuke_instruction_codes
osrm now returns codes intread of strings, handle this in tests
2012-04-17 06:28:09 -07:00
Emil Tin f359927b09 osrm now returns codes intread of strings, handle this in tests 2012-04-17 15:22:55 +02:00
DennisOSRM 70825abb1d Fixing wrong turn instruction at roundabouts 2012-04-16 19:27:20 +02:00
DennisOSRM c4dc85f607 Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-04-16 17:42:49 +02:00
DennisOSRM 7e8de26657 Fixing broken merge 2012-04-16 17:41:54 +02:00
DennisOSRM b3570f57ee Merge remote-tracking branch 'origin/feature/Localization' 2012-04-16 17:38:46 +02:00
DennisOSRM 3c62aa02d4 Moving object that holds all query data into seperate object 2012-04-14 20:34:38 +02:00
DennisOSRM 58e88d43a9 Moving object that holds all query data into seperate object. 2012-04-14 20:07:30 +02:00
DennisOSRM 78ade5b7d7 Adding a number of explicit namespace declarations 2012-04-14 18:18:18 +02:00
DennisOSRM 969d5c8558 Removing leftovers of STL parallel mode experiments 2012-04-14 18:01:06 +02:00
DennisOSRM 539199a7e9 Adding a std:: to size_t because it makes the parser more happy 2012-04-14 17:42:09 +02:00
DennisOSRM 60ffe55565 Names vector of strings is now passes as reference 2012-04-14 17:40:59 +02:00
DennisOSRM dd03c6b168 Removing unnecessary STL parallel mode include 2012-04-14 16:19:40 +02:00
DennisOSRM f53c0d7dfa Sequential read of routing graph hastens startup 2012-04-14 15:53:10 +02:00
DennisOSRM 7872354b49 Pushing auto casted char buffer to vector of strings. Shall save one
allocation per street name
2012-04-14 15:43:37 +02:00
DennisOSRM 1ee470f5b4 Setting one char to '\0' instead of memsetting 1k bytes for every string
read
2012-04-14 15:40:19 +02:00
DennisOSRM 04e6ca9763 Trimming excess capacity of string of names 2012-04-14 15:37:39 +02:00
DennisOSRM 80219a31e2 Trim excess capacities 2012-04-14 15:28:45 +02:00
DennisOSRM 0555dc4bc3 Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-04-14 15:07:26 +02:00
DennisOSRM 4401b58f45 Adding a little more verbosity during construction of external memory
data structure
2012-04-14 15:07:02 +02:00
DennisOSRM 8d2d3bd73c Swapping vector with itself in contractor to save a little space 2012-04-14 15:05:51 +02:00
DennisOSRM c7dfed8f29 10% increase in dynamic graph data structur 2012-04-14 15:03:08 +02:00
DennisOSRM 92f9a29de1 Reordering of operations frees some memory earlier 2012-04-14 14:50:25 +02:00
DennisOSRM ff50cfb4da Fixes a type in variable name 2012-04-14 14:38:13 +02:00
DennisOSRM 086e10671f Ref'ed and consted parameters. Gives some extra performance when
creating grid.
2012-04-14 14:36:11 +02:00
DennisOSRM 68c1c0a6a6 Consistently reserve only 10% more in DynamicGraph. 2012-04-14 13:41:04 +02:00
DennisOSRM 811d77eccb Transforming string to lower case in mph detection 2012-04-13 15:42:30 +02:00
DennisOSRM f87450efd6 Expanding mph maxspeed detection 2012-04-13 13:40:19 +02:00
Project OSRM e1a8cad552 Merge pull request #220 from Gnonthgol/master
Parse mph properly on maxspeed tags
2012-04-13 04:28:37 -07:00
DennisOSRM c0141a9744 Fixing mph parsing 2012-04-13 13:27:36 +02:00
Gnonthgol 221de3343a Add a maxspeed parser that can parse mph 2012-04-13 13:17:49 +02:00
DennisOSRM 4c0a54f95f Removing strings of the turn instructions 2012-04-12 19:52:18 +02:00
DennisOSRM 1ce21556a1 Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-04-12 19:36:02 +02:00
DennisOSRM e104017d4c Skipping ContractionCleantup entirely. Avoids a big allocation. Removing
DELETE() macro.
2012-04-12 19:35:47 +02:00
DennisOSRM 8377e411cb Skipping ContractionCleantup entirely. Avoids a big allocation. Removing
DELETE() macro.
2012-04-12 18:53:01 +02:00
Project OSRM b16f3f91d9 Merge pull request #217 from emiltin/cuke_ignore_reached
ignore 'You have reached your destination' when parsing route instructio...
2012-04-12 07:51:27 -07:00
Emil Tin c669d46efb ignore 'You have reached your destination' when parsing route instructions in cucumber tests 2012-04-12 16:47:43 +02:00
DennisOSRM 03deda313a Restructured concurrent FIFO queue to use a circular buffer. Thx to the
guys from last week for asking about such a thing.
2012-04-06 15:07:28 +02:00
DennisOSRM 7983063d05 Reimplemented ConcurrentQueue with a circular buffer from boost library.
Gives about 10% faster raw parsing performance.
2012-04-06 14:33:15 +02:00
Project OSRM e412366bb2 Merge pull request #213 from DennisOSRM/feature/FlushContractor
Feature/flush contractor
2012-04-05 05:06:03 -07:00
DennisOSRM 7035d17290 Pulling in latest changes from web frontend submodule 2012-04-04 13:24:26 +02:00
DennisOSRM b9e0cb6be1 Cleaning up debug outputs 2012-04-04 13:08:13 +02:00
DennisOSRM 0a78a50eff Adding external web project as submodule 2012-04-04 11:52:16 +02:00
DennisOSRM 323bf67037 Removing Docs subdirectory 2012-04-04 11:50:48 +02:00
DennisOSRM 9ffcec2fcb Minor updates for flushing Contractor 2012-04-04 11:11:54 +02:00
DennisOSRM 964c0425bf First working implementation of Contractor flush at 75% of contracted
nodes
2012-04-04 09:55:43 +02:00
DennisOSRM 19208289dc Deleting old web front end. 2012-04-02 13:44:44 +02:00
DennisOSRM a5c5f4c02c First round of changes to have the constractor flush its data structures
at around 75% of the preprocessing. Also, a first try to branches.
2012-03-24 20:15:04 +01:00
Project OSRM 53aede83dc Merge pull request #191 from tabacha/master
Issue #190 add stxxlroot option for SConstruct Default build
2012-03-23 10:42:49 -07:00
DennisOSRM e4080aba05 Fixes issue #202 2012-03-23 17:44:56 +01:00
DennisOSRM 2549f7254a Fixing a minor problem with multiple via nodes. 2012-03-23 11:06:33 +01:00
DennisOSRM 87f4341866 Fixes yesterdays crashes on the routing server where segfaults occured
in a rare scenario with multiple via points.
2012-03-22 13:58:59 +01:00
DennisOSRM 3f6cc725d6 First round of changes for access=destination enhancements. Not yet
fully functional.
2012-03-22 10:25:04 +01:00
DennisOSRM a558f447cf Fixes issue #198 2012-03-22 10:22:23 +01:00
DennisOSRM bd2c99d9ec access=destination and similar tags get parsed by extractor 2012-03-21 15:41:38 +01:00
DennisOSRM 1a224e2adc Changing string splitter function for better efficiency 2012-03-21 14:52:38 +01:00
DennisOSRM c64aaab193 Checkin missing file, fixes issue #197 2012-03-20 23:17:45 +01:00
DennisOSRM 556e487a15 Adding a U-turn penalty for very sharp turns. Fixes #188 and #153 and
also partially fixes #65 and #167
2012-03-20 12:35:52 +01:00
DennisOSRM 30d72543b9 Fixes issue #195 2012-03-19 15:38:02 +01:00
DennisOSRM af0def36c2 Fixing a misplaced min function. Thanks, Gnonthgol 2012-03-19 14:43:59 +01:00
DennisOSRM 6d8f99832f Excluding barrier=cattle_grid 2012-03-19 13:48:01 +01:00
DennisOSRM 6a9b05e126 bollards are ignored if access=yes tag is set at the node. 2012-03-19 13:37:43 +01:00
DennisOSRM c45e2cbb82 Reworking the logic to accept only tracks with access=yes. 2012-03-19 11:49:52 +01:00
Sven Anders 4d0c02de2d Added stxxlroot option for default target 2012-03-18 15:31:08 +01:00
DennisOSRM e43019a1df Adding tracks if they are tagged with access=yes 2012-03-17 19:54:31 +01:00
Project OSRM 4d19793d69 Allowing tracks to be accessed at low avg speed. 2012-03-17 13:19:12 +01:00
Project OSRM 15358a2e72 Update speedprofile.ini 2012-03-17 12:25:46 +01:00
Project OSRM 73f0e6e825 Adding tertiary_link. 2012-03-17 12:23:39 +01:00
DennisOSRM 17738c3861 Destination now shows up in turn instructions 2012-03-16 13:25:23 +01:00
DennisOSRM 3712868831 Fixing a bug with hinting coordinates on one-way streets. 2012-03-16 13:22:51 +01:00
DennisOSRM a0a71d6e05 Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-03-16 12:19:43 +01:00
DennisOSRM 1116608389 Ignoring barrier=no for now. Thanks Derick. 2012-03-16 12:19:10 +01:00
Project OSRM a9b9775fe4 Adding the URL of the demo installation to README 2012-03-15 20:30:17 +01:00
DennisOSRM 75353852fd duration tags on ferry ways get parsed now. Cheers to Mackerski! 2012-03-15 16:39:35 +01:00
DennisOSRM 64ab2da43b Fixes issue #180. 2012-03-14 16:44:43 +01:00
DennisOSRM 6d74ae1b84 Allowing toll_booth's to be bypassed. 2012-03-13 16:03:43 +01:00
Project OSRM 26f3c51cf0 Merge pull request #131 from emiltin/oneway_class_override
make sure oneway:<class> overrides standard oneway tag
2012-03-13 07:58:36 -07:00
Emil Tin b192fb9403 make sure oneway:<class> overrides standard oneway tag 2012-03-10 09:36:52 +01:00
Project OSRM 24e72bc6cc Merge pull request #171 from emiltin/cuke_penalty_tests
tests for signal penalties
2012-03-08 05:33:21 -08:00
Emil Tin 9dfbd5f671 tests for signal penalty. renamed 'given the nodes' to 'given the node map' and introduced new 'given the nodes' to set node tags 2012-03-08 14:10:28 +01:00
DennisOSRM a65339d011 Check that each shortcut is unpackable in debug mode 2012-03-08 11:42:55 +01:00
DennisOSRM 88890a1914 Upper bound for ordinals. Unlikely that any roundabout has more than 10
exits, but again, OSM has unlimited opportunities.
2012-03-08 11:37:41 +01:00
DennisOSRM 3ea1461839 Fixing direction of edges. 2012-03-08 11:35:40 +01:00
DennisOSRM 164e1be018 Disabling CH postprocessing for now. 2012-03-08 11:27:31 +01:00
DennisOSRM fffb9c8a2c Correct counting of node-based edges 2012-03-07 14:08:46 +01:00
DennisOSRM f877788cf1 Changing traffic signal penalty 2012-03-07 12:39:08 +01:00
DennisOSRM 5940e40d22 Moving a variable back to local scope 2012-03-07 10:43:25 +01:00
DennisOSRM 9c894fb8b0 A bit of code cleanup 2012-03-07 10:39:33 +01:00
DennisOSRM 29b30bb69c Moving contractor back to baseline 2012-03-07 08:49:10 +01:00
DennisOSRM 9b340a507b checksum is unsigned not signed 2012-03-07 08:30:51 +01:00
DennisOSRM 0465753bdf Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-03-06 19:27:02 +01:00
DennisOSRM 08ebe94005 Remove duplicate edges. 2012-03-06 19:25:54 +01:00
Project OSRM 7afd6d32b7 Merge pull request #169 from emiltin/cuke_avoid_pbf_roundtrip
osrm-prepare still reads xml, so avoid converting to pfb format during testing
2012-03-06 06:09:34 -08:00
Emil Tin f41495dc7a osrm-prepare still reads xml, so avoid converting to pfb format. avoids dependency on osmosis tool 2012-03-06 15:05:52 +01:00
Project OSRM b253721df4 Merge pull request #168 from emiltin/cuke_updated_api
updated cucumber test to use loc= query params
2012-03-06 05:55:34 -08:00
Emil Tin 8200f889fb updated cucumber test to use loc= query params 2012-03-06 14:50:59 +01:00
DennisOSRM ec9a7f8165 Updated SConstruct to check for additional boost headers 2012-03-06 08:50:15 +01:00
DennisOSRM e83891b4fc API Breaking change. Location of nodes can be specified by a hint. 2012-03-05 19:08:10 +01:00
DennisOSRM 91c9cb2114 Change of API. 2012-03-05 17:42:35 +01:00
Project OSRM 303d571d23 Merge pull request #163 from emiltin/update_restriction_tests
update turn restrictions tests to use oneway streets, to avoid u-turns
2012-03-05 07:21:07 -08:00
DennisOSRM f7cc34c807 Parsing hints from request. If no hint is given, then it is initialized
to empty string.
2012-03-05 16:19:46 +01:00
Emil Tin 8b2c0030d0 update turn restrictions tests to use oneway streets, to avoid u-turns 2012-03-05 16:11:11 +01:00
DennisOSRM c273351d4a PhantomNodes get transmitted as well. The client is supposed to send us
this information whenever it's possible.
2012-03-05 15:44:21 +01:00
DennisOSRM 0cd06be13a Fixes segfault where route over node with highest ID could not be
unpacked.
2012-03-05 14:48:59 +01:00
DennisOSRM ee64b2f5fd removed dead code 2012-03-05 14:47:48 +01:00
DennisOSRM f8499e1113 More assertions in debug runs, but faster in release runs. 2012-03-05 14:34:38 +01:00
DennisOSRM 305f4dc5d0 Merge remote-tracking branch 'origin/master' 2012-03-05 09:39:13 +01:00
DennisOSRM 3e73710245 Adding another method to simply add the increment. 2012-03-05 09:37:13 +01:00
DennisOSRM 77d5c44664 fixes issue #161 2012-03-05 09:36:20 +01:00
DennisOSRM 22e1e6c92f partially fixes issue #161 2012-03-05 09:32:53 +01:00
Project OSRM e70bcfb343 Merge pull request #158 from DrVanScott/gui
Gui: allow coordinates to specify start/end point
2012-03-02 10:21:25 -08:00
Dr Scott 93bccf36ba support coordinates as start/end point: also accept semicolon as separator 2012-03-02 19:05:17 +01:00
Project OSRM 1720a2b123 Merge pull request #159 from emiltin/update_restriction_tests
updated turn restriction tests
2012-03-02 07:48:57 -08:00
Emil Tin b0ecb869f2 updated turn restriction tests. use correct .osrm.restrictions file during tests. add tests for no-right-turn 2012-03-02 16:37:55 +01:00
Dr Scott 58359fe4ac support coordinates as start/end point 2012-03-02 01:31:05 +01:00
DennisOSRM 9fdb6eb2c5 Refactoring edge based graph generation subrouting into a single
function. Should make parallelization much easier.
2012-03-01 19:41:06 +01:00
DennisOSRM 9b80d44873 Fixes an issue where target was on a dead-end street. 2012-03-01 19:39:48 +01:00
DennisOSRM 9673980fae Reserve is not initial size 2012-03-01 15:59:46 +01:00
DennisOSRM ec579fb6be Renaming of Bits Struct 2012-03-01 15:58:59 +01:00
DennisOSRM 3cc3d4fd3b Fail more gracefully if file of restrictions is not accessible. 2012-03-01 15:58:10 +01:00
DennisOSRM 63f4aaf7dd Further refactoring of edge based graph generation 2012-03-01 14:36:10 +01:00
DennisOSRM 9776373784 Allow ways to cross barrier=border_control 2012-03-01 09:59:35 +01:00
DennisOSRM f8c0c468a9 First preparations for Intels TBB 2012-02-29 20:02:04 +01:00
DennisOSRM 3e3c5f72e9 Disabling debug output. 2012-02-29 14:58:31 +01:00
DennisOSRM f332f39ea6 Merge branch 'master' of
https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git
2012-02-29 14:30:19 +01:00
DennisOSRM 39be1ec116 Simplify turn instructions 2012-02-29 14:14:30 +01:00
DennisOSRM c3bab284ba Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-02-29 14:11:07 +01:00
DennisOSRM 28581de0ee Simplify turn instructions where roads carry multiple names in ref 2012-02-29 14:10:44 +01:00
Project OSRM 2bd749b0f7 Readme references to Wiki 2012-02-29 09:24:35 +01:00
DennisOSRM 9586bc26c7 Better speed profile 2012-02-28 17:29:01 +01:00
DennisOSRM e8ef6c8b8a Changing name of traffic signal parameter. 2012-02-28 16:47:40 +01:00
DennisOSRM 300f7370c8 traffic signal penalty gets incorporated now into routing data. 2012-02-28 16:25:01 +01:00
DennisOSRM 8d83ce47e9 Renaming vector 2012-02-28 15:33:31 +01:00
DennisOSRM ade2ecdb8e Parsing traffic lights from input data 2012-02-28 15:31:47 +01:00
DennisOSRM 8839a5eb3f All kinds of barriers get parsed now, not only bollards. 2012-02-28 15:15:08 +01:00
DennisOSRM d61ece7891 Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-02-28 11:36:07 +01:00
DennisOSRM f736bb9c9a More realistic car speed profile 2012-02-28 11:35:47 +01:00
Project OSRM f8fb79a838 Merge pull request #154 from emiltin/update_distance_tests
fixed two distance tests, and added another for 1000km scales
2012-02-27 06:12:49 -08:00
Emil Tin 5ad4992816 fixed two distance tests, and added another for 1000km scales 2012-02-27 14:48:14 +01:00
DennisOSRM 02e15bd3d2 Disabling OpenMP for good on OS X, see issue #123 2012-02-27 13:09:59 +01:00
DennisOSRM 25d15fe2af Disabling OpenMP for good on OS X 2012-02-27 13:09:19 +01:00
DennisOSRM fdb4198c0d Further adjustments for OS X 2012-02-27 11:51:59 +01:00
DennisOSRM 3f7437fec2 Check for libpthread on Linux 2012-02-27 10:44:23 +01:00
DennisOSRM ed0733e125 Adding --no-march switch to SConstruct as well as some of the OS X support 2012-02-27 10:33:43 +01:00
DennisOSRM cc3255702f Merge branch 'master' of https://github.com/DennisOSRM/Project-OSRM 2012-02-27 09:57:11 +01:00
DennisOSRM b53f3b1b5c PngImage compile fixes for libpng 1.5 (OS X). Partially fixes issue #123 2012-02-27 09:47:53 +01:00
Project OSRM 795d2b264c Merge pull request #149 from emiltin/cuke_config_files
add extractor.ini and contractor.ini files to test folder
2012-02-25 05:27:55 -08:00
Emil Tin ab961486d9 add extractor.ini and contractor.ini files to test folder 2012-02-25 13:52:22 +01:00
Project OSRM f35a82e36a Merge pull request #146 from emiltin/cuke_routed_hash
reprocess data files during tests if osrm-routed binary has changed
2012-02-24 06:14:18 -08:00
Emil Tin f841a7a25a reprocess data files during tests if osrm-routed binary has changed 2012-02-24 14:58:49 +01:00
Emil Tin d01f350e94 update SConstruct to make compiling work on mac. different version of png code, that compiles on mac os x. 2012-02-24 13:50:15 +01:00
DennisOSRM 0e589ecbcd Further perfomance for nearest neighbor structure. I/Os are now 25%
faster.
2012-02-24 11:57:06 +01:00
DennisOSRM 1f381d790f Some performance hacks in nearest neighbor lookup. gives upto 10% of
speed on the single operation.
2012-02-24 11:16:22 +01:00
DennisOSRM e6ce9d3d29 Adding (commented) log output 2012-02-23 17:04:11 +01:00
DennisOSRM a88ad71be6 Merge branch 'master' of
https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git
2012-02-23 16:29:55 +01:00
Project OSRM 48daf38f2b Appending CCFLAGS. osrm-routed was not compiled with any optimizations. That gave a tremendous slowdown. 2012-02-22 13:27:44 +01:00
Project OSRM 7d42330352 Merge pull request #141 from emiltin/testing_invalid_oneways
update tests for handling of invalid oneway mapping
2012-02-21 04:41:48 -08:00
Emil Tin dfd227cfc9 update tests for handling of invalid oneway mapping 2012-02-21 13:35:13 +01:00
Project OSRM 568dd9bf3c Merge pull request #139 from emiltin/way_name_testing
enable testing of way names, including ways with empty or missing names
2012-02-21 04:34:13 -08:00
DennisOSRM 3507a805a9 Merge branch 'way_name_testing' of https://github.com/emiltin/Project-OSRM 2012-02-21 12:56:12 +01:00
DennisOSRM e248517535 Added german OSM Tileservers 2012-02-21 12:26:31 +01:00
Emil Tin 0984a669ce enable testing of way names, including ways with empty or missing name tags 2012-02-21 11:51:42 +01:00
DennisOSRM 15f2b21b62 Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-02-21 10:34:31 +01:00
DennisOSRM 4aaecfb4f9 Fixes issue #136 2012-02-21 10:34:17 +01:00
Project OSRM e6941df981 Merge pull request #126 from emiltin/test_grid_size
allow setting the grid space in tests
2012-02-21 01:22:02 -08:00
Project OSRM 632f344db5 Merge pull request #132 from emiltin/fix_snap_test
fix an invalid cuke test
2012-02-21 01:21:32 -08:00
Project OSRM 1f1b472568 Merge pull request #135 from emiltin/cuke_travel_time
cuke testing of travel times
2012-02-21 01:21:22 -08:00
Project OSRM 20fa2f8738 Merge pull request #134 from emiltin/frontend_url_format
frontend now uses ? instead of & to separete query params in urls
2012-02-21 01:18:08 -08:00
DennisOSRM d3bf394b16 Merge branch 'master' of https://github.com/DennisOSRM/Project-OSRM 2012-02-21 10:03:13 +01:00
Emil Tin 887092bacd allow setting the grid space in tests 2012-02-19 20:49:10 +01:00
Emil Tin 61aa095722 cuke testing of travel times 2012-02-19 20:42:14 +01:00
Emil Tin 7aa2700d8f update web frontend to use ? instead of & to separete query params in urls 2012-02-19 09:31:30 +01:00
Emil Tin e842c7b28b fix an invalid cuke test 2012-02-18 22:47:35 +01:00
Project OSRM 091cd57f68 Merge pull request #125 from emiltin/cuke_row_order
in cucumber tests, always show failed rows right below expected ones
2012-02-18 10:22:14 -08:00
Project OSRM 045b1e0cb8 Merge pull request #124 from emiltin/query_delimiter
update tests to use new query delimter ? instead of &
2012-02-18 10:21:57 -08:00
Project OSRM e7bc232eb1 Merge pull request #127 from emiltin/gitignore_sandbox
gitignore the sandbox/ folder
2012-02-18 10:21:41 -08:00
Project OSRM 4eaaf91794 Merge pull request #128 from emiltin/cuke_way_check
perform a sanity check on which ways are used during routability tests
2012-02-18 10:21:19 -08:00
Project OSRM 9542ab0482 Merge pull request #129 from emiltin/foot_speedprofile
add a speedprofile for walking, and a test for basic way accessability
2012-02-18 10:20:22 -08:00
Project OSRM f427550bb7 Merge pull request #130 from emiltin/distance_tests
added tests for distance calculations (some are failing)
2012-02-18 10:19:44 -08:00
Emil Tin ef9c3c8431 added tests for distance calculations (some are failing) 2012-02-18 18:08:42 +01:00
Emil Tin 9eef17506d add a speedprofile for walking, and a test for basic way accessability 2012-02-18 16:46:57 +01:00
Emil Tin 801490b9fc perform a sanity check on which ways are used during routability tests 2012-02-18 16:22:54 +01:00
Emil Tin 169988b3c4 gitignore the sandbox/ folder 2012-02-18 15:28:50 +01:00
Emil Tin 695fecddeb in cucumber tests, always show failed rows right below expected ones 2012-02-18 14:52:48 +01:00
Emil Tin 429eb316d0 update tests to use new query delimter ? instead of & 2012-02-18 14:41:15 +01:00
DennisOSRM a99a26aeab Additional hints are sent to the client 2012-02-17 16:27:54 +01:00
DennisOSRM ae93423116 Forgot to remove debug output. 2012-02-17 14:19:45 +01:00
DennisOSRM b897b5d0e2 Query string starts with '?' before first parameter and not '&'. See
http://en.wikipedia.org/wiki/Query_string for an explanation. Fixes
issue #121. Thanks Jochen for the reminder!
2012-02-17 08:45:09 +01:00
DennisOSRM 1744e69214 checksum is transmitted to the client. 2012-02-17 08:34:52 +01:00
DennisOSRM e034733ac6 CRC32 of data is written to file and loaded into NodeInfoHelpDesk. 2012-02-17 08:15:33 +01:00
DennisOSRM ac41c3b06c Typo in CRC32 data length 2012-02-16 16:18:13 +01:00
DennisOSRM 3c8cea2af6 Adding new class to compute CRC32 of a char array 2012-02-16 15:45:49 +01:00
DennisOSRM 99e8f36901 Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-02-15 10:52:19 +01:00
Emil Tin eeea5b0e81 Adds the cucumber test framework referenced in issues #26, #95, #114 2012-02-15 10:50:43 +01:00
DennisOSRM b210b22975 Adds the cucumber test framework referenced in issues #26, #95, #114 2012-02-14 17:21:07 +01:00
DennisOSRM 84b35f47a1 Fixes test cucumber --tags @basic:63 and issue #105 2012-02-14 17:17:11 +01:00
DennisOSRM 0727ff09fa Fixes issue #119 2012-02-14 13:37:08 +01:00
DennisOSRM fe416526f2 Dropping Magick++ for libpng and pngwriter 2012-02-13 16:15:28 +01:00
DennisOSRM 3c10844067 Adding PNGImage as a third party object. It's under MIT License, so it
should be no problem at all to redistribute it.
2012-02-13 16:10:47 +01:00
DennisOSRM 94bd6e22ff Dropping Magick++ for libpng and pngwriter 2012-02-13 15:28:45 +01:00
DennisOSRM d11524781e Implements #110 2012-02-13 15:21:51 +01:00
DennisOSRM 8d16c047cc Fixes a rounding issue related to issues #98, #105, #115 and #116.
Problems were partially caused by the limits of floating point accuracy.
2012-02-13 13:30:13 +01:00
DennisOSRM f94ebf5296 Removing unnecessary debug output 2012-02-10 17:35:59 +01:00
DennisOSRM 8cddaf39c4 Fixes issue #105 and partially #62 as well as #83. 2012-02-10 17:14:30 +01:00
Project OSRM 7ce75733d0 Update README.TXT 2012-02-09 18:42:45 +01:00
Project OSRM e8af613aaa Update README.TXT 2012-02-09 18:41:01 +01:00
DennisOSRM 96f2358d28 Fixes issue #83. The bug was caused by improper retrieval of the packed
path.
2012-02-09 17:53:09 +01:00
DennisOSRM bb8645dd18 Changed debug output to use output macros instead of std::cout directly 2012-02-09 17:51:05 +01:00
DennisOSRM 12c547126e Fixes issue #111 where heading 0 was incorrectly mapped to South. 2012-02-09 11:22:32 +01:00
DennisOSRM 78d6a25d98 T@H Osmarender is going away at the end of the month. Instead the tile
from OpenCycleMap's transport layer are offered.
2012-02-09 11:00:21 +01:00
DennisOSRM 2c4621011d Additional work for issue #46 2012-02-08 18:31:37 +01:00
DennisOSRM 7a6c36d43c Adding include to make static code analysis happy. 2012-02-08 16:22:33 +01:00
DennisOSRM d9f0d92262 Removed superflous debug output 2012-02-08 15:10:55 +01:00
DennisOSRM cc91ee1c52 Fixes issue #62. Initial "O m" instruction won't be shown anymore. 2012-02-08 14:58:58 +01:00
DennisOSRM 0dc77b056a Fixes issue #46. Turn instructions are much more verbose now where the
streets have no name.
2012-02-08 11:46:34 +01:00
DennisOSRM c793672d63 Fixed problem with check of input parameter size in release mode. thx
Dennis
2012-02-08 10:35:59 +01:00
DennisOSRM 5136853ce0 Fixes issue #101. Target nodes close to bollards were neglected. 2012-02-07 19:40:25 +01:00
DennisOSRM 9da873330a Special case of heading 202.5 not properly handled and defaulted to "N". 2012-02-07 18:22:31 +01:00
DennisOSRM bd67e7a4ed PBF Parser extracts bollards now, too! 2012-02-07 15:54:30 +01:00
DennisOSRM 9eb73f9306 Missing include, thanks Fred! 2012-02-07 15:19:29 +01:00
DennisOSRM 5e275b3935 Fixes issue #104. Heading and Azimuth get computed now. 2012-02-07 14:47:01 +01:00
DennisOSRM c98f19c5a6 Adding a hop limit to preprocessing, which makes preprocessing a lot
faster but trades for routing speed.
2012-02-07 11:52:22 +01:00
DennisOSRM 66b4f65d84 Removed excess if-statement that prohibited output of unencoded
polyline.
2012-02-06 10:49:45 +01:00
DennisOSRM b85898c5da Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-02-03 18:40:03 +01:00
DennisOSRM f1332c7c6a Fixing rounding errors by a hack. 2012-02-03 18:39:15 +01:00
DennisOSRM 8a47c87a8a Fixing issues #81 and #82 2012-02-03 16:39:18 +01:00
Project OSRM 88b2d8a8ef Merge pull request #99 from woodpeck/master
trivial readme additions.
2012-02-03 06:50:04 -08:00
Frederik Ramm 2fd3ebc8fb typo fix 2012-02-03 15:45:45 +01:00
Frederik Ramm 204f522ea4 add dependency & stxxl config info tho readme 2012-02-03 15:43:22 +01:00
DennisOSRM 1f986598f1 Fixing issue #89 where the first street name could not be properly
adressed.
2012-02-03 13:45:59 +01:00
DennisOSRM 6996b24c44 Unnecessary memory allocation removed in extractor 2012-02-03 13:44:08 +01:00
DennisOSRM b44e36e7ba Fixes issue #74, thanks DrVanScott. 2012-02-01 17:36:28 +01:00
Project OSRM 7c41206c6d Merge pull request #97 from DrVanScott/memory
authors
2012-02-01 00:53:35 -08:00
Dr Scott ea6c0353be authors 2012-01-31 23:23:42 +01:00
DennisOSRM 8a665bc044 Fixes issue #73. 2012-01-31 20:38:52 +01:00
DennisOSRM f68d53ead6 Fixing off-by one error 2012-01-31 17:46:04 +01:00
DennisOSRM 93b1ff1c5d Fixing constant-sized memory leaks 2012-01-31 17:44:55 +01:00
DennisOSRM d41b0f28b4 Fixes issue #94. 2012-01-31 16:12:19 +01:00
DennisOSRM c686d28675 Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2012-01-31 14:51:59 +01:00
Project OSRM 448095ff98 Merge pull request #92 from DrVanScott/memory
fixing some memory problems, Thanks.
2012-01-31 05:51:43 -08:00
DennisOSRM 835bf436e4 Extractor dies more gracefully now if the stxxl singleton is already in
use.
2012-01-31 14:48:46 +01:00
Project OSRM 6da047005a Merge pull request #86 from risicle/master
Fix for issue #72, thanks.
2012-01-31 05:18:48 -08:00
Dr Scott 571824415c memory problem (because of n+1 in StaticGraph::EndEdges) 2012-01-27 00:41:31 +01:00
Dr Scott bef3aad423 another memory problem 2012-01-26 23:03:39 +01:00
Dr Scott 7d21a4e0fb fixing some memory problems 2012-01-26 01:48:22 +01:00
Robert Scott e9258a238e add pthread check to SConscript so subsequent google protocol buffers check doesn't fail 2012-01-21 23:10:23 +00:00
DennisOSRM a21376f6ce Removed dead code 2012-01-07 15:01:55 +01:00
DennisOSRM 664f133c4b Optimization hacks. Saving about 10% preprocessing time and about 1-2%
space
2012-01-07 15:00:40 +01:00
DennisOSRM f4cf3596c5 Added ImageMagick's Magick++ to dependencies for elevation profile bitmaps 2012-01-06 12:34:06 +01:00
DennisOSRM d4eebd7c0d Added ImageMagick's Magick++ to dependencies for elevation profile bitmaps 2012-01-06 12:28:16 +01:00
DennisOSRM 70256146fc barrier=bollard is now used. Fixes ticket #9 and saves about .5% RAM in
metropolitan areas
2012-01-02 13:09:20 +01:00
DennisOSRM 057e3a936e obeyBollards added to speed profile 2012-01-02 12:52:22 +01:00
DennisOSRM 0aab2510d3 Adding a static traffic light penalty to the speed profile. 2012-01-02 12:47:31 +01:00
DennisOSRM ed826e4451 Updated SConstruct with further boost dependencies 2012-01-01 19:34:33 +01:00
Sasa Ivetic 8efb9a38ea Moved all Windows related files to win folder 2012-01-01 23:33:10 +08:00
DennisOSRM 8e1d69ac8b Adding compile flag to get rid of STXXL dependency for osrm-routed 2012-01-01 16:20:00 +01:00
DennisOSRM ee1b3afdcf Allowing U-Turn at the end of a dead-end street which is necessary for
via routes.
2012-01-01 16:04:59 +01:00
DennisOSRM 62aab1cec6 Reordering dependenxy checks 2012-01-01 15:53:55 +01:00
DennisOSRM 44c07e9504 Merge branch 'master' of https://github.com/DennisOSRM/Project-OSRM 2011-12-31 16:19:00 +01:00
DennisOSRM 1c74f84647 Merging manually 2011-12-31 16:18:52 +01:00
DennisOSRM 1741ce7ec9 Refactored access to NASA data 2011-12-31 15:59:37 +01:00
DennisOSRM 53d87eb9be Removing directories 2011-12-31 15:58:42 +01:00
DennisOSRM 6e7bb505c1 Edge-based via routes working again. Beware, it may be buggy or slow or
even both. It does not yet work with via points on one-way streets.
2011-12-30 22:11:48 +01:00
DennisOSRM e1f137d59a Minor perfomance tweaks. Saves about 3-4 percent of preprocessing time
spent in computing the CH.
2011-12-30 15:37:19 +01:00
DennisOSRM 6d7dd2cf39 prefix vs. infix 2011-12-30 14:42:29 +01:00
DennisOSRM ebf3eea004 Output message about number of used restrictions is now more helpful. 2011-12-30 13:30:17 +01:00
DennisOSRM 913c2e5713 Merge branch 'master' of https://github.com/DennisOSRM/Project-OSRM 2011-12-30 12:49:18 +01:00
DennisOSRM d2b5b8d854 Const'ed read-only functions in BasePlugin and derived classes. 2011-12-30 12:20:36 +01:00
DennisOSRM 5c10d2fae0 Hashtable does not allocate during operator[], RouteParameters to
plugins are passed as ref and not as value.
2011-12-28 14:14:09 +01:00
DennisOSRM 738c3eae91 void function needs to be void 2011-12-23 17:28:12 +01:00
DennisOSRM 83968bc1cd Inline'ing functions that can be inline'd 2011-12-20 18:52:53 +01:00
DennisOSRM 4cd615ba2e Const'ing parameter in function 2011-12-20 18:50:37 +01:00
DennisOSRM ac1908d464 Preparing edgebased via node routes. Via routes disabled for the moment. 2011-12-20 18:45:48 +01:00
DennisOSRM 95d8d44259 Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git 2011-12-20 11:38:31 +01:00
DennisOSRM d57be5244c Cleanung up NodeInformationHelpDesk 2011-12-17 22:19:08 +01:00
DennisOSRM 5ef4909bdd code cleanup 2011-12-17 22:01:40 +01:00
DennisOSRM 83e160d14d Removing unused variable 2011-12-17 22:00:35 +01:00
DennisOSRM 9a2e11c0d7 Some minor performance improvements 2011-12-17 21:58:48 +01:00
DennisOSRM 41b381f567 Template'ing Key parameter 2011-12-17 21:56:31 +01:00
DennisOSRM ecb979a14b Replace recursive unpacking procedure by a stack'ed implementation. 2011-12-17 20:17:40 +01:00
DennisOSRM 84bba8aa20 Renaming function to have a more obvious name. 2011-12-17 18:47:32 +01:00
DennisOSRM b133beed5e Fixes issue 63 2011-12-17 13:44:01 +01:00
DennisOSRM 90502a0c15 Bicycles allowed on oneways except motorways. Implements changes from
pull request (issue 54)
2011-12-16 16:51:14 +01:00
DennisOSRM f5226b2228 Certain type of edges, i.e. ferries, are now properly ignored from
nearest neighbor lookup. Fixes ticket 59.
2011-12-16 14:05:30 +01:00
DennisOSRM ad77d6cfec graph is built in-place, so memory peak usage is halved. 2011-12-15 17:48:00 +01:00
DennisOSRM a098e38c5a Util functions to convert between osm (google) x/y and nasa grid 2011-12-15 17:41:33 +01:00
DennisOSRM a7e7773d85 Fixing premature push to master repo 2011-12-14 19:01:57 +01:00
DennisOSRM 0df0c85fea Moving static code from NNGrid namespace to class 2011-12-14 18:23:14 +01:00
DennisOSRM fdd85a6328 Code cleanup 2011-12-14 18:07:58 +01:00
DennisOSRM 1409d0e06e Moving Bresenhams algorithm to the Algorithms subdirectory 2011-12-14 18:06:31 +01:00
DennisOSRM 4765409fe7 nearest neighbor data structure supports files larger than 4GB now. 2011-12-14 16:25:28 +01:00
DennisOSRM dad24f1106 Renaming subfolder 2011-12-13 15:45:14 +01:00
DennisOSRM 9ea39d280c SRTM Root directory parsed from ini file 2011-12-13 15:30:52 +01:00
DennisOSRM a04eb2bba1 Better LRU Cache implementation 2011-12-13 13:59:01 +01:00
DennisOSRM e849d18c1b Merge fixed 2011-12-13 11:08:40 +01:00
DennisOSRM 57868f38ef First working version of SRTM lookup 2011-12-13 10:13:48 +01:00
DennisOSRM 85f9b398da Minor change: Removing dead code 2011-12-13 10:12:41 +01:00
DennisOSRM e081cf1c3d Fixing inverted #ifdef 2011-12-10 18:43:37 +01:00
DennisOSRM 7c85b2f85a Threshold for Douglas-Peucker fixed 2011-12-10 18:42:07 +01:00
DennisOSRM ec3bcb43a8 Downsizing memory requirements by better struct packing 2011-12-10 18:26:33 +01:00
DennisOSRM 3a984668d6 Fixing several of the flickering issues. 2011-12-10 17:34:43 +01:00
DennisOSRM b08104367e Minor change: Rearranging debug output 2011-12-10 17:12:54 +01:00
DennisOSRM 1fb97f0080 Disabling tc 2011-12-10 16:50:18 +01:00
DennisOSRM 79a989e504 ignored edge type, i.e. ferry connections, can now be excluded from
nearest neighbor lookup
2011-12-10 15:13:15 +01:00
DennisOSRM d7f8eafe2d Removed google sparsehash 2011-12-10 14:58:18 +01:00
DennisOSRM 6e74ac9bd2 Removed redundant information 2011-12-10 14:57:59 +01:00
DennisOSRM 82c2e9978f Fixed stopping condition of Dijkstra implementation. 2011-12-10 14:16:21 +01:00
DennisOSRM e04ef5a030 Dropped google sparsehash dependency 2011-12-10 14:12:36 +01:00
DennisOSRM 0906a0fe1c Web page is available at
https://github.com/DennisOSRM/dennisosrm.github.com, so no need to store
it twice
2011-12-10 14:10:55 +01:00
DennisOSRM d07994bd73 Replaced google sparsehash by boost unordered map 2011-12-10 14:09:40 +01:00
DennisOSRM e8699d4337 Removed dead code; streamlined IOs; #ifdef'ed debug code; replace google
sparsehash by boost::unordered_map
2011-12-10 14:02:33 +01:00
DennisOSRM aa0ce0fb88 Removed dead code 2011-12-10 13:49:38 +01:00
DennisOSRM 435efc9886 speedprofile.ini has new options 2011-12-10 12:29:03 +01:00
DennisOSRM e64e45015a Minor change: Removing dead code 2011-12-09 17:43:50 +01:00
DennisOSRM 8e9461ea6a Minor change: simplifying code. 2011-12-09 17:40:40 +01:00
DennisOSRM 1262600895 Removing dead code 2011-12-09 17:39:13 +01:00
DennisOSRM 8589436158 Less flickery 2011-12-09 17:20:01 +01:00
DennisOSRM 3767ffd79a Forgotten in latest round of changes 2011-12-06 14:56:52 +01:00
DennisOSRM d81c632ef2 Another changeset to reduce flickering 2011-12-06 11:36:16 +01:00
DennisOSRM 18abdd0cd6 Fixes ticket 41. Speed is minimum of tagged maxspeed and definition from
speedprofile.ini
2011-12-06 10:56:42 +01:00
DennisOSRM 0cad039615 implements ticket 41 2011-12-05 18:39:40 +01:00
DennisOSRM abfb49818f if <accessclass>=no then immediately return. Fixes ticket 41 2011-12-05 18:28:00 +01:00
DennisOSRM afe9157d65 Solves another case of flickery routes. 2011-12-05 15:22:19 +01:00
DennisOSRM fe12ba23b0 Compare edge by edgebasednodeids 2011-12-05 15:14:43 +01:00
DennisOSRM 4f54c90a95 Moving check to member function 2011-12-05 15:14:23 +01:00
DennisOSRM 045922fb56 fixes ticket 43 2011-12-05 14:45:45 +01:00
DennisOSRM 4f5678fc95 stale file streams get reset. fixes ticket 37. 2011-12-02 17:24:50 +01:00
DennisOSRM 3986b30b00 way id needs to be set again 2011-12-02 16:43:44 +01:00
DennisOSRM 7be723782a Support for 'only_*'-typed turn restrictions. 2011-12-02 16:38:10 +01:00
DennisOSRM f601664620 Bringing XML parser up to speed and adding support for turn restriction
parsing. Note that it will be removed after the release of 0.3
2011-12-02 15:06:49 +01:00
DennisOSRM bd2080fdb5 Flickering of route was caused by rounding error in NNGrid. Fixes ticket
#35.
2011-12-02 11:52:56 +01:00
DennisOSRM b4585f24bb Skipping awfully tagged ways in extraction 2011-12-01 18:30:13 +01:00
DennisOSRM 21c9132902 Flushing vectors by swap tricks smoothes memory requirements 2011-12-01 15:13:35 +01:00
DennisOSRM 9abb317e6d Minor changes 2011-12-01 15:12:30 +01:00
DennisOSRM 5236fb8c0e Removed superflous member that saves about 10 percent of RAM 2011-12-01 14:48:06 +01:00
DennisOSRM fb661ab6f6 Fixed typo in output 2011-12-01 13:00:09 +01:00
DennisOSRM 9d22fca5e7 Moved GUARANTEE macro from debug to general scope 2011-12-01 12:58:41 +01:00
DennisOSRM eb1d629ea7 Doing swap trick to save RAM 2011-11-30 20:00:05 +01:00
DennisOSRM fd3ce305f4 Moved raw outputs to the appropriate macros 2011-11-30 19:48:01 +01:00
DennisOSRM 928e1178b1 Removed VERBOSE macro since it was superflous 2011-11-30 19:33:03 +01:00
DennisOSRM ff5e34ee70 Fixing segfaults when restrictions list was empty. See ticket #34 2011-11-30 18:48:38 +01:00
DennisOSRM e8d52c0f01 Fixes issue #38 2011-11-30 16:58:44 +01:00
DennisOSRM 275808d0d5 Adding 'designated' to list of recognized access tags 2011-11-30 16:54:49 +01:00
Project OSRM 55488b1fb6 Update README.TXT 2011-11-26 16:45:30 +00:00
Project OSRM e50e6ada6b Merge pull request #30 from emiltin/master
Make compilation work on mac
2011-11-26 08:25:28 -08:00
Emil Tin f511af0f0c fix compilation on mac; openmp issues and an unneeded typename 2011-11-26 16:42:15 +01:00
DennisOSRM f10bf842c6 removing OpenMP from where it doesnt belong 2011-11-26 14:20:29 +01:00
Dennis Luxen e3ad54996f Compile fixes 2011-11-26 13:16:36 +00:00
DennisOSRM aac6f45f54 Forgot to resolve conflict 2011-11-26 13:36:45 +01:00
DennisOSRM caf908669f Forgot to remove one old include 2011-11-26 12:45:45 +01:00
DennisOSRM 39c10e2b6a Merge branch 'master' of https://github.com/DennisOSRM/Project-OSRM 2011-11-26 12:41:33 +01:00
DennisOSRM 295164302a Merge branch 'master' of https://github.com/DennisOSRM/Project-OSRM
Conflicts:
	createHierarchy.cpp
2011-11-26 12:38:42 +01:00
Project OSRM 9a65d480a8 Welcome to the list Emil 2011-11-26 11:37:23 +00:00
Project OSRM b5a1bf6a84 Merge pull request #25 from emiltin/master
Fix compilation without OpenMP on Mac
2011-11-26 03:31:33 -08:00
Emil Tin d72c48500b moved openmp replacement header 2011-11-25 21:54:19 +01:00
DennisOSRM 8b2be2639e moved files 2011-11-25 21:36:02 +01:00
DennisOSRM 7295811965 moved files 2011-11-25 21:35:53 +01:00
Emil Tin a3000019db Move OpenMP stubs to a header 2011-11-25 18:49:23 +01:00
DennisOSRM 44235d427d More monav backporting 2011-11-25 17:23:23 +01:00
DennisOSRM 18b4f44605 MoNav backport, 30% faster contraction 2011-11-25 14:43:56 +01:00
DennisOSRM 17a5b7a363 Grid input streams now implemented as thread local objects. 2011-11-25 13:31:46 +01:00
DennisOSRM 8d008f9dcc Space requirements are better now 2011-11-25 12:02:52 +01:00
DennisOSRM d32734af0b Removing unnecessary parameter and using smart instead of raw pointers 2011-11-25 12:01:52 +01:00
DennisOSRM d68f72ec6d Renaming binaries. Thanks Emil 2011-11-25 10:49:53 +01:00
Emil Tin 37f80e027d Fix compilation without OpenMP. 2011-11-24 21:00:55 +01:00
DennisOSRM 7585dec359 Added angle based turn costs 2011-11-24 18:51:28 +01:00
DennisOSRM b98a67223b Removed dead code 2011-11-24 17:57:18 +01:00
DennisOSRM 7c17344a42 Changed barrier tag 2011-11-24 17:57:00 +01:00
DennisOSRM 3279ce3ea9 Removed debug code 2011-11-24 17:49:01 +01:00
DennisOSRM 7e52e2c691 Fixes bug with non-negative weights 2011-11-24 17:47:05 +01:00
DennisOSRM 4e75bd1de6 Start and target can be on same edge 2011-11-24 17:33:23 +01:00
DennisOSRM b5d2e56faf Roundabouts generate only one instruction 2011-11-24 11:14:59 +01:00
DennisOSRM fb1857f7cc Exits of roundabouts get handled 2011-11-23 18:40:54 +01:00
DennisOSRM 885d45e9b8 More roundabout magic 2011-11-22 16:57:42 +01:00
DennisOSRM 070050a48e Entering and leaving roundabouts is getting handled. 2011-11-22 16:47:15 +01:00
DennisOSRM 8c0db16b13 Removed debug code 2011-11-18 18:04:40 +01:00
DennisOSRM 99641bd55c Linestring is generalized by an untuned (Ramer-)Douglas-Peucker
algorithm. Distance computation is still a naive implementation and can
be further sped up if necessary
2011-11-18 18:00:08 +01:00
DennisOSRM 14c999fc82 Moved descriptors into their own folder. 2011-11-17 18:56:45 +01:00
DennisOSRM 95bcfa3dce Turn instructions util class. Mainly an enumerator 2011-11-17 18:56:07 +01:00
DennisOSRM 5e345fa7b0 Public typedef to access EdgeData type 2011-11-17 18:55:31 +01:00
DennisOSRM 8578a1c101 Sconstruct looks for Descriptors 2011-11-17 18:53:15 +01:00
DennisOSRM 4100b05fd9 Sconstruct checks for Boost 1.41 now 2011-11-17 18:39:52 +01:00
DennisOSRM e7439e92ed Route description are generated 2011-11-17 18:04:49 +01:00
DennisOSRM d874b51419 Added some minor code formatting 2011-11-17 15:41:49 +01:00
DennisOSRM cebef471a5 Added new object to SConstruct 2011-11-17 14:19:39 +01:00
DennisOSRM be9b21edc4 Renamed template parameter, added typedef to access template parameter
data
2011-11-17 10:37:43 +01:00
DennisOSRM 37e07025f7 Moved pure algorithms to /Algorithms sub directory 2011-11-16 19:10:49 +01:00
DennisOSRM f66c1e4a4f Removed unnecessary nameID of first leg 2011-11-16 18:10:51 +01:00
DennisOSRM 9a6cf7b991 Add first nodes with negative weights 2011-11-16 17:29:00 +01:00
DennisOSRM caf8cd701e NNGrid supports nameID of edges. 2011-11-15 16:47:53 +01:00
DennisOSRM eca2c0c5ef Store nameID with Edge 2011-11-15 16:24:13 +01:00
DennisOSRM 11653ef58f removed debug output 2011-11-15 16:11:07 +01:00
DennisOSRM d05638f64f Removed debug output 2011-11-15 15:57:39 +01:00
DennisOSRM d80586e405 Inlined and static'ed fields to make it compilable into several objects 2011-11-15 14:31:32 +01:00
DennisOSRM a62e757099 Removed debug output in ArrayStorage ctor 2011-11-15 11:48:31 +01:00
DennisOSRM 274189ee7e Removed superflous pointer in Contractor 2011-11-15 11:41:28 +01:00
DennisOSRM 18c7aa7f89 Carrying turn instructions through Contractor 2011-11-15 11:40:29 +01:00
DennisOSRM 735b4e2db1 Renamed ImportEdge turn instruction getter function to turnInstruction() 2011-11-15 11:35:46 +01:00
DennisOSRM f7326ca7f1 expanded _PathData struct to include name, turn instruction and length 2011-11-15 11:29:49 +01:00
DennisOSRM 647f054714 GPX export working with edge based routing 2011-11-15 11:21:37 +01:00
DennisOSRM b6ddccc793 Removed superflous line-break 2011-11-15 11:18:28 +01:00
DennisOSRM 1e54b3e69a Missing initialization of stxxl-vector 2011-11-15 11:08:44 +01:00
DennisOSRM 8f3de7d022 Removing KML descriptor from list of supported formats 2011-11-15 10:57:29 +01:00
DennisOSRM d1436cce38 Added dummy initialization to ctor 2011-11-15 10:40:38 +01:00
DennisOSRM 97afa231ca First working edge based version. Still missing: GPX export; Via Points;
origin,destination on same edge, descriptions
2011-11-14 19:36:31 +01:00
DennisOSRM 34e4ead885 Generation of edge based graph fixed. 2011-11-14 13:12:56 +01:00
DennisOSRM afaca23f12 Backport from Monav 2011-11-14 13:12:22 +01:00
DennisOSRM c6f6a7baed Coding style adapted, removed locks on const (read-only) functions 2011-11-11 11:02:16 +01:00
DennisOSRM 25ac07f8a6 Merge branch 'master' of https://github.com/DennisOSRM/Project-OSRM 2011-11-09 16:21:44 +01:00
Project OSRM 1bac501cbd Fixes ticket #23 2011-11-09 16:16:54 +01:00
DennisOSRM f8135c56b7 Merge branch 'master' of https://github.com/DennisOSRM/Project-OSRM 2011-11-09 16:12:12 +01:00
DennisOSRM eb9630251f First set of changes toward edge-based graph 2011-11-09 16:12:05 +01:00
Project OSRM 08dd04a0d6 Changed prerequesite of boost libraries to 1.41 2011-11-04 10:05:02 -05:00
Project OSRM a5c4d2102c Merge pull request #20 from sivetic/master
Split PBF Parser into a single Read and a single Parse thread to increase parsing speed.
2011-11-03 09:09:19 -07:00
Dennis Luxen 3fcabb642e Compile fixes if OpenMP is not available 2011-11-03 10:53:40 -05:00
Sasa Ivetic 63e8793c7f Moved Concurrent Queue class into its own file 2011-10-14 12:02:40 -05:00
Sasa Ivetic 2a6275cf38 Split PBF Parser into a single Read and a single Parse thread to increase parsing speed. 2011-10-14 09:18:57 -05:00
DennisOSRM 43438dbfab Adjusted coding style, inlined functions 2011-10-14 15:10:28 +02:00
DennisOSRM eae9e95c66 Removed dead code 2011-10-14 15:04:57 +02:00
DennisOSRM 77c6a06c15 Graphloader translates external to internal node ids for binary osrm
files. Google sparsehash replaced by boost unordered map
2011-10-12 17:31:18 +02:00
DennisOSRM 3f49351d38 New Constructor allows construction of empty graph 2011-10-10 18:56:01 +02:00
DennisOSRM c1e0387f3b Operator inlined to ease compile woes 2011-10-10 18:55:25 +02:00
DennisOSRM 52430b0180 More flexible build script 2011-10-10 18:54:34 +02:00
DennisOSRM cc737e54d4 Global functions inlined to ease compile trouble 2011-10-10 18:54:05 +02:00
DennisOSRM a9f9857ab8 Making global functions inline to ease compile trouble 2011-10-10 18:53:14 +02:00
DennisOSRM d7f82db8bd Removing superflous member. 2011-10-10 18:52:00 +02:00
DennisOSRM 4e2be10574 Updated dependencies 2011-10-10 17:52:47 +02:00
DennisOSRM 4e3f975221 Fixing signed/unsigned comparison 2011-10-10 15:00:08 +02:00
DennisOSRM 5274af7730 Small performance fixes 2011-10-08 20:37:16 +02:00
Project OSRM 1fb34be11e removed linebreak. 2011-10-07 18:38:54 +03:00
Project OSRM 5e1f621c50 Removed linebreak 2011-10-07 18:19:43 +03:00
Project OSRM 9091c8702d Removing superflous statement. 2011-10-07 17:44:03 +03:00
Project OSRM a2389d741e Merge pull request #19 from sivetic/master
Fixed intermediate dir in vcprojects
2011-10-06 02:48:38 -07:00
Sasa Ivetic 7541a614b0 Copy speedprofile.ini for Release build of extractor 2011-10-05 12:54:09 -05:00
Sasa Ivetic 2f2b1f874a Fixed IntermediateDirectory in createHiearchy.vcproj 2011-10-05 12:48:37 -05:00
Project OSRM c3125c2e5e Merge pull request #18 from sivetic/master
Pull request for AUTHORS.TXT
2011-10-05 10:44:00 -07:00
Sasa Ivetic 3a8ed01b8f Merge branch 'master' of git://github.com/DennisOSRM/Project-OSRM 2011-10-05 12:31:40 -05:00
Sasa Ivetic 35a2dad993 Added myself to author list as per Dennis' request 2011-10-05 12:24:06 -05:00
Sasa Ivetic 9f04305c12 Fixed available sys memory calc to work in KBs. Changed to boost::uint64_t for Visual C++ compilation 2011-10-06 01:20:41 +08:00
Sasa Ivetic a69d378b84 Added files necessary for Windows compilation with Visual Studio 2008 2011-10-06 01:16:50 +08:00
Sasa Ivetic a9ce528744 Added Visual Studio/.stxxl/lib files to ignore 2011-10-06 01:14:18 +08:00
DennisOSRM aae7027ac6 No hardcoded speedprofile anymore 2011-10-05 19:08:27 +02:00
DennisOSRM 0745341d49 Getting debug output displayed right 2011-10-05 18:35:25 +02:00
Sasa Ivetic 68ecc270f7 Added Visual Studio/.stxxl/lib files to ignore 2011-10-05 11:20:58 -05:00
Sasa Ivetic 5132c84dfa Merged for loop changes pulled down from upstream 2011-10-05 11:19:50 -05:00
Sasa Ivetic 0ec648217a Added files necessary for Windows compilation with Visual Studio 2008 2011-10-05 11:04:57 -05:00
Sasa Ivetic e603a41fb6 Fixed available sys memory calc to work in KBs. Changed to boost::uint64_t for Visual C++ compilation 2011-10-05 11:04:01 -05:00
DennisOSRM 89e4d4ac30 Fixes issue #17 2011-10-05 18:02:26 +02:00
Sasa Ivetic 789cb99292 OpenMP 2.0 for variable must be an int 2011-10-05 11:00:32 -05:00
DennisOSRM 0f440610b6 Adding a little do{}while(false); safety to macros 2011-10-05 17:57:04 +02:00
DennisOSRM cf8de234be reflects change of _Way member name 2011-10-04 18:38:18 +02:00
DennisOSRM cd03ad9207 struct _Egde now has constructor to also set nameid 2011-10-04 18:33:40 +02:00
DennisOSRM b1f2f2786c speedprofile is now represented as hash table and operator[] const() has
been defined.
2011-10-04 17:32:33 +02:00
DennisOSRM 1db1b4e5ae Removed commented speed profile 2011-10-04 16:27:32 +02:00
DennisOSRM 3ec4487297 Added newly used boost headers to SConstruct 2011-10-04 16:00:21 +02:00
DennisOSRM 88bd5aefe0 Ignoring unwanted files 2011-10-04 15:54:14 +02:00
DennisOSRM a73d79b138 Ignore unwanted files 2011-10-04 15:50:11 +02:00
DennisOSRM cd9a01bdf0 Ignore unwanted files 2011-10-04 15:49:14 +02:00
DennisOSRM 2f65370d19 removed fixed speed profile 2011-10-04 15:45:03 +02:00
DennisOSRM 54de6d4afb Speeds are integers 2011-10-04 15:44:37 +02:00
DennisOSRM 858adeb9db DEBUG output macro introduced 2011-10-04 15:43:53 +02:00
DennisOSRM 109279d0b5 Boost Property Tree provides the speed profile from an ini file
Memory leak fixed, issue #11, thanks sivetic
Typo fixed
for loop replaced by boost's FOREACH
2011-10-04 15:42:24 +02:00
DennisOSRM c4fb8f74ac Updated speed profiles to include pier ways 2011-10-04 15:33:47 +02:00
DennisOSRM 528d0a2899 Fixing signed to unsigned comparison warning 2011-10-04 15:32:16 +02:00
DennisOSRM faba474def Added basic ini file for speed profiles 2011-10-04 15:11:29 +02:00
DennisOSRM 7dc17ae693 Making find() return a const_iterator ensures that the function is const
and does not allocate any unnecessary RAM.
2011-10-04 15:07:25 +02:00
DennisOSRM 482edd0b02 Switching Hashtable from google sparsehash to boost::unordered_map 2011-10-04 10:28:40 +02:00
DennisOSRM d1b723e5e1 Missing includes added 2011-10-04 10:14:30 +02:00
Dennis Luxen 89c9ca183f Windows RAM info, thanks sivetic 2011-09-28 17:24:06 +02:00
Dennis Luxen 54d8a362fc Windows support, thanks sivetic 2011-09-28 17:22:03 +02:00
Dennis Luxen 0c4c1ce878 Further FreeBSD compile fixes, thanks tolmaion 2011-09-28 17:11:51 +02:00
Dennis Luxen 816657347f Function installCrashHandler() in Util/LinuxStackTrace.h shall not be const equally in debug and normal build, thanks tolmaion 2011-09-28 17:09:05 +02:00
Dennis Luxen 8533b5d0a2 fix extractor to run correctly on machines with more than 32bit mem range, thanks tolmaion 2011-09-28 17:02:52 +02:00
Dennis Luxen 2523f845d2 FreeBSD compile fix, thanks tolmaion 2011-09-28 17:00:11 +02:00
Dennis Luxen 30cffd2563 Fix build with GCC 4.2, thanks tolmaion 2011-09-28 16:51:54 +02:00
Dennis Luxen bcb39b9e69 performance fixes 2011-08-07 10:56:37 +00:00
Dennis Luxen a5c94c4630 ArrayStorage instead of hash maps 2011-08-07 09:48:51 +00:00
Dennis Luxen b5813ae18b making destructor virtual 2011-08-06 21:13:34 +00:00
Dennis Luxen 4919f72060 Minor fixes 2011-08-06 18:31:20 +00:00
Dennis Luxen c8b0f96251 compression of polylines is now a lot faster 2011-08-06 17:48:10 +00:00
Dennis Luxen 3bcd262099 parameter can be made const 2011-08-04 17:08:37 +00:00
Dennis Luxen ff3de43ec6 A bit of code-cleanup. 2011-08-04 17:07:51 +00:00
Dennis Luxen 79083e7585 Compile fixes for FreeBSD, see ticket #56 2011-08-04 16:32:07 +00:00
Dennis Luxen 29fb07446a replacing stringstream by plain string is faster 2011-07-29 16:41:32 +00:00
Dennis Luxen a816630f2f Hack to make distance calculation more robust 2011-07-29 15:56:25 +00:00
Dennis Luxen 24ca42c017 2011-07-29 15:48:20 +00:00
Dennis Luxen 39fe92ebc4 Adding -rdynamic to debug build flags 2011-07-28 12:58:31 +00:00
Dennis Luxen 905b0331b8 Adding stacktracing for seg'faulting debig builds under linux. 2011-07-28 12:16:36 +00:00
Dennis Luxen 88a8d9043a fixes ticket #49 2011-07-27 09:03:56 +00:00
Dennis Luxen d05e097a78 dev version of index.html 2011-07-22 17:15:05 +00:00
Dennis Luxen 2d5d1f4a29 ViaRoute Javascript 2011-07-22 17:12:47 +00:00
Dennis Luxen 85c1a74c1b Missing cancel image for Via Routes 2011-07-22 16:58:05 +00:00
Dennis Luxen f7e81a8d22 Draggable Via Points 2011-07-22 16:15:42 +00:00
Dennis Luxen 61bc95dc9a Routing outside coverage area crashes the Router 2011-07-22 16:05:40 +00:00
Dennis Luxen 53e9d70d3d Fence had wrong name 2011-07-22 15:38:46 +00:00
Dennis Luxen 11dbf03467 BinaryHeap should handle negative keys as well. Thanks Christian for pointing out the obviuos! 2011-07-22 15:33:57 +00:00
Dennis Luxen 4f23dfef64 Removing empty line 2011-07-22 12:24:22 +00:00
Dennis Luxen 83fca53d04 Making via routes more stable 2011-07-21 14:30:36 +00:00
Dennis Luxen e93735903e Util function 2011-07-18 15:50:08 +00:00
Dennis Luxen ddc7e8b8c7 Check if PhantomNodes are on same Edge. 2011-07-18 15:48:30 +00:00
Dennis Luxen 5377e82ca0 Unnecessary members on edge 2011-07-18 14:18:12 +00:00
Dennis Luxen fdb46f5445 Missing return in operator[] 2011-07-18 14:17:33 +00:00
Dennis Luxen a76cf5cad4 more safe deletes 2011-07-12 17:14:39 +00:00
Dennis Luxen 96f5c1c735 (experimental) LRU cache turned off, safe delete 2011-07-12 17:12:30 +00:00
Dennis Luxen 307c9ae9c5 minor adjustments 2011-07-12 14:17:21 +00:00
Dennis Luxen 83b5774d1a Safe delete 2011-07-12 14:04:27 +00:00
Dennis Luxen ae81a8d118 Bugfixes, plus safe delete, less pointers and speed back on track 2011-07-12 14:03:31 +00:00
Dennis Luxen 77ae0d8ef4 Typedef'ing hashtable iterator type 2011-07-11 16:55:37 +00:00
Dennis Luxen 2e8744a034 As always, forgot debug output. D'oh! 2011-07-11 15:22:38 +00:00
Dennis Luxen f29f6c65a5 Refactored various parts for integration of multi-segment paths 2011-07-11 15:16:14 +00:00
Pascal Neis 4bbf53ce62 Added GPX download support and changed the default start and destination address 2011-07-09 19:31:45 +00:00
Dennis Luxen 9878372866 Experimental plugin 2011-07-08 17:27:16 +00:00
Dennis Luxen 302255807c As always, one file was missing 2011-07-07 17:03:32 +00:00
Dennis Luxen c60c3fcd3c Support for multi-segment routes. Needs to be further tested 2011-07-07 16:51:23 +00:00
Dennis Luxen ccf40b53eb Fixes ticket #45 2011-07-07 16:37:26 +00:00
Dennis Luxen e3d97ec41b Initalizing ArrayStorage by default 2011-07-07 14:50:40 +00:00
Dennis Luxen cdad977341 Unnecessary define 2011-07-07 13:39:53 +00:00
Dennis Luxen 717d25cad0 Parsing via points from URL 2011-07-07 09:32:47 +00:00
Dennis Luxen 9ffe6ccb6a Enhancing data structure for via points 2011-07-07 09:29:15 +00:00
Dennis Luxen af98879303 Unnecessary call by value. Change to call by reference 2011-07-07 09:24:19 +00:00
Dennis Luxen 57809439a8 Setting reply to ok by default 2011-07-07 09:15:43 +00:00
Dennis Luxen 44e03627c3 Small refactoring 2011-07-07 09:14:07 +00:00
Dennis Luxen 13f8c973f4 Allowing empty c'tor 2011-07-07 09:01:49 +00:00
Dennis Luxen 00e0d46e92 Additional sanity check 2011-07-07 08:55:25 +00:00
Dennis Luxen 7fee51081f Fixing Maney Hill street bug. 2011-07-07 08:54:53 +00:00
Dennis Luxen 6b99e44177 Coordinates are resettable now 2011-07-07 08:30:42 +00:00
Dennis Luxen 87bc397ee0 removing old file 2011-07-07 08:18:29 +00:00
Dennis Luxen ac3ccf1d7a Adding util method to load hsgr graph without any edge data type. 2011-07-07 08:15:56 +00:00
Dennis Luxen a8ad4695aa Typo in StringUtil.h file name. D'oh! 2011-07-07 08:05:58 +00:00
Dennis Luxen dae6d1c730 Refactoring method names 2011-07-07 08:01:14 +00:00
Dennis Luxen 132c25fd3b Deleting unnecessary class 2011-07-07 07:44:20 +00:00
Dennis Luxen 943a0203f2 Removing empty line 2011-07-07 07:42:30 +00:00
Dennis Luxen 6e8a1e0e31 array initialization can be optional 2011-07-07 07:40:49 +00:00
Dennis Luxen 108e1ad5e6 array subscript is above array bounds 2011-07-06 16:50:53 +00:00
Dennis Luxen a79231c666 Cleaning some left-overs 2011-07-06 12:56:01 +00:00
Dennis Luxen 97bd93f9bc Fixes ticket #43 where JSON was incorrectly formatted 2011-07-06 12:42:44 +00:00
Dennis Luxen a37528362d Extracting additional features from graph 2011-07-06 12:33:41 +00:00
Dennis Luxen 4883c6c197 'startswith' util function for strings 2011-07-06 12:32:57 +00:00
Dennis Luxen 5ef8afe7c4 GPX output format. Thanks, Bharath! 2011-06-30 14:24:43 +00:00
Dennis Luxen 229cddb5c6 Defines for easy debug output 2011-06-30 14:21:29 +00:00
Pascal Neis bb9cb9a1ef No updates, only a new version number in the footer 2011-06-30 11:38:51 +00:00
Pascal Neis eca141eebc Added some small documentation 2011-06-30 11:37:31 +00:00
Pascal Neis e7a4070339 Added RouteGeometryCompression and ShortLink support 2011-06-30 11:35:08 +00:00
Dennis Luxen 9551eff4fb Backslashes need to be doubled. Note to myself: RTFM, d'oh! 2011-06-29 08:43:08 +00:00
Dennis Luxen 4639187180 missing check for empty polylines 2011-06-28 09:28:19 +00:00
Dennis Luxen 5b621d8fe9 polyline needs to be data, not array 2011-06-28 08:27:38 +00:00
Dennis Luxen e3b648ea72 Adding support for polyline compression. Reduces file size, see http://open.mapquestapi.com/common/encodedecode.html 2011-06-27 22:08:53 +00:00
Pascal Neis 676333ab5a added a new feature to the GUI: you now get a link of the calculated route 2011-06-19 19:13:07 +00:00
Dennis Luxen bd7aa1cc7b Missing output operator<< for Coordinates 2011-06-15 21:01:36 +00:00
Dennis Luxen 88cfb538bd Missing partial initialization of _PriorityData 2011-06-10 09:32:51 +00:00
Dennis Luxen b844634a85 Adding operator<<() and Reset() functions to PhantomNodes 2011-06-10 08:25:26 +00:00
Pascal Neis c93e948bc8 bugifxing 2011-06-09 07:27:29 +00:00
Pascal Neis dafb0f7e37 remove 2011-06-09 07:12:56 +00:00
Pascal Neis d531a1f255 solved the problem with the moving of the marker at zooming 2011-06-09 07:09:17 +00:00
Pascal Neis 39d6527ea4 backup of the old markers 2011-06-09 07:06:35 +00:00
Pascal Neis ffb21d613e Smaller size of the markers 2011-06-09 07:04:29 +00:00
Dennis Luxen 46afc9fb08 Missing initializations 2011-06-01 09:08:36 +00:00
Dennis Luxen f2a3041ce7 Picture was missing 2011-05-31 08:23:25 +00:00
Dennis Luxen d761d0fa9d Partially fixes ticket #31 where oneway streets may be be ignored at the start or end of a route 2011-05-30 17:46:56 +00:00
Dennis Luxen 5f6cac9155 make sure any data structure is only loaded once. saves roughly 25% of RAM and starts up 10% faster on benchmark instances. 2011-05-26 09:16:04 +00:00
Dennis Luxen 860e73a633 minor typo 2011-05-26 08:44:00 +00:00
Dennis Luxen 9ad7d9db8f Updated README (Thanks again Bharath!) 2011-05-24 13:53:13 +00:00
Dennis Luxen fba77ff459 projection from lat/lon to nearest point on road network has been reworked and is more precise (Thanks again Bharath!) 2011-05-24 13:52:51 +00:00
Dennis Luxen 8d5c42d7f8 Support for yet another subdomain 2011-05-22 10:17:36 +00:00
Dennis Luxen 408dc7358b Clear markers on new route, show boundaries of map data when run on map.project-osrm.org, route is always recalculated on drag completion 2011-05-20 12:15:50 +00:00
Dennis Luxen ff5ac3a109 Missing image files. 2011-05-20 11:12:00 +00:00
Dennis Luxen 8f637b95ef Fixes ticket 30 and gives ref tags precedence over name tags 2011-05-19 16:44:34 +00:00
Dennis Luxen fadaf7ec5c Fixes wrong wrong position of target edge for some routes 2011-05-19 13:50:32 +00:00
Dennis Luxen 8b8e0eb9ef Prepare RoutePlugin for several instantiations with different metrics 2011-05-18 11:52:53 +00:00
Dennis Luxen 3bfb274d24 **BREAKING CHANGE ** Removing unnecessary information at edge objects. saves roughly 10% of space. **BREAKING CHANGE ** Please redo all preprocessing. 2011-05-18 11:38:09 +00:00
Dennis Luxen 0d3e8914ae renaming metric 2011-05-18 09:54:19 +00:00
Dennis Luxen 5cebe65f38 Pascal, welcome to the list of authors 2011-05-17 12:43:45 +00:00
Pascal Neis 023c655c6e Styling for WebFrontend/OpenLayers - pt.3 2011-05-16 10:44:45 +00:00
Pascal Neis 8bae431503 Styling for WebFrontend/OpenLayers - pt.2 2011-05-16 10:39:17 +00:00
Pascal Neis 87eab2b242 Styling for WebFrontend/OpenLayers 2011-05-16 10:37:36 +00:00
Pascal Neis 86ec00867a Images for WebFrontend/OpenLayers 2011-05-16 10:37:08 +00:00
Dennis Luxen 2df5d58027 template parameter was not used but fixed type instead 2011-05-16 09:53:49 +00:00
Dennis Luxen 5f327f450d changing demo link to http://map.project-osrm.org 2011-05-16 07:29:34 +00:00
Pascal Neis 10bd19f4e1 JS for the Index.html WebFrontend 2011-05-15 19:54:34 +00:00
Pascal Neis 4962678776 JS for the Index.html WebFrontend 2011-05-15 19:54:12 +00:00
Pascal Neis 82ef4170cb JS for the Index.html WebFrontend 2011-05-15 19:53:09 +00:00
Pascal Neis fca4c19406 JS for the Index.html WebFrontend 2011-05-15 19:44:06 +00:00
Pascal Neis bf7bab8ea3 JS for the Index.html WebFrontend 2011-05-15 19:41:27 +00:00
Pascal Neis ce73bd7501 Index.html of the WebFrontend 2011-05-15 19:36:48 +00:00
Pascal Neis 0239365964 OpenLayers Version 2.10 2011-05-15 19:32:50 +00:00
Pascal Neis 1ff580d9eb new import 2011-05-15 19:29:40 +00:00
Pascal Neis db9b65d7ed images 2011-05-15 19:27:37 +00:00
Pascal Neis c0f33222ea new dir for website from http://map.project-osrm.org/ 2011-05-15 19:24:51 +00:00
Dennis Luxen 0328057a9d changing debug output to new descripte configuration class 2011-05-13 14:48:48 +00:00
Dennis Luxen d531c5beb5 silly typo always gave instructions 2011-05-13 14:47:31 +00:00
Dennis Luxen 243fc2664a motorway instruction text fishy 2011-05-13 14:39:04 +00:00
Dennis Luxen 61b8b320e3 Position of instruction off by one 2011-05-13 12:37:04 +00:00
Dennis Luxen 689b447990 introducing &instructions=true/false. Configuration of Descriptor refactored 2011-05-13 09:16:58 +00:00
Dennis Luxen 1cbf2ab0d7 HTML entities in street names 2011-05-13 09:15:37 +00:00
Dennis Luxen 5c0ed9229d support for subdomains on the sourceforge hosting site 2011-05-12 09:02:38 +00:00
Dennis Luxen 0a29df80d0 Distance was not summed up correctly 2011-05-11 13:23:46 +00:00
Dennis Luxen d2b6ac722b output of geometry can be triggered by geometry=true/false (thanks Bharath).
route generalization is determined by zoom level. &simplified=true is thereby not valid, use &z=19 for the non-generalized geometry
2011-05-11 11:35:15 +00:00
Dennis Luxen 2784e273bc Fix for incorrect street names 2011-05-11 09:31:07 +00:00
Dennis Luxen 0332b11793 compile time stated at startup 2011-05-11 08:03:27 +00:00
Dennis Luxen 9de3a5a586 Filtering of geometry details by zoom level 2011-05-10 10:24:13 +00:00
Dennis Luxen 5642dc00e1 Code cleanup 2011-05-07 09:02:50 +00:00
Dennis Luxen 75f80029f6 linux compile fixes. grmbl 2011-05-07 07:43:48 +00:00
Dennis Luxen a93738dd79 Mac OS X compile fixes 2011-05-07 07:36:17 +00:00
Dennis Luxen 4f78634994 Fixes a translation bug 2011-04-27 16:01:27 +00:00
Dennis Luxen 1f7ddc865f Return a valid route even if nameIDs are bogus 2011-04-21 09:26:32 +00:00
Dennis Luxen 2c6e68dda7 Abort build if protobuf is too old 2011-04-20 13:20:27 +00:00
Dennis Luxen d29a27cca7 Assert could fire in wrong place. omitted 2011-04-20 12:03:24 +00:00
Dennis Luxen 90bd34d8ac Support for additional parameter '&simplified=yes' that outputs a simplified geometry that does not depict all of the small road segments but omits some. Usually, this is not visible to the user. 2011-04-19 16:03:48 +00:00
Dennis Luxen fb2a414839 fixes ticket 26 and another race condition/memory leak issue 2011-04-19 08:46:04 +00:00
Dennis Luxen 68c210d184 (more) accurate travel time on segments 2011-04-18 16:47:10 +00:00
Dennis Luxen 4e01f75be7 Remove superflous file. 2011-04-18 09:42:43 +00:00
Dennis Luxen 9514c4b811 jsonp support by adding "output=json&jsonp=parseResponse" to URL 2011-04-18 09:18:29 +00:00
Dennis Luxen 51d0b94e90 Output format is selectable with additional parameter to URL: &output={kml,json} 2011-04-18 08:12:44 +00:00
Dennis Luxen 66a3da0694 rearranging includes! 2011-04-15 16:41:37 +00:00
Dennis Luxen b5562485ab inlining functions 2011-04-15 16:39:44 +00:00
Dennis Luxen c62e1ac5fe Fixed fence, fixed nodecounting 2011-04-15 16:37:48 +00:00
Dennis Luxen df6e229cfc Parameter can be made const 2011-04-15 16:36:12 +00:00
Dennis Luxen 92b467ae77 Moved pathinfo struct to common place 2011-04-15 16:33:37 +00:00
Dennis Luxen 8502b62c77 Descriptor that outputs JSON formatted routing info 2011-04-15 16:31:04 +00:00
Dennis Luxen 6b91ae4585 Resizing level vector when non-existing level is requested. 2011-04-02 21:18:52 +00:00
Dennis Luxen 43c2e3a291 SConscript didn't fail when protobuffers version was insufficient (Thanks yobiSource) 2011-03-31 16:55:16 +00:00
Dennis Luxen 08854d9f6b reporting actual number of nodes instead of what data file wants 2011-03-31 14:44:41 +00:00
Dennis Luxen 571e6be9ce Checking for boost_system 2011-03-30 20:03:16 +00:00
Dennis Luxen b5aa1554c0 kml file indicates that it is indeed UTF-8 encoded. Thanks Frederik! 2011-03-30 18:18:29 +00:00
Dennis Luxen 68b02a2348 reading string resulted in garbage when char buffer is not cleared every time. Occured on certain locales 2011-03-30 18:10:47 +00:00
Dennis Luxen 08661558f2 HashTable class missed operator[] 2011-03-30 15:38:32 +00:00
Dennis Luxen ed608f9f13 provide a little more fault-tolerance when input data is fishy 2011-03-30 12:26:38 +00:00
Dennis Luxen ac6583906d fixing a silly endless loop that occurred when an edge had a starting node that was not present in node data (Thanks Frederik) 2011-03-30 11:24:11 +00:00
Dennis Luxen 878e837679 removing obsolete file 2011-03-30 07:37:18 +00:00
Dennis Luxen 3a421f04ad New plugin "Nearest" locates the nearest point on an edge to a given input coordinate. Needed for draggable routes. 2011-03-29 15:02:07 +00:00
Dennis Luxen 929793f7a8 cleaning up the SConstruct 2011-03-29 14:27:44 +00:00
Dennis Luxen 5217307132 start and target are now identified by name in description and heading is given in first advice. 2011-03-29 13:35:13 +00:00
Dennis Luxen 06ce09d0d7 Adding ignores 2011-03-29 13:34:16 +00:00
Dennis Luxen 010627b75a removing unnecessary data copies and redundant for loops. Thanks Moritz! 2011-03-29 09:53:48 +00:00
Dennis Luxen 26966f5cdb removing precompiled libprotobuf objects. fixes ticket 23 2011-03-29 09:16:49 +00:00
Dennis Luxen 9be6c1c795 Removing dead code 2011-03-29 08:53:41 +00:00
Dennis Luxen 3d44f3eb64 BREAKING CHANGE: kml-based turn-by-turn instructions 2011-03-28 16:34:06 +00:00
Dennis Luxen b6cf33b353 removing unnecessary comments 2011-03-28 16:32:47 +00:00
Dennis Luxen 7437bad834 renaming extractLargeNetwork to extractor 2011-03-28 12:50:12 +00:00
Dennis Luxen 78df3ae23a renaming extractLargeNetwork to extractor 2011-03-28 12:49:09 +00:00
Dennis Luxen b5c92f20b4 Putting typedefs where they belong. 2011-03-28 08:59:15 +00:00
Dennis Luxen 4fef3195b9 Rounding doubles to int where applicable. 2011-03-25 16:49:28 +00:00
Dennis Luxen 03a53c4fdb BREAKING CHANGE. grid now using mercator projection. 2011-03-25 12:49:45 +00:00
Dennis Luxen a60c5f651a Updated docs a bit. No one reads those anyway, eh? 2011-03-25 10:06:46 +00:00
Dennis Luxen ddd6d800fc Reflecting changes for 0.2 Release 2011-03-24 15:28:43 +00:00
Dennis Luxen 5f711c5e03 Parameterize amount of RAM for extractLargenetwork. Fixes ticket 21. 2011-03-24 15:06:49 +00:00
Dennis Luxen 417f02d30a Removing duplicate Header 2011-03-24 14:11:58 +00:00
Dennis Luxen 654ca2de2b Delete duplicate header file, introducing SparseTableStorage 2011-03-24 13:32:15 +00:00
Dennis Luxen 846bb11cc0 BREAKING CHANGE! Intermediate file format is not ASCII encoded anymore. Saves roughly 40 % space. Loading and saving is now much faster. Also, 50% I/Os less by writing the intermediate data non-linear. Please recompute all your data files. 2011-03-23 17:15:13 +00:00
Dennis Luxen 29977c4b88 Extractor reworked to take only about 2.5GB of RAM while extracting the planet 2011-03-22 17:38:18 +00:00
Dennis Luxen 445f7c9a92 Performance enhancements. Planet can be extracted within 65 minutes on a core i7/980 using 2.5GB of RAM. 2011-03-20 21:53:37 +00:00
Dennis Luxen 0e44126df6 Removing a few lines of uncommented debug code 2011-03-20 21:23:55 +00:00
Dennis Luxen 5347b285e5 forgot some debug output 2011-03-18 11:52:48 +00:00
Dennis Luxen df4ead91b6 Introducing AdressCallback in Parser, reverting node renumbering 2011-03-18 10:55:18 +00:00
Dennis Luxen 73dc97b95d osm.bz2 parsing fixed 2011-03-18 10:54:09 +00:00
Dennis Luxen 6b6ed949b4 helper define (minor change) 2011-03-18 10:39:48 +00:00
Dennis Luxen cd51481ce1 .osm.bz2 parsing fixed 2011-03-17 21:29:11 +00:00
Dennis Luxen 09ad2ff699 Giving the Heap a simple dijkstra data type 2011-03-16 20:23:07 +00:00
Dennis Luxen df4768132e minor change 2011-03-16 19:45:09 +00:00
Dennis Luxen 247dee0966 removing stalled node attribute 2011-03-16 19:43:26 +00:00
Dennis Luxen 3db44b3ce1 minor changes 2011-03-15 15:20:14 +00:00
Dennis Luxen e695e269b1 introducing tuning parameters 2011-03-15 15:19:20 +00:00
Dennis Luxen 7562795b4b debug output left over 2011-03-14 18:51:15 +00:00
Dennis Luxen 951d6d9311 fix double free 2011-03-14 18:49:03 +00:00
Dennis Luxen 7d5cb718cf typo 2011-03-14 18:06:44 +00:00
Dennis Luxen be34eebda7 Writing level information into seperate file 2011-03-14 18:01:02 +00:00
Dennis Luxen 229812cd95 missing return statement 2011-03-14 17:06:29 +00:00
Dennis Luxen 4c5f8f1ce3 code cleanup 2011-03-14 17:04:24 +00:00
Dennis Luxen f231484cc9 readOSRMGraphFromStream() counts the number of distinct nodes 2011-03-14 17:03:19 +00:00
Dennis Luxen 9d1d1a3a54 website under version control 2011-03-14 17:00:44 +00:00
Dennis Luxen 30369c7701 Added test functions to collect statistical data (mostly useless to any user) 2011-03-14 16:59:48 +00:00
Dennis Luxen f1f2541e4d Deleting objects as soon as possible should give a few extra bytes of RAM during precomputation (thanks 7.prime) 2011-03-14 13:40:31 +00:00
Dennis Luxen 2b639a5a14 RequestHandler object is now returned as reference rather than as pointer. Memory handling should be more clear by that change. 2011-03-14 13:39:16 +00:00
Dennis Luxen da3789f2ce Fixing regression and rewrote portions of the memory handling of registered server plugins 2011-03-14 13:35:16 +00:00
Dennis Luxen 50373d0a94 Allocated objects are not deleted at shutdown (thanks 7.prime) 2011-03-14 11:01:20 +00:00
Dennis Luxen 72fc514370 Getting rid of third party dependency for boost_program_options part 3 2011-03-11 16:57:31 +00:00
Dennis Luxen dae3152c9c Getting rid of third party dependency for boost_program_options part 2 2011-03-11 16:53:30 +00:00
Dennis Luxen a2b096b096 Getting rid of third party dependency for boost_program_options 2011-03-11 16:52:30 +00:00
Dennis Luxen 6a3fe6edeb Added sanity check for the case when empty table was cleared. 2011-03-11 12:59:55 +00:00
Dennis Luxen d2c532e4d5 Removed Dead code 2011-03-10 16:01:44 +00:00
Dennis Luxen 75ba542c38 Sanity checks for upper/lower bounds on the lat/lon coordinates. Fixes several segfaults. 2011-02-15 17:00:39 +00:00
Dennis Luxen 221080e281 Support for gzip compression when using http 1.1; giving gzip precendence 2011-02-13 11:15:56 +00:00
Dennis Luxen d0547f3d69 Support http 1.1 deflate compression 2011-02-11 16:12:37 +00:00
Dennis Luxen e48b47f1ec Typo 2011-02-06 19:27:44 +00:00
Dennis Luxen 164c9333ef fixes ticket 6. Slight speed increase for queries, escpecially long distance ones. 2011-01-14 17:21:19 +00:00
Dennis Luxen e32ba24b6a fixing ticket 20. stxxl should not complain any more. also, there should be no compiler warnings. 2011-01-14 16:54:42 +00:00
Dennis Luxen 46a690dfc2 Updated third party dependencies 2011-01-14 15:59:54 +00:00
Dennis Luxen e9cfe94dfd Updated SConstruct to reflect new dependencies 2011-01-12 19:59:29 +00:00
Dennis Luxen cf46fd79b0 PBF Support (Thanks to Christian for explanations) 2011-01-12 18:08:10 +00:00
Dennis Luxen d38adbe7f1 Fixed warnings 2011-01-12 17:09:04 +00:00
Dennis Luxen 85bc62948b Minor C++ include fixes 2011-01-11 17:47:49 +00:00
Dennis Luxen f663df87d4 Minor C++ include fixes 2011-01-11 17:42:55 +00:00
Dennis Luxen edfa70aff0 Updated SConstruct to be more compliant 2011-01-10 11:06:06 +00:00
Dennis Luxen 7584c78c25 Forgot to comment some debug code 2011-01-09 21:49:27 +00:00
Dennis Luxen 1ecca0db74 This is a large update that brings many internal and architectural changes. The most obvious change to the user is the presence of configuration files for extractLargeNetwork and routed. Optimistically speaking, it should not break anything. Thanks to rskr for support patches and suggestions. 2011-01-09 21:45:16 +00:00
Dennis Luxen bfd2a8aee2 This is a large update that brings many internal and architectural changes. The most obvious change to the user is the presence of configuration files for extractLargeNetwork and routed. Optimistically speaking, it should not break anything. Thanks to rskr for support patches and suggestions. 2011-01-09 21:42:27 +00:00
Dennis Luxen f45af2ba72 precursor to the many coming changes 2011-01-09 16:55:05 +00:00
Dennis Luxen 17310a9d2b Fixes a race condition when more than one thread tries to access the grid file (thanks Patrick) 2010-11-18 16:58:31 +00:00
Dennis Luxen e176115273 Fixes a race condition when more than one thread tries to access the grid file (thanks Patrick) 2010-11-18 16:56:22 +00:00
Dennis Luxen 73ab331506 Route description output turned off 2010-11-17 15:54:58 +00:00
Dennis Luxen 03772fd85b Preprocessing of routing datastructures at least 30 percent faster (Monav backport, thanks Christian) 2010-11-17 14:03:18 +00:00
Dennis Luxen 545162cd4c Route description output turned off 2010-11-17 14:02:27 +00:00
Dennis Luxen 054bffc0f6 Minor glitch fixed 2010-11-17 13:37:17 +00:00
Dennis Luxen ddad5a0523 workaround non-initialized value if its not possible to locate an edge close to a coordinate 2010-10-26 09:54:49 +00:00
Dennis Luxen b1ee58b8e8 TurnInfo is now computed in a seperate object 2010-10-05 11:28:27 +00:00
Dennis Luxen 0f1f99dbf2 Propagating turn info to hsgr 2010-10-04 11:00:36 +00:00
Dennis Luxen 5692d43abb Propagating turn info (not yet finished) 2010-10-01 16:30:35 +00:00
Dennis Luxen 512aabc7a4 unnecessary output at the moment 2010-10-01 12:17:31 +00:00
Dennis Luxen 3b885a492c Every node in route carries a bit that indicates if its possible at all to take a turn 2010-10-01 10:32:39 +00:00
Dennis Luxen e91058c2eb Output formatting 2010-10-01 10:30:46 +00:00
Dennis Luxen 7e77a1f9cd Forgot to remove debug output 2010-09-30 16:02:43 +00:00
Dennis Luxen f35d87f685 check for correct number of arguments (Thanks Dane!) 2010-09-30 15:43:11 +00:00
Dennis Luxen 5637c2f92a BREAKING CHANGE, REPROCESS YOUR OSM FILES
Information if its possible at all to turn at the end of edges is propagated through the complete toolchain
2010-09-30 15:40:48 +00:00
Dennis Luxen 94cfb4aad7 nompute a vector<bool> that indicates if it's possible at all to take a turn at a certain node 2010-09-29 16:40:36 +00:00
Dennis Luxen 676f64b0ef BREAKING CHANGE, REPROCESS YOUR OSM FILES
All preparations necessary to compute and output turn directions.
2010-09-29 15:22:38 +00:00
Dennis Luxen 4c47d5b70e segfault if first routing node equals start node 2010-09-29 13:22:12 +00:00
Dennis Luxen affaa106d1 name of way is now extracted and id of name is prepared. 2010-09-26 18:30:58 +00:00
Dennis Luxen 76488c58e8 Preparing data structures for turn directions 2010-09-23 15:34:22 +00:00
Dennis Luxen 586e8b4c4b Saving a byte per node 2010-09-22 10:21:18 +00:00
Dennis Luxen 2acfe2591f Fixing a rare case of route construction problems when origin were on the same edge which was stored reversed in graph. 2010-09-22 07:50:00 +00:00
Dennis Luxen 8f06b2fa31 It is way too late to fix silly bugs. 2010-09-21 17:15:59 +00:00
Dennis Luxen c36fc9e49f Forgot to guard against bad data from NNGrid 2010-09-21 16:23:50 +00:00
Dennis Luxen ee56d0051f Fixing odd behavior when origin and destination are on the same street. 2010-09-21 15:59:52 +00:00
Dennis Luxen 1de5496e9a removing excessive use of time stamps 2010-09-21 15:58:52 +00:00
Dennis Luxen 61a8b6820f Same include twice 2010-09-20 09:32:16 +00:00
Dennis Luxen 4a9698844e Ferries back in 2010-09-19 16:31:44 +00:00
Dennis Luxen 27ff707d54 misplaced assertion 2010-09-17 15:33:11 +00:00
Dennis Luxen 53aa2f54e5 Fixes a problem with stxxl, that throws an exception on exit of main function. Thanks Frederik. 2010-09-17 11:41:14 +00:00
Dennis Luxen be836dc950 fixing last leg of output path 2010-09-17 08:46:43 +00:00
Dennis Luxen 9c13a8a6dd unclassified roads have wrong default speed (thanks again twain47) 2010-09-16 15:37:11 +00:00
Dennis Luxen 41e5a52509 last leg of route is now computed correctly 2010-09-16 15:08:45 +00:00
Dennis Luxen 6cefcf568b Fixed a bug related to roundabouts. Thanks to twain47 for reporting. 2010-09-16 13:02:38 +00:00
Dennis Luxen a07efcc4b7 moving common code into a single file 2010-09-15 13:49:26 +00:00
Dennis Luxen 10ea331909 sorting input edges with multiple core if available 2010-09-15 13:48:31 +00:00
Dennis Luxen 94c8c61a05 New auxiliary method 2010-09-14 16:40:11 +00:00
Dennis Luxen 43bbf953c1 Fixes bad alloc for large graphs 2010-09-13 15:31:29 +00:00
Dennis Luxen effee46011 New DynamicGraph uses less RAM, Monav backport. Thanks 2010-09-13 14:16:07 +00:00
Dennis Luxen 891b068551 forgot to comment debug output 2010-09-03 14:39:29 +00:00
Dennis Luxen 32a357c434 Much faster routing description. Thanks Christian 2010-09-03 13:28:33 +00:00
Dennis Luxen 6fcc6722c4 nearest neighbor grid can now be specialized to be read only with a template parameter. 2010-09-03 07:14:58 +00:00
Dennis Luxen f9f4fa2972 Fixed potential memory leak 2010-09-02 15:56:12 +00:00
Dennis Luxen 1ba915cbed BREAKING CHANGE, REPROCESS YOUR OSM FILES
Ferry egdes are now ignores by nearest neighbor grid
2010-09-02 15:47:55 +00:00
Dennis Luxen e79e36bea9 Perfomance fixes 2010-09-02 13:01:49 +00:00
Dennis Luxen cc44fef25d Fix problem with long edges (ferry connections) 2010-09-02 09:13:59 +00:00
Dennis Luxen 0875c2d557 BREAKING CHANGE: the routing engine does not use the kd-tree anymore, but an external memory nearest neighbor grid. The memory consumption is less than half. This is a breaking change, please reprocess your .osrm files and take note that the parameter to routed have been changed!
Known Bug: There are some minor rounding errors that affect the position of start and destination node by a few feet.
2010-08-31 14:00:40 +00:00
Dennis Luxen 027c0e46ee Compilation fixes for Mac. Works with g++ 4.4 from MacPorts 2010-08-25 19:15:17 +00:00
Dennis Luxen 34b67d0621 Minor code tweaks 2010-08-25 14:12:17 +00:00
Dennis Luxen b3fded0725 Reverting change that made path unpacking impossible 2010-08-25 09:33:41 +00:00
Dennis Luxen dc889cfe80 DNDEBUG is set for release build. Assertions are skipped now in release build. 2010-08-25 07:56:25 +00:00
Dennis Luxen a9b76e8050 Using less RAM, Fixing a leak in ContractionCleanup. 2010-08-24 13:50:58 +00:00
Dennis Luxen 897f328b45 Disabled count of components of input graph, because its wasting too much memory. 2010-08-24 13:02:59 +00:00
Dennis Luxen 8148fad464 Monav project changes backport 2010-08-17 16:59:13 +00:00
Dennis Luxen 95dddcf522 minor tweaks 2010-08-13 10:28:16 +00:00
Dennis Luxen d8701a7e41 fixed a strange behaviour on OSM data covering the US. 2010-08-13 09:21:58 +00:00
Dennis Luxen 3bdfd1437b Ferries are now extracted with 25 kph average speed. 2010-08-12 16:49:59 +00:00
Dennis Luxen 106155a97a forgot debug output 2010-08-12 15:43:49 +00:00
Dennis Luxen 59abeccc3e Show the number of connected components and the size of the largest one 2010-08-12 15:42:22 +00:00
Dennis Luxen 4f883aaeda corrected timing of kd tree construction 2010-08-12 15:41:14 +00:00
Dennis Luxen 77df6616a9 sanity check for nodes in loaded graph 2010-08-12 11:49:41 +00:00
Dennis Luxen 171815c9b7 backported kd tree improvements from monav project: faster with base case 8 2010-08-12 11:39:06 +00:00
Dennis Luxen b87d6f3c66 GetOutDegree more implementation independent 2010-08-12 11:37:13 +00:00
Dennis Luxen 52d1c1abfc ignored the last bytes of bzip2 stream 2010-08-11 12:32:06 +00:00
Dennis Luxen a96f932016 ability to handle bzip2 compressed files consisting of multiple streams (pbzip2) 2010-08-11 08:56:59 +00:00
Dennis Luxen 85388b3112 Naming convention typos. 2010-08-10 17:11:52 +00:00
Dennis Luxen 65351959fe extraction is now able to handle bzip2 compressed input files 2010-08-10 17:06:37 +00:00
Dennis Luxen d07dd71078 Dense is dense and sparse is sparse 2010-08-07 12:25:45 +00:00
Dennis Luxen 5a67a79569 endl should be flush again 2010-08-06 20:32:24 +00:00
Dennis Luxen 25ecd5072f endl should be flush 2010-08-06 19:37:43 +00:00
Dennis Luxen 7c05cf9980 Make output more verbose while extracting data. 2010-08-06 19:33:54 +00:00
Dennis Luxen 051b710484 Use different map 2010-08-06 16:24:06 +00:00
Dennis Luxen ae0e6d6516 extractLargeNetwork has fault-tolerance now.
extractNetwork has been deprecated.
2010-08-06 15:30:00 +00:00
Dennis Luxen 048c04d0f1 Make SConstruct obey buildconfigurations and other minor changes 2010-07-30 17:41:36 +00:00
Dennis Luxen 38fd46565e Removed unnecessary line 2010-07-29 08:49:39 +00:00
Dennis Luxen 2acad805b3 Removed unneeded code from http component 2010-07-26 12:27:58 +00:00
Dennis Luxen 7f63a84295 make stxxl run quiet (works with latest version from trunk only) 2010-07-26 09:46:03 +00:00
Dennis Luxen 1f8235ec98 typo 2010-07-26 08:18:36 +00:00
Dennis Luxen ec0108553f removed libkdtree++ dependency. 2010-07-26 08:17:52 +00:00
Dennis Luxen 92963ced1f Updated Readme 2010-07-24 14:18:19 +00:00
Dennis Luxen 5052302f97 Parameter for STXXL root path 2010-07-24 14:11:20 +00:00
Dennis Luxen a83b790225 GCC 4.2 Compile fix. Code compiles with older GCC, that the default compiler on Mac OS. Only a few warnings left. 2010-07-24 14:05:03 +00:00
Dennis Luxen e8baf75ec2 Removed a few redundant lines 2010-07-24 14:02:01 +00:00
Dennis Luxen e38d473fdd Compile Fixes on Mac 2010-07-24 14:00:00 +00:00
Dennis Luxen 49a088ac87 Upgraded speed profile to the one of ORS 2010-07-23 22:10:57 +00:00
Dennis Luxen 51cc0bb209 Moving redundant code into common include file. 2010-07-23 20:22:35 +00:00
Dennis Luxen 4ce7739453 Lat/Lon mixed up in output of locate command. Thanks to Ted Rosenbaum. 2010-07-23 13:00:16 +00:00
Dennis Luxen a02dafb8d7 Minor fixes in Scons script 2010-07-23 12:34:15 +00:00
Dennis Luxen 5c13171e29 2010-07-21 15:39:51 +00:00
Dennis Luxen 681f3c46e7 Make SConscript work with eclipse plugin 2010-07-21 15:29:41 +00:00
Dennis Luxen 13a88e712f Experimental compile on Mac 2010-07-21 15:03:26 +00:00
Dennis Luxen 4177ab6df9 Checking C++ now 2010-07-20 14:42:41 +00:00
Dennis Luxen 60d472ac56 changing build management to scons 2010-07-20 13:33:06 +00:00
Dennis Luxen dd6c87e12d Replacing many includes by a single one 2010-07-20 13:16:36 +00:00
Dennis Luxen 27a6bcd7ce Removed redundant code for extractors 2010-07-20 09:46:52 +00:00
Dennis Luxen 94d50c1fdd longitude label was off by a factor of 10. 2010-07-17 11:44:09 +00:00
Dennis Luxen 604024e3e3 Removed dead code 2010-07-17 11:42:29 +00:00
Dennis Luxen 4df82206b4 Additional road network extractor that works in external memory. 2010-07-15 14:45:43 +00:00
Dennis Luxen 72e314d1c0 kdtree usage simplified and dropped intermediate data structures
kdtree build-up twice at fast
int2ext node map holds iterators instead of object copies
some functions const'ed
buggy defines fixed
2010-07-14 16:29:18 +00:00
Dennis Luxen 61c19405fd Faster routed startup (roughly 20%) 2010-07-14 14:22:29 +00:00
Dennis Luxen 4351e8850a Queries are now handled by a static graph which means less RAM usage and faster queries. 2010-07-14 12:56:24 +00:00
Dennis Luxen fa5a042071 Queries are now handled by a static graph which means less RAM usage and faster queries. 2010-07-14 12:55:53 +00:00
Dennis Luxen 18b278fe1d Incorrect usage of flushes fixed. Thanks to Dennis Schieferdecker. 2010-07-13 10:13:16 +00:00
Dennis Luxen eead597c9e More Todos 2010-07-10 07:23:09 +00:00
Dennis Luxen cea7c28626 typos in the name of files. 2010-07-09 12:52:13 +00:00
Dennis Luxen d4a64d2168 Initial Import. 2010-07-09 09:05:40 +00:00
Dennis Luxen a44a309de5 Initial import. 2010-07-09 07:52:46 +00:00
397 changed files with 38783 additions and 10200 deletions
+54
View File
@@ -0,0 +1,54 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: true
AlwaysBreakTemplateDeclarations: false
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: false
ColumnLimit: 100
ConstructorInitializerAllOnOneLineOrOnePerLine: false
DerivePointerBinding: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: false
MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: true
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000
PenaltyReturnTypeOnItsOwnLine: 60
PointerBindsToType: false
SpacesBeforeTrailingComments: 1
Cpp11BracedListStyle: true
Standard: Cpp11
IndentWidth: 4
TabWidth: 8
UseTab: Never
BreakBeforeBraces: Allman
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
CommentPragmas: '^ IWYU pragma:'
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
SpaceBeforeParens: ControlStatements
...
+94 -2
View File
@@ -1,2 +1,94 @@
/.settings
/.project
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files #
######################
.DS_Store
ehthumbs.db
Icon?
Thumbs.db
# build related files #
#######################
/build/
/Util/FingerPrint.cpp
/Util/GitDescription.cpp
/cmake/postinst
# Eclipse related files #
#########################
.setting*
.scb
.cproject
.project
# stxxl related files #
#######################
.stxxl
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 #
####################################
/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
/nohup.out
# Sandbox folder #
###################
/sandbox/
/test/profile.lua
# Deprecated config file #
##########################
/server.ini
View File
+55
View File
@@ -0,0 +1,55 @@
language: cpp
compiler:
- gcc
# - clang
# Make sure CMake is installed
install:
- sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
- sudo add-apt-repository -y ppa:boost-latest/ppa
- sudo apt-get update >/dev/null
- sudo apt-get -q install libprotoc-dev libprotobuf7 libprotobuf-dev libosmpbf-dev libbz2-dev libstxxl-dev libstxxl1 libxml2-dev libzip-dev lua5.1 liblua5.1-0-dev rubygems libtbb-dev
- sudo apt-get -q install g++-4.8
- sudo apt-get install libboost1.54-all-dev
#luabind
- curl https://gist.githubusercontent.com/DennisOSRM/f2eb7b948e6fe1ae319e/raw/install-luabind.sh | sudo bash
#osmosis
- curl -s https://gist.githubusercontent.com/DennisOSRM/803a64a9178ec375069f/raw/ | sudo bash
before_script:
- rvm use 1.9.3
- gem install bundler
- bundle install
- mkdir build
- cd build
- cmake .. $CMAKEOPTIONS
script:
- make -j 2
- make -j 2 tests
- cd ..
- cucumber -p verify
after_script:
# - cd ..
# - cucumber -p verify
branches:
only:
- master
- develop
cache:
- bundler
- apt
env:
- CMAKEOPTIONS="-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++-4.8" OSRM_PORT=5000 OSRM_TIMEOUT=60
- CMAKEOPTIONS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=g++-4.8" OSRM_PORT=5010 OSRM_TIMEOUT=60
notifications:
irc:
channels:
- irc.oftc.net#osrm
on_success: change
on_failure: always
use_notice: true
skip_join: false
recipients:
- dennis@mapbox.com
email:
on_success: change
on_failure: always
+148
View File
@@ -0,0 +1,148 @@
#ifndef __BFS_COMPONENT_EXPLORER_H__
#define __BFS_COMPONENT_EXPLORER_H__
#include "../typedefs.h"
#include "../DataStructures/DynamicGraph.h"
#include "../DataStructures/RestrictionMap.h"
#include <queue>
#include <unordered_set>
// Explores the components of the given graph while respecting turn restrictions
// and barriers.
template <typename GraphT> class BFSComponentExplorer
{
public:
BFSComponentExplorer(const GraphT &dynamicGraph,
const RestrictionMap &restrictions,
const std::unordered_set<NodeID> &barrier_nodes)
: m_graph(dynamicGraph), m_restriction_map(restrictions), m_barrier_nodes(barrier_nodes)
{
BOOST_ASSERT(m_graph.GetNumberOfNodes() > 0);
}
/*!
* Returns the size of the component that the node belongs to.
*/
inline unsigned int GetComponentSize(NodeID node)
{
BOOST_ASSERT(node < m_component_index_list.size());
return m_component_index_size[m_component_index_list[node]];
}
inline unsigned int GetNumberOfComponents() { return m_component_index_size.size(); }
/*!
* Computes the component sizes.
*/
void run()
{
std::queue<std::pair<NodeID, NodeID>> bfs_queue;
unsigned current_component = 0;
BOOST_ASSERT(m_component_index_list.empty());
BOOST_ASSERT(m_component_index_size.empty());
unsigned num_nodes = m_graph.GetNumberOfNodes();
m_component_index_list.resize(num_nodes, std::numeric_limits<unsigned>::max());
BOOST_ASSERT(num_nodes > 0);
// put unexplorered node with parent pointer into queue
for (NodeID node = 0; node < num_nodes; ++node)
{
if (std::numeric_limits<unsigned>::max() == m_component_index_list[node])
{
unsigned size = ExploreComponent(bfs_queue, node, current_component);
// push size into vector
m_component_index_size.emplace_back(size);
++current_component;
}
}
}
private:
/*!
* Explores the current component that starts at node using BFS.
*/
inline unsigned ExploreComponent(std::queue<std::pair<NodeID, NodeID>> &bfs_queue,
NodeID node,
unsigned current_component)
{
/*
Graphical representation of variables:
u v w
*---------->*---------->*
e2
*/
bfs_queue.emplace(node, node);
// mark node as read
m_component_index_list[node] = current_component;
unsigned current_component_size = 1;
while (!bfs_queue.empty())
{
// fetch element from BFS queue
std::pair<NodeID, NodeID> current_queue_item = bfs_queue.front();
bfs_queue.pop();
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 =
m_restriction_map.CheckForEmanatingIsOnlyTurn(u, v);
for (auto e2 : m_graph.GetAdjacentEdgeRange(v))
{
const NodeID w = m_graph.GetTarget(e2);
if (to_node_of_only_restriction != std::numeric_limits<unsigned>::max() &&
w != to_node_of_only_restriction)
{
// 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 (!m_restriction_map.CheckIfTurnIsRestricted(u, v, w))
{
// only add an edge if turn is not prohibited
if (std::numeric_limits<unsigned>::max() == m_component_index_list[w])
{
// insert next (node, parent) only if w has
// not yet been explored
// mark node as read
m_component_index_list[w] = current_component;
bfs_queue.emplace(w, v);
}
}
}
}
}
}
return current_component_size;
}
std::vector<unsigned> m_component_index_list;
std::vector<NodeID> m_component_index_size;
const GraphT &m_graph;
const RestrictionMap &m_restriction_map;
const std::unordered_set<NodeID> &m_barrier_nodes;
};
#endif
+182
View File
@@ -0,0 +1,182 @@
/*
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/Coordinate.h>
#include "DouglasPeucker.h"
#include "../DataStructures/SegmentInformation.h"
#include <boost/assert.hpp>
#include <cmath>
#include <algorithm>
struct CoordinatePairCalculator
{
CoordinatePairCalculator() = delete;
CoordinatePairCalculator(const FixedPointCoordinate &coordinate_a,
const FixedPointCoordinate &coordinate_b)
{
// initialize distance calculator with two fixed coordinates a, b
const float RAD = 0.017453292519943295769236907684886f;
first_lat = (coordinate_a.lat / COORDINATE_PRECISION) * RAD;
first_lon = (coordinate_a.lon / COORDINATE_PRECISION) * RAD;
second_lat = (coordinate_b.lat / COORDINATE_PRECISION) * RAD;
second_lon = (coordinate_b.lon / COORDINATE_PRECISION) * RAD;
}
int operator()(FixedPointCoordinate &other) const
{
// set third coordinate c
const float RAD = 0.017453292519943295769236907684886f;
const float earth_radius = 6372797.560856f;
const float float_lat1 = (other.lat / COORDINATE_PRECISION) * RAD;
const float float_lon1 = (other.lon / COORDINATE_PRECISION) * RAD;
// compute distance (a,c)
const float x_value_1 = (first_lon - float_lon1) * cos((float_lat1 + first_lat) / 2.f);
const float y_value_1 = first_lat - float_lat1;
const float dist1 = sqrt(std::pow(x_value_1, 2) + std::pow(y_value_1, 2)) * earth_radius;
// compute distance (b,c)
const float x_value_2 = (second_lon - float_lon1) * cos((float_lat1 + second_lat) / 2.f);
const float y_value_2 = second_lat - float_lat1;
const float dist2 = sqrt(std::pow(x_value_2, 2) + std::pow(y_value_2, 2)) * earth_radius;
// return the minimum
return static_cast<int>(std::min(dist1, dist2));
}
float first_lat;
float first_lon;
float second_lat;
float second_lon;
};
DouglasPeucker::DouglasPeucker()
: douglas_peucker_thresholds({512440, // z0
256720, // z1
122560, // z2
56780, // z3
28800, // z4
14400, // z5
7200, // z6
3200, // z7
2400, // z8
1000, // z9
600, // z10
120, // z11
60, // z12
45, // z13
36, // z14
20, // z15
8, // z16
6, // z17
4 // z18
})
{
}
void DouglasPeucker::Run(std::vector<SegmentInformation> &input_geometry, const unsigned zoom_level)
{
// check if input data is invalid
BOOST_ASSERT_MSG(!input_geometry.empty(), "geometry invalid");
if (input_geometry.size() < 2)
{
return;
}
input_geometry.front().necessary = true;
input_geometry.back().necessary = true;
{
BOOST_ASSERT_MSG(zoom_level < 19, "unsupported zoom level");
unsigned left_border = 0;
unsigned right_border = 1;
// Sweep over array and identify those ranges that need to be checked
do
{
// traverse list until new border element found
if (input_geometry[right_border].necessary)
{
// sanity checks
BOOST_ASSERT(input_geometry[left_border].necessary);
BOOST_ASSERT(input_geometry[right_border].necessary);
recursion_stack.emplace(left_border, right_border);
left_border = right_border;
}
++right_border;
} while (right_border < input_geometry.size());
}
// mark locations as 'necessary' by divide-and-conquer
while (!recursion_stack.empty())
{
// pop next element
const GeometryRange pair = recursion_stack.top();
recursion_stack.pop();
// sanity checks
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_int_distance = 0;
unsigned farthest_entry_index = pair.second;
const CoordinatePairCalculator DistCalc(input_geometry[pair.first].location,
input_geometry[pair.second].location);
// sweep over range to find the maximum
for (unsigned i = pair.first + 1; i < pair.second; ++i)
{
const int distance = DistCalc(input_geometry[i].location);
// found new feasible maximum?
if (distance > max_int_distance && distance > douglas_peucker_thresholds[zoom_level])
{
farthest_entry_index = i;
max_int_distance = distance;
}
}
// check if maximum violates a zoom level dependent threshold
if (max_int_distance > douglas_peucker_thresholds[zoom_level])
{
// mark idx as necessary
input_geometry[farthest_entry_index].necessary = true;
if (1 < (farthest_entry_index - pair.first))
{
recursion_stack.emplace(pair.first, farthest_entry_index);
}
if (1 < (pair.second - farthest_entry_index))
{
recursion_stack.emplace(farthest_entry_index, pair.second);
}
}
}
}
+58
View File
@@ -0,0 +1,58 @@
/*
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 <stack>
#include <utility>
#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*/
struct SegmentInformation;
class DouglasPeucker
{
private:
std::vector<int> douglas_peucker_thresholds;
typedef std::pair<unsigned, unsigned> GeometryRange;
// Stack to simulate the recursion
std::stack<GeometryRange> recursion_stack;
public:
DouglasPeucker();
void Run(std::vector<SegmentInformation> &input_geometry, const unsigned zoom_level);
};
#endif /* DOUGLASPEUCKER_H_ */
+169
View File
@@ -0,0 +1,169 @@
/*
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 EXTRACT_ROUTE_NAMES_H
#define EXTRACT_ROUTE_NAMES_H
#include <boost/assert.hpp>
#include <algorithm>
#include <string>
#include <vector>
struct RouteNames
{
std::string shortest_path_name_1;
std::string shortest_path_name_2;
std::string alternative_path_name_1;
std::string alternative_path_name_2;
};
// construct routes names
template <class DataFacadeT, class SegmentT> struct ExtractRouteNames
{
private:
SegmentT PickNextLongestSegment(const std::vector<SegmentT> &segment_list,
const unsigned blocked_name_id) const
{
SegmentT result_segment;
result_segment.length = 0;
for (const SegmentT &segment : segment_list)
{
if (segment.name_id != blocked_name_id && segment.length > result_segment.length && segment.name_id != 0)
{
result_segment = segment;
}
}
return result_segment;
}
public:
RouteNames operator()(std::vector<SegmentT> &shortest_path_segments,
std::vector<SegmentT> &alternative_path_segments,
const DataFacadeT *facade) const
{
RouteNames route_names;
SegmentT shortest_segment_1, shortest_segment_2;
SegmentT alternative_segment_1, alternative_segment_2;
auto length_comperator = [](const SegmentT &a, const SegmentT &b)
{ return a.length > b.length; };
auto name_id_comperator = [](const SegmentT &a, const SegmentT &b)
{ return a.name_id < b.name_id; };
if (shortest_path_segments.empty())
{
return route_names;
}
// pick the longest segment for the shortest path.
std::sort(shortest_path_segments.begin(), shortest_path_segments.end(), length_comperator);
shortest_segment_1 = shortest_path_segments[0];
if (!alternative_path_segments.empty())
{
std::sort(alternative_path_segments.begin(),
alternative_path_segments.end(),
length_comperator);
// also pick the longest segment for the alternative path
alternative_segment_1 = alternative_path_segments[0];
}
// compute the set difference (for shortest path) depending on names between shortest and
// alternative
std::vector<SegmentT> shortest_path_set_difference(shortest_path_segments.size());
std::sort(shortest_path_segments.begin(), shortest_path_segments.end(), name_id_comperator);
std::sort(alternative_path_segments.begin(), alternative_path_segments.end(), name_id_comperator);
std::set_difference(shortest_path_segments.begin(),
shortest_path_segments.end(),
alternative_path_segments.begin(),
alternative_path_segments.end(),
shortest_path_set_difference.begin(),
name_id_comperator);
std::sort(shortest_path_set_difference.begin(),
shortest_path_set_difference.end(),
length_comperator);
shortest_segment_2 =
PickNextLongestSegment(shortest_path_set_difference, shortest_segment_1.name_id);
// compute the set difference (for alternative path) depending on names between shortest and
// alternative
// vectors are still sorted, no need to do again
BOOST_ASSERT(std::is_sorted(shortest_path_segments.begin(),
shortest_path_segments.end(),
name_id_comperator));
BOOST_ASSERT(std::is_sorted(alternative_path_segments.begin(),
alternative_path_segments.end(),
name_id_comperator));
std::vector<SegmentT> alternative_path_set_difference(alternative_path_segments.size());
std::set_difference(alternative_path_segments.begin(),
alternative_path_segments.end(),
shortest_path_segments.begin(),
shortest_path_segments.end(),
alternative_path_set_difference.begin(),
name_id_comperator);
std::sort(alternative_path_set_difference.begin(),
alternative_path_set_difference.end(),
length_comperator);
if (!alternative_path_segments.empty())
{
alternative_segment_2 = PickNextLongestSegment(alternative_path_set_difference,
alternative_segment_1.name_id);
}
// move the segments into the order in which they occur.
if (shortest_segment_1.position > shortest_segment_2.position)
{
std::swap(shortest_segment_1, shortest_segment_2);
}
if (alternative_segment_1.position > alternative_segment_2.position)
{
std::swap(alternative_segment_1, alternative_segment_2);
}
// fetching names for the selected segments
route_names.shortest_path_name_1 =
facade->GetEscapedNameForNameID(shortest_segment_1.name_id);
route_names.shortest_path_name_2 =
facade->GetEscapedNameForNameID(shortest_segment_2.name_id);
route_names.alternative_path_name_1 =
facade->GetEscapedNameForNameID(alternative_segment_1.name_id);
route_names.alternative_path_name_2 =
facade->GetEscapedNameForNameID(alternative_segment_2.name_id);
return route_names;
}
};
#endif // EXTRACT_ROUTE_NAMES_H
+144
View File
@@ -0,0 +1,144 @@
/*
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 ITERATOR_BASED_CRC32_H
#define ITERATOR_BASED_CRC32_H
#include "../Util/SimpleLogger.h"
#include <iostream>
#if defined(__x86_64__) && !defined(__MINGW64__)
#include <cpuid.h>
#else
#include <boost/crc.hpp> // for boost::crc_32_type
inline void __get_cpuid(int param, unsigned *eax, unsigned *ebx, unsigned *ecx, unsigned *edx)
{
*ecx = 0;
}
#endif
template <class ContainerT> class IteratorbasedCRC32
{
private:
typedef typename ContainerT::iterator IteratorType;
unsigned crc;
bool use_SSE42_CRC_function;
#if !defined(__x86_64__)
boost::crc_optimal<32, 0x1EDC6F41, 0x0, 0x0, true, true> CRC32_processor;
#endif
unsigned SoftwareBasedCRC32(char *str, unsigned len)
{
#if !defined(__x86_64__)
CRC32_processor.process_bytes(str, len);
return CRC32_processor.checksum();
#else
return 0;
#endif
}
// adapted from http://byteworm.com/2010/10/13/crc32/
unsigned SSE42BasedCRC32(char *str, unsigned len)
{
#if defined(__x86_64__)
unsigned q = len / sizeof(unsigned);
unsigned r = len % sizeof(unsigned);
unsigned *p = (unsigned *)str;
// 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;
}
#endif
return crc;
}
inline unsigned cpuid() const
{
unsigned eax = 0, ebx = 0, ecx = 0, edx = 0;
// on X64 this calls hardware cpuid(.) instr. otherwise a dummy impl.
__get_cpuid(1, &eax, &ebx, &ecx, &edx);
return ecx;
}
bool DetectNativeCRC32Support()
{
static const int SSE42_BIT = 0x00100000;
const unsigned ecx = cpuid();
const bool has_SSE42 = (ecx & SSE42_BIT) != 0;
if (has_SSE42)
{
SimpleLogger().Write() << "using hardware based CRC32 computation";
}
else
{
SimpleLogger().Write() << "using software based CRC32 computation";
}
return has_SSE42;
}
public:
IteratorbasedCRC32() : crc(0) { use_SSE42_CRC_function = DetectNativeCRC32Support(); }
unsigned operator()(IteratorType iter, const IteratorType end)
{
unsigned crc = 0;
while (iter != end)
{
char *data = reinterpret_cast<char *>(&(*iter));
if (use_SSE42_CRC_function)
{
crc = SSE42BasedCRC32(data, sizeof(typename ContainerT::value_type));
}
else
{
crc = SoftwareBasedCRC32(data, sizeof(typename ContainerT::value_type));
}
++iter;
}
return crc;
}
};
#endif /* ITERATOR_BASED_CRC32_H */
+99
View File
@@ -0,0 +1,99 @@
/*
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 <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_ */
+114
View File
@@ -0,0 +1,114 @@
/*
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"
#include "../DataStructures/SegmentInformation.h"
#include <osrm/Coordinate.h>
void PolylineCompressor::encodeVectorSignedNumber(std::vector<int> &numbers, std::string &output)
const
{
const unsigned end = static_cast<unsigned>(numbers.size());
for (unsigned i = 0; i < end; ++i)
{
numbers[i] <<= 1;
if (numbers[i] < 0)
{
numbers[i] = ~(numbers[i]);
}
}
for (const int number : numbers)
{
encodeNumber(number, output);
}
}
void PolylineCompressor::encodeNumber(int number_to_encode, std::string &output) const
{
while (number_to_encode >= 0x20)
{
const int next_value = (0x20 | (number_to_encode & 0x1f)) + 63;
output += static_cast<char>(next_value);
if (92 == next_value)
{
output += static_cast<char>(next_value);
}
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);
}
}
JSON::String PolylineCompressor::printEncodedString(const std::vector<SegmentInformation> &polyline)
const
{
std::string output;
std::vector<int> delta_numbers;
if (!polyline.empty())
{
FixedPointCoordinate last_coordinate = {0, 0};
for (const auto &segment : polyline)
{
if (segment.necessary)
{
const int lat_diff = segment.location.lat - last_coordinate.lat;
const int lon_diff = segment.location.lon - last_coordinate.lon;
delta_numbers.emplace_back(lat_diff);
delta_numbers.emplace_back(lon_diff);
last_coordinate = segment.location;
}
}
encodeVectorSignedNumber(delta_numbers, output);
}
JSON::String return_value(output);
return return_value;
}
JSON::Array
PolylineCompressor::printUnencodedString(const std::vector<SegmentInformation> &polyline) const
{
JSON::Array json_geometry_array;
for (const auto &segment : polyline)
{
if (segment.necessary)
{
std::string tmp, output;
FixedPointCoordinate::convertInternalLatLonToString(segment.location.lat, tmp);
output += (tmp + ",");
FixedPointCoordinate::convertInternalLatLonToString(segment.location.lon, tmp);
output += tmp;
json_geometry_array.values.push_back(output);
}
}
return json_geometry_array;
}
+51
View File
@@ -0,0 +1,51 @@
/*
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_
struct SegmentInformation;
#include "../DataStructures/JSONContainer.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:
JSON::String printEncodedString(const std::vector<SegmentInformation> &polyline) const;
JSON::Array printUnencodedString(const std::vector<SegmentInformation> &polyline) const;
};
#endif /* POLYLINECOMPRESSOR_H_ */
+459
View File
@@ -0,0 +1,459 @@
/*
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 "../typedefs.h"
#include "../DataStructures/DeallocatingVector.h"
#include "../DataStructures/DynamicGraph.h"
#include "../DataStructures/ImportEdge.h"
#include "../DataStructures/QueryNode.h"
#include "../DataStructures/Percent.h"
#include "../DataStructures/Range.h"
#include "../DataStructures/Restriction.h"
#include "../DataStructures/TurnInstructions.h"
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
#include "../Util/StdHashExtensions.h"
#include "../Util/TimingUtil.h"
#include <osrm/Coordinate.h>
#include <boost/assert.hpp>
#include <boost/filesystem.hpp>
#include <tbb/parallel_sort.h>
#ifdef __APPLE__
#include <gdal.h>
#include <ogrsf_frmts.h>
#else
#include <gdal/gdal.h>
#include <gdal/ogrsf_frmts.h>
#endif
#include <cstdint>
#include <memory>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
class TarjanSCC
{
private:
struct TarjanNode
{
TarjanNode() : index(SPECIAL_NODEID), low_link(SPECIAL_NODEID), on_stack(false) {}
unsigned index;
unsigned low_link;
bool on_stack;
};
struct TarjanEdgeData
{
TarjanEdgeData() : distance(INVALID_EDGE_WEIGHT), name_id(INVALID_NAMEID) {}
TarjanEdgeData(int distance, unsigned name_id) : distance(distance), name_id(name_id) {}
int distance;
unsigned name_id;
};
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> RestrictionTarget;
typedef std::vector<RestrictionTarget> EmanatingRestrictionsVector;
typedef std::unordered_map<RestrictionSource, unsigned> RestrictionMap;
std::vector<NodeInfo> m_coordinate_list;
std::vector<EmanatingRestrictionsVector> m_restriction_bucket_list;
std::shared_ptr<TarjanDynamicGraph> m_node_based_graph;
std::unordered_set<NodeID> barrier_node_list;
std::unordered_set<NodeID> traffic_light_list;
unsigned m_restriction_counter;
RestrictionMap m_restriction_map;
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())
{
TIMER_START(SCC_LOAD);
for (const TurnRestriction &restriction : irs)
{
std::pair<NodeID, NodeID> restriction_source = {restriction.fromNode,
restriction.viaNode};
unsigned index = 0;
const auto restriction_iterator = m_restriction_map.find(restriction_source);
if (restriction_iterator == 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_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)
.emplace_back(restriction.toNode, restriction.flags.isOnly);
}
barrier_node_list.insert(bn.begin(), bn.end());
traffic_light_list.insert(tl.begin(), tl.end());
DeallocatingVector<TarjanEdge> edge_list;
for (const NodeBasedEdge &input_edge : input_edges)
{
if (input_edge.source == input_edge.target)
{
continue;
}
if (input_edge.forward)
{
edge_list.emplace_back(input_edge.source,
input_edge.target,
(std::max)((int)input_edge.weight, 1),
input_edge.name_id);
}
if (input_edge.backward)
{
edge_list.emplace_back(input_edge.target,
input_edge.source,
(std::max)((int)input_edge.weight, 1),
input_edge.name_id);
}
}
input_edges.clear();
input_edges.shrink_to_fit();
BOOST_ASSERT_MSG(0 == input_edges.size() && 0 == input_edges.capacity(),
"input edge vector not properly deallocated");
tbb::parallel_sort(edge_list.begin(), edge_list.end());
m_node_based_graph = std::make_shared<TarjanDynamicGraph>(number_of_nodes, edge_list);
TIMER_STOP(SCC_LOAD);
SimpleLogger().Write() << "Loading data into SCC took " << TIMER_MSEC(SCC_LOAD)/1000. << "s";
}
~TarjanSCC() { m_node_based_graph.reset(); }
void Run()
{
TIMER_START(SCC_RUN_SETUP);
// 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 (nullptr == poDriver)
{
throw OSRMException("ESRI Shapefile driver not available");
}
OGRDataSource *poDS = poDriver->CreateDataSource("component.shp", nullptr);
if (nullptr == poDS)
{
throw OSRMException("Creation of output file failed");
}
OGRSpatialReference *poSRS = new OGRSpatialReference();
poSRS->importFromEPSG(4326);
OGRLayer *poLayer = poDS->CreateLayer("component", poSRS, wkbLineString, nullptr);
if (nullptr == poLayer)
{
throw OSRMException("Layer creation failed.");
}
TIMER_STOP(SCC_RUN_SETUP);
SimpleLogger().Write() << "shapefile setup took " << TIMER_MSEC(SCC_RUN_SETUP)/1000. << "s";
TIMER_START(SCC_RUN);
// The following is a hack to distinguish between stuff that happens
// before the recursive call and stuff that happens after
std::stack<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(),
SPECIAL_NODEID);
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;
const NodeID last_node = m_node_based_graph->GetNumberOfNodes();
std::vector<bool> processing_node_before_recursion(m_node_based_graph->GetNumberOfNodes(), true);
for(const NodeID node : osrm::irange(0u, last_node))
{
if (SPECIAL_NODEID == components_index[node])
{
recursion_stack.emplace(TarjanStackFrame(node, node));
}
while (!recursion_stack.empty())
{
TarjanStackFrame currentFrame = recursion_stack.top();
const NodeID v = currentFrame.v;
recursion_stack.pop();
const bool before_recursion = processing_node_before_recursion[v];
if (before_recursion && tarjan_node_list[v].index != UINT_MAX)
{
continue;
}
if (before_recursion)
{
// Mark frame to handle tail of recursion
recursion_stack.emplace(currentFrame);
processing_node_before_recursion[v] = false;
// Mark essential information for SCC
tarjan_node_list[v].index = index;
tarjan_node_list[v].low_link = index;
tarjan_stack.push(v);
tarjan_node_list[v].on_stack = true;
++index;
// Traverse outgoing edges
for (const auto current_edge : m_node_based_graph->GetAdjacentEdgeRange(v))
{
const TarjanDynamicGraph::NodeIterator vprime =
m_node_based_graph->GetTarget(current_edge);
if (SPECIAL_NODEID == tarjan_node_list[vprime].index)
{
recursion_stack.emplace(TarjanStackFrame(vprime, v));
}
else
{
if (tarjan_node_list[vprime].on_stack &&
tarjan_node_list[vprime].index < tarjan_node_list[v].low_link)
{
tarjan_node_list[v].low_link = tarjan_node_list[vprime].index;
}
}
}
}
else
{
processing_node_before_recursion[v] = true;
tarjan_node_list[currentFrame.parent].low_link =
std::min(tarjan_node_list[currentFrame.parent].low_link,
tarjan_node_list[v].low_link);
// 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].low_link == tarjan_node_list[v].index)
{
NodeID vprime;
do
{
vprime = tarjan_stack.top();
tarjan_stack.pop();
tarjan_node_list[vprime].on_stack = false;
components_index[vprime] = component_index;
++size_of_current_component;
} while (v != vprime);
component_size_vector.emplace_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;
}
}
}
}
TIMER_STOP(SCC_RUN);
SimpleLogger().Write() << "SCC run took: " << TIMER_MSEC(SCC_RUN)/1000. << "s";
SimpleLogger().Write() << "identified: " << component_size_vector.size()
<< " many components, marking small components";
TIMER_START(SCC_OUTPUT);
const unsigned size_one_counter = std::count_if(component_size_vector.begin(),
component_size_vector.end(),
[](unsigned value)
{
return 1 == value;
});
SimpleLogger().Write() << "identified " << size_one_counter << " SCCs of size 1";
uint64_t total_network_distance = 0;
p.reinit(m_node_based_graph->GetNumberOfNodes());
// const NodeID last_u_node = m_node_based_graph->GetNumberOfNodes();
for (const NodeID source : osrm::irange(0u, last_node))
{
p.printIncrement();
for (const auto current_edge : m_node_based_graph->GetAdjacentEdgeRange(source))
{
const TarjanDynamicGraph::NodeIterator target =
m_node_based_graph->GetTarget(current_edge);
if (source < target ||
m_node_based_graph->EndEdges(target) ==
m_node_based_graph->FindEdge(target, source))
{
total_network_distance +=
100 * FixedPointCoordinate::ApproximateEuclideanDistance(
m_coordinate_list[source].lat,
m_coordinate_list[source].lon,
m_coordinate_list[target].lat,
m_coordinate_list[target].lon);
BOOST_ASSERT(current_edge != SPECIAL_EDGEID);
BOOST_ASSERT(source != SPECIAL_NODEID);
BOOST_ASSERT(target != SPECIAL_NODEID);
const unsigned size_of_containing_component =
std::min(component_size_vector[components_index[source]],
component_size_vector[components_index[target]]);
// 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[source].lon / COORDINATE_PRECISION,
m_coordinate_list[source].lat / COORDINATE_PRECISION);
lineString.addPoint(m_coordinate_list[target].lon / COORDINATE_PRECISION,
m_coordinate_list[target].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);
component_size_vector.clear();
component_size_vector.shrink_to_fit();
BOOST_ASSERT_MSG(0 == component_size_vector.size() && 0 == component_size_vector.capacity(),
"component_size_vector not properly deallocated");
components_index.clear();
components_index.shrink_to_fit();
BOOST_ASSERT_MSG(0 == components_index.size() && 0 == components_index.capacity(),
"components_index not properly deallocated");
TIMER_STOP(SCC_OUTPUT);
SimpleLogger().Write() << "generating output took: " << TIMER_MSEC(SCC_OUTPUT)/1000. << "s";
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 = {u, v};
const auto restriction_iterator = m_restriction_map.find(restriction_source);
if (restriction_iterator != m_restriction_map.end())
{
const unsigned index = restriction_iterator->second;
for (const RestrictionSource &restriction_target : m_restriction_bucket_list.at(index))
{
if (restriction_target.second)
{
return restriction_target.first;
}
}
}
return SPECIAL_NODEID;
}
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 = {u, v};
const auto restriction_iterator = m_restriction_map.find(restriction_source);
if (restriction_iterator != m_restriction_map.end())
{
const unsigned index = restriction_iterator->second;
for (const RestrictionTarget &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_ */
+118
View File
@@ -0,0 +1,118 @@
#include "../DataStructures/OriginalEdgeData.h"
#include "../DataStructures/QueryNode.h"
#include "../DataStructures/SharedMemoryVectorWrapper.h"
#include "../DataStructures/StaticRTree.h"
#include "../Util/BoostFileSystemFix.h"
#include "../DataStructures/EdgeBasedNode.h"
#include <osrm/Coordinate.h>
#include <random>
// Choosen by a fair W20 dice roll (this value is completely arbitrary)
constexpr unsigned RANDOM_SEED = 13;
constexpr int32_t WORLD_MIN_LAT = -90*COORDINATE_PRECISION;
constexpr int32_t WORLD_MAX_LAT = 90*COORDINATE_PRECISION;
constexpr int32_t WORLD_MIN_LON = -180*COORDINATE_PRECISION;
constexpr int32_t WORLD_MAX_LON = 180*COORDINATE_PRECISION;
typedef EdgeBasedNode RTreeLeaf;
typedef std::shared_ptr<std::vector<FixedPointCoordinate>> FixedPointCoordinateListPtr;
typedef StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, false>::vector, false> BenchStaticRTree;
FixedPointCoordinateListPtr LoadCoordinates(const boost::filesystem::path& nodes_file)
{
boost::filesystem::ifstream nodes_input_stream(nodes_file, std::ios::binary);
NodeInfo current_node;
unsigned number_of_coordinates = 0;
nodes_input_stream.read((char *)&number_of_coordinates, sizeof(unsigned));
auto coords = std::make_shared<std::vector<FixedPointCoordinate>>(number_of_coordinates);
for (unsigned i = 0; i < number_of_coordinates; ++i)
{
nodes_input_stream.read((char *)&current_node, sizeof(NodeInfo));
coords->at(i) = FixedPointCoordinate(current_node.lat, current_node.lon);
BOOST_ASSERT((std::abs(coords->at(i).lat) >> 30) == 0);
BOOST_ASSERT((std::abs(coords->at(i).lon) >> 30) == 0);
}
nodes_input_stream.close();
return coords;
}
void Benchmark(BenchStaticRTree& rtree, unsigned num_queries)
{
std::mt19937 g(RANDOM_SEED);
std::uniform_int_distribution<> lat_udist(WORLD_MIN_LAT, WORLD_MAX_LAT);
std::uniform_int_distribution<> lon_udist(WORLD_MIN_LON, WORLD_MAX_LON);
std::vector<FixedPointCoordinate> queries;
for (unsigned i = 0; i < num_queries; i++)
{
queries.emplace_back(
FixedPointCoordinate(lat_udist(g), lon_udist(g))
);
}
const unsigned num_results = 5;
std::cout << "#### IncrementalFindPhantomNodeForCoordinate : " << num_results << " phantom nodes" << std::endl;
TIMER_START(query_phantom);
std::vector<PhantomNode> resulting_phantom_node_vector;
for (const auto& q : queries)
{
resulting_phantom_node_vector.clear();
rtree.IncrementalFindPhantomNodeForCoordinate(q, resulting_phantom_node_vector, 3, num_results);
resulting_phantom_node_vector.clear();
rtree.IncrementalFindPhantomNodeForCoordinate(q, resulting_phantom_node_vector, 17, num_results);
}
TIMER_STOP(query_phantom);
std::cout << "Took " << TIMER_MSEC(query_phantom) << " msec for " << num_queries << " queries." << std::endl;
std::cout << TIMER_MSEC(query_phantom)/((double) num_queries) << " msec/query." << std::endl;
std::cout << "#### LocateClosestEndPointForCoordinate" << std::endl;
TIMER_START(query_endpoint);
FixedPointCoordinate result;
for (const auto& q : queries)
{
rtree.LocateClosestEndPointForCoordinate(q, result, 3);
}
TIMER_STOP(query_endpoint);
std::cout << "Took " << TIMER_MSEC(query_endpoint) << " msec for " << num_queries << " queries." << std::endl;
std::cout << TIMER_MSEC(query_endpoint)/((double) num_queries) << " msec/query." << std::endl;
std::cout << "#### FindPhantomNodeForCoordinate" << std::endl;
TIMER_START(query_phantomnode);
for (const auto& q : queries)
{
PhantomNode phantom;
rtree.FindPhantomNodeForCoordinate(q, phantom, 3);
}
TIMER_STOP(query_phantomnode);
std::cout << "Took " << TIMER_MSEC(query_phantomnode) << " msec for " << num_queries << " queries." << std::endl;
std::cout << TIMER_MSEC(query_phantomnode)/((double) num_queries) << " msec/query." << std::endl;
}
int main(int argc, char** argv)
{
if (argc < 4)
{
std::cout << "./rtree-bench file.ramIndex file.fileIndx file.nodes" << std::endl;
return 1;
}
const char* ramPath = argv[1];
const char* filePath = argv[2];
const char* nodesPath = argv[3];
auto coords = LoadCoordinates(nodesPath);
BenchStaticRTree rtree(ramPath, filePath, coords);
Benchmark(rtree, 10000);
return 0;
}
+347
View File
@@ -0,0 +1,347 @@
cmake_minimum_required(VERSION 2.8)
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_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)
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)
set(bitness 32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(bitness 64)
message(STATUS "Building on a 64 bit system")
else()
message(WARNING "Building on a 32 bit system is unsupported")
endif()
if (WIN32 AND MSVC_VERSION LESS 1800)
message(FATAL_ERROR "Building with Microsoft compiler needs Visual Studio 2013 or later (Express version works too)")
endif()
OPTION(WITH_TOOLS "Build OSRM tools" OFF)
OPTION(BUILD_TOOLS "Build OSRM tools" OFF)
include_directories(${CMAKE_SOURCE_DIR}/Include/)
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/Util/FingerPrint.cpp FingerPrint.cpp.alwaysbuild
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FingerPrint-Config.cmake
DEPENDS
${CMAKE_SOURCE_DIR}/Util/FingerPrint.cpp.in
COMMENT "Configuring FingerPrint.cpp"
VERBATIM)
add_custom_target(FingerPrintConfigure DEPENDS ${CMAKE_SOURCE_DIR}/Util/FingerPrint.cpp)
add_custom_target(tests DEPENDS datastructure-tests)
add_custom_target(benchmarks DEPENDS rtree-bench)
set(BOOST_COMPONENTS date_time filesystem iostreams program_options regex system thread unit_test_framework)
configure_file(
${CMAKE_SOURCE_DIR}/Util/GitDescription.cpp.in
${CMAKE_SOURCE_DIR}/Util/GitDescription.cpp
)
file(GLOB ExtractorGlob Extractor/*.cpp)
file(GLOB ImporterGlob DataStructures/Import*.cpp)
add_library(IMPORT STATIC ${ImporterGlob})
set(ExtractorSources extractor.cpp ${ExtractorGlob})
add_executable(osrm-extract ${ExtractorSources})
file(GLOB PrepareGlob Contractor/*.cpp DataStructures/HilbertValue.cpp DataStructures/RestrictionMap.cpp)
set(PrepareSources prepare.cpp ${PrepareGlob})
add_executable(osrm-prepare ${PrepareSources})
file(GLOB ServerGlob Server/*.cpp)
file(GLOB DescriptorGlob Descriptors/*.cpp)
file(GLOB DatastructureGlob DataStructures/SearchEngineData.cpp DataStructures/RouteParameters.cpp)
file(GLOB CoordinateGlob DataStructures/Coordinate.cpp)
file(GLOB AlgorithmGlob Algorithms/*.cpp)
file(GLOB HttpGlob Server/Http/*.cpp)
file(GLOB LibOSRMGlob Library/*.cpp)
file(GLOB DataStructureTestsGlob UnitTests/DataStructures/*.cpp DataStructures/HilbertValue.cpp)
set(
OSRMSources
${LibOSRMGlob}
${DescriptorGlob}
${DatastructureGlob}
${CoordinateGlob}
${AlgorithmGlob}
${HttpGlob}
)
add_library(COORDLIB STATIC ${CoordinateGlob})
add_library(FINGERPRINT STATIC Util/FingerPrint.cpp)
add_library(OSRM ${OSRMSources} Util/GitDescription.cpp Util/FingerPrint.cpp)
add_library(GITDESCRIPTION STATIC Util/GitDescription.cpp)
add_dependencies(FINGERPRINT FingerPrintConfigure)
add_executable(osrm-routed routed.cpp ${ServerGlob})
add_executable(osrm-datastore datastore.cpp)
# Unit tests
add_executable(datastructure-tests EXCLUDE_FROM_ALL UnitTests/datastructure_tests.cpp ${DataStructureTestsGlob})
# Benchmarks
add_executable(rtree-bench EXCLUDE_FROM_ALL Benchmarks/StaticRTreeBench.cpp)
# Check the release mode
if(NOT CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_BUILD_TYPE Release)
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug)
message(STATUS "Configuring OSRM in debug mode")
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
message(STATUS "adding profiling flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -fno-inline")
set(CMAKE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -fno-inline")
endif()
endif()
if(CMAKE_BUILD_TYPE MATCHES Release)
message(STATUS "Configuring OSRM in release mode")
# Check if LTO is available
set(LTO_FLAGS "")
CHECK_CXX_COMPILER_FLAG("-flto" HAS_LTO_FLAG)
if (HAS_LTO_FLAG)
set(LTO_FLAGS "${LTO_FLAGS} -flto")
# 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")
message(STATUS "Using gcc specific binutils for LTO.")
set(CMAKE_AR "/usr/bin/gcc-ar")
set(CMAKE_RANLIB "/usr/bin/gcc-ranlib")
endif()
endif (HAS_LTO_FLAG)
endif()
if (NOT WIN32)
add_definitions(-DBOOST_TEST_DYN_LINK)
endif()
# Configuring compilers
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# using Clang
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wunreachable-code -pedantic -fPIC")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# using GCC
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -fPIC")
if (WIN32) # using mingw
add_definitions(-DM_PI=3.141592653589793238462643383) # define M_PI
add_definitions(-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_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-DNOMINMAX) # avoid min and max macros that can break compilation
add_definitions(-D_USE_MATH_DEFINES) # define M_PI
add_definitions(-D_WIN32_WINNT=0x0501)
endif()
# disable partitioning of LTO process when possible (fixes Debian issues)
set(LTO_PARTITION_FLAGS "")
CHECK_CXX_COMPILER_FLAG("-flto-partition=none" HAS_LTO_PARTITION_FLAG)
if (HAS_LTO_PARTITION_FLAG)
set(LTO_PARTITION_FLAGS "${LTO_PARTITION_FLAGS} -flto-partition=none")
endif (HAS_LTO_PARTITION_FLAG)
# Add Link-Time-Optimization flags, if supported (GCC >= 4.7) and enabled
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LTO_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LTO_FLAGS} ${LTO_PARTITION_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LTO_FLAGS} ${LTO_PARTITION_FLAGS}")
# Activate C++11
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
ADD_DEFINITIONS(-std=c++11)
endif()
# Configuring other platform dependencies
if(APPLE)
set(CMAKE_OSX_ARCHITECTURES "x86_64")
message(STATUS "Set Architecture to x64 on OS X")
exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
if(OSXLIBSTD)
message(STATUS "linking against ${OSXLIBSTD}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=${OSXLIBSTD}")
elseif(DARWIN_VERSION GREATER 12)
message(STATUS "linking against libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
endif()
if(UNIX AND NOT APPLE)
target_link_libraries(osrm-prepare rt)
target_link_libraries(osrm-datastore rt)
target_link_libraries(OSRM rt)
endif()
#Check Boost
set(BOOST_MIN_VERSION "1.49.0")
find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS ${BOOST_COMPONENTS} REQUIRED)
if(NOT Boost_FOUND)
message(FATAL_ERROR "Fatal error: Boost (version >= 1.49.0) required.\n")
endif()
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(OSRM ${Boost_LIBRARIES} COORDLIB)
target_link_libraries(osrm-extract ${Boost_LIBRARIES} FINGERPRINT GITDESCRIPTION COORDLIB IMPORT)
target_link_libraries(osrm-prepare ${Boost_LIBRARIES} FINGERPRINT GITDESCRIPTION COORDLIB IMPORT)
target_link_libraries(osrm-routed ${Boost_LIBRARIES} ${OPTIONAL_SOCKET_LIBS} OSRM FINGERPRINT GITDESCRIPTION)
target_link_libraries(osrm-datastore ${Boost_LIBRARIES} FINGERPRINT GITDESCRIPTION COORDLIB)
target_link_libraries(datastructure-tests ${Boost_LIBRARIES} COORDLIB)
target_link_libraries(rtree-bench ${Boost_LIBRARIES} COORDLIB)
find_package(Threads REQUIRED)
target_link_libraries(osrm-extract ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(osrm-datastore ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(osrm-prepare ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(OSRM ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(datastructure-tests ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(rtree-bench ${CMAKE_THREAD_LIBS_INIT})
find_package(TBB REQUIRED)
if(WIN32 AND CMAKE_BUILD_TYPE MATCHES Debug)
set(TBB_LIBRARIES ${TBB_DEBUG_LIBRARIES})
endif()
target_link_libraries(osrm-datastore ${TBB_LIBRARIES})
target_link_libraries(osrm-extract ${TBB_LIBRARIES})
target_link_libraries(osrm-prepare ${TBB_LIBRARIES})
target_link_libraries(osrm-routed ${TBB_LIBRARIES})
target_link_libraries(datastructure-tests ${TBB_LIBRARIES})
target_link_libraries(rtree-bench ${TBB_LIBRARIES})
include_directories(${TBB_INCLUDE_DIR})
find_package(Lua52)
if(NOT LUA52_FOUND)
find_package(Lua51 REQUIRED)
if(NOT APPLE)
find_package(LuaJIT 5.1)
endif()
else()
if(NOT APPLE)
find_package(LuaJIT 5.2)
endif()
endif()
find_package( Luabind REQUIRED )
include_directories(${LUABIND_INCLUDE_DIR})
target_link_libraries(osrm-extract ${LUABIND_LIBRARY})
target_link_libraries(osrm-prepare ${LUABIND_LIBRARY})
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})
find_package(LibXml2 REQUIRED)
include_directories(${LIBXML2_INCLUDE_DIR})
target_link_libraries(osrm-extract ${LIBXML2_LIBRARIES})
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( OSMPBF REQUIRED )
include_directories(${OSMPBF_INCLUDE_DIR})
target_link_libraries(osrm-extract ${OSMPBF_LIBRARY})
target_link_libraries(osrm-prepare ${OSMPBF_LIBRARY})
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIRS})
target_link_libraries(osrm-extract ${PROTOBUF_LIBRARY})
target_link_libraries(osrm-prepare ${PROTOBUF_LIBRARY})
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})
if(WITH_TOOLS OR BUILD_TOOLS)
message(STATUS "Activating OSRM internal tools")
find_package(GDAL)
if(GDAL_FOUND)
add_executable(osrm-components Tools/components.cpp)
target_link_libraries(osrm-components ${TBB_LIBRARIES} IMPORT)
include_directories(${GDAL_INCLUDE_DIR})
target_link_libraries(
osrm-components
${GDAL_LIBRARIES} ${Boost_LIBRARIES} FINGERPRINT GITDESCRIPTION COORDLIB)
install(TARGETS osrm-components DESTINATION bin)
else()
message(FATAL_ERROR "libgdal and/or development headers not found")
endif()
add_executable(osrm-cli Tools/simpleclient.cpp)
target_link_libraries(osrm-cli ${Boost_LIBRARIES} ${OPTIONAL_SOCKET_LIBS} OSRM FINGERPRINT GITDESCRIPTION)
target_link_libraries(osrm-cli ${TBB_LIBRARIES})
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()
add_executable(osrm-check-hsgr Tools/check-hsgr.cpp)
target_link_libraries(osrm-check-hsgr ${Boost_LIBRARIES} GITDESCRIPTION FINGERPRINT)
install(TARGETS osrm-cli DESTINATION bin)
install(TARGETS osrm-io-benchmark DESTINATION bin)
install(TARGETS osrm-unlock-all DESTINATION bin)
install(TARGETS osrm-check-hsgr DESTINATION bin)
endif()
file(GLOB InstallGlob Include/osrm/*.h Library/OSRM.h)
# 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-prepare 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)
install(FILES ${InstallGlob} DESTINATION include/osrm)
install(TARGETS osrm-extract DESTINATION bin)
install(TARGETS osrm-prepare DESTINATION bin)
install(TARGETS osrm-datastore DESTINATION bin)
install(TARGETS osrm-routed DESTINATION bin)
install(TARGETS OSRM DESTINATION lib)
list(GET Boost_LIBRARIES 1 BOOST_LIBRARY_FIRST)
get_filename_component(BOOST_LIBRARY_LISTING "${BOOST_LIBRARY_FIRST}" PATH)
set(BOOST_LIBRARY_LISTING "-L${BOOST_LIBRARY_LISTING}")
foreach (lib ${Boost_LIBRARIES})
get_filename_component(BOOST_LIBRARY_NAME "${lib}" NAME_WE)
string(REPLACE "lib" "" BOOST_LIBRARY_NAME ${BOOST_LIBRARY_NAME})
set(BOOST_LIBRARY_LISTING "${BOOST_LIBRARY_LISTING} -l${BOOST_LIBRARY_NAME}")
endforeach ()
configure_file(${CMAKE_SOURCE_DIR}/cmake/pkgconfig.in libosrm.pc @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION lib/pkgconfig)
if(BUILD_DEBIAN_PACKAGE)
include(CPackDebianConfig)
include(CPack)
endif()
+974
View File
@@ -0,0 +1,974 @@
/*
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
#define CONTRACTOR_H
#include "../DataStructures/BinaryHeap.h"
#include "../DataStructures/DeallocatingVector.h"
#include "../DataStructures/DynamicGraph.h"
#include "../DataStructures/Percent.h"
#include "../DataStructures/QueryEdge.h"
#include "../DataStructures/Range.h"
#include "../DataStructures/XORFastHash.h"
#include "../DataStructures/XORFastHashStorage.h"
#include "../Util/SimpleLogger.h"
#include "../Util/StringUtil.h"
#include "../Util/TimingUtil.h"
#include "../typedefs.h"
#include <boost/assert.hpp>
#include <stxxl/vector>
#include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h>
#include <tbb/parallel_sort.h>
#include <algorithm>
#include <limits>
#include <vector>
class Contractor
{
private:
struct ContractorEdgeData
{
ContractorEdgeData()
: distance(0), id(0), originalEdges(0), shortcut(0), forward(0), backward(0),
is_original_via_node_ID(false)
{
}
ContractorEdgeData(unsigned distance,
unsigned original_edges,
unsigned id,
bool shortcut,
bool forward,
bool backward)
: distance(distance), id(id),
originalEdges(std::min((unsigned)1 << 28, original_edges)), shortcut(shortcut),
forward(forward), backward(backward), is_original_via_node_ID(false)
{
}
unsigned distance;
unsigned id;
unsigned originalEdges : 28;
bool shortcut : 1;
bool forward : 1;
bool backward : 1;
bool is_original_via_node_ID : 1;
} data;
struct ContractorHeapData
{
short hop;
bool target;
ContractorHeapData() : hop(0), target(false) {}
ContractorHeapData(short h, bool t) : hop(h), target(t) {}
};
typedef DynamicGraph<ContractorEdgeData> ContractorGraph;
// typedef BinaryHeap< NodeID, NodeID, int, ContractorHeapData, ArrayStorage<NodeID, NodeID>
// > ContractorHeap;
typedef BinaryHeap<NodeID, NodeID, int, ContractorHeapData, XORFastHashStorage<NodeID, NodeID>>
ContractorHeap;
typedef ContractorGraph::InputEdge ContractorEdge;
struct ContractorThreadData
{
ContractorHeap heap;
std::vector<ContractorEdge> inserted_edges;
std::vector<NodeID> neighbours;
ContractorThreadData(NodeID nodes) : heap(nodes) {}
};
struct NodePriorityData
{
int depth;
NodePriorityData() : depth(0) {}
};
struct ContractionStats
{
int edges_deleted_count;
int edges_added_count;
int original_edges_deleted_count;
int original_edges_added_count;
ContractionStats()
: edges_deleted_count(0), edges_added_count(0), original_edges_deleted_count(0),
original_edges_added_count(0)
{
}
};
struct RemainingNodeData
{
RemainingNodeData() : id(0), is_independent(false) {}
NodeID id : 31;
bool is_independent : 1;
};
struct ThreadDataContainer
{
ThreadDataContainer(int number_of_nodes) : number_of_nodes(number_of_nodes) {}
inline ContractorThreadData* getThreadData()
{
bool exists = false;
auto& ref = data.local(exists);
if (!exists)
{
ref = std::make_shared<ContractorThreadData>(number_of_nodes);
}
return ref.get();
}
int number_of_nodes;
typedef tbb::enumerable_thread_specific<std::shared_ptr<ContractorThreadData>> EnumerableThreadData;
EnumerableThreadData data;
};
public:
template <class ContainerT> Contractor(int nodes, ContainerT &input_edge_list)
{
std::vector<ContractorEdge> edges;
edges.reserve(input_edge_list.size() * 2);
const auto dend = input_edge_list.dend();
for (auto diter = input_edge_list.dbegin(); diter != dend; ++diter)
{
BOOST_ASSERT_MSG(static_cast<unsigned int>(std::max(diter->weight, 1)) > 0, "edge distance < 1");
#ifndef NDEBUG
if (static_cast<unsigned int>(std::max(diter->weight, 1)) > 24 * 60 * 60 * 10)
{
SimpleLogger().Write(logWARNING) << "Edge weight large -> "
<< static_cast<unsigned int>(std::max(diter->weight, 1));
}
#endif
edges.emplace_back(diter->source, diter->target,
static_cast<unsigned int>(std::max(diter->weight, 1)),
1,
diter->edge_id,
false,
diter->forward ? true : false,
diter->backward ? true : false);
edges.emplace_back(diter->target, diter->source,
static_cast<unsigned int>(std::max(diter->weight, 1)),
1,
diter->edge_id,
false,
diter->backward ? true : false,
diter->forward ? true : false);
}
// clear input vector
input_edge_list.clear();
edges.shrink_to_fit();
tbb::parallel_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 forward_edge;
ContractorEdge reverse_edge;
forward_edge.source = reverse_edge.source = source;
forward_edge.target = reverse_edge.target = target;
forward_edge.data.forward = reverse_edge.data.backward = true;
forward_edge.data.backward = reverse_edge.data.forward = false;
forward_edge.data.shortcut = reverse_edge.data.shortcut = false;
forward_edge.data.id = reverse_edge.data.id = id;
forward_edge.data.originalEdges = reverse_edge.data.originalEdges = 1;
forward_edge.data.distance = reverse_edge.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)
{
forward_edge.data.distance =
std::min(edges[i].data.distance, forward_edge.data.distance);
}
if (edges[i].data.backward)
{
reverse_edge.data.distance =
std::min(edges[i].data.distance, reverse_edge.data.distance);
}
++i;
}
// merge edges (s,t) and (t,s) into bidirectional edge
if (forward_edge.data.distance == reverse_edge.data.distance)
{
if ((int)forward_edge.data.distance != std::numeric_limits<int>::max())
{
forward_edge.data.backward = true;
edges[edge++] = forward_edge;
}
}
else
{ // insert seperate edges
if (((int)forward_edge.data.distance) != std::numeric_limits<int>::max())
{
edges[edge++] = forward_edge;
}
if ((int)reverse_edge.data.distance != std::numeric_limits<int>::max())
{
edges[edge++] = reverse_edge;
}
}
}
std::cout << "merged " << edges.size() - edge << " edges out of " << edges.size()
<< std::endl;
edges.resize(edge);
contractor_graph = std::make_shared<ContractorGraph>(nodes, edges);
edges.clear();
edges.shrink_to_fit();
BOOST_ASSERT(0 == edges.capacity());
// unsigned maxdegree = 0;
// NodeID highestNode = 0;
//
// for(unsigned i = 0; i < contractor_graph->GetNumberOfNodes(); ++i) {
// unsigned degree = contractor_graph->EndEdges(i) -
// contractor_graph->BeginEdges(i);
// if(degree > maxdegree) {
// maxdegree = degree;
// highestNode = i;
// }
// }
//
// SimpleLogger().Write() << "edges at node with id " << highestNode << " has degree
// " << maxdegree;
// for(unsigned i = contractor_graph->BeginEdges(highestNode); i <
// contractor_graph->EndEdges(highestNode); ++i) {
// SimpleLogger().Write() << " ->(" << highestNode << "," <<
// contractor_graph->GetTarget(i)
// << "); via: " << contractor_graph->GetEdgeData(i).via;
// }
std::cout << "contractor finished initalization" << std::endl;
}
~Contractor() { }
void Run()
{
// for the preperation we can use a big grain size, which is much faster (probably cache)
constexpr size_t InitGrainSize = 100000;
constexpr size_t PQGrainSize = 100000;
// auto_partitioner will automatically increase the blocksize if we have
// a lot of data. It is *important* for the last loop iterations
// (which have a very small dataset) that it is devisible.
constexpr size_t IndependentGrainSize = 1;
constexpr size_t ContractGrainSize = 1;
constexpr size_t NeighboursGrainSize = 1;
constexpr size_t DeleteGrainSize = 1;
const NodeID number_of_nodes = contractor_graph->GetNumberOfNodes();
Percent p(number_of_nodes);
ThreadDataContainer thread_data_list(number_of_nodes);
NodeID number_of_contracted_nodes = 0;
std::vector<RemainingNodeData> remaining_nodes(number_of_nodes);
std::vector<float> node_priorities(number_of_nodes);
std::vector<NodePriorityData> node_data(number_of_nodes);
// initialize priorities in parallel
tbb::parallel_for(tbb::blocked_range<int>(0, number_of_nodes, InitGrainSize),
[&remaining_nodes](const tbb::blocked_range<int>& range)
{
for (int x = range.begin(); x != range.end(); ++x)
{
remaining_nodes[x].id = x;
}
}
);
std::cout << "initializing elimination PQ ..." << std::flush;
tbb::parallel_for(tbb::blocked_range<int>(0, number_of_nodes, PQGrainSize),
[this, &node_priorities, &node_data, &thread_data_list](const tbb::blocked_range<int>& range)
{
ContractorThreadData *data = thread_data_list.getThreadData();
for (int x = range.begin(); x != range.end(); ++x)
{
node_priorities[x] = this->EvaluateNodePriority(data, &node_data[x], x);
}
}
);
std::cout << "ok" << std::endl << "preprocessing " << number_of_nodes << " nodes ..."
<< std::flush;
bool flushed_contractor = false;
while (number_of_nodes > 2 && number_of_contracted_nodes < number_of_nodes)
{
if (!flushed_contractor && (number_of_contracted_nodes > (number_of_nodes * 0.65)))
{
DeallocatingVector<ContractorEdge> new_edge_set; // this one is not explicitely
// cleared since it goes out of
// scope anywa
std::cout << " [flush " << number_of_contracted_nodes << " nodes] " << std::flush;
// Delete old heap data to free memory that we need for the coming operations
thread_data_list.data.clear();
// Create new priority array
std::vector<float> new_node_priority(remaining_nodes.size());
// this map gives the old IDs from the new ones, necessary to get a consistent graph
// at the end of contraction
orig_node_id_to_new_id_map.resize(remaining_nodes.size());
// this map gives the new IDs from the old ones, necessary to remap targets from the
// remaining graph
std::vector<NodeID> new_node_id_from_orig_id_map(number_of_nodes, UINT_MAX);
// build forward and backward renumbering map and remap ids in remaining_nodes and
// Priorities.
for (const auto new_node_id : osrm::irange<std::size_t>(0, remaining_nodes.size()))
{
// create renumbering maps in both directions
orig_node_id_to_new_id_map[new_node_id] = remaining_nodes[new_node_id].id;
new_node_id_from_orig_id_map[remaining_nodes[new_node_id].id] = new_node_id;
new_node_priority[new_node_id] =
node_priorities[remaining_nodes[new_node_id].id];
remaining_nodes[new_node_id].id = new_node_id;
}
// walk over all nodes
for (const auto i : osrm::irange<std::size_t>(0, contractor_graph->GetNumberOfNodes()))
{
const NodeID source = i;
for (auto current_edge : contractor_graph->GetAdjacentEdgeRange(source))
{
ContractorGraph::EdgeData &data =
contractor_graph->GetEdgeData(current_edge);
const NodeID target = contractor_graph->GetTarget(current_edge);
if (SPECIAL_NODEID == new_node_id_from_orig_id_map[i])
{
external_edge_list.push_back({source, target, data});
}
else
{
// node is not yet contracted.
// add (renumbered) outgoing edges to new DynamicGraph.
ContractorEdge new_edge = {
new_node_id_from_orig_id_map[source],
new_node_id_from_orig_id_map[target],
data
};
new_edge.data.is_original_via_node_ID = true;
BOOST_ASSERT_MSG(UINT_MAX != new_node_id_from_orig_id_map[source],
"new source id not resolveable");
BOOST_ASSERT_MSG(UINT_MAX != new_node_id_from_orig_id_map[target],
"new target id not resolveable");
new_edge_set.push_back(new_edge);
}
}
}
// Delete map from old NodeIDs to new ones.
new_node_id_from_orig_id_map.clear();
new_node_id_from_orig_id_map.shrink_to_fit();
// Replace old priorities array by new one
node_priorities.swap(new_node_priority);
// Delete old node_priorities vector
new_node_priority.clear();
new_node_priority.shrink_to_fit();
// old Graph is removed
contractor_graph.reset();
// create new graph
std::sort(new_edge_set.begin(), new_edge_set.end());
contractor_graph =
std::make_shared<ContractorGraph>(remaining_nodes.size(), new_edge_set);
new_edge_set.clear();
flushed_contractor = true;
// INFO: MAKE SURE THIS IS THE LAST OPERATION OF THE FLUSH!
// reinitialize heaps and ThreadData objects with appropriate size
thread_data_list.number_of_nodes = contractor_graph->GetNumberOfNodes();
}
const int last = (int)remaining_nodes.size();
tbb::parallel_for(tbb::blocked_range<int>(0, last, IndependentGrainSize),
[this, &node_priorities, &remaining_nodes, &thread_data_list](const tbb::blocked_range<int>& range)
{
ContractorThreadData *data = thread_data_list.getThreadData();
// determine independent node set
for (int i = range.begin(); i != range.end(); ++i)
{
const NodeID node = remaining_nodes[i].id;
remaining_nodes[i].is_independent =
this->IsNodeIndependent(node_priorities, data, node);
}
}
);
const auto first = stable_partition(remaining_nodes.begin(),
remaining_nodes.end(),
[](RemainingNodeData node_data)
{ return !node_data.is_independent; });
const int first_independent_node = static_cast<int>(first - remaining_nodes.begin());
// contract independent nodes
tbb::parallel_for(tbb::blocked_range<int>(first_independent_node, last, ContractGrainSize),
[this, &remaining_nodes, &thread_data_list](const tbb::blocked_range<int>& range)
{
ContractorThreadData *data = thread_data_list.getThreadData();
for (int position = range.begin(); position != range.end(); ++position)
{
const NodeID x = remaining_nodes[position].id;
this->ContractNode<false>(data, x);
}
}
);
// make sure we really sort each block
tbb::parallel_for(thread_data_list.data.range(),
[&](const ThreadDataContainer::EnumerableThreadData::range_type& range)
{
for (auto& data : range)
std::sort(data->inserted_edges.begin(),
data->inserted_edges.end());
}
);
tbb::parallel_for(tbb::blocked_range<int>(first_independent_node, last, DeleteGrainSize),
[this, &remaining_nodes, &thread_data_list](const tbb::blocked_range<int>& range)
{
ContractorThreadData *data = thread_data_list.getThreadData();
for (int position = range.begin(); position != range.end(); ++position)
{
const NodeID x = remaining_nodes[position].id;
this->DeleteIncomingEdges(data, x);
}
}
);
// insert new edges
for (auto& data : thread_data_list.data)
{
for (const ContractorEdge &edge : data->inserted_edges)
{
const EdgeID current_edge_ID = contractor_graph->FindEdge(edge.source, edge.target);
if (current_edge_ID < contractor_graph->EndEdges(edge.source))
{
ContractorGraph::EdgeData &current_data =
contractor_graph->GetEdgeData(current_edge_ID);
if (current_data.shortcut && edge.data.forward == current_data.forward &&
edge.data.backward == current_data.backward &&
edge.data.distance < current_data.distance)
{
// found a duplicate edge with smaller weight, update it.
current_data = edge.data;
continue;
}
}
contractor_graph->InsertEdge(edge.source, edge.target, edge.data);
}
data->inserted_edges.clear();
}
tbb::parallel_for(tbb::blocked_range<int>(first_independent_node, last, NeighboursGrainSize),
[this, &remaining_nodes, &node_priorities, &node_data, &thread_data_list](const tbb::blocked_range<int>& range)
{
ContractorThreadData *data = thread_data_list.getThreadData();
for (int position = range.begin(); position != range.end(); ++position)
{
NodeID x = remaining_nodes[position].id;
this->UpdateNodeNeighbours(node_priorities, node_data, data, x);
}
}
);
// remove contracted nodes from the pool
number_of_contracted_nodes += last - first_independent_node;
remaining_nodes.resize(first_independent_node);
remaining_nodes.shrink_to_fit();
// unsigned maxdegree = 0;
// unsigned avgdegree = 0;
// unsigned mindegree = UINT_MAX;
// unsigned quaddegree = 0;
//
// for(unsigned i = 0; i < remaining_nodes.size(); ++i) {
// unsigned degree = contractor_graph->EndEdges(remaining_nodes[i].first)
// -
// contractor_graph->BeginEdges(remaining_nodes[i].first);
// if(degree > maxdegree)
// maxdegree = degree;
// if(degree < mindegree)
// mindegree = degree;
//
// avgdegree += degree;
// quaddegree += (degree*degree);
// }
//
// avgdegree /= std::max((unsigned)1,(unsigned)remaining_nodes.size() );
// quaddegree /= std::max((unsigned)1,(unsigned)remaining_nodes.size() );
//
// SimpleLogger().Write() << "rest: " << remaining_nodes.size() << ", max: "
// << maxdegree << ", min: " << mindegree << ", avg: " << avgdegree << ",
// quad: " << quaddegree;
p.printStatus(number_of_contracted_nodes);
}
thread_data_list.data.clear();
}
template <class Edge> inline void GetEdges(DeallocatingVector<Edge> &edges)
{
Percent p(contractor_graph->GetNumberOfNodes());
SimpleLogger().Write() << "Getting edges of minimized graph";
const NodeID number_of_nodes = contractor_graph->GetNumberOfNodes();
if (contractor_graph->GetNumberOfNodes())
{
Edge new_edge;
for (const auto node : osrm::irange(0u, number_of_nodes))
{
p.printStatus(node);
for (auto edge : contractor_graph->GetAdjacentEdgeRange(node))
{
const NodeID target = contractor_graph->GetTarget(edge);
const ContractorGraph::EdgeData &data = contractor_graph->GetEdgeData(edge);
if (!orig_node_id_to_new_id_map.empty())
{
new_edge.source = orig_node_id_to_new_id_map[node];
new_edge.target = orig_node_id_to_new_id_map[target];
}
else
{
new_edge.source = node;
new_edge.target = target;
}
BOOST_ASSERT_MSG(UINT_MAX != new_edge.source, "Source id invalid");
BOOST_ASSERT_MSG(UINT_MAX != new_edge.target, "Target id invalid");
new_edge.data.distance = data.distance;
new_edge.data.shortcut = data.shortcut;
if (!data.is_original_via_node_ID && !orig_node_id_to_new_id_map.empty())
{
new_edge.data.id = orig_node_id_to_new_id_map[data.id];
}
else
{
new_edge.data.id = data.id;
}
BOOST_ASSERT_MSG(new_edge.data.id != INT_MAX, // 2^31
"edge id invalid");
new_edge.data.forward = data.forward;
new_edge.data.backward = data.backward;
edges.push_back(new_edge);
}
}
}
contractor_graph.reset();
orig_node_id_to_new_id_map.clear();
orig_node_id_to_new_id_map.shrink_to_fit();
BOOST_ASSERT(0 == orig_node_id_to_new_id_map.capacity());
edges.append(external_edge_list.begin(), external_edge_list.end());
external_edge_list.clear();
}
private:
inline void Dijkstra(const int max_distance,
const unsigned number_of_targets,
const int maxNodes,
ContractorThreadData *const data,
const NodeID middleNode)
{
ContractorHeap &heap = data->heap;
int nodes = 0;
unsigned number_of_targets_found = 0;
while (!heap.Empty())
{
const NodeID node = heap.DeleteMin();
const int distance = heap.GetKey(node);
const short current_hop = heap.GetData(node).hop + 1;
if (++nodes > maxNodes)
{
return;
}
if (distance > max_distance)
{
return;
}
// Destination settled?
if (heap.GetData(node).target)
{
++number_of_targets_found;
if (number_of_targets_found >= number_of_targets)
{
return;
}
}
// iterate over all edges of node
for (auto edge : contractor_graph->GetAdjacentEdgeRange(node))
{
const ContractorEdgeData &data = contractor_graph->GetEdgeData(edge);
if (!data.forward)
{
continue;
}
const NodeID to = contractor_graph->GetTarget(edge);
if (middleNode == to)
{
continue;
}
const int to_distance = distance + data.distance;
// New Node discovered -> Add to Heap + Node Info Storage
if (!heap.WasInserted(to))
{
heap.Insert(to, to_distance, ContractorHeapData(current_hop, false));
}
// Found a shorter Path -> Update distance
else if (to_distance < heap.GetKey(to))
{
heap.DecreaseKey(to, to_distance);
heap.GetData(to).hop = current_hop;
}
}
}
}
inline float EvaluateNodePriority(ContractorThreadData *const data,
NodePriorityData *const node_data,
const NodeID node)
{
ContractionStats stats;
// perform simulated contraction
ContractNode<true>(data, node, &stats);
// Result will contain the priority
float result;
if (0 == (stats.edges_deleted_count * stats.original_edges_deleted_count))
{
result = 1.f * node_data->depth;
}
else
{
result = 2.f * (((float)stats.edges_added_count) / stats.edges_deleted_count) +
4.f * (((float)stats.original_edges_added_count) /
stats.original_edges_deleted_count) +
1.f * node_data->depth;
}
BOOST_ASSERT(result >= 0);
return result;
}
template <bool RUNSIMULATION>
inline bool
ContractNode(ContractorThreadData *data, const NodeID node, ContractionStats *stats = nullptr)
{
ContractorHeap &heap = data->heap;
int inserted_edges_size = data->inserted_edges.size();
std::vector<ContractorEdge> &inserted_edges = data->inserted_edges;
for (auto in_edge : contractor_graph->GetAdjacentEdgeRange(node))
{
const ContractorEdgeData &in_data = contractor_graph->GetEdgeData(in_edge);
const NodeID source = contractor_graph->GetTarget(in_edge);
if (RUNSIMULATION)
{
BOOST_ASSERT(stats != nullptr);
++stats->edges_deleted_count;
stats->original_edges_deleted_count += in_data.originalEdges;
}
if (!in_data.backward)
{
continue;
}
heap.Clear();
heap.Insert(source, 0, ContractorHeapData());
int max_distance = 0;
unsigned number_of_targets = 0;
for (auto out_edge : contractor_graph->GetAdjacentEdgeRange(node))
{
const ContractorEdgeData &out_data = contractor_graph->GetEdgeData(out_edge);
if (!out_data.forward)
{
continue;
}
const NodeID target = contractor_graph->GetTarget(out_edge);
const int path_distance = in_data.distance + out_data.distance;
max_distance = std::max(max_distance, path_distance);
if (!heap.WasInserted(target))
{
heap.Insert(target, INT_MAX, ContractorHeapData(0, true));
++number_of_targets;
}
}
if (RUNSIMULATION)
{
Dijkstra(max_distance, number_of_targets, 1000, data, node);
}
else
{
Dijkstra(max_distance, number_of_targets, 2000, data, node);
}
for (auto out_edge : contractor_graph->GetAdjacentEdgeRange(node))
{
const ContractorEdgeData &out_data = contractor_graph->GetEdgeData(out_edge);
if (!out_data.forward)
{
continue;
}
const NodeID target = contractor_graph->GetTarget(out_edge);
const int path_distance = in_data.distance + out_data.distance;
const int distance = heap.GetKey(target);
if (path_distance < distance)
{
if (RUNSIMULATION)
{
BOOST_ASSERT(stats != nullptr);
stats->edges_added_count += 2;
stats->original_edges_added_count +=
2 * (out_data.originalEdges + in_data.originalEdges);
}
else
{
inserted_edges.emplace_back(source, target, path_distance,
out_data.originalEdges + in_data.originalEdges,
node,
true,
true,
false);
inserted_edges.emplace_back(target, source, path_distance,
out_data.originalEdges + in_data.originalEdges,
node,
true,
false,
true);
}
}
}
}
if (!RUNSIMULATION)
{
int iend = inserted_edges.size();
for (int i = inserted_edges_size; i < iend; ++i)
{
bool found = false;
for (int other = i + 1; other < iend; ++other)
{
if (inserted_edges[other].source != inserted_edges[i].source)
{
continue;
}
if (inserted_edges[other].target != inserted_edges[i].target)
{
continue;
}
if (inserted_edges[other].data.distance != inserted_edges[i].data.distance)
{
continue;
}
if (inserted_edges[other].data.shortcut != inserted_edges[i].data.shortcut)
{
continue;
}
inserted_edges[other].data.forward |= inserted_edges[i].data.forward;
inserted_edges[other].data.backward |= inserted_edges[i].data.backward;
found = true;
break;
}
if (!found)
{
inserted_edges[inserted_edges_size++] = inserted_edges[i];
}
}
inserted_edges.resize(inserted_edges_size);
}
return true;
}
inline void DeleteIncomingEdges(ContractorThreadData *data, const NodeID node)
{
std::vector<NodeID> &neighbours = data->neighbours;
neighbours.clear();
// find all neighbours
for (auto e : contractor_graph->GetAdjacentEdgeRange(node))
{
const NodeID u = contractor_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 (const auto i : osrm::irange<std::size_t>(0, neighbours.size()))
{
contractor_graph->DeleteEdgesTo(neighbours[i], node);
}
}
inline bool UpdateNodeNeighbours(std::vector<float> &priorities,
std::vector<NodePriorityData> &node_data,
ContractorThreadData *const data,
const NodeID node)
{
std::vector<NodeID> &neighbours = data->neighbours;
neighbours.clear();
// find all neighbours
for (auto e : contractor_graph->GetAdjacentEdgeRange(node))
{
const NodeID u = contractor_graph->GetTarget(e);
if (u == node)
{
continue;
}
neighbours.push_back(u);
node_data[u].depth = (std::max)(node_data[node].depth + 1, node_data[u].depth);
}
// eliminate duplicate entries ( forward + backward edges )
std::sort(neighbours.begin(), neighbours.end());
neighbours.resize(std::unique(neighbours.begin(), neighbours.end()) - neighbours.begin());
// re-evaluate priorities of neighboring nodes
for (const NodeID u : neighbours)
{
priorities[u] = EvaluateNodePriority(data, &(node_data)[u], u);
}
return true;
}
inline bool IsNodeIndependent(
const std::vector<float> &priorities,
ContractorThreadData *const data,
NodeID node) const
{
const float priority = priorities[node];
std::vector<NodeID> &neighbours = data->neighbours;
neighbours.clear();
for (auto e : contractor_graph->GetAdjacentEdgeRange(node))
{
const NodeID target = contractor_graph->GetTarget(e);
if (node == target)
{
continue;
}
const float target_priority = priorities[target];
BOOST_ASSERT(target_priority >= 0);
// found a neighbour with lower priority?
if (priority > target_priority)
{
return false;
}
// tie breaking
if (std::abs(priority - target_priority) < std::numeric_limits<float>::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
for (const NodeID u : neighbours)
{
for (auto e : contractor_graph->GetAdjacentEdgeRange(u))
{
const NodeID target = contractor_graph->GetTarget(e);
if (node == target)
{
continue;
}
const float target_priority = priorities[target];
BOOST_ASSERT(target_priority >= 0);
// found a neighbour with lower priority?
if (priority > target_priority)
{
return false;
}
// tie breaking
if (std::abs(priority - target_priority) < std::numeric_limits<float>::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
{
const unsigned short hasha = fast_hash(a);
const unsigned short hashb = fast_hash(b);
// The compiler optimizes that to conditional register flags but without branching
// statements!
if (hasha != hashb)
{
return hasha < hashb;
}
return a < b;
}
std::shared_ptr<ContractorGraph> contractor_graph;
std::vector<ContractorGraph::InputEdge> contracted_edge_list;
stxxl::vector<QueryEdge> external_edge_list;
std::vector<NodeID> orig_node_id_to_new_id_map;
XORFastHash fast_hash;
};
#endif // CONTRACTOR_H
+774
View File
@@ -0,0 +1,774 @@
/*
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"
#include "../Algorithms/BFSComponentExplorer.h"
#include "../DataStructures/Percent.h"
#include "../DataStructures/Range.h"
#include "../Util/ComputeAngle.h"
#include "../Util/LuaUtil.h"
#include "../Util/SimpleLogger.h"
#include "../Util/TimingUtil.h"
#include <boost/assert.hpp>
#include <fstream>
#include <limits>
EdgeBasedGraphFactory::EdgeBasedGraphFactory(
const std::shared_ptr<NodeBasedDynamicGraph> &node_based_graph,
std::unique_ptr<RestrictionMap> restriction_map,
std::vector<NodeID> &barrier_node_list,
std::vector<NodeID> &traffic_light_node_list,
std::vector<NodeInfo> &m_node_info_list,
SpeedProfileProperties &speed_profile)
: speed_profile(speed_profile),
m_number_of_edge_based_nodes(std::numeric_limits<unsigned>::max()),
m_node_info_list(m_node_info_list), m_node_based_graph(node_based_graph),
m_restriction_map(std::move(restriction_map)), max_id(0)
{
// insert into unordered sets for fast lookup
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());
}
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
for (const EdgeBasedNode &node : m_edge_based_node_list)
{
BOOST_ASSERT(m_node_info_list.at(node.u).lat != INT_MAX);
BOOST_ASSERT(m_node_info_list.at(node.u).lon != INT_MAX);
BOOST_ASSERT(m_node_info_list.at(node.v).lon != INT_MAX);
BOOST_ASSERT(m_node_info_list.at(node.v).lat != INT_MAX);
}
#endif
nodes.swap(m_edge_based_node_list);
}
void
EdgeBasedGraphFactory::InsertEdgeBasedNode(const NodeID node_u, const NodeID node_v, const bool belongs_to_tiny_cc)
{
// merge edges together into one EdgeBasedNode
BOOST_ASSERT(node_u != SPECIAL_NODEID);
BOOST_ASSERT(node_v != SPECIAL_NODEID);
// find forward edge id and
const EdgeID e1 = m_node_based_graph->FindEdge(node_u, node_v);
BOOST_ASSERT(e1 != SPECIAL_EDGEID);
const EdgeData &forward_data = m_node_based_graph->GetEdgeData(e1);
// find reverse edge id and
const EdgeID e2 = m_node_based_graph->FindEdge(node_v, node_u);
#ifndef NDEBUG
if (e2 == m_node_based_graph->EndEdges(node_v))
{
SimpleLogger().Write(logWARNING) << "Did not find edge (" << node_v << "," << node_u << ")";
}
#endif
BOOST_ASSERT(e2 != SPECIAL_EDGEID);
BOOST_ASSERT(e2 < m_node_based_graph->EndEdges(node_v));
const EdgeData &reverse_data = m_node_based_graph->GetEdgeData(e2);
if (forward_data.edgeBasedNodeID == SPECIAL_NODEID &&
reverse_data.edgeBasedNodeID == SPECIAL_NODEID)
{
return;
}
BOOST_ASSERT(m_geometry_compressor.HasEntryForID(e1) ==
m_geometry_compressor.HasEntryForID(e2));
if (m_geometry_compressor.HasEntryForID(e1))
{
BOOST_ASSERT(m_geometry_compressor.HasEntryForID(e2));
// reconstruct geometry and put in each individual edge with its offset
const std::vector<GeometryCompressor::CompressedNode> &forward_geometry =
m_geometry_compressor.GetBucketReference(e1);
const std::vector<GeometryCompressor::CompressedNode> &reverse_geometry =
m_geometry_compressor.GetBucketReference(e2);
BOOST_ASSERT(forward_geometry.size() == reverse_geometry.size());
BOOST_ASSERT(0 != forward_geometry.size());
const unsigned geometry_size = forward_geometry.size();
BOOST_ASSERT(geometry_size > 1);
// reconstruct bidirectional edge with individual weights and put each into the NN index
std::vector<int> forward_dist_prefix_sum(forward_geometry.size(), 0);
std::vector<int> reverse_dist_prefix_sum(reverse_geometry.size(), 0);
// quick'n'dirty prefix sum as std::partial_sum needs addtional casts
// TODO: move to lambda function with C++11
int temp_sum = 0;
for (const auto i : osrm::irange(0u, geometry_size))
{
forward_dist_prefix_sum[i] = temp_sum;
temp_sum += forward_geometry[i].second;
BOOST_ASSERT(forward_data.distance >= temp_sum);
}
temp_sum = 0;
for (const auto i : osrm::irange(0u, geometry_size))
{
temp_sum += reverse_geometry[reverse_geometry.size() - 1 - i].second;
reverse_dist_prefix_sum[i] = reverse_data.distance - temp_sum;
// BOOST_ASSERT(reverse_data.distance >= temp_sum);
}
NodeID current_edge_source_coordinate_id = node_u;
if (SPECIAL_NODEID != forward_data.edgeBasedNodeID)
{
max_id = std::max(forward_data.edgeBasedNodeID, max_id);
}
if (SPECIAL_NODEID != reverse_data.edgeBasedNodeID)
{
max_id = std::max(reverse_data.edgeBasedNodeID, max_id);
}
// traverse arrays from start and end respectively
for (const auto i : osrm::irange(0u, geometry_size))
{
BOOST_ASSERT(current_edge_source_coordinate_id ==
reverse_geometry[geometry_size - 1 - i].first);
const NodeID current_edge_target_coordinate_id = forward_geometry[i].first;
BOOST_ASSERT(current_edge_target_coordinate_id != current_edge_source_coordinate_id);
// build edges
m_edge_based_node_list.emplace_back(forward_data.edgeBasedNodeID,
reverse_data.edgeBasedNodeID,
current_edge_source_coordinate_id,
current_edge_target_coordinate_id,
forward_data.nameID,
forward_geometry[i].second,
reverse_geometry[i].second,
forward_dist_prefix_sum[i],
reverse_dist_prefix_sum[i],
m_geometry_compressor.GetPositionForID(e1),
i,
belongs_to_tiny_cc);
current_edge_source_coordinate_id = current_edge_target_coordinate_id;
BOOST_ASSERT(m_edge_based_node_list.back().IsCompressed());
BOOST_ASSERT(node_u != m_edge_based_node_list.back().u ||
node_v != m_edge_based_node_list.back().v);
BOOST_ASSERT(node_u != m_edge_based_node_list.back().v ||
node_v != m_edge_based_node_list.back().u);
}
BOOST_ASSERT(current_edge_source_coordinate_id == node_v);
BOOST_ASSERT(m_edge_based_node_list.back().IsCompressed());
}
else
{
BOOST_ASSERT(!m_geometry_compressor.HasEntryForID(e2));
if (forward_data.edgeBasedNodeID != SPECIAL_NODEID)
{
BOOST_ASSERT(forward_data.forward);
}
if (reverse_data.edgeBasedNodeID != SPECIAL_NODEID)
{
BOOST_ASSERT(reverse_data.forward);
}
if (forward_data.edgeBasedNodeID == SPECIAL_NODEID)
{
BOOST_ASSERT(!forward_data.forward);
}
if (reverse_data.edgeBasedNodeID == SPECIAL_NODEID)
{
BOOST_ASSERT(!reverse_data.forward);
}
BOOST_ASSERT(forward_data.edgeBasedNodeID != SPECIAL_NODEID ||
reverse_data.edgeBasedNodeID != SPECIAL_NODEID);
m_edge_based_node_list.emplace_back(forward_data.edgeBasedNodeID,
reverse_data.edgeBasedNodeID,
node_u,
node_v,
forward_data.nameID,
forward_data.distance,
reverse_data.distance,
0,
0,
SPECIAL_EDGEID,
0,
belongs_to_tiny_cc);
BOOST_ASSERT(!m_edge_based_node_list.back().IsCompressed());
}
}
void EdgeBasedGraphFactory::FlushVectorToStream(
std::ofstream &edge_data_file, std::vector<OriginalEdgeData> &original_edge_data_vector) const
{
if (original_edge_data_vector.empty()) {
return;
}
edge_data_file.write((char *)&(original_edge_data_vector[0]),
original_edge_data_vector.size() * sizeof(OriginalEdgeData));
original_edge_data_vector.clear();
}
void EdgeBasedGraphFactory::Run(const std::string &original_edge_data_filename,
const std::string &geometry_filename,
lua_State *lua_state)
{
TIMER_START(geometry);
CompressGeometry();
TIMER_STOP(geometry);
TIMER_START(renumber);
RenumberEdges();
TIMER_STOP(renumber);
TIMER_START(generate_nodes);
GenerateEdgeExpandedNodes();
TIMER_STOP(generate_nodes);
TIMER_START(generate_edges);
GenerateEdgeExpandedEdges(original_edge_data_filename, lua_state);
TIMER_STOP(generate_edges);
m_geometry_compressor.SerializeInternalVector(geometry_filename);
SimpleLogger().Write() << "Timing statistics for edge-expanded graph:";
SimpleLogger().Write() << "Geometry compression: " << TIMER_SEC(geometry) << "s";
SimpleLogger().Write() << "Renumbering edges: " << TIMER_SEC(renumber) << "s";
SimpleLogger().Write() << "Generating nodes: " << TIMER_SEC(generate_nodes) << "s";
SimpleLogger().Write() << "Generating edges: " << TIMER_SEC(generate_edges) << "s";
}
void EdgeBasedGraphFactory::CompressGeometry()
{
SimpleLogger().Write() << "Removing graph geometry while preserving topology";
const unsigned original_number_of_nodes = m_node_based_graph->GetNumberOfNodes();
const unsigned original_number_of_edges = m_node_based_graph->GetNumberOfEdges();
Percent progress(original_number_of_nodes);
unsigned removed_node_count = 0;
for (const NodeID node_v : osrm::irange(0u, original_number_of_nodes))
{
progress.printStatus(node_v);
// only contract degree 2 vertices
if (2 != m_node_based_graph->GetOutDegree(node_v))
{
continue;
}
// don't contract barrier node
if (m_barrier_nodes.end() != m_barrier_nodes.find(node_v))
{
continue;
}
// check if v is a via node for a turn restriction, i.e. a 'directed' barrier node
if (m_restriction_map->IsViaNode(node_v))
{
continue;
}
const bool reverse_edge_order =
!(m_node_based_graph->GetEdgeData(m_node_based_graph->BeginEdges(node_v)).forward);
const EdgeID forward_e2 = m_node_based_graph->BeginEdges(node_v) + reverse_edge_order;
BOOST_ASSERT(SPECIAL_EDGEID != forward_e2);
const EdgeID reverse_e2 = m_node_based_graph->BeginEdges(node_v) + 1 - reverse_edge_order;
BOOST_ASSERT(SPECIAL_EDGEID != reverse_e2);
const EdgeData &fwd_edge_data2 = m_node_based_graph->GetEdgeData(forward_e2);
const EdgeData &rev_edge_data2 = m_node_based_graph->GetEdgeData(reverse_e2);
const NodeID node_w = m_node_based_graph->GetTarget(forward_e2);
BOOST_ASSERT(SPECIAL_NODEID != node_w);
BOOST_ASSERT(node_v != node_w);
const NodeID node_u = m_node_based_graph->GetTarget(reverse_e2);
BOOST_ASSERT(SPECIAL_NODEID != node_u);
BOOST_ASSERT(node_u != node_v);
const EdgeID forward_e1 = m_node_based_graph->FindEdge(node_u, node_v);
BOOST_ASSERT(m_node_based_graph->EndEdges(node_u) != forward_e1);
BOOST_ASSERT(SPECIAL_EDGEID != forward_e1);
BOOST_ASSERT(node_v == m_node_based_graph->GetTarget(forward_e1));
const EdgeID reverse_e1 = m_node_based_graph->FindEdge(node_w, node_v);
BOOST_ASSERT(SPECIAL_EDGEID != reverse_e1);
BOOST_ASSERT(node_v == m_node_based_graph->GetTarget(reverse_e1));
const EdgeData &fwd_edge_data1 = m_node_based_graph->GetEdgeData(forward_e1);
const EdgeData &rev_edge_data1 = m_node_based_graph->GetEdgeData(reverse_e1);
if ((m_node_based_graph->FindEdge(node_u, node_w) != m_node_based_graph->EndEdges(node_u)) ||
(m_node_based_graph->FindEdge(node_w, node_u) != m_node_based_graph->EndEdges(node_w)))
{
continue;
}
if ( // TODO: rename to IsCompatibleTo
fwd_edge_data1.IsEqualTo(fwd_edge_data2) &&
rev_edge_data1.IsEqualTo(rev_edge_data2))
{
// Get distances before graph is modified
const int forward_weight1 = m_node_based_graph->GetEdgeData(forward_e1).distance;
const int forward_weight2 = m_node_based_graph->GetEdgeData(forward_e2).distance;
BOOST_ASSERT(0 != forward_weight1);
BOOST_ASSERT(0 != forward_weight2);
const int reverse_weight1 = m_node_based_graph->GetEdgeData(reverse_e1).distance;
const int reverse_weight2 = m_node_based_graph->GetEdgeData(reverse_e2).distance;
BOOST_ASSERT(0 != reverse_weight1);
BOOST_ASSERT(0 != forward_weight2);
const bool add_traffic_signal_penalty =
(m_traffic_lights.find(node_v) != m_traffic_lights.end());
// add weight of e2's to e1
m_node_based_graph->GetEdgeData(forward_e1).distance += fwd_edge_data2.distance;
m_node_based_graph->GetEdgeData(reverse_e1).distance += rev_edge_data2.distance;
if (add_traffic_signal_penalty)
{
m_node_based_graph->GetEdgeData(forward_e1).distance +=
speed_profile.traffic_signal_penalty;
m_node_based_graph->GetEdgeData(reverse_e1).distance +=
speed_profile.traffic_signal_penalty;
}
// extend e1's to targets of e2's
m_node_based_graph->SetTarget(forward_e1, node_w);
m_node_based_graph->SetTarget(reverse_e1, node_u);
// remove e2's (if bidir, otherwise only one)
m_node_based_graph->DeleteEdge(node_v, forward_e2);
m_node_based_graph->DeleteEdge(node_v, reverse_e2);
// update any involved turn restrictions
m_restriction_map->FixupStartingTurnRestriction(node_u, node_v, node_w);
m_restriction_map->FixupArrivingTurnRestriction(node_u, node_v, node_w);
m_restriction_map->FixupStartingTurnRestriction(node_w, node_v, node_u);
m_restriction_map->FixupArrivingTurnRestriction(node_w, node_v, node_u);
// store compressed geometry in container
m_geometry_compressor.CompressEdge(
forward_e1,
forward_e2,
node_v,
node_w,
forward_weight1 +
(add_traffic_signal_penalty ? speed_profile.traffic_signal_penalty : 0),
forward_weight2);
m_geometry_compressor.CompressEdge(
reverse_e1,
reverse_e2,
node_v,
node_u,
reverse_weight1,
reverse_weight2 +
(add_traffic_signal_penalty ? speed_profile.traffic_signal_penalty : 0));
++removed_node_count;
BOOST_ASSERT(m_node_based_graph->GetEdgeData(forward_e1).nameID ==
m_node_based_graph->GetEdgeData(reverse_e1).nameID);
}
}
SimpleLogger().Write() << "removed " << removed_node_count << " nodes";
m_geometry_compressor.PrintStatistics();
unsigned new_node_count = 0;
unsigned new_edge_count = 0;
for(const auto i : osrm::irange(0u, m_node_based_graph->GetNumberOfNodes()))
{
if (m_node_based_graph->GetOutDegree(i) > 0)
{
++new_node_count;
new_edge_count += (m_node_based_graph->EndEdges(i) - m_node_based_graph->BeginEdges(i));
}
}
SimpleLogger().Write() << "new nodes: " << new_node_count << ", edges " << new_edge_count;
SimpleLogger().Write() << "Node compression ratio: " << new_node_count /
(double)original_number_of_nodes;
SimpleLogger().Write() << "Edge compression ratio: " << new_edge_count /
(double)original_number_of_edges;
}
/**
* Writes the id of the edge in the edge expanded graph (into the egde in the node based graph)
*/
void EdgeBasedGraphFactory::RenumberEdges()
{
// renumber edge based node IDs
unsigned numbered_edges_count = 0;
for (NodeID current_node = 0; current_node < m_node_based_graph->GetNumberOfNodes();
++current_node)
{
for (EdgeID current_edge : m_node_based_graph->GetAdjacentEdgeRange(current_node))
{
EdgeData &edge_data = m_node_based_graph->GetEdgeData(current_edge);
if (!edge_data.forward)
{
continue;
}
BOOST_ASSERT(numbered_edges_count < m_node_based_graph->GetNumberOfEdges());
edge_data.edgeBasedNodeID = numbered_edges_count;
++numbered_edges_count;
BOOST_ASSERT(SPECIAL_NODEID != edge_data.edgeBasedNodeID);
}
}
m_number_of_edge_based_nodes = numbered_edges_count;
}
/**
* Creates the nodes in the edge expanded graph from edges in the node-based graph.
*/
void EdgeBasedGraphFactory::GenerateEdgeExpandedNodes()
{
SimpleLogger().Write() << "Identifying components of the road network";
// Run a BFS on the undirected graph and identify small components
BFSComponentExplorer<NodeBasedDynamicGraph> component_explorer(
*m_node_based_graph, *m_restriction_map, m_barrier_nodes);
component_explorer.run();
SimpleLogger().Write() << "identified: " << component_explorer.GetNumberOfComponents()
<< " many components";
SimpleLogger().Write() << "generating edge-expanded nodes";
Percent progress(m_node_based_graph->GetNumberOfNodes());
// loop over all edges and generate new set of nodes
for (NodeID u = 0, end = m_node_based_graph->GetNumberOfNodes(); u < end; ++u)
{
BOOST_ASSERT(u != SPECIAL_NODEID);
BOOST_ASSERT(u < m_node_based_graph->GetNumberOfNodes());
progress.printStatus(u);
for (EdgeID e1 : m_node_based_graph->GetAdjacentEdgeRange(u))
{
const EdgeData &edge_data = m_node_based_graph->GetEdgeData(e1);
BOOST_ASSERT(e1 != SPECIAL_EDGEID);
const NodeID v = m_node_based_graph->GetTarget(e1);
BOOST_ASSERT(SPECIAL_NODEID != v);
// pick only every other edge
if (u > v)
{
continue;
}
BOOST_ASSERT(u < v);
BOOST_ASSERT(edge_data.type != SHRT_MAX);
// 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_explorer.GetComponentSize(u),
component_explorer.GetComponentSize(v));
const bool component_is_tiny = (size_of_component < 1000);
if (edge_data.edgeBasedNodeID == SPECIAL_NODEID)
{
InsertEdgeBasedNode(v, u, component_is_tiny);
}
else
{
InsertEdgeBasedNode(u, v, component_is_tiny);
}
}
}
SimpleLogger().Write() << "Generated " << m_edge_based_node_list.size()
<< " nodes in edge-expanded graph";
}
/**
* Actually it also generates OriginalEdgeData and serializes them...
*/
void
EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(const std::string &original_edge_data_filename,
lua_State *lua_state)
{
SimpleLogger().Write() << "generating edge-expanded edges";
unsigned node_based_edge_counter = 0;
unsigned original_edges_counter = 0;
std::ofstream edge_data_file(original_edge_data_filename.c_str(), std::ios::binary);
// writes a dummy value that is updated later
edge_data_file.write((char *)&original_edges_counter, sizeof(unsigned));
std::vector<OriginalEdgeData> original_edge_data_vector;
original_edge_data_vector.reserve(1024 * 1024);
// 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.
unsigned restricted_turns_counter = 0;
unsigned skipped_uturns_counter = 0;
unsigned skipped_barrier_turns_counter = 0;
unsigned compressed = 0;
Percent progress(m_node_based_graph->GetNumberOfNodes());
for (NodeID u = 0, end = m_node_based_graph->GetNumberOfNodes(); u < end; ++u)
{
progress.printStatus(u);
for (const EdgeID e1 : m_node_based_graph->GetAdjacentEdgeRange(u))
{
if (!m_node_based_graph->GetEdgeData(e1).forward)
{
continue;
}
++node_based_edge_counter;
const NodeID v = m_node_based_graph->GetTarget(e1);
const NodeID to_node_of_only_restriction =
m_restriction_map->CheckForEmanatingIsOnlyTurn(u, v);
const bool is_barrier_node = (m_barrier_nodes.find(v) != m_barrier_nodes.end());
for (EdgeID e2 : m_node_based_graph->GetAdjacentEdgeRange(v))
{
if (!m_node_based_graph->GetEdgeData(e2).forward)
{
continue;
}
const NodeID w = m_node_based_graph->GetTarget(e2);
if ((to_node_of_only_restriction != SPECIAL_NODEID) &&
(w != to_node_of_only_restriction))
{
// We are at an only_-restriction but not at the right turn.
++restricted_turns_counter;
continue;
}
if (is_barrier_node)
{
if (u != w)
{
++skipped_barrier_turns_counter;
continue;
}
}
else
{
if ((u == w) && (m_node_based_graph->GetOutDegree(v) > 1))
{
++skipped_uturns_counter;
continue;
}
}
// only add an edge if turn is not a U-turn except when it is
// at the end of a dead-end street
if (m_restriction_map->CheckIfTurnIsRestricted(u, v, w) &&
(to_node_of_only_restriction == SPECIAL_NODEID) &&
(w != to_node_of_only_restriction))
{
// We are at an only_-restriction but not at the right turn.
++restricted_turns_counter;
continue;
}
// 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);
BOOST_ASSERT(edge_data1.edgeBasedNodeID != edge_data2.edgeBasedNodeID);
BOOST_ASSERT(edge_data1.forward);
BOOST_ASSERT(edge_data2.forward);
// the following is the core of the loop.
unsigned distance = edge_data1.distance;
if (m_traffic_lights.find(v) != m_traffic_lights.end())
{
distance += speed_profile.traffic_signal_penalty;
}
const double angle = GetAngleBetweenThreeFixedPointCoordinates(
m_node_info_list[u], m_node_info_list[v], m_node_info_list[w]);
const int turn_penalty = GetTurnPenalty(angle, lua_state);
TurnInstruction turn_instruction = AnalyzeTurn(u, v, w, angle);
if (turn_instruction == TurnInstruction::UTurn)
{
distance += speed_profile.u_turn_penalty;
}
distance += turn_penalty;
const bool edge_is_compressed = m_geometry_compressor.HasEntryForID(e1);
if (edge_is_compressed)
{
++compressed;
}
original_edge_data_vector.emplace_back(
(edge_is_compressed ? m_geometry_compressor.GetPositionForID(e1) : v),
edge_data1.nameID,
turn_instruction,
edge_is_compressed);
++original_edges_counter;
if (original_edge_data_vector.size() > 1024 * 1024 * 10)
{
FlushVectorToStream(edge_data_file, original_edge_data_vector);
}
BOOST_ASSERT(SPECIAL_NODEID != edge_data1.edgeBasedNodeID);
BOOST_ASSERT(SPECIAL_NODEID != edge_data2.edgeBasedNodeID);
m_edge_based_edge_list.emplace_back(EdgeBasedEdge(edge_data1.edgeBasedNodeID,
edge_data2.edgeBasedNodeID,
m_edge_based_edge_list.size(),
distance,
true,
false));
}
}
}
FlushVectorToStream(edge_data_file, original_edge_data_vector);
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 " << restricted_turns_counter << " turns, "
"defined by "
<< m_restriction_map->size() << " restrictions";
SimpleLogger().Write() << " skips " << skipped_uturns_counter << " U turns";
SimpleLogger().Write() << " skips " << skipped_barrier_turns_counter << " turns over barriers";
}
int EdgeBasedGraphFactory::GetTurnPenalty(double angle, lua_State *lua_state) const
{
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 node_u,
const NodeID node_v,
const NodeID node_w,
const double angle)
const
{
if (node_u == node_w)
{
return TurnInstruction::UTurn;
}
const EdgeID edge1 = m_node_based_graph->FindEdge(node_u, node_v);
const EdgeID edge2 = m_node_based_graph->FindEdge(node_v, node_w);
const EdgeData &data1 = m_node_based_graph->GetEdgeData(edge1);
const EdgeData &data2 = m_node_based_graph->GetEdgeData(edge2);
if (!data1.contraFlow && data2.contraFlow)
{
return TurnInstruction::EnterAgainstAllowedDirection;
}
if (data1.contraFlow && !data2.contraFlow)
{
return TurnInstruction::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->GetDirectedOutDegree(node_v))
{
// No turn possible.
return TurnInstruction::NoTurn;
}
return TurnInstruction::StayOnRoundAbout;
}
// Does turn start or end on roundabout?
if (data1.roundabout || data2.roundabout)
{
// We are entering the roundabout
if ((!data1.roundabout) && data2.roundabout)
{
return TurnInstruction::EnterRoundAbout;
}
// We are leaving the roundabout
if (data1.roundabout && (!data2.roundabout))
{
return TurnInstruction::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 || m_node_based_graph->GetOutDegree(node_v) <= 2)
{
return TurnInstruction::NoTurn;
}
}
return TurnInstructionsClass::GetTurnDirectionOfInstruction(angle);
}
unsigned EdgeBasedGraphFactory::GetNumberOfEdgeBasedNodes() const
{
return m_number_of_edge_based_nodes;
}
+126
View File
@@ -0,0 +1,126 @@
/*
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/EdgeBasedNode.h"
#include "../DataStructures/OriginalEdgeData.h"
#include "../DataStructures/QueryNode.h"
#include "../DataStructures/TurnInstructions.h"
#include "../DataStructures/NodeBasedGraph.h"
#include "../DataStructures/RestrictionMap.h"
#include "GeometryCompressor.h"
#include <algorithm>
#include <iosfwd>
#include <memory>
#include <queue>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
struct lua_State;
class EdgeBasedGraphFactory
{
public:
EdgeBasedGraphFactory() = delete;
EdgeBasedGraphFactory(const EdgeBasedGraphFactory &) = delete;
struct SpeedProfileProperties;
explicit EdgeBasedGraphFactory(const std::shared_ptr<NodeBasedDynamicGraph> &node_based_graph,
std::unique_ptr<RestrictionMap> restricion_map,
std::vector<NodeID> &barrier_node_list,
std::vector<NodeID> &traffic_light_node_list,
std::vector<NodeInfo> &m_node_info_list,
SpeedProfileProperties &speed_profile);
void Run(const std::string &original_edge_data_filename,
const std::string &geometry_filename,
lua_State *lua_state);
void GetEdgeBasedEdges(DeallocatingVector<EdgeBasedEdge> &edges);
void GetEdgeBasedNodes(std::vector<EdgeBasedNode> &nodes);
TurnInstruction AnalyzeTurn(const NodeID u, const NodeID v, const NodeID w, const double angle) const;
int GetTurnPenalty(double angle, lua_State *lua_state) const;
unsigned GetNumberOfEdgeBasedNodes() const;
struct SpeedProfileProperties
{
SpeedProfileProperties()
: traffic_signal_penalty(0), u_turn_penalty(0), has_turn_penalty_function(false)
{
}
int traffic_signal_penalty;
int u_turn_penalty;
bool has_turn_penalty_function;
} speed_profile;
private:
typedef NodeBasedDynamicGraph::EdgeData EdgeData;
unsigned m_number_of_edge_based_nodes;
std::vector<NodeInfo> m_node_info_list;
std::vector<EdgeBasedNode> m_edge_based_node_list;
DeallocatingVector<EdgeBasedEdge> m_edge_based_edge_list;
std::shared_ptr<NodeBasedDynamicGraph> m_node_based_graph;
std::unordered_set<NodeID> m_barrier_nodes;
std::unordered_set<NodeID> m_traffic_lights;
std::unique_ptr<RestrictionMap> m_restriction_map;
GeometryCompressor m_geometry_compressor;
void CompressGeometry();
void RenumberEdges();
void GenerateEdgeExpandedNodes();
void GenerateEdgeExpandedEdges(const std::string &original_edge_data_filename,
lua_State *lua_state);
void InsertEdgeBasedNode(const NodeID u, const NodeID v, const bool belongsToTinyComponent);
void FlushVectorToStream(std::ofstream &edge_data_file,
std::vector<OriginalEdgeData> &original_edge_data_vector) const;
NodeID max_id;
};
#endif /* EDGEBASEDGRAPHFACTORY_H_ */
+227
View File
@@ -0,0 +1,227 @@
/*
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 "GeometryCompressor.h"
#include "../Util/SimpleLogger.h"
#include <boost/assert.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <limits>
#include <string>
int free_list_maximum = 0;
int UniqueNumber() { return ++free_list_maximum; }
GeometryCompressor::GeometryCompressor()
{
m_free_list.reserve(100);
IncreaseFreeList();
}
void GeometryCompressor::IncreaseFreeList()
{
m_compressed_geometries.resize(m_compressed_geometries.size() + 100);
for (unsigned i = 100; i > 0; --i)
{
m_free_list.emplace_back(free_list_maximum);
++free_list_maximum;
}
}
bool GeometryCompressor::HasEntryForID(const EdgeID edge_id) const
{
auto iter = m_edge_id_to_list_index_map.find(edge_id);
return iter != m_edge_id_to_list_index_map.end();
}
unsigned GeometryCompressor::GetPositionForID(const EdgeID edge_id) const
{
auto map_iterator = m_edge_id_to_list_index_map.find(edge_id);
BOOST_ASSERT(map_iterator != m_edge_id_to_list_index_map.end());
BOOST_ASSERT(map_iterator->second < m_compressed_geometries.size());
return map_iterator->second;
}
void GeometryCompressor::SerializeInternalVector(const std::string &path) const
{
boost::filesystem::fstream geometry_out_stream(path, std::ios::binary | std::ios::out);
const unsigned compressed_geometries = m_compressed_geometries.size() + 1;
BOOST_ASSERT(std::numeric_limits<unsigned>::max() != compressed_geometries);
geometry_out_stream.write((char *)&compressed_geometries, sizeof(unsigned));
// write indices array
unsigned prefix_sum_of_list_indices = 0;
for (const auto &elem : m_compressed_geometries)
{
geometry_out_stream.write((char *)&prefix_sum_of_list_indices, sizeof(unsigned));
const std::vector<CompressedNode> &current_vector = elem;
const unsigned unpacked_size = current_vector.size();
BOOST_ASSERT(std::numeric_limits<unsigned>::max() != unpacked_size);
prefix_sum_of_list_indices += unpacked_size;
}
// sentinel element
geometry_out_stream.write((char *)&prefix_sum_of_list_indices, sizeof(unsigned));
// number of geometry entries to follow, it is the (inclusive) prefix sum
geometry_out_stream.write((char *)&prefix_sum_of_list_indices, sizeof(unsigned));
unsigned control_sum = 0;
// write compressed geometries
for (auto &elem : m_compressed_geometries)
{
const std::vector<CompressedNode> &current_vector = elem;
const unsigned unpacked_size = current_vector.size();
control_sum += unpacked_size;
BOOST_ASSERT(std::numeric_limits<unsigned>::max() != unpacked_size);
for (const CompressedNode current_node : current_vector)
{
geometry_out_stream.write((char *)&(current_node.first), sizeof(NodeID));
}
}
BOOST_ASSERT(control_sum == prefix_sum_of_list_indices);
// all done, let's close the resource
geometry_out_stream.close();
}
void GeometryCompressor::CompressEdge(const EdgeID edge_id_1,
const EdgeID edge_id_2,
const NodeID via_node_id,
const NodeID target_node_id,
const EdgeWeight weight1,
const EdgeWeight weight2)
{
// remove super-trivial geometries
BOOST_ASSERT(SPECIAL_EDGEID != edge_id_1);
BOOST_ASSERT(SPECIAL_EDGEID != edge_id_2);
BOOST_ASSERT(SPECIAL_NODEID != via_node_id);
BOOST_ASSERT(SPECIAL_NODEID != target_node_id);
BOOST_ASSERT(INVALID_EDGE_WEIGHT != weight1);
BOOST_ASSERT(INVALID_EDGE_WEIGHT != weight2);
// append list of removed edge_id plus via node to surviving edge id:
// <surv_1, .. , surv_n, via_node_id, rem_1, .. rem_n
//
// General scheme:
// 1. append via node id to list of edge_id_1
// 2. find list for edge_id_2, if yes add all elements and delete it
// Add via node id. List is created if it does not exist
if (!HasEntryForID(edge_id_1))
{
// create a new entry in the map
if (0 == m_free_list.size())
{
// make sure there is a place to put the entries
IncreaseFreeList();
}
BOOST_ASSERT(!m_free_list.empty());
m_edge_id_to_list_index_map[edge_id_1] = m_free_list.back();
m_free_list.pop_back();
}
// find bucket index
const auto iter = m_edge_id_to_list_index_map.find(edge_id_1);
BOOST_ASSERT(iter != m_edge_id_to_list_index_map.end());
const unsigned edge_bucket_id1 = iter->second;
BOOST_ASSERT(edge_bucket_id1 == GetPositionForID(edge_id_1));
BOOST_ASSERT(edge_bucket_id1 < m_compressed_geometries.size());
std::vector<CompressedNode> &edge_bucket_list1 = m_compressed_geometries[edge_bucket_id1];
if (edge_bucket_list1.empty())
{
edge_bucket_list1.emplace_back(via_node_id, weight1);
}
BOOST_ASSERT(0 < edge_bucket_list1.size());
BOOST_ASSERT(!edge_bucket_list1.empty());
if (HasEntryForID(edge_id_2))
{
// second edge is not atomic anymore
const unsigned list_to_remove_index = GetPositionForID(edge_id_2);
BOOST_ASSERT(list_to_remove_index < m_compressed_geometries.size());
std::vector<CompressedNode> &edge_bucket_list2 =
m_compressed_geometries[list_to_remove_index];
// found an existing list, append it to the list of edge_id_1
edge_bucket_list1.insert(
edge_bucket_list1.end(), edge_bucket_list2.begin(), edge_bucket_list2.end());
// remove the list of edge_id_2
m_edge_id_to_list_index_map.erase(edge_id_2);
BOOST_ASSERT(m_edge_id_to_list_index_map.end() ==
m_edge_id_to_list_index_map.find(edge_id_2));
edge_bucket_list2.clear();
BOOST_ASSERT(0 == edge_bucket_list2.size());
m_free_list.emplace_back(list_to_remove_index);
BOOST_ASSERT(list_to_remove_index == m_free_list.back());
}
else
{
// we are certain that the second edge is atomic.
edge_bucket_list1.emplace_back(target_node_id, weight2);
}
}
void GeometryCompressor::PrintStatistics() const
{
const uint64_t compressed_edges = m_compressed_geometries.size();
BOOST_ASSERT(0 == compressed_edges % 2);
BOOST_ASSERT(m_compressed_geometries.size() + m_free_list.size() > 0);
uint64_t compressed_geometries = 0;
uint64_t longest_chain_length = 0;
for (const std::vector<CompressedNode> &current_vector : m_compressed_geometries)
{
compressed_geometries += current_vector.size();
longest_chain_length = std::max(longest_chain_length, (uint64_t)current_vector.size());
}
SimpleLogger().Write() << "Geometry successfully removed:"
"\n compressed edges: " << compressed_edges
<< "\n compressed geometries: " << compressed_geometries
<< "\n longest chain length: " << longest_chain_length
<< "\n cmpr ratio: "
<< ((float)compressed_edges /
std::max(compressed_geometries, (uint64_t)1))
<< "\n avg chain length: "
<< (float)compressed_geometries /
std::max((uint64_t)1, compressed_edges);
}
const std::vector<GeometryCompressor::CompressedNode> &
GeometryCompressor::GetBucketReference(const EdgeID edge_id) const
{
const unsigned index = m_edge_id_to_list_index_map.at(edge_id);
return m_compressed_geometries.at(index);
}
+65
View File
@@ -0,0 +1,65 @@
/*
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 "../typedefs.h"
#include <unordered_map>
#include <string>
#include <vector>
#ifndef GEOMETRY_COMPRESSOR_H
#define GEOMETRY_COMPRESSOR_H
class GeometryCompressor
{
public:
typedef std::pair<NodeID, EdgeWeight> CompressedNode;
GeometryCompressor();
void CompressEdge(const EdgeID surviving_edge_id,
const EdgeID removed_edge_id,
const NodeID via_node_id,
const NodeID target_node,
const EdgeWeight weight1,
const EdgeWeight weight2);
bool HasEntryForID(const EdgeID edge_id) const;
void PrintStatistics() const;
void SerializeInternalVector(const std::string &path) const;
unsigned GetPositionForID(const EdgeID edge_id) const;
const std::vector<GeometryCompressor::CompressedNode> &
GetBucketReference(const EdgeID edge_id) const;
private:
void IncreaseFreeList();
std::vector<std::vector<CompressedNode>> m_compressed_geometries;
std::vector<unsigned> m_free_list;
std::unordered_map<EdgeID, unsigned> m_edge_id_to_list_index_map;
};
#endif // GEOMETRY_COMPRESSOR_H
+563
View File
@@ -0,0 +1,563 @@
/*
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 "Prepare.h"
#include "Contractor.h"
#include "../Algorithms/IteratorBasedCRC32.h"
#include "../DataStructures/BinaryHeap.h"
#include "../DataStructures/DeallocatingVector.h"
#include "../DataStructures/Range.h"
#include "../DataStructures/StaticRTree.h"
#include "../DataStructures/RestrictionMap.h"
#include "../Util/GitDescription.h"
#include "../Util/LuaUtil.h"
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
#include "../Util/StringUtil.h"
#include "../Util/TimingUtil.h"
#include "../typedefs.h"
#include <boost/filesystem/fstream.hpp>
#include <boost/program_options.hpp>
#include <tbb/task_scheduler_init.h>
#include <tbb/parallel_sort.h>
#include <chrono>
#include <memory>
#include <string>
#include <thread>
#include <vector>
Prepare::Prepare() : requested_num_threads(1) {}
Prepare::~Prepare() {}
int Prepare::Process(int argc, char *argv[])
{
LogPolicy::GetInstance().Unmute();
TIMER_START(preparing);
TIMER_START(expansion);
if (!ParseArguments(argc, argv))
{
return 0;
}
if (!boost::filesystem::is_regular_file(input_path))
{
SimpleLogger().Write(logWARNING) << "Input file " << input_path.string() << " not found!";
return 1;
}
if (!boost::filesystem::is_regular_file(profile_path))
{
SimpleLogger().Write(logWARNING) << "Profile " << profile_path.string() << " not found!";
return 1;
}
if (1 > requested_num_threads)
{
SimpleLogger().Write(logWARNING) << "Number of threads must be 1 or larger";
return 1;
}
const unsigned recommended_num_threads = tbb::task_scheduler_init::default_num_threads();
SimpleLogger().Write() << "Input file: " << input_path.filename().string();
SimpleLogger().Write() << "Restrictions file: " << restrictions_path.filename().string();
SimpleLogger().Write() << "Profile: " << profile_path.filename().string();
SimpleLogger().Write() << "Threads: " << requested_num_threads;
if (recommended_num_threads != requested_num_threads)
{
SimpleLogger().Write(logWARNING) << "The recommended number of threads is "
<< recommended_num_threads
<< "! This setting may have performance side-effects.";
}
tbb::task_scheduler_init init(requested_num_threads);
LogPolicy::GetInstance().Unmute();
FingerPrint fingerprint_orig;
CheckRestrictionsFile(fingerprint_orig);
boost::filesystem::ifstream input_stream(input_path, std::ios::in | std::ios::binary);
node_filename = input_path.string() + ".nodes";
edge_out = input_path.string() + ".edges";
geometry_filename = input_path.string() + ".geometry";
graph_out = input_path.string() + ".hsgr";
rtree_nodes_path = input_path.string() + ".ramIndex";
rtree_leafs_path = input_path.string() + ".fileIndex";
/*** Setup Scripting Environment ***/
// Create a new lua state
lua_State *lua_state = luaL_newstate();
// Connect LuaBind to this lua state
luabind::open(lua_state);
EdgeBasedGraphFactory::SpeedProfileProperties speed_profile;
if (!SetupScriptingEnvironment(lua_state, speed_profile))
{
return 1;
}
#ifdef WIN32
#pragma message("Memory consumption on Windows can be higher due to different bit packing")
#else
static_assert(sizeof(ImportEdge) == 20,
"changing ImportEdge type has influence on memory consumption!");
#endif
NodeID number_of_node_based_nodes =
readBinaryOSRMGraphFromStream(input_stream,
edge_list,
barrier_node_list,
traffic_light_list,
&internal_to_external_node_map,
restriction_list);
input_stream.close();
if (edge_list.empty())
{
SimpleLogger().Write(logWARNING) << "The input data is empty, exiting.";
return 1;
}
SimpleLogger().Write() << restriction_list.size() << " restrictions, "
<< barrier_node_list.size() << " bollard nodes, "
<< traffic_light_list.size() << " traffic lights";
std::vector<EdgeBasedNode> node_based_edge_list;
unsigned number_of_edge_based_nodes = 0;
DeallocatingVector<EdgeBasedEdge> edge_based_edge_list;
// init node_based_edge_list, edge_based_edge_list by edgeList
number_of_edge_based_nodes = BuildEdgeExpandedGraph(lua_state,
number_of_node_based_nodes,
node_based_edge_list,
edge_based_edge_list,
speed_profile);
lua_close(lua_state);
TIMER_STOP(expansion);
BuildRTree(node_based_edge_list);
IteratorbasedCRC32<std::vector<EdgeBasedNode>> crc32;
const unsigned node_based_edge_list_CRC32 =
crc32(node_based_edge_list.begin(), node_based_edge_list.end());
node_based_edge_list.clear();
node_based_edge_list.shrink_to_fit();
SimpleLogger().Write() << "CRC32: " << node_based_edge_list_CRC32;
WriteNodeMapping();
/***
* Contracting the edge-expanded graph
*/
SimpleLogger().Write() << "initializing contractor";
Contractor *contractor = new Contractor(number_of_edge_based_nodes, edge_based_edge_list);
TIMER_START(contraction);
contractor->Run();
TIMER_STOP(contraction);
SimpleLogger().Write() << "Contraction took " << TIMER_SEC(contraction) << " sec";
DeallocatingVector<QueryEdge> contracted_edge_list;
contractor->GetEdges(contracted_edge_list);
delete contractor;
/***
* Sorting contracted edges in a way that the static query graph can read some in in-place.
*/
tbb::parallel_sort(contracted_edge_list.begin(), contracted_edge_list.end());
const unsigned contracted_edge_count = contracted_edge_list.size();
SimpleLogger().Write() << "Serializing compacted graph of " << contracted_edge_count
<< " edges";
boost::filesystem::ofstream hsgr_output_stream(graph_out, std::ios::binary);
hsgr_output_stream.write((char *)&fingerprint_orig, sizeof(FingerPrint));
const unsigned max_used_node_id = 1 + [&contracted_edge_list]
{
unsigned tmp_max = 0;
for (const QueryEdge &edge : contracted_edge_list)
{
BOOST_ASSERT(SPECIAL_NODEID != edge.source);
BOOST_ASSERT(SPECIAL_NODEID != edge.target);
tmp_max = std::max(tmp_max, edge.source);
tmp_max = std::max(tmp_max, edge.target);
}
return tmp_max;
}();
SimpleLogger().Write(logDEBUG) << "input graph has " << number_of_edge_based_nodes << " nodes";
SimpleLogger().Write(logDEBUG) << "contracted graph has " << max_used_node_id << " nodes";
std::vector<StaticGraph<EdgeData>::NodeArrayEntry> node_array;
node_array.resize(number_of_edge_based_nodes + 1);
SimpleLogger().Write() << "Building node array";
StaticGraph<EdgeData>::EdgeIterator edge = 0;
StaticGraph<EdgeData>::EdgeIterator position = 0;
StaticGraph<EdgeData>::EdgeIterator last_edge = edge;
// initializing 'first_edge'-field of nodes:
for (const auto node : osrm::irange(0u, max_used_node_id))
{
last_edge = edge;
while ((edge < contracted_edge_count) && (contracted_edge_list[edge].source == node))
{
++edge;
}
node_array[node].first_edge = position; //=edge
position += edge - last_edge; // remove
}
for (const auto sentinel_counter : osrm::irange<unsigned>(max_used_node_id, node_array.size()))
{
// sentinel element, guarded against underflow
node_array[sentinel_counter].first_edge = contracted_edge_count;
}
SimpleLogger().Write() << "Serializing node array";
const unsigned node_array_size = node_array.size();
// serialize crc32, aka checksum
hsgr_output_stream.write((char *)&node_based_edge_list_CRC32, sizeof(unsigned));
// serialize number of nodes
hsgr_output_stream.write((char *)&node_array_size, sizeof(unsigned));
// serialize number of edges
hsgr_output_stream.write((char *)&contracted_edge_count, sizeof(unsigned));
// serialize all nodes
if (node_array_size > 0)
{
hsgr_output_stream.write((char *)&node_array[0],
sizeof(StaticGraph<EdgeData>::NodeArrayEntry) * node_array_size);
}
// serialize all edges
SimpleLogger().Write() << "Building edge array";
edge = 0;
int number_of_used_edges = 0;
StaticGraph<EdgeData>::EdgeArrayEntry current_edge;
for (const auto edge : osrm::irange<std::size_t>(0, contracted_edge_list.size()))
{
// no eigen loops
BOOST_ASSERT(contracted_edge_list[edge].source != contracted_edge_list[edge].target);
current_edge.target = contracted_edge_list[edge].target;
current_edge.data = contracted_edge_list[edge].data;
// every target needs to be valid
BOOST_ASSERT(current_edge.target < max_used_node_id);
#ifndef NDEBUG
if (current_edge.data.distance <= 0)
{
SimpleLogger().Write(logWARNING) << "Edge: " << edge
<< ",source: " << contracted_edge_list[edge].source
<< ", target: " << contracted_edge_list[edge].target
<< ", dist: " << current_edge.data.distance;
SimpleLogger().Write(logWARNING) << "Failed at adjacency list of node "
<< contracted_edge_list[edge].source << "/"
<< node_array.size() - 1;
return 1;
}
#endif
hsgr_output_stream.write((char *)&current_edge,
sizeof(StaticGraph<EdgeData>::EdgeArrayEntry));
++number_of_used_edges;
}
hsgr_output_stream.close();
TIMER_STOP(preparing);
SimpleLogger().Write() << "Preprocessing : " << TIMER_SEC(preparing) << " seconds";
SimpleLogger().Write() << "Expansion : " << (number_of_node_based_nodes / TIMER_SEC(expansion))
<< " nodes/sec and "
<< (number_of_edge_based_nodes / TIMER_SEC(expansion)) << " edges/sec";
SimpleLogger().Write() << "Contraction: "
<< (number_of_edge_based_nodes / TIMER_SEC(contraction))
<< " nodes/sec and " << number_of_used_edges / TIMER_SEC(contraction)
<< " edges/sec";
node_array.clear();
SimpleLogger().Write() << "finished preprocessing";
return 0;
}
/**
\brief Parses command line arguments
\param argc count of arguments
\param argv array of arguments
\param result [out] value for exit return value
\return true if everything is ok, false if need to terminate execution
*/
bool Prepare::ParseArguments(int argc, char *argv[])
{
// declare a group of options that will be allowed only on command line
boost::program_options::options_description generic_options("Options");
generic_options.add_options()("version,v", "Show version")("help,h", "Show this help message")(
"config,c",
boost::program_options::value<boost::filesystem::path>(&config_file_path)
->default_value("contractor.ini"),
"Path to a configuration file.");
// declare a group of options that will be allowed both on command line and in config file
boost::program_options::options_description config_options("Configuration");
config_options.add_options()(
"restrictions,r",
boost::program_options::value<boost::filesystem::path>(&restrictions_path),
"Restrictions file in .osrm.restrictions format")(
"profile,p",
boost::program_options::value<boost::filesystem::path>(&profile_path)
->default_value("profile.lua"),
"Path to LUA routing profile")(
"threads,t",
boost::program_options::value<unsigned int>(&requested_num_threads)
->default_value(tbb::task_scheduler_init::default_num_threads()),
"Number of threads to use");
// hidden options, will be allowed both on command line and in config file, but will not be
// shown to the user
boost::program_options::options_description hidden_options("Hidden options");
hidden_options.add_options()(
"input,i",
boost::program_options::value<boost::filesystem::path>(&input_path),
"Input file in .osm, .osm.bz2 or .osm.pbf format");
// positional option
boost::program_options::positional_options_description positional_options;
positional_options.add("input", 1);
// combine above options for parsing
boost::program_options::options_description cmdline_options;
cmdline_options.add(generic_options).add(config_options).add(hidden_options);
boost::program_options::options_description config_file_options;
config_file_options.add(config_options).add(hidden_options);
boost::program_options::options_description visible_options(
"Usage: " + boost::filesystem::basename(argv[0]) + " <input.osrm> [options]");
visible_options.add(generic_options).add(config_options);
// parse command line options
boost::program_options::variables_map option_variables;
boost::program_options::store(boost::program_options::command_line_parser(argc, argv)
.options(cmdline_options)
.positional(positional_options)
.run(),
option_variables);
if (option_variables.count("version"))
{
SimpleLogger().Write() << g_GIT_DESCRIPTION;
return false;
}
if (option_variables.count("help"))
{
SimpleLogger().Write() << "\n" << visible_options;
return false;
}
boost::program_options::notify(option_variables);
if (!option_variables.count("restrictions"))
{
restrictions_path = std::string(input_path.string() + ".restrictions");
}
if (!option_variables.count("input"))
{
SimpleLogger().Write() << "\n" << visible_options;
return false;
}
return true;
}
/**
\brief Loads and checks file UUIDs
*/
void Prepare::CheckRestrictionsFile(FingerPrint &fingerprint_orig)
{
boost::filesystem::ifstream restriction_stream(restrictions_path, std::ios::binary);
FingerPrint fingerprint_loaded;
unsigned number_of_usable_restrictions = 0;
restriction_stream.read((char *)&fingerprint_loaded, sizeof(FingerPrint));
if (!fingerprint_loaded.TestPrepare(fingerprint_orig))
{
SimpleLogger().Write(logWARNING) << ".restrictions was prepared with different build.\n"
"Reprocess to get rid of this warning.";
}
restriction_stream.read((char *)&number_of_usable_restrictions, sizeof(unsigned));
restriction_list.resize(number_of_usable_restrictions);
if (number_of_usable_restrictions > 0)
{
restriction_stream.read((char *)&(restriction_list[0]),
number_of_usable_restrictions * sizeof(TurnRestriction));
}
restriction_stream.close();
}
/**
\brief Setups scripting environment (lua-scripting)
Also initializes speed profile.
*/
bool
Prepare::SetupScriptingEnvironment(lua_State *lua_state,
EdgeBasedGraphFactory::SpeedProfileProperties &speed_profile)
{
// open utility libraries string library;
luaL_openlibs(lua_state);
// adjust lua load path
luaAddScriptFolderToLoadPath(lua_state, profile_path.string().c_str());
// Now call our function in a lua script
if (0 != luaL_dofile(lua_state, profile_path.string().c_str()))
{
std::cerr << lua_tostring(lua_state, -1) << " occured in scripting block" << std::endl;
return false;
}
if (0 != luaL_dostring(lua_state, "return traffic_signal_penalty\n"))
{
std::cerr << lua_tostring(lua_state, -1) << " occured in scripting block" << std::endl;
return false;
}
speed_profile.traffic_signal_penalty = 10 * lua_tointeger(lua_state, -1);
SimpleLogger().Write(logDEBUG)
<< "traffic_signal_penalty: " << speed_profile.traffic_signal_penalty;
if (0 != luaL_dostring(lua_state, "return u_turn_penalty\n"))
{
std::cerr << lua_tostring(lua_state, -1) << " occured in scripting block" << std::endl;
return false;
}
speed_profile.u_turn_penalty = 10 * lua_tointeger(lua_state, -1);
speed_profile.has_turn_penalty_function = lua_function_exists(lua_state, "turn_function");
return true;
}
/**
\brief Building an edge-expanded graph from node-based input and turn restrictions
*/
std::size_t Prepare::BuildEdgeExpandedGraph(lua_State *lua_state,
NodeID number_of_node_based_nodes,
std::vector<EdgeBasedNode> &node_based_edge_list,
DeallocatingVector<EdgeBasedEdge> &edge_based_edge_list,
EdgeBasedGraphFactory::SpeedProfileProperties &speed_profile)
{
SimpleLogger().Write() << "Generating edge-expanded graph representation";
std::shared_ptr<NodeBasedDynamicGraph> node_based_graph =
NodeBasedDynamicGraphFromImportEdges(number_of_node_based_nodes, edge_list);
std::unique_ptr<RestrictionMap> restriction_map =
std::unique_ptr<RestrictionMap>(new RestrictionMap(node_based_graph, restriction_list));
std::shared_ptr<EdgeBasedGraphFactory> edge_based_graph_factory =
std::make_shared<EdgeBasedGraphFactory>(node_based_graph,
std::move(restriction_map),
barrier_node_list,
traffic_light_list,
internal_to_external_node_map,
speed_profile);
edge_list.clear();
edge_list.shrink_to_fit();
edge_based_graph_factory->Run(edge_out, geometry_filename, lua_state);
restriction_list.clear();
restriction_list.shrink_to_fit();
barrier_node_list.clear();
barrier_node_list.shrink_to_fit();
traffic_light_list.clear();
traffic_light_list.shrink_to_fit();
const std::size_t number_of_edge_based_nodes = edge_based_graph_factory->GetNumberOfEdgeBasedNodes();
BOOST_ASSERT(number_of_edge_based_nodes != std::numeric_limits<unsigned>::max());
#ifndef WIN32
static_assert(sizeof(EdgeBasedEdge) == 16,
"changing ImportEdge type has influence on memory consumption!");
#endif
edge_based_graph_factory->GetEdgeBasedEdges(edge_based_edge_list);
edge_based_graph_factory->GetEdgeBasedNodes(node_based_edge_list);
edge_based_graph_factory.reset();
node_based_graph.reset();
return number_of_edge_based_nodes;
}
/**
\brief Writing info on original (node-based) nodes
*/
void Prepare::WriteNodeMapping()
{
SimpleLogger().Write() << "writing node map ...";
boost::filesystem::ofstream node_stream(node_filename, std::ios::binary);
const unsigned size_of_mapping = internal_to_external_node_map.size();
node_stream.write((char *)&size_of_mapping, sizeof(unsigned));
if (size_of_mapping > 0)
{
node_stream.write((char *)&(internal_to_external_node_map[0]),
size_of_mapping * sizeof(NodeInfo));
}
node_stream.close();
internal_to_external_node_map.clear();
internal_to_external_node_map.shrink_to_fit();
}
/**
\brief Building rtree-based nearest-neighbor data structure
Saves info to files: '.ramIndex' and '.fileIndex'.
*/
void Prepare::BuildRTree(std::vector<EdgeBasedNode> &node_based_edge_list)
{
SimpleLogger().Write() << "building r-tree ...";
StaticRTree<EdgeBasedNode>(node_based_edge_list,
rtree_nodes_path.c_str(),
rtree_leafs_path.c_str(),
internal_to_external_node_map);
}
+67
View File
@@ -0,0 +1,67 @@
#ifndef PREPARE_H
#define PREPARE_H
#include "EdgeBasedGraphFactory.h"
#include "../DataStructures/QueryEdge.h"
#include "../DataStructures/StaticGraph.h"
#include "../Util/GraphLoader.h"
#include <boost/filesystem.hpp>
#include <luabind/luabind.hpp>
#include <vector>
/**
\brief class of 'prepare' utility.
*/
class Prepare
{
public:
typedef QueryEdge::EdgeData EdgeData;
typedef DynamicGraph<EdgeData>::InputEdge InputEdge;
typedef StaticGraph<EdgeData>::InputEdge StaticEdge;
explicit Prepare();
Prepare(const Prepare &) = delete;
~Prepare();
int Process(int argc, char *argv[]);
protected:
bool ParseArguments(int argc, char *argv[]);
void CheckRestrictionsFile(FingerPrint &fingerprint_orig);
bool SetupScriptingEnvironment(lua_State *myLuaState,
EdgeBasedGraphFactory::SpeedProfileProperties &speed_profile);
std::size_t BuildEdgeExpandedGraph(lua_State *myLuaState,
NodeID nodeBasedNodeNumber,
std::vector<EdgeBasedNode> &nodeBasedEdgeList,
DeallocatingVector<EdgeBasedEdge> &edgeBasedEdgeList,
EdgeBasedGraphFactory::SpeedProfileProperties &speed_profile);
void WriteNodeMapping();
void BuildRTree(std::vector<EdgeBasedNode> &node_based_edge_list);
private:
std::vector<NodeInfo> internal_to_external_node_map;
std::vector<TurnRestriction> restriction_list;
std::vector<NodeID> barrier_node_list;
std::vector<NodeID> traffic_light_list;
std::vector<ImportEdge> edge_list;
unsigned requested_num_threads;
boost::filesystem::path config_file_path;
boost::filesystem::path input_path;
boost::filesystem::path restrictions_path;
boost::filesystem::path preinfo_path;
boost::filesystem::path profile_path;
std::string node_filename;
std::string edge_out;
std::string info_out;
std::string geometry_filename;
std::string graph_out;
std::string rtree_nodes_path;
std::string rtree_leafs_path;
};
#endif // PREPARE_H
+290
View File
@@ -0,0 +1,290 @@
/*
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 BINARY_HEAP_H
#define BINARY_HEAP_H
#include <boost/assert.hpp>
#include <algorithm>
#include <limits>
#include <map>
#include <type_traits>
#include <unordered_map>
#include <vector>
#include <cstring>
template <typename NodeID, typename Key> class ArrayStorage
{
public:
explicit 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:
explicit 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:
explicit UnorderedMapStorage(size_t) { nodes.rehash(1000); }
Key &operator[](const NodeID node) { return nodes[node]; }
Key const &operator[](const NodeID node) const
{
auto iter = nodes.find(node);
return iter->second;
}
void Clear() { nodes.clear(); }
private:
std::unordered_map<NodeID, Key> nodes;
};
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;
explicit BinaryHeap(size_t maxID) : node_index(maxID) { Clear(); }
void Clear()
{
heap.resize(1);
inserted_nodes.clear();
heap[0].weight = std::numeric_limits<Weight>::min();
node_index.Clear();
}
std::size_t Size() const { return (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>(inserted_nodes.size());
element.weight = weight;
const Key key = static_cast<Key>(heap.size());
heap.emplace_back(element);
inserted_nodes.emplace_back(node, key, weight, data);
node_index[node] = element.index;
Upheap(key);
CheckHeap();
}
Data &GetData(NodeID node)
{
const Key index = node_index[node];
return inserted_nodes[index].data;
}
Data const &GetData(NodeID node) const
{
const Key index = node_index[node];
return inserted_nodes[index].data;
}
Weight &GetKey(NodeID node)
{
const Key index = node_index[node];
return inserted_nodes[index].weight;
}
bool WasRemoved(const NodeID node)
{
BOOST_ASSERT(WasInserted(node));
const Key index = node_index[node];
return inserted_nodes[index].key == 0;
}
bool WasInserted(const NodeID node)
{
const Key index = node_index[node];
if (index >= static_cast<Key>(inserted_nodes.size()))
{
return false;
}
return inserted_nodes[index].node == node;
}
NodeID Min() const
{
BOOST_ASSERT(heap.size() > 1);
return inserted_nodes[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);
}
inserted_nodes[removedIndex].key = 0;
CheckHeap();
return inserted_nodes[removedIndex].node;
}
void DeleteAll()
{
auto iend = heap.end();
for (typename std::vector<HeapElement>::iterator i = heap.begin() + 1; i != iend; ++i)
{
inserted_nodes[i->index].key = 0;
}
heap.resize(1);
heap[0].weight = (std::numeric_limits<Weight>::min)();
}
void DecreaseKey(NodeID node, Weight weight)
{
BOOST_ASSERT(std::numeric_limits<NodeID>::max() != node);
const Key &index = node_index[node];
Key &key = inserted_nodes[index].key;
BOOST_ASSERT(key >= 0);
inserted_nodes[index].weight = weight;
heap[key].weight = weight;
Upheap(key);
CheckHeap();
}
private:
class HeapNode
{
public:
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> inserted_nodes;
std::vector<HeapElement> heap;
IndexStorage node_index;
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];
inserted_nodes[heap[key].index].key = key;
key = nextKey;
nextKey <<= 1;
}
heap[key].index = droppingIndex;
heap[key].weight = weight;
inserted_nodes[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];
inserted_nodes[heap[key].index].key = key;
key = nextKey;
nextKey >>= 1;
}
heap[key].index = risingIndex;
heap[key].weight = weight;
inserted_nodes[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 // BINARY_HEAP_H
+85
View File
@@ -0,0 +1,85 @@
/*
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 CONCURRENT_QUEUE_H
#define CONCURRENT_QUEUE_H
#include "../typedefs.h"
#include <boost/circular_buffer.hpp>
#include <condition_variable>
#include <mutex>
template <typename Data> class ConcurrentQueue
{
public:
explicit ConcurrentQueue(const size_t max_size) : m_internal_queue(max_size) {}
inline void push(const Data &data)
{
std::unique_lock<std::mutex> lock(m_mutex);
m_not_full.wait(lock,
[this]
{ return m_internal_queue.size() < m_internal_queue.capacity(); });
m_internal_queue.push_back(data);
m_not_empty.notify_one();
}
inline bool empty() const { return m_internal_queue.empty(); }
inline void wait_and_pop(Data &popped_value)
{
std::unique_lock<std::mutex> lock(m_mutex);
m_not_empty.wait(lock,
[this]
{ return !m_internal_queue.empty(); });
popped_value = m_internal_queue.front();
m_internal_queue.pop_front();
m_not_full.notify_one();
}
inline bool try_pop(Data &popped_value)
{
std::unique_lock<std::mutex> lock(m_mutex);
if (m_internal_queue.empty())
{
return false;
}
popped_value = m_internal_queue.front();
m_internal_queue.pop_front();
m_not_full.notify_one();
return true;
}
private:
boost::circular_buffer<Data> m_internal_queue;
std::mutex m_mutex;
std::condition_variable m_not_empty;
std::condition_variable m_not_full;
};
#endif // CONCURRENT_QUEUE_H
+475
View File
@@ -0,0 +1,475 @@
/*
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/Coordinate.h>
#include "../Util/MercatorUtil.h"
#ifndef NDEBUG
#include "../Util/SimpleLogger.h"
#endif
#include "../Util/StringUtil.h"
#include <boost/assert.hpp>
#ifndef NDEBUG
#include <bitset>
#endif
#include <iostream>
#include <limits>
FixedPointCoordinate::FixedPointCoordinate()
: lat(std::numeric_limits<int>::min()), lon(std::numeric_limits<int>::min())
{
}
FixedPointCoordinate::FixedPointCoordinate(int lat, int lon) : lat(lat), lon(lon)
{
#ifndef NDEBUG
if (0 != (std::abs(lat) >> 30))
{
std::bitset<32> y_coordinate_vector(lat);
SimpleLogger().Write(logDEBUG) << "broken lat: " << lat
<< ", bits: " << y_coordinate_vector;
}
if (0 != (std::abs(lon) >> 30))
{
std::bitset<32> x_coordinate_vector(lon);
SimpleLogger().Write(logDEBUG) << "broken lon: " << lon
<< ", bits: " << x_coordinate_vector;
}
#endif
}
void FixedPointCoordinate::Reset()
{
lat = std::numeric_limits<int>::min();
lon = std::numeric_limits<int>::min();
}
bool FixedPointCoordinate::isSet() const
{
return (std::numeric_limits<int>::min() != lat) && (std::numeric_limits<int>::min() != lon);
}
bool FixedPointCoordinate::isValid() const
{
if (lat > 90 * COORDINATE_PRECISION || lat < -90 * COORDINATE_PRECISION ||
lon > 180 * COORDINATE_PRECISION || lon < -180 * COORDINATE_PRECISION)
{
return false;
}
return true;
}
bool FixedPointCoordinate::operator==(const FixedPointCoordinate &other) const
{
return lat == other.lat && lon == other.lon;
}
double FixedPointCoordinate::ApproximateDistance(const int lat1,
const int lon1,
const int lat2,
const int lon2)
{
BOOST_ASSERT(lat1 != std::numeric_limits<int>::min());
BOOST_ASSERT(lon1 != std::numeric_limits<int>::min());
BOOST_ASSERT(lat2 != std::numeric_limits<int>::min());
BOOST_ASSERT(lon2 != std::numeric_limits<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 radius varies between 6,356.750-6,378.135 km (3,949.901-3,963.189mi)
// The IUGG value for the equatorial radius is 6378.137 km (3963.19 miles)
const double earth = 6372797.560856;
return earth * cHarv;
}
double FixedPointCoordinate::ApproximateDistance(const FixedPointCoordinate &coordinate_1,
const FixedPointCoordinate &coordinate_2)
{
return ApproximateDistance(
coordinate_1.lat, coordinate_1.lon, coordinate_2.lat, coordinate_2.lon);
}
float FixedPointCoordinate::ApproximateEuclideanDistance(const FixedPointCoordinate &coordinate_1,
const FixedPointCoordinate &coordinate_2)
{
return ApproximateEuclideanDistance(
coordinate_1.lat, coordinate_1.lon, coordinate_2.lat, coordinate_2.lon);
}
float FixedPointCoordinate::ApproximateEuclideanDistance(const int lat1,
const int lon1,
const int lat2,
const int lon2)
{
BOOST_ASSERT(lat1 != std::numeric_limits<int>::min());
BOOST_ASSERT(lon1 != std::numeric_limits<int>::min());
BOOST_ASSERT(lat2 != std::numeric_limits<int>::min());
BOOST_ASSERT(lon2 != std::numeric_limits<int>::min());
const float RAD = 0.017453292519943295769236907684886f;
const float float_lat1 = (lat1 / COORDINATE_PRECISION) * RAD;
const float float_lon1 = (lon1 / COORDINATE_PRECISION) * RAD;
const float float_lat2 = (lat2 / COORDINATE_PRECISION) * RAD;
const float float_lon2 = (lon2 / COORDINATE_PRECISION) * RAD;
const float x_value = (float_lon2 - float_lon1) * cos((float_lat1 + float_lat2) / 2.f);
const float y_value = float_lat2 - float_lat1;
const float earth_radius = 6372797.560856f;
return sqrt(x_value * x_value + y_value * y_value) * earth_radius;
}
float
FixedPointCoordinate::ComputePerpendicularDistance(const FixedPointCoordinate &source_coordinate,
const FixedPointCoordinate &target_coordinate,
const FixedPointCoordinate &point)
{
// initialize values
const float x_value = lat2y(point.lat / COORDINATE_PRECISION);
const float y_value = point.lon / COORDINATE_PRECISION;
float a = lat2y(source_coordinate.lat / COORDINATE_PRECISION);
float b = source_coordinate.lon / COORDINATE_PRECISION;
float c = lat2y(target_coordinate.lat / COORDINATE_PRECISION);
float d = target_coordinate.lon / COORDINATE_PRECISION;
float p, q;
if (std::abs(a - c) > std::numeric_limits<float>::epsilon())
{
const float slope = (d - b) / (c - a); // slope
// Projection of (x,y) on line joining (a,b) and (c,d)
p = ((x_value + (slope * y_value)) + (slope * slope * a - slope * b)) /
(1.f + slope * slope);
q = b + slope * (p - a);
}
else
{
p = c;
q = y_value;
}
float ratio;
bool inverse_ratio = false;
// straight line segment on equator
if (std::abs(c) < std::numeric_limits<float>::epsilon() && std::abs(a) < std::numeric_limits<float>::epsilon())
{
ratio = (q - b) / (d - b);
}
else
{
if (std::abs(c) < std::numeric_limits<float>::epsilon())
{
// swap start/end
std::swap(a, c);
std::swap(b, d);
inverse_ratio = true;
}
float nY = (d * p - c * q) / (a * d - b * c);
// discretize the result to coordinate precision. it's a hack!
if (std::abs(nY) < (1.f / COORDINATE_PRECISION))
{
nY = 0.f;
}
// compute ratio
ratio = (p - nY * a) / c;
}
if (std::isnan(ratio))
{
ratio = (target_coordinate == point ? 1.f : 0.f);
}
else if (std::abs(ratio) <= std::numeric_limits<float>::epsilon())
{
ratio = 0.f;
}
else if (std::abs(ratio - 1.f) <= std::numeric_limits<float>::epsilon())
{
ratio = 1.f;
}
// we need to do this, if we switched start/end coordinates
if (inverse_ratio)
{
ratio = 1.0f - ratio;
}
//compute the nearest location
FixedPointCoordinate nearest_location;
BOOST_ASSERT(!std::isnan(ratio));
if (ratio <= 0.f)
{ // point is "left" of edge
nearest_location = source_coordinate;
}
else if (ratio >= 1.f)
{ // point is "right" of edge
nearest_location = target_coordinate;
}
else
{ // point lies in between
nearest_location.lat = static_cast<int>(y2lat(p) * COORDINATE_PRECISION);
nearest_location.lon = static_cast<int>(q * COORDINATE_PRECISION);
}
BOOST_ASSERT(nearest_location.isValid());
return FixedPointCoordinate::ApproximateEuclideanDistance(point, nearest_location);
}
float FixedPointCoordinate::ComputePerpendicularDistance(const FixedPointCoordinate &segment_source,
const FixedPointCoordinate &segment_target,
const FixedPointCoordinate &query_location,
FixedPointCoordinate &nearest_location,
float &ratio)
{
BOOST_ASSERT(query_location.isValid());
// initialize values
const float x = lat2y(query_location.lat / COORDINATE_PRECISION);
const float y = query_location.lon / COORDINATE_PRECISION;
const float a = lat2y(segment_source.lat / COORDINATE_PRECISION);
const float b = segment_source.lon / COORDINATE_PRECISION;
const float c = lat2y(segment_target.lat / COORDINATE_PRECISION);
const float d = segment_target.lon / COORDINATE_PRECISION;
float p, q /*,mX*/, nY;
if (std::abs(a - c) > std::numeric_limits<float>::epsilon())
{
const float 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.f + m * m);
q = b + m * (p - a);
}
else
{
p = c;
q = y;
}
nY = (d * p - c * q) / (a * d - b * c);
// discretize the result to coordinate precision. it's a hack!
if (std::abs(nY) < (1.f / COORDINATE_PRECISION))
{
nY = 0.f;
}
// compute ratio
ratio = (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(ratio))
{
ratio = (segment_target == query_location ? 1.f : 0.f);
}
else if (std::abs(ratio) <= std::numeric_limits<float>::epsilon())
{
ratio = 0.;
}
else if (std::abs(ratio - 1.f) <= std::numeric_limits<float>::epsilon())
{
ratio = 1.f;
}
// compute nearest location
BOOST_ASSERT(!std::isnan(ratio));
if (ratio <= 0.f)
{
nearest_location = segment_source;
}
else if (ratio >= 1.)
{
nearest_location = segment_target;
}
else
{
// point lies in between
nearest_location.lat = static_cast<int>(y2lat(p) * COORDINATE_PRECISION);
nearest_location.lon = static_cast<int>(q * COORDINATE_PRECISION);
}
BOOST_ASSERT(nearest_location.isValid());
const float approximate_distance =
FixedPointCoordinate::ApproximateEuclideanDistance(query_location, nearest_location);
BOOST_ASSERT(0. <= approximate_distance);
return approximate_distance;
}
void FixedPointCoordinate::convertInternalLatLonToString(const int value, std::string &output)
{
char buffer[12];
buffer[11] = 0; // zero termination
output = printInt<11, 6>(buffer, value);
}
void FixedPointCoordinate::convertInternalCoordinateToString(const FixedPointCoordinate &coord,
std::string &output)
{
std::string tmp;
tmp.reserve(23);
convertInternalLatLonToString(coord.lon, tmp);
output = tmp;
output += ",";
convertInternalLatLonToString(coord.lat, tmp);
output += tmp;
}
void
FixedPointCoordinate::convertInternalReversedCoordinateToString(const FixedPointCoordinate &coord,
std::string &output)
{
std::string tmp;
tmp.reserve(23);
convertInternalLatLonToString(coord.lat, tmp);
output = tmp;
output += ",";
convertInternalLatLonToString(coord.lon, tmp);
output += tmp;
}
void FixedPointCoordinate::Output(std::ostream &out) const
{
out << "(" << lat / COORDINATE_PRECISION << "," << lon / COORDINATE_PRECISION << ")";
}
float FixedPointCoordinate::GetBearing(const FixedPointCoordinate &first_coordinate,
const FixedPointCoordinate &second_coordinate)
{
const float lon_diff = second_coordinate.lon / COORDINATE_PRECISION - first_coordinate.lon / COORDINATE_PRECISION;
const float lon_delta = DegreeToRadian(lon_diff);
const float lat1 = DegreeToRadian(first_coordinate.lat / COORDINATE_PRECISION);
const float lat2 = DegreeToRadian(second_coordinate.lat / COORDINATE_PRECISION);
const float y = sin(lon_delta) * cos(lat2);
const float x = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(lon_delta);
float result = RadianToDegree(std::atan2(y, x));
while (result < 0.f)
{
result += 360.f;
}
while (result >= 360.f)
{
result -= 360.f;
}
return result;
}
float FixedPointCoordinate::GetBearing(const FixedPointCoordinate &other) const
{
const float lon_delta =
DegreeToRadian(lon / COORDINATE_PRECISION - other.lon / COORDINATE_PRECISION);
const float lat1 = DegreeToRadian(other.lat / COORDINATE_PRECISION);
const float lat2 = DegreeToRadian(lat / COORDINATE_PRECISION);
const float y_value = std::sin(lon_delta) * std::cos(lat2);
const float x_value =
std::cos(lat1) * std::sin(lat2) - std::sin(lat1) * std::cos(lat2) * std::cos(lon_delta);
float result = RadianToDegree(std::atan2(y_value, x_value));
while (result < 0.f)
{
result += 360.f;
}
while (result >= 360.f)
{
result -= 360.f;
}
return result;
}
float FixedPointCoordinate::DegreeToRadian(const float degree) { return degree * (static_cast<float>(M_PI) / 180.f); }
float FixedPointCoordinate::RadianToDegree(const float radian) { return radian * (180.f * static_cast<float>(M_1_PI)); }
// This distance computation does integer arithmetic only and is a lot faster than
// the other distance function which are numerically correct('ish).
// It preserves some order among the elements that make it useful for certain purposes
int FixedPointCoordinate::OrderedPerpendicularDistanceApproximation(
const FixedPointCoordinate &input_point,
const FixedPointCoordinate &segment_source,
const FixedPointCoordinate &segment_target)
{
// initialize values
const float x = lat2y(input_point.lat / COORDINATE_PRECISION);
const float y = input_point.lon / COORDINATE_PRECISION;
const float a = lat2y(segment_source.lat / COORDINATE_PRECISION);
const float b = segment_source.lon / COORDINATE_PRECISION;
const float c = lat2y(segment_target.lat / COORDINATE_PRECISION);
const float d = segment_target.lon / COORDINATE_PRECISION;
float p, q;
if (a == c)
{
p = c;
q = y;
}
else
{
const float 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.f + m * m);
q = b + m * (p - a);
}
const float nY = (d * p - c * q) / (a * d - b * c);
float ratio = (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(ratio))
{
ratio = (segment_target == input_point) ? 1.f : 0.f;
}
// compute target quasi-location
int dx, dy;
if (ratio < 0.f)
{
dx = input_point.lon - segment_source.lon;
dy = input_point.lat - segment_source.lat;
}
else if (ratio > 1.f)
{
dx = input_point.lon - segment_target.lon;
dy = input_point.lat - segment_target.lat;
}
else
{
// point lies in between
dx = input_point.lon - static_cast<int>(q * COORDINATE_PRECISION);
dy = input_point.lat - static_cast<int>(y2lat(p) * COORDINATE_PRECISION);
}
// return an approximation in the plane
return static_cast<int>(sqrt(dx * dx + dy * dy));
}
+313
View File
@@ -0,0 +1,313 @@
/*
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 "Range.h"
#include <boost/iterator/iterator_facade.hpp>
#include <utility>
#include <vector>
template <typename ElementT> struct DeallocatingVectorIteratorState
{
DeallocatingVectorIteratorState() : index(-1), bucket_list(nullptr) {}
explicit DeallocatingVectorIteratorState(const DeallocatingVectorIteratorState &r)
: index(r.index), bucket_list(r.bucket_list)
{
}
explicit DeallocatingVectorIteratorState(const std::size_t idx,
std::vector<ElementT *> *input_list)
: index(idx), bucket_list(input_list)
{
}
std::size_t index;
std::vector<ElementT *> *bucket_list;
inline DeallocatingVectorIteratorState &operator=(const DeallocatingVectorIteratorState &other)
{
index = other.index;
bucket_list = other.bucket_list;
return *this;
}
};
template <typename ElementT, std::size_t ELEMENTS_PER_BLOCK>
class DeallocatingVectorIterator
: public boost::iterator_facade<DeallocatingVectorIterator<ElementT, ELEMENTS_PER_BLOCK>,
ElementT,
std::random_access_iterator_tag>
{
DeallocatingVectorIteratorState<ElementT> current_state;
public:
DeallocatingVectorIterator() {}
DeallocatingVectorIterator(std::size_t idx, std::vector<ElementT *> *input_list)
: current_state(idx, input_list)
{
}
friend class boost::iterator_core_access;
void advance(std::size_t n) { current_state.index += n; }
void increment() { advance(1); }
void decrement() { advance(-1); }
bool equal(DeallocatingVectorIterator const &other) const
{
return current_state.index == other.current_state.index;
}
std::ptrdiff_t distance_to(DeallocatingVectorIterator const &other) const
{
// it is important to implement it 'other minus this'. otherwise sorting breaks
return other.current_state.index - current_state.index;
}
ElementT &dereference() const
{
const std::size_t current_bucket = current_state.index / ELEMENTS_PER_BLOCK;
const std::size_t current_index = current_state.index % ELEMENTS_PER_BLOCK;
return (current_state.bucket_list->at(current_bucket)[current_index]);
}
ElementT &operator[](const std::size_t index) const
{
const std::size_t current_bucket = (index + current_state.index) / ELEMENTS_PER_BLOCK;
const std::size_t current_index = (index + current_state.index) % ELEMENTS_PER_BLOCK;
return (current_state.bucket_list->at(current_bucket)[current_index]);
}
};
template <typename ElementT, std::size_t ELEMENTS_PER_BLOCK>
class DeallocatingVectorRemoveIterator
: public boost::iterator_facade<DeallocatingVectorRemoveIterator<ElementT, ELEMENTS_PER_BLOCK>,
ElementT,
boost::forward_traversal_tag>
{
DeallocatingVectorIteratorState<ElementT> current_state;
public:
DeallocatingVectorRemoveIterator(std::size_t idx, std::vector<ElementT *> *input_list)
: current_state(idx, input_list)
{
}
friend class boost::iterator_core_access;
void increment()
{
const std::size_t old_bucket = current_state.index / ELEMENTS_PER_BLOCK;
++current_state.index;
const std::size_t new_bucket = current_state.index / ELEMENTS_PER_BLOCK;
if (old_bucket != new_bucket)
{
// delete old bucket entry
if (nullptr != current_state.bucket_list->at(old_bucket))
{
delete[] current_state.bucket_list->at(old_bucket);
current_state.bucket_list->at(old_bucket) = nullptr;
}
}
}
bool equal(DeallocatingVectorRemoveIterator const &other) const
{
return current_state.index == other.current_state.index;
}
std::ptrdiff_t distance_to(DeallocatingVectorRemoveIterator const &other) const
{
return other.current_state.index - current_state.index;
}
ElementT &dereference() const
{
const std::size_t current_bucket = current_state.index / ELEMENTS_PER_BLOCK;
const std::size_t current_index = current_state.index % ELEMENTS_PER_BLOCK;
return (current_state.bucket_list->at(current_bucket)[current_index]);
}
};
template <typename ElementT, std::size_t ELEMENTS_PER_BLOCK = 8388608 / sizeof(ElementT)>
class DeallocatingVector
{
std::size_t current_size;
std::vector<ElementT *> bucket_list;
public:
typedef DeallocatingVectorIterator<ElementT, ELEMENTS_PER_BLOCK> iterator;
typedef DeallocatingVectorIterator<ElementT, ELEMENTS_PER_BLOCK> const_iterator;
// this forward-only iterator deallocates all buckets that have been visited
typedef DeallocatingVectorRemoveIterator<ElementT, ELEMENTS_PER_BLOCK> deallocation_iterator;
DeallocatingVector() : current_size(0) { bucket_list.emplace_back(new ElementT[ELEMENTS_PER_BLOCK]); }
~DeallocatingVector() { clear(); }
inline void swap(DeallocatingVector<ElementT, ELEMENTS_PER_BLOCK> &other)
{
std::swap(current_size, other.current_size);
bucket_list.swap(other.bucket_list);
}
inline void clear()
{
// Delete[]'ing ptr's to all Buckets
for (auto bucket : bucket_list)
{
if (nullptr != bucket)
{
delete[] bucket;
bucket = nullptr;
}
}
bucket_list.clear(); bucket_list.shrink_to_fit();
current_size = 0;
}
inline void push_back(const ElementT &element)
{
const std::size_t current_capacity = capacity();
if (current_size == current_capacity)
{
bucket_list.push_back(new ElementT[ELEMENTS_PER_BLOCK]);
}
std::size_t current_index = size() % ELEMENTS_PER_BLOCK;
bucket_list.back()[current_index] = element;
++current_size;
}
template <typename... Ts> inline void emplace_back(Ts &&... element)
{
const std::size_t current_capacity = capacity();
if (current_size == current_capacity)
{
bucket_list.push_back(new ElementT[ELEMENTS_PER_BLOCK]);
}
const std::size_t current_index = size() % ELEMENTS_PER_BLOCK;
bucket_list.back()[current_index] = ElementT(std::forward<Ts>(element)...);
++current_size;
}
inline void reserve(const std::size_t) const { /* don't do anything */ }
inline void resize(const std::size_t new_size)
{
if (new_size >= current_size)
{
while (capacity() < new_size)
{
bucket_list.push_back(new ElementT[ELEMENTS_PER_BLOCK]);
}
}
else
{ // down-size
const std::size_t number_of_necessary_buckets = 1 + (new_size / ELEMENTS_PER_BLOCK);
for (const auto bucket_index : osrm::irange(number_of_necessary_buckets, bucket_list.size()))
{
if (nullptr != bucket_list[bucket_index])
{
delete[] bucket_list[bucket_index];
}
}
bucket_list.resize(number_of_necessary_buckets);
}
current_size = new_size;
}
inline std::size_t size() const { return current_size; }
inline std::size_t capacity() const { return bucket_list.size() * ELEMENTS_PER_BLOCK; }
inline iterator begin() { return iterator(static_cast<std::size_t>(0), &bucket_list); }
inline iterator end() { return iterator(size(), &bucket_list); }
inline deallocation_iterator dbegin()
{
return deallocation_iterator(static_cast<std::size_t>(0), &bucket_list);
}
inline deallocation_iterator dend() { return deallocation_iterator(size(), &bucket_list); }
inline const_iterator begin() const
{
return const_iterator(static_cast<std::size_t>(0), &bucket_list);
}
inline const_iterator end() const { return const_iterator(size(), &bucket_list); }
inline ElementT &operator[](const std::size_t index)
{
const std::size_t _bucket = index / ELEMENTS_PER_BLOCK;
const std::size_t _index = index % ELEMENTS_PER_BLOCK;
return (bucket_list[_bucket][_index]);
}
const inline ElementT &operator[](const std::size_t index) const
{
const std::size_t _bucket = index / ELEMENTS_PER_BLOCK;
const std::size_t _index = index % ELEMENTS_PER_BLOCK;
return (bucket_list[_bucket][_index]);
}
inline ElementT &back()
{
const std::size_t _bucket = current_size / ELEMENTS_PER_BLOCK;
const std::size_t _index = current_size % ELEMENTS_PER_BLOCK;
return (bucket_list[_bucket][_index]);
}
const inline ElementT &back() const
{
const std::size_t _bucket = current_size / ELEMENTS_PER_BLOCK;
const std::size_t _index = current_size % ELEMENTS_PER_BLOCK;
return (bucket_list[_bucket][_index]);
}
template<class InputIterator>
const inline void append(InputIterator first, const InputIterator last)
{
InputIterator position = first;
while (position != last)
{
push_back(*position);
++position;
}
}
};
#endif /* DEALLOCATINGVECTOR_H_ */
+295
View File
@@ -0,0 +1,295 @@
/*
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
#define DYNAMICGRAPH_H
#include "DeallocatingVector.h"
#include "Range.h"
#include <boost/assert.hpp>
#include <cstdint>
#include <algorithm>
#include <limits>
#include <vector>
#include <atomic>
template <typename EdgeDataT> class DynamicGraph
{
public:
typedef EdgeDataT EdgeData;
typedef unsigned NodeIterator;
typedef unsigned EdgeIterator;
typedef osrm::range<EdgeIterator> EdgeRange;
class InputEdge
{
public:
NodeIterator source;
NodeIterator target;
EdgeDataT data;
InputEdge() : source(std::numeric_limits<NodeIterator>::max()), target(std::numeric_limits<NodeIterator>::max()) { }
template<typename... Ts>
InputEdge(NodeIterator source, NodeIterator target, Ts &&...data) : source(source), target(target), data(std::forward<Ts>(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.
explicit DynamicGraph(int32_t nodes) : number_of_nodes(nodes), number_of_edges(0)
{
node_list.reserve(number_of_nodes);
node_list.resize(number_of_nodes);
edge_list.reserve(number_of_nodes * 1.1);
edge_list.resize(number_of_nodes);
}
template <class ContainerT> DynamicGraph(const int32_t nodes, const ContainerT &graph)
{
number_of_nodes = nodes;
number_of_edges = (EdgeIterator)graph.size();
node_list.reserve(number_of_nodes + 1);
node_list.resize(number_of_nodes + 1);
EdgeIterator edge = 0;
EdgeIterator position = 0;
for (const auto node : osrm::irange(0u, number_of_nodes))
{
EdgeIterator lastEdge = edge;
while (edge < number_of_edges && graph[edge].source == node)
{
++edge;
}
node_list[node].firstEdge = position;
node_list[node].edges = edge - lastEdge;
position += node_list[node].edges;
}
node_list.back().firstEdge = position;
edge_list.reserve((std::size_t)edge_list.size() * 1.1);
edge_list.resize(position);
edge = 0;
for (const auto node : osrm::irange(0u, number_of_nodes))
{
for (const auto i : osrm::irange(node_list[node].firstEdge,
node_list[node].firstEdge + node_list[node].edges))
{
edge_list[i].target = graph[edge].target;
edge_list[i].data = graph[edge].data;
++edge;
}
}
}
~DynamicGraph() {}
unsigned GetNumberOfNodes() const { return number_of_nodes; }
unsigned GetNumberOfEdges() const { return number_of_edges; }
unsigned GetOutDegree(const NodeIterator n) const { return node_list[n].edges; }
unsigned GetDirectedOutDegree(const NodeIterator n) const
{
unsigned degree = 0;
for (const auto edge : osrm::irange(BeginEdges(n), EndEdges(n)))
{
if (GetEdgeData(edge).forward)
{
++degree;
}
}
return degree;
}
NodeIterator GetTarget(const EdgeIterator e) const { return NodeIterator(edge_list[e].target); }
void SetTarget(const EdgeIterator e, const NodeIterator n) { edge_list[e].target = n; }
EdgeDataT &GetEdgeData(const EdgeIterator e) { return edge_list[e].data; }
const EdgeDataT &GetEdgeData(const EdgeIterator e) const { return edge_list[e].data; }
EdgeIterator BeginEdges(const NodeIterator n) const
{
return EdgeIterator(node_list[n].firstEdge);
}
EdgeIterator EndEdges(const NodeIterator n) const
{
return EdgeIterator(node_list[n].firstEdge + node_list[n].edges);
}
EdgeRange GetAdjacentEdgeRange(const NodeIterator node) const
{
return osrm::irange(BeginEdges(node), EndEdges(node));
}
NodeIterator InsertNode()
{
node_list.emplace_back(node_list.back());
number_of_nodes += 1;
return number_of_nodes;
}
// adds an edge. Invalidates edge iterators for the source node
EdgeIterator InsertEdge(const NodeIterator from, const NodeIterator to, const EdgeDataT &data)
{
Node &node = node_list[from];
EdgeIterator newFirstEdge = node.edges + node.firstEdge;
if (newFirstEdge >= edge_list.size() || !isDummy(newFirstEdge))
{
if (node.firstEdge != 0 && isDummy(node.firstEdge - 1))
{
node.firstEdge--;
edge_list[node.firstEdge] = edge_list[node.firstEdge + node.edges];
}
else
{
EdgeIterator newFirstEdge = (EdgeIterator)edge_list.size();
unsigned newSize = node.edges * 1.1 + 2;
EdgeIterator requiredCapacity = newSize + edge_list.size();
EdgeIterator oldCapacity = edge_list.capacity();
if (requiredCapacity >= oldCapacity)
{
edge_list.reserve(requiredCapacity * 1.1);
}
edge_list.resize(edge_list.size() + newSize);
for (const auto i : osrm::irange(0u, node.edges))
{
edge_list[newFirstEdge + i] = edge_list[node.firstEdge + i];
makeDummy(node.firstEdge + i);
}
for (const auto i : osrm::irange(node.edges + 1, newSize))
{
makeDummy(newFirstEdge + i);
}
node.firstEdge = newFirstEdge;
}
}
Edge &edge = edge_list[node.firstEdge + node.edges];
edge.target = to;
edge.data = data;
++number_of_edges;
++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 = node_list[source];
--number_of_edges;
--node.edges;
BOOST_ASSERT(std::numeric_limits<unsigned>::max() != node.edges);
const unsigned last = node.firstEdge + node.edges;
BOOST_ASSERT(std::numeric_limits<unsigned>::max() != last);
// swap with last edge
edge_list[e] = edge_list[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 (edge_list[i].target == target)
{
do
{
deleted++;
edge_list[i] = edge_list[iend - deleted];
makeDummy(iend - deleted);
} while (i < iend - deleted && edge_list[i].target == target);
}
}
number_of_edges -= deleted;
node_list[source].edges -= deleted;
return deleted;
}
// searches for a specific edge
EdgeIterator FindEdge(const NodeIterator from, const NodeIterator to) const
{
for (const auto i : osrm::irange(BeginEdges(from), EndEdges(from)))
{
if (to == edge_list[i].target)
{
return i;
}
}
return EndEdges(from);
}
protected:
bool isDummy(const EdgeIterator edge) const
{
return edge_list[edge].target == (std::numeric_limits<NodeIterator>::max)();
}
void makeDummy(const EdgeIterator edge)
{
edge_list[edge].target = (std::numeric_limits<NodeIterator>::max)();
}
struct Node
{
// index of the first edge
EdgeIterator firstEdge;
// amount of edges
unsigned edges;
};
struct Edge
{
NodeIterator target;
EdgeDataT data;
};
NodeIterator number_of_nodes;
std::atomic_uint number_of_edges;
std::vector<Node> node_list;
DeallocatingVector<Edge> edge_list;
};
#endif // DYNAMICGRAPH_H
+90
View File
@@ -0,0 +1,90 @@
#ifndef EDGE_BASED_NODE_H
#define EDGE_BASED_NODE_H
#include "../Util/SimpleLogger.h"
#include "../typedefs.h"
#include <osrm/Coordinate.h>
#include <boost/assert.hpp>
#include <limits>
struct EdgeBasedNode
{
EdgeBasedNode() :
forward_edge_based_node_id(SPECIAL_NODEID),
reverse_edge_based_node_id(SPECIAL_NODEID),
u(SPECIAL_NODEID),
v(SPECIAL_NODEID),
name_id(0),
forward_weight(INVALID_EDGE_WEIGHT >> 1),
reverse_weight(INVALID_EDGE_WEIGHT >> 1),
forward_offset(0),
reverse_offset(0),
packed_geometry_id(SPECIAL_EDGEID),
fwd_segment_position( std::numeric_limits<unsigned short>::max() ),
is_in_tiny_cc(false)
{ }
explicit EdgeBasedNode(
NodeID forward_edge_based_node_id,
NodeID reverse_edge_based_node_id,
NodeID u,
NodeID v,
unsigned name_id,
int forward_weight,
int reverse_weight,
int forward_offset,
int reverse_offset,
unsigned packed_geometry_id,
unsigned short fwd_segment_position,
bool belongs_to_tiny_component
) :
forward_edge_based_node_id(forward_edge_based_node_id),
reverse_edge_based_node_id(reverse_edge_based_node_id),
u(u),
v(v),
name_id(name_id),
forward_weight(forward_weight),
reverse_weight(reverse_weight),
forward_offset(forward_offset),
reverse_offset(reverse_offset),
packed_geometry_id(packed_geometry_id),
fwd_segment_position(fwd_segment_position),
is_in_tiny_cc(belongs_to_tiny_component)
{
BOOST_ASSERT((forward_edge_based_node_id != SPECIAL_NODEID) ||
(reverse_edge_based_node_id != SPECIAL_NODEID));
}
static inline FixedPointCoordinate Centroid(const FixedPointCoordinate & a, const FixedPointCoordinate & b)
{
FixedPointCoordinate centroid;
//The coordinates of the midpoint are given by:
centroid.lat = (a.lat + b.lat)/2;
centroid.lon = (a.lon + b.lon)/2;
return centroid;
}
bool IsCompressed() const
{
return packed_geometry_id != SPECIAL_EDGEID;
}
NodeID forward_edge_based_node_id; // needed for edge-expanded graph
NodeID reverse_edge_based_node_id; // needed for edge-expanded graph
NodeID u; // indices into the coordinates array
NodeID v; // indices into the coordinates array
unsigned name_id; // id of the edge name
int forward_weight; // weight of the edge
int reverse_weight; // weight in the other direction (may be different)
int forward_offset; // prefix sum of the weight up the edge TODO: short must suffice
int reverse_offset; // prefix sum of the weight from the edge TODO: short must suffice
unsigned packed_geometry_id; // if set, then the edge represents a packed geometry
unsigned short fwd_segment_position; // segment id in a compressed geometry
bool is_in_tiny_cc;
};
#endif //EDGE_BASED_NODE_H
+78
View File
@@ -0,0 +1,78 @@
/*
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 HASH_TABLE_H
#define HASH_TABLE_H
#include <vector>
template <typename Key, typename Value>
class HashTable
{
private:
typedef std::pair<Key, Value> KeyValPair;
std::vector<KeyValPair> table;
public:
HashTable() {}
inline void Add(Key const &key, Value const &value)
{
table.emplace_back(std::move(key), std::move(value));
}
inline void Clear()
{
table.clear();
}
inline const Value Find(Key const &key) const
{
for (const auto &key_val_pair : table)
{
if (key_val_pair.first == key)
{
return key_val_pair.second;
}
}
return Value();
}
inline const bool Holds(Key const &key) const
{
for (const auto &key_val_pair : table)
{
if (key_val_pair.first == key)
{
return true;
}
}
return false;
}
};
#endif /* HASH_TABLE_H */
+100
View File
@@ -0,0 +1,100 @@
/*
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 "HilbertValue.h"
#include <osrm/Coordinate.h>
uint64_t HilbertCode::operator()(const FixedPointCoordinate &current_coordinate) const
{
unsigned location[2];
location[0] = current_coordinate.lat + static_cast<int>(90 * COORDINATE_PRECISION);
location[1] = current_coordinate.lon + static_cast<int>(180 * COORDINATE_PRECISION);
TransposeCoordinate(location);
return BitInterleaving(location[0], location[1]);
}
uint64_t HilbertCode::BitInterleaving(const uint32_t latitude, const uint32_t longitude) const
{
uint64_t result = 0;
for (int8_t index = 31; index >= 0; --index)
{
result |= (latitude >> index) & 1;
result <<= 1;
result |= (longitude >> index) & 1;
if (0 != index)
{
result <<= 1;
}
}
return result;
}
void HilbertCode::TransposeCoordinate(uint32_t *X) const
{
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)
{
const bool condition = (X[i] & Q);
if (condition)
{
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)
{
const bool condition = (X[2 - 1] & Q);
if (condition)
{
t ^= Q - 1;
}
} // check if this for loop is wrong
for (i = 0; i < 2; ++i)
{
X[i] ^= t;
}
}
+49
View File
@@ -0,0 +1,49 @@
/*
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 <cstdint>
// computes a 64 bit value that corresponds to the hilbert space filling curve
struct FixedPointCoordinate;
class HilbertCode
{
public:
uint64_t operator()(const FixedPointCoordinate &current_coordinate) const;
HilbertCode() {}
HilbertCode(const HilbertCode &) = delete;
private:
inline uint64_t BitInterleaving(const uint32_t a, const uint32_t b) const;
inline void TransposeCoordinate(uint32_t *X) const;
};
#endif /* HILBERTVALUE_H_ */
+107
View File
@@ -0,0 +1,107 @@
/*
Copyright (c) 2014, 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 "ImportEdge.h"
#include <boost/assert.hpp>
bool NodeBasedEdge::operator<(const NodeBasedEdge &other) const
{
if (source == other.source)
{
if (target == other.target)
{
if (weight == other.weight)
{
return forward && backward && ((!other.forward) || (!other.backward));
}
return weight < other.weight;
}
return target < other.target;
}
return source < other.source;
}
NodeBasedEdge::NodeBasedEdge(NodeID source,
NodeID target,
NodeID name_id,
EdgeWeight weight,
bool forward,
bool backward,
short type,
bool roundabout,
bool in_tiny_cc,
bool access_restricted,
bool contra_flow,
bool is_split)
: source(source), target(target), name_id(name_id), weight(weight), type(type),
forward(forward), backward(backward), roundabout(roundabout), in_tiny_cc(in_tiny_cc),
access_restricted(access_restricted), contra_flow(contra_flow), is_split(is_split)
{
BOOST_ASSERT_MSG(type > 0, "negative edge type");
}
bool EdgeBasedEdge::operator<(const EdgeBasedEdge &other) const
{
if (source == other.source)
{
if (target == other.target)
{
if (weight == other.weight)
{
return forward && backward && ((!other.forward) || (!other.backward));
}
return weight < other.weight;
}
return target < other.target;
}
return source < other.source;
}
template <class EdgeT>
EdgeBasedEdge::EdgeBasedEdge(const EdgeT &other)
: source(other.source), target(other.target), edge_id(other.data.via),
weight(other.data.distance), forward(other.data.forward), backward(other.data.backward)
{
}
/** Default constructor. target and weight are set to 0.*/
EdgeBasedEdge::EdgeBasedEdge()
: source(0), target(0), edge_id(0), weight(0), forward(false), backward(false)
{
}
EdgeBasedEdge::EdgeBasedEdge(const NodeID source,
const NodeID target,
const NodeID edge_id,
const EdgeWeight weight,
const bool forward,
const bool backward)
: source(source), target(target), edge_id(edge_id), weight(weight), forward(forward),
backward(backward)
{
}
+92
View File
@@ -0,0 +1,92 @@
/*
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 "../typedefs.h"
struct NodeBasedEdge
{
bool operator<(const NodeBasedEdge &e) const;
explicit NodeBasedEdge(NodeID source,
NodeID target,
NodeID name_id,
EdgeWeight weight,
bool forward,
bool backward,
short type,
bool roundabout,
bool in_tiny_cc,
bool access_restricted,
bool contra_flow,
bool is_split);
NodeID source;
NodeID target;
NodeID name_id;
EdgeWeight weight;
short type;
bool forward : 1;
bool backward : 1;
bool roundabout : 1;
bool in_tiny_cc : 1;
bool access_restricted : 1;
bool contra_flow : 1;
bool is_split : 1;
NodeBasedEdge() = delete;
};
struct EdgeBasedEdge
{
public:
bool operator<(const EdgeBasedEdge &e) const;
template <class EdgeT> explicit EdgeBasedEdge(const EdgeT &myEdge);
EdgeBasedEdge();
explicit EdgeBasedEdge(const NodeID source,
const NodeID target,
const NodeID edge_id,
const EdgeWeight weight,
const bool forward,
const bool backward);
NodeID source;
NodeID target;
NodeID edge_id;
EdgeWeight weight : 30;
bool forward : 1;
bool backward : 1;
};
typedef NodeBasedEdge ImportEdge;
#endif /* IMPORT_EDGE_H */
+64
View File
@@ -0,0 +1,64 @@
/*
Copyright (c) 2014, 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 "ImportNode.h"
#include <limits>
ExternalMemoryNode::ExternalMemoryNode(
int lat, int lon, unsigned int node_id, bool bollard, bool traffic_light)
: NodeInfo(lat, lon, node_id), bollard(bollard), trafficLight(traffic_light)
{
}
ExternalMemoryNode::ExternalMemoryNode() : bollard(false), trafficLight(false)
{
}
ExternalMemoryNode ExternalMemoryNode::min_value()
{
return ExternalMemoryNode(0, 0, 0, false, false);
}
ExternalMemoryNode ExternalMemoryNode::max_value()
{
return ExternalMemoryNode(std::numeric_limits<int>::max(),
std::numeric_limits<int>::max(),
std::numeric_limits<unsigned>::max(),
false,
false);
}
void ImportNode::Clear()
{
keyVals.Clear();
lat = 0;
lon = 0;
node_id = 0;
bollard = false;
trafficLight = false;
}
+57
View File
@@ -0,0 +1,57 @@
/*
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"
#include <string>
struct ExternalMemoryNode : NodeInfo
{
ExternalMemoryNode(int lat, int lon, unsigned int id, bool bollard, bool traffic_light);
ExternalMemoryNode();
static ExternalMemoryNode min_value();
static ExternalMemoryNode max_value();
bool bollard;
bool trafficLight;
};
struct ImportNode : public ExternalMemoryNode
{
HashTable<std::string, std::string> keyVals;
inline void Clear();
};
#endif /* IMPORTNODE_H_ */
+123
View File
@@ -0,0 +1,123 @@
/*
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 INPUT_READER_FACTORY_H
#define INPUT_READER_FACTORY_H
#include <boost/assert.hpp>
#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 = nullptr;
char *unusedTmp = nullptr;
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);
BOOST_ASSERT_MSG(BZ_OK == context->error, "Could not BZ2_bzReadGetUnused");
unusedTmp = (char *)unusedTmpVoid;
for (int i = 0; i < context->nUnused; i++)
{
context->unused[i] = unusedTmp[i];
}
BZ2_bzReadClose(&context->error, context->bz2);
BOOST_ASSERT_MSG(BZ_OK == context->error, "Could not BZ2_bzReadClose");
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);
BOOST_ASSERT_MSG(nullptr != context->bz2, "Could not open file");
}
}
else
{
BOOST_ASSERT_MSG(false, "Could not read bz2 file");
}
}
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 == nullptr || context->file == nullptr)
{
delete context;
return nullptr;
}
return xmlReaderForIO(readFromBz2Stream, closeBz2Stream, (void *)context, nullptr, nullptr, 0);
}
else
{
return xmlNewTextReaderFilename(name);
}
}
#endif // INPUT_READER_FACTORY_H
+237
View File
@@ -0,0 +1,237 @@
/*
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.
*/
// based on https://svn.apache.org/repos/asf/mesos/tags/release-0.9.0-incubating-RC0/src/common/json.hpp
#ifndef JSON_CONTAINER_H
#define JSON_CONTAINER_H
#include "../Util/StringUtil.h"
#include <boost/variant.hpp>
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
namespace JSON
{
struct String;
struct Number;
struct Object;
struct Array;
struct True;
struct False;
struct Null;
typedef boost::variant<boost::recursive_wrapper<String>,
boost::recursive_wrapper<Number>,
boost::recursive_wrapper<Object>,
boost::recursive_wrapper<Array>,
boost::recursive_wrapper<True>,
boost::recursive_wrapper<False>,
boost::recursive_wrapper<Null> > Value;
struct String
{
String() {}
String(const char *value) : value(value) {}
String(const std::string &value) : value(value) {}
std::string value;
};
struct Number
{
Number() {}
Number(double value) : value(value) {}
double value;
};
struct Object
{
std::unordered_map<std::string, Value> values;
};
struct Array
{
std::vector<Value> values;
};
struct True
{
};
struct False
{
};
struct Null
{
};
struct Renderer : boost::static_visitor<>
{
Renderer(std::ostream &_out) : out(_out) {}
void operator()(const String &string) const { out << "\"" << string.value << "\""; }
void operator()(const Number &number) const
{
out.precision(10);
out << number.value;
}
void operator()(const Object &object) const
{
out << "{";
auto iterator = object.values.begin();
while (iterator != object.values.end())
{
out << "\"" << (*iterator).first << "\":";
boost::apply_visitor(Renderer(out), (*iterator).second);
if (++iterator != object.values.end())
{
out << ",";
}
}
out << "}";
}
void operator()(const Array &array) const
{
out << "[";
std::vector<Value>::const_iterator iterator;
iterator = array.values.begin();
while (iterator != array.values.end())
{
boost::apply_visitor(Renderer(out), *iterator);
if (++iterator != array.values.end())
{
out << ",";
}
}
out << "]";
}
void operator()(const True &) const { out << "true"; }
void operator()(const False &) const { out << "false"; }
void operator()(const Null &) const { out << "null"; }
private:
std::ostream &out;
};
struct ArrayRenderer : boost::static_visitor<>
{
ArrayRenderer(std::vector<char> &_out) : out(_out) {}
void operator()(const String &string) const {
out.push_back('\"');
out.insert(out.end(), string.value.begin(), string.value.end());
out.push_back('\"');
}
void operator()(const Number &number) const
{
const std::string number_string = FixedDoubleToString(number.value);
out.insert(out.end(), number_string.begin(), number_string.end());
}
void operator()(const Object &object) const
{
out.push_back('{');
auto iterator = object.values.begin();
while (iterator != object.values.end())
{
out.push_back('\"');
out.insert(out.end(), (*iterator).first.begin(), (*iterator).first.end());
out.push_back('\"');
out.push_back(':');
boost::apply_visitor(ArrayRenderer(out), (*iterator).second);
if (++iterator != object.values.end())
{
out.push_back(',');
}
}
out.push_back('}');
}
void operator()(const Array &array) const
{
out.push_back('[');
std::vector<Value>::const_iterator iterator;
iterator = array.values.begin();
while (iterator != array.values.end())
{
boost::apply_visitor(ArrayRenderer(out), *iterator);
if (++iterator != array.values.end())
{
out.push_back(',');
}
}
out.push_back(']');
}
void operator()(const True &) const {
const std::string temp("true");
out.insert(out.end(), temp.begin(), temp.end());
}
void operator()(const False &) const {
const std::string temp("false");
out.insert(out.end(), temp.begin(), temp.end());
}
void operator()(const Null &) const {
const std::string temp("null");
out.insert(out.end(), temp.begin(), temp.end());
}
private:
std::vector<char> &out;
};
inline void render(std::ostream &out, const Object &object)
{
Value value = object;
boost::apply_visitor(Renderer(out), value);
}
inline void render(std::vector<char> &out, const Object &object)
{
Value value = object;
boost::apply_visitor(ArrayRenderer(out), value);
}
} // namespace JSON
#endif // JSON_CONTAINER_H
+97
View File
@@ -0,0 +1,97 @@
/*
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 <unordered_map>
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;
std::unordered_map<KeyT, typename std::list<CacheEntry>::iterator> positionMap;
public:
explicit 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
+245
View File
@@ -0,0 +1,245 @@
#ifndef __NODE_BASED_GRAPH_H__
#define __NODE_BASED_GRAPH_H__
#include "DynamicGraph.h"
#include "ImportEdge.h"
#include "../Util/SimpleLogger.h"
#include <tbb/parallel_sort.h>
#include <memory>
struct NodeBasedEdgeData
{
NodeBasedEdgeData()
: distance(INVALID_EDGE_WEIGHT), edgeBasedNodeID(SPECIAL_NODEID),
nameID(std::numeric_limits<unsigned>::max()), type(std::numeric_limits<short>::max()),
isAccessRestricted(false), shortcut(false), forward(false), backward(false),
roundabout(false), ignore_in_grid(false), contraFlow(false)
{
}
int distance;
unsigned edgeBasedNodeID;
unsigned nameID;
short type;
bool isAccessRestricted : 1;
bool shortcut : 1;
bool forward : 1;
bool backward : 1;
bool roundabout : 1;
bool ignore_in_grid : 1;
bool contraFlow : 1;
void SwapDirectionFlags()
{
bool temp_flag = forward;
forward = backward;
backward = temp_flag;
}
bool IsEqualTo(const NodeBasedEdgeData &other) const
{
return (forward == other.forward) && (backward == other.backward) &&
(nameID == other.nameID) && (ignore_in_grid == other.ignore_in_grid) &&
(contraFlow == other.contraFlow);
}
};
struct SimpleEdgeData
{
SimpleEdgeData() : capacity(0) {}
EdgeWeight capacity;
};
typedef DynamicGraph<NodeBasedEdgeData> NodeBasedDynamicGraph;
typedef DynamicGraph<SimpleEdgeData> SimpleNodeBasedDynamicGraph;
// Factory method to create NodeBasedDynamicGraph from ImportEdges
inline std::shared_ptr<NodeBasedDynamicGraph>
NodeBasedDynamicGraphFromImportEdges(int number_of_nodes, std::vector<ImportEdge> &input_edge_list)
{
static_assert(sizeof(NodeBasedEdgeData) == 16, "changing node based edge data size changes memory consumption");
DeallocatingVector<NodeBasedDynamicGraph::InputEdge> edges_list;
NodeBasedDynamicGraph::InputEdge edge;
for (const ImportEdge &import_edge : input_edge_list)
{
if (import_edge.forward)
{
edge.source = import_edge.source;
edge.target = import_edge.target;
edge.data.forward = import_edge.forward;
edge.data.backward = import_edge.backward;
}
else
{
edge.source = import_edge.target;
edge.target = import_edge.source;
edge.data.backward = import_edge.forward;
edge.data.forward = import_edge.backward;
}
if (edge.source == edge.target)
{
continue;
}
edge.data.distance = (std::max)((int)import_edge.weight, 1);
BOOST_ASSERT(edge.data.distance > 0);
edge.data.shortcut = false;
edge.data.roundabout = import_edge.roundabout;
edge.data.ignore_in_grid = import_edge.in_tiny_cc;
edge.data.nameID = import_edge.name_id;
edge.data.type = import_edge.type;
edge.data.isAccessRestricted = import_edge.access_restricted;
edge.data.contraFlow = import_edge.contra_flow;
edges_list.push_back(edge);
if (!import_edge.is_split)
{
using std::swap; // enable ADL
swap(edge.source, edge.target);
edge.data.SwapDirectionFlags();
edges_list.push_back(edge);
}
}
// remove duplicate edges
tbb::parallel_sort(edges_list.begin(), edges_list.end());
NodeID edge_count = 0;
for (NodeID i = 0; i < edges_list.size(); )
{
const NodeID source = edges_list[i].source;
const NodeID target = edges_list[i].target;
// remove eigenloops
if (source == target)
{
i++;
continue;
}
NodeBasedDynamicGraph::InputEdge forward_edge;
NodeBasedDynamicGraph::InputEdge reverse_edge;
forward_edge = reverse_edge = edges_list[i];
forward_edge.data.forward = reverse_edge.data.backward = true;
forward_edge.data.backward = reverse_edge.data.forward = false;
forward_edge.data.shortcut = reverse_edge.data.shortcut = false;
forward_edge.data.distance = reverse_edge.data.distance =
std::numeric_limits<int>::max();
// remove parallel edges
while (i < edges_list.size() && edges_list[i].source == source && edges_list[i].target == target)
{
if (edges_list[i].data.forward)
{
forward_edge.data.distance =
std::min(edges_list[i].data.distance, forward_edge.data.distance);
}
if (edges_list[i].data.backward)
{
reverse_edge.data.distance =
std::min(edges_list[i].data.distance, reverse_edge.data.distance);
}
++i;
}
// merge edges (s,t) and (t,s) into bidirectional edge
if (forward_edge.data.distance == reverse_edge.data.distance)
{
if ((int)forward_edge.data.distance != std::numeric_limits<int>::max())
{
forward_edge.data.backward = true;
edges_list[edge_count++] = forward_edge;
}
}
else
{ // insert seperate edges
if (((int)forward_edge.data.distance) != std::numeric_limits<int>::max())
{
edges_list[edge_count++] = forward_edge;
}
if ((int)reverse_edge.data.distance != std::numeric_limits<int>::max())
{
edges_list[edge_count++] = reverse_edge;
}
}
}
edges_list.resize(edge_count);
SimpleLogger().Write() << "merged " << edges_list.size() - edge_count << " edges out of " << edges_list.size();
auto graph = std::make_shared<NodeBasedDynamicGraph>(number_of_nodes, edges_list);
return graph;
}
template<class SimpleEdgeT>
inline std::shared_ptr<SimpleNodeBasedDynamicGraph>
SimpleNodeBasedDynamicGraphFromEdges(int number_of_nodes, std::vector<SimpleEdgeT> &input_edge_list)
{
static_assert(sizeof(NodeBasedEdgeData) == 16, "changing node based edge data size changes memory consumption");
tbb::parallel_sort(input_edge_list.begin(), input_edge_list.end());
DeallocatingVector<SimpleNodeBasedDynamicGraph::InputEdge> edges_list;
SimpleNodeBasedDynamicGraph::InputEdge edge;
edge.data.capacity = 1;
for (const SimpleEdgeT &import_edge : input_edge_list)
{
if (import_edge.source == import_edge.target)
{
continue;
}
edge.source = import_edge.source;
edge.target = import_edge.target;
edges_list.push_back(edge);
std::swap(edge.source, edge.target);
edges_list.push_back(edge);
}
// remove duplicate edges
tbb::parallel_sort(edges_list.begin(), edges_list.end());
NodeID edge_count = 0;
for (NodeID i = 0; i < edges_list.size(); )
{
const NodeID source = edges_list[i].source;
const NodeID target = edges_list[i].target;
// remove eigenloops
if (source == target)
{
i++;
continue;
}
SimpleNodeBasedDynamicGraph::InputEdge forward_edge;
SimpleNodeBasedDynamicGraph::InputEdge reverse_edge;
forward_edge = reverse_edge = edges_list[i];
forward_edge.data.capacity = reverse_edge.data.capacity = INVALID_EDGE_WEIGHT;
// remove parallel edges
while (i < edges_list.size() && edges_list[i].source == source && edges_list[i].target == target)
{
forward_edge.data.capacity = std::min(edges_list[i].data.capacity, forward_edge.data.capacity);
reverse_edge.data.capacity = std::min(edges_list[i].data.capacity, reverse_edge.data.capacity);
++i;
}
// merge edges (s,t) and (t,s) into bidirectional edge
if (forward_edge.data.capacity == reverse_edge.data.capacity)
{
if ((int)forward_edge.data.capacity != INVALID_EDGE_WEIGHT)
{
edges_list[edge_count++] = forward_edge;
}
}
else
{ // insert seperate edges
if (((int)forward_edge.data.capacity) != INVALID_EDGE_WEIGHT)
{
edges_list[edge_count++] = forward_edge;
}
if ((int)reverse_edge.data.capacity != INVALID_EDGE_WEIGHT)
{
edges_list[edge_count++] = reverse_edge;
}
}
}
SimpleLogger().Write() << "merged " << edges_list.size() - edge_count << " edges out of " << edges_list.size();
auto graph = std::make_shared<SimpleNodeBasedDynamicGraph>(number_of_nodes, edges_list);
return graph;
}
#endif // __NODE_BASED_GRAPH_H__
+60
View File
@@ -0,0 +1,60 @@
/*
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 ORIGINAL_EDGE_DATA_H
#define ORIGINAL_EDGE_DATA_H
#include "TurnInstructions.h"
#include "../typedefs.h"
#include <limits>
struct OriginalEdgeData
{
explicit OriginalEdgeData(NodeID via_node,
unsigned name_id,
TurnInstruction turn_instruction,
bool compressed_geometry)
: via_node(via_node), name_id(name_id), turn_instruction(turn_instruction),
compressed_geometry(compressed_geometry)
{
}
OriginalEdgeData()
: via_node(std::numeric_limits<unsigned>::max()),
name_id(std::numeric_limits<unsigned>::max()),
turn_instruction(TurnInstruction::NoTurn), compressed_geometry(false)
{
}
NodeID via_node;
unsigned name_id;
TurnInstruction turn_instruction;
bool compressed_geometry;
};
#endif // ORIGINAL_EDGE_DATA_H
+101
View File
@@ -0,0 +1,101 @@
/*
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 <iostream>
#include <atomic>
class Percent
{
public:
explicit Percent(unsigned max_value, unsigned step = 5) { reinit(max_value, step); }
// Reinitializes
void reinit(unsigned max_value, unsigned step = 5)
{
m_max_value = max_value;
m_current_value = 0;
m_percent_interval = m_max_value / 100;
m_next_threshold = m_percent_interval;
m_last_percent = 0;
m_step = step;
}
// If there has been significant progress, display it.
void printStatus(unsigned current_value)
{
if (current_value >= m_next_threshold)
{
m_next_threshold += m_percent_interval;
printPercent(current_value / (double)m_max_value * 100);
}
if (current_value + 1 == m_max_value)
std::cout << " 100%" << std::endl;
}
void printIncrement()
{
++m_current_value;
printStatus(m_current_value);
}
void printAddition(const unsigned addition)
{
m_current_value += addition;
printStatus(m_current_value);
}
private:
std::atomic_uint m_current_value;
unsigned m_max_value;
unsigned m_percent_interval;
unsigned m_next_threshold;
unsigned m_last_percent;
unsigned m_step;
// Displays progress.
void printPercent(double percent)
{
while (percent >= m_last_percent + m_step)
{
m_last_percent += m_step;
if (m_last_percent % 10 == 0)
{
std::cout << " " << m_last_percent << "% ";
}
else
{
std::cout << ".";
}
std::cout.flush();
}
}
};
#endif // PERCENT_H
+173
View File
@@ -0,0 +1,173 @@
/*
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 PHANTOM_NODES_H
#define PHANTOM_NODES_H
#include <osrm/Coordinate.h>
#include "../Util/SimpleLogger.h"
#include "../typedefs.h"
#include <vector>
struct PhantomNode
{
PhantomNode(NodeID forward_node_id, NodeID reverse_node_id, unsigned name_id,
int forward_weight, int reverse_weight, int forward_offset, int reverse_offset,
unsigned packed_geometry_id, FixedPointCoordinate &location,
unsigned short fwd_segment_position) :
forward_node_id(forward_node_id),
reverse_node_id(reverse_node_id),
name_id(name_id),
forward_weight(forward_weight),
reverse_weight(reverse_weight),
forward_offset(forward_offset),
reverse_offset(reverse_offset),
packed_geometry_id(packed_geometry_id),
location(location),
fwd_segment_position(fwd_segment_position)
{ }
PhantomNode() :
forward_node_id(SPECIAL_NODEID),
reverse_node_id(SPECIAL_NODEID),
name_id(std::numeric_limits<unsigned>::max()),
forward_weight(INVALID_EDGE_WEIGHT),
reverse_weight(INVALID_EDGE_WEIGHT),
forward_offset(0),
reverse_offset(0),
packed_geometry_id(SPECIAL_EDGEID),
fwd_segment_position(0)
{ }
NodeID forward_node_id;
NodeID reverse_node_id;
unsigned name_id;
int forward_weight;
int reverse_weight;
int forward_offset;
int reverse_offset;
unsigned packed_geometry_id;
FixedPointCoordinate location;
unsigned short fwd_segment_position;
int GetForwardWeightPlusOffset() const
{
if (SPECIAL_NODEID == forward_node_id)
{
return 0;
}
const int result = (forward_offset + forward_weight);
return result;
}
int GetReverseWeightPlusOffset() const
{
if (SPECIAL_NODEID == reverse_node_id)
{
return 0;
}
const int result = (reverse_offset + reverse_weight);
return result;
}
bool isBidirected() const
{
return (forward_node_id != SPECIAL_NODEID) &&
(reverse_node_id != SPECIAL_NODEID);
}
bool IsCompressed() const
{
return (forward_offset != 0) || (reverse_offset != 0);
}
bool isValid(const unsigned numberOfNodes) const
{
return
location.isValid() &&
(
(forward_node_id < numberOfNodes) ||
(reverse_node_id < numberOfNodes)
) &&
(
(forward_weight != INVALID_EDGE_WEIGHT) ||
(reverse_weight != INVALID_EDGE_WEIGHT)
) &&
(name_id != std::numeric_limits<unsigned>::max()
);
}
bool isValid() const
{
return location.isValid() &&
(name_id != std::numeric_limits<unsigned>::max());
}
bool operator==(const PhantomNode & other) const
{
return location == other.location;
}
};
typedef std::vector<std::vector<PhantomNode>> PhantomNodeArray;
struct PhantomNodeLists
{
std::vector<PhantomNode> source_phantom_list;
std::vector<PhantomNode> target_phantom_list;
};
struct PhantomNodes
{
PhantomNode source_phantom;
PhantomNode target_phantom;
};
inline std::ostream& operator<<(std::ostream &out, const PhantomNodes & pn)
{
out << "source_coord: " << pn.source_phantom.location << "\n";
out << "target_coord: " << pn.target_phantom.location << std::endl;
return out;
}
inline std::ostream& operator<<(std::ostream &out, const PhantomNode & pn)
{
out << "node1: " << pn.forward_node_id << ", " <<
"node2: " << pn.reverse_node_id << ", " <<
"name: " << pn.name_id << ", " <<
"fwd-w: " << pn.forward_weight << ", " <<
"rev-w: " << pn.reverse_weight << ", " <<
"fwd-o: " << pn.forward_offset << ", " <<
"rev-o: " << pn.reverse_offset << ", " <<
"geom: " << pn.packed_geometry_id << ", " <<
"pos: " << pn.fwd_segment_position << ", " <<
"loc: " << pn.location;
return out;
}
#endif // PHANTOM_NODES_H
+81
View File
@@ -0,0 +1,81 @@
/*
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 "../typedefs.h"
struct QueryEdge
{
NodeID source;
NodeID target;
struct EdgeData
{
EdgeData() : id(0), shortcut(false), distance(0), forward(false), backward(false) {}
template <class OtherT> EdgeData(const OtherT &other)
{
distance = other.distance;
shortcut = other.shortcut;
id = other.id;
forward = other.forward;
backward = other.backward;
}
NodeID id : 31;
bool shortcut : 1;
int distance : 30;
bool forward : 1;
bool backward : 1;
} data;
QueryEdge() : source(SPECIAL_NODEID), target(SPECIAL_NODEID) {}
QueryEdge(NodeID source, NodeID target, EdgeData data)
: source(source), target(target), data(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
@@ -0,0 +1,85 @@
/*
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_NODE_H
#define QUERY_NODE_H
#include "../typedefs.h"
#include <osrm/Coordinate.h>
#include <boost/assert.hpp>
#include <limits>
struct NodeInfo
{
typedef NodeID key_type; // type of NodeID
typedef int value_type; // type of lat,lons
explicit NodeInfo(int lat, int lon, NodeID node_id) : lat(lat), lon(lon), node_id(node_id) {}
NodeInfo()
: lat(std::numeric_limits<int>::max()), lon(std::numeric_limits<int>::max()),
node_id(std::numeric_limits<unsigned>::max())
{
}
int lat;
int lon;
NodeID node_id;
static NodeInfo min_value()
{
return NodeInfo(static_cast<int>(-90 * COORDINATE_PRECISION),
static_cast<int>(-180 * COORDINATE_PRECISION),
std::numeric_limits<NodeID>::min());
}
static NodeInfo max_value()
{
return NodeInfo(static_cast<int>(90 * COORDINATE_PRECISION),
static_cast<int>(180 * COORDINATE_PRECISION),
std::numeric_limits<NodeID>::max());
}
value_type operator[](const std::size_t n) const
{
switch (n)
{
case 1:
return lat;
case 0:
return lon;
default:
break;
}
BOOST_ASSERT_MSG(false, "should not happen");
return std::numeric_limits<unsigned>::max();
}
};
#endif // QUERY_NODE_H
+67
View File
@@ -0,0 +1,67 @@
/*
Copyright (c) 2013,2014, 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 RANGE_H
#define RANGE_H
#include <type_traits>
namespace osrm
{
template <typename Integer> class range
{
private:
Integer last;
Integer iter;
public:
range(Integer start, Integer end) : last(end), iter(start)
{
static_assert(std::is_integral<Integer>::value, "range type must be integral");
}
// Iterable functions
const range &begin() const { return *this; }
const range &end() const { return *this; }
Integer front() const { return iter; }
Integer back() const { return last - 1; }
// Iterator functions
bool operator!=(const range &) const { return iter < last; }
void operator++() { ++iter; }
Integer operator*() const { return iter; }
};
// convenience function to construct an integer range with type deduction
template <typename Integer> range<Integer> irange(Integer first, Integer last)
{
return range<Integer>(first, last);
}
}
#endif // RANGE_H
+231
View File
@@ -0,0 +1,231 @@
#ifndef __RANGE_TABLE_H__
#define __RANGE_TABLE_H__
#include "Range.h"
#include "SharedMemoryFactory.h"
#include "SharedMemoryVectorWrapper.h"
#include <fstream>
#include <vector>
#include <array>
/*
* These pre-declarations are needed because parsing C++ is hard
* and otherwise the compiler gets confused.
*/
template<unsigned BLOCK_SIZE=16, bool USE_SHARED_MEMORY = false> class RangeTable;
template<unsigned BLOCK_SIZE, bool USE_SHARED_MEMORY>
std::ostream& operator<<(std::ostream &out, const RangeTable<BLOCK_SIZE, USE_SHARED_MEMORY> &table);
template<unsigned BLOCK_SIZE, bool USE_SHARED_MEMORY>
std::istream& operator>>(std::istream &in, RangeTable<BLOCK_SIZE, USE_SHARED_MEMORY> &table);
/**
* Stores adjacent ranges in a compressed format.
*
* Maximum supported length of a range is 255.
*
* Note: BLOCK_SIZE is the number of differential encodoed values.
* But each block consists of an absolute value and BLOCK_SIZE differential values.
* So the effective block size is sizeof(unsigned) + BLOCK_SIZE.
*/
template<unsigned BLOCK_SIZE, bool USE_SHARED_MEMORY>
class RangeTable
{
public:
typedef std::array<unsigned char, BLOCK_SIZE> BlockT;
typedef typename ShM<BlockT, USE_SHARED_MEMORY>::vector BlockContainerT;
typedef typename ShM<unsigned, USE_SHARED_MEMORY>::vector OffsetContainerT;
typedef osrm::range<unsigned> RangeT;
friend std::ostream& operator<< <>(std::ostream &out, const RangeTable &table);
friend std::istream& operator>> <>(std::istream &in, RangeTable &table);
RangeTable() : sum_lengths(0) {}
// for loading from shared memory
explicit RangeTable(OffsetContainerT& external_offsets, BlockContainerT& external_blocks, const unsigned sum_lengths)
: sum_lengths(sum_lengths)
{
block_offsets.swap(external_offsets);
diff_blocks.swap(external_blocks);
}
// construct table from length vector
explicit RangeTable(const std::vector<unsigned>& lengths)
{
const unsigned number_of_blocks = [&lengths]() {
unsigned num = (lengths.size() + 1) / (BLOCK_SIZE + 1);
if ((lengths.size() + 1) % (BLOCK_SIZE + 1) != 0)
{
num += 1;
}
return num;
}();
block_offsets.reserve(number_of_blocks);
diff_blocks.reserve(number_of_blocks);
unsigned last_length = 0;
unsigned lengths_prefix_sum = 0;
unsigned block_idx = 0;
unsigned block_counter = 0;
BlockT block;
unsigned block_sum = 0;
for (const unsigned l : lengths)
{
// first entry of a block: encode absolute offset
if (block_idx == 0)
{
block_offsets.push_back(lengths_prefix_sum);
block_sum = 0;
}
else
{
block[block_idx - 1] = last_length;
block_sum += last_length;
}
BOOST_ASSERT((block_idx == 0 && block_offsets[block_counter] == lengths_prefix_sum)
|| lengths_prefix_sum == (block_offsets[block_counter]+block_sum));
// block is full
if (BLOCK_SIZE == block_idx)
{
diff_blocks.push_back(block);
block_counter++;
}
// we can only store strings with length 255
BOOST_ASSERT(l <= 255);
lengths_prefix_sum += l;
last_length = l;
block_idx = (block_idx + 1) % (BLOCK_SIZE + 1);
}
// Last block can't be finished because we didn't add the sentinel
BOOST_ASSERT (block_counter == (number_of_blocks - 1));
// one block missing: starts with guard value
if (0 == block_idx)
{
// the last value is used as sentinel
block_offsets.push_back(lengths_prefix_sum);
block_idx = 1;
last_length = 0;
}
while (0 != block_idx)
{
block[block_idx - 1] = last_length;
last_length = 0;
block_idx = (block_idx + 1) % (BLOCK_SIZE + 1);
}
diff_blocks.push_back(block);
BOOST_ASSERT(diff_blocks.size() == number_of_blocks && block_offsets.size() == number_of_blocks);
sum_lengths = lengths_prefix_sum;
}
inline RangeT GetRange(const unsigned id) const
{
BOOST_ASSERT(id < block_offsets.size() + diff_blocks.size() * BLOCK_SIZE);
// internal_idx 0 is implicitly stored in block_offsets[block_idx]
const unsigned internal_idx = id % (BLOCK_SIZE + 1);
const unsigned block_idx = id / (BLOCK_SIZE + 1);
BOOST_ASSERT(block_idx < diff_blocks.size());
unsigned begin_idx = 0;
unsigned end_idx = 0;
begin_idx = block_offsets[block_idx];
const BlockT& block = diff_blocks[block_idx];
if (internal_idx > 0)
{
begin_idx += PrefixSumAtIndex(internal_idx - 1, block);
}
// next index inside current block
if (internal_idx < BLOCK_SIZE)
{
// note internal_idx - 1 is the *current* index for uint8_blocks
end_idx = begin_idx + block[internal_idx];
}
else
{
BOOST_ASSERT(block_idx < block_offsets.size() - 1);
end_idx = block_offsets[block_idx + 1];
}
BOOST_ASSERT(begin_idx < sum_lengths && end_idx <= sum_lengths);
BOOST_ASSERT(begin_idx <= end_idx);
return osrm::irange(begin_idx, end_idx);
}
private:
inline unsigned PrefixSumAtIndex(int index, const BlockT& block) const;
// contains offset for each differential block
OffsetContainerT block_offsets;
// blocks of differential encoded offsets, should be aligned
BlockContainerT diff_blocks;
unsigned sum_lengths;
};
template<unsigned BLOCK_SIZE, bool USE_SHARED_MEMORY>
unsigned RangeTable<BLOCK_SIZE, USE_SHARED_MEMORY>::PrefixSumAtIndex(int index, const BlockT& block) const
{
// this loop looks inefficent, but a modern compiler
// will emit nice SIMD here, at least for sensible block sizes. (I checked.)
unsigned sum = 0;
for (int i = 0; i <= index; ++i)
{
sum += block[i];
}
return sum;
}
template<unsigned BLOCK_SIZE, bool USE_SHARED_MEMORY>
std::ostream& operator<<(std::ostream &out, const RangeTable<BLOCK_SIZE, USE_SHARED_MEMORY> &table)
{
// write number of block
const unsigned number_of_blocks = table.diff_blocks.size();
out.write((char *) &number_of_blocks, sizeof(unsigned));
// write total length
out.write((char *) &table.sum_lengths, sizeof(unsigned));
// write block offsets
out.write((char *) table.block_offsets.data(), sizeof(unsigned) * table.block_offsets.size());
// write blocks
out.write((char *) table.diff_blocks.data(), BLOCK_SIZE * table.diff_blocks.size());
return out;
}
template<unsigned BLOCK_SIZE, bool USE_SHARED_MEMORY>
std::istream& operator>>(std::istream &in, RangeTable<BLOCK_SIZE, USE_SHARED_MEMORY> &table)
{
// read number of block
unsigned number_of_blocks;
in.read((char *) &number_of_blocks, sizeof(unsigned));
// read total length
in.read((char *) &table.sum_lengths, sizeof(unsigned));
table.block_offsets.resize(number_of_blocks);
table.diff_blocks.resize(number_of_blocks);
// read block offsets
in.read((char *) table.block_offsets.data(), sizeof(unsigned) * number_of_blocks);
// read blocks
in.read((char *) table.diff_blocks.data(), BLOCK_SIZE * number_of_blocks);
return in;
}
#endif
+85
View File
@@ -0,0 +1,85 @@
/*
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 RAW_ROUTE_DATA_H
#define RAW_ROUTE_DATA_H
#include "../DataStructures/PhantomNodes.h"
#include "../DataStructures/TurnInstructions.h"
#include "../typedefs.h"
#include <osrm/Coordinate.h>
#include <vector>
struct PathData
{
PathData()
: node(SPECIAL_NODEID), name_id(INVALID_EDGE_WEIGHT),
segment_duration(INVALID_EDGE_WEIGHT),
turn_instruction(TurnInstruction::NoTurn)
{
}
PathData(NodeID node, unsigned name_id, TurnInstruction turn_instruction, EdgeWeight segment_duration)
: node(node), name_id(name_id), segment_duration(segment_duration), turn_instruction(turn_instruction)
{
}
NodeID node;
unsigned name_id;
EdgeWeight segment_duration;
TurnInstruction turn_instruction;
};
struct RawRouteData
{
std::vector<std::vector<PathData>> unpacked_path_segments;
std::vector<PathData> unpacked_alternative;
std::vector<PhantomNodes> segment_end_coordinates;
std::vector<FixedPointCoordinate> raw_via_node_coordinates;
std::vector<bool> source_traversed_in_reverse;
std::vector<bool> target_traversed_in_reverse;
std::vector<bool> alt_source_traversed_in_reverse;
std::vector<bool> alt_target_traversed_in_reverse;
unsigned check_sum;
int shortest_path_length;
int alternative_path_length;
bool is_via_leg(const std::size_t leg) const
{
return (leg != unpacked_path_segments.size() - 1);
}
RawRouteData()
: check_sum(SPECIAL_NODEID),
shortest_path_length(INVALID_EDGE_WEIGHT),
alternative_path_length(INVALID_EDGE_WEIGHT)
{
}
};
#endif // RAW_ROUTE_DATA_H
+126
View File
@@ -0,0 +1,126 @@
/*
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 <limits>
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;
explicit TurnRestriction(NodeID viaNode)
: viaNode(viaNode), fromNode(std::numeric_limits<unsigned>::max()),
toNode(std::numeric_limits<unsigned>::max())
{
}
explicit TurnRestriction(const bool isOnly = false)
: viaNode(std::numeric_limits<unsigned>::max()),
fromNode(std::numeric_limits<unsigned>::max()),
toNode(std::numeric_limits<unsigned>::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;
}
explicit InputRestrictionContainer(bool isOnly = false)
: fromWay(std::numeric_limits<unsigned>::max()),
toWay(std::numeric_limits<unsigned>::max()), viaNode(std::numeric_limits<unsigned>::max())
{
restriction.flags.isOnly = isOnly;
}
static InputRestrictionContainer min_value() { return InputRestrictionContainer(0, 0, 0, 0); }
static InputRestrictionContainer max_value()
{
return InputRestrictionContainer(std::numeric_limits<unsigned>::max(),
std::numeric_limits<unsigned>::max(),
std::numeric_limits<unsigned>::max(),
std::numeric_limits<unsigned>::max());
}
};
struct CmpRestrictionContainerByFrom
{
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
{
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
+221
View File
@@ -0,0 +1,221 @@
/*
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 "RestrictionMap.h"
#include "NodeBasedGraph.h"
#include "../Util/SimpleLogger.h"
bool RestrictionMap::IsViaNode(const NodeID node) const
{
return m_no_turn_via_node_set.find(node) != m_no_turn_via_node_set.end();
}
RestrictionMap::RestrictionMap(const std::shared_ptr<NodeBasedDynamicGraph> &graph,
const std::vector<TurnRestriction> &restriction_list)
: m_count(0), m_graph(graph)
{
// decompose restriction consisting of a start, via and end node into a
// a pair of starting edge and a list of all end nodes
for (auto &restriction : restriction_list)
{
m_restriction_start_nodes.insert(restriction.fromNode);
m_no_turn_via_node_set.insert(restriction.viaNode);
RestrictionSource restriction_source = {restriction.fromNode, restriction.viaNode};
unsigned index;
auto 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()->is_only)
{
continue;
}
else if (restriction.flags.isOnly)
{
// We are going to insert an is_only_*-restriction. There can be only one.
m_count -= m_restriction_bucket_list.at(index).size();
m_restriction_bucket_list.at(index).clear();
}
}
++m_count;
m_restriction_bucket_list.at(index)
.emplace_back(restriction.toNode, restriction.flags.isOnly);
}
}
// Replace end v with w in each turn restriction containing u as via node
void RestrictionMap::FixupArrivingTurnRestriction(const NodeID node_u,
const NodeID node_v,
const NodeID node_w)
{
BOOST_ASSERT(node_u != SPECIAL_NODEID);
BOOST_ASSERT(node_v != SPECIAL_NODEID);
BOOST_ASSERT(node_w != SPECIAL_NODEID);
if (!IsViaNode(node_u))
{
return;
}
// find all potential start edges. It is more efficent to get a (small) list
// of potential start edges than iterating over all buckets
std::vector<NodeID> predecessors;
for (const EdgeID current_edge_id : m_graph->GetAdjacentEdgeRange(node_u))
{
const NodeID target = m_graph->GetTarget(current_edge_id);
if (node_v != target)
{
predecessors.push_back(target);
}
}
for (const NodeID node_x : predecessors)
{
const auto restriction_iterator = m_restriction_map.find({node_x, node_u});
if (restriction_iterator == m_restriction_map.end())
{
continue;
}
const unsigned index = restriction_iterator->second;
auto &bucket = m_restriction_bucket_list.at(index);
for (RestrictionTarget &restriction_target : bucket)
{
if (node_v == restriction_target.target_node)
{
restriction_target.target_node = node_w;
}
}
}
}
// Replaces start edge (v, w) with (u, w). Only start node changes.
void RestrictionMap::FixupStartingTurnRestriction(const NodeID node_u,
const NodeID node_v,
const NodeID node_w)
{
BOOST_ASSERT(node_u != SPECIAL_NODEID);
BOOST_ASSERT(node_v != SPECIAL_NODEID);
BOOST_ASSERT(node_w != SPECIAL_NODEID);
if (!IsSourceNode(node_v))
{
return;
}
const auto restriction_iterator = m_restriction_map.find({node_v, node_w});
if (restriction_iterator != m_restriction_map.end())
{
const unsigned index = restriction_iterator->second;
// remove old restriction start (v,w)
m_restriction_map.erase(restriction_iterator);
m_restriction_start_nodes.emplace(node_u);
// insert new restriction start (u,w) (pointing to index)
RestrictionSource new_source = {node_u, node_w};
m_restriction_map.emplace(new_source, index);
}
}
// Check if edge (u, v) is the start of any turn restriction.
// If so returns id of first target node.
NodeID RestrictionMap::CheckForEmanatingIsOnlyTurn(const NodeID node_u, const NodeID node_v) const
{
BOOST_ASSERT(node_u != SPECIAL_NODEID);
BOOST_ASSERT(node_v != SPECIAL_NODEID);
if (!IsSourceNode(node_u))
{
return SPECIAL_NODEID;
}
const auto restriction_iter = m_restriction_map.find({node_u, node_v});
if (restriction_iter != m_restriction_map.end())
{
const unsigned index = restriction_iter->second;
const auto &bucket = m_restriction_bucket_list.at(index);
for (const RestrictionTarget &restriction_target : bucket)
{
if (restriction_target.is_only)
{
return restriction_target.target_node;
}
}
}
return SPECIAL_NODEID;
}
// Checks if turn <u,v,w> is actually a turn restriction.
bool RestrictionMap::CheckIfTurnIsRestricted(const NodeID node_u,
const NodeID node_v,
const NodeID node_w) const
{
BOOST_ASSERT(node_u != SPECIAL_NODEID);
BOOST_ASSERT(node_v != SPECIAL_NODEID);
BOOST_ASSERT(node_w != SPECIAL_NODEID);
if (!IsSourceNode(node_u))
{
return false;
}
const auto restriction_iter = m_restriction_map.find({node_u, node_v});
if (restriction_iter != m_restriction_map.end())
{
const unsigned index = restriction_iter->second;
const auto &bucket = m_restriction_bucket_list.at(index);
for (const RestrictionTarget &restriction_target : bucket)
{
if ((node_w == restriction_target.target_node) && // target found
(!restriction_target.is_only) // and not an only_-restr.
)
{
return true;
}
}
}
return false;
}
// check of node is the start of any restriction
bool RestrictionMap::IsSourceNode(const NodeID node) const
{
if (m_restriction_start_nodes.find(node) == m_restriction_start_nodes.end())
{
return false;
}
return true;
}
+126
View File
@@ -0,0 +1,126 @@
/*
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_MAP_H__
#define __RESTRICTION_MAP_H__
#include <memory>
#include "DynamicGraph.h"
#include "Restriction.h"
#include "NodeBasedGraph.h"
#include "../Util/StdHashExtensions.h"
#include "../typedefs.h"
#include <unordered_map>
#include <unordered_set>
struct RestrictionSource
{
NodeID start_node;
NodeID via_node;
RestrictionSource(NodeID start, NodeID via) : start_node(start), via_node(via)
{
}
friend inline bool operator==(const RestrictionSource &lhs, const RestrictionSource &rhs)
{
return (lhs.start_node == rhs.start_node && lhs.via_node == rhs.via_node);
}
};
struct RestrictionTarget
{
NodeID target_node;
bool is_only;
explicit RestrictionTarget(NodeID target, bool only) : target_node(target), is_only(only)
{
}
friend inline bool operator==(const RestrictionTarget &lhs, const RestrictionTarget &rhs)
{
return (lhs.target_node == rhs.target_node && lhs.is_only == rhs.is_only);
}
};
namespace std
{
template <> struct hash<RestrictionSource>
{
size_t operator()(const RestrictionSource &r_source) const
{
return hash_val(r_source.start_node, r_source.via_node);
}
};
template <> struct hash<RestrictionTarget>
{
size_t operator()(const RestrictionTarget &r_target) const
{
return hash_val(r_target.target_node, r_target.is_only);
}
};
}
/**
\brief Efficent look up if an edge is the start + via node of a TurnRestriction
EdgeBasedEdgeFactory decides by it if edges are inserted or geometry is compressed
*/
class RestrictionMap
{
public:
RestrictionMap(const std::shared_ptr<NodeBasedDynamicGraph> &graph,
const std::vector<TurnRestriction> &input_restrictions_list);
void FixupArrivingTurnRestriction(const NodeID u, const NodeID v, const NodeID w);
void FixupStartingTurnRestriction(const NodeID u, const NodeID v, const NodeID w);
NodeID CheckForEmanatingIsOnlyTurn(const NodeID u, const NodeID v) const;
bool CheckIfTurnIsRestricted(const NodeID u, const NodeID v, const NodeID w) const;
bool IsViaNode(const NodeID node) const;
std::size_t size()
{
return m_count;
}
private:
bool IsSourceNode(const NodeID node) const;
typedef std::vector<RestrictionTarget> EmanatingRestrictionsVector;
typedef NodeBasedDynamicGraph::EdgeData EdgeData;
std::size_t m_count;
std::shared_ptr<NodeBasedDynamicGraph> m_graph;
//! index -> list of (target, isOnly)
std::vector<EmanatingRestrictionsVector> m_restriction_bucket_list;
//! maps (start, via) -> bucket index
std::unordered_map<RestrictionSource, unsigned> m_restriction_map;
std::unordered_set<NodeID> m_restriction_start_nodes;
std::unordered_set<NodeID> m_no_turn_via_node_set;
};
#endif
+109
View File
@@ -0,0 +1,109 @@
/*
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/RouteParameters.h>
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/sequence/intrinsic.hpp>
#include <boost/fusion/include/at_c.hpp>
RouteParameters::RouteParameters()
: zoom_level(18), print_instructions(false), alternate_route(true), geometry(true),
compression(true), deprecatedAPI(false), uturn_default(false), check_sum(-1)
{
}
void RouteParameters::setZoomLevel(const short level)
{
if (18 >= level && 0 <= level)
{
zoom_level = level;
}
}
void RouteParameters::setAlternateRouteFlag(const bool flag) { alternate_route = flag; }
void RouteParameters::setUTurn(const bool flag)
{
uturns.resize(coordinates.size(), uturn_default);
if (!uturns.empty())
{
uturns.back() = flag;
}
}
void RouteParameters::setAllUTurns(const bool flag)
{
// if the flag flips the default, then we erase everything.
if (flag)
{
uturn_default = flag;
uturns.clear();
uturns.resize(coordinates.size(), uturn_default);
}
}
void RouteParameters::setDeprecatedAPIFlag(const std::string &) { deprecatedAPI = true; }
void RouteParameters::setChecksum(const unsigned sum) { check_sum = sum; }
void RouteParameters::setInstructionFlag(const bool flag) { print_instructions = flag; }
void RouteParameters::setService(const std::string &service_string) { service = service_string; }
void RouteParameters::setOutputFormat(const std::string &format) { output_format = format; }
void RouteParameters::setJSONpParameter(const std::string &parameter)
{
jsonp_parameter = parameter;
}
void RouteParameters::addHint(const std::string &hint)
{
hints.resize(coordinates.size());
if (!hints.empty())
{
hints.back() = hint;
}
}
void RouteParameters::setLanguage(const std::string &language_string)
{
language = language_string;
}
void RouteParameters::setGeometryFlag(const bool flag) { geometry = flag; }
void RouteParameters::setCompressionFlag(const bool flag) { compression = flag; }
void
RouteParameters::addCoordinate(const boost::fusion::vector<double, double> &transmitted_coordinates)
{
coordinates.emplace_back(
static_cast<int>(COORDINATE_PRECISION * boost::fusion::at_c<0>(transmitted_coordinates)),
static_cast<int>(COORDINATE_PRECISION * boost::fusion::at_c<1>(transmitted_coordinates)));
}
+60
View File
@@ -0,0 +1,60 @@
/*
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 SEARCHENGINE_H
#define SEARCHENGINE_H
#include "SearchEngineData.h"
#include "../RoutingAlgorithms/AlternativePathRouting.h"
#include "../RoutingAlgorithms/ManyToManyRouting.h"
#include "../RoutingAlgorithms/ShortestPathRouting.h"
#include <type_traits>
template <class DataFacadeT> class SearchEngine
{
private:
DataFacadeT *facade;
SearchEngineData engine_working_data;
public:
ShortestPathRouting<DataFacadeT> shortest_path;
AlternativeRouting<DataFacadeT> alternative_path;
ManyToManyRouting<DataFacadeT> distance_table;
explicit SearchEngine(DataFacadeT *facade)
: facade(facade), shortest_path(facade, engine_working_data),
alternative_path(facade, engine_working_data), distance_table(facade, engine_working_data)
{
static_assert(!std::is_pointer<DataFacadeT>::value, "don't instantiate with ptr type");
static_assert(std::is_object<DataFacadeT>::value, "don't instantiate with void, function, or reference");
}
~SearchEngine() {}
};
#endif // SEARCHENGINE_H
+93
View File
@@ -0,0 +1,93 @@
/*
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"
#include "BinaryHeap.h"
void SearchEngineData::InitializeOrClearFirstThreadLocalStorage(const unsigned number_of_nodes)
{
if (forwardHeap.get())
{
forwardHeap->Clear();
}
else
{
forwardHeap.reset(new QueryHeap(number_of_nodes));
}
if (backwardHeap.get())
{
backwardHeap->Clear();
}
else
{
backwardHeap.reset(new QueryHeap(number_of_nodes));
}
}
void SearchEngineData::InitializeOrClearSecondThreadLocalStorage(const unsigned number_of_nodes)
{
if (forwardHeap2.get())
{
forwardHeap2->Clear();
}
else
{
forwardHeap2.reset(new QueryHeap(number_of_nodes));
}
if (backwardHeap2.get())
{
backwardHeap2->Clear();
}
else
{
backwardHeap2.reset(new QueryHeap(number_of_nodes));
}
}
void SearchEngineData::InitializeOrClearThirdThreadLocalStorage(const unsigned number_of_nodes)
{
if (forwardHeap3.get())
{
forwardHeap3->Clear();
}
else
{
forwardHeap3.reset(new QueryHeap(number_of_nodes));
}
if (backwardHeap3.get())
{
backwardHeap3->Clear();
}
else
{
backwardHeap3.reset(new QueryHeap(number_of_nodes));
}
}
+61
View File
@@ -0,0 +1,61 @@
/*
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 <boost/thread/tss.hpp>
#include "../typedefs.h"
#include "BinaryHeap.h"
struct HeapData
{
NodeID parent;
/* explicit */ HeapData(NodeID p) : parent(p) {}
};
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
+72
View File
@@ -0,0 +1,72 @@
/*
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 SEGMENT_INFORMATION_H
#define SEGMENT_INFORMATION_H
#include "TurnInstructions.h"
#include "../typedefs.h"
#include <osrm/Coordinate.h>
// Struct fits everything in one cache line
struct SegmentInformation
{
FixedPointCoordinate location;
NodeID name_id;
EdgeWeight duration;
float length;
short bearing; // more than enough [0..3600] fits into 12 bits
TurnInstruction turn_instruction;
bool necessary:1;
bool is_via_location:1;
explicit SegmentInformation(const FixedPointCoordinate &location,
const NodeID name_id,
const EdgeWeight duration,
const float length,
const TurnInstruction turn_instruction,
const bool necessary,
const bool is_via_location)
: location(location), name_id(name_id), duration(duration), length(length), bearing(0),
turn_instruction(turn_instruction), necessary(necessary), is_via_location(is_via_location)
{
}
explicit SegmentInformation(const FixedPointCoordinate &location,
const NodeID name_id,
const EdgeWeight duration,
const float length,
const TurnInstruction turn_instruction)
: location(location), name_id(name_id), duration(duration), length(length), bearing(0),
turn_instruction(turn_instruction), necessary(turn_instruction != TurnInstruction::NoTurn), is_via_location(false)
{
}
};
#endif /* SEGMENT_INFORMATION_H */
+370
View File
@@ -0,0 +1,370 @@
/*
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/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/interprocess/mapped_region.hpp>
#ifndef WIN32
#include <boost/interprocess/xsi_shared_memory.hpp>
#else
#include <boost/interprocess/shared_memory_object.hpp>
#endif
#ifdef __linux__
#include <sys/ipc.h>
#include <sys/shm.h>
#endif
// #include <cstring>
#include <cstdint>
#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;
}
};
#ifndef WIN32
class SharedMemory
{
// Remove shared memory on destruction
class shm_remove
{
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(const shm_remove &) = delete;
~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(); }
SharedMemory() = delete;
SharedMemory(const SharedMemory &) = delete;
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;
};
#else
// Windows - specific code
class SharedMemory : boost::noncopyable
{
// Remove shared memory on destruction
class shm_remove : boost::noncopyable
{
private:
char *m_shmid;
bool m_initialized;
public:
void SetID(char *shmid)
{
m_shmid = shmid;
m_initialized = true;
}
shm_remove() : m_shmid("undefined"), m_initialized(false) {}
~shm_remove()
{
if (m_initialized)
{
SimpleLogger().Write(logDEBUG) << "automatic memory deallocation";
if (!boost::interprocess::shared_memory_object::remove(m_shmid))
{
SimpleLogger().Write(logDEBUG) << "could not deallocate id " << m_shmid;
}
}
}
};
public:
void *Ptr() const { return region.get_address(); }
SharedMemory(const boost::filesystem::path &lock_file,
const int id,
const uint64_t size = 0,
bool read_write = false,
bool remove_prev = true)
{
sprintf(key, "%s.%d", "osrm.lock", id);
if (0 == size)
{ // read_only
shm = boost::interprocess::shared_memory_object(
boost::interprocess::open_only,
key,
read_write ? boost::interprocess::read_write : boost::interprocess::read_only);
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::shared_memory_object(
boost::interprocess::open_or_create, key, boost::interprocess::read_write);
shm.truncate(size);
region = boost::interprocess::mapped_region(shm, boost::interprocess::read_write);
remover.SetID(key);
SimpleLogger().Write(logDEBUG) << "writeable memory allocated " << size << " bytes";
}
}
static bool RegionExists(const int id)
{
bool result = true;
try
{
char k[500];
build_key(id, k);
result = RegionExists(k);
}
catch (...) { result = false; }
return result;
}
static bool Remove(const int id)
{
char k[500];
build_key(id, k);
return Remove(k);
}
private:
static void build_key(int id, char *key)
{
OSRMLockFile lock_file;
sprintf(key, "%s.%d", "osrm.lock", id);
}
static bool RegionExists(const char *key)
{
bool result = true;
try
{
boost::interprocess::shared_memory_object shm(
boost::interprocess::open_only, key, boost::interprocess::read_write);
}
catch (...) { result = false; }
return result;
}
static bool Remove(char *key)
{
bool ret = false;
try
{
SimpleLogger().Write(logDEBUG) << "deallocating prev memory";
ret = boost::interprocess::shared_memory_object::remove(key);
}
catch (const boost::interprocess::interprocess_exception &e)
{
if (e.get_error_code() != boost::interprocess::not_found_error)
{
throw;
}
}
return ret;
}
char key[500];
boost::interprocess::shared_memory_object shm;
boost::interprocess::mapped_region region;
shm_remove remover;
};
#endif
template <class LockFileT = OSRMLockFile> class SharedMemoryFactory_tmpl
{
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());
}
}
SharedMemoryFactory_tmpl() = delete;
SharedMemoryFactory_tmpl(const SharedMemoryFactory_tmpl &) = delete;
};
typedef SharedMemoryFactory_tmpl<> SharedMemoryFactory;
#endif /* SHARED_MEMORY_POINTER_FACTORY_H */
+156
View File
@@ -0,0 +1,156 @@
/*
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 <algorithm>
#include <iterator>
#include <type_traits>
#include <vector>
template <typename DataT> class ShMemIterator : public std::iterator<std::input_iterator_tag, DataT>
{
DataT *p;
public:
explicit 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(nullptr), 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);
}
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; }
bool empty() const { return 0 == 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 <> class SharedMemoryWrapper<bool>
{
private:
unsigned *m_ptr;
std::size_t m_size;
public:
SharedMemoryWrapper() : m_ptr(nullptr), m_size(0) {}
SharedMemoryWrapper(unsigned *ptr, std::size_t size) : m_ptr(ptr), m_size(size) {}
void swap(SharedMemoryWrapper<bool> &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);
}
bool at(const std::size_t index) const
{
const std::size_t bucket = index / 32;
const unsigned offset = static_cast<unsigned>(index % 32);
return m_ptr[bucket] & (1 << offset);
}
std::size_t size() const { return m_size; }
bool empty() const { return 0 == size(); }
bool operator[](const unsigned index)
{
BOOST_ASSERT_MSG(index < m_size, "invalid size");
const unsigned bucket = index / 32;
const unsigned offset = index % 32;
return m_ptr[bucket] & (1 << offset);
}
};
template <typename DataT, bool UseSharedMemory> struct ShM
{
typedef typename std::conditional<UseSharedMemory,
SharedMemoryWrapper<DataT>,
std::vector<DataT>>::type vector;
};
#endif // SHARED_MEMORY_VECTOR_WRAPPER_H
+205
View File
@@ -0,0 +1,205 @@
/*
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 STATIC_GRAPH_H
#define STATIC_GRAPH_H
#include "Percent.h"
#include "Range.h"
#include "SharedMemoryVectorWrapper.h"
#include "../Util/SimpleLogger.h"
#include "../typedefs.h"
#include <boost/assert.hpp>
#include <tbb/parallel_sort.h>
#include <algorithm>
#include <limits>
#include <utility>
#include <vector>
template <typename EdgeDataT, bool UseSharedMemory = false> class StaticGraph
{
public:
typedef NodeID NodeIterator;
typedef NodeID EdgeIterator;
typedef EdgeDataT EdgeData;
typedef osrm::range<EdgeIterator> EdgeRange;
class InputEdge
{
public:
NodeIterator source;
NodeIterator target;
EdgeDataT data;
template<typename... Ts>
InputEdge(NodeIterator source, NodeIterator target, Ts &&...data) : source(source), target(target), data(std::forward<Ts>(data)...) { }
bool operator<(const InputEdge &right) const
{
if (source != right.source)
{
return source < right.source;
}
return target < right.target;
}
};
struct NodeArrayEntry
{
// index of the first edge
EdgeIterator first_edge;
};
struct EdgeArrayEntry
{
NodeID target;
EdgeDataT data;
};
EdgeRange GetAdjacentEdgeRange(const NodeID node) const
{
return osrm::irange(BeginEdges(node), EndEdges(node));
}
StaticGraph(const int nodes, std::vector<InputEdge> &graph)
{
tbb::parallel_sort(graph.begin(), graph.end());
number_of_nodes = nodes;
number_of_edges = (EdgeIterator)graph.size();
node_array.resize(number_of_nodes + 1);
EdgeIterator edge = 0;
EdgeIterator position = 0;
for (const auto node : osrm::irange(0u, number_of_nodes+1))
{
EdgeIterator last_edge = edge;
while (edge < number_of_edges && graph[edge].source == node)
{
++edge;
}
node_array[node].first_edge = position; //=edge
position += edge - last_edge; // remove
}
edge_array.resize(position); //(edge)
edge = 0;
for (const auto node : osrm::irange(0u, number_of_nodes))
{
EdgeIterator e = node_array[node + 1].first_edge;
for (EdgeIterator i = node_array[node].first_edge; i != e; ++i)
{
edge_array[i].target = graph[edge].target;
edge_array[i].data = graph[edge].data;
BOOST_ASSERT(edge_array[i].data.distance > 0);
edge++;
}
}
}
StaticGraph(typename ShM<NodeArrayEntry, UseSharedMemory>::vector &nodes,
typename ShM<EdgeArrayEntry, UseSharedMemory>::vector &edges)
{
number_of_nodes = nodes.size() - 1;
number_of_edges = edges.size();
node_array.swap(nodes);
edge_array.swap(edges);
}
unsigned GetNumberOfNodes() const { return number_of_nodes; }
unsigned GetNumberOfEdges() const { return number_of_edges; }
unsigned GetOutDegree(const NodeIterator n) const { return EndEdges(n) - BeginEdges(n); }
inline NodeIterator GetTarget(const EdgeIterator e) const
{
return NodeIterator(edge_array[e].target);
}
inline EdgeDataT &GetEdgeData(const EdgeIterator e) { return edge_array[e].data; }
const EdgeDataT &GetEdgeData(const EdgeIterator e) const { return edge_array[e].data; }
EdgeIterator BeginEdges(const NodeIterator n) const
{
return EdgeIterator(node_array.at(n).first_edge);
}
EdgeIterator EndEdges(const NodeIterator n) const
{
return EdgeIterator(node_array.at(n + 1).first_edge);
}
// searches for a specific edge
EdgeIterator FindEdge(const NodeIterator from, const NodeIterator to) const
{
EdgeIterator smallest_edge = SPECIAL_EDGEID;
EdgeWeight smallest_weight = INVALID_EDGE_WEIGHT;
for (auto edge : GetAdjacentEdgeRange(from))
{
const NodeID target = GetTarget(edge);
const EdgeWeight weight = GetEdgeData(edge).distance;
if (target == to && weight < smallest_weight)
{
smallest_edge = edge;
smallest_weight = weight;
}
}
return smallest_edge;
}
EdgeIterator FindEdgeInEitherDirection(const NodeIterator from, const NodeIterator to) const
{
EdgeIterator tmp = FindEdge(from, to);
return (SPECIAL_NODEID != tmp ? tmp : FindEdge(to, from));
}
EdgeIterator
FindEdgeIndicateIfReverse(const NodeIterator from, const NodeIterator to, bool &result) const
{
EdgeIterator current_iterator = FindEdge(from, to);
if (SPECIAL_NODEID == current_iterator)
{
current_iterator = FindEdge(to, from);
if (SPECIAL_NODEID != current_iterator)
{
result = true;
}
}
return current_iterator;
}
private:
NodeIterator number_of_nodes;
EdgeIterator number_of_edges;
typename ShM<NodeArrayEntry, UseSharedMemory>::vector node_array;
typename ShM<EdgeArrayEntry, UseSharedMemory>::vector edge_array;
};
#endif // STATIC_GRAPH_H
+260
View File
@@ -0,0 +1,260 @@
/*
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;
}
};
explicit 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:
explicit 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
File diff suppressed because it is too large Load Diff
+90
View File
@@ -0,0 +1,90 @@
/*
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 TURN_INSTRUCTIONS_H
#define TURN_INSTRUCTIONS_H
enum class TurnInstruction : unsigned char
{
NoTurn = 0, GoStraight, TurnSlightRight, TurnRight, TurnSharpRight, UTurn,
TurnSharpLeft, TurnLeft, TurnSlightLeft, ReachViaLocation, HeadOn, EnterRoundAbout,
LeaveRoundAbout, StayOnRoundAbout, StartAtEndOfStreet, ReachedYourDestination,
EnterAgainstAllowedDirection, LeaveAgainstAllowedDirection,
InverseAccessRestrictionFlag = 127,
AccessRestrictionFlag = 128,
AccessRestrictionPenalty = 129
};
struct TurnInstructionsClass
{
TurnInstructionsClass() = delete;
TurnInstructionsClass(const TurnInstructionsClass&) = delete;
static inline TurnInstruction GetTurnDirectionOfInstruction(const double angle)
{
if (angle >= 23 && angle < 67)
{
return TurnInstruction::TurnSharpRight;
}
if (angle >= 67 && angle < 113)
{
return TurnInstruction::TurnRight;
}
if (angle >= 113 && angle < 158)
{
return TurnInstruction::TurnSlightRight;
}
if (angle >= 158 && angle < 202)
{
return TurnInstruction::GoStraight;
}
if (angle >= 202 && angle < 248)
{
return TurnInstruction::TurnSlightLeft;
}
if (angle >= 248 && angle < 292)
{
return TurnInstruction::TurnLeft;
}
if (angle >= 292 && angle < 336)
{
return TurnInstruction::TurnSharpLeft;
}
return TurnInstruction::UTurn;
}
static inline bool TurnIsNecessary(const TurnInstruction turn_instruction)
{
if (TurnInstruction::NoTurn == turn_instruction || TurnInstruction::StayOnRoundAbout == turn_instruction)
{
return false;
}
return true;
}
};
#endif /* TURN_INSTRUCTIONS_H */
+115
View File
@@ -0,0 +1,115 @@
/*
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 XOR_FAST_HASH_H
#define XOR_FAST_HASH_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 // XOR_FAST_HASH_H
+89
View File
@@ -0,0 +1,89 @@
/*
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 XOR_FAST_HASH_STORAGE_H
#define XOR_FAST_HASH_STORAGE_H
#include "XORFastHash.h"
#include <limits>
#include <vector>
template <typename NodeID, typename Key> class XORFastHashStorage
{
public:
struct HashCell
{
Key key;
NodeID id;
unsigned time;
HashCell()
: key(std::numeric_limits<unsigned>::max()), id(std::numeric_limits<unsigned>::max()),
time(std::numeric_limits<unsigned>::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 &key_to_insert) { key = key_to_insert; }
};
explicit XORFastHashStorage(size_t) : positions(2 << 16), current_timestamp(0) {}
inline HashCell &operator[](const NodeID node)
{
unsigned short position = fast_hasher(node);
while ((positions[position].time == current_timestamp) && (positions[position].id != node))
{
++position %= (2 << 16);
}
positions[position].id = node;
positions[position].time = current_timestamp;
return positions[position];
}
inline void Clear()
{
++current_timestamp;
if (std::numeric_limits<unsigned>::max() == current_timestamp)
{
positions.clear();
positions.resize((2 << 16));
}
}
private:
XORFastHashStorage() : positions(2 << 16), current_timestamp(0) {}
std::vector<HashCell> positions;
XORFastHash fast_hasher;
unsigned current_timestamp;
};
#endif // XOR_FAST_HASH_STORAGE_H
+61
View File
@@ -0,0 +1,61 @@
/*
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/PhantomNodes.h"
#include "../DataStructures/RawRouteData.h"
#include "../typedefs.h"
#include <osrm/Reply.h>
#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(const RawRouteData &raw_route, http::Reply &reply) = 0;
virtual void SetConfig(const DescriptorConfig &config) = 0;
};
#endif // BASE_DESCRIPTOR_H
+101
View File
@@ -0,0 +1,101 @@
/*
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"
#include <osrm/Coordinate.h>
#include "../typedefs.h"
#include "../Algorithms/PolylineCompressor.h"
#include "../DataStructures/PhantomNodes.h"
#include "../DataStructures/RawRouteData.h"
#include "../DataStructures/SegmentInformation.h"
#include "../DataStructures/TurnInstructions.h"
DescriptionFactory::DescriptionFactory() : entireLength(0) { via_indices.push_back(0); }
std::vector<unsigned> const &DescriptionFactory::GetViaIndices() const { return via_indices; }
void DescriptionFactory::SetStartSegment(const PhantomNode &source, const bool traversed_in_reverse)
{
start_phantom = source;
const EdgeWeight segment_duration =
(traversed_in_reverse ? source.reverse_weight : source.forward_weight);
AppendSegment(source.location,
PathData(0, source.name_id, TurnInstruction::HeadOn, segment_duration));
BOOST_ASSERT(path_description.back().duration == segment_duration);
}
void DescriptionFactory::SetEndSegment(const PhantomNode &target,
const bool traversed_in_reverse,
const bool is_via_location)
{
target_phantom = target;
const EdgeWeight segment_duration =
(traversed_in_reverse ? target.reverse_weight : target.forward_weight);
path_description.emplace_back(target.location,
target.name_id,
segment_duration,
0.f,
is_via_location ? TurnInstruction::ReachViaLocation
: TurnInstruction::NoTurn,
true,
true);
BOOST_ASSERT(path_description.back().duration == segment_duration);
}
void DescriptionFactory::AppendSegment(const FixedPointCoordinate &coordinate,
const PathData &path_point)
{
if ((1 == path_description.size()) && (path_description.back().location == coordinate))
{
path_description.back().name_id = path_point.name_id;
return;
}
path_description.emplace_back(coordinate,
path_point.name_id,
path_point.segment_duration,
0.f,
path_point.turn_instruction);
}
JSON::Value DescriptionFactory::AppendEncodedPolylineString(const bool return_encoded)
{
if (return_encoded)
{
return polyline_compressor.printEncodedString(path_description);
}
return polyline_compressor.printUnencodedString(path_description);
}
void DescriptionFactory::BuildRouteSummary(const double distance, const unsigned time)
{
summary.source_name_id = start_phantom.name_id;
summary.target_name_id = target_phantom.name_id;
summary.BuildDurationAndLengthStrings(distance, time);
}
+215
View File
@@ -0,0 +1,215 @@
/*
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/PhantomNodes.h"
#include "../DataStructures/SegmentInformation.h"
#include "../DataStructures/TurnInstructions.h"
#include "../typedefs.h"
#include <osrm/Coordinate.h>
#include <limits>
#include <vector>
struct PathData;
/* 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;
std::vector<unsigned> via_indices;
public:
struct RouteSummary
{
unsigned distance;
EdgeWeight duration;
unsigned source_name_id;
unsigned target_name_id;
RouteSummary() : distance(0), duration(0), source_name_id(0), target_name_id(0) {}
void BuildDurationAndLengthStrings(const double raw_distance, const unsigned raw_duration)
{
// compute distance/duration for route summary
distance = static_cast<unsigned>(round(raw_distance));
duration = static_cast<unsigned>(round(raw_duration / 10.));
}
} summary;
double entireLength;
// I know, declaring this public is considered bad. I'm lazy
std::vector<SegmentInformation> path_description;
DescriptionFactory();
void AppendSegment(const FixedPointCoordinate &coordinate, const PathData &data);
void BuildRouteSummary(const double distance, const unsigned time);
void SetStartSegment(const PhantomNode &start_phantom, const bool traversed_in_reverse);
void SetEndSegment(const PhantomNode &start_phantom, const bool traversed_in_reverse, const bool is_via_location = false);
JSON::Value AppendEncodedPolylineString(const bool return_encoded);
std::vector<unsigned> const & GetViaIndices() const;
template <class DataFacadeT> void Run(const DataFacadeT *facade, const unsigned zoomLevel)
{
if (path_description.empty())
{
return;
}
/** starts at index 1 */
path_description[0].length = 0;
for (unsigned i = 1; i < path_description.size(); ++i)
{
// move down names by one, q&d hack
path_description[i - 1].name_id = path_description[i].name_id;
path_description[i].length = FixedPointCoordinate::ApproximateEuclideanDistance(
path_description[i - 1].location, path_description[i].location);
}
/*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 < path_description.size(); ++i) {
// string1 = sEngine.GetEscapedNameForNameID(path_description[i].name_id);
// if(TurnInstruction::GoStraight == path_description[i].turn_instruction) {
// 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)
// path_description[lastTurn].name_id = path_description[i].name_id;
// path_description[i].turn_instruction = TurnInstruction::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;
// path_description[i].name_id = path_description[i-1].name_id;
// path_description[i].turn_instruction = TurnInstruction::NoTurn;
// }
// }
// if (TurnInstruction::NoTurn != path_description[i].turn_instruction) {
// lastTurn = i;
// }
// string0 = string1;
// }
float segment_length = 0.;
unsigned segment_duration = 0;
unsigned segment_start_index = 0;
for (unsigned i = 1; i < path_description.size(); ++i)
{
entireLength += path_description[i].length;
segment_length += path_description[i].length;
segment_duration += path_description[i].duration;
path_description[segment_start_index].length = segment_length;
path_description[segment_start_index].duration = segment_duration;
if (TurnInstruction::NoTurn != path_description[i].turn_instruction)
{
BOOST_ASSERT(path_description[i].necessary);
segment_length = 0;
segment_duration = 0;
segment_start_index = i;
}
}
// Post-processing to remove empty or nearly empty path segments
if (std::numeric_limits<double>::epsilon() > path_description.back().length)
{
if (path_description.size() > 2)
{
path_description.pop_back();
path_description.back().necessary = true;
path_description.back().turn_instruction = TurnInstruction::NoTurn;
target_phantom.name_id = (path_description.end() - 2)->name_id;
}
}
if (std::numeric_limits<double>::epsilon() > path_description.front().length)
{
if (path_description.size() > 2)
{
path_description.erase(path_description.begin());
path_description.front().turn_instruction = TurnInstruction::HeadOn;
path_description.front().necessary = true;
start_phantom.name_id = path_description.front().name_id;
}
}
// Generalize poly line
polyline_generalizer.Run(path_description, zoomLevel);
// fix what needs to be fixed else
unsigned necessary_pieces = 0; // a running index that counts the necessary pieces
for (unsigned i = 0; i < path_description.size() - 1 && path_description.size() >= 2; ++i)
{
if (path_description[i].necessary)
{
++necessary_pieces;
if (path_description[i].is_via_location)
{ //mark the end of a leg
via_indices.push_back(necessary_pieces);
}
const double angle = path_description[i+1].location.GetBearing(path_description[i].location);
path_description[i].bearing = static_cast<unsigned>(angle * 10);
}
}
via_indices.push_back(necessary_pieces+1);
BOOST_ASSERT(via_indices.size() >= 2);
// BOOST_ASSERT(0 != necessary_pieces || path_description.empty());
return;
}
};
#endif /* DESCRIPTIONFACTORY_H_ */
+100
View File
@@ -0,0 +1,100 @@
/*
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"
template <class DataFacadeT> class GPXDescriptor : public BaseDescriptor<DataFacadeT>
{
private:
DescriptorConfig config;
FixedPointCoordinate current;
DataFacadeT * facade;
void AddRoutePoint(const FixedPointCoordinate & coordinate, std::vector<char> & output)
{
const std::string route_point_head = "<rtept lat=\"";
const std::string route_point_middle = " lon=\"";
const std::string route_point_tail = "\"></rtept>";
std::string tmp;
FixedPointCoordinate::convertInternalLatLonToString(coordinate.lat, tmp);
output.insert(output.end(), route_point_head.begin(), route_point_head.end());
output.insert(output.end(), tmp.begin(), tmp.end());
output.push_back('\"');
FixedPointCoordinate::convertInternalLatLonToString(coordinate.lon, tmp);
output.insert(output.end(), route_point_middle.begin(), route_point_middle.end());
output.insert(output.end(), tmp.begin(), tmp.end());
output.insert(output.end(), route_point_tail.begin(), route_point_tail.end());
}
public:
GPXDescriptor(DataFacadeT *facade) : facade(facade) {}
void SetConfig(const DescriptorConfig &c) { config = c; }
// TODO: reorder parameters
void Run(const RawRouteData &raw_route, http::Reply &reply)
{
std::string header("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<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"
"\">"
"<metadata><copyright author=\"Project OSRM\"><license>Data (c)"
" OpenStreetMap contributors (ODbL)</license></copyright>"
"</metadata>"
"<rte>");
reply.content.insert(reply.content.end(), header.begin(), header.end());
const bool found_route = (raw_route.shortest_path_length != INVALID_EDGE_WEIGHT) &&
(!raw_route.unpacked_path_segments.front().empty());
if (found_route)
{
AddRoutePoint(raw_route.segment_end_coordinates.front().source_phantom.location, reply.content);
for (const std::vector<PathData> &path_data_vector : raw_route.unpacked_path_segments)
{
for (const PathData &path_data : path_data_vector)
{
const FixedPointCoordinate current_coordinate =
facade->GetCoordinateOfNode(path_data.node);
AddRoutePoint(current_coordinate, reply.content);
}
}
AddRoutePoint(raw_route.segment_end_coordinates.back().target_phantom.location, reply.content);
}
std::string footer("</rte></gpx>");
reply.content.insert(reply.content.end(), footer.begin(), footer.end());
}
};
#endif // GPX_DESCRIPTOR_H
+385
View File
@@ -0,0 +1,385 @@
/*
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 "../Algorithms/ExtractRouteNames.h"
#include "../DataStructures/JSONContainer.h"
#include "../DataStructures/Range.h"
#include "../DataStructures/SegmentInformation.h"
#include "../DataStructures/TurnInstructions.h"
#include "../Util/Azimuth.h"
#include "../Util/StringUtil.h"
#include "../Util/TimingUtil.h"
#include <algorithm>
template <class DataFacadeT> class JSONDescriptor : public BaseDescriptor<DataFacadeT>
{
private:
DataFacadeT *facade;
DescriptorConfig config;
DescriptionFactory description_factory, alternate_description_factory;
FixedPointCoordinate current;
unsigned entered_restricted_area_count;
struct RoundAbout
{
RoundAbout() : start_index(INT_MAX), name_id(INVALID_NAMEID), leave_at_exit(INT_MAX) {}
int start_index;
unsigned name_id;
int leave_at_exit;
} round_about;
struct Segment
{
Segment() : name_id(INVALID_NAMEID), length(-1), position(0) {}
Segment(unsigned n, int l, unsigned p) : name_id(n), length(l), position(p) {}
unsigned name_id;
int length;
unsigned position;
};
std::vector<Segment> shortest_path_segments, alternative_path_segments;
ExtractRouteNames<DataFacadeT, Segment> GenerateRouteNames;
public:
JSONDescriptor(DataFacadeT *facade) : facade(facade), entered_restricted_area_count(0) {}
void SetConfig(const DescriptorConfig &c) { config = c; }
unsigned DescribeLeg(const std::vector<PathData> route_leg,
const PhantomNodes &leg_phantoms,
const bool target_traversed_in_reverse,
const bool is_via_leg)
{
unsigned added_element_count = 0;
// Get all the coordinates for the computed route
FixedPointCoordinate current_coordinate;
for (const PathData &path_data : route_leg)
{
current_coordinate = facade->GetCoordinateOfNode(path_data.node);
description_factory.AppendSegment(current_coordinate, path_data);
++added_element_count;
}
description_factory.SetEndSegment(leg_phantoms.target_phantom, target_traversed_in_reverse, is_via_leg);
++added_element_count;
BOOST_ASSERT((route_leg.size() + 1) == added_element_count);
return added_element_count;
}
void Run(const RawRouteData &raw_route, http::Reply &reply)
{
JSON::Object json_result;
if (INVALID_EDGE_WEIGHT == raw_route.shortest_path_length)
{
// We do not need to do much, if there is no route ;-)
json_result.values["status"] = 207;
json_result.values["status_message"] = "Cannot find route between points";
JSON::render(reply.content, json_result);
return;
}
// check if first segment is non-zero
std::string road_name = facade->GetEscapedNameForNameID(
raw_route.segment_end_coordinates.front().source_phantom.name_id);
BOOST_ASSERT(raw_route.unpacked_path_segments.size() ==
raw_route.segment_end_coordinates.size());
description_factory.SetStartSegment(
raw_route.segment_end_coordinates.front().source_phantom,
raw_route.source_traversed_in_reverse.front());
json_result.values["status"] = 0;
json_result.values["status_message"] = "Found route between points";
// for each unpacked segment add the leg to the description
for (const auto i : osrm::irange<std::size_t>(0, raw_route.unpacked_path_segments.size()))
{
#ifndef NDEBUG
const int added_segments =
#endif
DescribeLeg(raw_route.unpacked_path_segments[i],
raw_route.segment_end_coordinates[i],
raw_route.target_traversed_in_reverse[i],
raw_route.is_via_leg(i));
BOOST_ASSERT(0 < added_segments);
}
description_factory.Run(facade, config.zoom_level);
if (config.geometry)
{
JSON::Value route_geometry =
description_factory.AppendEncodedPolylineString(config.encode_geometry);
json_result.values["route_geometry"] = route_geometry;
}
if (config.instructions)
{
JSON::Array json_route_instructions;
BuildTextualDescription(description_factory,
json_route_instructions,
raw_route.shortest_path_length,
shortest_path_segments);
json_result.values["route_instructions"] = json_route_instructions;
}
description_factory.BuildRouteSummary(description_factory.entireLength,
raw_route.shortest_path_length);
JSON::Object json_route_summary;
json_route_summary.values["total_distance"] = description_factory.summary.distance;
json_route_summary.values["total_time"] = description_factory.summary.duration;
json_route_summary.values["start_point"] =
facade->GetEscapedNameForNameID(description_factory.summary.source_name_id);
json_route_summary.values["end_point"] =
facade->GetEscapedNameForNameID(description_factory.summary.target_name_id);
json_result.values["route_summary"] = json_route_summary;
BOOST_ASSERT(!raw_route.segment_end_coordinates.empty());
JSON::Array json_via_points_array;
JSON::Array json_first_coordinate;
json_first_coordinate.values.push_back(
raw_route.segment_end_coordinates.front().source_phantom.location.lat /
COORDINATE_PRECISION);
json_first_coordinate.values.push_back(
raw_route.segment_end_coordinates.front().source_phantom.location.lon /
COORDINATE_PRECISION);
json_via_points_array.values.push_back(json_first_coordinate);
for (const PhantomNodes &nodes : raw_route.segment_end_coordinates)
{
std::string tmp;
JSON::Array json_coordinate;
json_coordinate.values.push_back(nodes.target_phantom.location.lat /
COORDINATE_PRECISION);
json_coordinate.values.push_back(nodes.target_phantom.location.lon /
COORDINATE_PRECISION);
json_via_points_array.values.push_back(json_coordinate);
}
json_result.values["via_points"] = json_via_points_array;
JSON::Array json_via_indices_array;
std::vector<unsigned> const &shortest_leg_end_indices = description_factory.GetViaIndices();
json_via_indices_array.values.insert(json_via_indices_array.values.end(),
shortest_leg_end_indices.begin(),
shortest_leg_end_indices.end());
json_result.values["via_indices"] = json_via_indices_array;
// only one alternative route is computed at this time, so this is hardcoded
if (INVALID_EDGE_WEIGHT != raw_route.alternative_path_length)
{
json_result.values["found_alternative"] = JSON::True();
BOOST_ASSERT(!raw_route.alt_source_traversed_in_reverse.empty());
alternate_description_factory.SetStartSegment(
raw_route.segment_end_coordinates.front().source_phantom,
raw_route.alt_source_traversed_in_reverse.front());
// Get all the coordinates for the computed route
for (const PathData &path_data : raw_route.unpacked_alternative)
{
current = facade->GetCoordinateOfNode(path_data.node);
alternate_description_factory.AppendSegment(current, path_data);
}
alternate_description_factory.SetEndSegment(raw_route.segment_end_coordinates.back().target_phantom, raw_route.alt_source_traversed_in_reverse.back());
alternate_description_factory.Run(facade, config.zoom_level);
if (config.geometry)
{
JSON::Value alternate_geometry_string =
alternate_description_factory.AppendEncodedPolylineString(
config.encode_geometry);
JSON::Array json_alternate_geometries_array;
json_alternate_geometries_array.values.push_back(alternate_geometry_string);
json_result.values["alternative_geometries"] = json_alternate_geometries_array;
}
// Generate instructions for each alternative (simulated here)
JSON::Array json_alt_instructions;
JSON::Array json_current_alt_instructions;
if (config.instructions)
{
BuildTextualDescription(alternate_description_factory,
json_current_alt_instructions,
raw_route.alternative_path_length,
alternative_path_segments);
json_alt_instructions.values.push_back(json_current_alt_instructions);
json_result.values["alternative_instructions"] = json_alt_instructions;
}
alternate_description_factory.BuildRouteSummary(
alternate_description_factory.entireLength, raw_route.alternative_path_length);
JSON::Object json_alternate_route_summary;
JSON::Array json_alternate_route_summary_array;
json_alternate_route_summary.values["total_distance"] =
alternate_description_factory.summary.distance;
json_alternate_route_summary.values["total_time"] =
alternate_description_factory.summary.duration;
json_alternate_route_summary.values["start_point"] = facade->GetEscapedNameForNameID(
alternate_description_factory.summary.source_name_id);
json_alternate_route_summary.values["end_point"] = facade->GetEscapedNameForNameID(
alternate_description_factory.summary.target_name_id);
json_alternate_route_summary_array.values.push_back(json_alternate_route_summary);
json_result.values["alternative_summaries"] = json_alternate_route_summary_array;
std::vector<unsigned> const &alternate_leg_end_indices =
alternate_description_factory.GetViaIndices();
JSON::Array json_altenative_indices_array;
json_altenative_indices_array.values.insert(json_altenative_indices_array.values.end(),
alternate_leg_end_indices.begin(),
alternate_leg_end_indices.end());
json_result.values["alternative_indices"] = json_altenative_indices_array;
}
else
{
json_result.values["found_alternative"] = JSON::False();
}
// Get Names for both routes
RouteNames route_names =
GenerateRouteNames(shortest_path_segments, alternative_path_segments, facade);
JSON::Array json_route_names;
json_route_names.values.push_back(route_names.shortest_path_name_1);
json_route_names.values.push_back(route_names.shortest_path_name_2);
json_result.values["route_name"] = json_route_names;
if (INVALID_EDGE_WEIGHT != raw_route.alternative_path_length)
{
JSON::Array json_alternate_names_array;
JSON::Array json_alternate_names;
json_alternate_names.values.push_back(route_names.alternative_path_name_1);
json_alternate_names.values.push_back(route_names.alternative_path_name_2);
json_alternate_names_array.values.push_back(json_alternate_names);
json_result.values["alternative_names"] = json_alternate_names_array;
}
JSON::Object json_hint_object;
json_hint_object.values["checksum"] = raw_route.check_sum;
JSON::Array json_location_hint_array;
std::string hint;
for (const auto i : osrm::irange<std::size_t>(0, raw_route.segment_end_coordinates.size()))
{
EncodeObjectToBase64(raw_route.segment_end_coordinates[i].source_phantom, hint);
json_location_hint_array.values.push_back(hint);
}
EncodeObjectToBase64(raw_route.segment_end_coordinates.back().target_phantom, hint);
json_location_hint_array.values.push_back(hint);
json_hint_object.values["locations"] = json_location_hint_array;
json_result.values["hint_data"] = json_hint_object;
// render the content to the output array
TIMER_START(route_render);
JSON::render(reply.content, json_result);
TIMER_STOP(route_render);
SimpleLogger().Write(logDEBUG) << "rendering took: " << TIMER_MSEC(route_render);
}
// TODO: reorder parameters
inline void BuildTextualDescription(DescriptionFactory &description_factory,
JSON::Array &json_instruction_array,
const int route_length,
std::vector<Segment> &route_segments_list)
{
// Segment information has following format:
//["instruction id","streetname",length,position,time,"length","earth_direction",azimuth]
unsigned necessary_segments_running_index = 0;
round_about.leave_at_exit = 0;
round_about.name_id = 0;
std::string temp_dist, temp_length, temp_duration, temp_bearing, temp_instruction;
// Fetch data from Factory and generate a string from it.
for (const SegmentInformation &segment : description_factory.path_description)
{
JSON::Array json_instruction_row;
TurnInstruction current_instruction = segment.turn_instruction;
entered_restricted_area_count += (current_instruction != segment.turn_instruction);
if (TurnInstructionsClass::TurnIsNecessary(current_instruction))
{
if (TurnInstruction::EnterRoundAbout == current_instruction)
{
round_about.name_id = segment.name_id;
round_about.start_index = necessary_segments_running_index;
}
else
{
std::string current_turn_instruction;
if (TurnInstruction::LeaveRoundAbout == current_instruction)
{
temp_instruction =
IntToString(as_integer(TurnInstruction::EnterRoundAbout));
current_turn_instruction += temp_instruction;
current_turn_instruction += "-";
temp_instruction = IntToString(round_about.leave_at_exit + 1);
current_turn_instruction += temp_instruction;
round_about.leave_at_exit = 0;
}
else
{
temp_instruction = IntToString(as_integer(current_instruction));
current_turn_instruction += temp_instruction;
}
json_instruction_row.values.push_back(current_turn_instruction);
json_instruction_row.values.push_back(
facade->GetEscapedNameForNameID(segment.name_id));
json_instruction_row.values.push_back(std::round(segment.length));
json_instruction_row.values.push_back(necessary_segments_running_index);
json_instruction_row.values.push_back(round(segment.duration / 10));
json_instruction_row.values.push_back(
UintToString(static_cast<int>(segment.length)) + "m");
const double bearing_value = (segment.bearing / 10.) ;
json_instruction_row.values.push_back(Azimuth::Get(bearing_value));
json_instruction_row.values.push_back(static_cast<unsigned>(round(bearing_value)));
route_segments_list.emplace_back(
segment.name_id, static_cast<int>(segment.length), static_cast<unsigned>(route_segments_list.size()));
json_instruction_array.values.push_back(json_instruction_row);
}
}
else if (TurnInstruction::StayOnRoundAbout == current_instruction)
{
++round_about.leave_at_exit;
}
if (segment.necessary)
{
++necessary_segments_running_index;
}
}
JSON::Array json_last_instruction_row;
temp_instruction = IntToString(as_integer(TurnInstruction::ReachedYourDestination));
json_last_instruction_row.values.push_back(temp_instruction);
json_last_instruction_row.values.push_back("");
json_last_instruction_row.values.push_back(0);
json_last_instruction_row.values.push_back(necessary_segments_running_index - 1);
json_last_instruction_row.values.push_back(0);
json_last_instruction_row.values.push_back("0m");
json_last_instruction_row.values.push_back(Azimuth::Get(0.0));
json_last_instruction_row.values.push_back(0.);
json_instruction_array.values.push_back(json_last_instruction_row);
}
};
#endif /* JSON_DESCRIPTOR_H_ */
+3
View File
@@ -0,0 +1,3 @@
The javascript based web client is a seperate project available at
https://github.com/DennisSchiefer/Project-OSRM-Web
+140
View File
@@ -0,0 +1,140 @@
/*
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"
#include "ExtractionWay.h"
#include "ScriptingEnvironment.h"
#include "../DataStructures/ImportNode.h"
#include "../Util/LuaUtil.h"
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/regex.hpp>
#include <boost/ref.hpp>
#include <boost/regex.hpp>
BaseParser::BaseParser(ExtractorCallbacks *extractor_callbacks,
ScriptingEnvironment &scripting_environment)
: extractor_callbacks(extractor_callbacks),
lua_state(scripting_environment.getLuaState()),
scripting_environment(scripting_environment), use_turn_restrictions(true)
{
ReadUseRestrictionsSetting();
ReadRestrictionExceptions();
}
void BaseParser::ReadUseRestrictionsSetting()
{
if (0 != luaL_dostring(lua_state, "return use_turn_restrictions\n"))
{
use_turn_restrictions = false;
}
else if (lua_isboolean(lua_state, -1))
{
use_turn_restrictions = lua_toboolean(lua_state, -1);
}
if (use_turn_restrictions)
{
SimpleLogger().Write() << "Using turn restrictions";
}
else
{
SimpleLogger().Write() << "Ignoring turn restrictions";
}
}
void BaseParser::ReadRestrictionExceptions()
{
if (lua_function_exists(lua_state, "get_exceptions"))
{
// get list of turn restriction exceptions
luabind::call_function<void>(
lua_state, "get_exceptions", boost::ref(restriction_exceptions));
const unsigned exception_count = restriction_exceptions.size();
SimpleLogger().Write() << "Found " << exception_count
<< " exceptions to turn restrictions:";
for (const std::string &str : restriction_exceptions)
{
SimpleLogger().Write() << " " << str;
}
}
else
{
SimpleLogger().Write() << "Found no exceptions to turn restrictions";
}
}
void BaseParser::report_errors(lua_State *lua_state, const int status) const
{
if (0 != status)
{
std::cerr << "-- " << lua_tostring(lua_state, -1) << std::endl;
lua_pop(lua_state, 1); // remove error message
}
}
void BaseParser::ParseNodeInLua(ImportNode &node, lua_State *local_lua_state)
{
luabind::call_function<void>(local_lua_state, "node_function", boost::ref(node));
}
void BaseParser::ParseWayInLua(ExtractionWay &way, lua_State *local_lua_state)
{
luabind::call_function<void>(local_lua_state, "way_function", boost::ref(way));
}
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), eg: except=bus;bicycle
// b) the lua profile defines a hierachy of modes,
// eg: [access, vehicle, bicycle]
if (except_tag_string.empty())
{
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("[;][ ]*"));
for (std::string &current_string : exceptions)
{
const auto string_iterator =
std::find(restriction_exceptions.begin(), restriction_exceptions.end(), current_string);
if (restriction_exceptions.end() != string_iterator)
{
return true;
}
}
return false;
}
+67
View File
@@ -0,0 +1,67 @@
/*
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 <string>
#include <vector>
struct lua_State;
class ExtractorCallbacks;
class ScriptingEnvironment;
struct ExtractionWay;
struct ImportNode;
class BaseParser
{
public:
BaseParser() = delete;
BaseParser(const BaseParser &) = delete;
BaseParser(ExtractorCallbacks *extractor_callbacks,
ScriptingEnvironment &scripting_environment);
virtual ~BaseParser() {}
virtual bool ReadHeader() = 0;
virtual bool Parse() = 0;
virtual void ParseNodeInLua(ImportNode &node, lua_State *lua_state);
virtual void ParseWayInLua(ExtractionWay &way, lua_State *lua_state);
virtual void report_errors(lua_State *lua_state, const int status) const;
protected:
virtual void ReadUseRestrictionsSetting();
virtual void ReadRestrictionExceptions();
virtual bool ShouldIgnoreRestriction(const std::string &except_tag_string) const;
ExtractorCallbacks *extractor_callbacks;
lua_State *lua_state;
ScriptingEnvironment &scripting_environment;
std::vector<std::string> restriction_exceptions;
bool use_turn_restrictions;
};
#endif /* BASEPARSER_H_ */
+428
View File
@@ -0,0 +1,428 @@
/*
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"
#include "ExtractionWay.h"
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
#include "../Util/TimingUtil.h"
#include "../DataStructures/RangeTable.h"
#include <boost/assert.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <stxxl/sort>
#include <chrono>
#include <limits>
ExtractionContainers::ExtractionContainers()
{
// Check if stxxl can be instantiated
stxxl::vector<unsigned> dummy_vector;
name_list.push_back("");
}
ExtractionContainers::~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 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;
std::cout << "[extractor] Sorting used nodes ... " << std::flush;
TIMER_START(sorting_used_nodes);
stxxl::sort(used_node_id_list.begin(), used_node_id_list.end(), Cmp(), stxxl_memory);
TIMER_STOP(sorting_used_nodes);
std::cout << "ok, after " << TIMER_SEC(sorting_used_nodes) << "s" << std::endl;
std::cout << "[extractor] Erasing duplicate nodes ... " << std::flush;
TIMER_START(erasing_dups);
auto new_end = std::unique(used_node_id_list.begin(), used_node_id_list.end());
used_node_id_list.resize(new_end - used_node_id_list.begin());
TIMER_STOP(erasing_dups);
std::cout << "ok, after " << TIMER_SEC(erasing_dups) << "s" << std::endl;
std::cout << "[extractor] Sorting all nodes ... " << std::flush;
TIMER_START(sorting_nodes);
stxxl::sort(all_nodes_list.begin(), all_nodes_list.end(), CmpNodeByID(), stxxl_memory);
TIMER_STOP(sorting_nodes);
std::cout << "ok, after " << TIMER_SEC(sorting_nodes) << "s" << std::endl;
std::cout << "[extractor] Sorting used ways ... " << std::flush;
TIMER_START(sort_ways);
stxxl::sort(
way_start_end_id_list.begin(), way_start_end_id_list.end(), CmpWayByID(), stxxl_memory);
TIMER_STOP(sort_ways);
std::cout << "ok, after " << TIMER_SEC(sort_ways) << "s" << std::endl;
std::cout << "[extractor] Sorting restrictions. by from... " << std::flush;
TIMER_START(sort_restrictions);
stxxl::sort(restrictions_list.begin(),
restrictions_list.end(),
CmpRestrictionContainerByFrom(),
stxxl_memory);
TIMER_STOP(sort_restrictions);
std::cout << "ok, after " << TIMER_SEC(sort_restrictions) << "s" << std::endl;
std::cout << "[extractor] Fixing restriction starts ... " << std::flush;
TIMER_START(fix_restriction_starts);
auto restrictions_iterator = restrictions_list.begin();
auto 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);
const 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;
}
TIMER_STOP(fix_restriction_starts);
std::cout << "ok, after " << TIMER_SEC(fix_restriction_starts) << "s" << std::endl;
std::cout << "[extractor] Sorting restrictions. by to ... " << std::flush;
TIMER_START(sort_restrictions_to);
stxxl::sort(restrictions_list.begin(),
restrictions_list.end(),
CmpRestrictionContainerByTo(),
stxxl_memory);
TIMER_STOP(sort_restrictions_to);
std::cout << "ok, after " << TIMER_SEC(sort_restrictions_to) << "s" << std::endl;
unsigned number_of_useable_restrictions = 0;
std::cout << "[extractor] Fixing restriction ends ... " << std::flush;
TIMER_START(fix_restriction_ends);
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 (std::numeric_limits<unsigned>::max() != restrictions_iterator->restriction.fromNode &&
std::numeric_limits<unsigned>::max() != restrictions_iterator->restriction.toNode)
{
++number_of_useable_restrictions;
}
++restrictions_iterator;
}
TIMER_STOP(fix_restriction_ends);
std::cout << "ok, after " << TIMER_SEC(fix_restriction_ends) << "s" << std::endl;
SimpleLogger().Write() << "usable restrictions: " << number_of_useable_restrictions;
// serialize restrictions
std::ofstream restrictions_out_stream;
restrictions_out_stream.open(restrictions_file_name.c_str(), std::ios::binary);
restrictions_out_stream.write((char *)&fingerprint, sizeof(FingerPrint));
restrictions_out_stream.write((char *)&number_of_useable_restrictions, sizeof(unsigned));
for(const auto & restriction_container : restrictions_list)
{
if (std::numeric_limits<unsigned>::max() != restriction_container.restriction.fromNode &&
std::numeric_limits<unsigned>::max() != restriction_container.restriction.toNode)
{
restrictions_out_stream.write((char *)&(restriction_container.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 *)&fingerprint, sizeof(FingerPrint));
file_out_stream.write((char *)&number_of_used_nodes, sizeof(unsigned));
std::cout << "[extractor] Confirming/Writing used nodes ... " << std::flush;
TIMER_START(write_nodes);
// identify all used nodes by a merging step of two sorted lists
auto node_iterator = all_nodes_list.begin();
auto 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->node_id)
{
++node_id_iterator;
continue;
}
if (*node_id_iterator > node_iterator->node_id)
{
++node_iterator;
continue;
}
BOOST_ASSERT(*node_id_iterator == node_iterator->node_id);
file_out_stream.write((char *)&(*node_iterator), sizeof(ExternalMemoryNode));
++number_of_used_nodes;
++node_id_iterator;
++node_iterator;
}
TIMER_STOP(write_nodes);
std::cout << "ok, after " << TIMER_SEC(write_nodes) << "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(FingerPrint));
file_out_stream.write((char *)&number_of_used_nodes, sizeof(unsigned));
file_out_stream.seekp(previous_file_position);
std::cout << "ok" << std::endl;
// Sort edges by start.
std::cout << "[extractor] Sorting edges by start ... " << std::flush;
TIMER_START(sort_edges_by_start);
stxxl::sort(all_edges_list.begin(), all_edges_list.end(), CmpEdgeByStartID(), stxxl_memory);
TIMER_STOP(sort_edges_by_start);
std::cout << "ok, after " << TIMER_SEC(sort_edges_by_start) << "s" << std::endl;
std::cout << "[extractor] Setting start coords ... " << std::flush;
TIMER_START(set_start_coords);
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();
auto 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->node_id)
{
++edge_iterator;
continue;
}
if (edge_iterator->start > node_iterator->node_id)
{
node_iterator++;
continue;
}
BOOST_ASSERT(edge_iterator->start == node_iterator->node_id);
edge_iterator->source_coordinate.lat = node_iterator->lat;
edge_iterator->source_coordinate.lon = node_iterator->lon;
++edge_iterator;
}
TIMER_STOP(set_start_coords);
std::cout << "ok, after " << TIMER_SEC(set_start_coords) << "s" << std::endl;
// Sort Edges by target
std::cout << "[extractor] Sorting edges by target ... " << std::flush;
TIMER_START(sort_edges_by_target);
stxxl::sort(all_edges_list.begin(), all_edges_list.end(), CmpEdgeByTargetID(), stxxl_memory);
TIMER_STOP(sort_edges_by_target);
std::cout << "ok, after " << TIMER_SEC(sort_edges_by_target) << "s" << std::endl;
std::cout << "[extractor] Setting target coords ... " << std::flush;
TIMER_START(set_target_coords);
// 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->node_id)
{
++edge_iterator;
continue;
}
if (edge_iterator->target > node_iterator->node_id)
{
++node_iterator;
continue;
}
BOOST_ASSERT(edge_iterator->target == node_iterator->node_id);
if (edge_iterator->source_coordinate.lat != std::numeric_limits<int>::min() &&
edge_iterator->source_coordinate.lon != std::numeric_limits<int>::min())
{
BOOST_ASSERT(edge_iterator->speed != -1);
BOOST_ASSERT(edge_iterator->type >= 0);
edge_iterator->target_coordinate.lat = node_iterator->lat;
edge_iterator->target_coordinate.lon = node_iterator->lon;
const double distance = FixedPointCoordinate::ApproximateEuclideanDistance(
edge_iterator->source_coordinate.lat,
edge_iterator->source_coordinate.lon,
node_iterator->lat,
node_iterator->lon);
const double weight = (distance * 10.) / (edge_iterator->speed / 3.6);
int integer_weight = std::max(
1,
(int)std::floor(
(edge_iterator->is_duration_set ? 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");
}
file_out_stream.write((char *)&integer_weight, sizeof(int));
file_out_stream.write((char *)&edge_iterator->type, sizeof(short));
file_out_stream.write((char *)&edge_iterator->name_id, sizeof(unsigned));
file_out_stream.write((char *)&edge_iterator->is_roundabout, sizeof(bool));
file_out_stream.write((char *)&edge_iterator->is_in_tiny_cc, sizeof(bool));
file_out_stream.write((char *)&edge_iterator->is_access_restricted, sizeof(bool));
file_out_stream.write((char *)&edge_iterator->is_contra_flow, sizeof(bool));
file_out_stream.write((char *)&edge_iterator->is_split, sizeof(bool));
++number_of_used_edges;
}
++edge_iterator;
}
TIMER_STOP(set_target_coords);
std::cout << "ok, after " << TIMER_SEC(set_target_coords) << "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;
std::cout << "[extractor] writing street name index ... " << std::flush;
TIMER_START(write_name_index);
std::string name_file_streamName = (output_file_name + ".names");
boost::filesystem::ofstream name_file_stream(name_file_streamName, std::ios::binary);
unsigned total_length = 0;
std::vector<unsigned> name_lengths;
for (const std::string &temp_string : name_list)
{
const unsigned string_length = std::min(static_cast<unsigned>(temp_string.length()), 255u);
name_lengths.push_back(string_length);
total_length += string_length;
}
RangeTable<> table(name_lengths);
name_file_stream << table;
name_file_stream.write((char*) &total_length, sizeof(unsigned));
// write all chars consecutively
for (const std::string &temp_string : name_list)
{
const unsigned string_length = std::min(static_cast<unsigned>(temp_string.length()), 255u);
name_file_stream.write(temp_string.c_str(), string_length);
}
name_file_stream.close();
TIMER_STOP(write_name_index);
std::cout << "ok, after " << TIMER_SEC(write_name_index) << "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; }
}
+69
View File
@@ -0,0 +1,69 @@
/*
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 "InternalExtractorEdge.h"
#include "ExtractorStructs.h"
#include "../DataStructures/Restriction.h"
#include "../Util/FingerPrint.h"
#include <stxxl/vector>
class ExtractionContainers
{
#ifndef _MSC_VER
constexpr static unsigned stxxl_memory = ((sizeof(std::size_t) == 4) ? std::numeric_limits<int>::max() : std::numeric_limits<unsigned>::max());
#else
const static unsigned stxxl_memory = ((sizeof(std::size_t) == 4) ? INT_MAX : UINT_MAX);
#endif
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 FingerPrint fingerprint;
ExtractionContainers();
virtual ~ExtractionContainers();
void PrepareData(const std::string &output_file_name,
const std::string &restrictions_file_name);
};
#endif /* EXTRACTIONCONTAINERS_H_ */
+89
View File
@@ -0,0 +1,89 @@
/*
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 EXTRACTION_HELPER_FUNCTIONS_H
#define EXTRACTION_HELPER_FUNCTIONS_H
#include "../Util/StringUtil.h"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string_regex.hpp>
#include <boost/regex.hpp>
#include <limits>
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(":"));
const 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(":"));
const bool matched = regex_match(s, e);
if (matched)
{
if (1 == result.size())
{
minutes = StringToUint(result[0]);
}
if (2 == result.size())
{
minutes = StringToUint(result[1]);
hours = StringToUint(result[0]);
}
if (3 == result.size())
{
seconds = StringToUint(result[2]);
minutes = StringToUint(result[1]);
hours = StringToUint(result[0]);
}
return 10 * (3600 * hours + 60 * minutes + seconds);
}
return std::numeric_limits<unsigned>::max();
}
#endif // EXTRACTION_HELPER_FUNCTIONS_H_
+79
View File
@@ -0,0 +1,79 @@
/*
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 EXTRACTION_WAY_H
#define EXTRACTION_WAY_H
#include "../DataStructures/HashTable.h"
#include "../typedefs.h"
#include <string>
#include <vector>
struct ExtractionWay
{
ExtractionWay() { Clear(); }
inline void Clear()
{
id = SPECIAL_NODEID;
nameID = INVALID_NAMEID;
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 };
unsigned id;
unsigned nameID;
double speed;
double backward_speed;
double duration;
Directions direction;
std::string name;
short type;
bool access;
bool roundabout;
bool isAccessRestricted;
bool ignoreInGrid;
std::vector<NodeID> path;
HashTable<std::string, std::string> keyVals;
};
#endif // EXTRACTION_WAY_H
+302
View File
@@ -0,0 +1,302 @@
/*
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 "Extractor.h"
#include "ExtractorCallbacks.h"
#include "ExtractionContainers.h"
#include "PBFParser.h"
#include "ScriptingEnvironment.h"
#include "XMLParser.h"
#include "../Util/GitDescription.h"
#include "../Util/OSRMException.h"
#include "../Util/ProgramOptions.h"
#include "../Util/SimpleLogger.h"
#include "../Util/TimingUtil.h"
#include "../typedefs.h"
#include <boost/program_options.hpp>
#include <tbb/task_scheduler_init.h>
#include <cstdlib>
#include <chrono>
#include <fstream>
#include <iostream>
#include <thread>
#include <unordered_map>
Extractor::Extractor() : requested_num_threads(0), file_has_pbf_format(false)
{
}
Extractor::~Extractor() {}
bool Extractor::ParseArguments(int argc, char *argv[])
{
// declare a group of options that will be allowed only on command line
boost::program_options::options_description generic_options("Options");
generic_options.add_options()("version,v", "Show version")("help,h", "Show this help message")(
"config,c",
boost::program_options::value<boost::filesystem::path>(&config_file_path)
->default_value("extractor.ini"),
"Path to a configuration file.");
// declare a group of options that will be allowed both on command line and in config file
boost::program_options::options_description config_options("Configuration");
config_options.add_options()("profile,p",
boost::program_options::value<boost::filesystem::path>(
&profile_path)->default_value("profile.lua"),
"Path to LUA routing profile")(
"threads,t",
boost::program_options::value<unsigned int>(&requested_num_threads)
->default_value(tbb::task_scheduler_init::default_num_threads()),
"Number of threads to use");
// hidden options, will be allowed both on command line and in config file, but will not be
// shown to the user
boost::program_options::options_description hidden_options("Hidden options");
hidden_options.add_options()(
"input,i",
boost::program_options::value<boost::filesystem::path>(&input_path),
"Input file in .osm, .osm.bz2 or .osm.pbf format");
// positional option
boost::program_options::positional_options_description positional_options;
positional_options.add("input", 1);
// combine above options for parsing
boost::program_options::options_description cmdline_options;
cmdline_options.add(generic_options).add(config_options).add(hidden_options);
boost::program_options::options_description config_file_options;
config_file_options.add(config_options).add(hidden_options);
boost::program_options::options_description visible_options(
boost::filesystem::basename(argv[0]) + " <input.osm/.osm.bz2/.osm.pbf> [options]");
visible_options.add(generic_options).add(config_options);
// parse command line options
boost::program_options::variables_map option_variables;
boost::program_options::store(boost::program_options::command_line_parser(argc, argv)
.options(cmdline_options)
.positional(positional_options)
.run(),
option_variables);
if (option_variables.count("version"))
{
SimpleLogger().Write() << g_GIT_DESCRIPTION;
return false;
}
if (option_variables.count("help"))
{
SimpleLogger().Write() << visible_options;
return false;
}
boost::program_options::notify(option_variables);
// parse config file
if (boost::filesystem::is_regular_file(config_file_path))
{
SimpleLogger().Write() << "Reading options from: " << config_file_path.string();
std::string ini_file_contents = ReadIniFileAndLowerContents(config_file_path);
std::stringstream config_stream(ini_file_contents);
boost::program_options::store(parse_config_file(config_stream, config_file_options),
option_variables);
boost::program_options::notify(option_variables);
}
if (!option_variables.count("input"))
{
SimpleLogger().Write() << visible_options;
return false;
}
return true;
}
void Extractor::GenerateOutputFilesNames()
{
output_file_name = input_path.string();
restriction_file_name = input_path.string();
std::string::size_type pos = output_file_name.find(".osm.bz2");
if (pos == std::string::npos)
{
pos = output_file_name.find(".osm.pbf");
if (pos != std::string::npos)
{
file_has_pbf_format = true;
}
else
{
pos = output_file_name.find(".osm.xml");
}
}
if (pos == std::string::npos)
{
pos = output_file_name.find(".pbf");
if (pos != std::string::npos)
{
file_has_pbf_format = true;
}
}
if (pos == std::string::npos)
{
pos = output_file_name.find(".osm");
if (pos == std::string::npos)
{
output_file_name.append(".osrm");
restriction_file_name.append(".osrm.restrictions");
}
else
{
output_file_name.replace(pos, 5, ".osrm");
restriction_file_name.replace(pos, 5, ".osrm.restrictions");
}
}
else
{
output_file_name.replace(pos, 8, ".osrm");
restriction_file_name.replace(pos, 8, ".osrm.restrictions");
}
}
int Extractor::Run(int argc, char *argv[])
{
try
{
LogPolicy::GetInstance().Unmute();
TIMER_START(extracting);
if (!ParseArguments(argc, argv))
return 0;
if (1 > requested_num_threads)
{
SimpleLogger().Write(logWARNING) << "Number of threads must be 1 or larger";
return 1;
}
if (!boost::filesystem::is_regular_file(input_path))
{
SimpleLogger().Write(logWARNING) << "Input file " << input_path.string()
<< " not found!";
return 1;
}
if (!boost::filesystem::is_regular_file(profile_path))
{
SimpleLogger().Write(logWARNING) << "Profile " << profile_path.string()
<< " not found!";
return 1;
}
const unsigned recommended_num_threads = tbb::task_scheduler_init::default_num_threads();
SimpleLogger().Write() << "Input file: " << input_path.filename().string();
SimpleLogger().Write() << "Profile: " << profile_path.filename().string();
SimpleLogger().Write() << "Threads: " << requested_num_threads;
if (recommended_num_threads != requested_num_threads)
{
SimpleLogger().Write(logWARNING) << "The recommended number of threads is "
<< recommended_num_threads
<< "! This setting may have performance side-effects.";
}
tbb::task_scheduler_init init(requested_num_threads);
/*** Setup Scripting Environment ***/
ScriptingEnvironment scripting_environment(profile_path.string().c_str());
GenerateOutputFilesNames();
std::unordered_map<std::string, NodeID> string_map;
ExtractionContainers extraction_containers;
string_map[""] = 0;
auto extractor_callbacks = new ExtractorCallbacks(extraction_containers, string_map);
BaseParser *parser;
if (file_has_pbf_format)
{
parser = new PBFParser(input_path.string().c_str(),
extractor_callbacks,
scripting_environment,
requested_num_threads);
}
else
{
parser = new XMLParser(input_path.string().c_str(),
extractor_callbacks,
scripting_environment);
}
if (!parser->ReadHeader())
{
throw OSRMException("Parser not initialized!");
}
SimpleLogger().Write() << "Parsing in progress..";
TIMER_START(parsing);
parser->Parse();
delete parser;
delete extractor_callbacks;
TIMER_STOP(parsing);
SimpleLogger().Write() << "Parsing finished after " << TIMER_SEC(parsing) << " seconds";
if (extraction_containers.all_edges_list.empty())
{
SimpleLogger().Write(logWARNING) << "The input data is empty, exiting.";
return 1;
}
extraction_containers.PrepareData(output_file_name, restriction_file_name);
TIMER_STOP(extracting);
SimpleLogger().Write() << "extraction finished after " << TIMER_SEC(extracting) << "s";
SimpleLogger().Write() << "To prepare the data for routing, run: "
<< "./osrm-prepare " << output_file_name << std::endl;
}
catch (boost::program_options::too_many_positional_options_error &)
{
SimpleLogger().Write(logWARNING) << "Only one input file can be specified";
return 1;
}
catch (std::exception &e)
{
SimpleLogger().Write(logWARNING) << e.what();
return 1;
}
return 0;
}
+36
View File
@@ -0,0 +1,36 @@
#ifndef EXTRACTOR_H_
#define EXTRACTOR_H_
#include <boost/filesystem.hpp>
#include <string>
class ExtractorCallbacks;
/** \brief Class of 'extract' utility. */
class Extractor
{
protected:
unsigned requested_num_threads;
boost::filesystem::path config_file_path;
boost::filesystem::path input_path;
boost::filesystem::path profile_path;
std::string output_file_name;
std::string restriction_file_name;
bool file_has_pbf_format;
/** \brief Parses "extractor's" command line arguments */
bool ParseArguments(int argc, char *argv[]);
/** \brief Parses config file, if present in options */
void GenerateOutputFilesNames();
public:
explicit Extractor();
Extractor(const Extractor &) = delete;
virtual ~Extractor();
int Run(int argc, char *argv[]);
};
#endif /* EXTRACTOR_H_ */
+171
View File
@@ -0,0 +1,171 @@
/*
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"
#include "ExtractionContainers.h"
#include "ExtractionWay.h"
#include "../DataStructures/Restriction.h"
#include "../DataStructures/ImportNode.h"
#include "../Util/SimpleLogger.h"
#include <osrm/Coordinate.h>
#include <limits>
#include <string>
#include <vector>
ExtractorCallbacks::ExtractorCallbacks(ExtractionContainers &extraction_containers,
std::unordered_map<std::string, NodeID> &string_map)
: string_map(string_map), external_memory(extraction_containers)
{
}
/** warning: caller needs to take care of synchronization! */
void ExtractorCallbacks::ProcessNode(const ExternalMemoryNode &n)
{
if (n.lat <= 85 * COORDINATE_PRECISION && n.lat >= -85 * COORDINATE_PRECISION)
{
external_memory.all_nodes_list.push_back(n);
}
}
bool ExtractorCallbacks::ProcessRestriction(const InputRestrictionContainer &restriction)
{
external_memory.restrictions_list.push_back(restriction);
return true;
}
/** warning: caller needs to take care of synchronization! */
void ExtractorCallbacks::ProcessWay(ExtractionWay &parsed_way)
{
if ((0 >= parsed_way.speed) && (0 >= parsed_way.duration))
{ // Only true if the way is specified by the speed profile
return;
}
if (parsed_way.path.size() <= 1)
{ // safe-guard against broken data
return;
}
if (std::numeric_limits<unsigned>::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() >= std::abs(-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 auto &string_map_iterator = string_map.find(parsed_way.name);
if (string_map.end() == string_map_iterator)
{
parsed_way.nameID = external_memory.name_list.size();
external_memory.name_list.push_back(parsed_way.name);
string_map.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_edge =
(parsed_way.backward_speed > 0) && (parsed_way.speed != parsed_way.backward_speed);
for (unsigned n = 0; n < (parsed_way.path.size() - 1); ++n)
{
external_memory.all_edges_list.push_back(InternalExtractorEdge(
parsed_way.path[n],
parsed_way.path[n + 1],
parsed_way.type,
(split_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,
false,
split_edge));
external_memory.used_node_id_list.push_back(parsed_way.path[n]);
}
external_memory.used_node_id_list.push_back(parsed_way.path.back());
// The following information is needed to identify start and end segments of restrictions
external_memory.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_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)
{
external_memory.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),
split_edge));
}
external_memory.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()));
}
}
+63
View File
@@ -0,0 +1,63 @@
/*
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 EXTRACTOR_CALLBACKS_H
#define EXTRACTOR_CALLBACKS_H
#include "../typedefs.h"
#include <unordered_map>
#include <string>
struct ExternalMemoryNode;
class ExtractionContainers;
struct ExtractionWay;
struct InputRestrictionContainer;
class ExtractorCallbacks
{
private:
std::unordered_map<std::string, NodeID> &string_map;
ExtractionContainers &external_memory;
public:
ExtractorCallbacks() = delete;
ExtractorCallbacks(const ExtractorCallbacks &) = delete;
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers,
std::unordered_map<std::string, NodeID> &string_map);
// warning: caller needs to take care of synchronization!
void ProcessNode(const ExternalMemoryNode &node);
// warning: caller needs to take care of synchronization!
bool ProcessRestriction(const InputRestrictionContainer &restriction);
// warning: caller needs to take care of synchronization!
void ProcessWay(ExtractionWay &way);
};
#endif /* EXTRACTOR_CALLBACKS_H */
+114
View File
@@ -0,0 +1,114 @@
/*
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/HashTable.h"
#include "../DataStructures/ImportNode.h"
#include "../typedefs.h"
#include <limits>
#include <string>
struct ExtractorRelation
{
ExtractorRelation() : type(unknown) {}
enum
{ unknown = 0,
ferry,
turnRestriction } type;
HashTable<std::string, std::string> keyVals;
};
struct WayIDStartAndEndEdge
{
unsigned wayID;
NodeID firstStart;
NodeID firstTarget;
NodeID lastStart;
NodeID lastTarget;
WayIDStartAndEndEdge()
: wayID(std::numeric_limits<unsigned>::max()), firstStart(std::numeric_limits<unsigned>::max()), firstTarget(std::numeric_limits<unsigned>::max()), lastStart(std::numeric_limits<unsigned>::max()),
lastTarget(std::numeric_limits<unsigned>::max())
{
}
explicit 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
{
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
{
typedef NodeID value_type;
bool operator()(const NodeID left, const NodeID right) const { return left < right; }
value_type max_value() { return 0xffffffff; }
value_type min_value() { return 0x0; }
};
struct CmpNodeByID
{
typedef ExternalMemoryNode value_type;
bool operator()(const ExternalMemoryNode &left, const ExternalMemoryNode &right) const
{
return left.node_id < right.node_id;
}
value_type max_value() { return ExternalMemoryNode::max_value(); }
value_type min_value() { return ExternalMemoryNode::min_value(); }
};
#endif /* EXTRACTORSTRUCTS_H_ */
+120
View File
@@ -0,0 +1,120 @@
/*
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_EXTRACTOR_EDGE_H
#define INTERNAL_EXTRACTOR_EDGE_H
#include "../typedefs.h"
#include <osrm/Coordinate.h>
#include <boost/assert.hpp>
struct InternalExtractorEdge
{
InternalExtractorEdge()
: start(0), target(0), type(0), direction(0), speed(0), name_id(0), is_roundabout(false),
is_in_tiny_cc(false), is_duration_set(false), is_access_restricted(false),
is_contra_flow(false), is_split(false)
{
}
explicit InternalExtractorEdge(NodeID start,
NodeID target,
short type,
short direction,
double speed,
unsigned name_id,
bool is_roundabout,
bool is_in_tiny_cc,
bool is_duration_set,
bool is_access_restricted,
bool is_contra_flow,
bool is_split)
: start(start), target(target), type(type), direction(direction), speed(speed),
name_id(name_id), is_roundabout(is_roundabout), is_in_tiny_cc(is_in_tiny_cc),
is_duration_set(is_duration_set), is_access_restricted(is_access_restricted),
is_contra_flow(is_contra_flow), is_split(is_split)
{
BOOST_ASSERT(0 <= type);
}
// necessary static util functions for stxxl's sorting
static InternalExtractorEdge min_value()
{
return InternalExtractorEdge(0, 0, 0, 0, 0, 0, false, false, false, false, false, false);
}
static InternalExtractorEdge max_value()
{
return InternalExtractorEdge(
SPECIAL_NODEID, SPECIAL_NODEID, 0, 0, 0, 0, false, false, false, false, false, false);
}
NodeID start;
NodeID target;
short type;
short direction;
double speed;
unsigned name_id;
bool is_roundabout;
bool is_in_tiny_cc;
bool is_duration_set;
bool is_access_restricted;
bool is_contra_flow;
bool is_split;
FixedPointCoordinate source_coordinate;
FixedPointCoordinate target_coordinate;
};
struct CmpEdgeByStartID
{
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
{
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(); }
};
#endif // INTERNAL_EXTRACTOR_EDGE_H
+664
View File
@@ -0,0 +1,664 @@
/*
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"
#include "ExtractionWay.h"
#include "ExtractorCallbacks.h"
#include "ScriptingEnvironment.h"
#include "../DataStructures/HashTable.h"
#include "../DataStructures/ImportNode.h"
#include "../DataStructures/Restriction.h"
#include "../Util/MachineInfo.h"
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
#include "../typedefs.h"
#include <boost/assert.hpp>
#include <tbb/parallel_for.h>
#include <tbb/task_scheduler_init.h>
#include <osrm/Coordinate.h>
#include <zlib.h>
#include <functional>
#include <limits>
#include <thread>
PBFParser::PBFParser(const char *fileName,
ExtractorCallbacks *extractor_callbacks,
ScriptingEnvironment &scripting_environment,
unsigned num_threads)
: BaseParser(extractor_callbacks, scripting_environment)
{
if (0 == num_threads)
{
num_parser_threads = tbb::task_scheduler_init::default_num_threads();
}
else
{
num_parser_threads = num_threads;
}
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.
// Max 2500 items in queue, hardcoded.
thread_data_queue = std::make_shared<ConcurrentQueue<ParserThreadData *>>(2500);
input.open(fileName, std::ios::in | std::ios::binary);
if (!input)
{
throw OSRMException("pbf file not found.");
}
block_count = 0;
group_count = 0;
}
PBFParser::~PBFParser()
{
if (input.is_open())
{
input.close();
}
// Clean up any leftover ThreadData objects in the queue
ParserThreadData *thread_data;
while (thread_data_queue->try_pop(thread_data))
{
delete thread_data;
}
google::protobuf::ShutdownProtobufLibrary();
SimpleLogger().Write(logDEBUG) << "parsed " << block_count << " blocks from pbf with "
<< group_count << " groups";
}
inline bool PBFParser::ReadHeader()
{
ParserThreadData init_data;
/** read Header */
if (!readPBFBlobHeader(input, &init_data))
{
return false;
}
if (readBlob(input, &init_data))
{
if (!init_data.PBFHeaderBlock.ParseFromArray(&(init_data.charBuffer[0]),
static_cast<int>(init_data.charBuffer.size())))
{
std::cerr << "[error] Header not parseable!" << std::endl;
return false;
}
const auto feature_size = init_data.PBFHeaderBlock.required_features_size();
for (int i = 0; i < feature_size; ++i)
{
const std::string &feature = init_data.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 keep_running = true;
do
{
ParserThreadData *thread_data = new ParserThreadData();
keep_running = readNextBlock(input, thread_data);
if (keep_running)
{
thread_data_queue->push(thread_data);
}
else
{
// No more data to read, parse stops when nullptr encountered
thread_data_queue->push(nullptr);
delete thread_data;
}
} while (keep_running);
}
inline void PBFParser::ParseData()
{
tbb::task_scheduler_init init(num_parser_threads);
while (true)
{
ParserThreadData *thread_data;
thread_data_queue->wait_and_pop(thread_data);
if (nullptr == thread_data)
{
thread_data_queue->push(nullptr); // Signal end of data for other threads
break;
}
loadBlock(thread_data);
int group_size = thread_data->PBFprimitiveBlock.primitivegroup_size();
for (int i = 0; i < group_size; ++i)
{
thread_data->currentGroupID = i;
loadGroup(thread_data);
if (thread_data->entityTypeIndicator == TypeNode)
{
parseNode(thread_data);
}
if (thread_data->entityTypeIndicator == TypeWay)
{
parseWay(thread_data);
}
if (thread_data->entityTypeIndicator == TypeRelation)
{
parseRelation(thread_data);
}
if (thread_data->entityTypeIndicator == TypeDenseNode)
{
parseDenseNode(thread_data);
}
}
delete thread_data;
thread_data = nullptr;
}
}
inline bool PBFParser::Parse()
{
// Start the read and parse threads
std::thread read_thread(std::bind(&PBFParser::ReadData, this));
// Open several parse threads that are synchronized before call to
std::thread parse_thread(std::bind(&PBFParser::ParseData, this));
// Wait for the threads to finish
read_thread.join();
parse_thread.join();
return true;
}
inline void PBFParser::parseDenseNode(ParserThreadData *thread_data)
{
const OSMPBF::DenseNodes &dense =
thread_data->PBFprimitiveBlock.primitivegroup(thread_data->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].node_id = static_cast<NodeID>(m_lastDenseID);
extracted_nodes_vector[i].lat = static_cast<int>(
COORDINATE_PRECISION *
((double)m_lastDenseLatitude * thread_data->PBFprimitiveBlock.granularity() +
thread_data->PBFprimitiveBlock.lat_offset()) /
NANO);
extracted_nodes_vector[i].lon = static_cast<int>(
COORDINATE_PRECISION *
((double)m_lastDenseLongitude * thread_data->PBFprimitiveBlock.granularity() +
thread_data->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 = thread_data->PBFprimitiveBlock.stringtable().s(tagValue);
const std::string &value = thread_data->PBFprimitiveBlock.stringtable().s(keyValue);
extracted_nodes_vector[i].keyVals.Add(std::move(key), std::move(value));
denseTagIndex += 2;
}
}
tbb::parallel_for(tbb::blocked_range<size_t>(0, extracted_nodes_vector.size()),
[this, &extracted_nodes_vector](const tbb::blocked_range<size_t> &range)
{
lua_State *lua_state = this->scripting_environment.getLuaState();
for (size_t i = range.begin(); i != range.end(); ++i)
{
ImportNode &import_node = extracted_nodes_vector[i];
ParseNodeInLua(import_node, lua_state);
}
});
for (const ImportNode &import_node : extracted_nodes_vector)
{
extractor_callbacks->ProcessNode(import_node);
}
}
inline void PBFParser::parseNode(ParserThreadData *)
{
throw OSRMException("Parsing of simple nodes not supported. PBF should use dense nodes");
}
inline void PBFParser::parseRelation(ParserThreadData *thread_data)
{
// TODO: leave early, if relation is not a restriction
// TODO: reuse rawRestriction container
if (!use_turn_restrictions)
{
return;
}
const OSMPBF::PrimitiveGroup &group =
thread_data->PBFprimitiveBlock.primitivegroup(thread_data->currentGroupID);
for (int i = 0, relation_size = group.relations_size(); i < relation_size; ++i)
{
std::string except_tag_string;
const OSMPBF::Relation &inputRelation =
thread_data->PBFprimitiveBlock.primitivegroup(thread_data->currentGroupID).relations(i);
bool is_restriction = false;
bool is_only_restriction = false;
for (int k = 0, endOfKeys = inputRelation.keys_size(); k < endOfKeys; ++k)
{
const std::string &key =
thread_data->PBFprimitiveBlock.stringtable().s(inputRelation.keys(k));
const std::string &val =
thread_data->PBFprimitiveBlock.stringtable().s(inputRelation.vals(k));
if ("type" == key)
{
if ("restriction" == val)
{
is_restriction = true;
}
else
{
break;
}
}
if (("restriction" == key) && (val.find("only_") == 0))
{
is_only_restriction = true;
}
if ("except" == key)
{
except_tag_string = val;
}
}
if (is_restriction && ShouldIgnoreRestriction(except_tag_string))
{
continue;
}
if (is_restriction)
{
int64_t last_ref = 0;
InputRestrictionContainer current_restriction_container(is_only_restriction);
for (int rolesIndex = 0, last_role = inputRelation.roles_sid_size();
rolesIndex < last_role;
++rolesIndex)
{
const std::string &role = thread_data->PBFprimitiveBlock.stringtable().s(
inputRelation.roles_sid(rolesIndex));
last_ref += 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;
}
BOOST_ASSERT("via" == role);
if (std::numeric_limits<unsigned>::max() !=
current_restriction_container.viaNode)
{
current_restriction_container.viaNode =
std::numeric_limits<unsigned>::max();
}
BOOST_ASSERT(std::numeric_limits<unsigned>::max() ==
current_restriction_container.viaNode);
current_restriction_container.restriction.viaNode =
static_cast<NodeID>(last_ref);
break;
case 1: // way
BOOST_ASSERT("from" == role || "to" == role || "via" == role);
if ("from" == role)
{
current_restriction_container.fromWay = static_cast<EdgeID>(last_ref);
}
if ("to" == role)
{
current_restriction_container.toWay = static_cast<EdgeID>(last_ref);
}
if ("via" == role)
{
BOOST_ASSERT(current_restriction_container.restriction.toNode ==
std::numeric_limits<unsigned>::max());
current_restriction_container.viaNode = static_cast<NodeID>(last_ref);
}
break;
case 2: // relation, not used. relations relating to relations are evil.
continue;
BOOST_ASSERT(false);
break;
default: // should not happen
BOOST_ASSERT(false);
break;
}
}
if (!extractor_callbacks->ProcessRestriction(current_restriction_container))
{
std::cerr << "[PBFParser] relation not parsed" << std::endl;
}
}
}
}
inline void PBFParser::parseWay(ParserThreadData *thread_data)
{
const int number_of_ways =
thread_data->PBFprimitiveBlock.primitivegroup(thread_data->currentGroupID).ways_size();
std::vector<ExtractionWay> parsed_way_vector(number_of_ways);
for (int i = 0; i < number_of_ways; ++i)
{
const OSMPBF::Way &input_way =
thread_data->PBFprimitiveBlock.primitivegroup(thread_data->currentGroupID).ways(i);
parsed_way_vector[i].id = static_cast<EdgeID>(input_way.id());
unsigned node_id_in_path = 0;
const auto number_of_referenced_nodes = input_way.refs_size();
for (auto j = 0; j < number_of_referenced_nodes; ++j)
{
node_id_in_path += static_cast<NodeID>(input_way.refs(j));
parsed_way_vector[i].path.push_back(node_id_in_path);
}
BOOST_ASSERT(input_way.keys_size() == input_way.vals_size());
const auto number_of_keys = input_way.keys_size();
for (auto j = 0; j < number_of_keys; ++j)
{
const std::string &key =
thread_data->PBFprimitiveBlock.stringtable().s(input_way.keys(j));
const std::string &val =
thread_data->PBFprimitiveBlock.stringtable().s(input_way.vals(j));
parsed_way_vector[i].keyVals.Add(std::move(key), std::move(val));
}
}
// TODO: investigate if schedule guided will be handled by tbb automatically
tbb::parallel_for(tbb::blocked_range<size_t>(0, parsed_way_vector.size()),
[this, &parsed_way_vector](const tbb::blocked_range<size_t> &range)
{
lua_State *lua_state = this->scripting_environment.getLuaState();
for (size_t i = range.begin(); i != range.end(); i++)
{
ExtractionWay &extraction_way = parsed_way_vector[i];
if (2 <= extraction_way.path.size())
{
ParseWayInLua(extraction_way, lua_state);
}
}
});
for (ExtractionWay &extraction_way : parsed_way_vector)
{
if (2 <= extraction_way.path.size())
{
extractor_callbacks->ProcessWay(extraction_way);
}
}
}
inline void PBFParser::loadGroup(ParserThreadData *thread_data)
{
#ifndef NDEBUG
++group_count;
#endif
const OSMPBF::PrimitiveGroup &group =
thread_data->PBFprimitiveBlock.primitivegroup(thread_data->currentGroupID);
thread_data->entityTypeIndicator = TypeDummy;
if (0 != group.nodes_size())
{
thread_data->entityTypeIndicator = TypeNode;
}
if (0 != group.ways_size())
{
thread_data->entityTypeIndicator = TypeWay;
}
if (0 != group.relations_size())
{
thread_data->entityTypeIndicator = TypeRelation;
}
if (group.has_dense())
{
thread_data->entityTypeIndicator = TypeDenseNode;
BOOST_ASSERT(0 != group.dense().id_size());
}
BOOST_ASSERT(thread_data->entityTypeIndicator != TypeDummy);
}
inline void PBFParser::loadBlock(ParserThreadData *thread_data)
{
++block_count;
thread_data->currentGroupID = 0;
thread_data->currentEntityID = 0;
}
inline bool PBFParser::readPBFBlobHeader(std::fstream &stream, ParserThreadData *thread_data)
{
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 = (thread_data->PBFBlobHeader).ParseFromArray(data, size);
delete[] data;
return dataSuccessfullyParsed;
}
inline bool PBFParser::unpackZLIB(ParserThreadData *thread_data)
{
auto raw_size = thread_data->PBFBlob.raw_size();
char *unpacked_data_array = new char[raw_size];
z_stream compressed_data_stream;
compressed_data_stream.next_in = (unsigned char *)thread_data->PBFBlob.zlib_data().data();
compressed_data_stream.avail_in = thread_data->PBFBlob.zlib_data().size();
compressed_data_stream.next_out = (unsigned char *)unpacked_data_array;
compressed_data_stream.avail_out = raw_size;
compressed_data_stream.zalloc = Z_NULL;
compressed_data_stream.zfree = Z_NULL;
compressed_data_stream.opaque = Z_NULL;
int return_code = inflateInit(&compressed_data_stream);
if (return_code != Z_OK)
{
std::cerr << "[error] failed to init zlib stream" << std::endl;
delete[] unpacked_data_array;
return false;
}
return_code = inflate(&compressed_data_stream, Z_FINISH);
if (return_code != Z_STREAM_END)
{
std::cerr << "[error] failed to inflate zlib stream" << std::endl;
std::cerr << "[error] Error type: " << return_code << std::endl;
delete[] unpacked_data_array;
return false;
}
return_code = inflateEnd(&compressed_data_stream);
if (return_code != Z_OK)
{
std::cerr << "[error] failed to deinit zlib stream" << std::endl;
delete[] unpacked_data_array;
return false;
}
thread_data->charBuffer.clear();
thread_data->charBuffer.resize(raw_size);
std::copy(unpacked_data_array, unpacked_data_array + raw_size, thread_data->charBuffer.begin());
delete[] unpacked_data_array;
return true;
}
inline bool PBFParser::unpackLZMA(ParserThreadData *) { return false; }
inline bool PBFParser::readBlob(std::fstream &stream, ParserThreadData *thread_data)
{
if (stream.eof())
{
return false;
}
const int size = thread_data->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 (!thread_data->PBFBlob.ParseFromArray(data, size))
{
std::cerr << "[error] failed to parse blob" << std::endl;
delete[] data;
return false;
}
if (thread_data->PBFBlob.has_raw())
{
const std::string &data = thread_data->PBFBlob.raw();
thread_data->charBuffer.clear();
thread_data->charBuffer.resize(data.size());
std::copy(data.begin(), data.end(), thread_data->charBuffer.begin());
}
else if (thread_data->PBFBlob.has_zlib_data())
{
if (!unpackZLIB(thread_data))
{
std::cerr << "[error] zlib data encountered that could not be unpacked" << std::endl;
delete[] data;
return false;
}
}
else if (thread_data->PBFBlob.has_lzma_data())
{
if (!unpackLZMA(thread_data))
{
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, ParserThreadData *thread_data)
{
if (stream.eof())
{
return false;
}
if (!readPBFBlobHeader(stream, thread_data))
{
return false;
}
if (thread_data->PBFBlobHeader.type() != "OSMData")
{
return false;
}
if (!readBlob(stream, thread_data))
{
return false;
}
if (!thread_data->PBFprimitiveBlock.ParseFromArray(&(thread_data->charBuffer[0]),
thread_data->charBuffer.size()))
{
std::cerr << "failed to parse PrimitiveBlock" << std::endl;
return false;
}
return true;
}
+103
View File
@@ -0,0 +1,103 @@
/*
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/ConcurrentQueue.h"
#include <osmpbf/fileformat.pb.h>
#include <osmpbf/osmformat.pb.h>
#include <fstream>
#include <memory>
class PBFParser : public BaseParser
{
enum EntityType
{ TypeDummy = 0,
TypeNode = 1,
TypeWay = 2,
TypeRelation = 4,
TypeDenseNode = 8 };
struct ParserThreadData
{
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 *file_name,
ExtractorCallbacks *extractor_callbacks,
ScriptingEnvironment &scripting_environment,
unsigned num_parser_threads = 0);
virtual ~PBFParser();
inline bool ReadHeader();
inline bool Parse();
private:
inline void ReadData();
inline void ParseData();
inline void parseDenseNode(ParserThreadData *thread_data);
inline void parseNode(ParserThreadData *thread_data);
inline void parseRelation(ParserThreadData *thread_data);
inline void parseWay(ParserThreadData *thread_data);
inline void loadGroup(ParserThreadData *thread_data);
inline void loadBlock(ParserThreadData *thread_data);
inline bool readPBFBlobHeader(std::fstream &stream, ParserThreadData *thread_data);
inline bool unpackZLIB(ParserThreadData *thread_data);
inline bool unpackLZMA(ParserThreadData *thread_data);
inline bool readBlob(std::fstream &stream, ParserThreadData *thread_data);
inline bool readNextBlock(std::fstream &stream, ParserThreadData *thread_data);
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;
unsigned group_count;
unsigned block_count;
std::fstream input; // the input stream to parse
std::shared_ptr<ConcurrentQueue<ParserThreadData *>> thread_data_queue;
unsigned num_parser_threads;
};
#endif /* PBFPARSER_H_ */
+121
View File
@@ -0,0 +1,121 @@
/*
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"
#include "ExtractionHelperFunctions.h"
#include "ExtractionWay.h"
#include "../DataStructures/ImportNode.h"
#include "../Util/LuaUtil.h"
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
#include "../typedefs.h"
#include <sstream>
ScriptingEnvironment::ScriptingEnvironment() {}
ScriptingEnvironment::ScriptingEnvironment(const char *file_name)
: file_name(file_name)
{
SimpleLogger().Write() << "Using script " << file_name;
}
void ScriptingEnvironment::initLuaState(lua_State* lua_state)
{
luabind::open(lua_state);
// open utility libraries string library;
luaL_openlibs(lua_state);
luaAddScriptFolderToLoadPath(lua_state, file_name.c_str());
// Add our function to the state's global scope
luabind::module(lua_state)[
luabind::def("print", LUA_print<std::string>),
luabind::def("durationIsValid", durationIsValid),
luabind::def("parseDuration", parseDuration),
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::class_<ImportNode>("Node")
// .def(luabind::constructor<>())
.def_readwrite("lat", &ImportNode::lat)
.def_readwrite("lon", &ImportNode::lon)
.def_readonly("id", &ImportNode::node_id)
.def_readwrite("bollard", &ImportNode::bollard)
.def_readwrite("traffic_light", &ImportNode::trafficLight)
.def_readwrite("tags", &ImportNode::keyVals),
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)
],
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(lua_state, file_name.c_str()))
{
luabind::object error_msg(luabind::from_stack(lua_state, -1));
std::ostringstream error_stream;
error_stream << error_msg;
throw OSRMException("ERROR occured in profile script:\n" + error_stream.str());
}
}
lua_State *ScriptingEnvironment::getLuaState()
{
bool initialized = false;
auto& ref = script_contexts.local(initialized);
if (!initialized)
{
std::shared_ptr<lua_State> state(luaL_newstate(), lua_close);
ref = state;
initLuaState(ref.get());
}
return ref.get();
}
+52
View File
@@ -0,0 +1,52 @@
/*
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 <string>
#include <memory>
#include <tbb/enumerable_thread_specific.h>
struct lua_State;
class ScriptingEnvironment
{
public:
ScriptingEnvironment();
explicit ScriptingEnvironment(const char *file_name);
lua_State *getLuaState();
private:
void initLuaState(lua_State* lua_state);
std::string file_name;
tbb::enumerable_thread_specific<std::shared_ptr<lua_State>> script_contexts;
};
#endif /* SCRIPTINGENVIRONMENT_H_ */
+353
View File
@@ -0,0 +1,353 @@
/*
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 "ExtractionWay.h"
#include "ExtractorCallbacks.h"
#include "../DataStructures/HashTable.h"
#include "../DataStructures/ImportNode.h"
#include "../DataStructures/InputReaderFactory.h"
#include "../DataStructures/Restriction.h"
#include "../Util/SimpleLogger.h"
#include "../Util/StringUtil.h"
#include "../typedefs.h"
#include <osrm/Coordinate.h>
XMLParser::XMLParser(const char *filename,
ExtractorCallbacks *extractor_callbacks,
ScriptingEnvironment &scripting_environment)
: BaseParser(extractor_callbacks, scripting_environment)
{
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 == nullptr)
{
continue;
}
if (xmlStrEqual(currentName, (const xmlChar *)"node") == 1)
{
ImportNode current_node = ReadXMLNode();
ParseNodeInLua(current_node, lua_state);
extractor_callbacks->ProcessNode(current_node);
}
if (xmlStrEqual(currentName, (const xmlChar *)"way") == 1)
{
ExtractionWay way = ReadXMLWay();
ParseWayInLua(way, lua_state);
extractor_callbacks->ProcessWay(way);
}
if (use_turn_restrictions && xmlStrEqual(currentName, (const xmlChar *)"relation") == 1)
{
InputRestrictionContainer current_restriction = ReadXMLRestriction();
if ((UINT_MAX != current_restriction.fromWay) &&
!extractor_callbacks->ProcessRestriction(current_restriction))
{
std::cerr << "[XMLParser] restriction not parsed" << std::endl;
}
}
xmlFree(currentName);
}
return true;
}
InputRestrictionContainer XMLParser::ReadXMLRestriction()
{
InputRestrictionContainer restriction;
if (xmlTextReaderIsEmptyElement(inputReader) == 1)
{
return restriction;
}
std::string except_tag_string;
const int depth = xmlTextReaderDepth(inputReader);
while (xmlTextReaderRead(inputReader) == 1)
{
const int child_type = xmlTextReaderNodeType(inputReader);
if (child_type != 1 && child_type != 15)
{
continue;
}
const int child_depth = xmlTextReaderDepth(inputReader);
xmlChar *child_name = xmlTextReaderName(inputReader);
if (child_name == nullptr)
{
continue;
}
if (depth == child_depth && child_type == 15 &&
xmlStrEqual(child_name, (const xmlChar *)"relation") == 1)
{
xmlFree(child_name);
break;
}
if (child_type != 1)
{
xmlFree(child_name);
continue;
}
if (xmlStrEqual(child_name, (const xmlChar *)"tag") == 1)
{
xmlChar *key = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"k");
xmlChar *value = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"v");
if (key != nullptr && value != nullptr)
{
if (xmlStrEqual(key, (const xmlChar *)"restriction") &&
StringStartsWith((const char *)value, "only_"))
{
restriction.restriction.flags.isOnly = true;
}
if (xmlStrEqual(key, (const xmlChar *)"except"))
{
except_tag_string = (const char *)value;
}
}
if (key != nullptr)
{
xmlFree(key);
}
if (value != nullptr)
{
xmlFree(value);
}
}
else if (xmlStrEqual(child_name, (const xmlChar *)"member") == 1)
{
xmlChar *ref = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"ref");
if (ref != nullptr)
{
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 (nullptr != type)
{
xmlFree(type);
}
if (nullptr != role)
{
xmlFree(role);
}
if (nullptr != ref)
{
xmlFree(ref);
}
}
}
xmlFree(child_name);
}
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)
{
return way;
}
const int depth = xmlTextReaderDepth(inputReader);
while (xmlTextReaderRead(inputReader) == 1)
{
const int child_type = xmlTextReaderNodeType(inputReader);
if (child_type != 1 && child_type != 15)
{
continue;
}
const int child_depth = xmlTextReaderDepth(inputReader);
xmlChar *child_name = xmlTextReaderName(inputReader);
if (child_name == nullptr)
{
continue;
}
if (depth == child_depth && child_type == 15 &&
xmlStrEqual(child_name, (const xmlChar *)"way") == 1)
{
xmlChar *way_id = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"id");
way.id = StringToUint((char *)way_id);
xmlFree(way_id);
xmlFree(child_name);
break;
}
if (child_type != 1)
{
xmlFree(child_name);
continue;
}
if (xmlStrEqual(child_name, (const xmlChar *)"tag") == 1)
{
xmlChar *key = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"k");
xmlChar *value = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"v");
if (key != nullptr && value != nullptr)
{
way.keyVals.Add(std::string((char *)key), std::string((char *)value));
}
if (key != nullptr)
{
xmlFree(key);
}
if (value != nullptr)
{
xmlFree(value);
}
}
else if (xmlStrEqual(child_name, (const xmlChar *)"nd") == 1)
{
xmlChar *ref = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"ref");
if (ref != nullptr)
{
way.path.push_back(StringToUint((const char *)ref));
xmlFree(ref);
}
}
xmlFree(child_name);
}
return way;
}
ImportNode XMLParser::ReadXMLNode()
{
ImportNode node;
xmlChar *attribute = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"lat");
if (attribute != nullptr)
{
node.lat = static_cast<int>(COORDINATE_PRECISION * StringToDouble((const char *)attribute));
xmlFree(attribute);
}
attribute = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"lon");
if (attribute != nullptr)
{
node.lon = static_cast<int>(COORDINATE_PRECISION * StringToDouble((const char *)attribute));
xmlFree(attribute);
}
attribute = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"id");
if (attribute != nullptr)
{
node.node_id = StringToUint((const char *)attribute);
xmlFree(attribute);
}
if (xmlTextReaderIsEmptyElement(inputReader) == 1)
{
return node;
}
const int depth = xmlTextReaderDepth(inputReader);
while (xmlTextReaderRead(inputReader) == 1)
{
const int child_type = xmlTextReaderNodeType(inputReader);
// 1 = Element, 15 = EndElement
if (child_type != 1 && child_type != 15)
{
continue;
}
const int child_depth = xmlTextReaderDepth(inputReader);
xmlChar *child_name = xmlTextReaderName(inputReader);
if (child_name == nullptr)
{
continue;
}
if (depth == child_depth && child_type == 15 &&
xmlStrEqual(child_name, (const xmlChar *)"node") == 1)
{
xmlFree(child_name);
break;
}
if (child_type != 1)
{
xmlFree(child_name);
continue;
}
if (xmlStrEqual(child_name, (const xmlChar *)"tag") == 1)
{
xmlChar *key = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"k");
xmlChar *value = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"v");
if (key != nullptr && value != nullptr)
{
node.keyVals.Add(std::string((char *)(key)), std::string((char *)(value)));
}
if (key != nullptr)
{
xmlFree(key);
}
if (value != nullptr)
{
xmlFree(value);
}
}
xmlFree(child_name);
}
return node;
}
+54
View File
@@ -0,0 +1,54 @@
/*
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/Restriction.h"
#include <libxml/xmlreader.h>
class ExtractorCallbacks;
class XMLParser : public BaseParser
{
public:
XMLParser(const char *filename,
ExtractorCallbacks *extractor_callbacks,
ScriptingEnvironment &scripting_environment);
bool ReadHeader();
bool Parse();
private:
InputRestrictionContainer ReadXMLRestriction();
ExtractionWay ReadXMLWay();
ImportNode ReadXMLNode();
xmlTextReaderPtr inputReader;
};
#endif /* XMLPARSER_H_ */
+7
View File
@@ -0,0 +1,7 @@
source "http://rubygems.org"
gem "cucumber"
gem "rake"
gem "osmlib-base"
gem "sys-proctable"
gem "rspec-expectations"
+30
View File
@@ -0,0 +1,30 @@
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
+102
View File
@@ -0,0 +1,102 @@
/*
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 <iosfwd> //for std::ostream
#include <string>
const float COORDINATE_PRECISION = 1000000.f;
struct FixedPointCoordinate
{
int lat;
int lon;
FixedPointCoordinate();
FixedPointCoordinate(int lat, int lon);
void Reset();
bool isSet() const;
bool isValid() const;
bool operator==(const FixedPointCoordinate &other) const;
static double
ApproximateDistance(const int lat1, const int lon1, const int lat2, const int lon2);
static double ApproximateDistance(const FixedPointCoordinate &first_coordinate,
const FixedPointCoordinate &second_coordinate);
static float ApproximateEuclideanDistance(const FixedPointCoordinate &first_coordinate,
const FixedPointCoordinate &second_coordinate);
static float
ApproximateEuclideanDistance(const int lat1, const int lon1, const int lat2, const int lon2);
static float ApproximateSquaredEuclideanDistance(const FixedPointCoordinate &first_coordinate,
const FixedPointCoordinate &second_coordinate);
static void convertInternalLatLonToString(const int value, std::string &output);
static void convertInternalCoordinateToString(const FixedPointCoordinate &coordinate,
std::string &output);
static void convertInternalReversedCoordinateToString(const FixedPointCoordinate &coordinate,
std::string &output);
static float ComputePerpendicularDistance(const FixedPointCoordinate &segment_source,
const FixedPointCoordinate &segment_target,
const FixedPointCoordinate &query_location);
static float ComputePerpendicularDistance(const FixedPointCoordinate &segment_source,
const FixedPointCoordinate &segment_target,
const FixedPointCoordinate &query_location,
FixedPointCoordinate &nearest_location,
float &ratio);
static int
OrderedPerpendicularDistanceApproximation(const FixedPointCoordinate &segment_source,
const FixedPointCoordinate &segment_target,
const FixedPointCoordinate &query_location);
static float GetBearing(const FixedPointCoordinate &A, const FixedPointCoordinate &B);
float GetBearing(const FixedPointCoordinate &other) const;
void Output(std::ostream &out) const;
static float DegreeToRadian(const float degree);
static float RadianToDegree(const float radian);
};
inline std::ostream &operator<<(std::ostream &out_stream, FixedPointCoordinate const &coordinate)
{
coordinate.Output(out_stream);
return out_stream;
}
#endif /* FIXED_POINT_COORDINATE_H_ */
+53
View File
@@ -0,0 +1,53 @@
/*
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 HTTP_HEADER_H
#define HTTP_HEADER_H
#include <string>
#include <algorithm>
namespace http
{
struct Header
{
Header& operator=(const Header& other) = default;
Header(const std::string & name, const std::string & value) : name(name), value(value) {}
Header(const Header && other) : name(std::move(other.name)), value(std::move(other.value)) {}
void Clear()
{
name.clear();
value.clear();
}
std::string name;
std::string value;
};
}
#endif // HTTP_HEADER_H
+74
View File
@@ -0,0 +1,74 @@
/*
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 <boost/asio.hpp>
#include <vector>
namespace http
{
const char okHTML[] = "";
const char badRequestHTML[] = "{\"status\": 400,\"status_message\":\"Bad Request\"}";
const char internalServerErrorHTML[] =
"{\"status\": 500,\"status_message\":\"Internal Server Error\"}";
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<char> content;
static Reply StockReply(status_type status);
void SetSize(const unsigned size);
void SetUncompressedSize();
Reply();
private:
std::string ToString(Reply::status_type status);
boost::asio::const_buffer ToBuffer(Reply::status_type status);
};
}
#endif // REPLY_H
+89
View File
@@ -0,0 +1,89 @@
/*
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 <osrm/Coordinate.h>
#include <boost/fusion/container/vector/vector_fwd.hpp>
#include <string>
#include <vector>
struct RouteParameters
{
RouteParameters();
void setZoomLevel(const short level);
void setAlternateRouteFlag(const bool flag);
void setUTurn(const bool flag);
void setAllUTurns(const bool flag);
void setDeprecatedAPIFlag(const std::string &);
void setChecksum(const unsigned check_sum);
void setInstructionFlag(const bool flag);
void setService(const std::string &service);
void setOutputFormat(const std::string &format);
void setJSONpParameter(const std::string &parameter);
void addHint(const std::string &hint);
void setLanguage(const std::string &language);
void setGeometryFlag(const bool flag);
void setCompressionFlag(const bool flag);
void addCoordinate(const boost::fusion::vector<double, double> &coordinates);
short zoom_level;
bool print_instructions;
bool alternate_route;
bool geometry;
bool compression;
bool deprecatedAPI;
bool uturn_default;
unsigned check_sum;
std::string service;
std::string output_format;
std::string jsonp_parameter;
std::string language;
std::vector<std::string> hints;
std::vector<bool> uturns;
std::vector<FixedPointCoordinate> coordinates;
};
#endif // ROUTE_PARAMETERS_H
+38
View File
@@ -0,0 +1,38 @@
/*
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_PATH_H
#define SERVER_PATH_H
#include <boost/filesystem.hpp>
#include <unordered_map>
#include <string>
typedef std::unordered_map<std::string, boost::filesystem::path> ServerPaths;
#endif // SERVER_PATH_H
+22
View File
@@ -0,0 +1,22 @@
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.
+52
View File
@@ -0,0 +1,52 @@
/*
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/ServerPaths.h>
class OSRM_impl;
struct RouteParameters;
namespace http
{
class Reply;
}
class OSRM
{
private:
OSRM_impl *OSRM_pimpl_;
public:
explicit OSRM(const ServerPaths &paths, const bool use_shared_memory = false);
~OSRM();
void RunQuery(RouteParameters &route_parameters, http::Reply &reply);
};
#endif // OSRM_H
+167
View File
@@ -0,0 +1,167 @@
/*
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.
*/
namespace boost { namespace interprocess { class named_mutex; } }
#include "OSRM_impl.h"
#include "OSRM.h"
#include <osrm/Reply.h>
#include <osrm/RouteParameters.h>
#include <osrm/ServerPaths.h>
#include "../Plugins/BasePlugin.h"
#include "../Plugins/DistanceTablePlugin.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 "../Util/SimpleLogger.h"
#include <boost/assert.hpp>
#include <boost/interprocess/sync/named_condition.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>
#include <algorithm>
#include <fstream>
#include <utility>
#include <vector>
OSRM_impl::OSRM_impl(const ServerPaths &server_paths, const bool use_shared_memory)
: use_shared_memory(use_shared_memory)
{
if (use_shared_memory)
{
barrier = new SharedBarriers();
query_data_facade = new SharedDataFacade<QueryEdge::EdgeData>();
}
else
{
query_data_facade = new InternalDataFacade<QueryEdge::EdgeData>(server_paths);
}
// The following plugins handle all requests.
RegisterPlugin(new DistanceTablePlugin<BaseDataFacade<QueryEdge::EdgeData>>(query_data_facade));
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_impl::~OSRM_impl()
{
delete query_data_facade;
for (PluginMap::value_type &plugin_pointer : plugin_map)
{
delete plugin_pointer.second;
}
if (use_shared_memory)
{
delete barrier;
}
}
void OSRM_impl::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_impl::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);
}
}
// proxy code for compilation firewall
OSRM::OSRM(const ServerPaths &paths, const bool use_shared_memory)
: OSRM_pimpl_(new OSRM_impl(paths, use_shared_memory))
{
}
OSRM::~OSRM() { delete OSRM_pimpl_; }
void OSRM::RunQuery(RouteParameters &route_parameters, http::Reply &reply)
{
OSRM_pimpl_->RunQuery(route_parameters, reply);
}
+65
View File
@@ -0,0 +1,65 @@
/*
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_IMPL_H
#define OSRM_IMPL_H
class BasePlugin;
namespace http { class Reply; }
struct RouteParameters;
#include <osrm/ServerPaths.h>
#include "../DataStructures/QueryEdge.h"
#include <unordered_map>
#include <string>
struct SharedBarriers;
template <class EdgeDataT> class BaseDataFacade;
class OSRM_impl
{
private:
typedef std::unordered_map<std::string, BasePlugin *> PluginMap;
public:
OSRM_impl(const ServerPaths &paths, const bool use_shared_memory);
OSRM_impl(const OSRM_impl &) = delete;
virtual ~OSRM_impl();
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_IMPL_H
+50
View File
@@ -0,0 +1,50 @@
/*
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 "../Util/StringUtil.h"
#include <osrm/Coordinate.h>
#include <osrm/Reply.h>
#include <osrm/RouteParameters.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;
};
#endif /* BASEPLUGIN_H_ */
+146
View File
@@ -0,0 +1,146 @@
/*
Copyright (c) 2014, 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 DISTANCE_TABLE_PLUGIN_H
#define DISTANCE_TABLE_PLUGIN_H
#include "BasePlugin.h"
#include "../Algorithms/ObjectToBase64.h"
#include "../DataStructures/JSONContainer.h"
#include "../DataStructures/QueryEdge.h"
#include "../DataStructures/SearchEngine.h"
#include "../Descriptors/BaseDescriptor.h"
#include "../Util/SimpleLogger.h"
#include "../Util/StringUtil.h"
#include "../Util/TimingUtil.h"
#include <cstdlib>
#include <algorithm>
#include <memory>
#include <unordered_map>
#include <string>
#include <vector>
template <class DataFacadeT> class DistanceTablePlugin : public BasePlugin
{
private:
std::shared_ptr<SearchEngine<DataFacadeT>> search_engine_ptr;
public:
explicit DistanceTablePlugin(DataFacadeT *facade) : descriptor_string("table"), facade(facade)
{
search_engine_ptr = std::make_shared<SearchEngine<DataFacadeT>>(facade);
}
virtual ~DistanceTablePlugin() {}
const std::string GetDescriptor() const { return descriptor_string; }
void HandleRequest(const RouteParameters &route_parameters, http::Reply &reply)
{
// check number of parameters
if (2 > route_parameters.coordinates.size())
{
reply = http::Reply::StockReply(http::Reply::badRequest);
return;
}
RawRouteData raw_route;
raw_route.check_sum = facade->GetCheckSum();
if (std::any_of(begin(route_parameters.coordinates),
end(route_parameters.coordinates),
[&](FixedPointCoordinate coordinate)
{ return !coordinate.isValid(); }))
{
reply = http::Reply::StockReply(http::Reply::badRequest);
return;
}
for (const FixedPointCoordinate &coordinate : route_parameters.coordinates)
{
raw_route.raw_via_node_coordinates.emplace_back(std::move(coordinate));
}
const bool checksum_OK = (route_parameters.check_sum == raw_route.check_sum);
unsigned max_locations =
std::min(100u, static_cast<unsigned>(raw_route.raw_via_node_coordinates.size()));
PhantomNodeArray phantom_node_vector(max_locations);
for (unsigned i = 0; i < max_locations; ++i)
{
if (checksum_OK && i < route_parameters.hints.size() &&
!route_parameters.hints[i].empty())
{
PhantomNode current_phantom_node;
DecodeObjectFromBase64(route_parameters.hints[i], current_phantom_node);
if (current_phantom_node.isValid(facade->GetNumberOfNodes()))
{
phantom_node_vector[i].emplace_back(std::move(current_phantom_node));
continue;
}
}
facade->IncrementalFindPhantomNodeForCoordinate(raw_route.raw_via_node_coordinates[i],
phantom_node_vector[i],
route_parameters.zoom_level,
1);
BOOST_ASSERT(phantom_node_vector[i].front().isValid(facade->GetNumberOfNodes()));
}
// TIMER_START(distance_table);
std::shared_ptr<std::vector<EdgeWeight>> result_table =
search_engine_ptr->distance_table(phantom_node_vector);
// TIMER_STOP(distance_table);
if (!result_table)
{
reply = http::Reply::StockReply(http::Reply::badRequest);
return;
}
JSON::Object json_object;
JSON::Array json_array;
const unsigned number_of_locations = static_cast<unsigned>(phantom_node_vector.size());
for (unsigned row = 0; row < number_of_locations; ++row)
{
JSON::Array json_row;
auto row_begin_iterator = result_table->begin() + (row * number_of_locations);
auto row_end_iterator = result_table->begin() + ((row + 1) * number_of_locations);
json_row.values.insert(json_row.values.end(), row_begin_iterator, row_end_iterator);
json_array.values.push_back(json_row);
}
json_object.values["distance_table"] = json_array;
JSON::render(reply.content, json_object);
}
private:
std::string descriptor_string;
DataFacadeT *facade;
};
#endif // DISTANCE_TABLE_PLUGIN_H

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