From 9c3050a2b8e140f91c830cfafd1f5300f4b5dd72 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 16 Dec 2024 19:40:06 +0800
Subject: [PATCH] 新干路由配置调整、作战图显示调整
---
src/views/pd/components/dynamicPanel.vue | 397 +++++++++++++++++++++++++++++++-------------------------
1 files changed, 221 insertions(+), 176 deletions(-)
diff --git a/src/views/pd/components/dynamicPanel.vue b/src/views/pd/components/dynamicPanel.vue
index ed15e9b..03487bd 100644
--- a/src/views/pd/components/dynamicPanel.vue
+++ b/src/views/pd/components/dynamicPanel.vue
@@ -2,7 +2,7 @@
* @Author: shuishen 1109946754@qq.com
* @Date: 2024-11-09 15:41:35
* @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2024-11-28 19:36:24
+ * @LastEditTime: 2024-12-06 16:50:50
* @FilePath: \bigScreen\src\views\pd\components\dynamicPanel.vue
* @Description:
*
@@ -46,8 +46,8 @@
lng: 115.10343807,
lat: 27.27256126
},
- linePosition: '115.10341051,27.27251643,80;115.10357817,27.27278003,80',
- lineTime: 10000,
+ linePosition: '115.10341051,27.27251643,64;115.10357817,27.27278003,64',
+ lineTime: 5000,
threeContent: '关闭绿源污水处理厂旁雨水排口,拦截污染水体。',
threePointPosition: {
@@ -86,13 +86,13 @@
lng: 115.10627858,
lat: 27.29434439
},
- linePosition: '115.10627726,27.29408853,80;115.10627703,27.29456132,80',
+ linePosition: '115.10627726,27.29408853,64;115.10627703,27.29456132,64',
lineTime: 5000,
twoContent: '园区关闭北区雨水排口,拦截污染水体。',
twoPointPosition: {
- lng: 115.10542509,
- lat: 27.29924475
+ lng: 115.10629605,
+ lat: 27.29785816
},
twotime: 10000,
@@ -112,8 +112,8 @@
fiveContent: '排口下游展开应急监测,确保废水没有进入周边水系。',
fivePointPosition: {
- lng: 115.10921467,
- lat: 27.27166382
+ lng: 115.10542509,
+ lat: 27.29924475
},
fivetime: 25000
},
@@ -127,10 +127,10 @@
oneCentent: '2024年09月16日14时,北片区某公司的危化品运输车辆发生侧翻,大量盐酸流至路面。',
onePointPosition: {
- lng: 115.10639786,
- lat: 27.28116943
+ lng: 115.10639803,
+ lat: 27.27848014
},
- onetime: 8000,
+ onetime: 10000,
twoContent: '调度金龙水库清水,稀释污染团。',
twoPointPosition: {
@@ -162,41 +162,32 @@
let modelPosition = [
{
- lng: 115.10601196,
- lat: 27.28378838
- },
- {
- lng: 115.10602432,
- lat: 27.28339800
- },
- {
- lng: 115.10600450,
- lat: 27.28319338,
- },
- {
- lng: 115.10605031,
- lat: 27.28294272,
- },
- {
- lng: 115.10610404,
- lat: 27.28267996
- },
- {
- lng: 115.10614202,
- lat: 27.28248175
- },
- {
- lng: 115.10620011,
- lat: 27.28221311
- },
- {
lng: 115.10640155,
lat: 27.28121605
},
-
+ {
+ lng: 115.10641953,
+ lat: 27.28084006
+ },
+ {
+ lng: 115.10641886,
+ lat: 27.28026147
+ },
+ {
+ lng: 115.10642486,
+ lat: 27.27994712,
+ },
+ {
+ lng: 115.10640964,
+ lat: 27.27928393,
+ },
+ {
+ lng: 115.10639803,
+ lat: 27.27848014
+ }
]
-let positions = modelPosition.map(i => [i.lng, i.lat, 64].join(',')).join(';')
+let positions = modelPosition.map(i => [i.lng, i.lat, i.ele || 64].join(',')).join(';')
let tc = new DC.TrackController(window.$viewer)
let track = new DC.Track(positions, 5)
track.setModel(VITE_APP_BASE + 'gltf/car.gltf', {
@@ -208,6 +199,173 @@
})
tc.addTrack(track)
+
+const synth = window.speechSynthesis
+
+
+const speak = (msg, continueFun = () => { }) => {
+ let u = new SpeechSynthesisUtterance()
+ let voices = synth.getVoices()
+ u.text = msg
+ u.rate = 2
+ let findObj = voices.some(voice => voice.lang == 'zh-CN')
+
+ if (!findObj) {
+ u.lang = 'zh-TW'
+ }
+
+ u.onend = () => {
+ continueFun()
+ }
+ synth.speak(u)
+}
+
+const publicFun = (item) => {
+ let threeCenter = DC.Position.fromObject(item.threePointPosition)
+ let threeCircle = new DC.Circle(threeCenter, 30)
+ threeCircle.setStyle({
+ material: new DC.CircleWaveMaterialProperty({
+ color: DC.Color.fromRandom(),
+ speed: 20,
+ count: 5,
+ gradient: 0.5
+ })
+ })
+ dynamicVectorLayer.addOverlay(threeCircle)
+
+ let threeContent = new DC.DivIcon(
+ new DC.Position(item.threePointPosition.lng, item.threePointPosition.lat, 70),
+ `<div class="dynamic-map-popup">
+ <div class="content-wrap">
+ <div class="content">
+ <p>${item.threeContent}</p>
+ </div>
+ </div>
+ <div class="arrow"></div>
+ </div>`
+ )
+ dynamicHtmlLayer.addOverlay(threeContent)
+
+ window.$viewer.flyToPosition(new DC.Position(item.threePointPosition.lng, item.threePointPosition.lat, 400, 0, -90, 0), () => {
+ speak(item.threeContent, () => {
+ let FourCenter = DC.Position.fromObject(item.fourPointPosition)
+ let fourCircle = new DC.Circle(FourCenter, 10)
+ fourCircle.setStyle({
+ material: new DC.CircleWaveMaterialProperty({
+ color: DC.Color.fromRandom(),
+ speed: 20,
+ count: 5,
+ gradient: 0.5
+ })
+ })
+ dynamicVectorLayer.addOverlay(fourCircle)
+
+ let fourContent = new DC.DivIcon(
+ new DC.Position(item.fourPointPosition.lng, item.fourPointPosition.lat, 70),
+ `<div class="dynamic-event-profile-map-popup">
+ <div class="content-wrap">
+ <div class="content">
+ <p>${item.fourContent}</p>
+ </div>
+ </div>
+ <div class="arrow"></div>
+ </div>`
+ )
+ dynamicHtmlLayer.addOverlay(fourContent)
+ // 执行对应的事件函数
+ window.$viewer.flyToPosition(new DC.Position(item.fourPointPosition.lng, item.fourPointPosition.lat, 400, 0, -90, 0), () => {
+ speak(item.fourContent, () => {
+ if (item.fivePointPosition) {
+ let fiveCenter = DC.Position.fromObject(item.fivePointPosition)
+ let fiveCircle = new DC.Circle(fiveCenter, 10)
+ fiveCircle.setStyle({
+ material: new DC.CircleWaveMaterialProperty({
+ color: DC.Color.fromRandom(),
+ speed: 20,
+ count: 5,
+ gradient: 0.5
+ })
+ })
+ dynamicVectorLayer.addOverlay(fiveCircle)
+
+ let fiveContent = new DC.DivIcon(
+ new DC.Position(item.fivePointPosition.lng, item.fivePointPosition.lat, 70),
+ `<div class="dynamic-event-profile-map-popup">
+ <div class="content-wrap">
+ <div class="content">
+ <p>${item.fiveContent}</p>
+ </div>
+ </div>
+ <div class="arrow"></div>
+ </div>`
+ )
+ dynamicHtmlLayer.addOverlay(fiveContent)
+ // 执行对应的事件函数
+ window.$viewer.flyToPosition(new DC.Position(item.fivePointPosition.lng, item.fivePointPosition.lat, 400, 0, -90, 0), () => {
+ speak(item.fiveContent)
+ }, 3)
+ }
+ })
+ }, 3)
+ })
+ }, 3)
+}
+
+const twoFun = (item, cb = () => { }) => {
+ let twoCenter = DC.Position.fromObject(item.twoPointPosition)
+ let twoCircle = new DC.Circle(twoCenter, 10)
+ twoCircle.setStyle({
+ material: new DC.CircleWaveMaterialProperty({
+ color: DC.Color.fromRandom(),
+ speed: 20,
+ count: 5,
+ gradient: 0.5
+ })
+ })
+ dynamicVectorLayer.addOverlay(twoCircle)
+
+ let twoContent = new DC.DivIcon(
+ new DC.Position(item.twoPointPosition.lng, item.twoPointPosition.lat, 70),
+ `<div class="dynamic-event-profile-map-popup">
+ <div class="content-wrap">
+ <div class="content">
+ <p>${item.twoContent}</p>
+ </div>
+ </div>
+ <div class="arrow"></div>
+ </div>`
+ // <p>特征污染物:${item.specificPollutant}</p>
+ )
+ dynamicHtmlLayer.addOverlay(twoContent)
+ // 执行对应的事件函数
+ window.$viewer.flyToPosition(new DC.Position(item.twoPointPosition.lng, item.twoPointPosition.lat, 400, 0, -90, 0), () => {
+ speak(item.twoContent, () => {
+ cb()
+ })
+ }, 3)
+}
+
+const createLinePath = (item, cb = () => { }) => {
+ let polyline = new DC.Polyline(item.linePosition)
+ polyline.setStyle({
+ width: 20,
+ material: new DC.PolylineImageTrailMaterialProperty({
+ color: DC.Color.RED,
+ speed: 20,
+ image: VITE_APP_BASE + 'img/mapicon/right.png',
+ repeat: { x: 5, y: 1 }
+ }),
+ clampToGround: false
+ })
+
+ dynamicLineVectorLayer.addOverlay(polyline)
+
+ window.$viewer.flyToPosition(new DC.Position(item.lineCenter.lng, item.lineCenter.lat, 400, 0, -90, 0), () => {
+ lineTime = setTimeout(() => {
+ cb()
+ }, item.lineTime)
+ }, 3)
+}
const schemeStart = (item) => {
emit('closePanel')
@@ -259,6 +417,26 @@
// <p>特征污染物:${item.specificPollutant}</p>
)
dynamicHtmlLayer.addOverlay(oneCentent)
+
+ speak(item.oneCentent, () => {
+ if (item.key == 2) {
+ createLinePath(item, () => {
+ twoFun(item, () => {
+ publicFun(item)
+ })
+ })
+ } else if (item.key == 1) {
+ twoFun(item, () => {
+ createLinePath(item, () => {
+ publicFun(item)
+ })
+ })
+ } else {
+ twoFun(item, () => {
+ publicFun(item)
+ })
+ }
+ })
}
if (item.showModel) {
oneLoad()
@@ -268,144 +446,11 @@
}, 3)
}
}, item.onetime)
-
- item.linePosition && (lineTime = setTimeout(() => {
- let polyline = new DC.Polyline(item.linePosition)
- polyline.setStyle({
- width: 20,
- material: new DC.PolylineImageTrailMaterialProperty({
- color: DC.Color.RED,
- speed: 20,
- image: VITE_APP_BASE + 'img/mapicon/right.png',
- repeat: { x: 5, y: 1 }
- }),
- clampToGround: false
- })
-
- dynamicLineVectorLayer.addOverlay(polyline)
-
- window.$viewer.flyToPosition(new DC.Position(item.lineCenter.lng, item.lineCenter.lat, 400, 0, -90, 0), () => { }, 3)
- }, item.lineTime))
-
- timeTwo = setTimeout(() => {
- let twoCenter = DC.Position.fromObject(item.twoPointPosition)
- let twoCircle = new DC.Circle(twoCenter, 10)
- twoCircle.setStyle({
- material: new DC.CircleWaveMaterialProperty({
- color: DC.Color.fromRandom(),
- speed: 20,
- count: 5,
- gradient: 0.5
- })
- })
- dynamicVectorLayer.addOverlay(twoCircle)
-
- let twoContent = new DC.DivIcon(
- new DC.Position(item.twoPointPosition.lng, item.twoPointPosition.lat, 70),
- `<div class="dynamic-event-profile-map-popup">
- <div class="content-wrap">
- <div class="content">
- <p>${item.twoContent}</p>
- </div>
- </div>
- <div class="arrow"></div>
- </div>`
- // <p>特征污染物:${item.specificPollutant}</p>
- )
- dynamicHtmlLayer.addOverlay(twoContent)
- // 执行对应的事件函数
- window.$viewer.flyToPosition(new DC.Position(item.twoPointPosition.lng, item.twoPointPosition.lat, 400, 0, -90, 0), () => { }, 3)
- }, item.twotime)
-
- timeThree = setTimeout(() => {
- let threeCenter = DC.Position.fromObject(item.threePointPosition)
- let threeCircle = new DC.Circle(threeCenter, 30)
- threeCircle.setStyle({
- material: new DC.CircleWaveMaterialProperty({
- color: DC.Color.fromRandom(),
- speed: 20,
- count: 5,
- gradient: 0.5
- })
- })
- dynamicVectorLayer.addOverlay(threeCircle)
-
- let threeContent = new DC.DivIcon(
- new DC.Position(item.threePointPosition.lng, item.threePointPosition.lat, 70),
- `<div class="dynamic-map-popup">
- <div class="content-wrap">
- <div class="content">
- <p>${item.threeContent}</p>
- </div>
- </div>
- <div class="arrow"></div>
- </div>`
- )
- dynamicHtmlLayer.addOverlay(threeContent)
-
- window.$viewer.flyToPosition(new DC.Position(item.threePointPosition.lng, item.threePointPosition.lat, 400, 0, -90, 0), () => { }, 3)
- }, item.threetime)
-
- item.fourPointPosition && (timeFour = setTimeout(() => {
- let FourCenter = DC.Position.fromObject(item.fourPointPosition)
- let fourCircle = new DC.Circle(FourCenter, 10)
- fourCircle.setStyle({
- material: new DC.CircleWaveMaterialProperty({
- color: DC.Color.fromRandom(),
- speed: 20,
- count: 5,
- gradient: 0.5
- })
- })
- dynamicVectorLayer.addOverlay(fourCircle)
-
- let fourContent = new DC.DivIcon(
- new DC.Position(item.fourPointPosition.lng, item.fourPointPosition.lat, 70),
- `<div class="dynamic-event-profile-map-popup">
- <div class="content-wrap">
- <div class="content">
- <p>${item.fourContent}</p>
- </div>
- </div>
- <div class="arrow"></div>
- </div>`
- )
- dynamicHtmlLayer.addOverlay(fourContent)
- // 执行对应的事件函数
- window.$viewer.flyToPosition(new DC.Position(item.fourPointPosition.lng, item.fourPointPosition.lat, 400, 0, -90, 0), () => { }, 3)
- }, item.fourtime))
-
- item.fivePointPosition && (timeFive = setTimeout(() => {
- let fiveCenter = DC.Position.fromObject(item.fivePointPosition)
- let fiveCircle = new DC.Circle(fiveCenter, 10)
- fiveCircle.setStyle({
- material: new DC.CircleWaveMaterialProperty({
- color: DC.Color.fromRandom(),
- speed: 20,
- count: 5,
- gradient: 0.5
- })
- })
- dynamicVectorLayer.addOverlay(fiveCircle)
-
- let fiveContent = new DC.DivIcon(
- new DC.Position(item.fivePointPosition.lng, item.fivePointPosition.lat, 70),
- `<div class="dynamic-event-profile-map-popup">
- <div class="content-wrap">
- <div class="content">
- <p>${item.fiveContent}</p>
- </div>
- </div>
- <div class="arrow"></div>
- </div>`
- )
- dynamicHtmlLayer.addOverlay(fiveContent)
- // 执行对应的事件函数
- window.$viewer.flyToPosition(new DC.Position(item.fivePointPosition.lng, item.fivePointPosition.lat, 400, 0, -90, 0), () => { }, 3)
- }, item.fivetime))
}
const clearAll = () => {
+ window.speechSynthesis.cancel()
+
lineTime && (clearTimeout(lineTime), lineTime = null)
timeOne && (clearTimeout(timeOne), timeOne = null)
timeTwo && (clearTimeout(timeTwo), timeTwo = null)
--
Gitblit v1.9.3