管道基础大数据平台系统开发-【前端】-新系統界面
584911253@qq.com
2023-03-13 54c628248c5e0470f040f89f6eec3d5d451826cd
src/views/Synthesis/LeftMenu.vue
@@ -647,7 +647,8 @@
      },
      activeName: "first",
      isShowModel: false,
      options: [{
      options: [
          {
        value: '倾斜模型',
        label: '倾斜模型'
      }, {
@@ -665,7 +666,9 @@
      }, {
        value: '其他模型',
        label: '其他模型'
      }]
      }],
      modelClip:false,
      clippingPlanes:null,
    };
  },
  methods: {
@@ -673,8 +676,8 @@
    setChangeTwoMenu(res) {
      var val = res.id[0];
      if (window.model != null) {
        window.model.deleteObject();
        window.model = null;
        // window.model.deleteObject();
        // window.model = null;
      }
      sgworld.Analysis.clearCurtainContrast();
      if (this.isMenuFlag == "d") {
@@ -1046,6 +1049,7 @@
              },
            });
            this.entityaLayers.push(entity);
            sgworld.Navigate.flyToObj(entity)
            break;
          case "point":
            let point = Viewer.entities.add({
@@ -1066,6 +1070,7 @@
            });
            this.entityaLayers.push(point);
            sgworld.Navigate.flyToObj(point)
            break;
          case "polyline":
            var std = [];
@@ -1086,6 +1091,7 @@
            });
            this.entityaLayers.push(line);
            sgworld.Navigate.flyToObj(line)
            break;
          case "label":
            const label = Viewer.entities.add({
@@ -1104,6 +1110,7 @@
              },
            });
            this.entityaLayers.push(label);
            sgworld.Navigate.flyToObj(label)
            break;
        }
      }
@@ -1139,6 +1146,8 @@
              fileReader.result,
              kmlOptions
            );
            sgworld.Navigate.flyToObj(geocachePromise)
            geocachePromise.then(function (dataSource) {
              var geocacheEntities = dataSource.entities.values;
@@ -1407,15 +1416,17 @@
    setAnalsy(res) {
      //this.$refs && this.$refs.queryinfo && this.$refs.queryinfo.close("queryinfo");
      this.$bus.$emit("closeMenuPop", res);
      var that = this;
      switch (res) {
        case "d1": //等高线分析
          this.closePipelinePop();
          that.isolineFlag = !that.isolineFlag;
          elevationTool.tf = that.isolineFlag;
          elevationTool.render();
          break;
        case "d2": //坡度分析
          this.closePipelinePop();
          that.isslopeFlag = !that.isslopeFlag;
          var val = {
            name: "Lengend",
@@ -1434,6 +1445,7 @@
          break;
        case "d3": //路径分析
          this.closePipelinePop();
          this.isRouter = !this.isRouter;
          let value;
          if (this.isRouter) {
@@ -1452,6 +1464,7 @@
          this.$bus.$emit("mapChangeBox", value);
          break;
        case "d4": //剖面分析
          this.closePipelinePop();
          if (window.AnalysisDXPM) {
            window.AnalysisDXPM.end && window.AnalysisDXPM.end("cancel");
            this.clear(res);
@@ -1460,6 +1473,7 @@
          }
          break;
        case "d5": //洪水淹没分析
          this.closePipelinePop();
          if (window.AnalysisFlood) {
            this.clear(res);
          } else {
@@ -1467,6 +1481,7 @@
          }
          break;
        case "d6": //土方量分析
          this.closePipelinePop();
          if (window.TFvolumetricMeasurementTool) {
            TFvolumetricMeasurementTool.cleanUp();
            if (TFvolumetricMeasurementTool._mouseHandler) {
@@ -1499,23 +1514,52 @@
          }
          break;
        case "d7": //三维截面分析
          this.closePipelinePop();
          // if(window.MXModel) {
          //   Viewer.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
          //   window.MXModel=null;
          // } else {
          var that = this;
          window.model = sgworld.Creator.create3DTilesets(
            "",
            modelUrl + "/tileset/m/SN/tileset.json",
            {},
            {},
            "0",
            true,
            (data) => {
              sgworld.Navigate.flyToObj(data);
              that.setclippingModel();
          that.modelClip = !that.modelClip;
          if (that.modelClip){
            if (window.model){
              that.modelClipping();
            }
          );
            else {
              var tileset = Viewer.scene.primitives.add(
                  new Cesium.Cesium3DTileset({
                    name: res.cnName,
                    url: modelUrl+ "/tileset/m/SN/tileset.json",
                    maximumScreenSpaceError: 64, // 最大屏幕空间错误:16
                    maximumMemoryUsage: 768, // 最大内存:512
                    dynamicScreenSpaceError: true, // 减少离相机较远的屏幕空间错误:false
                    skipLevelOfDetail: true, // 在遍历时候跳过详情:false
                  })
              );
              tileset.readyPromise.then((tileset) => {
                tileset.id = res.cnName;
                tileset.layerId = res.id;
                Viewer.flyTo(tileset);
                that.modelClipping();
              });
              window.model = tileset
            }
          }
          else {
            Viewer.entities.removeAll();
          }
          // window.model = sgworld.Creator.create3DTilesets(
          //   "",
          //   modelUrl + "/tileset/m/SN/tileset.json",
          //   {},
          //   {},
          //   "0",
          //   true,
          //   (data) => {
          //     sgworld.Navigate.flyToObj(data);
          //     that.setclippingModel();
          //   }
          // );
          break;
        case "d9": //管道分析
@@ -1543,6 +1587,7 @@
          break;
        case "d8": //影像对比
          this.closePipelinePop();
          if (this.isContrastFlag == false) {
            this.isContrastFlag = true;
            sgworld.Analysis.createCurtainContrast(2, 1);
@@ -1552,6 +1597,7 @@
          }
          break;
        case "d10": //地面整平
          this.closePipelinePop();
          var val = {
            name: "Trrain",
            id: res,
@@ -1589,6 +1635,7 @@
          break;
        case "d11": //地形开挖
          this.closePipelinePop();
          // this.$refs &&
          //   this.$refs.terrainDig &&
          //   this.$refs.terrainDig.open("管道空间分析", null, {
@@ -1613,6 +1660,7 @@
          break;
        case "d12": //通视分析
          this.closePipelinePop();
          if (window.TSExcavation != null) {
            window.TSExcavation._SimpleGraphic.drawHandler &&
              window.TSExcavation._SimpleGraphic.drawHandler.destroy();
@@ -1629,6 +1677,7 @@
          }
          break;
        case "d13": //视域分析
          this.closePipelinePop();
          if (window.SYExcavatio) {
            window.SYExcavatio.end && window.SYExcavatio.end();
            window.SYExcavatio.close();
@@ -1648,6 +1697,7 @@
          }
          break;
        case "d14": //圆形时域分析
          this.closePipelinePop();
          if (window.YXSYExcavation) {
            window.YXSYExcavation.end && window.YXSYExcavation.end();
            window.YXSYExcavation.close();
@@ -1668,6 +1718,104 @@
          break;
      }
    },
    //模型裁切
    modelClipping() {
      const scene = Viewer.scene;
      let targetY = 0.0;
      let planeEntities = [];
      let selectedPlane;
      let clippingPlanes = new Cesium.ClippingPlaneCollection({
        planes: [ // ClippingPlane对象数组集合
          new Cesium.ClippingPlane( // 裁切面
              new Cesium.Cartesian3(0.0, 0.0, -1.0), // 法线方向
              0// 原点到平面的最短距离,设置0就好
          ),
        ],
        enabled:true,
        edgeWidth: 1.0, // 模型被裁切部分的截面线宽
      });
      let boundingSphere = window.model.boundingSphere;
      // 创建添加裁剪平面
      for (let i = 0; i < clippingPlanes.length; ++i) {
        const plane = clippingPlanes.get(i);
        const planeEntity = Viewer.entities.add({
          position: boundingSphere.center,
          plane: {
            dimensions: new Cesium.Cartesian2(
                boundingSphere.radius * 1.5,
                boundingSphere.radius * 1.5
            ),
            material: Cesium.Color.WHITE.withAlpha(0.1),
            plane: new Cesium.CallbackProperty(
                // 添加绑定事件,不断调用
                createPlaneUpdateFunction(plane),
                false
            ),
            outline: true,
            outlineColor: Cesium.Color.WHITE,
          },
        });
        planeEntities.push(planeEntity);
      }
      this.clippingPlanes = clippingPlanes;
      window.model.clippingPlanes = clippingPlanes;
      // Select plane when mouse down
      // 绑定上移动事件
      const downHandler = new Cesium.ScreenSpaceEventHandler(
          Viewer.scene.canvas
      );
      downHandler.setInputAction(function (movement) {
        const pickedObject = scene.pick(movement.position);
        if (
            Cesium.defined(pickedObject) &&
            Cesium.defined(pickedObject.id.plane)
        ) {
          selectedPlane = pickedObject.id.plane;
          selectedPlane.material = Cesium.Color.WHITE.withAlpha(0.05);
          selectedPlane.outlineColor = Cesium.Color.WHITE;
          scene.screenSpaceCameraController.enableInputs = false;
        }
      }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
      // Release plane on mouse up
      // 绑定下移动事件
      const upHandler = new Cesium.ScreenSpaceEventHandler(
          Viewer.scene.canvas
      );
      upHandler.setInputAction(function () {
        if (Cesium.defined(selectedPlane)) {
          selectedPlane.material = Cesium.Color.WHITE.withAlpha(0.1);
          selectedPlane.outlineColor = Cesium.Color.WHITE;
          selectedPlane = undefined;
        }
        scene.screenSpaceCameraController.enableInputs = true;
      }, Cesium.ScreenSpaceEventType.LEFT_UP);
      // Update plane on mouse move
      const moveHandler = new Cesium.ScreenSpaceEventHandler(
          Viewer.scene.canvas
      );
      moveHandler.setInputAction(function (movement) {
        if (Cesium.defined(selectedPlane)) {
          const deltaY = movement.startPosition.y - movement.endPosition.y;
          targetY += deltaY;
        }
      }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
      function createPlaneUpdateFunction(plane) {
        return function () {
          plane.distance = targetY;
          return plane;
        };
      }
    },
    //关闭管道信息弹窗
    closePipelinePop(){
      this.$refs &&
      this.$refs.queryinfo &&
      this.$refs.queryinfo.close("queryinfo");
    },
    setclippingModel() {
      if (window.model) {
@@ -2159,7 +2307,7 @@
        }
      });
    },
    //附件列表查询
    //附件列表查询
    async getAttacthFlieList() {
      var obj = {
        eventid: this.$store.state.catModelInfo.id,