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

See @xeokit/sdk/viewer for usage.

Hierarchy (View Summary)

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

True once this Component has been destroyed.

Don't use this Component if this is true.

dirty: boolean
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

Unique ID of this Component.

layers: { [key: string]: ViewLayer }

Map of the all ViewLayers in this View.

Each ViewLayer is mapped here by ViewLayer.id.

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

Map of light sources in this View.

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

List of light sources in this View.

linesMaterial: LinesMaterial

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

metrics: Metrics

Manages measurement units, origin and scale for 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 RendererObject 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.

viewId: string

ID of this View, unique within the Viewer.

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 wether this View will automatically create ViewLayers on-demand as ViewerObjects are created.

    Returns boolean

  • set autoLayers(autoLayers: boolean): void
  • Sets wether 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 RendererObject.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

  • Enter snapshot mode.

    Switches rendering to a hidden snapshot canvas.

    Exit snapshot mode using Viewer#endSnapshot.

    Returns void

  • Protected

    Logs an error for this component to the JavaScript console.

    The console message will have this format: [ERROR] [<component type> =<component id>: <message>

    Parameters

    • message: string

      The error message to log

    Returns void

  • Protected

    Logs a message for this component.

    The message will have this format: [LOG] [<component type> <component id>: <message>

    Parameters

    • message: string

      The message to log

    Returns void

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

    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.

  • Protected

    Logs a warning for this component to the JavaScript console.

    The console message will have this format: [WARN] [<component type> =<component id>: <message>

    Parameters

    • message: string

      The warning message to log

    Returns void

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

Events

Emits an event each time the canvas boundary changes.

onDestroyed: EventEmitter<Component, null>

Emits an event when the Component has been destroyed.

onLayerCreated: EventEmitter<View, ViewLayer>

Emits an event each time a ViewLayer is created in this View.

Layers are created explicitly with View.createLayer, or implicitly with SceneModel.createObject and SceneObjectParams.layerId.

onLayerDestroyed: EventEmitter<View, ViewLayer>

Emits an event each time a ViewLayer in this View is destroyed.

ViewLayers are destroyed explicitly with ViewLayer.destroy, or implicitly when they become empty and View.autoLayers is false.

onObjectCreated: EventEmitter<View, ViewObject>

Emits an event each time a ViewObject is created in this View.

onObjectDestroyed: EventEmitter<View, ViewObject>

Emits an event each time a ViewObject is destroyed in this View.

onObjectVisibility: EventEmitter<View, ViewObject>

Emits an event each time the visibility of a ViewObject changes in this View.

ViewObjects are shown and hidden with View.setObjectsVisible, ViewLayer.setObjectsVisible or ViewObject.visible.

onObjectXRayed: EventEmitter<View, ViewObject>

Emits an event each time the X-ray state of a ViewObject changes in this View.

ViewObjects are X-rayed with View.setObjectsXRayed, ViewLayer.setObjectsXRayed or ViewObject.xrayed.

onSectionPlaneCreated: EventEmitter<View, SectionPlane>

Emits an event each time a SectionPlane is created in this View.

onSectionPlaneDestroyed: EventEmitter<View, SectionPlane>

Emits an event each time a SectionPlane in this View is destroyed.

Emits an event each time a snapshot is completed with View.getSnapshot.

Emits an event each time a snapshot is initiated with View.getSnapshot.