应用中所有摄像机的基础类。

Hierarchy

Constructors

Properties

onupdateend: null | ((this: Camera, ev: DivaCameraEvent) => void) = null

获取或设置一个 updateend 事件的 handler 处理器。

onupdatestart: null | ((this: Camera, ev: DivaCameraEvent) => void) = null

获取或设置一个 updatestart 事件的 handler 处理器。

Accessors

  • get [toStringTag](): string
  • Returns string

  • get coordinate(): null | CimCoordinates | CoordinateTuple
  • 获取经纬度坐标。

    Returns null | CimCoordinates | CoordinateTuple

  • set coordinate(value: null | CimCoordinates | CoordinateTuple): void
  • 设置经纬度坐标,仅 CIM 模式下支持。

    Parameters

    Returns void

  • get id(): string
  • Returns string

  • get name(): null | string
  • Returns null | string

  • set name(value: null | string): void
  • Parameters

    • value: null | string

    Returns void

  • get position(): Vector3
  • 获取世界笛卡尔坐标。

    Returns Vector3

  • set position(value: Vector3): void
  • 设置世界笛卡尔坐标。

    Parameters

    Returns void

  • get transformation(): Matrix
  • 获取到当前相机在世界空间中的变换矩阵。

    Returns Matrix

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 CameraEventMap

    Parameters

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

          • this: Camera
          • ev: CameraEventMap[K]

          Returns any

    • Optional options: boolean | AddEventListenerOptions

    Returns void

  • Parameters

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

    Returns 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

  • 将摄像机聚焦至空间中心。

    Parameters

    • space: BoundingInfo

      聚焦的空间

    • distance: number

      相机距离焦点距离,单位 cm

    • pitch: number

      镜头俯仰角(倾角)弧度角

    Returns Promise<void>

  • 将摄像机聚焦至指定点。

    Parameters

    • point: Vector3

      聚焦的全局笛卡尔位置坐标

    • distance: number

      相机距离焦点距离,单位 cm

    • pitch: number

      镜头俯仰角(倾角)弧度角

    Returns Promise<void>

  • 将摄像机聚焦至指定点。

    Parameters

    • coordinate: CimCoordinates

      聚焦的 CIM 经纬度位置坐标

    • distance: number

      相机距离焦点距离,单位 cm

    • pitch: number

      镜头俯仰角(倾角)弧度角

    Returns Promise<void>

  • Parameters

    • model: Model

      聚焦的模型

    • distance: number

      相机距离焦点距离,单位 cm

    • pitch: number

      镜头俯仰角(倾角)弧度角

    Returns Promise<void>

  • 按照索引值获取相机的轨道。

    Parameters

    • index: number

      相机轨道的索引

    Returns Promise<CameraTrack>

  • 按照名称获取相机的轨道。

    Parameters

    • name: string

      相机轨道的名称

    Returns Promise<CameraTrack>

  • Parameters

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • 使当前摄像机看向一个给定的空间中心。

    Parameters

    Returns Promise<void>

  • 使当前摄像机看向一个点。

    Parameters

    • point: Vector3

      看向的全局笛卡尔位置坐标

    Returns Promise<void>

  • 使当前摄像机看向一个点。

    Parameters

    Returns Promise<void>

  • 使当前摄像机看向一个模型的中心。

    Parameters

    • model: Model

      看向的模型

    Returns Promise<void>

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

    Type Parameters

    • K extends keyof CameraEventMap

    Parameters

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

          • this: Camera
          • ev: CameraEventMap[K]

          Returns any

    • Optional options: boolean | EventListenerOptions

    Returns void

  • Parameters

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

    Returns void

  • 设置经纬度坐标,仅 CIM 模式下支持。

    Deprecated

    请使用 coordinate 属性代替

    camera.setCimCoordinate(new CimCoordinates({ ... }));
    // 请使用下面的方式替代
    camera.coordinate = [116.0, 39.0, 10.0]; // [经度 (角度值), 纬度 (角度值), 高度 (单位 m)]
    camera.update();

    Parameters

    Returns Promise<void>

  • 设置相机约束。

    Parameters

    • options: null | CameraConstraintsOptions

      相机约束参数,当传入 null 时,则为移除所有约束限制

    Returns Promise<void>

  • Parameters

    • mode: "pull"

    Returns Promise<RpcParams>

  • Parameters

    • mode: "push"

    Returns Promise<void>

  • Returns Promise<void>