An independent view within a Viewer, with its own canvas, Camera and object visual states.

See @xeokit/sdk/viewer for usage.

Properties

boundary: number[]

Boundary of the canvas in absolute browser window coordinates. Format is [xmin, ymin, xwidth, ywidth].

camera: Camera

Manages the Camera for this View.

colorizedObjects: { [key: string]: ViewObject }

Map of currently colorized ViewObjects in this View.

Each ViewObject is mapped here by ViewObject.id.

destroyed: boolean = false

True if this View has been destroyed.

edges: Edges

Configures the appearance of edges belonging to ViewObject in this View.

gammaOutput: boolean
highlightedObjects: { [key: string]: ViewObject }

Map of currently highlighted ViewObjects in this View.

A ViewObject is highlighted when ViewObject.highlighted is true.

Each ViewObject is mapped here by ViewObject.id.

highlightMaterial: EmphasisMaterial

Configures the highlighted appearance of ViewObjects in this View.

htmlElement: HTMLElement

The HTML canvas.

id: string

ID of this View, unique within the Viewer.

layers: { [key: string]: ViewLayer }

Map of the all ViewLayers in this View.

Each ViewLayer is mapped here by ViewLayer.id.

lights: { [key: string]: AmbientLight | PointLight | DirLight }

Map of light sources in this View.

lightsList: (AmbientLight | PointLight | DirLight)[] = []

List of light sources in this View.

linesMaterial: LinesMaterial

Configures the appearance of lines belonging to ViewObjects in this View.

objects: { [key: string]: ViewObject }

Map of the all ViewObjects in this View.

Each ViewObject is mapped here by ViewObject.id.

The View automatically ensures that there is a ViewObject here for each ViewObject in the Viewer

opacityObjects: { [key: string]: ViewObject }

Map of ViewObjects in this View whose opacity has been updated.

Each ViewObject is mapped here by ViewObject.id.

pointsMaterial: PointsMaterial

Configures the appearance of point primitives belonging to ViewObjects in this View .

resolutionScale: ResolutionScale

Configures resolution scaling for this View.

sao: SAO

Configures Scalable Ambient Obscurance (SAO) for this View.

sectionPlanes: { [key: string]: SectionPlane }

Map of SectionPlanes in this View.

Each SectionPlane is mapped here by SectionPlane.id.

sectionPlanesList: SectionPlane[] = []

List of SectionPlanes in this View.

selectedMaterial: EmphasisMaterial

Configures the appearance of ViewObjects in this View.

selectedObjects: { [key: string]: ViewObject }

Map of currently selected ViewObjects in this View.

A ViewObject is selected when ViewObject.selected is true.

Each ViewObject is mapped here by ViewObject.id.

texturing: Texturing

Configures when textures are rendered for this View.

transparent: boolean

Indicates if this View is transparent.

viewer: Viewer

The Viewer to which this View belongs.

viewIndex: number

The tileIndex of this View in Viewer.viewList.

visibleObjects: { [key: string]: ViewObject }

Map of the currently visible ViewObjects in this View.

A ViewObject is visible when ViewObject.visible is true.

Each ViewObject is mapped here by ViewObject.id.

xrayedObjects: { [key: string]: ViewObject }

Map of currently x-rayed ViewObjects in this View.

A ViewObject is x-rayed when ViewObject.xrayed is true.

Each ViewObject is mapped here by ViewObject.id.

xrayMaterial: EmphasisMaterial

Configures the X-rayed appearance of ViewObjects in this View.

Accessors

  • get autoLayers(): boolean

    Gets whether this View will automatically create ViewLayers on-demand as ViewerObjects are created.

    Returns boolean

  • set autoLayers(autoLayers: boolean): void

    Sets whether this View will automatically create ViewLayers on-demand as ViewerObjects are created.

    When true (default), the View will automatically create ViewLayers as needed for each new ViewObject.layerId encountered, including a "default" ViewLayer for ViewerObjects that have no layerId. This "default" ViewLayer ensures that a ViewObject is created in the View for every SceneObject that is created.

    If you set this false, however, then the View will only create ViewObjects for SceneObjects that have a scene!SceneObject.layerId that matches the ID of a ViewLayer that you have explicitly created previously with View.createLayer.

    Setting this parameter false enables Views to contain only the ViewObjects that they actually need to show, i.e. to represent only ViewerObjects that they need to view. This enables a View to avoid wastefully creating and maintaining ViewObjects for ViewerObjects that it never needs to show.

    Default value is `true``.

    Parameters

    • autoLayers: boolean

      The new value for atuoLayers

    Returns void

  • get backgroundColorFromAmbientLight(): boolean

    Gets whether the canvas clear color will be derived from AmbientLight or View.backgroundColor when View.transparent is true.

    When View.transparent is true and this is true, then the canvas clear color will be taken from the ambient light color.

    When View.transparent is true and this is false, then the canvas clear color will be taken from View.backgroundColor.

    Default value is true.

    Returns boolean

  • set backgroundColorFromAmbientLight(
        backgroundColorFromAmbientLight: boolean,
    ): void

    Sets if the canvas background color is derived from an AmbientLight.

    This only has effect when the canvas is not transparent. When not enabled, the background color will be the canvas element's HTML/CSS background color.

    Default value is true.

    Parameters

    • backgroundColorFromAmbientLight: boolean

    Returns void

  • get renderMode(): number

    Gets which rendering mode this View is in.

    Default value is QualityRender.

    Returns number

  • set renderMode(renderMode: number): void

    Sets which rendering mode this View is in.

    Default value is QualityRender.

    Setting a View's rendering mode will activate whatever effects (eg. SAO, edges, canas scaling) are configured to be active in that mode, while deactivating all other effects.

    Parameters

    • renderMode: number

    Returns void

Methods

  • Sets the clippability of the given ViewObjects in this View.

    Parameters

    • objectIds: string[]

      Array of ViewObject.id values.

    • clippable: boolean

      Whether or not to set clippable.

    Returns boolean

    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 View.

    Updates ViewObject.collidable on the Objects with the given IDs.

    Parameters

    • objectIds: string[]

      Array of ViewObject.id values.

    • collidable: boolean

      Whether or not to cull.

    Returns boolean

    True if any ViewObjects were updated, else false if all updates were redundant and not applied.

  • Updates the culled status of the given ViewObjects in this View.

    Updates ViewObject.culled on the Objects with the given IDs.

    Parameters

    • objectIds: string[]

      Array of ViewObject.id values.

    • culled: boolean

      Whether or not to cull.

    Returns boolean

    True if any ViewObjects were updated, else false if all updates were redundant and not applied.

  • Sets the pickability of the given ViewObjects in this View.

    • Updates ViewObject.pickable on the Objects with the given IDs.
    • Enables or disables the ability to pick the given Objects with View.pick.

    Parameters

    • objectIds: string[]

      Array of ViewObject.id values.

    • pickable: boolean

      Whether or not to set pickable.

    Returns boolean

    True if any ViewObjects were updated, else false if all updates were redundant and not applied.

  • Iterates with a callback over the given ViewObjects in this View.

    Parameters

    Returns boolean

    True if any ViewObjects were updated, else false if all updates were redundant and not applied.