|
|
@@ -530,31 +530,37 @@ export default {
|
|
|
|
|
|
this.dixingAdd = true;
|
|
|
|
|
|
- viewer.camera.moveEnd.addEventListener(() => {
|
|
|
- // 获取相机的笛卡尔3D坐标
|
|
|
- const position = viewer.camera.position;
|
|
|
-
|
|
|
- // 将笛卡尔坐标转换为地理坐标(弧度)
|
|
|
- const cartographic = Cesium.Cartographic.fromCartesian(position);
|
|
|
-
|
|
|
- // 高度(以米为单位)
|
|
|
- // 注意:这个高度是相对于WGS84椭球体的高度,不是海拔高度(MSL)
|
|
|
- const height = Cesium.Math.toDegrees(cartographic.height);
|
|
|
- if (height > 3000000) {
|
|
|
- entityxy.show = false;
|
|
|
- console.log("entityxy false", entityxy.show);
|
|
|
- }
|
|
|
- if (height < 3000000) {
|
|
|
- entityxy.show = true;
|
|
|
- console.log("entityxy true", entityxy.show);
|
|
|
- }
|
|
|
- // 强制请求一次场景重绘
|
|
|
- if (viewer && viewer.scene) {
|
|
|
- viewer.scene.requestRender();
|
|
|
- }
|
|
|
- console.log("相机高度 (椭球体高):", height, "米");
|
|
|
+ const btn = document.getElementById("windBtn")
|
|
|
+
|
|
|
+ btn.addEventListener('click', function(event) {
|
|
|
+ entityxy.show = !entityxy.show;
|
|
|
});
|
|
|
|
|
|
+ // viewer.camera.moveEnd.addEventListener(() => {
|
|
|
+ // // 获取相机的笛卡尔3D坐标
|
|
|
+ // const position = viewer.camera.position;
|
|
|
+
|
|
|
+ // // 将笛卡尔坐标转换为地理坐标(弧度)
|
|
|
+ // const cartographic = Cesium.Cartographic.fromCartesian(position);
|
|
|
+
|
|
|
+ // // 高度(以米为单位)
|
|
|
+ // // 注意:这个高度是相对于WGS84椭球体的高度,不是海拔高度(MSL)
|
|
|
+ // const height = Cesium.Math.toDegrees(cartographic.height);
|
|
|
+ // if (height > 3000000) {
|
|
|
+ // entityxy.show = false;
|
|
|
+ // console.log("entityxy false", entityxy.show);
|
|
|
+ // }
|
|
|
+ // if (height < 3000000) {
|
|
|
+ // entityxy.show = true;
|
|
|
+ // console.log("entityxy true", entityxy.show);
|
|
|
+ // }
|
|
|
+ // // 强制请求一次场景重绘
|
|
|
+ // if (viewer && viewer.scene) {
|
|
|
+ // viewer.scene.requestRender();
|
|
|
+ // }
|
|
|
+ // console.log("相机高度 (椭球体高):", height, "米");
|
|
|
+ // });
|
|
|
+
|
|
|
// 创建事件处理器
|
|
|
const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
|
|
|
handler.setInputAction(function (movement) {
|