EquirectangularPanorama
Cesium v1.147 · 中文

new Cesium.EquirectangularPanorama(options)

在场景中以等距矩形格式显示影像的 Panorama
Name Type Description
options EquirectangularPanorama.ConstructorOptions 描述初始化选项的对象
Example:
const position = Cesium.Cartesian3.fromDegrees(
-75.1699,  // 经度
39.9522,   // 纬度
100.0      // 高度,单位:米
);

const heading = Cesium.Math.toRadians(45.0); // 绕垂直轴的旋转角度
const pitch = Cesium.Math.toRadians(-30.0);   // 俯仰角(负值表示向下)
const roll = Cesium.Math.toRadians(10.0);    // 滚转角,关于前进轴

const hpr = new Cesium.HeadingPitchRoll(
heading,
pitch,
roll
);

const modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(
position,
hpr,
Cesium.Ellipsoid.WGS84,
Cesium.Transforms.eastNorthUpToFixedFrame
);

scene.primitives.add(new Cesium.EquirectangularPanorama({
transform: modelMatrix,
image: 'path/to/image',
}));
Demo:

Members

获取全景图的版权信息

readonly image : string|HTMLImageElement|HTMLCanvasElement|ImageBitmap

获取全景图的源图像
获取全景图的半径
决定是否显示等距矩形全景图
获取全景图的变换矩阵

Methods

isDestroyed 之外的任何函数都将引发 DeveloperError 异常。因此, 将返回值(undefined)赋给对象,如示例中所示

对象已被销毁,即调用了 destroy() isDestroyed will result in a DeveloperError exception. Therefore, assign the return value (undefined) to the object as done in the example.
Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
equirectangularPanorama = equirectangularPanorama && equirectangularPanorama.destroy();
See:
如果此对象被销毁,则返回 true;否则返回 false。

如果此对象被销毁,不应使用它;调用除 isDestroyed 之外的任何函数将引发 DeveloperError 异常。
Returns:
true 如果此对象被销毁,则返回 true;否则返回 false。
See:
在 Viewer 或 CesiumWidget 渲染场景时调用,以获取渲染此基本体的所需绘制命令 不要直接调用此函数。此文档仅用于列出渲染场景时可能产生的异常:

会销毁该对象持有的 WebGL 资源。销毁对象允许确定性地释放 WebGL 资源,而无需依赖垃圾回收器来销毁该对象 一旦对象被销毁,就不应再使用它;调用除

Type Definitions

Cesium.EquirectangularPanorama.ConstructorOptions

EquirectangularPanorama 构造器的初始化选项
Properties:
Name Type Attributes Default Description
options.transform Matrix4 定义全景图位置和方向的 4x4 变换矩阵 (例如,由位置与航向-俯仰-滚转组合得到)
options.image string | HTMLImageElement | HTMLCanvasElement | ImageBitmap 指向图像资源的 URL,或预加载的图像对象
options.radius number <optional>
100000.0 全景图的半径,单位:米
options.repeatHorizontal number <optional>
1.0 纹理在水平方向上重复的次数
options.repeatVertical number <optional>
1.0 纹理在垂直方向上重复的次数
options.credit Credit | string <optional>
显示在画布上的全景图版权信息
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.