From 3f957f1b2edf8ad7e35f6c3f64b47f7704fa366d Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 08 Mar 2022 11:18:08 +0800
Subject: [PATCH] 二维码参数更改,左侧实景,监控更改
---
src/components/leftNav/index.vue | 264 +++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 217 insertions(+), 47 deletions(-)
diff --git a/src/components/leftNav/index.vue b/src/components/leftNav/index.vue
index c828f40..5454b50 100644
--- a/src/components/leftNav/index.vue
+++ b/src/components/leftNav/index.vue
@@ -1,24 +1,36 @@
<template>
<div class="left-nav">
<ul>
- <li v-for="(item, index) in leftNavData"
- :key="index"
- @click="leftNavClick(item)">
- <img :src="item.img"
- alt="">
- <span>{{item.label}}</span>
+ <li v-for="(item, index) in leftNavData" :key="index" @click="leftNavClick(item)">
+ <img :src="item.img" alt />
+ <span>{{ item.label }}</span>
+ </li>
+ <li class="addIcons" @click="addIcons">
+ <!-- <img :style="[imgStyle]" :src="item.img" alt="" /> -->
+ <span>+</span>
</li>
</ul>
</div>
</template>
<script>
-
-import { getLifeList, getMonitorList, getSceneList, getWayList, getTagList } from '@/api/pc/leftNav/index'
-
+import {
+ getLifeList,
+ getMonitorList,
+ getSceneList,
+ getWayList,
+ getTagList
+} from '@/api/pc/leftNav/index'
+import { mapGetters } from 'vuex'
export default {
name: 'leftNav',
- computed: {},
+ computed: {
+ ...mapGetters([
+ 'viewer',
+ 'closeMapClick', // 关闭地图点击,防止新增标签误触
+ 'addIconsLayerIconPopup' // 传送关闭编辑窗口,刷新标签数据
+ ])
+ },
data () {
return {
leftNavData: [
@@ -103,9 +115,74 @@
this.DC = global.DC
},
mounted () {
-
+ // 初始化新增标签图层
+ // this.$store.commit("createAddIconsLayerIconLayer", { viewer: this.viewer });
+ },
+ watch: {
+ addIconsLayerIconPopup () {
+ if (!this.addIconsLayerIconPopup) {
+ this.reself()
+ }
+ }
},
methods: {
+ reself () {
+ const that = this
+ if (this.tagLayer) {
+ this.tagLayer.clear()
+ }
+ getTagList().then((res) => {
+ res.data.data.forEach((item) => {
+ const divIcon = new this.DC.DivIcon(
+ new that.DC.Position(Number(item.jd), Number(item.wd), 0),
+ `
+ <div class="tag-entitys-box">
+ <div class="tag-content">
+ ${item.mechanismname}
+ </div>
+ <div class="tag-angle-content">
+ <img src="https://map.hit.edu.cn/images/tarrow_xq.png">
+ </div>
+ </div>
+ `
+ )
+ // 订阅事件
+ divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
+ if (that.closeMapClick) {
+ return
+ }
+ that.openPopups({
+ lng: e.overlay.position.lng,
+ lat: e.overlay.position.lat,
+ item: item
+ })
+ })
+ this.tagLayer.addOverlay(divIcon)
+ if (!this.leftNavData[0].flag) {
+ this.tagLayer.show = false
+ }
+ })
+ })
+ },
+ addIcons () {
+ if (this.closeMapClick) {
+ // 若正在加标签,退出
+ return
+ }
+ // 加标签
+ this.$store.dispatch('chouseAddIconsLayerIcon', {
+ // 新增标签 选定位置
+ viewer: this.viewer,
+ fn: (lnglat) => {
+ // 返回选定坐标
+ // 添加空白标签
+ this.$store.dispatch('addIconsLayerIcon', {
+ lnglat: lnglat,
+ viewer: this.viewer
+ })
+ }
+ })
+ },
generatePosition (num) {
const list = []
for (let i = 0; i < num; i++) {
@@ -144,8 +221,8 @@
this.comeLayer = new this.DC.VectorLayer('comeLayer')
viewer.addLayer(this.comeLayer)
- getTagList().then(res => {
- res.data.data.forEach(item => {
+ getTagList().then((res) => {
+ res.data.data.forEach((item) => {
const divIcon = new this.DC.DivIcon(
new that.DC.Position(Number(item.jd), Number(item.wd), 0),
`
@@ -159,14 +236,25 @@
</div>
`
)
-
+ // 订阅事件
+ divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
+ if (that.closeMapClick) {
+ return
+ }
+ // console.log(item, "see11111");
+ that.openPopups({
+ lng: e.overlay.position.lng,
+ lat: e.overlay.position.lat,
+ item: item
+ })
+ })
this.tagLayer.addOverlay(divIcon)
})
// this.tagLayer.show = false
})
- getWayList().then(res => {
- res.data.data.forEach(item => {
+ getWayList().then((res) => {
+ res.data.data.forEach((item) => {
const divIcon = new this.DC.DivIcon(
new that.DC.Position(Number(item.jd), Number(item.wd), 0),
`
@@ -185,13 +273,13 @@
this.wayLayer.show = false
})
- getMonitorList().then(res => {
- res.data.data.forEach(item => {
+ getMonitorList().then((res) => {
+ res.data.data.records.forEach((item) => {
const divIcon = new this.DC.DivIcon(
new that.DC.Position(Number(item.jd), Number(item.wd), 0),
`
<div class="monitor-entitys-box">
- <div>${item.mechanismname}</div>
+ <div>${item.vrname}</div>
<img class="monitor-entitys-box" src="/img/leftnav/map-monitor.png" alt="">
</div>
`
@@ -199,20 +287,37 @@
divIcon.attrParams = item
this.monitorLayer.addOverlay(divIcon)
- divIcon.on(that.DC.MouseEventType.CLICK, e => {
+ divIcon.on(that.DC.MouseEventType.CLICK, (e) => {
+ that.viewer.flyToPosition(
+ new global.DC.Position(Number(item.jd), Number(item.wd), Number(300), Number(0), Number(-90), Number(0)),
+ function () { },
+ 2
+ )
+
this.$store.commit('SET_PANORAMAPOPUP', false)
this.$store.commit('SET_DETAILSPOPUP', false)
- this.$store.commit('SET_STATENAME', e.overlay.attrParams.mechanismname)
- this.$store.commit('SET_MONITORURL', e.overlay.attrParams.videourl)
+ this.$store.commit(
+ 'SET_STATENAME',
+ e.overlay.attrParams.vrname
+ )
+ this.$store.commit('SET_MONITORURL', e.overlay.attrParams.vrurl)
// eslint-disable-next-line new-cap
- var positions = this.DC.Transform.transformWGS84ToCartesian(new this.DC.Position.fromArray([Number(item.jd), Number(item.wd), 0, 0, -90, 0]))
+ var positions = this.DC.Transform.transformWGS84ToCartesian(
+ // eslint-disable-next-line new-cap
+ new this.DC.Position.fromArray([
+ Number(item.jd),
+ Number(item.wd),
+ 0,
+ 0,
+ -90,
+ 0
+ ])
+ )
this.viewer.scene.globe.depthTestAgainstTerrain = false
// eslint-disable-next-line no-unused-vars
var monitor = new this.DC.PanoramaBox(this.viewer, {
domId: 'MonitorBox',
- position: [
- positions
- ]
+ position: [positions]
})
this.$store.commit('SET_MONITORPOPUP', true)
@@ -222,13 +327,13 @@
this.monitorLayer.show = false
})
- getSceneList().then(res => {
- res.data.data.forEach(item => {
+ getSceneList().then((res) => {
+ res.data.data.records.forEach((item) => {
const divIcon = new this.DC.DivIcon(
new that.DC.Position(Number(item.jd), Number(item.wd), 0),
`
<div class="scene-entitys-box">
- <div>${item.mechanismname}</div>
+ <div>${item.vrname}</div>
<img src="/img/leftnav/map-panorama.png" alt="">
</div>
`
@@ -236,20 +341,40 @@
divIcon.attrParams = item
this.sceneLayer.addOverlay(divIcon)
- divIcon.on(that.DC.MouseEventType.CLICK, e => {
+ divIcon.on(that.DC.MouseEventType.CLICK, (e) => {
+ that.viewer.flyToPosition(
+ new global.DC.Position(Number(item.jd), Number(item.wd), Number(300), Number(0), Number(-90), Number(0)),
+ function () { },
+ 2
+ )
+
this.$store.commit('SET_DETAILSPOPUP', false)
this.$store.commit('SET_MONITORPOPUP', false)
- this.$store.commit('SET_STATENAME', e.overlay.attrParams.mechanismname)
- this.$store.commit('SET_PANORAMAURL', e.overlay.attrParams.panoramaurl)
+ this.$store.commit(
+ 'SET_STATENAME',
+ e.overlay.attrParams.mechanvrnameismname
+ )
+ this.$store.commit(
+ 'SET_PANORAMAURL',
+ e.overlay.attrParams.vrurl
+ )
// eslint-disable-next-line new-cap
- var positions = this.DC.Transform.transformWGS84ToCartesian(new this.DC.Position.fromArray([Number(item.jd), Number(item.wd), 0, 0, -90, 0]))
+ var positions = that.DC.Transform.transformWGS84ToCartesian(
+ // eslint-disable-next-line new-cap
+ new that.DC.Position.fromArray([
+ Number(item.jd),
+ Number(item.wd),
+ 0,
+ 0,
+ -90,
+ 0
+ ])
+ )
this.viewer.scene.globe.depthTestAgainstTerrain = false
// eslint-disable-next-line no-unused-vars
var panorama = new this.DC.PanoramaBox(this.viewer, {
domId: 'PanoramaBox',
- position: [
- positions
- ]
+ position: [positions]
})
this.$store.commit('SET_PANORAMAPOPUP', true)
@@ -259,9 +384,12 @@
this.sceneLayer.show = false
})
- getLifeList({ lifetype: 9 }).then(res => {
- res.data.data.forEach(item => {
- const label = new this.DC.Label(new that.DC.Position(Number(item.jd), Number(item.wd), 0), item.mechanismname)
+ getLifeList({ lifetype: 9 }).then((res) => {
+ res.data.data.forEach((item) => {
+ const label = new this.DC.Label(
+ new that.DC.Position(Number(item.jd), Number(item.wd), 0),
+ item.mechanismname
+ )
label.setStyle({
fillColor: this.DC.Color.CRIMSON,
style: that.DC.Namespace.Cesium.LabelStyle.FILL_AND_OUTLINE,
@@ -272,7 +400,10 @@
})
this.aedLayer.addOverlay(label)
- const billboard = new this.DC.Billboard(new that.DC.Position(Number(item.jd), Number(item.wd), 0), '/img/leftnav/map-aed.png')
+ const billboard = new this.DC.Billboard(
+ new that.DC.Position(Number(item.jd), Number(item.wd), 0),
+ '/img/leftnav/map-aed.png'
+ )
billboard.size = [20, 20]
this.aedLayer.addOverlay(billboard)
@@ -280,8 +411,8 @@
this.aedLayer.show = false
})
- getLifeList({ lifetype: 11 }).then(res => {
- res.data.data.forEach(item => {
+ getLifeList({ lifetype: 11 }).then((res) => {
+ res.data.data.forEach((item) => {
const divIcon = new this.DC.DivIcon(
new that.DC.Position(Number(item.jd), Number(item.wd), 0),
`
@@ -304,9 +435,12 @@
this.parkLayer.show = false
})
- getLifeList({ lifetype: 12 }).then(res => {
- res.data.data.forEach(item => {
- const label = new that.DC.Label(new that.DC.Position(Number(item.jd), Number(item.wd), 0), item.mechanismname)
+ getLifeList({ lifetype: 12 }).then((res) => {
+ res.data.data.forEach((item) => {
+ const label = new that.DC.Label(
+ new that.DC.Position(Number(item.jd), Number(item.wd), 0),
+ item.mechanismname
+ )
label.setStyle({
fillColor: that.DC.Color.FUCHSIA,
style: that.DC.Namespace.Cesium.LabelStyle.FILL_AND_OUTLINE,
@@ -317,7 +451,10 @@
})
that.comeLayer.addOverlay(label)
- const billboard = new that.DC.Billboard(new that.DC.Position(Number(item.jd), Number(item.wd), 0), '/img/leftnav/map-activity.png')
+ const billboard = new that.DC.Billboard(
+ new that.DC.Position(Number(item.jd), Number(item.wd), 0),
+ '/img/leftnav/map-activity.png'
+ )
billboard.size = [20, 20]
billboard.setStyle({
pixelOffset: { x: 0, y: -16 }
@@ -327,12 +464,33 @@
})
this.comeLayer.show = false
})
+ },
+ openPopups (value) {
+ var popup = new this.DC.DivForms(this.viewer, {
+ domId: 'divFormsDomBox',
+ position: [
+ this.DC.Transform.transformWGS84ToCartesian(
+ new this.DC.Position(
+ Number(value.lng),
+ Number(value.lat),
+ Number(value.alt || 0)
+ )
+ )
+ ]
+ })
+ // console.log(value, "see");
+ this.$store.dispatch('setOurDataInPoput', value)
+ this.$store.dispatch('pcFlyView', {
+ jd: value.lng,
+ wd: value.lat,
+ viewer: this.viewer
+ })
}
}
}
</script>
-<style scoped lang='scss'>
+<style scoped lang="scss">
.left-nav {
position: fixed;
top: 160px;
@@ -377,4 +535,16 @@
}
}
}
+.addIcons {
+ position: absolute;
+ top: 0;
+ left: -60px;
+ width: 50px !important;
+ span {
+ font-size: 25px !important;
+ }
+}
+.avtiveAddIcons {
+ background-color: aqua;
+}
</style>
--
Gitblit v1.9.3