From b3f468ebf9cd380c18024aecd62098c9b6be2762 Mon Sep 17 00:00:00 2001
From: husq <931347610@qq.com>
Date: Thu, 07 Sep 2023 15:20:28 +0800
Subject: [PATCH] 项目模块功能提交

---
 src/components/cesiumMap/cesium.vue |   41 ++++++++++++++++++++++++-----------------
 1 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/src/components/cesiumMap/cesium.vue b/src/components/cesiumMap/cesium.vue
index 24aad64..132f6d9 100644
--- a/src/components/cesiumMap/cesium.vue
+++ b/src/components/cesiumMap/cesium.vue
@@ -2,7 +2,7 @@
  * @Author: 胡思旗 931347610@qq.com
  * @Date: 2023-08-22 17:50:30
  * @LastEditors: husq 931347610@qq.com
- * @LastEditTime: 2023-09-05 14:12:49
+ * @LastEditTime: 2023-09-05 17:28:28
  * @FilePath: \Cloud-API-Demo-Web\src\components\cesiumMap\cesium.vue
  * @Description:
  *
@@ -16,6 +16,7 @@
 <script setup lang="ts">
 import * as Cesium from 'cesium'
 import { onMounted, ref, onUnmounted } from 'vue'
+import { pointCenter, clickPoint } from '/@/hooks/use-center-point'
 import { useMyStore } from '/@/store'
 const viewer: { value: Cesium.Viewer | null | undefined } = ref()
 const store = useMyStore()
@@ -81,8 +82,6 @@
   })
   viewer.value?.imageryLayers.addImageryProvider(annotation)
 }
-// 相机设置
-const camera = () => { }
 // 获取地图点击坐标
 const getCoordinate = () => {
   if (!centerConfig.value.type) return
@@ -98,7 +97,6 @@
         latitude,
       }
       store.commit('SET_CENTER_CONFIG_LATITUDE', data)
-      console.log(store, '设置成功')
     }
     Point(longitude, latitude)
   }, Cesium.ScreenSpaceEventType.LEFT_CLICK)
@@ -117,7 +115,15 @@
   //   duration: 2
   // })
 }
-
+// 设置项目中所有的项目中心坐标
+watch(() => store.state.map.pointList, (newVal, oldVal) => {
+  if (newVal && newVal.length > 0) {
+    pointCenter(viewer.value, newVal)
+    clickPoint(viewer.value, newVal)
+  }
+}, {
+  deep: true
+})
 onMounted(() => {
   init()
 })
@@ -134,17 +140,18 @@
     display: none !important;
   }
 }
+
 .pointLongitude {
-    background-color: rgba(20, 20, 20, 0.792);
-    position: absolute;
-    z-index: 30;
-    bottom: 30px;
-    color: #fff;
-    left: 0;
-    right: 0;
-    margin: 0 80px;
-    padding: 15px 0;
-    text-align: center;
-    font-size: 16px;
-  }
+  background-color: rgba(20, 20, 20, 0.792);
+  position: absolute;
+  z-index: 30;
+  bottom: 30px;
+  color: #fff;
+  left: 0;
+  right: 0;
+  margin: 0 80px;
+  padding: 15px 0;
+  text-align: center;
+  font-size: 16px;
+}
 </style>

--
Gitblit v1.9.3