管道基础大数据平台系统开发-【前端】-新系統界面
q
Surpriseplus
2022-12-23 8d301b885c7c433300b5bbeb47a0864eb738fad4
src/views/Synthesis/LeftMenu.vue
@@ -10,6 +10,7 @@
      <div>{{ $t(item.label) }}</div>
    </div>
    <mapinfo ref="mapinfo" />
    <maplayer ref="maplayer" />
    <input type="file" accept=".kml" class="file" style="display: none" />
  </div>
</template>
@@ -17,8 +18,10 @@
<script>
import { transform } from 'ol/proj';
import mapinfo from '../Tools/mapinfo.vue';
import maplayer from '../Tools/maplayer.vue';
export default {
  components: { mapinfo },
  components: { mapinfo, maplayer },
  data() {
    return {
      showTwoMenuFlag: false,
@@ -31,18 +34,7 @@
            name: '图层管理',
            css: 'twoMenu_imge11',
          },
          {
            id: 'a2',
            name: '场景提取',
            label: 'synthesis.sceneExtraction',
            css: 'twoMenu_imge12',
          },
          {
            id: 'a3',
            label: 'synthesis.release',
            name: '场景发布',
            css: 'twoMenu_imge13',
          },
        ],
        [
          {
@@ -119,12 +111,7 @@
            name: '地图快照',
            css: 'twoMenu_imge34',
          },
          {
            id: 'c5',
            label: 'synthesis.tdisplay',
            name: '三维演示',
            css: 'twoMenu_imge35',
          },
        ],
        [
          {
@@ -303,12 +290,31 @@
            name: '清除',
            css: 'twoMenu_imge87',
          },
        ],
        ],[
            {
            id: 'i1',
            name: '场景提取',
            label: 'synthesis.sceneExtraction',
            css: 'twoMenu_imge12',
          },
          {
            id: 'i2',
            label: 'synthesis.release',
            name: '场景发布',
            css: 'twoMenu_imge13',
          }, {
            id: 'i3',
            label: 'synthesis.tdisplay',
            name: '三维演示',
            css: 'twoMenu_imge35',
          },
        ]
      ],
      isRuler: false,
      isNaviget: false,
      isolineFlag: false,
      isslopeFlag: false,
      isContrastFlag: false,
    };
  },
  methods: {
@@ -320,6 +326,10 @@
      this.$store.state.mapPopBoolean = false;
      this.$store.state.mapPopBoxFlag = null;
      var val = res.id[0];
      if (window.model != null) {
        window.model.deleteObject();
        window.model = null;
      }
      switch (val) {
        case 'a': //图层管理
          this.setCoverage(res.id);
@@ -386,6 +396,7 @@
          break;
        case 'h7':
          sgworld.Creator.SimpleGraphic.clear();
          break;
      }
    },
@@ -428,27 +439,44 @@
      }
    },
    handleOpenClick() {
      // let that = this;
      sgworld.Creator.SimpleGraphic.edit(true, { editProp: true });
      let fileInput = document.querySelector('.file');
      fileInput.onchange = function (evt) {
        let files = evt.target.files;
        if (files.length > 0) {
          let file = evt.target.files[0];
          let fileReader = new FileReader();
          fileReader.readAsDataURL(file);
          fileReader.onload = () => {
            sgworld.Viewer.dataSources
              .add(
                Cesium.KmlDataSource.load(fileReader.result, {
                  camera: sgworld.Viewer.scene.camera,
                  canvas: sgworld.Viewer.scene.canvas,
                })
              )
              .then((KmlDataSource) => {
                console.log(KmlDataSource);
                // let entities = kmlDataSource.entities;
              });
            var kmlOptions = {
              camera: sgworld.Viewer.scene.camera,
              canvas: sgworld.Viewer.scene.canvas,
              clampToGround: true,
            };
            var geocachePromise = Cesium.KmlDataSource.load(
              fileReader.result,
              kmlOptions
            );
            geocachePromise.then(function (dataSource) {
              var geocacheEntities = dataSource.entities.values;
              for (var i = 0; i < geocacheEntities.length; i++) {
                var entity = geocacheEntities[i];
                sgworld.Viewer.entities.add(entity);
              }
            });
            // sgworld.Viewer.dataSources
            //   .add(
            //     Cesium.KmlDataSource.load(fileReader.result, {
            //       camera: sgworld.Viewer.scene.camera,
            //       canvas: sgworld.Viewer.scene.canvas,
            //     })
            //   )
            //   .then((KmlDataSource) => {
            //     console.log(KmlDataSource);
            //     // let entities = kmlDataSource.entities;
            //   });
          };
        }
        // fileInput.value = null;
@@ -693,6 +721,30 @@
            }
          );
          break;
        case 'd7':
          var that = this;
          window.model = sgworld.Creator.create3DTilesets(
            '',
            modelUrl,
            {},
            {},
            '0',
            true,
            (data) => {
              sgworld.Navigate.flyToObj(data);
              that.setclippingModel();
            }
          );
          break;
        case 'd8':
          if (this.isContrastFlag == false) {
            this.isContrastFlag = true;
            sgworld.Analysis.createCurtainContrast(2, 1);
          } else {
            this.isContrastFlag = false;
            sgworld.Analysis.clearCurtainContrast();
          }
          break;
        case 'd10':
          if (window.TerrainFlattening) {
            window.TerrainFlattening.remove();
@@ -729,6 +781,18 @@
            );
          }
          break;
      }
    },
    setclippingModel() {
      if (window.model) {
        setTimeout(() => {
          window.model.clippingModel({
            direction: 'z',
          });
        }, 1000);
        // window.model.clippingModel({
        //   direction: 'z',
        // });
      }
    },
    clear(res) {
@@ -891,6 +955,13 @@
          break;
      }
    },
    setCoverage(res) {
      switch (res) {
        case 'a1':
          this.$refs && this.$refs.maplayer && this.$refs.maplayer.open();
          break;
      }
    },
    menuChange(res) {
      this.setListTwoMenu = this.setListTwoMenuAll[res];
    },
@@ -905,6 +976,11 @@
    this.$bus.$on('setChangeTwoMenu', (res) => {
      this.menuChange(res);
    });
    this.$bus.$on('showLeftMenu', (res) => {
      this.$store.state.showAllLayers = true;
      this.setCoverage('a1');
      // this.$bus.$emit('setAllLayers', true);
    });
  },
};
</script>