From c3c23814c1802121af66feecdf4238f1d60c4651 Mon Sep 17 00:00:00 2001
From: 584911253@qq.com <584911253@qq.com>
Date: 星期二, 28 三月 2023 09:58:45 +0800
Subject: [PATCH] 模型剖切修改

---
 src/views/Tools/LayerTree.vue    |   26 +++++++++++++++++++++++---
 src/views/Synthesis/LeftMenu.vue |    7 ++++++-
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/src/views/Synthesis/LeftMenu.vue b/src/views/Synthesis/LeftMenu.vue
index 3949311..ce5f276 100644
--- a/src/views/Synthesis/LeftMenu.vue
+++ b/src/views/Synthesis/LeftMenu.vue
@@ -1835,7 +1835,12 @@
       //   }
       // }
       window.model.clippingPlanes = clippingPlanes;
-
+      if (window.modelHeight && window.modelHeight != 0){
+        // console.log("window.modelHeight---",window.modelHeight)
+        window.model.clippingPlanes.modelMatrix = Cesium.Matrix4.fromTranslation(
+            new Cesium.Cartesian3(0.0, 0.0, window.modelHeight)
+        );
+      }
       // 缁戝畾涓婄Щ鍔ㄤ簨浠�
       const downHandler = new Cesium.ScreenSpaceEventHandler(
         Viewer.scene.canvas
diff --git a/src/views/Tools/LayerTree.vue b/src/views/Tools/LayerTree.vue
index fb41cf6..4909a56 100644
--- a/src/views/Tools/LayerTree.vue
+++ b/src/views/Tools/LayerTree.vue
@@ -704,7 +704,7 @@
 
       // if (checked.checkedKeys) {
       //   for (var i in result) {
-      //     
+      //
       //   }
       // } else {
 
@@ -875,9 +875,29 @@
           tileset.id = res.cnName;
           tileset.layerId = res.id;
           tileset.pubid = res.pubid;
+          // Cesium.Matrix4.equals(a,b)鍒ゆ柇涓や釜鍥涚淮鐭╅樀鏄惁鐩哥瓑
+          // 鏁翠釜鏍硅妭鐐规ā鍨嬬煩闃碉紝璇ileSet=>涓栫晫鍧愭爣绯�
+          // 鍗曚綅鐭╅樀锛屽瑙掔嚎鍊间负1.0鐨�4*4鐭╅樀
+          if (!Cesium.Matrix4.equals(tileset.root.transform,Cesium.Matrix4.IDENTITY)) {
+            // 鑾峰彇妯″瀷鐨勪笘鐣屽潗鏍�(绗涘崱灏�)
+            // Cesium.Matrix4.getTranslation 閫氳繃浠垮皠鍙樻崲鐭╅樀鑾峰彇璇ileSet鐨勪笘鐣屽潗鏍�
+            const transformCenter = Cesium.Matrix4.getTranslation(
+                tileset.root.transform,
+                new Cesium.Cartesian3()
+            );
+            // 灏嗙瑳鍗″皵鍧愭爣杞崲涓篧GS84缁忕含搴﹀潗鏍囷紙妯″瀷鐨勶級
+            const transformCartographic = Cesium.Cartographic.fromCartesian(
+                transformCenter
+            );
+            // 灏嗙瑳鍗″皵鍧愭爣杞崲涓篧GS84缁忕含搴﹀潗鏍囷紙鎴潰鐨勶級
+            const boundingSphereCartographic = Cesium.Cartographic.fromCartesian(
+                tileset.boundingSphere.center
+            );
+            const height = boundingSphereCartographic.height - transformCartographic.height;
+            // 浠庝竴涓狢artesian3瀵硅薄鐢熸垚Matrix4鍙樻崲鐭╅樀锛堣鍒囬潰鐨勶級
+            window.modelHeight = height;
+          }else window.modelHeight = 0;
           this.getTilesetArgs(tileset, res);
-
-
         });
         this.$store.state.setAlphaList.push({
           name: res.cnName,

--
Gitblit v1.9.3