diff --git a/stac_ipyleaflet/core.py b/stac_ipyleaflet/core.py index 2edf90f..9d8ef92 100644 --- a/stac_ipyleaflet/core.py +++ b/stac_ipyleaflet/core.py @@ -57,7 +57,7 @@ def __init__(self, **kwargs): self.selected_data = [] self.histogram_layer = None self.draw_control_added = False - self.inspect_control_added = False + self.point_control_added = False self.aoi_coordinates = [] self.aoi_bbox = () self.applied_layers = [] @@ -137,7 +137,7 @@ def __init__(self, **kwargs): self.add_biomass_layers_options() self.add_custom_tools() - self.inspect_control = InspectControlWidget.template( + self.point_control = InspectControlWidget.template( self, self.applied_layers, self.interact_widget, @@ -160,9 +160,9 @@ def toggle_layers_widget_display(self, b): if self.draw_control_added: self.remove(self.draw_control) self.draw_control_added = False - if self.inspect_control_added: - self.remove(self.inspect_control) - self.inspect_control_added = False + if self.point_control_added: + self.remove(self.point_control) + self.point_control_added = False if not b["new"]: if self.layers_widget.layout.display == "block": self.layers_widget.layout.display = "none" @@ -178,9 +178,9 @@ def toggle_stac_widget_display(self, b): if self.draw_control_added: self.remove(self.draw_control) self.draw_control_added = False - if self.inspect_control_added: - self.remove(self.inspect_control) - self.inspect_control_added = False + if self.point_control_added: + self.remove(self.point_control) + self.point_control_added = False if not b["new"]: if self.stac_widget.layout.display == "block": self.stac_widget.layout.display = "none" @@ -197,8 +197,8 @@ def toggle_interact_widget_display(self, b): self.interact_widget.children[0].selected_index ] if selected_tab == "Point": - self.add_control(self.inspect_control) - self.inspect_control_added = True + self.add_control(self.point_control) + self.point_control_added = True elif selected_tab == "Area": self.add_control(self.draw_control) self.draw_control_added = True @@ -208,9 +208,9 @@ def toggle_interact_widget_display(self, b): if self.draw_control_added: self.remove(self.draw_control) self.draw_control_added = False - if self.inspect_control_added: - self.remove(self.inspect_control) - self.inspect_control_added = False + if self.point_control_added: + self.remove(self.point_control) + self.point_control_added = False def create_aoi_tab(self): aoi_widget_desc = HTML( @@ -282,12 +282,12 @@ def toggle_interact_tab_change(event): if self.draw_control_added: self.remove(self.draw_control) self.draw_control_added = False - self.add_control(self.inspect_control) - self.inspect_control_added = True + self.add_control(self.point_control) + self.point_control_added = True elif selected_tab == "Area": # Draw Control - if self.inspect_control_added: - self.remove(self.inspect_control) - self.inspect_control_added = False + if self.point_control_added: + self.remove(self.point_control) + self.point_control_added = False self.add_control(self.draw_control) self.draw_control_added = True diff --git a/stac_ipyleaflet/widgets/inspect.py b/stac_ipyleaflet/widgets/inspect.py index ea85e02..26ed75d 100644 --- a/stac_ipyleaflet/widgets/inspect.py +++ b/stac_ipyleaflet/widgets/inspect.py @@ -69,10 +69,10 @@ def get_visible_layers_data(coordinates) -> List[LayerData]: # @NOTE: Blocked until Impact Titiler is updated to access /mosaicsjson/point return visible_layers_data - def display_data(layers_data: LayerData): + def display_layer_data(layers_data: LayerData): point_data.value = "" - def create_html_template(layer_name, coordinates, values, band_names): + def create_layer_data_html(layer_name, coordinates, values, band_names): template = f"""

@@ -94,7 +94,7 @@ def create_html_template(layer_name, coordinates, values, band_names): return template for layer in layers_data: - point_data.value += create_html_template( + point_data.value += create_layer_data_html( layer["layer_name"], layer["data"]["coordinates"], layer["data"]["values"], @@ -127,7 +127,7 @@ def handle_clear(event): if len(applied_layers): layers_data = get_visible_layers_data(self.coordinates) if layers_data: - display_data(layers_data) + display_layer_data(layers_data) else: point_data.value = f"

Coordinates:

{self.coordinates}
" elif not len(applied_layers):