Skip to content

Commit

Permalink
Update to pr comments, updates fn names
Browse files Browse the repository at this point in the history
  • Loading branch information
sandrahoang686 committed Aug 2, 2023
1 parent a13d31e commit bda7d8c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
36 changes: 18 additions & 18 deletions stac_ipyleaflet/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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,
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions stac_ipyleaflet/widgets/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
<p>
<b>
Expand All @@ -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"],
Expand Down Expand Up @@ -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"<p><b>Coordinates:</b></p><code>{self.coordinates}</code><br/>"
elif not len(applied_layers):
Expand Down

0 comments on commit bda7d8c

Please sign in to comment.