{"action":"created","comment":{"url":"https://api.github.com/repos/mapsme/omim/pulls/comments/213306640","pull_request_review_id":150113671,"id":213306640,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMzMwNjY0MA==","diff_hunk":"@@ -0,0 +1,101 @@\n+#pragma once\n+\n+#include \"generator/osm_element.hpp\"\n+#include \"generator/routing_helpers.hpp\"\n+\n+#include \"routing/base/followed_polyline.hpp\"\n+#include \"routing/routing_helpers.hpp\"\n+#include \"routing/serialize_speed_camera.hpp\"\n+\n+#include \"indexer/data_source.hpp\"\n+#include \"indexer/feature_data.hpp\"\n+#include \"indexer/feature_decl.hpp\"\n+#include \"indexer/scales.hpp\"\n+\n+#include \"coding/file_writer.hpp\"\n+#include \"coding/write_to_sink.hpp\"\n+\n+#include \"geometry/point2d.hpp\"\n+#include \"geometry/segment2d.hpp\"\n+\n+#include \"base/geo_object_id.hpp\"\n+\n+#include <cstdint>\n+#include <limits>\n+#include <map>\n+#include <string>\n+#include <utility>\n+#include <vector>\n+\n+#include \"boost/optional.hpp\"\n+\n+namespace generator\n+{\n+class CamerasInfoCollector\n+{\n+public:\n+  CamerasInfoCollector(std::string const & dataFilePath, std::string const & camerasInfoPath,\n+                       std::string const & osmIdsToFeatureIdsPath);\n+\n+  void Serialize(FileWriter & writer) const;\n+\n+private:\n+  struct Camera\n+  {\n+    static double constexpr kCoordEqualityEps = 1e-5;\n+\n+    Camera(m2::PointD const & center, uint8_t maxSpeed, std::vector<routing::SpeedCameraMwmPosition> && ways)\n+      : m_data(center, maxSpeed, std::move(ways))\n+    {\n+    }\n+\n+    void ParseDirection()\n+    {\n+      // After some research we understood, that camera's direction is a random option.\n+      // This fact was checked with randomly chosen cameras and google maps 3d view.\n+      // The real direction and the one indicated in the OSM differed.\n+      // So we left space in mwm for this feature and wait until good data appears in OSM\n+    }\n+\n+    // Modify m_ways vector. Set for each way - id of the closest segment.\n+    void FindClosestSegment(FrozenDataSource const & dataSource, MwmSet::MwmId const & mwmId);\n+\n+    /// \\brief Try to FindClosestSegment in |m_ways|. Look to FindMyself() for more details.\n+    /// \\return true if we could find closest segment. And false if we should use geometry index.\n+    bool FindClosestSegmentInInnerWays(FrozenDataSource const & dataSource, MwmSet::MwmId const & mwmId);\n+\n+    /// \\brief Use when |m_ways| is empty. Try to FindClosestSegment using geometry index.\n+    void FindClosestSegmentWithGeometryIndex(FrozenDataSource const & dataSource, MwmSet::MwmId const & mwmId);\n+\n+    // Returns empty object, if current feature - |wayId| is not the road.\n+    // Otherwise returns id of segment from feature with id - |wayId|, which starts at camera's\n+    // center and coefficient - where it placed at the segment.\n+    boost::optional<std::pair<double, uint32_t>> FindMyself(\n+      uint32_t wayFeatureId, FrozenDataSource const & dataSource, MwmSet::MwmId const & mwmId) const;\n+\n+    void Serialize(FileWriter & writer, uint32_t prevFeatureId) const;\n+\n+    routing::SpeedCameraMetadata m_data;\n+  };\n+\n+  static double constexpr kMaxDistFromCameraToClosestSegmentMeters = 20.0;\n+  static double constexpr kSearchCameraRadiusMeters = 10.0;\n+\n+  bool ParseIntermediateInfo(std::string const & camerasInfoPath,\n+                             std::map<base::GeoObjectId, uint32_t> const & osmIdToFeatureId);\n+\n+  std::vector<Camera> m_cameras;\n+};\n+}  // namespace generator\n+\n+namespace routing\n+{\n+// To start building camera info, the following data must be ready:\n+// 1. GenerateIntermediateData(). Cached data about camera node to ways.\n+// 2. GenerateFeatures(). Data about cameras from OSM.\n+// 3. GenerateFinalFeatures(). Calculate some data for features.\n+// 4. BuildOffsetsTable().\n+// 5. BuildIndexFromDataFile() - for doing search in rect.\n+void BuildCamerasInfo(std::string const & dataFilePath, std::string const & camerasInfoPath,\n+                      std::string const & osmIdsToFeatureIdsPath);","path":"generator/camera_info_collector.hpp","position":100,"original_position":100,"commit_id":"a3dfe3dd8b071753e5ed62ebab6488e9d5e73eca","original_commit_id":"e5f7afa623e2eef53f41d8577e9e8ea9e293d4c8","user":{"login":"bykoianko","id":1768114,"node_id":"MDQ6VXNlcjE3NjgxMTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1768114?v=4","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":"Давай все же этот метод в  namespace generator перенесем","created_at":"2018-08-28T13:11:41Z","updated_at":"2018-08-28T13:11:42Z","html_url":"https://github.com/mapsme/omim/pull/9330#discussion_r213306640","pull_request_url":"https://api.github.com/repos/mapsme/omim/pulls/9330","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments/213306640"},"html":{"href":"https://github.com/mapsme/omim/pull/9330#discussion_r213306640"},"pull_request":{"href":"https://api.github.com/repos/mapsme/omim/pulls/9330"}}},"pull_request":{"url":"https://api.github.com/repos/mapsme/omim/pulls/9330","id":209161114,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA5MTYxMTE0","html_url":"https://github.com/mapsme/omim/pull/9330","diff_url":"https://github.com/mapsme/omim/pull/9330.diff","patch_url":"https://github.com/mapsme/omim/pull/9330.patch","issue_url":"https://api.github.com/repos/mapsme/omim/issues/9330","number":9330,"state":"open","locked":false,"title":"[routing] [DNM] Add speed camera section (GENERATOR)","user":{"login":"gmoryes","id":17534533,"node_id":"MDQ6VXNlcjE3NTM0NTMz","avatar_url":"https://avatars2.githubusercontent.com/u/17534533?v=4","gravatar_id":"","url":"https://api.github.com/users/gmoryes","html_url":"https://github.com/gmoryes","followers_url":"https://api.github.com/users/gmoryes/followers","following_url":"https://api.github.com/users/gmoryes/following{/other_user}","gists_url":"https://api.github.com/users/gmoryes/gists{/gist_id}","starred_url":"https://api.github.com/users/gmoryes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmoryes/subscriptions","organizations_url":"https://api.github.com/users/gmoryes/orgs","repos_url":"https://api.github.com/users/gmoryes/repos","events_url":"https://api.github.com/users/gmoryes/events{/privacy}","received_events_url":"https://api.github.com/users/gmoryes/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-08-17T14:13:59Z","updated_at":"2018-08-28T13:11:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a0154a3650264df588dc16d053778cbdf662e66b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mapsme/omim/pulls/9330/commits","review_comments_url":"https://api.github.com/repos/mapsme/omim/pulls/9330/comments","review_comment_url":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mapsme/omim/issues/9330/comments","statuses_url":"https://api.github.com/repos/mapsme/omim/statuses/a3dfe3dd8b071753e5ed62ebab6488e9d5e73eca","head":{"label":"gmoryes:MAPSME-8120.speed_cam.GENERATOR_PART","ref":"MAPSME-8120.speed_cam.GENERATOR_PART","sha":"a3dfe3dd8b071753e5ed62ebab6488e9d5e73eca","user":{"login":"gmoryes","id":17534533,"node_id":"MDQ6VXNlcjE3NTM0NTMz","avatar_url":"https://avatars2.githubusercontent.com/u/17534533?v=4","gravatar_id":"","url":"https://api.github.com/users/gmoryes","html_url":"https://github.com/gmoryes","followers_url":"https://api.github.com/users/gmoryes/followers","following_url":"https://api.github.com/users/gmoryes/following{/other_user}","gists_url":"https://api.github.com/users/gmoryes/gists{/gist_id}","starred_url":"https://api.github.com/users/gmoryes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmoryes/subscriptions","organizations_url":"https://api.github.com/users/gmoryes/orgs","repos_url":"https://api.github.com/users/gmoryes/repos","events_url":"https://api.github.com/users/gmoryes/events{/privacy}","received_events_url":"https://api.github.com/users/gmoryes/received_events","type":"User","site_admin":false},"repo":{"id":141252817,"node_id":"MDEwOlJlcG9zaXRvcnkxNDEyNTI4MTc=","name":"omim","full_name":"gmoryes/omim","owner":{"login":"gmoryes","id":17534533,"node_id":"MDQ6VXNlcjE3NTM0NTMz","avatar_url":"https://avatars2.githubusercontent.com/u/17534533?v=4","gravatar_id":"","url":"https://api.github.com/users/gmoryes","html_url":"https://github.com/gmoryes","followers_url":"https://api.github.com/users/gmoryes/followers","following_url":"https://api.github.com/users/gmoryes/following{/other_user}","gists_url":"https://api.github.com/users/gmoryes/gists{/gist_id}","starred_url":"https://api.github.com/users/gmoryes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmoryes/subscriptions","organizations_url":"https://api.github.com/users/gmoryes/orgs","repos_url":"https://api.github.com/users/gmoryes/repos","events_url":"https://api.github.com/users/gmoryes/events{/privacy}","received_events_url":"https://api.github.com/users/gmoryes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gmoryes/omim","description":"🗺️ MAPS.ME — Offline OpenStreetMap maps for iOS and Android","fork":true,"url":"https://api.github.com/repos/gmoryes/omim","forks_url":"https://api.github.com/repos/gmoryes/omim/forks","keys_url":"https://api.github.com/repos/gmoryes/omim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gmoryes/omim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gmoryes/omim/teams","hooks_url":"https://api.github.com/repos/gmoryes/omim/hooks","issue_events_url":"https://api.github.com/repos/gmoryes/omim/issues/events{/number}","events_url":"https://api.github.com/repos/gmoryes/omim/events","assignees_url":"https://api.github.com/repos/gmoryes/omim/assignees{/user}","branches_url":"https://api.github.com/repos/gmoryes/omim/branches{/branch}","tags_url":"https://api.github.com/repos/gmoryes/omim/tags","blobs_url":"https://api.github.com/repos/gmoryes/omim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gmoryes/omim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gmoryes/omim/git/refs{/sha}","trees_url":"https://api.github.com/repos/gmoryes/omim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gmoryes/omim/statuses/{sha}","languages_url":"https://api.github.com/repos/gmoryes/omim/languages","stargazers_url":"https://api.github.com/repos/gmoryes/omim/stargazers","contributors_url":"https://api.github.com/repos/gmoryes/omim/contributors","subscribers_url":"https://api.github.com/repos/gmoryes/omim/subscribers","subscription_url":"https://api.github.com/repos/gmoryes/omim/subscription","commits_url":"https://api.github.com/repos/gmoryes/omim/commits{/sha}","git_commits_url":"https://api.github.com/repos/gmoryes/omim/git/commits{/sha}","comments_url":"https://api.github.com/repos/gmoryes/omim/comments{/number}","issue_comment_url":"https://api.github.com/repos/gmoryes/omim/issues/comments{/number}","contents_url":"https://api.github.com/repos/gmoryes/omim/contents/{+path}","compare_url":"https://api.github.com/repos/gmoryes/omim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gmoryes/omim/merges","archive_url":"https://api.github.com/repos/gmoryes/omim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gmoryes/omim/downloads","issues_url":"https://api.github.com/repos/gmoryes/omim/issues{/number}","pulls_url":"https://api.github.com/repos/gmoryes/omim/pulls{/number}","milestones_url":"https://api.github.com/repos/gmoryes/omim/milestones{/number}","notifications_url":"https://api.github.com/repos/gmoryes/omim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gmoryes/omim/labels{/name}","releases_url":"https://api.github.com/repos/gmoryes/omim/releases{/id}","deployments_url":"https://api.github.com/repos/gmoryes/omim/deployments","created_at":"2018-07-17T07:57:11Z","updated_at":"2018-08-22T09:46:37Z","pushed_at":"2018-08-28T12:28:43Z","git_url":"git://github.com/gmoryes/omim.git","ssh_url":"git@github.com:gmoryes/omim.git","clone_url":"https://github.com/gmoryes/omim.git","svn_url":"https://github.com/gmoryes/omim","homepage":"","size":4048328,"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,"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:master","ref":"master","sha":"799cf4e4764441914d721d95cfa4b008b9ef96f7","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","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},"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":"2018-08-28T11:57:48Z","pushed_at":"2018-08-28T12:45:00Z","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":4054570,"stargazers_count":2759,"watchers_count":2759,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":597,"mirror_url":null,"archived":false,"open_issues_count":730,"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":597,"open_issues":730,"watchers":2759,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/9330"},"html":{"href":"https://github.com/mapsme/omim/pull/9330"},"issue":{"href":"https://api.github.com/repos/mapsme/omim/issues/9330"},"comments":{"href":"https://api.github.com/repos/mapsme/omim/issues/9330/comments"},"review_comments":{"href":"https://api.github.com/repos/mapsme/omim/pulls/9330/comments"},"review_comment":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mapsme/omim/pulls/9330/commits"},"statuses":{"href":"https://api.github.com/repos/mapsme/omim/statuses/a3dfe3dd8b071753e5ed62ebab6488e9d5e73eca"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"bykoianko"}}