From 4dab9528d8e69c0c3f8ce03a7d4617bb13ecec8d Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Thu, 31 Mar 2022 14:24:24 +0800
Subject: [PATCH] +注释
---
src/components/mobilemap/index.vue | 83 ++++++++++++++++++++++++++++++++++-------
1 files changed, 69 insertions(+), 14 deletions(-)
diff --git a/src/components/mobilemap/index.vue b/src/components/mobilemap/index.vue
index 180030b..6410871 100644
--- a/src/components/mobilemap/index.vue
+++ b/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;
@@ -116,6 +116,7 @@
// 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],
// 控制4层缩放
// onelayerNum: 80,
// towlayerNum: 120,
@@ -123,16 +124,18 @@
// forlayerNum: null,
// intervallayerNum: 20,
// frislayertHeight: 120, // 默认高度
- onelayerNum: 110,
- towlayerNum: 140,
- threelayerNum: 170,
- forlayerNum: 200,
+ onelayerNum: 40,
+ towlayerNum: 80,
+ threelayerNum: 120,
+ forlayerNum: 160,
- fivelayerNum: 230,
- sixlayerNum: 260,
+ fivelayerNum: 200,
+ sixlayerNum: 240,
intervallayerNum: 15,
- frislayertHeight: 170, // 默认高度
+ frislayertHeight: 160, // 默认高度
+ useSuofang: false, //是否缩放 true 去掉了缩放, 抚州 false
+ addOthers: true, //加入了活动底图以及抚州底图 抚州 true
};
},
computed: {
@@ -168,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: {
@@ -239,6 +254,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) => {
// 相机移动最后参数
@@ -292,8 +308,15 @@
// 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;
+ }
window.conBack(usMun);
}
});
@@ -319,9 +342,15 @@
};
window.butbut = function () {
// 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
@@ -384,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
@@ -470,6 +502,21 @@
};
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;
+ }
if (that.dimension == "2.5D") {
// console.log(e);
window.height4s = Math.ceil(
@@ -480,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);
@@ -844,6 +891,7 @@
// overlay: undefined,
// color: undefined,
// };
+ //地图点击事件
global.viewer.on(global.DC.MouseEventType.CLICK, (e) => {
// console.log(e);
if (e.overlay != undefined && e.layer.id == "areaLayer") {
@@ -1039,6 +1087,7 @@
global.viewer.zoomController.enable = true;
global.viewer.locationBar.enable = false;
global.viewer.distanceLegend.enable = false;
+
// 判断默认维度
// 原本默认是2.5d 改为3d默认时做出改变
if (that.dimension == "2.5D") {
@@ -1046,7 +1095,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") {
@@ -1077,7 +1132,7 @@
}
global.viewer.scene.screenSpaceCameraController._minimumZoomRate = 1000;
global.viewer.scene.screenSpaceCameraController._maximumZoomRate = 5906376272000;
- //渲染后操作
+ // 渲染后操作
setTimeout(() => {
window.butbut();
// return;
--
Gitblit v1.9.3