From 58060e64e1fa9cf3ffcf5e29f09c4c2edf8f2126 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 21 Jul 2022 17:25:34 +0800
Subject: [PATCH] 数据显示更换
---
src/components/leftNav/index.vue | 192 ++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 161 insertions(+), 31 deletions(-)
diff --git a/src/components/leftNav/index.vue b/src/components/leftNav/index.vue
index b76d1d0..3fc957f 100644
--- a/src/components/leftNav/index.vue
+++ b/src/components/leftNav/index.vue
@@ -145,7 +145,12 @@
for (const key in LeftNavLayer) {
if (LeftNavLayer[key] != null) {
LeftNavLayer[key].eachOverlay((item) => {
- item.position = new global.DC.Position(Number(item.position.lng), Number(item.position.lat), 0)
+ if (item.attr.params.x && item.attr.params.x != '') {
+ const position = this.coordinate(item.attr.params.x)
+ item.position = new global.DC.Position(Number(position.lng), Number(position.lat), 0)
+ } else {
+ item.position = new global.DC.Position(Number(item.position.lng), Number(item.position.lat), 0)
+ }
})
}
}
@@ -153,7 +158,7 @@
for (const key in LeftNavLayer) {
if (LeftNavLayer[key] != null) {
LeftNavLayer[key].eachOverlay((item) => {
- item.position = new global.DC.Position(Number(item.position.lng), Number(item.position.lat), 150)
+ item.position = new global.DC.Position(Number(item.attr.params.jd), Number(item.attr.params.wd), 0)
})
}
}
@@ -168,6 +173,7 @@
if (LeftNavLayer.leftTagLayer) {
LeftNavLayer.leftTagLayer.clear()
}
+
getTagList().then((res) => {
res.data.data.forEach((item) => {
const divIcon = new global.DC.DivIcon(
@@ -201,6 +207,16 @@
})
})
},
+
+ coordinate (item) {
+ const arr = item.split(',')
+
+ return {
+ lng: arr[0],
+ lat: arr[1]
+ }
+ },
+
addIcons () {
if (this.closeMapClick) {
// 若正在加标签,退出
@@ -220,6 +236,7 @@
}
})
},
+
generatePosition (num) {
const list = []
for (let i = 0; i < num; i++) {
@@ -229,6 +246,7 @@
}
return list
},
+
leftNavClick (item) {
item.flag = !item.flag
if (item.flag == true) {
@@ -247,6 +265,7 @@
}
}
},
+
initialize () {
var that = this
global.viewer.scene.globe.depthTestAgainstTerrain = false
@@ -274,19 +293,34 @@
getTagList().then((res) => {
res.data.data.forEach((item) => {
+ let obj = {}
+ if (item.x && item.x != '') {
+ const position = that.coordinate(item.x)
+ obj = {
+ lng: position.lng, lat: position.lat
+ }
+ } else {
+ obj = {
+ lng: item.jd, lat: item.wd
+ }
+ }
+
const 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">
- ${item.mechanismname}
- </div>
- <div class="tag-angle-content">
- <img src="/img/icon/tarrow_xq.png">
- </div>
- </div>
- `
+ <div class="tag-entitys-box">
+ <div class="tag-content">
+ ${item.mechanismname}
+ </div>
+ <div class="tag-angle-content">
+ <img src="/img/icon/tarrow_xq.png">
+ </div>
+ </div>
+ `
)
+
+ divIcon.attr.params = item
+
// 订阅事件
divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
if (that.closeMapClick) {
@@ -294,8 +328,8 @@
}
// console.log(item, "see11111");
that.openPopups({
- lng: e.overlay.position.lng,
- lat: e.overlay.position.lat,
+ lng: Number(obj.lng),
+ lat: Number(obj.lat),
item: item
})
})
@@ -306,19 +340,34 @@
getWayList().then((res) => {
res.data.data.forEach((item) => {
+ let obj = {}
+ if (item.x && item.x != '') {
+ const position = that.coordinate(item.x)
+ obj = {
+ lng: position.lng, lat: position.lat
+ }
+ } else {
+ obj = {
+ lng: item.jd, lat: item.wd
+ }
+ }
+
const 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="way-entitys-box">
- <div class="way-title" style="border: white 1px solid; font-size: 0.875rem; background: #0066ff; width: 18px; line-height: 14px; padding: 6px 2px 6px 2px; color: white; text-align: center;">
- ${item.roadname}
- </div>
- <div class="way-sign-box">
- <img src="/img/icon/roadsign3.png">
- </div>
- </div>
- `
+ <div class="way-entitys-box">
+ <div class="way-title" style="border: white 1px solid; font-size: 0.875rem; background: #0066ff; width: 18px; line-height: 14px; padding: 6px 2px 6px 2px; color: white; text-align: center;">
+ ${item.roadname}
+ </div>
+ <div class="way-sign-box">
+ <img src="/img/icon/roadsign3.png">
+ </div>
+ </div>
+ `
)
+
+ divIcon.attr.params = item
+
LeftNavLayer.leftWayLayer.addOverlay(divIcon)
})
LeftNavLayer.leftWayLayer.show = false
@@ -326,8 +375,20 @@
getMonitorList().then((res) => {
res.data.data.records.forEach((item) => {
+ let obj = {}
+ if (item.x && item.x != '') {
+ const position = that.coordinate(item.x)
+ obj = {
+ lng: position.lng, lat: position.lat
+ }
+ } else {
+ obj = {
+ lng: item.jd, lat: item.wd
+ }
+ }
+
const 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="monitor-entitys-box">
<div>${item.vrname}</div>
@@ -335,6 +396,9 @@
</div>
`
)
+
+ divIcon.attr.params = item
+
divIcon.attrParams = item
LeftNavLayer.leftMonitorLayer.addOverlay(divIcon)
@@ -380,8 +444,20 @@
getSceneList().then((res) => {
res.data.data.records.forEach((item) => {
+ let obj = {}
+ if (item.x && item.x != '') {
+ const position = that.coordinate(item.x)
+ obj = {
+ lng: position.lng, lat: position.lat
+ }
+ } else {
+ obj = {
+ lng: item.jd, lat: item.wd
+ }
+ }
+
const 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="scene-entitys-box">
<div>${item.vrname}</div>
@@ -389,6 +465,9 @@
</div>
`
)
+
+ divIcon.attr.params = item
+
divIcon.attrParams = item
LeftNavLayer.leftSceneLayer.addOverlay(divIcon)
@@ -437,10 +516,23 @@
getLifeList({ lifetype: 9 }).then((res) => {
res.data.data.forEach((item) => {
+ let obj = {}
+ if (item.x && item.x != '') {
+ const position = that.coordinate(item.x)
+ obj = {
+ lng: position.lng, lat: position.lat
+ }
+ } else {
+ obj = {
+ lng: item.jd, lat: item.wd
+ }
+ }
+
const label = new global.DC.Label(
- new global.DC.Position(Number(item.jd), Number(item.wd), 0),
+ new global.DC.Position(Number(obj.lng), Number(obj.lat), 0),
item.mechanismname
)
+
label.setStyle({
fillColor: global.DC.Color.CRIMSON,
style: global.DC.Namespace.Cesium.LabelStyle.FILL_AND_OUTLINE,
@@ -449,13 +541,18 @@
font: '14px sans-serif',
pixelOffset: { x: 0, y: -24 }
})
+
+ label.attr.params = item
+
LeftNavLayer.leftAedLayer.addOverlay(label)
const billboard = new global.DC.Billboard(
- new global.DC.Position(Number(item.jd), Number(item.wd), 0),
+ new global.DC.Position(Number(obj.lng), Number(obj.lat), 0),
'/img/leftnav/map-aed.png'
)
billboard.size = [20, 20]
+
+ billboard.attr.params = item
LeftNavLayer.leftAedLayer.addOverlay(billboard)
})
@@ -464,8 +561,20 @@
getLifeList({ lifetype: 11 }).then((res) => {
res.data.data.forEach((item) => {
+ let obj = {}
+ if (item.x && item.x != '') {
+ const position = that.coordinate(item.x)
+ obj = {
+ lng: position.lng, lat: position.lat
+ }
+ } else {
+ obj = {
+ lng: item.jd, lat: item.wd
+ }
+ }
+
const 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="park-entitys-box">
<div class="park-title" alt="${item.mechanismname}">
@@ -481,6 +590,9 @@
</div>
`
)
+
+ divIcon.attr.params = item
+
LeftNavLayer.leftParkLayer.addOverlay(divIcon)
})
LeftNavLayer.leftParkLayer.show = false
@@ -488,8 +600,20 @@
getLifeList({ lifetype: 12 }).then((res) => {
res.data.data.forEach((item) => {
+ let obj = {}
+ if (item.x && item.x != '') {
+ const position = that.coordinate(item.x)
+ obj = {
+ lng: position.lng, lat: position.lat
+ }
+ } else {
+ obj = {
+ lng: item.jd, lat: item.wd
+ }
+ }
+
const label = new global.DC.Label(
- new global.DC.Position(Number(item.jd), Number(item.wd), 0),
+ new global.DC.Position(Number(obj.lng), Number(obj.lat), 0),
item.mechanismname
)
label.setStyle({
@@ -500,10 +624,13 @@
font: '14px sans-serif',
pixelOffset: { x: 0, y: -40 }
})
+
+ label.attr.params = item
+
LeftNavLayer.leftComeLayer.addOverlay(label)
const billboard = new global.DC.Billboard(
- new global.DC.Position(Number(item.jd), Number(item.wd), 0),
+ new global.DC.Position(Number(obj.lng), Number(obj.lat), 0),
'/img/leftnav/map-activity.png'
)
billboard.size = [20, 20]
@@ -511,11 +638,14 @@
pixelOffset: { x: 0, y: -16 }
})
+ billboard.attr.params = item
+
LeftNavLayer.leftComeLayer.addOverlay(billboard)
})
LeftNavLayer.leftComeLayer.show = false
})
},
+
openPopups (value) {
var popup = new global.DC.DivForms(global.viewer, {
domId: 'divFormsDomBox',
--
Gitblit v1.9.3