Skip to content

Commit

Permalink
fixed hurricane track layers getting added when deleting layers
Browse files Browse the repository at this point in the history
  • Loading branch information
lstillwe committed Mar 7, 2024
1 parent fc5c4c7 commit c9f1aa8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/custom-ui/components/drawer/layers-list/layer-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ export const LayerCard = ({
}
currentlyActive && setActivatedLayer(false);
// Check if this is a hurricane track layer
if (layer.uniqueId.includes("-hurr_composite")) {
if (
layer.uniqueId.includes("-hurr_composite") ||
(layer.infoAsObject.Advisory && layer.infoAsObject.Advisory.length < 4)
) {
setAddHurricaneLayers(false);
}
viewState.terria.workbench.remove(layer);
Expand Down
8 changes: 6 additions & 2 deletions lib/custom-ui/components/drawer/layers-list/layers-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,17 @@ export const LayersList = observer(
// );

function addStormLayers(item) {
const hpostfix = "-hurr_composite";
let icon_url =
viewState.terria.configParameters.plugins.hurricaneIconsURL;
// check to see if this is a storm track layer
// if so, just return
if (item.uniqueId.includes(hpostfix)) return;

// first see if hurricane layers have already been added for this model run
// next see if hurricane layers have already been added for this model run
// TODO: probably need to figure out a better way to do this
const item_id = getTruncatedId(item.uniqueId);
let new_id = item_id + "-hurr_composite";
let new_id = item_id + hpostfix;
const layer = viewState.terria.workbench.items.find(
(list_item) => list_item.uniqueId === new_id
);
Expand Down

0 comments on commit c9f1aa8

Please sign in to comment.