管道基础大数据平台系统开发-【前端】-新系統界面
584911253@qq.com
2023-03-13 54c628248c5e0470f040f89f6eec3d5d451826cd
模型裁剪清除
已修改1个文件
52 ■■■■■ 文件已修改
src/views/Synthesis/LeftMenu.vue 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Synthesis/LeftMenu.vue
@@ -667,7 +667,8 @@
        value: '其他模型',
        label: '其他模型'
      }],
      targetY: 0.0,
      modelClip:false,
      clippingPlanes:null,
    };
  },
  methods: {
@@ -1519,26 +1520,33 @@
          //   window.MXModel=null;
          // } else {
          var that = this;
          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.modelClip = !that.modelClip;
          if (that.modelClip){
            if (window.model){
              that.modelClipping();
            });
            window.model = tileset
            }
            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(
          //   "",
@@ -1722,9 +1730,10 @@
        planes: [ // ClippingPlane对象数组集合
          new Cesium.ClippingPlane( // 裁切面
              new Cesium.Cartesian3(0.0, 0.0, -1.0), // 法线方向
              0.0 // 原点到平面的最短距离,设置0就好
              0// 原点到平面的最短距离,设置0就好
          ),
        ],
        enabled:true,
        edgeWidth: 1.0, // 模型被裁切部分的截面线宽
      });
      let boundingSphere = window.model.boundingSphere;
@@ -1750,6 +1759,7 @@
        });
        planeEntities.push(planeEntity);
      }
      this.clippingPlanes = clippingPlanes;
      window.model.clippingPlanes = clippingPlanes;
      // Select plane when mouse down