Quellcode durchsuchen

修改雨水管道剖切

maxiaoxiao vor 11 Monaten
Ursprung
Commit
1ba30a5095

+ 32 - 25
src/components/3DAnalysis/ClippingPlanes/index.vue

@@ -76,16 +76,16 @@ import { moveHandler, pickPoint } from "@/utils/MapHelper/help.js";
 let pos = {};
 let box = null;
 let startClip = false;
-let boxPosition = {};
-let layers = null;
+let boxPosition = null;
+let layers = [];
 export default {
   name: "ClippingPlanes",
   props: {},
   data() {
     return {
       form: {
-        width: 100,
-        height: 100,
+        width: 5,
+        height: 5,
         heading: 0,
         pitch: 0,
         roll: 0,
@@ -99,9 +99,12 @@ export default {
 
   beforeDestroy() {},
   mounted() {
-    layers = store.state.tempLatData[0][0];
-    viewer.flyTo(layers);
-    this.addEntity();
+    if (store.state.tempLatData) {
+      layers = store.state.tempLatData[0];
+      console.log(layers, "llll");
+      viewer.flyTo(layers[0]);
+      this.addEntity();
+    }
   },
 
   methods: {
@@ -127,7 +130,7 @@ export default {
       this.analysis();
     },
     changehpr(pos) {
-      if (!box) return;
+      if (!box || !boxPosition) return;
       var hpr = new Cesium.HeadingPitchRoll(
         Cesium.Math.toRadians(this.form.heading),
         Cesium.Math.toRadians(this.form.pitch),
@@ -174,7 +177,7 @@ export default {
         position: Cesium.Cartesian3.fromDegrees(0, 0, 0),
         show: false,
         box: {
-          dimensions: new Cesium.Cartesian3(5, 5, 0.1),
+          dimensions: new Cesium.Cartesian3(5, 5, 0.001),
           fill: false,
           outline: true,
           outlineColor: Cesium.Color.RED,
@@ -185,35 +188,39 @@ export default {
       this.changehpr();
     },
     setBox() {
-      if (!box) return;
+      if (!box || !boxPosition) return;
       box.box.dimensions = new Cesium.Cartesian3(
         this.form.width,
         this.form.height,
-        0.1
+        0.001
       );
       box.position = boxPosition;
     },
 
     updateClip() {
-      console.log(layers, "llll");
       // layers.setCustomClipPlane(pos[0], pos[1], pos[2]);
-      layers.setCustomClipCross({
-        position: pos,
-        dimensions: new Cesium.Cartesian3(
-          this.form.width,
-          this.form.height,
-          this.form.extrudeDistance
-        ),
-        heading: this.form.heading,
-        pitch: this.form.pitch,
-        roll: this.form.roll,
-        extrudeDistance: this.form.extrudeDistance,
+      layers.forEach((li) => {
+        li.setCustomClipCross({
+          position: pos,
+          dimensions: new Cesium.Cartesian3(
+            this.form.width,
+            this.form.height,
+            this.form.extrudeDistance
+          ),
+          heading: this.form.heading,
+          pitch: this.form.pitch,
+          roll: this.form.roll,
+          extrudeDistance: this.form.extrudeDistance,
+        });
       });
     },
     clear() {
       if (box) box.show = false;
-      // layers.clearCustomClipBox();
-      layers.clearCustomClipBox();
+
+      layers.forEach((li) => {
+        li.clearCustomClipBox();
+      });
+
       // viewer.entities.removeAll();
     },
   },

+ 9 - 4
src/components/Combinations/LayerManage/LayerManage.vue

@@ -337,14 +337,19 @@ export default {
       if (obj.checked) {
         obj.trans = 100;
         obj.visible = true;
-        this.addlayerdata.unshift(obj);//将最新添加的对象放到第一位
+        this.addlayerdata.unshift(obj); //将最新添加的对象放到第一位
         if (obj.title == "测试WMS") {
-          this.layerparams[obj.id] = this.addWMS(obj);
-          store.setlayerparamsList(this.layerparams);
         } else if (obj.title == "测试WMTS") {
-          this.addWMTS(obj);
         } else {
           switch (obj.type) {
+            case "wms":
+              this.layerparams[obj.id] = this.addWMS(obj);
+              store.setlayerparamsList(this.layerparams);
+              break;
+            case "wmts":
+              this.layerparams[obj.id] = this.addWMTS(obj);
+              store.setlayerparamsList(this.layerparams);
+              break;
             case "S3M": //场景
               let s = viewer.scene.open(obj.url, undefined, {
                 autoSetView: false, // obj.title != "倾斜摄影",