From b81e5092630ad581841f7a772203ef1963cecca4 Mon Sep 17 00:00:00 2001 From: TreeWish <1131093754@qq.com> Date: 星期二, 28 二月 2023 19:15:35 +0800 Subject: [PATCH] Merge branch 'master' of http://103.85.165.99:8989/r/LFWEB_NEW --- src/components/MapDiv.vue | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/components/MapDiv.vue b/src/components/MapDiv.vue index b5149b3..d28f4f8 100644 --- a/src/components/MapDiv.vue +++ b/src/components/MapDiv.vue @@ -10,7 +10,10 @@ > <mapsdk></mapsdk> </div> - <div id="ds" v-show="isShowDs"></div> + <div + id="ds" + v-show="isShowDs" + ></div> <!--openLayers鏄剧ず鐣岄潰--> <div v-show="isOlMapFlag" @@ -53,6 +56,7 @@ methods: { changeMap(res) { this.isSplitFlag = res + this.getMapViewCenter(this.isSplitFlag); switch (res) { case 1: this.isShowCeMap = true @@ -73,8 +77,11 @@ this.isShowDs = false this.isShowOlMap = false this.isOlMapFlag = true + var val = this.$store.state.Map3; setTimeout(function () { window.map.updateSize() + window.map.getView().setCenter([val[0], val[1]]) + window.map.getView().setZoom(val[2]) }, 300) break case 3: @@ -83,8 +90,32 @@ this.isShowOlMap = false this.isOlMapFlag = false this.isShowCeMap = false + var val = this.$store.state.Map3; + window.Viewer.camera.setView({ + destination: Cesium.Cartesian3.fromDegrees(val[0], val[1], val[2]), + }) + break } + }, + getMapViewCenter(res) { + switch (res) { + case 2: + var position = window.Viewer.camera.position + var ellipsoid = window.Viewer.scene.globe.ellipsoid + var cartographic = ellipsoid.cartesianToCartographic(position) + var lat = Cesium.Math.toDegrees(cartographic.latitude) + var lng = Cesium.Math.toDegrees(cartographic.longitude) + var level = this.getLevel(cartographic.height) + this.$store.state.Map3 = [lng, lat, level] + break; + case 3: + var position = window.map.getView().getCenter() + var level = this.getHeight(parseInt(window.map.getView().getZoom())) + this.$store.state.Map3 = [position[0], position[1], level] + break; + } + }, showSplitMap() { var that = this @@ -106,6 +137,7 @@ // var pos = transform(position, 'EPSG:3857', 'EPSG:4326'); var pos = position var level = that.getHeight(parseInt(window.map.getView().getZoom())) + window.Viewer.camera.setView({ destination: Cesium.Cartesian3.fromDegrees(pos[0], pos[1], level), }) @@ -168,6 +200,7 @@ var lat = Cesium.Math.toDegrees(cartographic.latitude) var lng = Cesium.Math.toDegrees(cartographic.longitude) var level = this.getLevel(cartographic.height) + var value // window.map // .getView() @@ -192,7 +225,12 @@ }, mounted() { this.$bus.$on("changemap", e => { - this.changeMap(e) + if (this.isSplitFlag == 1) { + this.changeMap(3) + } else { + this.changeMap(e) + } + }) }, } -- Gitblit v1.9.3