HoopsLayerTreeElement

class wvc.HoopsLayerTreeElement()

Provides a tree view for displaying and managing model layers.

This component renders a list of layers with lazy loading support. It handles layer selection, visibility toggling, and node management within layers.

Constructors

wvc.HoopsLayerTreeElement.constructor()
HoopsLayerTreeElement(): HoopsLayerTreeElement

Returns: HoopsLayerTreeElement

Properties

wvc.HoopsLayerTreeElement.styles

static

styles: CSSResult[]

Array of styles to apply to the element. The styles should be defined using the ? tag function, via constructible stylesheets, or imported from native CSS module scripts.

Note on Content Security Policy:

Element styles are implemented with <style> tags when the browser doesn’t support adopted StyleSheets. To use such <style> tags with the style-src CSP directive, the style-src value must either include ‘unsafe-inline’ or nonce-<base64-value> with <base64-value> replaced be a server-generated nonce.

To provide a nonce to use on generated <style> elements, set window.litNonce to a server-generated nonce in your page’s HTML, before loading application code:

<script>
  // Generated and unique per request:
  window.litNonce = 'a1b2c3d4';
</script>

Accessors

wvc.HoopsLayerTreeElement.layerAdapter()
get layerAdapter(): (undefined | LayerAdapter)

Gets or sets the layer adapter that supplies data to the list.

This is a syntactic sugar to access list.context. If the List is not set it returns undefined.

Reassigning the layerAdapter will trigger an update.

Returns: (undefined | LayerAdapter)

set layerAdapter(newLayerAdapter: LayerAdapter): void

Parameters

newLayerAdapter: LayerAdapter

Returns: void

wvc.HoopsLayerTreeElement.layersContainer()
get layersContainer(): (undefined | ILayersContainer)

Gets or sets the layers container that represents the available layers in the model.

This is a syntactic sugar to access LayerTree.layerAdapter.layersContainer. If the LayerAdapter is not set it returns undefined.

Reassigning the layersContainer will trigger an update.

Returns: (undefined | ILayersContainer)

set layersContainer(layersContainer: (undefined | ILayersContainer)): void

Parameters

layersContainer: (undefined | ILayersContainer)

Returns: void

wvc.HoopsLayerTreeElement.layerTreeDomElement()
get layerTreeDomElement(): (undefined | List)

Gets the internal list component instance.

This is a syntactic sugar to simplify getting the list element and expose it externally.

Returns: (undefined | List)

The list element instance or undefined if not initialized

Methods

wvc.HoopsLayerTreeElement.getElementData()
getElementData(layerId: number): T

Retrieves custom data associated with a layer.

This is a shorthand to allow users to attach reactive data to layers.

Parameters

layerId: number

The ID of the layer that owns the data

Returns: T

The stored custom data or undefined if no data exists
wvc.HoopsLayerTreeElement.selectElements()
selectElements(layerIds: number[], selected: boolean): void

Selects or deselects layers in the list.

Reassigning the selected layers will trigger an update.

Parameters

layerIds: number[]

Array of layer IDs to update

selected: boolean

Whether to select (true) or deselect (false) the layers

Returns: void

wvc.HoopsLayerTreeElement.selectNodes()
selectNodes(nodeIds: number[], selected: boolean): void

Selects or deselects nodes in the layer sublists.

Clears existing selection and applies the new selection to all layer tree elements.

Parameters

nodeIds: number[]

Array of node IDs to update

selected: boolean

Whether to select (true) or deselect (false) the nodes

Returns: void

wvc.HoopsLayerTreeElement.setLayerData()
setLayerData(layerId: number, data: unknown): void

Stores custom data for a layer, replacing any existing value.

If the layer had already a value it is erased. Setting layer data will trigger an update.

Parameters

layerId: number

The ID of the layer that owns the data

data: unknown

The data to store

Returns: void

wvc.HoopsLayerTreeElement.updateLayerData()
updateLayerData(layerId: number, data: unknown): void

Merges custom data into an existing layer entry.

If the layer did not have data, it is added to the context. If the given data is an array and the context layer data is an array, the data passed as argument are appended to the context data. If both are objects, then the objects are merged using Object.assign, with the data argument being the last object of the merge. Otherwise it is equivalent to setLayerData.

Updating layer data will trigger an update.

Parameters

layerId: number

The ID of the layer that owns the data

data: unknown

The data to merge into the layer entry

Returns: void

wvc.HoopsLayerTreeElement.updateVisibility()
updateVisibility(shownBodyIds: number[], hiddenBodyIds: number[]): void

Updates visibility icons for layers based on shown and hidden body IDs.

This method propagates visibility changes to affected layer tree elements.

Parameters

shownBodyIds: number[]

Array of body IDs that are now visible

hiddenBodyIds: number[]

Array of body IDs that are now hidden

Returns: void