From 3f2090824cbb38a846e4f3037efb323b8c176418 Mon Sep 17 00:00:00 2001
From: mayisheng <admin>
Date: Thu, 11 Aug 2022 17:37:24 +0800
Subject: [PATCH] 修改标签错乱等问题
---
src/components/serviceNavBar/index.vue | 121 ++++++++++++++++++++++++++++++++--------
1 files changed, 96 insertions(+), 25 deletions(-)
diff --git a/src/components/serviceNavBar/index.vue b/src/components/serviceNavBar/index.vue
index 05aad93..9e12ce1 100644
--- a/src/components/serviceNavBar/index.vue
+++ b/src/components/serviceNavBar/index.vue
@@ -97,13 +97,15 @@
if (newData == '三 维') {
if (ourLayer != null) {
ourLayer.eachOverlay((item) => {
- item.position = new global.DC.Position(Number(item.position.lng), Number(item.position.lat), 0)
+ const position = this.coordinate(item.attrParam.x)
+
+ item.position = new global.DC.Position(Number(position.lng), Number(position.lat), 0)
})
}
} else {
if (ourLayer != null) {
ourLayer.eachOverlay((item) => {
- item.position = new global.DC.Position(Number(item.position.lng), Number(item.position.lat), 50)
+ item.position = new global.DC.Position(Number(item.attrParam.jd), Number(item.attrParam.wd), 50)
})
}
}
@@ -113,6 +115,14 @@
},
mounted () { },
methods: {
+ coordinate (item) {
+ const arr = item.split(',')
+
+ return {
+ lng: arr[0],
+ lat: arr[1]
+ }
+ },
closeModel () {
this.$parent.closeModel()
},
@@ -151,13 +161,25 @@
})
},
addDivIcon (item, mylayer) {
+ let obj = {}
+
+ if (item.x && item.x != '') {
+ const position = this.coordinate(item.x)
+ obj = {
+ lng: position.lng, lat: position.lat
+ }
+ } else {
+ obj = {
+ lng: item.jd, lat: item.wd
+ }
+ }
const that = this
let divIcon = null
if (this.twoOrThree == '三 维') {
divIcon = new global.DC.DivIcon(
- new global.DC.Position(Number(item.jd), Number(item.wd), 0),
+ new global.DC.Position(Number(obj.lng), Number(obj.lat), 0),
`
<div class="tag-entitys-box">
<div class="tag-content">
@@ -185,6 +207,8 @@
)
}
+ divIcon.attrParam = item
+
// 订阅事件
divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
// console.log(item, "see");
@@ -198,6 +222,18 @@
mylayer.addOverlay(divIcon)
},
mapPopup (param) {
+ let obj = {}
+
+ if (param.x && param.x != '') {
+ const position = this.coordinate(param.x)
+ obj = {
+ lng: position.lng, lat: position.lat
+ }
+ } else {
+ obj = {
+ lng: param.jd, lat: param.wd
+ }
+ }
var result = param
this.$store.commit('CLEAR_ALL', null)
@@ -205,14 +241,7 @@
this.$store.commit('SET_POPUPBGURL', imgArr[0])
this.$store.commit('SET_POPUPQRURL', result.codeurl)
- this.$store.commit('SET_POINTPOSITION', [
- Number(result.jd),
- Number(result.wd),
- Number(result.gd),
- Number(result.heading),
- Number(result.pitch),
- Number(result.roll)
- ])
+
this.$store.commit('SET_STATENAME', result.mechanismname)
this.$store.commit('SET_SITENAME', result.address)
this.$store.commit('SET_TELEPHONE', result.telephone)
@@ -224,24 +253,66 @@
this.$store.commit('SET_MONITORURL', result.videourl)
}
- this.newPopup(result)
- global.viewer.flyToPosition(
- new global.DC.Position(
- Number(result.jd),
- Number(result.wd),
- 300,
+ this.newPopup(result, obj)
+
+ if (this.twoOrThree == '三 维') {
+ this.$store.commit('SET_POINTPOSITION', [
+ Number(obj.lng),
+ Number(obj.lat),
+ Number(result.gd),
Number(result.heading),
Number(result.pitch),
Number(result.roll)
- ),
- function () { },
- 3
- )
+ ])
+
+ global.viewer.flyToPosition(
+ new global.DC.Position(
+ Number(obj.lng),
+ Number(obj.lat),
+ 300,
+ Number(result.heading),
+ Number(result.pitch),
+ Number(result.roll)
+ ),
+ function () { },
+ 3
+ )
+ } else {
+ this.$store.commit('SET_POINTPOSITION', [
+ Number(result.jd),
+ Number(result.wd),
+ Number(result.gd),
+ Number(result.heading),
+ Number(result.pitch),
+ Number(result.roll)
+ ])
+
+ global.viewer.flyToPosition(
+ new global.DC.Position(
+ Number(result.jd),
+ Number(result.wd),
+ 300,
+ Number(result.heading),
+ Number(result.pitch),
+ Number(result.roll)
+ ),
+ function () { },
+ 3
+ )
+ }
},
- newPopup (item) {
- const position = global.DC.Transform.transformWGS84ToCartesian(
- new global.DC.Position(Number(item.jd), Number(item.wd), Number(item.gd))
- )
+ newPopup (item, obj) {
+ let position
+ if (this.twoOrThree == '三 维') {
+ position = global.DC.Transform.transformWGS84ToCartesian(
+ new global.DC.Position(Number(obj.lng), Number(obj.lat), Number(item.gd))
+ )
+ } else {
+ position = global.DC.Transform.transformWGS84ToCartesian(
+ new global.DC.Position(Number(item.jd), Number(item.wd), Number(item.gd))
+ )
+ }
+
// eslint-disable-next-line no-unused-vars
var popup = new global.DC.DivForms(global.viewer, {
domId: 'divFormsDomBox',
--
Gitblit v1.9.3