{"action":"created","comment":{"url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/comments/87755291","pull_request_review_id":8352622,"id":87755291,"diff_hunk":"@@ -383,136 +393,140 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,\n     if (intersection.size() == 2)\n         return 1;\n \n-    // at least three roads\n     std::size_t best = 0;\n     double best_deviation = 180;\n-\n     std::size_t best_continue = 0;\n     double best_continue_deviation = 180;\n \n-    const EdgeData &in_data = node_based_graph.GetEdgeData(via_edge);\n-    const auto in_classification = in_data.road_classification;\n+    const EdgeData &in_way = node_based_graph.GetEdgeData(via_edge);\n \n-    for (std::size_t i = 1; i < intersection.size(); ++i)\n-    {\n-        const double deviation = angularDeviation(intersection[i].angle, STRAIGHT_ANGLE);\n-        if (!intersection[i].entry_allowed)\n-            continue;\n+    std::vector<out_way> out_ways;\n \n-        const auto out_data = node_based_graph.GetEdgeData(intersection[i].eid);\n-        const auto continue_class =\n-            node_based_graph.GetEdgeData(intersection[best_continue].eid).road_classification;\n+    // create sortable vector of only entry allowed out_ways\n+    // get a count of number of ways from that intersection that qualify to have\n+    // continue instruction because they share a name with the approaching way\n+    std::int64_t continue_count = 0, continue_count_valid = 0;\n+    for (std::size_t i = 1, last = intersection.size(); i < last; ++i)\n+    {\n+        out_way out;\n+        const auto out_node = node_based_graph.GetEdgeData(intersection[i].eid);\n \n-        const auto same_name = !util::guidance::requiresNameAnnounced(\n-            in_data.name_id, out_data.name_id, name_table, street_name_suffix_table);\n+        out.road = &intersection[i];\n+        out.same_name_id = !util::guidance::requiresNameAnnounced(\n+            in_way.name_id, out_node.name_id, name_table, street_name_suffix_table);\n+        if (out.same_name_id)\n+            ++continue_count;\n \n-        if (same_name && (best_continue == 0 || (continue_class.GetPriority() >\n-                                                     out_data.road_classification.GetPriority() &&\n-                                                 in_classification != continue_class) ||\n-                          (deviation < best_continue_deviation &&\n-                           out_data.road_classification == continue_class) ||\n-                          (continue_class != in_classification &&\n-                           out_data.road_classification == continue_class)))\n+        if (!out.road->entry_allowed)\n         {\n-            best_continue_deviation = deviation;\n-            best_continue = i;\n+            ++continue_count_valid;\n+            continue;\n         }\n \n-        const auto current_best_class =\n-            node_based_graph.GetEdgeData(intersection[best_continue].eid).road_classification;\n+        out.index = i;\n+        out.deviation_from_straight = angularDeviation(intersection[i].angle, STRAIGHT_ANGLE);\n+        out.same_classification = out_node.road_classification == in_way.road_classification;\n+        out.same_or_higher_priority =\n+            out_node.road_classification.GetPriority() <= in_way.road_classification.GetPriority();\n \n-        // don't prefer low priority classes\n-        if (best != 0 && out_data.road_classification.IsLowPriorityRoadClass() &&\n-            !current_best_class.IsLowPriorityRoadClass())\n-            continue;\n+        out_ways.push_back(out);\n+    }\n+    const std::pair<std::int64_t, std::int64_t> num_continue_names =\n+        std::make_pair(continue_count, continue_count_valid);","path":"src/extractor/guidance/intersection_handler.cpp","position":96,"original_position":96,"commit_id":"7e17adab3a9d15df9d73cb0df14d23e4c76bca8a","original_commit_id":"7e17adab3a9d15df9d73cb0df14d23e4c76bca8a","user":{"login":"MoKob","id":12932279,"avatar_url":"https://avatars.githubusercontent.com/u/12932279?v=3","gravatar_id":"","url":"https://api.github.com/users/MoKob","html_url":"https://github.com/MoKob","followers_url":"https://api.github.com/users/MoKob/followers","following_url":"https://api.github.com/users/MoKob/following{/other_user}","gists_url":"https://api.github.com/users/MoKob/gists{/gist_id}","starred_url":"https://api.github.com/users/MoKob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MoKob/subscriptions","organizations_url":"https://api.github.com/users/MoKob/orgs","repos_url":"https://api.github.com/users/MoKob/repos","events_url":"https://api.github.com/users/MoKob/events{/privacy}","received_events_url":"https://api.github.com/users/MoKob/received_events","type":"User","site_admin":false},"body":"see above: this is `continue_count_invalid`. Also, what is the benefit in storing this in a pair? `num_continue_name.first/.second` is far less intuitive then a named variable.","created_at":"2016-11-14T08:31:44Z","updated_at":"2016-11-14T08:31:44Z","html_url":"https://github.com/Project-OSRM/osrm-backend/pull/3217#discussion_r87755291","pull_request_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/3217","_links":{"self":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/comments/87755291"},"html":{"href":"https://github.com/Project-OSRM/osrm-backend/pull/3217#discussion_r87755291"},"pull_request":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/3217"}}},"pull_request":{"url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/3217","id":91816993,"html_url":"https://github.com/Project-OSRM/osrm-backend/pull/3217","diff_url":"https://github.com/Project-OSRM/osrm-backend/pull/3217.diff","patch_url":"https://github.com/Project-OSRM/osrm-backend/pull/3217.patch","issue_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/3217","number":3217,"state":"open","locked":false,"title":"Refactor find obvious turn handling","user":{"login":"karenzshea","id":5521326,"avatar_url":"https://avatars.githubusercontent.com/u/5521326?v=3","gravatar_id":"","url":"https://api.github.com/users/karenzshea","html_url":"https://github.com/karenzshea","followers_url":"https://api.github.com/users/karenzshea/followers","following_url":"https://api.github.com/users/karenzshea/following{/other_user}","gists_url":"https://api.github.com/users/karenzshea/gists{/gist_id}","starred_url":"https://api.github.com/users/karenzshea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karenzshea/subscriptions","organizations_url":"https://api.github.com/users/karenzshea/orgs","repos_url":"https://api.github.com/users/karenzshea/repos","events_url":"https://api.github.com/users/karenzshea/events{/privacy}","received_events_url":"https://api.github.com/users/karenzshea/received_events","type":"User","site_admin":false},"body":"# Issue\r\n\r\nhttps://github.com/Project-OSRM/osrm-backend/issues/3081\r\n\r\nI made a pass at this code to hopefully make it cleaner and easier to follow, but more or less tried to preserve the same logic and handling via `best` and `best_continue` candidates.\r\n\r\n## Tasklist\r\n - [x] Make a refactor pass at the second half of the function\r\n-  [x] Investigate all of the cucumber test failures\r\n - [ ] review\r\n - [ ] adjust for comments\r\n\r\n## Requirements / Relations\r\ncc @MoKob \r\n\r\n","created_at":"2016-11-01T16:34:43Z","updated_at":"2016-11-14T08:59:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e56d1c66c6789cefdf2897ea3aea122428e8824d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/3217/commits","review_comments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/3217/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/3217/comments","statuses_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/statuses/7e17adab3a9d15df9d73cb0df14d23e4c76bca8a","head":{"label":"Project-OSRM:refactor/obviousness","ref":"refactor/obviousness","sha":"7e17adab3a9d15df9d73cb0df14d23e4c76bca8a","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":"Open Source Routing Machine - 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-11-13T22:14:41Z","pushed_at":"2016-11-14T08:52:44Z","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":29779,"stargazers_count":1433,"watchers_count":1433,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":855,"mirror_url":null,"open_issues_count":322,"forks":855,"open_issues":322,"watchers":1433,"default_branch":"master"}},"base":{"label":"Project-OSRM:master","ref":"master","sha":"8137e95fbb61d6d5c34998966dd8a89f3e220b09","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":"Open Source Routing Machine - 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-11-13T22:14:41Z","pushed_at":"2016-11-14T08:52:44Z","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":29779,"stargazers_count":1433,"watchers_count":1433,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":855,"mirror_url":null,"open_issues_count":322,"forks":855,"open_issues":322,"watchers":1433,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/3217"},"html":{"href":"https://github.com/Project-OSRM/osrm-backend/pull/3217"},"issue":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/3217"},"comments":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/3217/comments"},"review_comments":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/3217/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/3217/commits"},"statuses":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/statuses/7e17adab3a9d15df9d73cb0df14d23e4c76bca8a"}}}}
{"actor":{"display_login":"MoKob"}}