DIVA 客户端类,保存与 DIVA 交互所需要的数据,并提供交互方法。

Hierarchy

Implements

Constructors

Accessors

  • get adapter(): Adapter
  • 获取适配器。

    Returns

    DIVA 后端适配器

    Returns Adapter

  • get eventBus(): Observable<DivaEvent<object>>
  • 获取事件总线。

    Returns

    DIVA 远程调用事件的可观测对象

    Returns Observable<DivaEvent<object>>

Methods

  • Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

    The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

    When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

    When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

    When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

    If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

    The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

    Type Parameters

    • K extends keyof DivaClientEventMap

    Parameters

    • type: K
    • listener: ((this: DivaClient, ev: DivaClientEventMap[K]) => any)
        • (this: DivaClient, ev: DivaClientEventMap[K]): any
        • Parameters

          Returns any

    • Optional options: boolean | AddEventListenerOptions

    Returns void

  • Parameters

    • type: string
    • listener: EventListenerOrEventListenerObject
    • Optional options: boolean | AddEventListenerOptions

    Returns void

  • Parameters

    • type: string
    • callback: null | EventListenerOrEventListenerObject
    • Optional options: boolean | AddEventListenerOptions

    Returns Promise<void>

  • Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

    Parameters

    • event: Event

    Returns boolean

  • 获取后端场景中的摄像机。

    Returns

    更新并返回获取到的摄像机对象

    Returns Promise<Camera>

  • 获取镜头参数。

    Deprecated

    请使用摄像机类 getCamera 提供的方法

    const camera = await this.client.getCamera();

    camera.position // 相机位置
    camera.rotation // 相机旋转

    // await camera.update('pull') // 相机位置发生变化时,调用 update('pull') 更新同步

    Returns Promise<CameraParams>

  • 获取指定 DIVA 大纲组下的实体列表。获取到的实例都将会根据其具体类型实例化为 相对应的对象实例,如模型(Model)、灯光(Light)、设备(Device)等。

    Returns

    一个包含对象化实例列表的期约(Promise)

    Type Parameters

    Parameters

    • path: string

      DIVA 大纲组的全路径

    Returns Promise<T[]>

  • 获取指定名称的实例列表。获取到的实例都将会根据其具体类型实例化为相对应的 对象实例,如模型(Model)、灯光(Light)、设备(Device)等。

    Returns

    一个包含对象化实例列表的期约(Promise)

    Type Parameters

    Parameters

    • name: string

      DIVA 大纲中实体的名称

    Returns Promise<T[]>

  • 获取指定 id 的实体。获取到的实例会根据其具体类型实例化为相对应的对象实例, 如模型(Model)、灯光(Light)、设备(Device)等。

    Returns

    一个包含对象化实例的期约(Promise)

    Type Parameters

    Parameters

    • id: string

      实体唯一标识符

    Returns Promise<T>

  • 获取当前客户端的实体管理器。

    Returns EntityManager

  • 获取指定 DIVA 大纲组下的实体组。获取到的实例都将会根据其具体类型实例化为 相对应的对象实例,如模型(Model)、灯光(Light)、设备(Device)等。

    Returns

    一个包含对象化实例组的期约(Promise)

    Parameters

    • path: string

      DIVA 大纲组的全路径

    Returns Promise<TypedGroup<Model>>

  • 经纬度坐标转世界笛卡尔坐标。

    Deprecated

    Returns

    世界坐标数组

    Parameters

    Returns Promise<Vector3[]>

  • 经纬度坐标转世界笛卡尔坐标。

    Returns

    世界坐标数组

    Parameters

    • coordinates: CoordinateTuple | CoordinateTuple[]

      经纬度坐标或经纬度坐标数组

    Returns Promise<Vector3[]>

  • 加载当前客户端至世界容器中,并建立与服务端的数据通信通道。

    Returns Promise<void>

  • 通过数据通道向服务端发送 rpc 通知。

    Parameters

    • method: string

      rpc 通知的方法名

    • params: RpcParams

      rpc 通知的参数

    Returns void

  • 暂停当前正在播放的相机轨。 再次播放该相机轨时,将从当前暂停处继续播放。 如当前没有正在播放的相机轨,调用则不会有任何作用。

    Returns Promise<SuccessObject<RpcParams>>

  • Removes the event listener in target's event listener list with the same type, callback, and options.

    Type Parameters

    • K extends keyof DivaClientEventMap

    Parameters

    • type: K
    • listener: ((this: DivaClient, ev: DivaClientEventMap[K]) => any)
        • (this: DivaClient, ev: DivaClientEventMap[K]): any
        • Parameters

          Returns any

    • Optional options: boolean | EventListenerOptions

    Returns void

  • Parameters

    • type: string
    • listener: EventListenerOrEventListenerObject
    • Optional options: boolean | EventListenerOptions

    Returns void

  • Parameters

    • type: string
    • callback: null | EventListenerOrEventListenerObject
    • Optional options: boolean | EventListenerOptions

    Returns Promise<void>

  • 设置镜头参数。

    Deprecated

    请使用摄像机类 getCamera 提供的方法

    并在修改完成时调用更新方法 update 将变更同步更新至后端

    const camera = await this.client.getCamera();

    camera.position = new Vector(...); // 相机位置
    camera.rotation = new Quaternion(...); // 相机旋转

    await camera.update() // 更新同步至后端

    Parameters

    • options: CameraOptions

      约束参数

    Returns Promise<void>

  • 将高亮模式重置为预设效果。

    Returns Promise<void>

  • 自定义设置高亮叠色模式效果。

    Parameters

    • opt: { border?: { color?: string; width?: number }; color?: string }

      高亮叠色选项

      • Optional border?: { color?: string; width?: number }

        高亮边缘轮廓。

        • Optional color?: string

          轮廓颜色,hex 字符串。默认值:#80F3FF

        • Optional width?: number

          轮廓宽度。默认值:2

      • Optional color?: string

        高亮叠加颜色,hex 字符串, 支持 alpha 通道。默认值:#FFFFFF00(透明)

    Returns Promise<void>

  • 设置鼠标输入交互模式。

    • 模式 0:按住左键无效果,按住中键绕中心旋转镜头,按住右键旋转镜头。
    • 模式 1:按住左键绕中心旋转镜头,按住中键旋转镜头,按住右键平移镜头。

    Parameters

    • value: 0 | 1

      0 或 1

    Returns Promise<void>

  • 设置虚拟摇杆的启用状态。

    Parameters

    • enabled: boolean

      是否启用

    Returns Promise<void>

  • 设置自动旋转。

    Parameters

    • enabled: boolean

      是否自动旋转

    • direction: "clockwise" | "anticlockwise" = 'clockwise'

      旋转方向,取值 'clockwise' 表示顺时针,'anticlockwise' 表示逆时针,默认顺时针

    • duration: number = 10

      旋转一周的时长,单位(秒),默认 10 秒

    Returns Promise<void>

  • 设置指定索引值路径的可见性。

    Parameters

    • index: number

      路径的索引值

    • visible: boolean

      可见与否

    Returns Promise<void>

  • 设置服务后端运行渲染的分辨率。

    Note: 当设置的分辨率超过 4k(3840*2160) 时,将会按比例缩小至范围内。

    Parameters

    Returns Promise<void>

  • 停止当前正在播放的相机轨。 再次播放该相机轨时,将从头开始。 如当前没有正在播放的相机轨,调用则不会有任何作用。

    Returns Promise<SuccessObject<RpcParams>>