北京经济技术开发区经开区虚拟城市项目-【前端】--政府服务中心-1号屏Web
lixuliang
2023-10-10 cacb83dcc7db37cb7888850d40d0dfcb03bf3324
src/components/map/viewer.vue
@@ -1,13 +1,9 @@
<template>
  <div>
    <div id="sdkContainer"></div>
    <!-- <div
      id="msg"
      style="min-width: 200px;min-height: 100px; z-index: 30;position: absolute; top:5%;left: 40%;background: skyblue;"
    >
      <label>{{ messagelayer }}</label>
    </div>-->
    <!-- <div style="z-index: 30;position: absolute; top:1%;left: 1%;">
      <el-button @click="setLocation(3)">漫游</el-button>
    </div> -->
  </div>
</template>
@@ -19,9 +15,6 @@
import { mapState, mapMutations } from "vuex";
import "animate.css";
import rpc from "../../assets/js/rpc";
import mapData from "../../../static/mapData";
import mapMsg from "../../assets/js/mapMsg";
import vueEvents from '@/utils/vueEvent.js'
let PoiLayerConstructor = Vue.extend(poiLayer);
let handler;
@@ -48,21 +41,20 @@
      locationPoint: null,
      locationInstance: null,
      locationData: null,
      messagelayer: null
    };
  },
  computed: {
    ...mapState(["cesiumInit"]),
  },
  mounted() {
    vueEvents.$on('messagelayer', (res) => { this.messagelayer = JSON.stringify(res) })
    this.$nextTick(function () {
      let that = this;
      let option = {
        fullscreenButton: true,
        licenseServer: "http://183.162.245.49:18080",
        minViewHeight: parseFloat(common.minviewheight),
        // url: SmartEarthRootUrl + "Workers/image/earth.jpg",  //不含单张地图图片url则使用在线地图
        url: SmartEarthRootUrl + "Workers/image/earth.jpg",  //不含单张地图图片url则使用在线地图
        contextOptions: {
          failIfMajorPerformanceCaveat: false,
          webgl: {
@@ -113,14 +105,17 @@
          //     duration: 8, //飞行时间8s
          //   });
          // }, 10000);
          var data = mapData.mapRest
          setTimeout(() => {
            sgworld.Navigate.flyToPointsInterest({
              destination: { 'x': data.lng, 'y': data.lat, 'z': data.alt },
              destination: {
                "x": -2187108.231948378,
                "y": 4392040.442348233,
                "z": 4063265.829085007
              },
              orientation: {
                heading: data.heading,
                pitch: data.pitch,
                roll: data.roll,
                heading: 2.4384163743219607,
                pitch: -0.32733173444759833,
                roll: 6.283095595698651,
              },
              duration: 10, //飞行时间8s
            });
@@ -141,7 +136,7 @@
      //地下模式距离参数
      Viewer.scene.globe.translucency.frontFaceAlpha = 0.5;
      Viewer.scene.globe.undergroundColor = undefined;
      mapMsg.init();
      rpc.initMessage();
      rpc.clickToCoordinates();
      //标会编辑