{"action":"created","comment":{"url":"https://api.github.com/repos/qgis/QGIS/pulls/comments/34259458","id":34259458,"diff_hunk":"@@ -149,12 +150,28 @@ class CORE_EXPORT QgsLayerTreeModel : public QAbstractItemModel\n     double legendFilterByScale() const { return mLegendFilterByScale; }\n \n     //! Force only display of legend nodes which are valid for given map settings.\n+    //! The selection of legend nodes can be refined by passing a boolean expression and/or a polygon (added in 2.12).\n     //! Setting null pointer or invalid map settings will disable the functionality.\n+    //! If the expression is not empty and valid, only legend nodes where the expression is evaluated to true for at least one feature are displayed.\n+    //! If the polygon is not null, only legend nodes where symbols are inside the polygon are displayed. Coordinates of the polygon are assumed to be\n+    //! expressed in the CRS of the map settings.\n     //! Ownership of map settings pointer does not change, a copy is made.\n+    //! Ownership of the expression does not change, it is a (possibly null) reference\n+    //! Ownership of the polygon does not change, it is copied\n     //! @note added in 2.6\n-    void setLegendFilterByMap( const QgsMapSettings* settings );\n+    void setLegendFilterByMap( const QgsMapSettings* settings, /*const*/ QgsExpression* expression = 0, const QgsGeometry* polygon = 0 );","path":"src/core/layertree/qgslayertreemodel.h","position":24,"original_position":24,"commit_id":"1ec5febeefe6aa4fb00057d24c0dae9022c2954d","original_commit_id":"1ec5febeefe6aa4fb00057d24c0dae9022c2954d","user":{"login":"mhugo","id":1618556,"avatar_url":"https://avatars.githubusercontent.com/u/1618556?v=3","gravatar_id":"","url":"https://api.github.com/users/mhugo","html_url":"https://github.com/mhugo","followers_url":"https://api.github.com/users/mhugo/followers","following_url":"https://api.github.com/users/mhugo/following{/other_user}","gists_url":"https://api.github.com/users/mhugo/gists{/gist_id}","starred_url":"https://api.github.com/users/mhugo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhugo/subscriptions","organizations_url":"https://api.github.com/users/mhugo/orgs","repos_url":"https://api.github.com/users/mhugo/repos","events_url":"https://api.github.com/users/mhugo/events{/privacy}","received_events_url":"https://api.github.com/users/mhugo/received_events","type":"User","site_admin":false},"body":"The idea was to pass a possibly \"prepared\" expression. But ... yeah the gain is probably neglictable. And so if the expression is to be copied, there is no need anymore to pass a QgsExpression, the string will be enough.","created_at":"2015-07-09T14:18:40Z","updated_at":"2015-07-09T14:18:40Z","html_url":"https://github.com/qgis/QGIS/pull/2189#discussion_r34259458","pull_request_url":"https://api.github.com/repos/qgis/QGIS/pulls/2189","_links":{"self":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/comments/34259458"},"html":{"href":"https://github.com/qgis/QGIS/pull/2189#discussion_r34259458"},"pull_request":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/2189"}}},"pull_request":{"url":"https://api.github.com/repos/qgis/QGIS/pulls/2189","id":39064923,"html_url":"https://github.com/qgis/QGIS/pull/2189","diff_url":"https://github.com/qgis/QGIS/pull/2189.diff","patch_url":"https://github.com/qgis/QGIS/pull/2189.patch","issue_url":"https://api.github.com/repos/qgis/QGIS/issues/2189","number":2189,"state":"open","locked":false,"title":"Add more options for filtering legend elements","user":{"login":"mhugo","id":1618556,"avatar_url":"https://avatars.githubusercontent.com/u/1618556?v=3","gravatar_id":"","url":"https://api.github.com/users/mhugo","html_url":"https://github.com/mhugo","followers_url":"https://api.github.com/users/mhugo/followers","following_url":"https://api.github.com/users/mhugo/following{/other_user}","gists_url":"https://api.github.com/users/mhugo/gists{/gist_id}","starred_url":"https://api.github.com/users/mhugo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhugo/subscriptions","organizations_url":"https://api.github.com/users/mhugo/orgs","repos_url":"https://api.github.com/users/mhugo/repos","events_url":"https://api.github.com/users/mhugo/events{/privacy}","received_events_url":"https://api.github.com/users/mhugo/received_events","type":"User","site_admin":false},"body":"This introduces two new options to filter legend elements:\r\n- filter by expression: a boolean expression can be set. Only symbols of\r\nfeatures that make the expression evaluated to true will be kept in the legend\r\n- filter by polygon: only symbols of features that are inside the given\r\npolygon will be part of the legend.\r\n\r\nThe polygon filtering is used in particular for a new option in the\r\ncomposer legend that allows to filter out anything that is not included\r\nin the current atlas polygon.\r\n\r\nReviews are welcome on that.","created_at":"2015-07-02T09:43:53Z","updated_at":"2015-07-09T14:18:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cd3fe903dfc5803c071d5e036cd1f7fe57b3909c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/qgis/QGIS/pulls/2189/commits","review_comments_url":"https://api.github.com/repos/qgis/QGIS/pulls/2189/comments","review_comment_url":"https://api.github.com/repos/qgis/QGIS/pulls/comments{/number}","comments_url":"https://api.github.com/repos/qgis/QGIS/issues/2189/comments","statuses_url":"https://api.github.com/repos/qgis/QGIS/statuses/1ec5febeefe6aa4fb00057d24c0dae9022c2954d","head":{"label":"mhugo:legend_filter","ref":"legend_filter","sha":"1ec5febeefe6aa4fb00057d24c0dae9022c2954d","user":{"login":"mhugo","id":1618556,"avatar_url":"https://avatars.githubusercontent.com/u/1618556?v=3","gravatar_id":"","url":"https://api.github.com/users/mhugo","html_url":"https://github.com/mhugo","followers_url":"https://api.github.com/users/mhugo/followers","following_url":"https://api.github.com/users/mhugo/following{/other_user}","gists_url":"https://api.github.com/users/mhugo/gists{/gist_id}","starred_url":"https://api.github.com/users/mhugo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhugo/subscriptions","organizations_url":"https://api.github.com/users/mhugo/orgs","repos_url":"https://api.github.com/users/mhugo/repos","events_url":"https://api.github.com/users/mhugo/events{/privacy}","received_events_url":"https://api.github.com/users/mhugo/received_events","type":"User","site_admin":false},"repo":{"id":26274103,"name":"QGIS","full_name":"mhugo/QGIS","owner":{"login":"mhugo","id":1618556,"avatar_url":"https://avatars.githubusercontent.com/u/1618556?v=3","gravatar_id":"","url":"https://api.github.com/users/mhugo","html_url":"https://github.com/mhugo","followers_url":"https://api.github.com/users/mhugo/followers","following_url":"https://api.github.com/users/mhugo/following{/other_user}","gists_url":"https://api.github.com/users/mhugo/gists{/gist_id}","starred_url":"https://api.github.com/users/mhugo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhugo/subscriptions","organizations_url":"https://api.github.com/users/mhugo/orgs","repos_url":"https://api.github.com/users/mhugo/repos","events_url":"https://api.github.com/users/mhugo/events{/privacy}","received_events_url":"https://api.github.com/users/mhugo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mhugo/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/mhugo/QGIS","forks_url":"https://api.github.com/repos/mhugo/QGIS/forks","keys_url":"https://api.github.com/repos/mhugo/QGIS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mhugo/QGIS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mhugo/QGIS/teams","hooks_url":"https://api.github.com/repos/mhugo/QGIS/hooks","issue_events_url":"https://api.github.com/repos/mhugo/QGIS/issues/events{/number}","events_url":"https://api.github.com/repos/mhugo/QGIS/events","assignees_url":"https://api.github.com/repos/mhugo/QGIS/assignees{/user}","branches_url":"https://api.github.com/repos/mhugo/QGIS/branches{/branch}","tags_url":"https://api.github.com/repos/mhugo/QGIS/tags","blobs_url":"https://api.github.com/repos/mhugo/QGIS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mhugo/QGIS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mhugo/QGIS/git/refs{/sha}","trees_url":"https://api.github.com/repos/mhugo/QGIS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mhugo/QGIS/statuses/{sha}","languages_url":"https://api.github.com/repos/mhugo/QGIS/languages","stargazers_url":"https://api.github.com/repos/mhugo/QGIS/stargazers","contributors_url":"https://api.github.com/repos/mhugo/QGIS/contributors","subscribers_url":"https://api.github.com/repos/mhugo/QGIS/subscribers","subscription_url":"https://api.github.com/repos/mhugo/QGIS/subscription","commits_url":"https://api.github.com/repos/mhugo/QGIS/commits{/sha}","git_commits_url":"https://api.github.com/repos/mhugo/QGIS/git/commits{/sha}","comments_url":"https://api.github.com/repos/mhugo/QGIS/comments{/number}","issue_comment_url":"https://api.github.com/repos/mhugo/QGIS/issues/comments{/number}","contents_url":"https://api.github.com/repos/mhugo/QGIS/contents/{+path}","compare_url":"https://api.github.com/repos/mhugo/QGIS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mhugo/QGIS/merges","archive_url":"https://api.github.com/repos/mhugo/QGIS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mhugo/QGIS/downloads","issues_url":"https://api.github.com/repos/mhugo/QGIS/issues{/number}","pulls_url":"https://api.github.com/repos/mhugo/QGIS/pulls{/number}","milestones_url":"https://api.github.com/repos/mhugo/QGIS/milestones{/number}","notifications_url":"https://api.github.com/repos/mhugo/QGIS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mhugo/QGIS/labels{/name}","releases_url":"https://api.github.com/repos/mhugo/QGIS/releases{/id}","created_at":"2014-11-06T14:42:05Z","updated_at":"2015-06-30T08:40:10Z","pushed_at":"2015-07-03T07:41:36Z","git_url":"git://github.com/mhugo/QGIS.git","ssh_url":"git@github.com:mhugo/QGIS.git","clone_url":"https://github.com/mhugo/QGIS.git","svn_url":"https://github.com/mhugo/QGIS","homepage":"http://qgis.org","size":1106801,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"qgis:master","ref":"master","sha":"2083d6db258b7d92a0a0ead1d3240d656c574db1","user":{"login":"qgis","id":483444,"avatar_url":"https://avatars.githubusercontent.com/u/483444?v=3","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://avatars.githubusercontent.com/u/483444?v=3","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}","created_at":"2011-05-02T08:06:26Z","updated_at":"2015-07-07T22:01:55Z","pushed_at":"2015-07-09T12:56:37Z","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":1197187,"stargazers_count":707,"watchers_count":707,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":649,"mirror_url":null,"open_issues_count":51,"forks":649,"open_issues":51,"watchers":707,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/2189"},"html":{"href":"https://github.com/qgis/QGIS/pull/2189"},"issue":{"href":"https://api.github.com/repos/qgis/QGIS/issues/2189"},"comments":{"href":"https://api.github.com/repos/qgis/QGIS/issues/2189/comments"},"review_comments":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/2189/comments"},"review_comment":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/2189/commits"},"statuses":{"href":"https://api.github.com/repos/qgis/QGIS/statuses/1ec5febeefe6aa4fb00057d24c0dae9022c2954d"}}}}