{"action":"created","comment":{"url":"https://api.github.com/repos/mapsme/omim/pulls/comments/104298728","pull_request_review_id":25133948,"id":104298728,"diff_hunk":"@@ -3,10 +3,135 @@\n \n #include \"geometry/distance_on_sphere.hpp\"\n \n+#include <limits>\n+\n namespace\n {\n+using namespace routing;\n+\n inline bool IsValidEdgeWeight(EdgeWeight const & w) { return w != INVALID_EDGE_WEIGHT; }\n+\n+template <class Node>\n+class FindingNode\n+{\n+public:\n+  FindingNode(CrossNode const & node, double & minDistance, Node & resultingCrossNode)\n+    : m_node(node), m_minDistance(minDistance), m_resultingCrossNode(resultingCrossNode)\n+  {\n+  }\n+\n+  void operator()(Node const & crossNode) const\n+  {\n+    if (crossNode.m_nodeId != m_node.node)\n+      return;\n+\n+    double const dist = ms::DistanceOnEarth(m_node.point, crossNode.m_point);\n+    if (dist < m_minDistance)\n+    {\n+      m_minDistance = dist;\n+      m_resultingCrossNode = crossNode;\n+    }\n+  }\n+\n+private:\n+  CrossNode const & m_node;\n+  double & m_minDistance;\n+  Node & m_resultingCrossNode;\n+};\n+\n+double GetAdjacencyCost(CrossRoutingContextReader const & currentContext,\n+                        IngoingCrossNode const & ingoingCrossNode,\n+                        OutgoingCrossNode const & outgoingCrossNode)\n+{\n+  return currentContext.GetAdjacencyCost(ingoingCrossNode, outgoingCrossNode);\n+}\n+\n+double GetAdjacencyCost(CrossRoutingContextReader const & currentContext,\n+                        OutgoingCrossNode const & outgoingCrossNode,\n+                        IngoingCrossNode const & ingoingCrossNode)\n+{\n+  return GetAdjacencyCost(currentContext, ingoingCrossNode, outgoingCrossNode);\n+}\n+\n+template <class SourceNode, class TargetNode>\n+class FillingEdges\n+{\n+public:\n+  FillingEdges(TRoutingMappingPtr const & currentMapping,\n+               CrossRoutingContextReader const & currentContext, SourceNode const & startingNode,\n+               CrossMwmGraph const & crossMwmGraph, vector<CrossWeightedEdge> & adj)\n+    : m_currentMapping(currentMapping)\n+    , m_currentContext(currentContext)\n+    , m_startingNode(startingNode)\n+    , m_crossMwmGraph(crossMwmGraph)\n+    , m_adj(adj)\n+  {\n+  }\n+\n+  void operator()(TargetNode const & node) const\n+  {\n+    TWrittenEdgeWeight const outWeight = GetAdjacencyCost(m_currentContext, m_startingNode, node);\n+    if (outWeight != kInvalidContextEdgeWeight && outWeight != 0)\n+    {\n+      vector<BorderCross> const & targets =\n+          m_crossMwmGraph.ConstructBorderCross(m_currentMapping, node);\n+      for (auto const & target : targets)\n+      {\n+        if (target.toNode.IsValid())\n+          m_adj.emplace_back(target, outWeight);\n+      }\n+    }\n+  }\n+\n+private:\n+  TRoutingMappingPtr const & m_currentMapping;\n+  CrossRoutingContextReader const & m_currentContext;\n+  SourceNode const & m_startingNode;\n+  CrossMwmGraph const & m_crossMwmGraph;\n+  vector<CrossWeightedEdge> & m_adj;\n+};\n+\n+bool ForEachNodeNearPoint(CrossRoutingContextReader const & currentContext, CrossNode const & crossNode,\n+                          FindingNode<IngoingCrossNode> const & findingNode)\n+{\n+  return currentContext.ForEachIngoingNodeNearPoint(crossNode.point, findingNode);\n+}\n+\n+bool ForEachNodeNearPoint(CrossRoutingContextReader const & currentContext, CrossNode const & crossNode,\n+                          FindingNode<OutgoingCrossNode> const & findingNode)\n+{\n+  return currentContext.ForEachOutgoingNodeNearPoint(crossNode.point, findingNode);\n+}\n+\n+template <class Node, bool isOutgoing>\n+void FindCrossNode(CrossRoutingContextReader const & currentContext,\n+                   CrossNode const & crossNode, Node & node)\n+{\n+  double minDistance = std::numeric_limits<double>::max();\n+  FindingNode<Node> findingNode(crossNode, minDistance, node);\n+  CHECK(ForEachNodeNearPoint(currentContext, crossNode, findingNode), ());","path":"routing/cross_mwm_road_graph.cpp","position":110,"original_position":110,"commit_id":"b59e99d819924fab35fc157d45a90167c82b99b0","original_commit_id":"b59e99d819924fab35fc157d45a90167c82b99b0","user":{"login":"dobriy-eeh","id":19839790,"avatar_url":"https://avatars1.githubusercontent.com/u/19839790?v=3","gravatar_id":"","url":"https://api.github.com/users/dobriy-eeh","html_url":"https://github.com/dobriy-eeh","followers_url":"https://api.github.com/users/dobriy-eeh/followers","following_url":"https://api.github.com/users/dobriy-eeh/following{/other_user}","gists_url":"https://api.github.com/users/dobriy-eeh/gists{/gist_id}","starred_url":"https://api.github.com/users/dobriy-eeh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dobriy-eeh/subscriptions","organizations_url":"https://api.github.com/users/dobriy-eeh/orgs","repos_url":"https://api.github.com/users/dobriy-eeh/repos","events_url":"https://api.github.com/users/dobriy-eeh/events{/privacy}","received_events_url":"https://api.github.com/users/dobriy-eeh/received_events","type":"User","site_admin":false},"body":"Кстати, в текущем варианте параметр isOutgoing не используется.","created_at":"2017-03-04T22:24:51Z","updated_at":"2017-03-04T22:24:51Z","html_url":"https://github.com/mapsme/omim/pull/5508#discussion_r104298728","pull_request_url":"https://api.github.com/repos/mapsme/omim/pulls/5508","_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments/104298728"},"html":{"href":"https://github.com/mapsme/omim/pull/5508#discussion_r104298728"},"pull_request":{"href":"https://api.github.com/repos/mapsme/omim/pulls/5508"}}},"pull_request":{"url":"https://api.github.com/repos/mapsme/omim/pulls/5508","id":108920740,"html_url":"https://github.com/mapsme/omim/pull/5508","diff_url":"https://github.com/mapsme/omim/pull/5508.diff","patch_url":"https://github.com/mapsme/omim/pull/5508.patch","issue_url":"https://api.github.com/repos/mapsme/omim/issues/5508","number":5508,"state":"open","locked":false,"title":"Backward wave in CrossMwmGraph","user":{"login":"bykoianko","id":1768114,"avatar_url":"https://avatars3.githubusercontent.com/u/1768114?v=3","gravatar_id":"","url":"https://api.github.com/users/bykoianko","html_url":"https://github.com/bykoianko","followers_url":"https://api.github.com/users/bykoianko/followers","following_url":"https://api.github.com/users/bykoianko/following{/other_user}","gists_url":"https://api.github.com/users/bykoianko/gists{/gist_id}","starred_url":"https://api.github.com/users/bykoianko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bykoianko/subscriptions","organizations_url":"https://api.github.com/users/bykoianko/orgs","repos_url":"https://api.github.com/users/bykoianko/repos","events_url":"https://api.github.com/users/bykoianko/events{/privacy}","received_events_url":"https://api.github.com/users/bykoianko/received_events","type":"User","site_admin":false},"body":"1. Реализована обратная волна в классе CrossMwmGraph. Т.е. метод CrossMwmGraph::GetIngoingEdgesList() и методы необходимые для его реализации.\r\n\r\n2. Написан тест (в routing_integration_test), который проходится по всем входам всех mwm всего мира. Для каждого входа ищет все доступные выходы в данной mwm. Для каждого найденного выхода - ищет все входы и проверяет, что среди них есть вход, с которого начали.\r\n\r\n@dobriy-eeh @ygorshenin @mpimenov PTAL\r\n\r\nЗамечания:\r\n- Тест, указанный в (2) занимает 3 часа и должен выполняться над картой мира. Я пока не решил, что с ним делать. Вероятно, оставлю в routing_integration_test и закомментирую. Если есть идеи - пишите.\r\n- Несложно заметить, что в коде есть срытый copy paste. Он связан с тем, что в сигнатурах многих функций используется OutgoingCrossNode/IngoingCrossNode. Т.о. нам требуется два набора ф-ций. Если получится не очень сложно -  я попробую отрефакторить код, так чтоб у OutgoingCrossNode/IngoingCrossNode был общий базовый класс, который можно будет использовать в сигнатурах и убрать скрытый copypaste.","created_at":"2017-03-03T07:29:55Z","updated_at":"2017-03-04T22:24:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"14bc1a8a2d7f7c2b58bc00391aa92683720321c8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mapsme/omim/pulls/5508/commits","review_comments_url":"https://api.github.com/repos/mapsme/omim/pulls/5508/comments","review_comment_url":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mapsme/omim/issues/5508/comments","statuses_url":"https://api.github.com/repos/mapsme/omim/statuses/b59e99d819924fab35fc157d45a90167c82b99b0","head":{"label":"bykoianko:master-ingoing-wave","ref":"master-ingoing-wave","sha":"b59e99d819924fab35fc157d45a90167c82b99b0","user":{"login":"bykoianko","id":1768114,"avatar_url":"https://avatars3.githubusercontent.com/u/1768114?v=3","gravatar_id":"","url":"https://api.github.com/users/bykoianko","html_url":"https://github.com/bykoianko","followers_url":"https://api.github.com/users/bykoianko/followers","following_url":"https://api.github.com/users/bykoianko/following{/other_user}","gists_url":"https://api.github.com/users/bykoianko/gists{/gist_id}","starred_url":"https://api.github.com/users/bykoianko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bykoianko/subscriptions","organizations_url":"https://api.github.com/users/bykoianko/orgs","repos_url":"https://api.github.com/users/bykoianko/repos","events_url":"https://api.github.com/users/bykoianko/events{/privacy}","received_events_url":"https://api.github.com/users/bykoianko/received_events","type":"User","site_admin":false},"repo":{"id":43428862,"name":"omim","full_name":"bykoianko/omim","owner":{"login":"bykoianko","id":1768114,"avatar_url":"https://avatars3.githubusercontent.com/u/1768114?v=3","gravatar_id":"","url":"https://api.github.com/users/bykoianko","html_url":"https://github.com/bykoianko","followers_url":"https://api.github.com/users/bykoianko/followers","following_url":"https://api.github.com/users/bykoianko/following{/other_user}","gists_url":"https://api.github.com/users/bykoianko/gists{/gist_id}","starred_url":"https://api.github.com/users/bykoianko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bykoianko/subscriptions","organizations_url":"https://api.github.com/users/bykoianko/orgs","repos_url":"https://api.github.com/users/bykoianko/repos","events_url":"https://api.github.com/users/bykoianko/events{/privacy}","received_events_url":"https://api.github.com/users/bykoianko/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bykoianko/omim","description":"MAPS.ME - Offline OpenStreetMap maps for iOS/Android/Mac/Linux/Windows","fork":true,"url":"https://api.github.com/repos/bykoianko/omim","forks_url":"https://api.github.com/repos/bykoianko/omim/forks","keys_url":"https://api.github.com/repos/bykoianko/omim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bykoianko/omim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bykoianko/omim/teams","hooks_url":"https://api.github.com/repos/bykoianko/omim/hooks","issue_events_url":"https://api.github.com/repos/bykoianko/omim/issues/events{/number}","events_url":"https://api.github.com/repos/bykoianko/omim/events","assignees_url":"https://api.github.com/repos/bykoianko/omim/assignees{/user}","branches_url":"https://api.github.com/repos/bykoianko/omim/branches{/branch}","tags_url":"https://api.github.com/repos/bykoianko/omim/tags","blobs_url":"https://api.github.com/repos/bykoianko/omim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bykoianko/omim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bykoianko/omim/git/refs{/sha}","trees_url":"https://api.github.com/repos/bykoianko/omim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bykoianko/omim/statuses/{sha}","languages_url":"https://api.github.com/repos/bykoianko/omim/languages","stargazers_url":"https://api.github.com/repos/bykoianko/omim/stargazers","contributors_url":"https://api.github.com/repos/bykoianko/omim/contributors","subscribers_url":"https://api.github.com/repos/bykoianko/omim/subscribers","subscription_url":"https://api.github.com/repos/bykoianko/omim/subscription","commits_url":"https://api.github.com/repos/bykoianko/omim/commits{/sha}","git_commits_url":"https://api.github.com/repos/bykoianko/omim/git/commits{/sha}","comments_url":"https://api.github.com/repos/bykoianko/omim/comments{/number}","issue_comment_url":"https://api.github.com/repos/bykoianko/omim/issues/comments{/number}","contents_url":"https://api.github.com/repos/bykoianko/omim/contents/{+path}","compare_url":"https://api.github.com/repos/bykoianko/omim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bykoianko/omim/merges","archive_url":"https://api.github.com/repos/bykoianko/omim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bykoianko/omim/downloads","issues_url":"https://api.github.com/repos/bykoianko/omim/issues{/number}","pulls_url":"https://api.github.com/repos/bykoianko/omim/pulls{/number}","milestones_url":"https://api.github.com/repos/bykoianko/omim/milestones{/number}","notifications_url":"https://api.github.com/repos/bykoianko/omim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bykoianko/omim/labels{/name}","releases_url":"https://api.github.com/repos/bykoianko/omim/releases{/id}","deployments_url":"https://api.github.com/repos/bykoianko/omim/deployments","created_at":"2015-09-30T11:21:20Z","updated_at":"2016-03-24T12:55:17Z","pushed_at":"2017-03-04T21:29:00Z","git_url":"git://github.com/bykoianko/omim.git","ssh_url":"git@github.com:bykoianko/omim.git","clone_url":"https://github.com/bykoianko/omim.git","svn_url":"https://github.com/bykoianko/omim","homepage":null,"size":2872409,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mapsme:master","ref":"master","sha":"143a6e962b42980c8ead4ebb86d74390d1122599","user":{"login":"mapsme","id":14185141,"avatar_url":"https://avatars2.githubusercontent.com/u/14185141?v=3","gravatar_id":"","url":"https://api.github.com/users/mapsme","html_url":"https://github.com/mapsme","followers_url":"https://api.github.com/users/mapsme/followers","following_url":"https://api.github.com/users/mapsme/following{/other_user}","gists_url":"https://api.github.com/users/mapsme/gists{/gist_id}","starred_url":"https://api.github.com/users/mapsme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapsme/subscriptions","organizations_url":"https://api.github.com/users/mapsme/orgs","repos_url":"https://api.github.com/users/mapsme/repos","events_url":"https://api.github.com/users/mapsme/events{/privacy}","received_events_url":"https://api.github.com/users/mapsme/received_events","type":"Organization","site_admin":false},"repo":{"id":42798033,"name":"omim","full_name":"mapsme/omim","owner":{"login":"mapsme","id":14185141,"avatar_url":"https://avatars2.githubusercontent.com/u/14185141?v=3","gravatar_id":"","url":"https://api.github.com/users/mapsme","html_url":"https://github.com/mapsme","followers_url":"https://api.github.com/users/mapsme/followers","following_url":"https://api.github.com/users/mapsme/following{/other_user}","gists_url":"https://api.github.com/users/mapsme/gists{/gist_id}","starred_url":"https://api.github.com/users/mapsme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapsme/subscriptions","organizations_url":"https://api.github.com/users/mapsme/orgs","repos_url":"https://api.github.com/users/mapsme/repos","events_url":"https://api.github.com/users/mapsme/events{/privacy}","received_events_url":"https://api.github.com/users/mapsme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mapsme/omim","description":"🗺️ MAPS.ME — Offline OpenStreetMap maps for iOS and Android","fork":false,"url":"https://api.github.com/repos/mapsme/omim","forks_url":"https://api.github.com/repos/mapsme/omim/forks","keys_url":"https://api.github.com/repos/mapsme/omim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapsme/omim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapsme/omim/teams","hooks_url":"https://api.github.com/repos/mapsme/omim/hooks","issue_events_url":"https://api.github.com/repos/mapsme/omim/issues/events{/number}","events_url":"https://api.github.com/repos/mapsme/omim/events","assignees_url":"https://api.github.com/repos/mapsme/omim/assignees{/user}","branches_url":"https://api.github.com/repos/mapsme/omim/branches{/branch}","tags_url":"https://api.github.com/repos/mapsme/omim/tags","blobs_url":"https://api.github.com/repos/mapsme/omim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapsme/omim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapsme/omim/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapsme/omim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapsme/omim/statuses/{sha}","languages_url":"https://api.github.com/repos/mapsme/omim/languages","stargazers_url":"https://api.github.com/repos/mapsme/omim/stargazers","contributors_url":"https://api.github.com/repos/mapsme/omim/contributors","subscribers_url":"https://api.github.com/repos/mapsme/omim/subscribers","subscription_url":"https://api.github.com/repos/mapsme/omim/subscription","commits_url":"https://api.github.com/repos/mapsme/omim/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapsme/omim/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapsme/omim/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapsme/omim/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapsme/omim/contents/{+path}","compare_url":"https://api.github.com/repos/mapsme/omim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapsme/omim/merges","archive_url":"https://api.github.com/repos/mapsme/omim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapsme/omim/downloads","issues_url":"https://api.github.com/repos/mapsme/omim/issues{/number}","pulls_url":"https://api.github.com/repos/mapsme/omim/pulls{/number}","milestones_url":"https://api.github.com/repos/mapsme/omim/milestones{/number}","notifications_url":"https://api.github.com/repos/mapsme/omim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapsme/omim/labels{/name}","releases_url":"https://api.github.com/repos/mapsme/omim/releases{/id}","deployments_url":"https://api.github.com/repos/mapsme/omim/deployments","created_at":"2015-09-20T02:57:13Z","updated_at":"2017-03-04T18:54:29Z","pushed_at":"2017-03-04T21:29:02Z","git_url":"git://github.com/mapsme/omim.git","ssh_url":"git@github.com:mapsme/omim.git","clone_url":"https://github.com/mapsme/omim.git","svn_url":"https://github.com/mapsme/omim","homepage":"","size":2961483,"stargazers_count":2172,"watchers_count":2172,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":431,"mirror_url":null,"open_issues_count":429,"forks":431,"open_issues":429,"watchers":2172,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/5508"},"html":{"href":"https://github.com/mapsme/omim/pull/5508"},"issue":{"href":"https://api.github.com/repos/mapsme/omim/issues/5508"},"comments":{"href":"https://api.github.com/repos/mapsme/omim/issues/5508/comments"},"review_comments":{"href":"https://api.github.com/repos/mapsme/omim/pulls/5508/comments"},"review_comment":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mapsme/omim/pulls/5508/commits"},"statuses":{"href":"https://api.github.com/repos/mapsme/omim/statuses/b59e99d819924fab35fc157d45a90167c82b99b0"}}}}
{"actor":{"display_login":"dobriy-eeh"}}