An interface that can be implemented to be notified about certain ObjectStateManager related events. All of the methods allow the ability to return a Promise. When a Promise is returned, the ObjectStateManager will wait before it will trigger the next listener until the Promise resolves. Keep that in mind when returning a Promise.

interface ObjectStateListener {
    setLabels?: ((labels: Iterable<Label, any, any>) => void | Promise<unknown>);
    unloaded?: ((qids: Iterable<Qid, any, any>) => void | Promise<void>);
    addedToSelectionSet?(qids: Iterable<Qid, any, any>, type: string): void | Promise<void>;
    addedToVisibleSet?(qids: Iterable<Qid, any, any>): void | Promise<void>;
    colorChanged?(qids: Iterable<Qid, any, any>, color: Color): void | Promise<void>;
    colorChangedMulti?(changes: Map<Color, Iterable<Qid, any, any>>): void | Promise<void>;
    colorReset?(qids: Iterable<Qid, any, any>): void | Promise<void>;
    hoverOff?(qid: Qid): void;
    hoverOn?(qid: Qid, previousQid: Qid, screenspaceLocation: vec2): void;
    primarySelectionChanged?(qid: Qid): void | Promise<unknown>;
    removedFromSelectionSet?(qids: Iterable<Qid, any, any>, type: string): void | Promise<void>;
    removedFromVisibleSet?(qids: Iterable<Qid, any, any>, type?: string): void | Promise<void>;
    setBuildingStoreysVisibleExclusive?(buildingStoreyQids: Iterable<Qid, any, any>, hideOpenings: boolean): void | Promise<void>;
    setBuildingStoreyVisibleExclusive?(qid: Qid): void | Promise<void>;
    setToSelectionSet?(qids: Iterable<Qid, any, any>, qidsToUnselect: Iterable<Qid, any, any>, type: string): void | Promise<void>;
    setVisibleSet?(shown: Iterable<Qid, any, any>, hidden: Iterable<Qid, any, any>, force: boolean): void | Promise<unknown>;
    viewFit?(qids: Iterable<Qid, any, any>, options?: ViewFitOptions): void | Promise<void>;
    viewFitModels?(versionUuids: Iterable<string, any, any>, options?: ViewFitOptions): void | Promise<void>;
}

Implemented by

    Properties

    setLabels?: ((labels: Iterable<Label, any, any>) => void | Promise<unknown>)
    unloaded?: ((qids: Iterable<Qid, any, any>) => void | Promise<void>)

    Methods

    • This method will get called when objects have been added to the selection.

      Parameters

      Returns void | Promise<void>

    • Objects were added to the set of visible objects

      Parameters

      • qids: Iterable<Qid, any, any>

        An Iterable of all the objects that were added

      Returns void | Promise<void>

      This method can return a Promise, if it does, subsequent listeners will only be notified after the returned Promise has resolved

    • Called when the colors of objects have been changed.

      Parameters

      • qids: Iterable<Qid, any, any>

        The object for which the color was changed

      • color: Color

        The new color for those objects

      Returns void | Promise<void>

    • Called when the colors of objects have been changed.

      Parameters

      • changes: Map<Color, Iterable<Qid, any, any>>

        The color changes put into a Map. For each unique color there should be an entry. As the value usually a QidSet will be used but any Iterable will do

      Returns void | Promise<void>

    • Called when the color of the given objects has been reset

      Parameters

      • qids: Iterable<Qid, any, any>

        The Qids of the objects for which the color has been reset

      Returns void | Promise<void>

    • Called then the given object is not being hovered on anymore

      Parameters

      • qid: Qid

        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: Qid

        The Qid of the object being hovered over

      • previousQid: Qid

        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

    • The primary selection has changed

      Parameters

      • qid: Qid

        The Qid of the newly selected primary object or null if primary selection was unselected

      Returns void | Promise<unknown>

    • Objects have been removed from the selection set

      Parameters

      • qids: Iterable<Qid, any, any>

        The Qids of the objects that have been removed from the selection set

      • type: string

      Returns void | Promise<void>

    • Objects were removed from the set of visible objects

      Parameters

      • qids: Iterable<Qid, any, any>

        An Iterable of all the objects that were removed

      • Optionaltype: string

        To be removed

      Returns void | Promise<void>

      This method can return a Promise, if it does, subsequent listeners will only be notified after the returned Promise has resolved

    • Parameters

      • buildingStoreyQids: Iterable<Qid, any, any>
      • hideOpenings: boolean

      Returns void | Promise<void>

    • This method will get called when the set of selected objects has been

      Parameters

      Returns void | Promise<void>

    • The set of visible objects has been replaced to the given set

      Parameters

      • shown: Iterable<Qid, any, any>

        The objects that have been made visible

      • hidden: Iterable<Qid, any, any>

        The objects that have been made invisible

      • force: boolean

        Whether the state change is forced. This additional information can be used by implementations (such as the Viewer3d) to change internal state

      Returns void | Promise<unknown>

      This method can return a Promise, if it does, subsequent listeners will only be notified after the returned Promise has resolved

    • Fit the given object into view.

      Parameters

      • qids: Iterable<Qid, any, any>

        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 | Promise<void>

    • Fit the given models into view.

      Parameters

      • versionUuids: Iterable<string, any, any>

        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>