Class: SceneTransforms

SceneTransforms

new SceneTransforms()

在与渲染相关的坐标系之间进行场景变换的函数。

Methods

static convert2DToCartesian(scene, position){Cartesian3}

将未经反投影的Cartesian坐标转换为反投影后的Cartesian坐标。

Name Type Description
scene scene

参数scene是场景对象。

position position

待反投影的平面坐标。

Returns:
Type Description
Cartesian3 Cartesian3

static wgs84ToDrawingBufferCoordinates(scene, position, result){Cartesian2}

将 WGS84 坐标中的位置转换为绘图缓冲区坐标。当浏览器缩放不是 100%,或在高分辨率显示器上时,这可能会产生与 SceneTransforms.wgs84ToWindowCoordinates 不同的结果。

Name Type Description
scene Scene

场景。

position Cartesian3

以 WGS84(地理)坐标表示的位置。

result Cartesian2 可选

可选对象,用于返回转换为窗口坐标的输入位置。

Returns:
Type Description
Cartesian2 修改后的结果参数,或者一个新的 Cartesian2 实例(如果没有提供)。如果输入位置靠近椭球中心,则可能无法定义。
Example
// Output the window position of longitude/latitude (0, 0) every time the mouse moves.
var scene = widget.scene;
var ellipsoid = scene.globe.ellipsoid;
var position = SuperMap3D.Cartesian3.fromDegrees(0.0, 0.0);
var handler = new SuperMap3D.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
    console.log(SuperMap3D.SceneTransforms.wgs84ToWindowCoordinates(scene, position));
}, SuperMap3D.ScreenSpaceEventType.MOUSE_MOVE);

static wgs84ToWindowCoordinates(scene, position, result){Cartesian2}

将 WGS84 坐标中的位置转换为窗口坐标。这通常用于将 HTML 元素与场景中的对象置于相同的屏幕位置。

Name Type Description
scene Scene

场景。

position Cartesian3

以 WGS84(地理)坐标表示的位置。

result Cartesian2 可选

可选对象,用于返回转换为窗口坐标的输入位置。

Returns:
Type Description
Cartesian2 修改后的结果参数,或者一个新的 Cartesian2 实例(如果没有提供)。 如果输入位置靠近椭球中心,则可能无法定义。
Example
// Output the window position of longitude/latitude (0, 0) every time the mouse moves.
var scene = widget.scene;
var ellipsoid = scene.globe.ellipsoid;
var position = SuperMap3D.Cartesian3.fromDegrees(0.0, 0.0);
var handler = new SuperMap3D.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
    console.log(SuperMap3D.SceneTransforms.wgs84ToWindowCoordinates(scene, position));
}, SuperMap3D.ScreenSpaceEventType.MOUSE_MOVE);