liuyg
2022-03-28 0f6f73971c9c3db3d591018a8e6c2272ea07088a
src/components/mobilemap/index.vue
@@ -115,8 +115,8 @@
      ],
      // areaLayer: null,
      // mapCenter: [115.871863, 28.743861, 160.0],
      // mapCenter: [114.04062292 - 0.00035, 27.62666834 + 0.0025, 160.0],
      mapCenter: [116.35381525 - 0.00035, 27.95839468 + 0.0025, 160.0],
      mapCenter: [114.04062292 - 0.00035, 27.62666834 + 0.0025, 160.0],
      //   mapCenter: [116.35381525 - 0.00035, 27.95839468 + 0.0025, 160.0],
      // 控制4层缩放
      // onelayerNum: 80,
      // towlayerNum: 120,
@@ -134,7 +134,8 @@
      intervallayerNum: 15,
      frislayertHeight: 160, // 默认高度
      useSuofang: true, //是否缩放
      useSuofang: false, //是否缩放 true 去掉了缩放,
      addOthers: true, //加入了活动底图以及抚州底图
    };
  },
  computed: {
@@ -170,7 +171,19 @@
    var that = this;
    // let viewer;
    if (this.addOthers) {
      //抚州视角数据
      this.mapCenter = [116.35381525 - 0.00035, 27.95839468 + 0.0025, 160.0];
      this.onelayerNum = 100;
      this.towlayerNum = 300;
      this.threelayerNum = 500;
      this.forlayerNum = 700;
      this.fivelayerNum = null;
      this.sixlayerNum = null;
      this.intervallayerNum = 100;
      this.frislayertHeight = 700; // 默认高度
    }
    window.initViewer = () => {
      global.viewer = new global.DC.Viewer("mobile-viewer-container", {
        contextOptions: {
@@ -295,7 +308,11 @@
        //   conBack(200);
        // }
        // const usMun = that.forlayerNum ? that.forlayerNum : that.threelayerNum;
        const usMun = that.sixlayerNum;
        const usMun = that.sixlayerNum
          ? that.sixlayerNum
          : that.fivelayerNum
          ? that.fivelayerNum
          : that.forlayerNum;
        if (window.height1s > usMun && isSet) {
          if (that.useSuofang) {
            return;
@@ -325,12 +342,15 @@
      };
      window.butbut = function () {
        // return;
        if (that.useSuofang) {
          return;
        }
        // if (that.useSuofang) {
        //   return;
        // }
        // 放大
        document.querySelector(".dc-zoom-controller").children[0].onclick =
          function () {
            if (that.useSuofang) {
              return;
            }
            if (that.dimension == "2.5D") {
              window.height2s = Math.ceil(
                global.viewer.camera.positionCartographic.height
@@ -393,6 +413,9 @@
        // 缩小
        document.querySelector(".dc-zoom-controller").children[2].onclick =
          function () {
            if (that.useSuofang) {
              return;
            }
            if (that.dimension == "2.5D") {
              window.height3s = Math.ceil(
                global.viewer.camera.positionCartographic.height
@@ -479,6 +502,18 @@
        };
        var isCameraTime = null;
        global.viewer.on(global.DC.SceneEventType.CAMERA_CHANGED, (e) => {
          // window.height4s = Math.ceil(
          //   global.viewer.camera.positionCartographic.height
          // );
          // if (ii == 1 && startHeight == 0) {
          //   startHeight = window.height4s;
          // }
          // ii++;
          // cutHeight = window.height4s - startHeight;
          // that.heights = window.height4s;
          // that.heights1 = cutHeight;
          // console.log(cutHeight);
          if (that.useSuofang) {
            return;
          }
@@ -492,9 +527,9 @@
            }
            ii++;
            cutHeight = window.height4s - startHeight;
            that.heights = window.height4s;
            that.heights1 = cutHeight;
            // console.log(cutHeight);
            // that.heights = window.height4s;
            // that.heights1 = cutHeight;
            // return;
            if (isCameraTime) {
              clearTimeout(isCameraTime);
@@ -1059,8 +1094,13 @@
        that.$store.commit("set_zoomRange", [
          that.onelayerNum,
          // that.forlayerNum ? that.forlayerNum : that.threelayerNum,
          that.sixlayerNum,
          that.sixlayerNum
            ? that.sixlayerNum
            : that.fivelayerNum
            ? that.fivelayerNum
            : that.forlayerNum,
          that.useSuofang,
          that.addOthers,
        ]); // 送入移动端缩放范围
        that.$store.commit("MSET_DIMENSION", "2.5D"); // 切换2.5D设置
      } else if (that.dimension == "3D") {