{"action":"created","comment":{"url":"https://api.github.com/repos/qgis/QGIS/pulls/comments/60926507","id":60926507,"diff_hunk":"@@ -100,6 +100,28 @@ void QgsMapToolReshape::cadCanvasReleaseEvent( QgsMapMouseEvent * e )\n         reshapeReturn = geom->reshapeGeometry( points() );\n         if ( reshapeReturn == 0 )\n         {\n+          //avoid intersections on polygon layers\n+          if ( vlayer->geometryType() == QGis::Polygon )\n+          {\n+\n+            //ignore all current layer features as they should be reshaped too\n+            QMap<QgsVectorLayer*, QSet<QgsFeatureId>> ignoreFeatures;\n+            ignoreFeatures.insert( vlayer, vlayer->allFeatureIds() );\n+\n+            int avoidIntersectionsReturn = geom->avoidIntersections( ignoreFeatures );\n+            if ( avoidIntersectionsReturn == 1 )\n+            {\n+              //not a polygon type. Impossible to get there","path":"src/app/qgsmaptoolreshape.cpp","position":15,"original_position":15,"commit_id":"e10a4a6be039342f192404eb087a46a2cd7fd86b","original_commit_id":"e10a4a6be039342f192404eb087a46a2cd7fd86b","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":"If this is impossible to get there, then there should be no code here.\r\n","created_at":"2016-04-25T14:53:36Z","updated_at":"2016-04-25T14:53:36Z","html_url":"https://github.com/qgis/QGIS/pull/2342#discussion_r60926507","pull_request_url":"https://api.github.com/repos/qgis/QGIS/pulls/2342","_links":{"self":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/comments/60926507"},"html":{"href":"https://github.com/qgis/QGIS/pull/2342#discussion_r60926507"},"pull_request":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/2342"}}},"pull_request":{"url":"https://api.github.com/repos/qgis/QGIS/pulls/2342","id":46393040,"html_url":"https://github.com/qgis/QGIS/pull/2342","diff_url":"https://github.com/qgis/QGIS/pull/2342.diff","patch_url":"https://github.com/qgis/QGIS/pull/2342.patch","issue_url":"https://api.github.com/repos/qgis/QGIS/issues/2342","number":2342,"state":"open","locked":false,"title":"Avoid intersections in reshape tool","user":{"login":"arnaud-morvan","id":6095494,"avatar_url":"https://avatars.githubusercontent.com/u/6095494?v=3","gravatar_id":"","url":"https://api.github.com/users/arnaud-morvan","html_url":"https://github.com/arnaud-morvan","followers_url":"https://api.github.com/users/arnaud-morvan/followers","following_url":"https://api.github.com/users/arnaud-morvan/following{/other_user}","gists_url":"https://api.github.com/users/arnaud-morvan/gists{/gist_id}","starred_url":"https://api.github.com/users/arnaud-morvan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arnaud-morvan/subscriptions","organizations_url":"https://api.github.com/users/arnaud-morvan/orgs","repos_url":"https://api.github.com/users/arnaud-morvan/repos","events_url":"https://api.github.com/users/arnaud-morvan/events{/privacy}","received_events_url":"https://api.github.com/users/arnaud-morvan/received_events","type":"User","site_admin":false},"body":"This relates to http://hub.qgis.org/issues/11802 and http://hub.qgis.org/issues/11069.\r\n\r\nHere I call avoid intersections in reshape tool as in add feature tool.\r\nNote that this can affect not modified parts of the reshaped geometry, if there's already existing intersections.\r\n\r\nI've not applyed \"avoid intersection\" with current layer entities, because all entities of the current layer that intersect captured linestring would be reshaped. So \"avoid intersections\" only apply with other layers.\r\n\r\nNote that in the documentation, QgsGeometry::avoidIntersections can return 2 ou 3:\r\nhttp://qgis.org/api/classQgsGeometry.html#a4eb490efc041c462279d4bbe2bbb6d49\r\nBut this is not implement in code for today:\r\nhttps://github.com/qgis/QGIS/blob/8cec2c935f5541a865d0bf91140ca5b2d25b17cb/src/core/geometry/qgsgeometry.cpp#L1497:L1512\r\nThis could be due to recent QgsGeometry changes.\r\n\r\nThese features were funded by: MEDDE (French Ministry of Sustainable Development)","created_at":"2015-09-30T12:04:47Z","updated_at":"2016-04-25T14:53:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"da8b6b6201ee3d0d54f93ac9b6a5c2e4181b48ae","assignee":null,"milestone":{"url":"https://api.github.com/repos/qgis/QGIS/milestones/8","html_url":"https://github.com/qgis/QGIS/milestones/2.14","labels_url":"https://api.github.com/repos/qgis/QGIS/milestones/8/labels","id":1324795,"number":8,"title":"2.14","description":"Feature Freeze: Jan 2016\r\nRelease: Feb 2016","creator":{"login":"m-kuhn","id":588407,"avatar_url":"https://avatars.githubusercontent.com/u/588407?v=3","gravatar_id":"","url":"https://api.github.com/users/m-kuhn","html_url":"https://github.com/m-kuhn","followers_url":"https://api.github.com/users/m-kuhn/followers","following_url":"https://api.github.com/users/m-kuhn/following{/other_user}","gists_url":"https://api.github.com/users/m-kuhn/gists{/gist_id}","starred_url":"https://api.github.com/users/m-kuhn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-kuhn/subscriptions","organizations_url":"https://api.github.com/users/m-kuhn/orgs","repos_url":"https://api.github.com/users/m-kuhn/repos","events_url":"https://api.github.com/users/m-kuhn/events{/privacy}","received_events_url":"https://api.github.com/users/m-kuhn/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":61,"state":"open","created_at":"2015-09-26T08:11:50Z","updated_at":"2016-03-02T07:50:01Z","due_on":"2016-01-14T23:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/qgis/QGIS/pulls/2342/commits","review_comments_url":"https://api.github.com/repos/qgis/QGIS/pulls/2342/comments","review_comment_url":"https://api.github.com/repos/qgis/QGIS/pulls/comments{/number}","comments_url":"https://api.github.com/repos/qgis/QGIS/issues/2342/comments","statuses_url":"https://api.github.com/repos/qgis/QGIS/statuses/e10a4a6be039342f192404eb087a46a2cd7fd86b","head":{"label":"arnaud-morvan:reshape-avoidintersections","ref":"reshape-avoidintersections","sha":"e10a4a6be039342f192404eb087a46a2cd7fd86b","user":{"login":"arnaud-morvan","id":6095494,"avatar_url":"https://avatars.githubusercontent.com/u/6095494?v=3","gravatar_id":"","url":"https://api.github.com/users/arnaud-morvan","html_url":"https://github.com/arnaud-morvan","followers_url":"https://api.github.com/users/arnaud-morvan/followers","following_url":"https://api.github.com/users/arnaud-morvan/following{/other_user}","gists_url":"https://api.github.com/users/arnaud-morvan/gists{/gist_id}","starred_url":"https://api.github.com/users/arnaud-morvan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arnaud-morvan/subscriptions","organizations_url":"https://api.github.com/users/arnaud-morvan/orgs","repos_url":"https://api.github.com/users/arnaud-morvan/repos","events_url":"https://api.github.com/users/arnaud-morvan/events{/privacy}","received_events_url":"https://api.github.com/users/arnaud-morvan/received_events","type":"User","site_admin":false},"repo":{"id":15884637,"name":"QGIS","full_name":"arnaud-morvan/QGIS","owner":{"login":"arnaud-morvan","id":6095494,"avatar_url":"https://avatars.githubusercontent.com/u/6095494?v=3","gravatar_id":"","url":"https://api.github.com/users/arnaud-morvan","html_url":"https://github.com/arnaud-morvan","followers_url":"https://api.github.com/users/arnaud-morvan/followers","following_url":"https://api.github.com/users/arnaud-morvan/following{/other_user}","gists_url":"https://api.github.com/users/arnaud-morvan/gists{/gist_id}","starred_url":"https://api.github.com/users/arnaud-morvan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arnaud-morvan/subscriptions","organizations_url":"https://api.github.com/users/arnaud-morvan/orgs","repos_url":"https://api.github.com/users/arnaud-morvan/repos","events_url":"https://api.github.com/users/arnaud-morvan/events{/privacy}","received_events_url":"https://api.github.com/users/arnaud-morvan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arnaud-morvan/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/arnaud-morvan/QGIS","forks_url":"https://api.github.com/repos/arnaud-morvan/QGIS/forks","keys_url":"https://api.github.com/repos/arnaud-morvan/QGIS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arnaud-morvan/QGIS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arnaud-morvan/QGIS/teams","hooks_url":"https://api.github.com/repos/arnaud-morvan/QGIS/hooks","issue_events_url":"https://api.github.com/repos/arnaud-morvan/QGIS/issues/events{/number}","events_url":"https://api.github.com/repos/arnaud-morvan/QGIS/events","assignees_url":"https://api.github.com/repos/arnaud-morvan/QGIS/assignees{/user}","branches_url":"https://api.github.com/repos/arnaud-morvan/QGIS/branches{/branch}","tags_url":"https://api.github.com/repos/arnaud-morvan/QGIS/tags","blobs_url":"https://api.github.com/repos/arnaud-morvan/QGIS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arnaud-morvan/QGIS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arnaud-morvan/QGIS/git/refs{/sha}","trees_url":"https://api.github.com/repos/arnaud-morvan/QGIS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arnaud-morvan/QGIS/statuses/{sha}","languages_url":"https://api.github.com/repos/arnaud-morvan/QGIS/languages","stargazers_url":"https://api.github.com/repos/arnaud-morvan/QGIS/stargazers","contributors_url":"https://api.github.com/repos/arnaud-morvan/QGIS/contributors","subscribers_url":"https://api.github.com/repos/arnaud-morvan/QGIS/subscribers","subscription_url":"https://api.github.com/repos/arnaud-morvan/QGIS/subscription","commits_url":"https://api.github.com/repos/arnaud-morvan/QGIS/commits{/sha}","git_commits_url":"https://api.github.com/repos/arnaud-morvan/QGIS/git/commits{/sha}","comments_url":"https://api.github.com/repos/arnaud-morvan/QGIS/comments{/number}","issue_comment_url":"https://api.github.com/repos/arnaud-morvan/QGIS/issues/comments{/number}","contents_url":"https://api.github.com/repos/arnaud-morvan/QGIS/contents/{+path}","compare_url":"https://api.github.com/repos/arnaud-morvan/QGIS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arnaud-morvan/QGIS/merges","archive_url":"https://api.github.com/repos/arnaud-morvan/QGIS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arnaud-morvan/QGIS/downloads","issues_url":"https://api.github.com/repos/arnaud-morvan/QGIS/issues{/number}","pulls_url":"https://api.github.com/repos/arnaud-morvan/QGIS/pulls{/number}","milestones_url":"https://api.github.com/repos/arnaud-morvan/QGIS/milestones{/number}","notifications_url":"https://api.github.com/repos/arnaud-morvan/QGIS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arnaud-morvan/QGIS/labels{/name}","releases_url":"https://api.github.com/repos/arnaud-morvan/QGIS/releases{/id}","deployments_url":"https://api.github.com/repos/arnaud-morvan/QGIS/deployments","created_at":"2014-01-13T22:47:33Z","updated_at":"2015-01-09T12:29:09Z","pushed_at":"2016-03-02T13:41:39Z","git_url":"git://github.com/arnaud-morvan/QGIS.git","ssh_url":"git@github.com:arnaud-morvan/QGIS.git","clone_url":"https://github.com/arnaud-morvan/QGIS.git","svn_url":"https://github.com/arnaud-morvan/QGIS","homepage":"http://qgis.org","size":1136370,"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":"1d3cbd91cace921f71183535ca90ca8cf38bf9ef","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}","deployments_url":"https://api.github.com/repos/qgis/QGIS/deployments","created_at":"2011-05-02T08:06:26Z","updated_at":"2016-04-23T17:14:54Z","pushed_at":"2016-04-25T14:29:47Z","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":1294345,"stargazers_count":959,"watchers_count":959,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":822,"mirror_url":null,"open_issues_count":62,"forks":822,"open_issues":62,"watchers":959,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/2342"},"html":{"href":"https://github.com/qgis/QGIS/pull/2342"},"issue":{"href":"https://api.github.com/repos/qgis/QGIS/issues/2342"},"comments":{"href":"https://api.github.com/repos/qgis/QGIS/issues/2342/comments"},"review_comments":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/2342/comments"},"review_comment":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/qgis/QGIS/pulls/2342/commits"},"statuses":{"href":"https://api.github.com/repos/qgis/QGIS/statuses/e10a4a6be039342f192404eb087a46a2cd7fd86b"}}}}