{"action":"created","comment":{"url":"https://api.github.com/repos/mapsme/omim/pulls/comments/47900839","id":47900839,"diff_hunk":"@@ -39,25 +38,51 @@ GpsTrackFilter::GpsTrackFilter()\n void GpsTrackFilter::Process(vector<location::GpsInfo> const & inPoints,\n                              vector<location::GpsTrackInfo> & outPoints)\n {\n-  // Very simple initial implementation of filter.\n-  // Further, it is going to be improved.\n-\n   outPoints.reserve(inPoints.size());\n \n-  for (auto const & originPt : inPoints)\n+  for (location::GpsInfo const & currInfo : inPoints)\n   {\n-    // Filter point by accuracy\n-    if (m_minAccuracy > 0 && originPt.m_horizontalAccuracy > m_minAccuracy)\n+    if (!m_hasLastInfo)\n+    {\n+      m_hasLastInfo = true;\n+      m_lastInfo = currInfo;\n+      outPoints.emplace_back(currInfo);\n+      continue;\n+    }\n+\n+    // Filter points which happens earlier than first point\n+    if (currInfo.m_timestamp <= m_lastInfo.m_timestamp)\n       continue;\n \n+    // Distance in meters between last and current point is, meters:\n+    double const distance = ms::DistanceOnEarth(m_lastInfo.m_latitude, m_lastInfo.m_longitude,\n+                                                currInfo.m_latitude, currInfo.m_longitude);\n+\n     // Filter point by close distance\n-    ms::LatLon const ll(originPt.m_latitude, originPt.m_longitude);\n-    if (m_hasLastLl && ms::DistanceOnEarth(m_lastLl, ll) < kClosePointDistanceMeters)\n+    if (distance < kClosePointDistanceMeters)\n       continue;\n \n-    m_lastLl = ll;\n-    m_hasLastLl = true;\n+    // Filter point if accuracy areas are intersected\n+    if (distance < m_lastInfo.m_horizontalAccuracy && distance < currInfo.m_horizontalAccuracy)\n+      continue;\n+\n+    // Filter by point accuracy\n+    if (currInfo.m_horizontalAccuracy > m_minAccuracy)\n+      continue;\n+\n+    // Time elapsed since last info is, sec:\n+    double const elapsedTime = currInfo.m_timestamp - m_lastInfo.m_speed;\n+\n+    // Prevent jumping between wifi points\n+    // We use following heuristics: if suddenly point jumps over long\n+    // distance in short time then we skip point\n+    if (m_lastInfo.m_speed == 0 && currInfo.m_speed == 0)","path":"map/gps_track_filter.cpp","position":71,"original_position":71,"commit_id":"3dc957663b05a5720c574aee89462c6b09805c13","original_commit_id":"3dc957663b05a5720c574aee89462c6b09805c13","user":{"login":"vng","id":175612,"avatar_url":"https://avatars.githubusercontent.com/u/175612?v=3","gravatar_id":"","url":"https://api.github.com/users/vng","html_url":"https://github.com/vng","followers_url":"https://api.github.com/users/vng/followers","following_url":"https://api.github.com/users/vng/following{/other_user}","gists_url":"https://api.github.com/users/vng/gists{/gist_id}","starred_url":"https://api.github.com/users/vng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vng/subscriptions","organizations_url":"https://api.github.com/users/vng/orgs","repos_url":"https://api.github.com/users/vng/repos","events_url":"https://api.github.com/users/vng/events{/privacy}","received_events_url":"https://api.github.com/users/vng/received_events","type":"User","site_admin":false},"body":"Разве у нас в GpsInfo нет поля источник позиции? (GPS, WiFi, Cell, Fictive, LastKnown).\r\nЭто бы тут здорово помогло. И опять таки: прыжки мы фильтровали в нативных приемниках Андроид (iOS система внутри сама это делает), если только со временем тот код опять не зашаманили ...","created_at":"2015-12-17T12:39:51Z","updated_at":"2015-12-17T12:39:51Z","html_url":"https://github.com/mapsme/omim/pull/1033#discussion_r47900839","pull_request_url":"https://api.github.com/repos/mapsme/omim/pulls/1033","_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments/47900839"},"html":{"href":"https://github.com/mapsme/omim/pull/1033#discussion_r47900839"},"pull_request":{"href":"https://api.github.com/repos/mapsme/omim/pulls/1033"}}},"pull_request":{"url":"https://api.github.com/repos/mapsme/omim/pulls/1033","id":53968389,"html_url":"https://github.com/mapsme/omim/pull/1033","diff_url":"https://github.com/mapsme/omim/pull/1033.diff","patch_url":"https://github.com/mapsme/omim/pull/1033.patch","issue_url":"https://api.github.com/repos/mapsme/omim/issues/1033","number":1033,"state":"open","locked":false,"title":"[gpstracks] New version of gps track filter","user":{"login":"kshalnev","id":8023141,"avatar_url":"https://avatars.githubusercontent.com/u/8023141?v=3","gravatar_id":"","url":"https://api.github.com/users/kshalnev","html_url":"https://github.com/kshalnev","followers_url":"https://api.github.com/users/kshalnev/followers","following_url":"https://api.github.com/users/kshalnev/following{/other_user}","gists_url":"https://api.github.com/users/kshalnev/gists{/gist_id}","starred_url":"https://api.github.com/users/kshalnev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kshalnev/subscriptions","organizations_url":"https://api.github.com/users/kshalnev/orgs","repos_url":"https://api.github.com/users/kshalnev/repos","events_url":"https://api.github.com/users/kshalnev/events{/privacy}","received_events_url":"https://api.github.com/users/kshalnev/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-17T12:08:07Z","updated_at":"2015-12-17T12:39:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e398264ac47c998d0cc48bc8b8c4b5c6f103db2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mapsme/omim/pulls/1033/commits","review_comments_url":"https://api.github.com/repos/mapsme/omim/pulls/1033/comments","review_comment_url":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mapsme/omim/issues/1033/comments","statuses_url":"https://api.github.com/repos/mapsme/omim/statuses/3dc957663b05a5720c574aee89462c6b09805c13","head":{"label":"kshalnev:gps_filter_new","ref":"gps_filter_new","sha":"3dc957663b05a5720c574aee89462c6b09805c13","user":{"login":"kshalnev","id":8023141,"avatar_url":"https://avatars.githubusercontent.com/u/8023141?v=3","gravatar_id":"","url":"https://api.github.com/users/kshalnev","html_url":"https://github.com/kshalnev","followers_url":"https://api.github.com/users/kshalnev/followers","following_url":"https://api.github.com/users/kshalnev/following{/other_user}","gists_url":"https://api.github.com/users/kshalnev/gists{/gist_id}","starred_url":"https://api.github.com/users/kshalnev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kshalnev/subscriptions","organizations_url":"https://api.github.com/users/kshalnev/orgs","repos_url":"https://api.github.com/users/kshalnev/repos","events_url":"https://api.github.com/users/kshalnev/events{/privacy}","received_events_url":"https://api.github.com/users/kshalnev/received_events","type":"User","site_admin":false},"repo":{"id":43427584,"name":"omim","full_name":"kshalnev/omim","owner":{"login":"kshalnev","id":8023141,"avatar_url":"https://avatars.githubusercontent.com/u/8023141?v=3","gravatar_id":"","url":"https://api.github.com/users/kshalnev","html_url":"https://github.com/kshalnev","followers_url":"https://api.github.com/users/kshalnev/followers","following_url":"https://api.github.com/users/kshalnev/following{/other_user}","gists_url":"https://api.github.com/users/kshalnev/gists{/gist_id}","starred_url":"https://api.github.com/users/kshalnev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kshalnev/subscriptions","organizations_url":"https://api.github.com/users/kshalnev/orgs","repos_url":"https://api.github.com/users/kshalnev/repos","events_url":"https://api.github.com/users/kshalnev/events{/privacy}","received_events_url":"https://api.github.com/users/kshalnev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kshalnev/omim","description":"MAPS.ME - Offline OpenStreetMap maps for iOS/Android/Mac/Linux/Windows","fork":true,"url":"https://api.github.com/repos/kshalnev/omim","forks_url":"https://api.github.com/repos/kshalnev/omim/forks","keys_url":"https://api.github.com/repos/kshalnev/omim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kshalnev/omim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kshalnev/omim/teams","hooks_url":"https://api.github.com/repos/kshalnev/omim/hooks","issue_events_url":"https://api.github.com/repos/kshalnev/omim/issues/events{/number}","events_url":"https://api.github.com/repos/kshalnev/omim/events","assignees_url":"https://api.github.com/repos/kshalnev/omim/assignees{/user}","branches_url":"https://api.github.com/repos/kshalnev/omim/branches{/branch}","tags_url":"https://api.github.com/repos/kshalnev/omim/tags","blobs_url":"https://api.github.com/repos/kshalnev/omim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kshalnev/omim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kshalnev/omim/git/refs{/sha}","trees_url":"https://api.github.com/repos/kshalnev/omim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kshalnev/omim/statuses/{sha}","languages_url":"https://api.github.com/repos/kshalnev/omim/languages","stargazers_url":"https://api.github.com/repos/kshalnev/omim/stargazers","contributors_url":"https://api.github.com/repos/kshalnev/omim/contributors","subscribers_url":"https://api.github.com/repos/kshalnev/omim/subscribers","subscription_url":"https://api.github.com/repos/kshalnev/omim/subscription","commits_url":"https://api.github.com/repos/kshalnev/omim/commits{/sha}","git_commits_url":"https://api.github.com/repos/kshalnev/omim/git/commits{/sha}","comments_url":"https://api.github.com/repos/kshalnev/omim/comments{/number}","issue_comment_url":"https://api.github.com/repos/kshalnev/omim/issues/comments{/number}","contents_url":"https://api.github.com/repos/kshalnev/omim/contents/{+path}","compare_url":"https://api.github.com/repos/kshalnev/omim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kshalnev/omim/merges","archive_url":"https://api.github.com/repos/kshalnev/omim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kshalnev/omim/downloads","issues_url":"https://api.github.com/repos/kshalnev/omim/issues{/number}","pulls_url":"https://api.github.com/repos/kshalnev/omim/pulls{/number}","milestones_url":"https://api.github.com/repos/kshalnev/omim/milestones{/number}","notifications_url":"https://api.github.com/repos/kshalnev/omim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kshalnev/omim/labels{/name}","releases_url":"https://api.github.com/repos/kshalnev/omim/releases{/id}","created_at":"2015-09-30T10:46:32Z","updated_at":"2015-09-30T10:49:20Z","pushed_at":"2015-12-17T12:36:08Z","git_url":"git://github.com/kshalnev/omim.git","ssh_url":"git@github.com:kshalnev/omim.git","clone_url":"https://github.com/kshalnev/omim.git","svn_url":"https://github.com/kshalnev/omim","homepage":null,"size":1932319,"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:gps-tracks","ref":"gps-tracks","sha":"cedbd5e577068f027dceda3f660d37337ba956ef","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}","created_at":"2015-09-20T02:57:13Z","updated_at":"2015-12-17T08:39:15Z","pushed_at":"2015-12-17T12:10:39Z","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":1973974,"stargazers_count":1537,"watchers_count":1537,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":191,"mirror_url":null,"open_issues_count":82,"forks":191,"open_issues":82,"watchers":1537,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/1033"},"html":{"href":"https://github.com/mapsme/omim/pull/1033"},"issue":{"href":"https://api.github.com/repos/mapsme/omim/issues/1033"},"comments":{"href":"https://api.github.com/repos/mapsme/omim/issues/1033/comments"},"review_comments":{"href":"https://api.github.com/repos/mapsme/omim/pulls/1033/comments"},"review_comment":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mapsme/omim/pulls/1033/commits"},"statuses":{"href":"https://api.github.com/repos/mapsme/omim/statuses/3dc957663b05a5720c574aee89462c6b09805c13"}}}}