2D viewer based on WebGL.

Implements

Constructors

  • Create a new Viewer2d

    Parameters

    • objectStateManager: ObjectStateManager

      The ObjectStateManager manages all object related state such as visibility, color and selection

    • Optional settings: Viewer2dSettings

      Optional settings, will use default settings when not provided

    Returns Viewer2d

Properties

container: HTMLElement
modelManager: ModelManager
objectStateManager: ObjectStateManager

Methods

  • TODO: write description

    Parameters

    • newVersions: Iterable<Model>
    • allVersions: Iterable<Model>

      TODO: currently is used for "camera.fitOnLoad" behaviour. Looks strange - better idea is neded to handle this.

    Returns Promise<void>

  • Destroys the viewer and any (heavy) resources associated with it. As long as there is a reference to the Viewer2d instance it won't be completely destroyed.

    Returns void

  • Get the height of the viewer in pixels

    Returns number

  • Get the width of the viewer in pixels

    Returns number

  • Called then the given object is not being hovered on anymore @param: qid: The Qid of the object that is not being hovered over anymore

    Parameters

    • qid: string

    Returns void

  • Called then the given object is being hovered on

    Parameters

    • qid: string
    • previousQid: string
    • screenspaceLocation: vec2

    Returns void

  • This method must be called before loading any of the models. Keep in mind that this method is async, and models can only be loaded after the returned Promise has resolved.

    Returns Promise<void>

  • Returns boolean

    Whether rendering of generated door opening directions is currently enabled

  • Returns boolean

    Whether face rendering is currently enabled

  • Returns boolean

    Whether IFC line rendering is currently enabled

  • Returns boolean

    Whether wireframe rendering is currently enabled

  • Internal

    Parameters

    • stream: any
    • settings: any
    • labeller: any
    • vid: any
    • geometryBatchId: any
    • bb: any

    Returns void

  • Parameters

    • width: number
    • height: number

    Returns void

  • Will take a screenshot of the contents of the Viewer2d.

    Parameters

    Returns Promise<Blob>

    A Blob

    Example

    The returned Blob can for example be downloaded by the user, using the following example

        const width = viewer2d.width;
    const height = viewer2d.height;
    const filename = `screencapture-${width}x${height}.png`;
    Utils.downloadBlob(blob, filename);
  • To be called whenever the rendering state has changed and updates need to become visible

    Returns void

  • Parameters

    • layerIds: any

    Returns void

  • Starts the viewer. The viewer will only redraw when needed.

    Returns void

  • Stops the viewer. When the viewer is stopped, the view is not updated anymore. Any changes to the viewer will be accumulated and become visible as soon as the viewer is started again The main reason for stopping the viewer would be for performance, for example when the viewer is currently hidden

    Returns void

  • Toggle whether (generated) door openings are rendered. This only works for models that have been processed when the repository setting features.generate_door_openings had been enabled. Some models contains door opening direction geometry as IFC lines, in those cases it's best to disabled rendering generated door openings.

    Parameters

    • enabled: boolean

      True when enabled

    Returns void

  • Toggle whether faces are rendered.

    Parameters

    • enabled: boolean

      True when enabled

    Returns void

  • Toggle whether ifc lines are rendered. IFC Lines are all lines that have been defined in the original IFC file, such as Axis and FootPrint representations.

    Parameters

    • enabled: boolean

      True when enabled

    Returns void

  • Toggles whether the text labels are shown

    Returns void

  • Toggle whether wireframes are rendered. Wireframes are usually drawn to emphesize the edges and generally make the model look better

    Parameters

    • enabled: boolean

      True when enabled

    Returns void