{"action":"created","comment":{"url":"https://api.github.com/repos/mapsme/omim/pulls/comments/320309280","pull_request_review_id":283043790,"id":320309280,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMyMDMwOTI4MA==","diff_hunk":"@@ -3,13 +3,100 @@\n #include \"generator/cities_boundaries_builder.hpp\"\n #include \"generator/feature_builder.hpp\"\n \n+#include \"geometry/mercator.hpp\"\n+#include \"geometry/tree4d.hpp\"\n+\n+#include \"base/geo_object_id.hpp\"\n+\n+#include <functional>\n #include <memory>\n+#include <queue>\n+#include <set>\n #include <string>\n #include <unordered_map>\n+#include <utility>\n #include <vector>\n \n namespace generator\n {\n+// The class ClustersFinder finds clusters of objects for which IsSameFunc will return the true.\n+// RadiusFunc should return the same radius for all objects in one cluster.\n+template <typename T, template<typename, typename> class Container, typename Alloc = std::allocator<T>>\n+class ClustersFinder\n+{\n+public:\n+  using RadiusFunc = std::function<double(T const &)>;\n+  using IsSameFunc = std::function<bool(T const &, T const &)>;\n+  using ConstIterator = T const *;\n+\n+  ClustersFinder(Container<T, Alloc> && container, RadiusFunc const & radiusFunc,\n+                 IsSameFunc const & isSameFunc)\n+    : m_container(std::move(container)), m_radiusFunc(radiusFunc), m_isSameFunc(isSameFunc)\n+  {\n+    for (auto const & e : m_container)\n+      m_tree.Add(&e);\n+  }\n+\n+  std::vector<std::vector<T>> Find() const\n+  {\n+    std::vector<std::vector<T>> clusters;\n+    std::set<ConstIterator> unviewed;\n+    for (auto const & e : m_container)\n+      unviewed.insert(&e);\n+\n+    while (!unviewed.empty())\n+      clusters.emplace_back(FindOneCluster(*std::cbegin(unviewed), unviewed));\n+\n+    return clusters;\n+  }\n+\n+private:\n+  struct TraitsDef\n+  {\n+    m2::RectD const LimitRect(ConstIterator const & it) const { return GetLimitRect(*it); }\n+  };\n+\n+  std::vector<T> FindOneCluster(ConstIterator const & it, std::set<ConstIterator> & unviewed) const\n+  {\n+    std::vector<T> cluster{*it};\n+    std::queue<ConstIterator> queue;\n+    queue.emplace(it);\n+    unviewed.erase(it);\n+    while (!queue.empty())\n+    {\n+      auto const current = queue.front();\n+      queue.pop();\n+      auto const queryBbox = GetBboxFor(current);\n+      m_tree.ForEachInRect(queryBbox, [&](auto const & candidate) {\n+        if (unviewed.count(candidate) == 0 || !m_isSameFunc(*current, *candidate))\n+          return;\n+\n+        unviewed.erase(candidate);\n+        queue.emplace(candidate);\n+        cluster.emplace_back(*candidate);\n+      });\n+    }\n+\n+    return cluster;\n+  }\n+\n+  m2::RectD GetBboxFor(ConstIterator const & it) const\n+  {\n+    m2::RectD bbox;\n+    auto const dist = m_radiusFunc(*it);\n+    GetLimitRect(*it).ForEachCorner([&](auto const & p) {\n+      bbox.Add(MercatorBounds::RectByCenterXYAndSizeInMeters(p, dist));\n+    });","path":"generator/place_processor.hpp","position":87,"original_position":87,"commit_id":"8d5627422cb78116f024114f2bd12905a4005543","original_commit_id":"8d5627422cb78116f024114f2bd12905a4005543","user":{"login":"maksimandrianov","id":12376740,"node_id":"MDQ6VXNlcjEyMzc2NzQw","avatar_url":"https://avatars3.githubusercontent.com/u/12376740?v=4","gravatar_id":"","url":"https://api.github.com/users/maksimandrianov","html_url":"https://github.com/maksimandrianov","followers_url":"https://api.github.com/users/maksimandrianov/followers","following_url":"https://api.github.com/users/maksimandrianov/following{/other_user}","gists_url":"https://api.github.com/users/maksimandrianov/gists{/gist_id}","starred_url":"https://api.github.com/users/maksimandrianov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maksimandrianov/subscriptions","organizations_url":"https://api.github.com/users/maksimandrianov/orgs","repos_url":"https://api.github.com/users/maksimandrianov/repos","events_url":"https://api.github.com/users/maksimandrianov/events{/privacy}","received_events_url":"https://api.github.com/users/maksimandrianov/received_events","type":"User","site_admin":false},"body":"о, круто!\r\n++","created_at":"2019-09-03T14:38:48Z","updated_at":"2019-09-03T14:38:48Z","html_url":"https://github.com/mapsme/omim/pull/11577#discussion_r320309280","pull_request_url":"https://api.github.com/repos/mapsme/omim/pulls/11577","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments/320309280"},"html":{"href":"https://github.com/mapsme/omim/pull/11577#discussion_r320309280"},"pull_request":{"href":"https://api.github.com/repos/mapsme/omim/pulls/11577"}},"in_reply_to_id":320306722},"pull_request":{"url":"https://api.github.com/repos/mapsme/omim/pulls/11577","id":312404286,"node_id":"MDExOlB1bGxSZXF1ZXN0MzEyNDA0Mjg2","html_url":"https://github.com/mapsme/omim/pull/11577","diff_url":"https://github.com/mapsme/omim/pull/11577.diff","patch_url":"https://github.com/mapsme/omim/pull/11577.patch","issue_url":"https://api.github.com/repos/mapsme/omim/issues/11577","number":11577,"state":"open","locked":false,"title":"[generator] Improved catalog matching ","user":{"login":"maksimandrianov","id":12376740,"node_id":"MDQ6VXNlcjEyMzc2NzQw","avatar_url":"https://avatars3.githubusercontent.com/u/12376740?v=4","gravatar_id":"","url":"https://api.github.com/users/maksimandrianov","html_url":"https://github.com/maksimandrianov","followers_url":"https://api.github.com/users/maksimandrianov/followers","following_url":"https://api.github.com/users/maksimandrianov/following{/other_user}","gists_url":"https://api.github.com/users/maksimandrianov/gists{/gist_id}","starred_url":"https://api.github.com/users/maksimandrianov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maksimandrianov/subscriptions","organizations_url":"https://api.github.com/users/maksimandrianov/orgs","repos_url":"https://api.github.com/users/maksimandrianov/repos","events_url":"https://api.github.com/users/maksimandrianov/events{/privacy}","received_events_url":"https://api.github.com/users/maksimandrianov/received_events","type":"User","site_admin":false},"body":"С пометкой: нужно для запуска сборки сегодня","created_at":"2019-08-29T16:40:50Z","updated_at":"2019-09-03T14:38:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7b87386a2eb2dcb20cfe60ff457e86cde090fcc3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mapsme/omim/pulls/11577/commits","review_comments_url":"https://api.github.com/repos/mapsme/omim/pulls/11577/comments","review_comment_url":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mapsme/omim/issues/11577/comments","statuses_url":"https://api.github.com/repos/mapsme/omim/statuses/8d5627422cb78116f024114f2bd12905a4005543","head":{"label":"maksimandrianov:improved_matching_catalog","ref":"improved_matching_catalog","sha":"8d5627422cb78116f024114f2bd12905a4005543","user":{"login":"maksimandrianov","id":12376740,"node_id":"MDQ6VXNlcjEyMzc2NzQw","avatar_url":"https://avatars3.githubusercontent.com/u/12376740?v=4","gravatar_id":"","url":"https://api.github.com/users/maksimandrianov","html_url":"https://github.com/maksimandrianov","followers_url":"https://api.github.com/users/maksimandrianov/followers","following_url":"https://api.github.com/users/maksimandrianov/following{/other_user}","gists_url":"https://api.github.com/users/maksimandrianov/gists{/gist_id}","starred_url":"https://api.github.com/users/maksimandrianov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maksimandrianov/subscriptions","organizations_url":"https://api.github.com/users/maksimandrianov/orgs","repos_url":"https://api.github.com/users/maksimandrianov/repos","events_url":"https://api.github.com/users/maksimandrianov/events{/privacy}","received_events_url":"https://api.github.com/users/maksimandrianov/received_events","type":"User","site_admin":false},"repo":{"id":133388788,"node_id":"MDEwOlJlcG9zaXRvcnkxMzMzODg3ODg=","name":"omim","full_name":"maksimandrianov/omim","private":false,"owner":{"login":"maksimandrianov","id":12376740,"node_id":"MDQ6VXNlcjEyMzc2NzQw","avatar_url":"https://avatars3.githubusercontent.com/u/12376740?v=4","gravatar_id":"","url":"https://api.github.com/users/maksimandrianov","html_url":"https://github.com/maksimandrianov","followers_url":"https://api.github.com/users/maksimandrianov/followers","following_url":"https://api.github.com/users/maksimandrianov/following{/other_user}","gists_url":"https://api.github.com/users/maksimandrianov/gists{/gist_id}","starred_url":"https://api.github.com/users/maksimandrianov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maksimandrianov/subscriptions","organizations_url":"https://api.github.com/users/maksimandrianov/orgs","repos_url":"https://api.github.com/users/maksimandrianov/repos","events_url":"https://api.github.com/users/maksimandrianov/events{/privacy}","received_events_url":"https://api.github.com/users/maksimandrianov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/maksimandrianov/omim","description":"🗺️ MAPS.ME — Offline OpenStreetMap maps for iOS and Android","fork":true,"url":"https://api.github.com/repos/maksimandrianov/omim","forks_url":"https://api.github.com/repos/maksimandrianov/omim/forks","keys_url":"https://api.github.com/repos/maksimandrianov/omim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maksimandrianov/omim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maksimandrianov/omim/teams","hooks_url":"https://api.github.com/repos/maksimandrianov/omim/hooks","issue_events_url":"https://api.github.com/repos/maksimandrianov/omim/issues/events{/number}","events_url":"https://api.github.com/repos/maksimandrianov/omim/events","assignees_url":"https://api.github.com/repos/maksimandrianov/omim/assignees{/user}","branches_url":"https://api.github.com/repos/maksimandrianov/omim/branches{/branch}","tags_url":"https://api.github.com/repos/maksimandrianov/omim/tags","blobs_url":"https://api.github.com/repos/maksimandrianov/omim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maksimandrianov/omim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maksimandrianov/omim/git/refs{/sha}","trees_url":"https://api.github.com/repos/maksimandrianov/omim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maksimandrianov/omim/statuses/{sha}","languages_url":"https://api.github.com/repos/maksimandrianov/omim/languages","stargazers_url":"https://api.github.com/repos/maksimandrianov/omim/stargazers","contributors_url":"https://api.github.com/repos/maksimandrianov/omim/contributors","subscribers_url":"https://api.github.com/repos/maksimandrianov/omim/subscribers","subscription_url":"https://api.github.com/repos/maksimandrianov/omim/subscription","commits_url":"https://api.github.com/repos/maksimandrianov/omim/commits{/sha}","git_commits_url":"https://api.github.com/repos/maksimandrianov/omim/git/commits{/sha}","comments_url":"https://api.github.com/repos/maksimandrianov/omim/comments{/number}","issue_comment_url":"https://api.github.com/repos/maksimandrianov/omim/issues/comments{/number}","contents_url":"https://api.github.com/repos/maksimandrianov/omim/contents/{+path}","compare_url":"https://api.github.com/repos/maksimandrianov/omim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maksimandrianov/omim/merges","archive_url":"https://api.github.com/repos/maksimandrianov/omim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maksimandrianov/omim/downloads","issues_url":"https://api.github.com/repos/maksimandrianov/omim/issues{/number}","pulls_url":"https://api.github.com/repos/maksimandrianov/omim/pulls{/number}","milestones_url":"https://api.github.com/repos/maksimandrianov/omim/milestones{/number}","notifications_url":"https://api.github.com/repos/maksimandrianov/omim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maksimandrianov/omim/labels{/name}","releases_url":"https://api.github.com/repos/maksimandrianov/omim/releases{/id}","deployments_url":"https://api.github.com/repos/maksimandrianov/omim/deployments","created_at":"2018-05-14T16:11:26Z","updated_at":"2019-07-02T15:10:36Z","pushed_at":"2019-09-02T15:55:57Z","git_url":"git://github.com/maksimandrianov/omim.git","ssh_url":"git@github.com:maksimandrianov/omim.git","clone_url":"https://github.com/maksimandrianov/omim.git","svn_url":"https://github.com/maksimandrianov/omim","homepage":"","size":4424524,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mapsme:release-93","ref":"release-93","sha":"a9d6b328853a31c115a1ecf9ccd97db0a40fd0d6","user":{"login":"mapsme","id":14185141,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTg1MTQx","avatar_url":"https://avatars1.githubusercontent.com/u/14185141?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnk0Mjc5ODAzMw==","name":"omim","full_name":"mapsme/omim","private":false,"owner":{"login":"mapsme","id":14185141,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTg1MTQx","avatar_url":"https://avatars1.githubusercontent.com/u/14185141?v=4","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},"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":"2019-09-03T07:19:30Z","pushed_at":"2019-09-03T13:35:33Z","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":4449938,"stargazers_count":3087,"watchers_count":3087,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":667,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":835,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":667,"open_issues":835,"watchers":3087,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/11577"},"html":{"href":"https://github.com/mapsme/omim/pull/11577"},"issue":{"href":"https://api.github.com/repos/mapsme/omim/issues/11577"},"comments":{"href":"https://api.github.com/repos/mapsme/omim/issues/11577/comments"},"review_comments":{"href":"https://api.github.com/repos/mapsme/omim/pulls/11577/comments"},"review_comment":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mapsme/omim/pulls/11577/commits"},"statuses":{"href":"https://api.github.com/repos/mapsme/omim/statuses/8d5627422cb78116f024114f2bd12905a4005543"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"maksimandrianov"}}