From 3c23ce2d0214a1246664e61fd51466033e25481e Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期五, 07 七月 2023 11:25:16 +0800
Subject: [PATCH] cimSDk 替换

---
 src/assets/js/Map/menuTool.js |  109 ++++++++++++++++++++++++++++++------------------------
 1 files changed, 61 insertions(+), 48 deletions(-)

diff --git a/src/assets/js/Map/menuTool.js b/src/assets/js/Map/menuTool.js
index ede4bed..24e4bbd 100644
--- a/src/assets/js/Map/menuTool.js
+++ b/src/assets/js/Map/menuTool.js
@@ -1,16 +1,17 @@
 import * as turf from "@turf/turf";
+
 const menuTool = {
   toolMenu: null,
   toolFlag: null,
   oldLeftMenuId: null,
-  colorAll: {},
+
   squareOjb: [],
+  colorAll: {
+    point: SmartEarth.Cesium.Color.fromCssColorString("#ff0000"),
+    polyline: SmartEarth.Cesium.Color.fromCssColorString("#ffff0050"),
+    polygon: SmartEarth.Cesium.Color.fromCssColorString("#ffff0050"),
+  },
   topTools(res) {
-    // this.clearTopTools();
-    // if (res.id == this.toolFlag) {
-    //   this.toolFlag = null;
-    //   return;
-    // }
     this.toolFlag = res.id;
     switch (res.id) {
       case "a2": //鐐规极娓�
@@ -59,11 +60,46 @@
       case "e1"://蹇収
         this.snapshot();
         break;
+      case "f1"://绌洪棿鏌ヨ
+        this.spatialQuery();
+        break;
       case "g1": //鍧愭爣瀹氫綅
         this.Coordposition();
         break;
     }
   },
+  //绌洪棿鏌ヨ
+  spatialQuery() {
+
+    sgworld.Creator.createSimpleGraphic('rectangle', { showSize: false }, (entity) => {
+      var west = Cesium.Math.toDegrees(
+        entity.rectangle._coordinates.getValue().west
+      ); // 鏍规嵁寮у害鑾峰彇鍒扮粡搴�
+      var east = Cesium.Math.toDegrees(
+        entity.rectangle._coordinates.getValue().east
+      ); // 鏍规嵁寮у害鑾峰彇鍒扮含搴�
+      var north = Cesium.Math.toDegrees(
+        entity.rectangle._coordinates.getValue().north
+      ); // 鏍规嵁寮у害鑾峰彇鍒扮粡搴�
+      var south = Cesium.Math.toDegrees(
+        entity.rectangle._coordinates.getValue().south
+      ); // 鏍规嵁寮у害鑾峰彇鍒扮含搴�
+      sgworld.Creator.SimpleGraphic.clear();
+
+      var polygon = turf.polygon([
+        [
+          [east, north],
+          [west, north],
+          [west, south],
+          [east, south],
+          [east, north],
+        ],
+      ]);
+      debugger
+
+    });
+  },
+  //蹇収
   snapshot() {
     let canvas = window.Viewer.scene.canvas;
     let image = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
@@ -217,40 +253,26 @@
   },
   //鍨傜洿楂樺害
   verticalHeight() {
-    earthCtrl.measure.measureHeight(function (e) { });
+
+    sgworld.Analysis.verticalHeight(this.colorAll, () => {
+    });
   },
   //楂樼▼娴嬮噺
   heightMeasure() {
-    var colorAll = {
-      point: Cesium.Color.fromCssColorString("#ff0000"),
-      polyline: Cesium.Color.fromCssColorString("#ffff0050"),
-      polygon: Cesium.Color.fromCssColorString("#ffff0050"),
-    };
-    earthCtrl.Analysis.altitude(colorAll, () => { });
+
+    earthCtrl.Analysis.altitude(this.colorAll, () => { });
   },
   //骞抽潰闈㈢Н
   planeDistance() {
     // earthCtrl.analysis.getPlaneArea(function (e) { });
-    var colorAll = {
-      point: Cesium.Color.fromCssColorString("#ff0000"),
-      polyline: Cesium.Color.fromCssColorString("#ffff0050"),
-      polygon: Cesium.Color.fromCssColorString("#ffff0050"),
-    };
-    sgworld.Analysis.planeArea(colorAll, () => {
+
+    sgworld.Analysis.planeArea(this.colorAll, () => {
     });
 
   },
   //琛ㄩ潰璺濈
   surfaceDistance() {
-    // earthCtrl.analysis.getDistanceHorizontal(function (e) {
-    //   console.info(e);
-    // });
-    var colorAll = {
-      point: Cesium.Color.fromCssColorString("#ff0000"),
-      polyline: Cesium.Color.fromCssColorString("#ffff0050"),
-      polygon: Cesium.Color.fromCssColorString("#ffff0050"),
-    };
-    sgworld.Analysis.horizontalDistance(colorAll, () => {
+    sgworld.Analysis.horizontalDistance(this.colorAll, () => {
     });
   },
   //鐐规极娓�
@@ -283,7 +305,8 @@
   },
   //娓呴櫎鎸夐挳
   clearALL(id) {
-    id.forEach((e) => {
+    debugger
+    id.value.forEach((e) => {
       this.clearTopTools(e);
     });
   },
@@ -295,35 +318,25 @@
           break;
         case "a3":
           break;
-        case "b2":
-          earthCtrl.tools.browse();
-          break;
-        case "b3":
-          earthCtrl.analysis.deleteObject();
-        case "b4":
-          earthCtrl.Analysis.clearMeasure();
-        case "b5":
-          earthCtrl.tools.browse();
+        case "b2"://璺濈娴嬮噺
+        case "b3"://闈㈢Н娴嬮噺
+        case "b4"://楂樼▼娴嬮噺
+        case "b5"://楂樺害娴嬮噺
+          sgworld.Analysis.clearMeasure()
           break;
         case "c2": //鐐�
-          earthCtrl.Creator.SimpleGraphic.clear();
-          break;
         case "c3": //鏂囧瓧
-          earthCtrl.Creator.SimpleGraphic.clear();
-          break;
         case "c4": //绾�
-          earthCtrl.Creator.SimpleGraphic.clear();
-          break;
         case "c5": //鐭╁舰
-          earthCtrl.Creator.SimpleGraphic.clear();
-          break;
         case "c6": //澶氳竟褰�
-          earthCtrl.Creator.SimpleGraphic.clear();
+          sgworld.Creator.SimpleGraphic.clear();
           break;
         case "d5":
-          debugger;
           this.toolMenu.removeFromMap();
           break;
+        case 'f1':
+          sgworld.Creator.SimpleGraphic.clear();
+          break;
       }
       // this.toolFlag = null;
       this.toolMenu = null;

--
Gitblit v1.9.3