From a22aa1086eeef39a26cc161326ce09cd183185ea Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Fri, 04 Mar 2022 15:57:47 +0800
Subject: [PATCH] 3.3 1.自定义标签,退出后自动清除 2.自定义标签,转换二维码的数据格式ok,移动端对接二维码ok, 3.自定义标签点击移动到指定位置 ok 4.面板自适应高度 4.更换定位依赖,自定义标签扫码入移动端可以定位并显示路线
---
src/store/modules/popupParams.js | 199 ++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 178 insertions(+), 21 deletions(-)
diff --git a/src/store/modules/popupParams.js b/src/store/modules/popupParams.js
index 93ab92b..218580c 100644
--- a/src/store/modules/popupParams.js
+++ b/src/store/modules/popupParams.js
@@ -23,6 +23,11 @@
labelLayer: null, //自定义标签图层
addSignList: true,
+ myviewer: null,
+ nowlabelLayerData: {},
+ labelLayerDataShow: false,
+
+ closeMapClick: false, //关闭地图点击,防止新增标签误触
},
mutations: {
SET_POPUPBGURL(state, popupBgUrl) {
@@ -89,8 +94,138 @@
state.labelLayer = new global.DC.HtmlLayer("labelLayer");
val.addLayer(state.labelLayer);
}
+ state.myviewer = val;
},
- addLabelLayerIcon(state, val) {
+
+ clearLabelLayerIcon(state, val) {
+ if (state.labelLayer) {
+ state.labelLayer.clear();
+ }
+ },
+ openLabelLayer(state, val) {
+ // console.log(val, "see")
+ if (val.show) {
+ state.nowlabelLayerData = val.data;
+ state.labelLayerDataShow = true;
+ } else {
+ state.nowlabelLayerData = {};
+ state.labelLayerDataShow = false;
+ }
+ },
+ CLEAR_ALL(state, param) {
+ state.siteName = param
+ state.introduceText = param
+ state.telephone = param
+ state.panoramaUrl = param
+ state.monitorUrl = param
+ state.popupBgUrl = param
+ state.teachList = []
+ state.liveList = []
+ },
+ set_closeMapClick(state, val) {
+ state.closeMapClick = val;
+ }
+ },
+ actions: {
+ openPopups({
+ state,
+ commit,
+ dispatch
+ }, value) {
+ // //订阅事件
+ // divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
+ // console.log(item);
+ // that.openPopups({
+ // lng: e.overlay.position.lng,
+ // lat: e.overlay.position.lat,
+ // item: item,
+ // });
+ // });
+ var popup = new global.DC.DivForms(state.viewer, {
+ domId: "divFormsDomBox",
+ position: [
+ global.DC.Transform.transformWGS84ToCartesian(
+ new global.DC.Position(
+ Number(value.lng),
+ Number(value.lat),
+ Number(value.alt || 0)
+ )
+ ),
+ ],
+ });
+ dispatch("setOurDataInPoput", value);
+ dispatch("pcFlyView", {
+ jd: value.lng,
+ wd: value.lat,
+ viewer: this.viewer,
+ });
+ },
+ setOurDataInPoput({
+ state,
+ commit,
+ dispatch
+ }, value) {
+ //弹窗使用方法
+
+ commit("CLEAR_ALL", null);
+
+
+ commit("SET_STATENAME", value.item.mechanismname);
+ commit("SET_PANORAMAURL", value.item.panoramaurl);
+ commit("SET_INTRODUCETEXT", value.item.introduce);
+ var imgArr = value.item.tpurl.split(",");
+ commit("SET_POPUPBGURL", imgArr[0]);
+ commit("SET_POPUPQRURL", value.item.codeurl);
+ commit("SET_POINTPOSITION", [
+ Number(value.lng),
+ Number(value.lat),
+ Number(0),
+ Number(0),
+ Number(-90),
+ Number(0),
+ ]);
+ commit('SET_POPUPIMGATLAS', imgArr)
+ commit("SET_DETAILSPOPUP", true);
+ },
+ pcMoveView({
+ state,
+ commit,
+ dispatch
+ }, val) {
+ console.log(val, "see1")
+ val.viewer.camera.setView({
+ // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
+ // fromDegrees()方法,将经纬度和高程转换为世界坐标
+ destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
+ +val.jd,
+ +val.wd,
+ 400.0
+ ),
+ orientation: {
+ // 指向
+ heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0),
+ // 视角
+ pitch: global.DC.Namespace.Cesium.Math.toRadians(-90),
+ roll: 0.0,
+ },
+ });
+ },
+ pcFlyView({
+ state,
+ commit,
+ dispatch
+ }, val) {
+ val.viewer.flyToPosition(
+ new global.DC.Position(Number(val.jd), Number(val.wd), Number(300), Number(0), Number(-90), Number(0)),
+ function () {},
+ 2
+ )
+ },
+ addLabelLayerIcon({
+ state,
+ commit,
+ dispatch
+ }, val) {
let list = val.list;
if (val.clear) {
// state.labelLayer.remove();
@@ -98,9 +233,9 @@
}
if (val.add) { //刷新列表
state.addSignList = !state.addSignList;
+ return;
}
for (let i in list) {
- console.log(list[i], 112233)
const divIcon = new global.DC.DivIcon(
new global.DC.Position(
Number(list[i].jd),
@@ -118,28 +253,50 @@
</div>
`
);
+ //订阅事件
+ divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
+ // console.log(e);
+ // return;
+ // 定制化窗体
+ let position = e.position,
+ lntLat = [e.overlay._position._lng, e.overlay._position._lat];
+ // console.log(position, lntLat, list[i], state.myviewer, "see")
+ new global.DC.DivForms(state.myviewer, {
+ domId: "labelLayerid",
+ position: [
+ global.DC.Transform.transformWGS84ToCartesian(
+ new global.DC.Position(
+ Number(lntLat[0]),
+ Number(lntLat[1]),
+ Number(0)
+ )
+ ),
+ ],
+ });
+ state.myviewer.camera.setView({
+ // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
+ // fromDegrees()方法,将经纬度和高程转换为世界坐标
+ destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
+ lntLat[0],
+ lntLat[1],
+ 400.0
+ ),
+ orientation: {
+ // 指向
+ heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0),
+ // 视角
+ pitch: global.DC.Namespace.Cesium.Math.toRadians(-90),
+ roll: 0.0,
+ },
+ });
+ commit("openLabelLayer", {
+ show: true,
+ data: list[i]
+ })
+ });
state.labelLayer.addOverlay(divIcon);
}
},
- clearLabelLayerIcon(state, val) {
- if (state.labelLayer) {
- state.labelLayer.clear();
- }
- },
-
- CLEAR_ALL(state, param) {
- state.siteName = param
- state.introduceText = param
- state.telephone = param
- state.panoramaUrl = param
- state.monitorUrl = param
- state.popupBgUrl = param
- state.teachList = []
- state.liveList = []
- }
- },
- actions: {
-
}
}
--
Gitblit v1.9.3