在渲染相关坐标系之间执行场景相关转换的函数。
Methods
(static) wgs84ToDrawingBufferCoordinates(scene, position, result) → {Cartesian2}
将wgs84坐标中的位置转换为绘图缓冲区坐标。当浏览器缩放比例不是100%或在高dpi显示时,这可能会从sceneTransforms.wgs84中产生不同的结果。
Parameters:
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 = bmgl.Cartesian3.fromDegrees(0.0, 0.0);
var handler = new bmgl.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
console.log(bmgl.SceneTransforms.wgs84ToWindowCoordinates(scene, position));
}, bmgl.ScreenSpaceEventType.MOUSE_MOVE);
将wgs84坐标中的位置转换为窗口坐标。这通常用于将HTML元素放置在与场景中的对象相同的屏幕位置。
Parameters:
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 = bmgl.Cartesian3.fromDegrees(0.0, 0.0);
var handler = new bmgl.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
console.log(bmgl.SceneTransforms.wgs84ToWindowCoordinates(scene, position));
}, bmgl.ScreenSpaceEventType.MOUSE_MOVE);