{"action":"created","comment":{"url":"https://api.github.com/repos/qgis/QGIS/pulls/comments/179635556","pull_request_review_id":109917904,"id":179635556,"diff_hunk":"@@ -330,6 +330,57 @@ QgsPointLocator::Match QgsSnappingUtils::snapToMap( const QgsPointXY &pointMap,\n }\n \n \n+QgsFeatureIds QgsSnappingUtils::isMatchAVisibleLayer( QgsVectorLayer *layer )\n+{\n+\n+  QgsFeatureIds fids;\n+\n+    if ( layer )\n+    {\n+        if (!mEnableSnappingForInvisibleFeature) {\n+      bool filter = false;\n+      QgsRenderContext context( QgsRenderContext::fromMapSettings( mMapSettings ) );\n+      context.expressionContext() << QgsExpressionContextUtils::layerScope( layer );\n+      std::unique_ptr< QgsFeatureRenderer > renderer( layer->renderer() ? layer->renderer()->clone() : nullptr );\n+      if ( renderer )\n+      {\n+        // setup scale for scale dependent visibility (rule based)\n+        renderer->startRender( context, layer->fields() );\n+        filter = renderer->capabilities() & QgsFeatureRenderer::Filter;\n+      }\n+\n+\n+      QgsFeatureIterator fi = layer->getFeatures();\n+\n+      QgsFeature feat;\n+      while ( fi.nextFeature( feat ) )\n+      {\n+        context.expressionContext().setFeature( feat );\n+\n+        if ( !(filter && !renderer->willRenderFeature( feat, context ) ) )\n+            fids.insert( feat.id() );\n+      }\n+\n+      if ( renderer )\n+      {\n+        renderer->stopRender( context );\n+      }\n+        }\n+        else {","path":"src/core/qgssnappingutils.cpp","position":81,"original_position":81,"commit_id":"9cb48f3170b30c18e0792a8b52f68a128ea2b69e","original_commit_id":"9cb48f3170b30c18e0792a8b52f68a128ea2b69e","user":{"login":"nyalldawson","id":1829991,"avatar_url":"https://avatars1.githubusercontent.com/u/1829991?v=4","gravatar_id":"","url":"https://api.github.com/users/nyalldawson","html_url":"https://github.com/nyalldawson","followers_url":"https://api.github.com/users/nyalldawson/followers","following_url":"https://api.github.com/users/nyalldawson/following{/other_user}","gists_url":"https://api.github.com/users/nyalldawson/gists{/gist_id}","starred_url":"https://api.github.com/users/nyalldawson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyalldawson/subscriptions","organizations_url":"https://api.github.com/users/nyalldawson/orgs","repos_url":"https://api.github.com/users/nyalldawson/repos","events_url":"https://api.github.com/users/nyalldawson/events{/privacy}","received_events_url":"https://api.github.com/users/nyalldawson/received_events","type":"User","site_admin":false},"body":"I don't think this else branch is needed - if the invisible skipping is disabled, you could return an empty list here. That'll be handled correctly by the request in QgsPointLocator::rebuildIndex and avoid the expensive full layer iteration performed here.","created_at":"2018-04-06T00:32:45Z","updated_at":"2018-04-06T00:38:22Z","html_url":"https://github.com/qgis/QGIS/pull/6750#discussion_r179635556","pull_request_url":"https://api.github.com/repos/qgis/QGIS/pulls/6750","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/comments/179635556"},"html":{"href":"https://github.com/qgis/QGIS/pull/6750#discussion_r179635556"},"pull_request":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/6750"}}},"pull_request":{"url":"https://api.github.com/repos/qgis/QGIS/pulls/6750","id":179586194,"html_url":"https://github.com/qgis/QGIS/pull/6750","diff_url":"https://github.com/qgis/QGIS/pull/6750.diff","patch_url":"https://github.com/qgis/QGIS/pull/6750.patch","issue_url":"https://api.github.com/repos/qgis/QGIS/issues/6750","number":6750,"state":"open","locked":false,"title":"[WIP][BUGFIX][FEATURE][NEEDS-DOCS] Disable snapping on invisible features. Second version","user":{"login":"lbartoletti","id":7521540,"avatar_url":"https://avatars1.githubusercontent.com/u/7521540?v=4","gravatar_id":"","url":"https://api.github.com/users/lbartoletti","html_url":"https://github.com/lbartoletti","followers_url":"https://api.github.com/users/lbartoletti/followers","following_url":"https://api.github.com/users/lbartoletti/following{/other_user}","gists_url":"https://api.github.com/users/lbartoletti/gists{/gist_id}","starred_url":"https://api.github.com/users/lbartoletti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbartoletti/subscriptions","organizations_url":"https://api.github.com/users/lbartoletti/orgs","repos_url":"https://api.github.com/users/lbartoletti/repos","events_url":"https://api.github.com/users/lbartoletti/events{/privacy}","received_events_url":"https://api.github.com/users/lbartoletti/received_events","type":"User","site_admin":false},"body":"## Description\r\nFollowing the discussions, I open a new PR with modifications for #6657 / Fixes #16838.\r\n\r\nIf you are ok with the new propositions, I will add tests\r\n\r\nA comment, I thought that by activating/deactivating a style, the styleChanged or rendererChanged signal would be emitted. This is not the case, I added the repaintRequested signal. See the [video](https://raw.githubusercontent.com/lbartoletti/lbartoletti.github.io/master/snapPrepared/snapPrepared.webm)\r\n\r\nI tested on a data set with the cadastre and all networks (water, sanitation, road, etc.) on an old computer and for me it is usable.\r\n\r\n## Checklist\r\n\r\n> Reviewing is a process done by project maintainers, mostly on a volunteer basis. We try to keep the overhead as small as possible and appreciate if you help us to do so by completing the following items. Feel free to ask in a comment if you have troubles with any of them.\r\n\r\n- [X] Commit messages are descriptive and explain the rationale for changes\r\n- [X] Commits which fix bugs include `fixes #11111` in the commit message next to the description\r\n- [X] Commits which add new features are tagged with `[FEATURE]` in the commit message\r\n- [X] Commits which change the UI or existing user workflows are tagged with `[needs-docs]` in the commit message and containt sufficient information in the commit message to be documented\r\n- [X] I have read the [QGIS Coding Standards](https://docs.qgis.org/testing/en/docs/developers_guide/codingstandards.html) and this PR complies with them\r\n- [ ] This PR passes all existing unit tests (test results will be reported by travis-ci after opening this PR)\r\n- [ ] New unit tests have been added for core changes\r\n- [X] I have run [the `scripts/prepare-commit.sh` script](https://github.com/qgis/QGIS/blob/master/.github/CONTRIBUTE.md#contributing-to-qgis) before each commit\r\n","created_at":"2018-04-05T06:50:38Z","updated_at":"2018-04-06T00:38:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5494059a304de5fa69b1ce4acabe7548d8bb57f1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/qgis/QGIS/pulls/6750/commits","review_comments_url":"https://api.github.com/repos/qgis/QGIS/pulls/6750/comments","review_comment_url":"https://api.github.com/repos/qgis/QGIS/pulls/comments{/number}","comments_url":"https://api.github.com/repos/qgis/QGIS/issues/6750/comments","statuses_url":"https://api.github.com/repos/qgis/QGIS/statuses/9cb48f3170b30c18e0792a8b52f68a128ea2b69e","head":{"label":"lbartoletti:visibleSnapPerf","ref":"visibleSnapPerf","sha":"9cb48f3170b30c18e0792a8b52f68a128ea2b69e","user":{"login":"lbartoletti","id":7521540,"avatar_url":"https://avatars1.githubusercontent.com/u/7521540?v=4","gravatar_id":"","url":"https://api.github.com/users/lbartoletti","html_url":"https://github.com/lbartoletti","followers_url":"https://api.github.com/users/lbartoletti/followers","following_url":"https://api.github.com/users/lbartoletti/following{/other_user}","gists_url":"https://api.github.com/users/lbartoletti/gists{/gist_id}","starred_url":"https://api.github.com/users/lbartoletti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbartoletti/subscriptions","organizations_url":"https://api.github.com/users/lbartoletti/orgs","repos_url":"https://api.github.com/users/lbartoletti/repos","events_url":"https://api.github.com/users/lbartoletti/events{/privacy}","received_events_url":"https://api.github.com/users/lbartoletti/received_events","type":"User","site_admin":false},"repo":{"id":69051246,"name":"QGIS","full_name":"lbartoletti/QGIS","owner":{"login":"lbartoletti","id":7521540,"avatar_url":"https://avatars1.githubusercontent.com/u/7521540?v=4","gravatar_id":"","url":"https://api.github.com/users/lbartoletti","html_url":"https://github.com/lbartoletti","followers_url":"https://api.github.com/users/lbartoletti/followers","following_url":"https://api.github.com/users/lbartoletti/following{/other_user}","gists_url":"https://api.github.com/users/lbartoletti/gists{/gist_id}","starred_url":"https://api.github.com/users/lbartoletti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbartoletti/subscriptions","organizations_url":"https://api.github.com/users/lbartoletti/orgs","repos_url":"https://api.github.com/users/lbartoletti/repos","events_url":"https://api.github.com/users/lbartoletti/events{/privacy}","received_events_url":"https://api.github.com/users/lbartoletti/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lbartoletti/QGIS","description":"QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)","fork":true,"url":"https://api.github.com/repos/lbartoletti/QGIS","forks_url":"https://api.github.com/repos/lbartoletti/QGIS/forks","keys_url":"https://api.github.com/repos/lbartoletti/QGIS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lbartoletti/QGIS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lbartoletti/QGIS/teams","hooks_url":"https://api.github.com/repos/lbartoletti/QGIS/hooks","issue_events_url":"https://api.github.com/repos/lbartoletti/QGIS/issues/events{/number}","events_url":"https://api.github.com/repos/lbartoletti/QGIS/events","assignees_url":"https://api.github.com/repos/lbartoletti/QGIS/assignees{/user}","branches_url":"https://api.github.com/repos/lbartoletti/QGIS/branches{/branch}","tags_url":"https://api.github.com/repos/lbartoletti/QGIS/tags","blobs_url":"https://api.github.com/repos/lbartoletti/QGIS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lbartoletti/QGIS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lbartoletti/QGIS/git/refs{/sha}","trees_url":"https://api.github.com/repos/lbartoletti/QGIS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lbartoletti/QGIS/statuses/{sha}","languages_url":"https://api.github.com/repos/lbartoletti/QGIS/languages","stargazers_url":"https://api.github.com/repos/lbartoletti/QGIS/stargazers","contributors_url":"https://api.github.com/repos/lbartoletti/QGIS/contributors","subscribers_url":"https://api.github.com/repos/lbartoletti/QGIS/subscribers","subscription_url":"https://api.github.com/repos/lbartoletti/QGIS/subscription","commits_url":"https://api.github.com/repos/lbartoletti/QGIS/commits{/sha}","git_commits_url":"https://api.github.com/repos/lbartoletti/QGIS/git/commits{/sha}","comments_url":"https://api.github.com/repos/lbartoletti/QGIS/comments{/number}","issue_comment_url":"https://api.github.com/repos/lbartoletti/QGIS/issues/comments{/number}","contents_url":"https://api.github.com/repos/lbartoletti/QGIS/contents/{+path}","compare_url":"https://api.github.com/repos/lbartoletti/QGIS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lbartoletti/QGIS/merges","archive_url":"https://api.github.com/repos/lbartoletti/QGIS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lbartoletti/QGIS/downloads","issues_url":"https://api.github.com/repos/lbartoletti/QGIS/issues{/number}","pulls_url":"https://api.github.com/repos/lbartoletti/QGIS/pulls{/number}","milestones_url":"https://api.github.com/repos/lbartoletti/QGIS/milestones{/number}","notifications_url":"https://api.github.com/repos/lbartoletti/QGIS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lbartoletti/QGIS/labels{/name}","releases_url":"https://api.github.com/repos/lbartoletti/QGIS/releases{/id}","deployments_url":"https://api.github.com/repos/lbartoletti/QGIS/deployments","created_at":"2016-09-23T18:36:24Z","updated_at":"2018-04-05T07:29:13Z","pushed_at":"2018-04-05T07:28:55Z","git_url":"git://github.com/lbartoletti/QGIS.git","ssh_url":"git@github.com:lbartoletti/QGIS.git","clone_url":"https://github.com/lbartoletti/QGIS.git","svn_url":"https://github.com/lbartoletti/QGIS","homepage":"http://qgis.org","size":1379290,"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":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"qgis:master","ref":"master","sha":"7d65ee9fa4695a15148a42304097ea48dc25f5a6","user":{"login":"qgis","id":483444,"avatar_url":"https://avatars3.githubusercontent.com/u/483444?v=4","gravatar_id":"","url":"https://api.github.com/users/qgis","html_url":"https://github.com/qgis","followers_url":"https://api.github.com/users/qgis/followers","following_url":"https://api.github.com/users/qgis/following{/other_user}","gists_url":"https://api.github.com/users/qgis/gists{/gist_id}","starred_url":"https://api.github.com/users/qgis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qgis/subscriptions","organizations_url":"https://api.github.com/users/qgis/orgs","repos_url":"https://api.github.com/users/qgis/repos","events_url":"https://api.github.com/users/qgis/events{/privacy}","received_events_url":"https://api.github.com/users/qgis/received_events","type":"Organization","site_admin":false},"repo":{"id":1690480,"name":"QGIS","full_name":"qgis/QGIS","owner":{"login":"qgis","id":483444,"avatar_url":"https://avatars3.githubusercontent.com/u/483444?v=4","gravatar_id":"","url":"https://api.github.com/users/qgis","html_url":"https://github.com/qgis","followers_url":"https://api.github.com/users/qgis/followers","following_url":"https://api.github.com/users/qgis/following{/other_user}","gists_url":"https://api.github.com/users/qgis/gists{/gist_id}","starred_url":"https://api.github.com/users/qgis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qgis/subscriptions","organizations_url":"https://api.github.com/users/qgis/orgs","repos_url":"https://api.github.com/users/qgis/repos","events_url":"https://api.github.com/users/qgis/events{/privacy}","received_events_url":"https://api.github.com/users/qgis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/qgis/QGIS","description":"QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)","fork":false,"url":"https://api.github.com/repos/qgis/QGIS","forks_url":"https://api.github.com/repos/qgis/QGIS/forks","keys_url":"https://api.github.com/repos/qgis/QGIS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/qgis/QGIS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/qgis/QGIS/teams","hooks_url":"https://api.github.com/repos/qgis/QGIS/hooks","issue_events_url":"https://api.github.com/repos/qgis/QGIS/issues/events{/number}","events_url":"https://api.github.com/repos/qgis/QGIS/events","assignees_url":"https://api.github.com/repos/qgis/QGIS/assignees{/user}","branches_url":"https://api.github.com/repos/qgis/QGIS/branches{/branch}","tags_url":"https://api.github.com/repos/qgis/QGIS/tags","blobs_url":"https://api.github.com/repos/qgis/QGIS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/qgis/QGIS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/qgis/QGIS/git/refs{/sha}","trees_url":"https://api.github.com/repos/qgis/QGIS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/qgis/QGIS/statuses/{sha}","languages_url":"https://api.github.com/repos/qgis/QGIS/languages","stargazers_url":"https://api.github.com/repos/qgis/QGIS/stargazers","contributors_url":"https://api.github.com/repos/qgis/QGIS/contributors","subscribers_url":"https://api.github.com/repos/qgis/QGIS/subscribers","subscription_url":"https://api.github.com/repos/qgis/QGIS/subscription","commits_url":"https://api.github.com/repos/qgis/QGIS/commits{/sha}","git_commits_url":"https://api.github.com/repos/qgis/QGIS/git/commits{/sha}","comments_url":"https://api.github.com/repos/qgis/QGIS/comments{/number}","issue_comment_url":"https://api.github.com/repos/qgis/QGIS/issues/comments{/number}","contents_url":"https://api.github.com/repos/qgis/QGIS/contents/{+path}","compare_url":"https://api.github.com/repos/qgis/QGIS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/qgis/QGIS/merges","archive_url":"https://api.github.com/repos/qgis/QGIS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/qgis/QGIS/downloads","issues_url":"https://api.github.com/repos/qgis/QGIS/issues{/number}","pulls_url":"https://api.github.com/repos/qgis/QGIS/pulls{/number}","milestones_url":"https://api.github.com/repos/qgis/QGIS/milestones{/number}","notifications_url":"https://api.github.com/repos/qgis/QGIS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/qgis/QGIS/labels{/name}","releases_url":"https://api.github.com/repos/qgis/QGIS/releases{/id}","deployments_url":"https://api.github.com/repos/qgis/QGIS/deployments","created_at":"2011-05-02T08:06:26Z","updated_at":"2018-04-05T23:42:00Z","pushed_at":"2018-04-05T23:41:29Z","git_url":"git://github.com/qgis/QGIS.git","ssh_url":"git@github.com:qgis/QGIS.git","clone_url":"https://github.com/qgis/QGIS.git","svn_url":"https://github.com/qgis/QGIS","homepage":"http://qgis.org","size":1405753,"stargazers_count":1925,"watchers_count":1925,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1223,"mirror_url":null,"archived":false,"open_issues_count":146,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":1223,"open_issues":146,"watchers":1925,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/6750"},"html":{"href":"https://github.com/qgis/QGIS/pull/6750"},"issue":{"href":"https://api.github.com/repos/qgis/QGIS/issues/6750"},"comments":{"href":"https://api.github.com/repos/qgis/QGIS/issues/6750/comments"},"review_comments":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/6750/comments"},"review_comment":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/6750/commits"},"statuses":{"href":"https://api.github.com/repos/qgis/QGIS/statuses/9cb48f3170b30c18e0792a8b52f68a128ea2b69e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"nyalldawson"}}