{"action":"created","comment":{"url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/comments/51464603","id":51464603,"diff_hunk":"@@ -35,10 +39,133 @@ template <class DataFacadeT> class ViaRoutePlugin final : public BasePlugin\n     std::unique_ptr<SearchEngine<DataFacadeT>> search_engine_ptr;\n     DataFacadeT *facade;\n     int max_locations_viaroute;\n+    guidance::StepAssembler<DataFacadeT> step_assembler;\n+    guidance::LegAssembler<DataFacadeT> leg_asssembler;\n+    guidance::GeometryAssembler<DataFacadeT> geometry_assembler;\n+    guidance::RouteAssembler route_assembler;\n+    guidance::OverviewAssembler overview_assembler;\n+\n+    util::json::Array MakeWaypoints(const RouteParameters &parameters,\n+                                    const InternalRouteResult &raw_route) const\n+    {\n+        util::json::Array waypoints;\n+        auto coordinate_iter = parameters.coordinates.begin();\n+\n+        const auto &first_phantoms = raw_route.segment_end_coordinates.front();\n+        waypoints.values.push_back(makeWaypoint(\n+            first_phantoms.source_phantom.location,\n+            facade->get_name_for_id(first_phantoms.source_phantom.name_id),\n+            Hint{*coordinate_iter++, first_phantoms.source_phantom, facade->GetCheckSum()}));\n+        for (auto phantoms : raw_route.segment_end_coordinates)\n+        {\n+            waypoints.values.push_back(makeWaypoint(\n+                phantoms.target_phantom.location,\n+                facade->get_name_for_id(phantoms.target_phantom.name_id),\n+                Hint{*coordinate_iter++, phantoms.target_phantom, facade->GetCheckSum()}));\n+        }\n+\n+        return waypoints;\n+    }\n+\n+    util::json::Array MakeRoutes(const RouteParameters &parameters,\n+                                 const InternalRouteResult &raw_route) const\n+    {\n+        util::json::Array json_routes;\n+        // currently the raw_route has a weird format that boundles routes\n+        auto number_of_routes = raw_route.has_alternative() ? 2 : 1;\n+        json_routes.values.reserve(number_of_routes);\n+\n+        std::vector<guidance::RouteLeg> legs;\n+        std::vector<guidance::LegGeometry> leg_geometries;\n+        legs.reserve(raw_route.segment_end_coordinates.size());\n+        leg_geometries.reserve(raw_route.segment_end_coordinates.size());\n+        for (auto idx : boost::irange(0UL, raw_route.segment_end_coordinates.size()))","path":"include/engine/plugins/viaroute.hpp","position":69,"original_position":69,"commit_id":"e3fd6bf0335c9682fe97cad939c569f2beb9a7e4","original_commit_id":"e3fd6bf0335c9682fe97cad939c569f2beb9a7e4","user":{"login":"daniel-j-h","id":527241,"avatar_url":"https://avatars.githubusercontent.com/u/527241?v=3","gravatar_id":"","url":"https://api.github.com/users/daniel-j-h","html_url":"https://github.com/daniel-j-h","followers_url":"https://api.github.com/users/daniel-j-h/followers","following_url":"https://api.github.com/users/daniel-j-h/following{/other_user}","gists_url":"https://api.github.com/users/daniel-j-h/gists{/gist_id}","starred_url":"https://api.github.com/users/daniel-j-h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daniel-j-h/subscriptions","organizations_url":"https://api.github.com/users/daniel-j-h/orgs","repos_url":"https://api.github.com/users/daniel-j-h/repos","events_url":"https://api.github.com/users/daniel-j-h/events{/privacy}","received_events_url":"https://api.github.com/users/daniel-j-h/received_events","type":"User","site_admin":false},"body":"See comment and ref. above why we do not use irange. Dangerous.","created_at":"2016-02-01T19:10:08Z","updated_at":"2016-02-01T19:10:08Z","html_url":"https://github.com/Project-OSRM/osrm-backend/pull/1935#discussion_r51464603","pull_request_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1935","_links":{"self":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/comments/51464603"},"html":{"href":"https://github.com/Project-OSRM/osrm-backend/pull/1935#discussion_r51464603"},"pull_request":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1935"}}},"pull_request":{"url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1935","id":57519992,"html_url":"https://github.com/Project-OSRM/osrm-backend/pull/1935","diff_url":"https://github.com/Project-OSRM/osrm-backend/pull/1935.diff","patch_url":"https://github.com/Project-OSRM/osrm-backend/pull/1935.patch","issue_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/1935","number":1935,"state":"open","locked":false,"title":"[NOT READY] OSRM 5.0 API","user":{"login":"TheMarex","id":606968,"avatar_url":"https://avatars.githubusercontent.com/u/606968?v=3","gravatar_id":"","url":"https://api.github.com/users/TheMarex","html_url":"https://github.com/TheMarex","followers_url":"https://api.github.com/users/TheMarex/followers","following_url":"https://api.github.com/users/TheMarex/following{/other_user}","gists_url":"https://api.github.com/users/TheMarex/gists{/gist_id}","starred_url":"https://api.github.com/users/TheMarex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheMarex/subscriptions","organizations_url":"https://api.github.com/users/TheMarex/orgs","repos_url":"https://api.github.com/users/TheMarex/repos","events_url":"https://api.github.com/users/TheMarex/events{/privacy}","received_events_url":"https://api.github.com/users/TheMarex/received_events","type":"User","site_admin":false},"body":"This PR is meant to track the implementation of the new OSRM 5.0 API.\r\n\r\nTODO\r\n- [ ] Fix api_parameter parser for new query URL\r\n- [ ] Port plugins to new response format:\r\n   - [x] viaroute\r\n   - [ ] trip\r\n   - [ ] table\r\n   - [ ] match\r\n   - [ ] nearest\r\n- [ ] Adapt cucumber tests to new API:\r\n  - [ ] Fix the support code\r\n  - [ ] Remove code that tests for old API behavior\r\n\r\nFor reference the specification that we want to implement: https://github.com/Project-OSRM/osrm-backend/wiki/New-Server-api\r\n\r\n/cc @daniel-j-h @MoKob would be interested about your opinion of the code structure.","created_at":"2016-01-28T15:45:36Z","updated_at":"2016-02-01T19:10:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1935/commits","review_comments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1935/comments","review_comment_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/1935/comments","statuses_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/statuses/e3fd6bf0335c9682fe97cad939c569f2beb9a7e4","head":{"label":"Project-OSRM:rewrite/new-api","ref":"rewrite/new-api","sha":"e3fd6bf0335c9682fe97cad939c569f2beb9a7e4","user":{"login":"Project-OSRM","id":8207060,"avatar_url":"https://avatars.githubusercontent.com/u/8207060?v=3","gravatar_id":"","url":"https://api.github.com/users/Project-OSRM","html_url":"https://github.com/Project-OSRM","followers_url":"https://api.github.com/users/Project-OSRM/followers","following_url":"https://api.github.com/users/Project-OSRM/following{/other_user}","gists_url":"https://api.github.com/users/Project-OSRM/gists{/gist_id}","starred_url":"https://api.github.com/users/Project-OSRM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Project-OSRM/subscriptions","organizations_url":"https://api.github.com/users/Project-OSRM/orgs","repos_url":"https://api.github.com/users/Project-OSRM/repos","events_url":"https://api.github.com/users/Project-OSRM/events{/privacy}","received_events_url":"https://api.github.com/users/Project-OSRM/received_events","type":"Organization","site_admin":false},"repo":{"id":2436255,"name":"osrm-backend","full_name":"Project-OSRM/osrm-backend","owner":{"login":"Project-OSRM","id":8207060,"avatar_url":"https://avatars.githubusercontent.com/u/8207060?v=3","gravatar_id":"","url":"https://api.github.com/users/Project-OSRM","html_url":"https://github.com/Project-OSRM","followers_url":"https://api.github.com/users/Project-OSRM/followers","following_url":"https://api.github.com/users/Project-OSRM/following{/other_user}","gists_url":"https://api.github.com/users/Project-OSRM/gists{/gist_id}","starred_url":"https://api.github.com/users/Project-OSRM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Project-OSRM/subscriptions","organizations_url":"https://api.github.com/users/Project-OSRM/orgs","repos_url":"https://api.github.com/users/Project-OSRM/repos","events_url":"https://api.github.com/users/Project-OSRM/events{/privacy}","received_events_url":"https://api.github.com/users/Project-OSRM/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Project-OSRM/osrm-backend","description":"Project OSRM: C++ backend","fork":false,"url":"https://api.github.com/repos/Project-OSRM/osrm-backend","forks_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/forks","keys_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/teams","hooks_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/hooks","issue_events_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/events{/number}","events_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/events","assignees_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/assignees{/user}","branches_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/branches{/branch}","tags_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/tags","blobs_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/languages","stargazers_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/stargazers","contributors_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/contributors","subscribers_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/subscribers","subscription_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/subscription","commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/contents/{+path}","compare_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/merges","archive_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/downloads","issues_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues{/number}","pulls_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/labels{/name}","releases_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/releases{/id}","deployments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/deployments","created_at":"2011-09-22T10:05:08Z","updated_at":"2016-02-01T05:24:23Z","pushed_at":"2016-02-01T16:26:45Z","git_url":"git://github.com/Project-OSRM/osrm-backend.git","ssh_url":"git@github.com:Project-OSRM/osrm-backend.git","clone_url":"https://github.com/Project-OSRM/osrm-backend.git","svn_url":"https://github.com/Project-OSRM/osrm-backend","homepage":"http://map.project-osrm.org","size":18377,"stargazers_count":1032,"watchers_count":1032,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":468,"mirror_url":null,"open_issues_count":177,"forks":468,"open_issues":177,"watchers":1032,"default_branch":"develop"}},"base":{"label":"Project-OSRM:develop","ref":"develop","sha":"a48f02e0da2c0ec8fe208ebe2bacc2880bb5ec5f","user":{"login":"Project-OSRM","id":8207060,"avatar_url":"https://avatars.githubusercontent.com/u/8207060?v=3","gravatar_id":"","url":"https://api.github.com/users/Project-OSRM","html_url":"https://github.com/Project-OSRM","followers_url":"https://api.github.com/users/Project-OSRM/followers","following_url":"https://api.github.com/users/Project-OSRM/following{/other_user}","gists_url":"https://api.github.com/users/Project-OSRM/gists{/gist_id}","starred_url":"https://api.github.com/users/Project-OSRM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Project-OSRM/subscriptions","organizations_url":"https://api.github.com/users/Project-OSRM/orgs","repos_url":"https://api.github.com/users/Project-OSRM/repos","events_url":"https://api.github.com/users/Project-OSRM/events{/privacy}","received_events_url":"https://api.github.com/users/Project-OSRM/received_events","type":"Organization","site_admin":false},"repo":{"id":2436255,"name":"osrm-backend","full_name":"Project-OSRM/osrm-backend","owner":{"login":"Project-OSRM","id":8207060,"avatar_url":"https://avatars.githubusercontent.com/u/8207060?v=3","gravatar_id":"","url":"https://api.github.com/users/Project-OSRM","html_url":"https://github.com/Project-OSRM","followers_url":"https://api.github.com/users/Project-OSRM/followers","following_url":"https://api.github.com/users/Project-OSRM/following{/other_user}","gists_url":"https://api.github.com/users/Project-OSRM/gists{/gist_id}","starred_url":"https://api.github.com/users/Project-OSRM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Project-OSRM/subscriptions","organizations_url":"https://api.github.com/users/Project-OSRM/orgs","repos_url":"https://api.github.com/users/Project-OSRM/repos","events_url":"https://api.github.com/users/Project-OSRM/events{/privacy}","received_events_url":"https://api.github.com/users/Project-OSRM/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Project-OSRM/osrm-backend","description":"Project OSRM: C++ backend","fork":false,"url":"https://api.github.com/repos/Project-OSRM/osrm-backend","forks_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/forks","keys_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/teams","hooks_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/hooks","issue_events_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/events{/number}","events_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/events","assignees_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/assignees{/user}","branches_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/branches{/branch}","tags_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/tags","blobs_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/languages","stargazers_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/stargazers","contributors_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/contributors","subscribers_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/subscribers","subscription_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/subscription","commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/contents/{+path}","compare_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/merges","archive_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/downloads","issues_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues{/number}","pulls_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/labels{/name}","releases_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/releases{/id}","deployments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/deployments","created_at":"2011-09-22T10:05:08Z","updated_at":"2016-02-01T05:24:23Z","pushed_at":"2016-02-01T16:26:45Z","git_url":"git://github.com/Project-OSRM/osrm-backend.git","ssh_url":"git@github.com:Project-OSRM/osrm-backend.git","clone_url":"https://github.com/Project-OSRM/osrm-backend.git","svn_url":"https://github.com/Project-OSRM/osrm-backend","homepage":"http://map.project-osrm.org","size":18377,"stargazers_count":1032,"watchers_count":1032,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":468,"mirror_url":null,"open_issues_count":177,"forks":468,"open_issues":177,"watchers":1032,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1935"},"html":{"href":"https://github.com/Project-OSRM/osrm-backend/pull/1935"},"issue":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/1935"},"comments":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/1935/comments"},"review_comments":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1935/comments"},"review_comment":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1935/commits"},"statuses":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/statuses/e3fd6bf0335c9682fe97cad939c569f2beb9a7e4"}}}}