An instance of ObjectStateManager keeps track of all the viewer-related state and distributes this state to other components, usually viewers. This state includes:

  • Visibility of objects
  • User-changed colors of objects
  • Selection of objects
  • Object labelling
  • View fitting of objects

Most applications will have one ObjectStateManager, but you can have more. The most common scenatio is to have one ObjectStateManager, one Viewer3d and one Viewer2d. Both viewers being connected to the same ObjectStateManager so that the state is kept in sync.

Constructors

Methods

  • Add the provided objects to the currently pickable set of objects

    Parameters

    • query: Iterable<string> | BimQuery

      Either a query or Iterable of Qid

    • Optionalforce: boolean

      Whether to force this change, when forced, any viewer-specific settings are overruled

    • Optionaltype: string

      Always "BIM"

    Returns Promise<void>

  • Add a set of objects to the selected set

    Parameters

    • query: Iterable<string> | BimQuery
    • Optionaltype: string

    Returns Promise<void>

  • Add the provided objects to the currently visible set of objects *

    Parameters

    • query: Iterable<string> | BimQuery

      Either a query or Iterable of Qid *

    • Optionalforce: boolean

      Whether to force this change, when forced, any viewer-specific settings are overruled *

    • Optionaltype: string

      Always "BIM"

    Returns Promise<void>

  • Change the color of a given set of objects. When changing the colors of multiple sets of objects, use the more efficient changeColorMulti method.

    Parameters

    • query: Iterable<string> | BimQuery

      A query or iterable of Qids, the objects to change color

    • color: Color

      The new color, many representations are supported including "#00FF00", "#F0", "[r, g, b, a]" and "red"

    Returns Promise<void>

    A Promise that triggers when all connected listeners have applied the change

  • Change the colors of a given set of objects.

    Parameters

    Returns Promise<void>

    A Promise that triggers when all connected listeners have applied the change

  • Returns Set<string>

    A Set of the QIDS that are currently invisible. The returned Set must be treated as read-only.

  • Returns Set<string>

    A Set of the QIDS that are currently selected. The returned Set must be treated as read-only.

  • Returns Set<string>

    A Set of the QIDS that are currently visible. The returned Set must be treated as read-only.

  • Change the state of the given qid to not being hovered on anymore. In the Viewer3d tis will fade out the green glow over time.

    Parameters

    • qid: string

      The Qid of the object not being hovered over anymore

    Returns void

  • Change the state of the given qid to being hovered on. In the Viewer3d this will give the object a green glow

    Parameters

    • qid: string

      The Qid of the object being hovered over

    • OptionalscreenspaceLocation: vec2

      The screen space location of the hover event. This is not relevant/available in all situations and can be null

    Returns void

  • Remove objects from the set of pickable objects

    Parameters

    • query: Iterable<string> | BimQuery

      Either a query or Iterable of Qid

    • Optionalforce: boolean

      Whether to force this change, when forced, any viewer-specific settings are overruled

    • Optionaltype: string

      Always "BIM"

    Returns Promise<void>

  • Remove the provided objects from the current selection

    Parameters

    • query: Iterable<string> | BimQuery
    • Optionaltype: string

    Returns Promise<void>

  • Remove objects from the set of visible objects

    Parameters

    • query: Iterable<string> | BimQuery

      Either a query or Iterable of Qid

    • Optionalforce: boolean

      Whether to force this change, when forced, any viewer-specific settings are overruled

    • Optionaltype: string

      Always "BIM"

    Returns Promise<void>

  • Resets the internal ObjectStateManager state to the default state, which means:

    • Visibility is reset to the original visibility, by default this leaves out the types IFCOPENINGELEMENT, IFCPROJECT, IFCBUILDING, IFCBUILDINGSTOREY and IFCZONE
    • Color, all objects are reset to their original color
    • Selection, any selected objects will be unselected

    All of these changes trigger the regular listeners and therefore the connected viewers.

    Returns Promise<void>

  • Parameters

    • query: Iterable<string> | BimQuery

      A query or iterable of Qids, the objects to reset color

    Returns Promise<void>

    A Promise that triggers when all connected listeners have applied the change

  • Parameters

    • buildingStoreyQids: Iterable<string>
    • visible: boolean

    Returns Promise<void>

  • Parameters

    • query: Iterable<string> | BimQuery
    • OptionalhideOpenings: boolean

    Returns Promise<unknown>

  • Change the labels of objects. Depending on the viewer labels are visualized differently.

    Parameters

    • labels: Label[]

      An array of Label

    Returns void

  • Update the set of pickable objects, replacing any previous pickable state

    Parameters

    • query: Iterable<string> | BimQuery

      Either a query or Iterable of Qid

    • Optionalforce: boolean

      Whether to force this change, when forced, any viewer-specific settings are overruled

    • Optionaltype: string

      Always "BIM"

    Returns Promise<void>

  • Replace the currently selected set by the provided set of objects

    Parameters

    • query: Iterable<string> | BimQuery
    • Optionaltype: string

    Returns Promise<void>

  • Update the set of visible objects, replacing any previous visibily state

    Parameters

    • query: Iterable<string> | BimQuery

      Either a query or Iterable of Qid

    • Optionalforce: boolean

      Whether to force this change, when forced, any viewer-specific settings are overruled

    • Optionaltype: string

      Always "BIM"

    Returns Promise<void>

  • Calling this method will update all connected viewers in a way that all of them are afterwards showing at least all of the queried objects.

    Parameters

    • query: Iterable<string> | BimQuery

      A query or iterable of Qids, the objects to reset color

    • options: ViewFitOptions

    Returns Promise<void>