Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Add option of bounding box for PolygonSelector#21830
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
5847eda
to4ac8e37
CompareThis should be ready for review now |
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.
This works nicely, I made a couple of comments/suggestions.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
dhomeier left a comment
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.
Thanks for the PR and updates; I have tested this with a method inastropy/regions#406 that uses this new functionality and see that some early quirks have already been resolved!
A general issue with thatregions
method, which connects a customPolygonSelector
, is that creating a complete instance is somewhat tedious – adding the vertices and then triggering a redraw and finally marking the selector_selection_completed
; for most of this I have not found public methods for the required operations. Having those, analogously toextents
etc. inRectangleSelector
would be a plus (but not necessary from this PR).
Uh oh!
There was an error while loading.Please reload this page.
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.
This looks good, it just need the test to be fixed!
Uh oh!
There was an error while loading.Please reload this page.
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 wonder if it should be calleddraw_bbox
, or evendraw_bounding_box
(since we seem to have pretty verbose names in widgets already.)
Uh oh!
There was an error while loading.Please reload this page.
event_sequence = (polygon_place_vertex(*verts[0]) + | ||
polygon_place_vertex(*verts[1]) + | ||
polygon_place_vertex(*verts[2]) + | ||
polygon_place_vertex(*verts[3]) + | ||
polygon_place_vertex(*verts[0])) |
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.
event_sequence= (polygon_place_vertex(*verts[0])+ | |
polygon_place_vertex(*verts[1])+ | |
polygon_place_vertex(*verts[2])+ | |
polygon_place_vertex(*verts[3])+ | |
polygon_place_vertex(*verts[0])) | |
event_sequence= ( | |
*polygon_place_vertex(*verts[0]), | |
*polygon_place_vertex(*verts[1]), | |
*polygon_place_vertex(*verts[2]), | |
*polygon_place_vertex(*verts[3]), | |
*polygon_place_vertex(*verts[0]), | |
) |
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 didn't do this since the rest oftest_widgets.py
uses the+
notation. I'd be happy to put in a PR to change it all in one go though?
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Update polygon every time bounding box is movedAllow box customisationRemove delPrevent rotation on polygon bounding boxFix line lengthCleanup transform logicDon't use dicts as keyword defaultsMinor doc fixes
Run exising polygon selector tests with draw_box=True
Trigger events on canvas in testTest doc fixes
Thanks for reviewing. I changed the argument name to |
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Uh oh!
There was an error while loading.Please reload this page.
PR Summary
This allows one to put a bounding box around a PolygonSelector, that can be used for resizing and moving (and eventually rotating) the selector points.
polygon.mov
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).