管道基础大数据平台系统开发-【前端】-新系統界面
wulitaotao
2023-02-27 2c9fe4606e997b09eabb87afeb981d6ee924d420
src/components/Screen/mapsdk.vue
@@ -1,34 +1,69 @@
<template>
  <div  class="ParentCentermapdiv">
  <div class="ParentCentermapdiv">
    <div id="Centermapdiv"></div>
  </div>
</template>
<script>
let yunxuanLayer = null
export default {
  name: "",
  components: {},
  data() {
    return{}
    return {}
  },
  mounted() {
    this.init3DMap()
    // this.$bus.$on("changeProject", name => {
    //   if (!yunxuanLayer) {
    //     var urls = "https://tiles3.geovisearth.com/base/v1/ter"
    //     // 星图地球地形晕渲
    //     yunxuanLayer = sgworld.Creator.createUrlTemplateImageryProvider(
    //       "星图地球地形晕渲",
    //       {
    //         url:
    //           urls +
    //           "/{z}/{x}/{y}?format=webp&token=486dac3bec56d7d7c2a581c150be2bd937462f1e8f3bc9c78b5658b396122405",
    //       },
    //       "0",
    //       undefined,
    //       true,
    //       ""
    //     )
    //   }
    //   if (name == '全球项目') {
    //     yunxuanLayer.item.show = true
    //   } else {
    //     yunxuanLayer.item.show = false
    //   }
    // })
  },
  methods: {
    init3DMap() {
      //地图初始化
      window.sgworld = new SmartEarth.SGWorld("Centermapdiv", {
        licenseServer: window.sceneConfig.licenseServer,
      })
      window.Viewer = window.sgworld._Viewer
      // window.sgworld = new SmartEarth.SGWorld("Centermapdiv", {
      //   licenseServer: window.sceneConfig.licenseServer,
      // })
      window.sgworld = new SmartEarth.SGWorld(
        "Centermapdiv",
        SmartEarthRootUrl + "Workers/image/earth.jpg",
        function () {}
      )
      window.viewer = window.Viewer = window.sgworld._Viewer;
      Viewer.imageryLayers._layers[0].show = false
      //定位
      Viewer.camera.flyTo({
        destination: Cesium.Cartesian3.fromDegrees(110, 33, 25000000),
       sgworld.Navigate.jumpTo({      //跳转视角
            destination: new Cesium.Cartesian3.fromDegrees(110, 32, 50000000)
      });
      setTimeout(() => {
        window.viewer.camera.flyTo({
          destination:new Cesium.Cartesian3.fromDegrees(110, 32, 20000000),
          orientation:{
            heading:Cesium.Math.toRadians(0),
            pitch: Cesium.Math.toRadians(-90),
          }
        })
      }, 1000);
      Viewer.imageryLayers.addImageryProvider(
        new Cesium.UrlTemplateImageryProvider({
          url: gaoDeBaseUrl[0].url,
@@ -46,8 +81,6 @@
        })
      )
      Viewer._enableInfoOrSelection = false
      //显示fps
      Viewer.scene.debugShowFramesPerSecond = false
@@ -58,7 +91,6 @@
      //开启深度检测
      sgworld.Analysis.depthTestAgainstTerrain(true)
      Viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
        url: demLayer,
      })
@@ -66,23 +98,20 @@
      //改变天空颜色为黑色
      Viewer.scene.skyBox.show = false //关闭天空盒,否则会显示天空颜色
      //背景透明
      Viewer.scene.backgroundColor = new Cesium.Color(0.0, 0.0, 0.0, 0.0);
      Viewer.scene.backgroundColor = new Cesium.Color(0.0, 0.0, 0.0, 0.0)
    },
  }
  },
}
</script>
<style scoped lang="scss">
.ParentCentermapdiv{
<style scoped lang="less">
.ParentCentermapdiv {
  display: fixed;
  height: 100%;
    width: 100%;
  width: 100%;
}
  #Centermapdiv{
    height: 100%;
    width: 100%;
  }
#Centermapdiv {
  height: 100%;
  width: 100%;
}
</style>