liuyg
2022-03-25 badf4557ff897aed6e33e88fc01bdfb38e9b4fce
src/components/mobilemap/index.vue
@@ -39,7 +39,7 @@
import { getBuildClock } from "@/api/mobile/buildsClock/buildsClock"; // 楼栋详情
import { mapGetters } from "vuex";
//baselayer
// baselayer
window.baselayer = null;
window.conBack = null;
window.butbut = null;
@@ -58,7 +58,7 @@
window.polygon = null;
window.doit2 = null;
window.wallLayer = null;
window.initViewer = null; //主方法
window.initViewer = null; // 主方法
window.takes = null;
window.height1s = null;
@@ -115,7 +115,8 @@
      ],
      // areaLayer: null,
      // mapCenter: [115.871863, 28.743861, 160.0],
      mapCenter: [114.04062292 - 0.00035, 27.62666834 + 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,
@@ -123,12 +124,16 @@
      // forlayerNum: null,
      // intervallayerNum: 20,
      // frislayertHeight: 120, // 默认高度
      onelayerNum: 110,
      towlayerNum: 140,
      threelayerNum: 170,
      forlayerNum: 200,
      onelayerNum: 40,
      towlayerNum: 80,
      threelayerNum: 120,
      forlayerNum: 160,
      fivelayerNum: 200,
      sixlayerNum: 240,
      intervallayerNum: 15,
      frislayertHeight: 200, //默认高度
      frislayertHeight: 160, // 默认高度
    };
  },
  computed: {
@@ -235,6 +240,7 @@
        // let height = Math.ceil(global.viewer.camera.positionCartographic.height);
        // console.log(height);
      });
      // global.viewer.on(global.DC.SceneEventType.CAMERA_MOVE_END, (e) => {
      global.viewer.on(global.DC.SceneEventType.CAMERA_CHANGED, (e) => {
        // 相机移动最后参数
@@ -287,7 +293,8 @@
        // if (height > 200 && isSet) {
        //   conBack(200);
        // }
        const usMun = that.forlayerNum ? that.forlayerNum : that.threelayerNum;
        // const usMun = that.forlayerNum ? that.forlayerNum : that.threelayerNum;
        const usMun = that.sixlayerNum;
        if (window.height1s > usMun && isSet) {
          window.conBack(usMun);
        }
@@ -334,6 +341,24 @@
              // if (height > 100) {
              //   butSetViews(80);
              // }
              if (that.sixlayerNum) {
                if (
                  window.height2s >
                  that.sixlayerNum - that.intervallayerNum
                ) {
                  window.butSetViews(that.fivelayerNum);
                  return;
                }
              }
              if (that.fivelayerNum) {
                if (
                  window.height2s >
                  that.fivelayerNum - that.intervallayerNum
                ) {
                  window.butSetViews(that.forlayerNum);
                  return;
                }
              }
              if (that.forlayerNum) {
                if (
                  window.height2s >
@@ -399,6 +424,22 @@
                  window.butSetViews(that.forlayerNum);
                }
              }
              if (that.fivelayerNum) {
                if (
                  window.height3s > that.forlayerNum - that.intervallayerNum &&
                  window.height3s < that.fivelayerNum - that.intervallayerNum
                ) {
                  window.butSetViews(that.fivelayerNum);
                }
              }
              if (that.sixlayerNum) {
                if (
                  window.height3s > that.fivelayerNum - that.intervallayerNum &&
                  window.height3s < that.sixlayerNum - that.intervallayerNum
                ) {
                  window.butSetViews(that.sixlayerNum);
                }
              }
            }
          };
        // 滚轮事件
@@ -442,7 +483,7 @@
            ii++;
            cutHeight = window.height4s - startHeight;
            // console.log(cutHeight);
            // that.heights = height;
            // that.heights = window.height4s;
            // that.heights1 = cutHeight;
            // return;
            if (isCameraTime) {
@@ -490,6 +531,22 @@
                        window.setViews(that.forlayerNum);
                      }
                    }
                    if (that.fivelayerNum) {
                      if (
                        window.height4s >= that.forlayerNum + 2 &&
                        window.height4s < that.fivelayerNum
                      ) {
                        window.setViews(that.fivelayerNum);
                      }
                    }
                    if (that.sixlayerNum) {
                      if (
                        window.height4s >= that.fivelayerNum + 2 &&
                        window.height4s < that.sixlayerNum
                      ) {
                        window.setViews(that.sixlayerNum);
                      }
                    }
                  }
                  // 放大
                } else {
@@ -505,6 +562,22 @@
                  //     setViews(80);
                  //   }
                  if (cutHeight < -2) {
                    if (that.sixlayerNum) {
                      if (
                        window.height4s <= that.sixlayerNum &&
                        window.height4s > that.fivelayerNum - 2
                      ) {
                        window.setViews(that.fivelayerNum);
                      }
                    }
                    if (that.fivelayerNum) {
                      if (
                        window.height4s <= that.fivelayerNum &&
                        window.height4s > that.forlayerNum - 2
                      ) {
                        window.setViews(that.forlayerNum);
                      }
                    }
                    if (that.forlayerNum) {
                      if (
                        window.height4s <= that.forlayerNum &&
@@ -614,9 +687,9 @@
        global.viewer.scene.globe.depthTestAgainstTerrain = false;
        // console.log(e);
        global.viewer.flyToPosition(
          new global.DC.Position(115.87186406, 28.74449337, 1800, 0, 45, 0)
        );
        // global.viewer.flyToPosition(
        //   new global.DC.Position(115.87186406, 28.74449337, 1800, 0, 45, 0)
        // );
        // 定制化窗体
        that.openPopupS(
@@ -626,9 +699,10 @@
            name: e.overlay.attr.name,
            address: e.layer._id,
            introduce: e.overlay.attr.id,
            data: e,
            // data: e,
          }
        );
        // return;
        // 高亮
        window.silhouetteBlue.selected = [];
@@ -944,13 +1018,13 @@
      // 瀑布流↑
      // 传入store
      that.$store.commit("MSET_MODEOLS", {
        tilesetLayer: window.tilesetLayer,
        // tileset: window.tileset,
        newLayer: window.newLayer,
        wallLayer: window.wallLayer,
        usetowpointfive: window.usetowpointfive,
      });
      // that.$store.commit("MSET_MODEOLS", {
      //   tilesetLayer: window.tilesetLayer,
      //   // tileset: window.tileset,
      //   newLayer: window.newLayer,
      //   wallLayer: window.wallLayer,
      //   usetowpointfive: window.usetowpointfive,
      // });
      // 飞入起始点
      // that.$store.dispatch("mapFlyTo", {
@@ -967,13 +1041,15 @@
      global.viewer.zoomController.enable = true;
      global.viewer.locationBar.enable = false;
      global.viewer.distanceLegend.enable = false;
      // 判断默认维度
      // 原本默认是2.5d  改为3d默认时做出改变
      if (that.dimension == "2.5D") {
        that.$store.commit("set_frislayertHeight", that.frislayertHeight); // 送入默认弹窗高度
        that.$store.commit("set_zoomRange", [
          that.onelayerNum,
          that.forlayerNum ? that.forlayerNum : that.threelayerNum,
          // that.forlayerNum ? that.forlayerNum : that.threelayerNum,
          that.sixlayerNum,
        ]); // 送入移动端缩放范围
        that.$store.commit("MSET_DIMENSION", "2.5D"); // 切换2.5D设置
      } else if (that.dimension == "3D") {
@@ -1004,7 +1080,7 @@
      }
      global.viewer.scene.screenSpaceCameraController._minimumZoomRate = 1000;
      global.viewer.scene.screenSpaceCameraController._maximumZoomRate = 5906376272000;
      //渲染后操作
      // 渲染后操作
      setTimeout(() => {
        window.butbut();
        // return;
@@ -1074,10 +1150,7 @@
              // from: 'PopupOurOnce'
            };
            window.popupsDom = that.$store.dispatch(
              "setMobileWindows",
              dataInitialization
            );
            that.$store.dispatch("setMobileWindows", dataInitialization);
          }
        }
      }, 0);
@@ -1094,6 +1167,7 @@
        query: { introduce: position, address: lntLat, ...(query || {}) },
        useJWD: true, // 仅使用经纬度
      };
      console.log(d);
      that.$store.dispatch("setMobileWindows", d);
    },
    flytos(jd, wd) {