# new CompatibleFunc()
适配不同版本Cesium接口方法类
支持如下方法:
[1、适配Cesium不同版本的worldToWindowCoordinates方法,将世界坐标中的位置转换为窗口坐标][2、适配Cesium不同版本的fromGltfAsync方法,异步创建GLTF模型]
[3、适配Cesium不同版本的fromBoundingSphere方法]
示例
// ES5引入方式
const { CompatibleFunc } = zondy.cesium
// ES6引入方式
import { CompatibleFunc } from "@mapgis/webclient-cesium-plugin"
const windowCoordinates = CompatibleFunc.worldToWindowCoordinates(
scene,
Cesium.Cartesian3.fromDegrees(0, 0, 0)
)
方法
# static fromBoundingSphere(boundingSphere, ellipsoidopt, resultopt)
适配Cesium不同版本的fromBoundingSphere方法。Create a rectangle from a bounding sphere, ignoring height.
参数:
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
boundingSphere |
Cesium.BoundingSphere | The bounding sphere. |
|
ellipsoid |
Cesium.Ellipsoid | Ellipsoid.default | The ellipsoid. |
result |
Cesium.Rectangle | The object onto which to store the result, or undefined if a new instance should be created. |
The modified result parameter or a new Rectangle instance if none was provided.
Cesium.Rectangle
*
# static fromGltfAsync()
适配Cesium不同版本的fromGltfAsync方法,异步创建GLTF模型。 Cesium1.122中该方法为Cesium.Model.fromGltfAsync。Cesium1.84中该方法为Cesium.Model.fromGltf。
fromGltfAsync方法
function
# static worldToWindowCoordinates()
适配Cesium不同版本的worldToWindowCoordinates方法,将世界坐标中的位置转换为窗口坐标。 Cesium1.122中该方法为Cesium.SceneTransforms.worldToWindowCoordinates。Cesium1.84中该方法为Cesium.SceneTransforms.wgs84ToWindowCoordinates。
worldToWindowCoordinates方法
function