Readonly
colorizedMap of currently colorized ViewObjects in this ViewLayer.
Each ViewObject is mapped here by ViewObject.id.
True once this Component has been destroyed.
Don't use this Component if this is true
.
Protected
dirtyReadonly
highlightedMap of currently highlighted ViewObjects in this ViewLayer.
A ViewObject is highlighted when ViewObject.highlighted is true.
Each ViewObject is mapped here by ViewObject.id.
Readonly
idID of this ViewLayer, unique within the View.
This ViewLayer is mapped by this ID in View.layers.
Readonly
objectsMap of the all ViewObjects in this ViewLayer.
These are the ViewObjects for which SceneObject.layerId has the same value as the ViewLayer.id.
Each ViewObject is mapped here by ViewObject.id.
The ViewLayer automatically ensures that there is a ViewObject here for each scene!RendererObject in the Viewer
Readonly
opacityMap of ViewObjects in this ViewLayer whose opacity has been updated.
Each ViewObject is mapped here by ViewObject.id.
Readonly
selectedMap of currently selected ViewObjects in this ViewLayer.
A ViewObject is selected when ViewObject.selected is true.
Each ViewObject is mapped here by ViewObject.id.
Readonly
viewThe View to which this ViewLayer belongs.
Readonly
viewerThe Viewer to which this ViewLayer belongs.
Readonly
visibleMap of the currently visible ViewObjects in this ViewLayer.
A ViewObject is visible when ViewObject.visible is true.
Each ViewObject is mapped here by ViewObject.id.
Readonly
xrayedMap of currently x-rayed ViewObjects in this ViewLayer.
A ViewObject is x-rayed when ViewObject.xrayed is true.
Each ViewObject is mapped here by ViewObject.id.
Gets the IDs of the colorized ViewObjects in this ViewLayer.
Gets the gamma factor.
Gets the IDs of the highlighted ViewObjects in this ViewLayer.
Gets the number of colorized ViewObjects in this ViewLayer.
Gets the number of highlighted ViewObjects in this ViewLayer.
Gets the number of ViewObjects in this ViewLayer.
Gets the number of ViewObjects in this ViewLayer that have updated opacities.
Gets the number of selected ViewObjects in this ViewLayer.
Gets the number of visible ViewObjects in this ViewLayer.
Gets the number of X-rayed ViewObjects in this ViewLayer.
Gets the IDs of the ViewObjects in this ViewLayer.
Gets the IDs of the ViewObjects in this ViewLayer that have updated opacities.
Gets which rendering modes in which to render the ViewObjects in this ViewLayer.
Default value is [].
Sets which rendering modes in which to render the ViewObjects in this ViewLayer.
Default value is [].
Gets the IDs of the selected ViewObjects in this ViewLayer.
Gets the IDs of the visible ViewObjects in this ViewLayer.
Gets the IDs of the X-rayed ViewObjects in this ViewLayer.
Protected
cleanProtected
cleanDestroys this ViewLayer.
Causes Viewer to fire a "viewDestroyed" event.
Protected
errorConfigures this ViewLayer.
Protected
logProtected
setSets the clippability of the given ViewObjects in this ViewLayer.
Array of ViewObject.id values.
Whether or not to set clippable.
True if any ViewObjects were updated, else false if all updates were redundant and not applied.
Updates the collidability of the given ViewObjects in this ViewLayer.
Updates ViewObject.collidable on the Objects with the given IDs.
Array of ViewObject.id values.
Whether or not to cull.
True if any ViewObjects were updated, else false if all updates were redundant and not applied.
Colorizes the given ViewObjects in this ViewLayer.
One or more ViewObject.id values.
RGB colorize factors in range [0..1,0..1,0..1]
.
True if any ViewObjects changed opacity, else false if all updates were redundant and not applied.
Updates the culled status of the given ViewObjects in this ViewLayer.
Updates ViewObject.culled on the Objects with the given IDs.
Array of ViewObject.id values.
Whether or not to cull.
True if any ViewObjects were updated, else false if all updates were redundant and not applied.
Highlights or un-highlights the given ViewObjects in this ViewLayer.
One or more ViewObject.id values.
Whether or not to highlight.
True if any ViewObjects were updated, else false if all updates were redundant and not applied.
Sets the opacity of the given ViewObjects in this ViewLayer.
One or more ViewObject.id values.
Opacity factor in range [0..1]
.
True if any ViewObjects changed opacity, else false if all updates were redundant and not applied.
Sets the pickability of the given ViewObjects in this ViewLayer.
Array of ViewObject.id values.
Whether or not to set pickable.
True if any ViewObjects were updated, else false if all updates were redundant and not applied.
Selects or deselects the given ViewObjects in this ViewLayer.
One or more ViewObject.id values.
Whether or not to select.
True if any ViewObjects were updated, else false if all updates were redundant and not applied.
Updates the visibility of the given ViewObjects in this ViewLayer.
Array of ViewObject.id values.
Whether or not to cull.
True if any ViewObjects were updated, else false if all updates were redundant and not applied.
Applies or removes X-ray rendering for the given ViewObjects in this ViewLayer.
One or more ViewObject.id values.
Whether or not to xray.
True if any ViewObjects were updated, else false if all updates were redundant and not applied.
Gets the current configuration of this ViewLayer.
Protected
warnIterates with a callback over the given ViewObjects in this ViewLayer.
One or more ViewObject.id values.
Callback to execute on each ViewObject.
True if any ViewObjects were updated, else false if all updates were redundant and not applied.
Emits an event when the Component has been destroyed.
Readonly
onEmits an event each time a ViewObject is created in this ViewLayer.
Readonly
onEmits an event each time a ViewObject is destroyed in this ViewLayer.
Readonly
onEmits an event each time the visibility of a ViewObject changes.
ViewObjects are shown and hidden with View.setObjectsVisible, ViewLayer.setObjectsVisible or ViewObject.visible.
A layer of ViewObjects within a View.
ViewLayers allow users to group and segregate ViewObjects based on their roles or aspects in a scene, simplifying interaction and focusing operations on specific object groups.
ViewLayers group ViewObjects based on the layerId of the corresponding SceneObject.
See @xeokit/sdk/viewer for more info.
Automatic vs. Manual ViewLayers
Automatic ViewLayers - Created automatically on-the-fly as SceneObjects with layerIds are created and destroyed. Ensures a dynamic and self-managing system where layers appear and disappear based on the existence of relevant objects.
Manual ViewLayers - Requires user's manual creation and destruction of ViewLayers. ViewLayers persist even after objects are destroyed.
Automatic ViewLayers
ViewLayers are useful for separating different types of objects, such as models and environment objects. A common use case is to create separate layers for models and environment objects like the ground or skybox. This allows focusing on model objects for operations like highlighting, hiding, or interacting, without affecting background objects.
Create a Viewer:
Create a View, with autoLayers set true:
Next, create a SceneModel with four SceneObjects. The first two SceneObjects will represent a skybox and a ground plane, while the other two will represent a building foundation and walls.
The skybox and ground plane SceneObjects will assign their ViewObjects to the "environment" ViewLayer, and the building foundation and walls will assign theirs to the "model" ViewLayer.
Our View now has an "environment" ViewLayer, which contains ViewObjects for the skybox and ground plane, and a "model" ViewLayer, which contains ViewObjects for the house foundation and walls.
We can now focus our updates on the ViewObjects in each ViewLayer.
Manual ViewLayers
Create a Viewer:
Create a View with autoLayers set false.
This will prevent the View from creating ViewLayers automatically.
Create a "model" ViewLayer, but this time don't create an "environment" ViewLayer:
As in the previous example, we'll now create a SceneModel containing two model SceneObjects representing a building foundation and walls, along with two environmental ViewerObjects representing a skybox and ground plane.
This time, however, our View has created ViewObjects only for the "model" SceneObjects, while ignoring the "environment" SceneObjects.
From this View's perspective, the "environment" SceneObjects don't exist because no "environment" ViewLayer exists.
Loading a model into a ViewLayer
Create a Viewer:
Create a View, with autoLayers set true:
Create a SceneModel, with layerId "environmental", and create some environmental objects in it.
Create a second SceneModel, with layerId "model", and load a BIM model into it.
All our model objects are now in the "model" ViewLayer, and all our environmental objects are in the "environment" ViewLayer.
Let's show all the model objects, and hide all the environmental objects: