Skip to main content

CoordinateTracker <Tracked3D>

CoordinateTracker contains methods for tracking a screen space coordinate from a 3D position.

Index

Constructors

constructor

  • Constructor


    Type parameters

    Parameters

    • bimApi: BimCoreApi

      BIM Core API.

    • recalculate2DEachFrame: boolean = false

      If true then it updates the 2D positions for each tracked 3D coordinate at the end of each frame.

    Returns CoordinateTracker<Tracked3D>

Properties

publicreadonlyonUpdateObservable

onUpdateObservable: Observable<TrackCoordinate2D<Tracked3D>> = ...

Called when a tracked 3D coordinate changes its 2D position (when camera is manipulated). Same as onUpdate but using a Observable instead.

Accessors

publicsize

  • get size(): number
  • Number of items currently being tracked.


    Returns number

Methods

publicclear

  • clear(): void
  • Removes all tracked coordinates from the tracker.


    Returns void

publicdispose

  • dispose(): void
  • Disposes the coordinate tracker.


    Returns void

publicentries

  • entries(): IterableIterator<[unknown, Tracked3D], any, any>
  • Allows iteration of all entities that are tracked (and their ids)


    Returns IterableIterator<[unknown, Tracked3D], any, any>

    collection of all tracked entities and their id.

publicforceRecalculation

  • forceRecalculation(): void
  • Immediately force a recalculation of all 2D coordinates


    Returns void

publicget

  • Attempt to get a currently tracked object by id.


    Parameters

    • id: unknown

      Id of tracked object.

    Returns undefined | TrackCoordinate2D<Tracked3D>

    Tracked object if it exists. Otherwise undefined

publiconUpdate

  • Register a callback which will be called when the active camera moves. It is called once for each coordinate registered by track.


    Parameters

    • callback: (coordinate: TrackCoordinate2D<Tracked3D>) => void

      Callback to trigger when an active camera moves.

      Returns void

    publictrack

    • track(coordinate: Tracked3D, id?: unknown): unknown
    • This method takes a coordinate in 3D to track screen space position when the camera moves. When method is called events on onUpdateObservable are immediately raised for the passed coordinate. Same coordinate can be passed multiple times (with same id) but it will only be added once. However events onUpdateObservable will still be immediately raised and report 2D coordinates data even if coordinate is already tracked.


      Parameters

      • coordinate: Tracked3D

        Coordinate to track.

      • optionalid: unknown

        Optional. If not specified an id will be generated

      Returns unknown

      id of tracked coordinate.

    publictrackOnce

    • trackOnce(coordinate: Tracked3D, id: unknown): undefined | TrackCoordinate2D<Tracked3D>
    • Gets 2D coordinate of a 3D coordinate once.


      Parameters

      • coordinate: Tracked3D

        3D coordinate to get 2D coordinate from

      • id: unknown

        Identifier for 3D coordinate.

      Returns undefined | TrackCoordinate2D<Tracked3D>

    publicuntrack

    • untrack(id: unknown): undefined | Tracked3D
    • Stops tracking of a 3D coordinate.


      Parameters

      • id: unknown

        Id of 3D coordinate to stop tracking

      Returns undefined | Tracked3D

      Object that was untracked. If there is no such object then undefined.