进行场景依赖的函数在渲染相关的坐标系统之间转换.

Methods

static Cesium.SceneTransforms.worldToDrawingBufferCoordinates(scene, position, result)Cartesian2|undefined

NT 0 世界坐标中一个位置来绘制缓冲坐标. 这可能会产生不同的 当浏览器缩放不是100%时,或者在高 NT++1 显示时,结果为 NT+0 .
Name Type Description
scene Scene The scene.
position Cartesian3 世界位置( WGS84 或另类椭圆)坐标.
result Cartesian2 optional 返回转换为窗口坐标的输入位置的可选对象.
Returns:
未提供修改的结果参数或新的 NT% 0 实例 。 如果输入位置位于椭圆形中心附近,则可能是 unguide .
Example:
// Output the window position of longitude/latitude (0, 0) every time the mouse moves.
const position = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
const handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
    console.log(Cesium.SceneTransforms.worldToDrawingBufferCoordinates(scene, position));
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);

static Cesium.SceneTransforms.worldToWindowCoordinates(scene, position, result)Cartesian2|undefined

NT 0 世界上一个位置( NT 1 或另类椭圆形)坐标到窗口坐标. 这通常用于放置 HTML 元素与场景中的物体位于同一屏幕位置.
Name Type Description
scene Scene The scene.
position Cartesian3 世界位置( WGS84 或另类椭圆)坐标.
result Cartesian2 optional 返回转换为窗口坐标的输入位置的可选对象.
Returns:
未提供修改的结果参数或新的 NT% 0 实例 。 如果输入位置位于椭圆形中心附近,则可能是 unguide .
Example:
// Output the window position of longitude/latitude (0, 0) every time the mouse moves.
const position = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
const handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
    console.log(Cesium.SceneTransforms.worldToWindowCoordinates(scene, position));
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.