SceneTransforms

SceneTransforms()

Functions that do scene-dependent transforms between rendering-related coordinate systems.

Methods

staticSuperMap3D.SceneTransforms.convert2DToCartesian(scene, position)Cartesian3

将未经反投影的笛卡尔坐标转换为反投影后的笛卡尔坐标。
Name Type Description
scene scene 参数scene是场景对象
position position 待反投影的平面坐标
Returns:
Cartesian3

staticSuperMap3D.SceneTransforms.wgs84ToDrawingBufferCoordinates(scene, position, result)Cartesian2

Transforms a position in WGS84 coordinates to drawing buffer coordinates. This may produce different results from SceneTransforms.wgs84ToWindowCoordinates when the browser zoom is not 100%, or on high-DPI displays.
Name Type Description
scene Scene The scene.
position Cartesian3 The position in WGS84 (world) coordinates.
result Cartesian2 optional An optional object to return the input position transformed to window coordinates.
Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided. This may be undefined if the input position is near the center of the ellipsoid.
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);

staticSuperMap3D.SceneTransforms.wgs84ToWindowCoordinates(scene, position, result)Cartesian2

Transforms a position in WGS84 coordinates to window coordinates. This is commonly used to place an HTML element at the same screen position as an object in the scene.
Name Type Description
scene Scene The scene.
position Cartesian3 The position in WGS84 (world) coordinates.
result Cartesian2 optional An optional object to return the input position transformed to window coordinates.
Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided. This may be undefined if the input position is near the center of the ellipsoid.
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);