-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QgsVectorLayer: add addMultiRing and use it in QgsMapToolAddRing #50447
QgsVectorLayer: add addMultiRing and use it in QgsMapToolAddRing #50447
Conversation
3b8ff92
to
39ec98f
Compare
python/core/auto_generated/vector/qgsvectorlayereditutils.sip.in
Outdated
Show resolved
Hide resolved
2aae8fd
to
bb0029c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got some unit tests coming too?
The `QgsMapToolAddRing` adds a ring through the `addRing` method of `QgsVectorLayerEditUtils` called by this of `QgsVectorLayer`. The bug described in qgis#23113 indicates that only one of the entities receives the ring addition when using the map tool. This is consistent with the documentation of the `addRing` methods. So, it is by design that the tool works like this. However, as stated in the ticket, it is best to add the ring to all entities. In order to avoid an api break, I added a new addMultiRing method that adds the ring on all entities. Fixes qgis#23113
QgsMapToolAddRing can use the one from QgsVectorLayerEditUtils. All checks are made inside QgsVectorLayerEditUtils.
2d49918
to
cc07d1e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like the addMultiRing()
name, it kind of implies adding a MultiRing, if there is such a thing.
Imho, the old behavior is buggy and should be fixed on the existing methods. Is there a use case where the old only add a ring to a random intersecting polygon would be needed?
hmmm right, what's your suggestion?
It was by design, and can't be fixed without an api break.
Personally, I don't know. |
How about Also, a test case for "selected features only" would be nice |
Done, thanks. |
6e1ffc4
to
2cede13
Compare
The backport to
stderr
stdout
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-queued_ltr_backports queued_ltr_backports
# Navigate to the new working tree
cd .worktrees/backport-queued_ltr_backports
# Create a new branch
git switch --create backport-50447-to-queued_ltr_backports
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick b09c2d113232ca1b4c5cc1e6be8cd5ad372f5019,6ebb15db9c937b73b46727fe98e31903ffd360a3,992e2bf1dfec13291f13b59a266dd54b41e5d05d,5d7a0253040243f85c5f6e17b6bf40dea758c69c,6a1222f187f68e250139cbf44add069ae4077cc4,cc07d1e7772e868779c76f947b6fccfadb6a198a,732be4999a00b927e0fd8deee4212724564add5b,e3bf816f55b4b52aeca0e3bcade04aac0dc5f132,2cede134edd84d69b86016eee97b2ca332af547d
# Push it to GitHub
git push --set-upstream origin backport-50447-to-queued_ltr_backports
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-queued_ltr_backports Then, create a pull request where the |
@lbartoletti looks like this has introduced a flaky test -- see eg #50597 |
Hi @lbartoletti, may you please have a look at the regression reported at #59053 which may be related to this PR? |
and remove a fix me (refs qgis/QGIS#50447)
and remove a fix me (refs qgis/QGIS#50447)
Description
The
QgsMapToolAddRing
adds a ring through theaddRing
method ofQgsVectorLayerEditUtils
called by this ofQgsVectorLayer
.The bug described in #23113 indicates that only one of the entities receives the ring addition when using the map tool.
This is consistent with the documentation of the
addRing
methods. So, it is by design that the tool works like this.However, as stated in the ticket, it is best to add the ring to all entities.
In order to avoid an api break, I added a new addMultiRing method that adds the ring on all entities.
Fixes #23113
recording_2022-10-03-161557.mp4