From 9f51306b10520a2be30bedfe1b34c288cf770f43 Mon Sep 17 00:00:00 2001
From: surprise <15810472099@163.com>
Date: 星期四, 19 十月 2023 17:51:30 +0800
Subject: [PATCH] 坡度坡向功能新增,临时图层添加定位。空间查询功能优化;

---
 src/assets/js/Map/index.js |   43 ++++++++++++++++++++++++++++++++++---------
 1 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/src/assets/js/Map/index.js b/src/assets/js/Map/index.js
index 7fb0fd1..c8a7867 100644
--- a/src/assets/js/Map/index.js
+++ b/src/assets/js/Map/index.js
@@ -31,11 +31,11 @@
       timeline: true,
     });
 
- 
+
     this.earthCtrl.Viewer.scene.debugShowFramesPerSecond = true
     this.earthCtrl.coreMap.scene.screenSpaceCameraController.enableCollisionDetection = true;
     this.earthCtrl.Viewer.scene.globe.terrainExaggeration = 1.00001
- 
+
 
     window.earthCtrl = this.earthCtrl;
 
@@ -65,26 +65,51 @@
     sgworld.Navigate.Stop(); //鍙栨秷椋炶鐘舵��
     sgworld.Navigate.setPosition(-1093596.38, 5729026.12, 4136590.41);
     this.addMouseLeftClickEvents();
+    this.addMouseLeftDownEvents();
   },
-
-  //榧犳爣宸﹂敭鐐瑰嚮浜嬩欢娣诲姞
-  addMouseLeftClickEvents() {
+  addMouseLeftDownEvents() {
     if (window.handleLeftClick) {
       window.handleLeftClick.removeInputAction(
         Cesium.ScreenSpaceEventType.LEFT_CLICK
       ); //绉婚櫎浜嬩欢
       window.handleLeftClick = null;
     }
+    const pickGlobeSlope = new SmartEarth.Cesium.PickGlobeSlope(earthCtrl.Viewer)
     window.handleLeftClick = new Cesium.ScreenSpaceEventHandler(
       window.Viewer.scene.canvas
     );
     var that = this;
     window.handleLeftClick.setInputAction(function (event) {
+      const angle = pickGlobeSlope.pickSlope(event.position)
+      if (store.state.slopeQueyFlag) {
+        if (!store.state.showSlopeQuey) {
+          store.state.showSlopeQuey = true;
+        }
+        store.state.slopeQueyValue = angle.toFixed(6);
+
+      }
+
+    }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
+  },
+
+  //榧犳爣宸﹂敭鐐瑰嚮浜嬩欢娣诲姞
+  addMouseLeftClickEvents() {
+    if (window.handleLeftDown) {
+      window.handleLeftDown.removeInputAction(
+        Cesium.ScreenSpaceEventType.LEFT_DOWN
+      ); //绉婚櫎浜嬩欢
+      window.handleLeftDown = null;
+    }
+    window.handleLeftDown = new Cesium.ScreenSpaceEventHandler(
+      window.Viewer.scene.canvas
+    );
+    var that = this;
+    window.handleLeftDown.setInputAction(function (event) {
       let cartesian = window.Viewer.scene.pick(event.position);
       if (Cesium.defined(cartesian)) {
 
         if (cartesian.id.shpType && cartesian.id.shpType == 'temporaryLayer') {
-     
+
           that.setEditTemporaryLayer(cartesian.id._id)
         }
 
@@ -94,9 +119,9 @@
   setEditTemporaryLayer(res) {
     // store.state.editTemporaryId = res;
     // console.log(store.state.editTemporaryId)
- 
-    if (store.state.editTemporaryId && store.state.editTemporaryId  == res) {
- 
+
+    if (store.state.editTemporaryId && store.state.editTemporaryId == res) {
+
       store.state.setEditTemporaryShow = true;
     }
   },

--
Gitblit v1.9.3