//获取四角经纬度
export const fourWind = () => {
// 获取当前视图范围
var extent = viewer.camera.computeViewRectangle();
// 提取四个角的经纬度
var southwest = Cesium.Rectangle.southwest(extent);
var southeast = Cesium.Rectangle.southeast(extent);
var northeast = Cesium.Rectangle.northeast(extent);
var northwest = Cesium.Rectangle.northwest(extent);
return northwest
// 打印经纬度信息
console.log("Southwest Corner: " + Cesium.Math.toDegrees(southwest.longitude) + ", " + Cesium.Math.toDegrees(southwest.latitude));
console.log("Southeast Corner: " + Cesium.Math.toDegrees(southeast.longitude) + ", " + Cesium.Math.toDegrees(southeast.latitude));
console.log("Northeast Corner: " + Cesium.Math.toDegrees(northeast.longitude) + ", " + Cesium.Math.toDegrees(northeast.latitude));
console.log("Northwest Corner: " + Cesium.Math.toDegrees(northwest.longitude) + ", " + Cesium.Math.toDegrees(northwest.latitude));
}
//监听鼠标滚轮事件
export const ScreenSpaceEventHandler = (callback) => {
const handle3D = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handle3D.setInputAction(() => {
console.log(fourWind(), 'yi1')
// var level = Math.ceil(viewer.camera.positionCartographic.height);
// console.log(level,'缩放等级')
// var height = viewer.camera.positionCartographic.height;
// console.log(height,'高度')
callback(fourWind())
}, Cesium.ScreenSpaceEventType.WHEEL);
}