Methods
static Cesium.SceneTransforms.wgs84ToDrawingBufferCoordinates(scene, position, result) → Cartesian2
将WGS84坐标中的位置转换为绘图缓冲区坐标。这可能会产生不同的结果
结果来自SceneTransforms.wgs84到窗口坐标当浏览器缩放不是100%时,或显示高DPI时。
Name | Type | Description |
---|---|---|
scene |
Scene | 现场。 |
position |
Cartesian3 | WGS84(世界)坐标中的位置。 |
result |
Cartesian2 | optional 返回转换为窗口坐标的输入位置的可选对象。 |
Returns:
修改后的结果参数或新的Cartesian2实例(如果未提供实例)。如果输入位置靠近椭球体的中心,则可能为
undefined
。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 = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
console.log(Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position));
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
static Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position, result) → Cartesian2
将WGS84坐标中的位置转换为窗口坐标。这通常用于放置
HTML元素与场景中的对象处于同一屏幕位置。
Name | Type | Description |
---|---|---|
scene |
Scene | 现场。 |
position |
Cartesian3 | WGS84(世界)坐标中的位置。 |
result |
Cartesian2 | optional 返回转换为窗口坐标的输入位置的可选对象。 |
Returns:
修改后的结果参数或新的Cartesian2实例(如果未提供实例)。如果输入位置靠近椭球体的中心,则可能为
undefined
。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 = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
console.log(Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position));
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);