Cesium 获取当前屏幕范围内的中心点以及相机姿态

//相机姿态

var direction = viewer.camera._direction;
var x = Cesium.Math.toDegrees(direction.x);
var y = Cesium.Math.toDegrees(direction.y);
var z = Cesium.Math.toDegrees(direction.z);

//中心点位置

var rectangle = viewer.camera.computeViewRectangle();
var west =rectangle.west / Math.PI * 180;
var north = rectangle.north / Math.PI * 180;
var east = rectangle.east / Math.PI * 180;
var south = rectangle.south / Math.PI * 180;
        var centerx=(west+east)/2;
        var cnetery=(north+south)/2;
// 鉴于高德、leaflet获取的边界都是southwest和northeast字段来表示,本例保持一致性
console.log("centerx:"+centerx);
 console.log("cnetery:"+cnetery); 

你可能感兴趣的:(Cesium)