pysepal.mapping.layers_control.ToggleRow#

class pysepal.mapping.layers_control.ToggleRow(*args, **kwargs)[source]#

Html row element to describe a layer exposing no visibility trait.

Layers such as the ipyleaflet PMTilesLayer inherit from Layer rather than RasterLayer, so they have neither visible nor opacity to link a widget to. They are hidden by removing them from the map instead, which means the control has to remember them, and where they sat, to keep the row in place.

Showing a layer again appends it to the map, so it lands on top of anything added while it was hidden. That cannot be undone from python: ipywidgets reuses the views of the models already present, so reordering m.layers never replays leaflet’s addLayer and the stack stays as it is.

Parameters:
  • layer (Layer) – the layer associated to the row

  • control (LayersControl) – the layer control owning the registry of hidden layers

  • index (int) – the position of the row, restored as is when the layer is hidden

Attributes

w_checkbox

the checkbox to hide/show the layer

Methods

__init__

Html row element to describe a layer exposing no visibility trait.

ToggleRow.__init__(layer, control, index)[source]#

Html row element to describe a layer exposing no visibility trait.

Layers such as the ipyleaflet PMTilesLayer inherit from Layer rather than RasterLayer, so they have neither visible nor opacity to link a widget to. They are hidden by removing them from the map instead, which means the control has to remember them, and where they sat, to keep the row in place.

Showing a layer again appends it to the map, so it lands on top of anything added while it was hidden. That cannot be undone from python: ipywidgets reuses the views of the models already present, so reordering m.layers never replays leaflet’s addLayer and the stack stays as it is.

Parameters:
  • layer (Layer) – the layer associated to the row

  • control (LayersControl) – the layer control owning the registry of hidden layers

  • index (int) – the position of the row, restored as is when the layer is hidden

Return type:

None