From 49c8b89710f806e3d4e50e86fb90a48baa54af01 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 20 Nov 2024 17:30:55 +0800
Subject: [PATCH] 突发事件模拟加载样式调整、内容语音播放
---
src/views/pd/components/dynamicPanel.vue | 162 ++++++++++++++++++++++++++++++------------------------
1 files changed, 90 insertions(+), 72 deletions(-)
diff --git a/src/views/pd/components/dynamicPanel.vue b/src/views/pd/components/dynamicPanel.vue
index 30a3c67..d76627c 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-15 19:32:16
+ * @LastEditTime: 2024-11-20 17:16:17
* @FilePath: \bigScreen\src\views\pd\components\dynamicPanel.vue
* @Description:
*
@@ -21,10 +21,10 @@
eventProfile: '2024年11月11日11时,南片区江西殷莱特化工有限公司松节油储罐泄漏,如不采取措施,将造成污染事故,影响到赣江下游水质。',
specificPollutantPosition: {
- lng: 115.10164229,
- lat: 27.27360951
+ lng: 115.10175740,
+ lat: 27.27356477
},
- specificPollutant: '松节油,无色至淡黄色油状液体,具有松香气味。 熔点:/ 沸点:154~170℃相对密度(水=1):0.85~0.87 饱和蒸气压(kPa):2.67(51.4℃)溶解性:不溶于水,溶于乙醇、氯仿、醚等多数有机溶剂。',
+ specificPollutant: '松节油,无色至淡黄色油状液体,具有松香气味。 熔点:无 沸点:154~170℃相对密度(水=1):0.85~0.87 饱和蒸气压(kPa):2.67(51.4℃)溶解性:不溶于水,溶于乙醇、氯仿、醚等多数有机溶剂。',
transitPointPosition: {
lng: 115.10231042,
@@ -32,8 +32,8 @@
},
wastewaterTreatmentPosition: {
- lng: 115.10815397,
- lat: 27.27212251
+ lng: 115.10814596,
+ lat: 27.27257473
},
wastewaterTreatment: '事故应急结束后,应急指挥部组织专家评估组指导企业对受污染的废水进入废水处理中站进行处理,对公共应急池的事故废水进行水质监测,分析水质达标情况,并研判处理处置方式,在确保安全的情况下转转输至绿源污水处理厂处理。'
},
@@ -56,8 +56,8 @@
},
wastewaterTreatmentPosition: {
- lng: 115.10815397,
- lat: 27.27212251
+ lng: 115.10814596,
+ lat: 27.27257473
},
wastewaterTreatment: '将拦截废水从应急池中通过北区污水提升泵站转移至绿源污水处理厂进行处置,同时在排口下游展开应急监测,确保废水没有进入周边水系。'
},
@@ -80,29 +80,29 @@
},
wastewaterTreatmentPosition: {
- lng: 115.10815397,
- lat: 27.27212251
+ lng: 115.10814596,
+ lat: 27.27257473
},
wastewaterTreatment: '对转输至企业应急空间的事故废水进行水质监测,分析水质达标情况,并研判处理处置方式,在确保安全的情况下加药处理或者排入企业废水处理站处理'
},
]
})
-let timeO = null
-let timeT = null
-let timeThree = null
+
+let isSpeaking = false
const dynamicVectorLayer = new DC.VectorLayer('dynamicVectorLayer').addTo(window.$viewer)
const dynamicHtmlLayer = new DC.HtmlLayer('dynamicHtmlLayer').addTo(window.$viewer)
const schemeStart = (item) => {
emit('closePanel')
clearAll()
-
let center = DC.Position.fromObject(item.specificPollutantPosition)
let circle = new DC.Circle(center, 20)
circle.setStyle({
- material: new DC.CircleDiffuseMaterialProperty({
- color: DC.Color.RED.withAlpha(0.2),
- speed: 2.0
+ material: new DC.CircleWaveMaterialProperty({
+ color: DC.Color.RED.withAlpha(0.9),
+ speed: 20,
+ count: 5,
+ gradient: 0.5
})
})
dynamicVectorLayer.addOverlay(circle)
@@ -113,7 +113,8 @@
<div class="content-wrap">
<div class="title">事件概况</div>
<div class="content">
- ${item.eventProfile}
+ <p>${item.eventProfile}</p>
+ <p>特征污染物:${item.specificPollutant}</p>
</div>
</div>
<div class="arrow"></div>
@@ -121,70 +122,87 @@
)
dynamicHtmlLayer.addOverlay(divContent)
- window.$viewer.flyToPosition(new DC.Position(item.specificPollutantPosition.lng, item.specificPollutantPosition.lat, 400, 0, -90, 0), () => { }, 3)
+ window.$viewer.flyToPosition(new DC.Position(item.specificPollutantPosition.lng, item.specificPollutantPosition.lat, 400, 0, -90, 0), () => {
+ const utterance = new SpeechSynthesisUtterance(`事件概况:${item.eventProfile}特征污染物:${item.specificPollutant}`)
- timeO = setTimeout(() => {
- let divIcon = new DC.DivIcon(
- new DC.Position(item.specificPollutantPosition.lng, item.specificPollutantPosition.lat, 70),
- `<div class="dynamic-map-popup">
- <div class="title">特征污染物</div>
- <div class="content">
- ${item.specificPollutant}
- </div>
- </div>`
- )
- dynamicHtmlLayer.addOverlay(divIcon)
- }, 5000)
+ isSpeaking = true
- timeT = setTimeout(() => {
- window.$viewer.flyToPosition(new DC.Position(item.transitPointPosition.lng, item.transitPointPosition.lat, 400, 0, -90, 0), () => {
+ utterance.onend = () => {
+ isSpeaking = false
- let centerT = DC.Position.fromObject(item.transitPointPosition)
- let circleT = new DC.Circle(centerT, 20)
- circleT.setStyle({
- material: new DC.CircleWaveMaterialProperty({
- color: DC.Color.fromRandom(),
- speed: 20,
- count: 5,
- gradient: 0.5
+ // 执行对应的事件函数
+ window.$viewer.flyToPosition(new DC.Position(item.transitPointPosition.lng, item.transitPointPosition.lat, 400, 0, -90, 0), () => {
+
+ let centerT = DC.Position.fromObject(item.transitPointPosition)
+ let circleT = new DC.Circle(centerT, 10)
+ circleT.setStyle({
+ material: new DC.CircleWaveMaterialProperty({
+ color: DC.Color.fromRandom(),
+ speed: 20,
+ count: 5,
+ gradient: 0.5
+ })
})
- })
- dynamicVectorLayer.addOverlay(circleT)
+ dynamicVectorLayer.addOverlay(circleT)
- }, 3)
- }, 10000)
+ const utteranceTow = new SpeechSynthesisUtterance('')
- timeThree = setTimeout(() => {
- window.$viewer.flyToPosition(new DC.Position(item.wastewaterTreatmentPosition.lng, item.wastewaterTreatmentPosition.lat, 400, 0, -90, 0), () => {
- let centerThree = DC.Position.fromObject(item.wastewaterTreatmentPosition)
- let circleThree = new DC.Circle(centerThree, 30)
- circleThree.setStyle({
- classificationType: 0,
- material: new DC.CircleSpiralMaterialProperty({
- color: DC.Color.BLUE.withAlpha(0.2),
- speed: 8.0
- })
- })
- dynamicVectorLayer.addOverlay(circleThree)
+ isSpeaking = true
- let divIconT = new DC.DivIcon(
- new DC.Position(item.wastewaterTreatmentPosition.lng, item.wastewaterTreatmentPosition.lat, 70),
- `<div class="dynamic-map-popup">
- <div class="title">绿源进水口</div>
- <div class="content">
- ${item.wastewaterTreatment}
- </div>
- </div>`
- )
- dynamicHtmlLayer.addOverlay(divIconT)
- }, 3)
- }, 15000)
+ utteranceTow.onend = () => {
+ isSpeaking = false
+
+ window.$viewer.flyToPosition(new DC.Position(item.wastewaterTreatmentPosition.lng, item.wastewaterTreatmentPosition.lat, 400, 0, -90, 0), () => {
+ let centerThree = DC.Position.fromObject(item.wastewaterTreatmentPosition)
+ let circleThree = new DC.Circle(centerThree, 30)
+ circleThree.setStyle({
+ classificationType: 0,
+ material: new DC.CircleSpiralMaterialProperty({
+ color: DC.Color.BLUE.withAlpha(0.2),
+ speed: 8.0
+ })
+ })
+ dynamicVectorLayer.addOverlay(circleThree)
+
+ let divIconT = new DC.DivIcon(
+ new DC.Position(item.wastewaterTreatmentPosition.lng, item.wastewaterTreatmentPosition.lat, 70),
+ `<div class="dynamic-map-popup">
+ <div class="content-wrap">
+ <div class="title">绿源进水口</div>
+ <div class="content">
+ <p>${item.wastewaterTreatment}</p>
+ </div>
+ </div>
+ <div class="arrow"></div>
+ </div>`
+ )
+ dynamicHtmlLayer.addOverlay(divIconT)
+
+ const utteranceThree = new SpeechSynthesisUtterance(item.wastewaterTreatment)
+
+ isSpeaking = true
+
+ utteranceThree.onend = () => {
+ isSpeaking = false
+ }
+
+ window.speechSynthesis.speak(utteranceThree)
+ }, 3)
+ }
+
+ window.speechSynthesis.speak(utteranceTow)
+ }, 3)
+ }
+
+ window.speechSynthesis.speak(utterance)
+ }, 3)
}
const clearAll = () => {
- clearTimeout(timeO)
- clearTimeout(timeT)
- clearTimeout(timeThree)
+ if (isSpeaking) {
+ window.speechSynthesis.cancel()
+ }
+
dynamicVectorLayer.clear()
dynamicHtmlLayer.clear()
}
--
Gitblit v1.9.3