在渲染相關坐標系之間執行場景相關轉換的函數。
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);