From 26215b4645227b91a58f3e56103c0f0c6ccb46b2 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Wed, 09 Feb 2022 11:20:57 +0800
Subject: [PATCH] +

---
 src/components/mobilemap/index.vue |  152 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 147 insertions(+), 5 deletions(-)

diff --git a/src/components/mobilemap/index.vue b/src/components/mobilemap/index.vue
index 8c377cd..3d9f773 100644
--- a/src/components/mobilemap/index.vue
+++ b/src/components/mobilemap/index.vue
@@ -40,6 +40,7 @@
   name: "mobilemapBox",
   data() {
     return {
+      butbut: null,
       DC: "",
       bigPopup: {
         width: 0,
@@ -279,13 +280,150 @@
         // if (height > 2000) {
         //   conBack(2000);
         // }
-        if (height < 0 && isSet) {
-          conBack(0);
+        if (height <= 220 && isSet) {
+          conBack(220);
         }
-        if (height > 4000 && isSet) {
-          conBack(4000);
+        // if (height > 220 && height <= 280 && isSet) {
+        //   conBack(280);
+        // }
+        // if (height > 280 && height <= 340 && isSet) {
+        //   conBack(340);
+        // }
+        // if (height > 340 && height <= 400 && isSet) {
+        //   conBack(400);
+        // }
+        if (height > 400 && isSet) {
+          conBack(400);
         }
       });
+
+      // 按钮事件
+      that.butbut = function () {
+        //放大
+        document.querySelector(".dc-zoom-controller").children[0].onclick =
+          function () {
+            if (that.dimension == "2.5D") {
+              const height = Math.ceil(
+                viewer.camera.positionCartographic.height
+              );
+
+              if (height > 370) {
+                viewer.camera.setView({
+                  destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
+                    viewer.camera.positionCartographic.longitude,
+                    viewer.camera.positionCartographic.latitude,
+                    340
+                  ),
+                  orientation: {
+                    // 指向
+                    heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+                    // 视角
+                    pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
+                    roll: 0.0,
+                  },
+                });
+
+                return;
+              }
+
+              if (height > 310) {
+                viewer.camera.setView({
+                  destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
+                    viewer.camera.positionCartographic.longitude,
+                    viewer.camera.positionCartographic.latitude,
+                    280
+                  ),
+                  orientation: {
+                    // 指向
+                    heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+                    // 视角
+                    pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
+                    roll: 0.0,
+                  },
+                });
+
+                return;
+              }
+
+              if (height > 250) {
+                viewer.camera.setView({
+                  destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
+                    viewer.camera.positionCartographic.longitude,
+                    viewer.camera.positionCartographic.latitude,
+                    220
+                  ),
+                  orientation: {
+                    // 指向
+                    heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+                    // 视角
+                    pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
+                    roll: 0.0,
+                  },
+                });
+              }
+            }
+          };
+        //缩小
+        document.querySelector(".dc-zoom-controller").children[2].onclick =
+          function () {
+            if (that.dimension == "2.5D") {
+              const height = Math.ceil(
+                viewer.camera.positionCartographic.height
+              );
+
+              if (height <= 250) {
+                viewer.camera.setView({
+                  destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
+                    viewer.camera.positionCartographic.longitude,
+                    viewer.camera.positionCartographic.latitude,
+                    280
+                  ),
+                  orientation: {
+                    // 指向
+                    heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+                    // 视角
+                    pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
+                    roll: 0.0,
+                  },
+                });
+              }
+
+              if (height > 250 && height <= 310) {
+                viewer.camera.setView({
+                  destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
+                    viewer.camera.positionCartographic.longitude,
+                    viewer.camera.positionCartographic.latitude,
+                    340
+                  ),
+                  orientation: {
+                    // 指向
+                    heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+                    // 视角
+                    pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
+                    roll: 0.0,
+                  },
+                });
+              }
+
+              if (height > 310 && height < 370) {
+                viewer.camera.setView({
+                  destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
+                    viewer.camera.positionCartographic.longitude,
+                    viewer.camera.positionCartographic.latitude,
+                    400
+                  ),
+                  orientation: {
+                    // 指向
+                    heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+                    // 视角
+                    pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
+                    roll: 0.0,
+                  },
+                });
+              }
+            }
+          };
+      };
 
       // 地图点击事件
       // viewer.on(DC.MouseEventType.CLICK, (e) => {
@@ -643,7 +781,8 @@
           };
           that.dimension == "2.5D"
             ? doit2(
-                [114.03928791, 27.62954732, 360.0],
+                [114.03928791, 27.62954732, 220.0],
+                // [114.04062292, 27.62666834, 220.0],
                 [
                   that.dimensionData.heading,
                   that.dimensionData.pitch,
@@ -826,6 +965,9 @@
     }
 
     DC.ready(initViewer);
+    setTimeout(() => {
+      that.butbut();
+    }, 0);
   },
   methods: {
     openPopupS(position, lntLat, query) {

--
Gitblit v1.9.3