Skip to content
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

Remove drawn features layer when geometries are cleared #2038

Merged
merged 5 commits into from
Jun 14, 2024

Conversation

sufyanAbbasi
Copy link
Collaborator

  • Ensures that whenever the last drawn geometry is removed, regardless of whether it was deleted from the map using the draw control tools or reset using the draw_control.reset() method, the "Drawn Features" layer will also be removed from the layers list.

See: https://colab.research.google.com/drive/1vzHVOhtEr9lQwKqPHh3CkF2FIVcQ5SLN?usp=sharing

Screenshot 2024-06-11 at 6 51 38 PM Screenshot 2024-06-11 at 6 51 50 PM Screenshot 2024-06-11 at 6 51 59 PM

Copy link
Member

@giswqs giswqs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Collaborator

@naschmitz naschmitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add unit tests (as long as it doesn't take too long)?

geemap/core.py Outdated Show resolved Hide resolved
@sufyanAbbasi
Copy link
Collaborator Author

sufyanAbbasi commented Jun 12, 2024

Could you add unit tests (as long as it doesn't take too long)?

Done. To make this better testable, I refactored to move the layer deletion logic to where we call redraw_layer() in the handle_geometry_delete method, and added some more implementation details to the FakeMap.

Copy link
Collaborator

@naschmitz naschmitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much!

@naschmitz naschmitz merged commit 221e410 into gee-community:master Jun 14, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants