Skip to content

Conversation

sufyanAbbasi
Copy link
Collaborator

  • A widgetized version of the draw controls that is mostly backwards compatible with the existing API and adds a few key API features that are missing in the original draw controls. The key design feature is that the AbstractDrawControl can be implemented with any draw control API, so long as they implement the following four methods:
    def _bind_to_draw_control(self):
        """Set up draw control event handling like create, edit, and delete."""
        raise NotImplementedError()
    
    def _remove_geometry_at_index_on_draw_control(self):
        """Remove the geometry at the given index on the draw control."""
        raise NotImplementedError()

    def _clear_draw_control(self):
        """Clears the geometries from the draw control."""
        raise NotImplementedError()

    def _get_synced_geojson_from_draw_control(self):
        """Returns an up-to-date of GeoJSON from the draw control."""
        raise NotImplementedError()
  • Edited geometries are added instead of modified in place in the status quo implementation of the draw control, because of buggy behavior with the base ipyleaflet DrawControl, which prevents other fixes. I have proposed a fix for it here.

    • We can actually sync the edited geometries from the draw control if the data attribute gets properly synced, but currently, since the data attribute (which holds a list of GeoJSON) is out of sync between the Python and JavaScript layers of the ipyleaflet library, we can't do much about it.
  • Also implements some key fixes to the toolbar "Collect training samples" feature, which will reset the draw control back to the default one after the user hits "Close."

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