{"action":"created","comment":{"url":"https://api.github.com/repos/mapsme/omim/pulls/comments/65061165","id":65061165,"diff_hunk":"@@ -0,0 +1,274 @@\n+#include \"generator/srtm_parser.hpp\"\n+\n+#include \"routing/bicycle_model.hpp\"\n+\n+#include \"coding/file_name_utils.hpp\"\n+\n+#include \"indexer/classificator_loader.hpp\"\n+#include \"indexer/feature.hpp\"\n+#include \"indexer/feature_processor.hpp\"\n+#include \"indexer/map_style_reader.hpp\"\n+\n+#include \"geometry/mercator.hpp\"\n+#include \"geometry/point2d.hpp\"\n+\n+#include \"platform/platform.hpp\"\n+\n+#include \"base/logging.hpp\"\n+\n+#include \"std/iostream.hpp\"\n+#include \"std/fstream.hpp\"\n+#include \"std/map.hpp\"\n+#include \"std/string.hpp\"\n+\n+#include \"3party/gflags/src/gflags/gflags.h\"\n+#include \"3party/kdtree++/kdtree.hpp\"\n+\n+DEFINE_string(srtm_dir_path, \"\", \"Path to directory with SRTM files\");\n+DEFINE_string(mwm_file_path, \"\", \"Path to an mwm file.\");\n+\n+namespace\n+{\n+routing::BicycleModel const & GetBicycleModel()\n+{\n+  static routing::BicycleModel const instance;\n+  return instance;\n+}\n+\n+int32_t Coord2RoughCoord(double d)\n+{\n+  int32_t constexpr kFactor = 100000;\n+  return static_cast<int32_t>(round(d * kFactor));\n+}\n+\n+struct RoughPoint\n+{\n+  RoughPoint(m2::PointD const & point)\n+    : x(Coord2RoughCoord(point.x)), y(Coord2RoughCoord(point.y)) {}\n+\n+  int32_t x;\n+  int32_t y;\n+};\n+\n+bool operator< (RoughPoint const & l, RoughPoint const & r)\n+{\n+  if (l.x != r.x)\n+    return l.x < r.x;\n+  return l.y < r.y;\n+}\n+\n+template <typename Cont>\n+void PrintCont(Cont const & cont, string const & title, string const & msgText1,\n+               string const & msgText2)\n+{\n+  cout << endl << title << endl;\n+  for (auto const & a : cont)\n+    cout << a.second << msgText1 << a.first << msgText2 << endl;\n+}\n+\n+template <typename Cont>\n+void WriteCSV(Cont const & cont, string const & fileName)\n+{\n+  ofstream fout(fileName);\n+  for (auto const & a : cont)\n+    fout << a.first << \";\" << a.second << endl;\n+}\n+\n+/// \\returns expected point altitude in meters according to linear model.\n+double ExpectedPointAltitude(int16_t startAltitudeMeters, int16_t endAltitudeMeters,\n+                             double distFromStartMeters, double featureLengthMeters)\n+{\n+  if (featureLengthMeters == 0.0)\n+    return 0;\n+  double const k = (endAltitudeMeters - startAltitudeMeters) / featureLengthMeters;\n+  return startAltitudeMeters + k * distFromStartMeters;\n+}\n+\n+class Processor\n+{\n+public:\n+  generator::SrtmTileManager & m_srtmManager;\n+  set<RoughPoint> m_uniqueRoadPoints;\n+  /// Key is altitude difference for feature in meters. If a feature goes up the key is more then 0.\n+  /// Value is a feature counter.\n+  map<generator::SrtmTile::THeight, uint32_t> m_altitudeDiffs;\n+  /// Key is length of feature in meters. Value is a feature counter.\n+  map<uint32_t, uint32_t> m_featureLength;\n+  /// Key is length of feature segment in meters. Value is a segment counter.\n+  map<uint32_t, uint32_t> m_segLength;\n+  /// Key is difference between two values:\n+  /// 1. how many meters it's necessary to go up following the feature. If feature wavy\n+  ///   calculates only raise meters.\n+  /// 2. the difference in altitude between end and start of features.\n+  /// Value is a segment counter.\n+  map<int32_t, uint32_t> m_featureWave;\n+  /// Key is number of meters which is necessary to go up following the feature.\n+  /// Value is a feature counter.\n+  map<int32_t, uint32_t> m_featureUp;\n+  /// Key is number of meters which is necessary to go down following the feature.\n+  /// Value is a feature counter.\n+  map<int32_t, uint32_t> m_featureDown;\n+  /// Key is number of meters. It shows altitude deviation of intermediate feature points\n+  /// from linear model.\n+  /// Value is a feature counter.\n+  map<int32_t, uint32_t> m_diffFromLinear;\n+  /// Feature counter for GetBicycleModel().IsRoad(feature) == true.\n+  uint32_t m_roadCount;\n+  /// Feature counter for empty features with GetBicycleModel().IsRoad(feature).\n+  uint32_t m_emptyRoadCount;\n+  /// Point counter for feature where GetBicycleModel().IsRoad(feature) == true.\n+  uint32_t m_roadPointCount;\n+  /// Feature counter for GetBicycleModel().IsRoad(feature) != true.\n+  uint32_t m_notRoadCount;\n+\n+  Processor(generator::SrtmTileManager & manager)\n+    : m_srtmManager(manager), m_roadCount(0), m_emptyRoadCount(0), m_roadPointCount(0), m_notRoadCount(0)\n+  {\n+  }\n+\n+  void operator()(FeatureType const & f, uint32_t const & id)\n+  {\n+    f.ParseBeforeStatistic();\n+    if (!GetBicycleModel().IsRoad(f))\n+    {\n+      ++m_notRoadCount;\n+      return;\n+    }\n+\n+    f.ParseGeometry(FeatureType::BEST_GEOMETRY);\n+    uint32_t const numPoints = f.GetPointsCount();\n+    if (numPoints == 0)\n+    {\n+      ++m_emptyRoadCount;\n+      return;\n+    }\n+\n+    ++m_roadCount;\n+\n+    m_roadPointCount += numPoints;\n+\n+    for (uint32_t i = 0; i < numPoints; ++i)\n+      m_uniqueRoadPoints.insert(RoughPoint(f.GetPoint(i)));\n+\n+    // Feature length and feature segment length.\n+    double realFeatureLengthMeters = 0.0;\n+    for (uint32_t i = 0; i < numPoints - 1; ++i)","path":"generator/feature_segments_checker/feature_segments_checker.cpp","position":155,"original_position":155,"commit_id":"87731ed71c7aab661b6deb91c66345a5184a6eac","original_commit_id":"87731ed71c7aab661b6deb91c66345a5184a6eac","user":{"login":"bykoianko","id":1768114,"avatar_url":"https://avatars.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":"Yes. Done.","created_at":"2016-05-30T11:49:23Z","updated_at":"2016-05-30T11:49:23Z","html_url":"https://github.com/mapsme/omim/pull/3269#discussion_r65061165","pull_request_url":"https://api.github.com/repos/mapsme/omim/pulls/3269","_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments/65061165"},"html":{"href":"https://github.com/mapsme/omim/pull/3269#discussion_r65061165"},"pull_request":{"href":"https://api.github.com/repos/mapsme/omim/pulls/3269"}}},"pull_request":{"url":"https://api.github.com/repos/mapsme/omim/pulls/3269","id":70684466,"html_url":"https://github.com/mapsme/omim/pull/3269","diff_url":"https://github.com/mapsme/omim/pull/3269.diff","patch_url":"https://github.com/mapsme/omim/pull/3269.patch","issue_url":"https://api.github.com/repos/mapsme/omim/issues/3269","number":3269,"state":"open","locked":false,"title":"A tool to get some statistics about map features and its altitudes.","user":{"login":"bykoianko","id":1768114,"avatar_url":"https://avatars.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":"Это программа при помощи, которой я собираю статистику о фичах и их высотах для велонавигации.\r\n\r\n@ygorshenin @mpimenov посмотрите до завтрашней встречи по возможности. Особенно на то, как я определяю \"волнистость\" фичи (т.е. на сколько на ней много рельефа, не учитываемого высотами в начале и в конце фичи). Именно про результаты работы этой тулзы я буду говорить завтра.\r\n\r\nhttps://jira.mail.ru/browse/MAPSME-1249","created_at":"2016-05-19T12:23:06Z","updated_at":"2016-05-30T11:49:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b9e1d27c58b0c4ec55e4521f38ad42af1fb2716e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mapsme/omim/pulls/3269/commits","review_comments_url":"https://api.github.com/repos/mapsme/omim/pulls/3269/comments","review_comment_url":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mapsme/omim/issues/3269/comments","statuses_url":"https://api.github.com/repos/mapsme/omim/statuses/87731ed71c7aab661b6deb91c66345a5184a6eac","head":{"label":"bykoianko:master-tools-for-mwm-investigation","ref":"master-tools-for-mwm-investigation","sha":"87731ed71c7aab661b6deb91c66345a5184a6eac","user":{"login":"bykoianko","id":1768114,"avatar_url":"https://avatars.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://avatars.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":"2016-05-30T08:21:05Z","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":2388704,"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":"c347f7ae850166f8ccd83173956570108e92578a","user":{"login":"mapsme","id":14185141,"avatar_url":"https://avatars.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://avatars.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/Android/Mac/Linux/Windows","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":"2016-05-30T10:35:54Z","pushed_at":"2016-05-30T11:48:42Z","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":null,"size":2482174,"stargazers_count":1792,"watchers_count":1792,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":277,"mirror_url":null,"open_issues_count":180,"forks":277,"open_issues":180,"watchers":1792,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/3269"},"html":{"href":"https://github.com/mapsme/omim/pull/3269"},"issue":{"href":"https://api.github.com/repos/mapsme/omim/issues/3269"},"comments":{"href":"https://api.github.com/repos/mapsme/omim/issues/3269/comments"},"review_comments":{"href":"https://api.github.com/repos/mapsme/omim/pulls/3269/comments"},"review_comment":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mapsme/omim/pulls/3269/commits"},"statuses":{"href":"https://api.github.com/repos/mapsme/omim/statuses/87731ed71c7aab661b6deb91c66345a5184a6eac"}}}}
{"actor":{"display_login":"bykoianko"}}