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

    • Optionalsettings: 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>

      The new versions that were added

    • allVersions: Iterable<Model>

      A list of all the currently loaded versions

    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

    Parameters

    • qid: string

      The Qid of the object that is not being hovered over anymore

    Returns void

  • Called then the given object is being hovered on

    Parameters

    • qid: string

      The Qid of the object being hovered over

    • previousQid: string

      The Qid of the previous objects that was being hovered over

    • screenspaceLocation: vec2

      The screenspace location of the hover event. This can be useful to for example place a popup/tooltip at that location. Screenspace location is x, y coordinate between 0, 0 and canvas width,height

    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

  • Parameters

    • width: number
    • height: number

    Returns void

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

    Parameters

    Returns Promise<Blob>

    A Blob

    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

  • 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

  • Fit the given object into view.

    Parameters

    • qids: Iterable<string>

      The Qids of the objects to fit

    • Optionaloptions: ViewFitOptions

      To provide a buffer around the objects. A percentage, where 0 means no buffer and 100 means only buffer

    Returns void

  • Fit the given models into view.

    Parameters

    • versionUuids: Iterable<string>

      The models to fit

    • Optionaloptions: ViewFitOptions

      To provide a buffer around the objects. A percentage, where 0 means no buffer and 100 means only buffer

    Returns void | Promise<void>