| | |
| | | <template> |
| | | <Left @start="startSimulate" @end="endSimulate" /> |
| | | <echartInfo :isDynamicMode="isDynamicMode" :isFinish="isFinish" v-if="loadingSim" /> |
| | | <TimeLine v-if="showWaterSimulate" @time-update="timeUpdate" @is-playing="isPlaying" |
| | | :waterSimulateParams="waterSimulateParams" @playbackFinished="playbackFinished" @end="endSimulate" /> |
| | | <DebuffDetail v-if="showDebuffDetail" @open="openDetail" @close="showDebuffDetail = false" /> |
| | | <echartInfo |
| | | :isDynamicMode="isDynamicMode" |
| | | :isFinish="isFinish" |
| | | v-if="rightRiverShow" |
| | | /> |
| | | <TimeLine |
| | | v-if="showWaterSimulate" |
| | | @time-update="timeUpdate" |
| | | @is-playing="isPlaying" |
| | | :waterSimulateParams="waterSimulateParams" |
| | | @playbackFinished="playbackFinished" |
| | | @end="endSimulate" |
| | | /> |
| | | <DebuffDetail |
| | | v-if="showDebuffDetail" |
| | | @open="openDetail" |
| | | @close="showDebuffDetail = false" |
| | | /> |
| | | <DebuffTable v-if="showDebuffTable" @close="closeDebuffTable" /> |
| | | </template> |
| | | |
| | |
| | | import { createPoint, geomToGeoJSON } from "@/utils/map.js"; |
| | | import { loadAreaPolygon, clearAreaPolygon } from "@/utils/area"; |
| | | |
| | | import colors from "@/assets/img/left/colors3.png"; |
| | | import danger from "@/assets/img/left/danger.png"; |
| | | import { checkedKeys } from "@/store/index"; |
| | | |
| | | |
| | | import { useSimStore } from "@/store/simulation"; |
| | | import { storeToRefs } from "pinia"; |
| | | const simStore = useSimStore(); |
| | | const { rightRiverShow } = storeToRefs(simStore); |
| | | |
| | | |
| | | const waterSimulateParams = ref({}); |
| | | const showWaterSimulate = ref(false); |
| | | const showDebuffDetail = ref(false); |
| | | const showDebuffTable = ref(false); |
| | | const isDynamicMode = ref(false); |
| | | const isFinish = ref(true); |
| | | const loadingSim = ref(false); |
| | | |
| | | const treeMap = new Map(); |
| | | |
| | | |
| | | |
| | | |
| | | // 提供方法给所有子组件 |
| | | provide("simulateActions", { |
| | |
| | | function startSimulate(form) { |
| | | // console.log("form", form); |
| | | showWaterSimulate.value = true; |
| | | loadingSim.value = true |
| | | rightRiverShow.value = true; |
| | | waterSimulateParams.value = form; |
| | | } |
| | | function endSimulate() { |
| | | loadingSim.value = false |
| | | showDebuffDetail.value = false |
| | | rightRiverShow.value = false; |
| | | showDebuffDetail.value = false; |
| | | clearTrailLine(); |
| | | removeEmergencyPoints() |
| | | removeEmergencyPoints(); |
| | | removeDataSources(); |
| | | setTimeout(() => { |
| | | showWaterSimulate.value = false; |
| | |
| | | scale: 1.0, |
| | | verticalOrigin: Cesium.VerticalOrigin.BOTTOM, |
| | | heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, |
| | | distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 1500), |
| | | distanceDisplayCondition: new Cesium.DistanceDisplayCondition( |
| | | 0, |
| | | 1500 |
| | | ), |
| | | }, |
| | | }); |
| | | dataSource.entities.add(billboardEntity); |
| | |
| | | }); |
| | | await Promise.all(loadPromises); |
| | | setupRowClickListener(dataSources); |
| | | } catch (error) { |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | // 清除隐患点 |
| | | function removeDataSources() { |
| | |
| | | ]; |
| | | // 这里是添加避险点富文本高亮显示 |
| | | list.forEach((item) => { |
| | | let point = earthCtrl.factory.createRichTextPoint("避险点", [item.longitude, item.latitude, item.altitude - 10], { |
| | | distanceDisplayCondition: new SmartEarth.Cesium.DistanceDisplayCondition(0, 2000), |
| | | fontColor: "#ffffff", |
| | | fontSize: 20 |
| | | }, "0"); |
| | | let point = earthCtrl.factory.createRichTextPoint( |
| | | "避险点", |
| | | [item.longitude, item.latitude, item.altitude - 10], |
| | | { |
| | | distanceDisplayCondition: |
| | | new SmartEarth.Cesium.DistanceDisplayCondition(0, 2000), |
| | | fontColor: "#ffffff", |
| | | fontSize: 20, |
| | | }, |
| | | "0" |
| | | ); |
| | | console.log("point", point); |
| | | emergencyAreaList.push(point); |
| | | }); |
| | |
| | | const emergencyAreaList = treeMap.get("避险点"); // 获取存储的避险点实体列表 |
| | | if (emergencyAreaList && emergencyAreaList.length > 0) { |
| | | emergencyAreaList.forEach((entity) => { |
| | | if (entity && typeof entity.deleteObject === 'function') { |
| | | if (entity && typeof entity.deleteObject === "function") { |
| | | // 如果有 deleteObject 方法,优先调用 |
| | | entity.deleteObject(); |
| | | } else if (entity && typeof entity.clear === 'function') { |
| | | } else if (entity && typeof entity.clear === "function") { |
| | | // 如果有 clear 方法,调用 clear |
| | | entity.clear(); |
| | | } else if (entity && earthCtrl && earthCtrl.coreMap) { |
| | |
| | | } |
| | | } |
| | | |
| | | let TrailLine = []; |
| | | async function showLine() { |
| | | const position = [ |
| | | { |
| | | x: -2172540.8322597803, |
| | | y: 4339064.62665997, |
| | | z: 4126183.3895281963, |
| | | }, |
| | | { |
| | | x: -2172480.18394144, |
| | | y: 4339033.15167176, |
| | | z: 4126240.9529584926, |
| | | }, |
| | | { |
| | | x: -2172454.114348403, |
| | | y: 4339020.0398392705, |
| | | z: 4126261.946960697, |
| | | }, |
| | | { |
| | | x: -2172377.9670952093, |
| | | y: 4338976.609385458, |
| | | z: 4126333.862357211, |
| | | }, |
| | | { |
| | | x: -2172299.4142002705, |
| | | y: 4338951.971578909, |
| | | z: 4126397.5205803993, |
| | | }, |
| | | { |
| | | x: -2172245.1703274297, |
| | | y: 4338940.86037857, |
| | | z: 4126436.276389208, |
| | | }, |
| | | { |
| | | x: -2172176.7332184147, |
| | | y: 4338930.525741544, |
| | | z: 4126477.629952572, |
| | | }, |
| | | { |
| | | x: -2172173.8151051304, |
| | | y: 4338939.043883864, |
| | | z: 4126469.336927342, |
| | | }, |
| | | { |
| | | x: -2172173.7151194704, |
| | | y: 4338939.023235937, |
| | | z: 4126469.4107743693, |
| | | }, |
| | | ]; |
| | | let LineInterpolation = earthCtrl.core.LineInterpolation(earthCtrl.coreMap, { |
| | | positions: position, |
| | | num: 50, |
| | | getHeight: true, |
| | | // 避险路线 |
| | | let pathLayer = null; // 存储创建的图层 |
| | | function showLine() { |
| | | // 创建新图层 |
| | | pathLayer = earthCtrl.factory.createPathLayer({ |
| | | url: "/json/line.json", |
| | | color: "#0033FF", |
| | | width: 15.0, |
| | | pointColor: "#FFFFFF", |
| | | speed: 2, |
| | | far: 50000, |
| | | }); |
| | | // console.log(LineInterpolation.height, "A"); |
| | | |
| | | let min = LineInterpolation.height; |
| | | let max = min.map((item) => { |
| | | return item + 35; |
| | | }); |
| | | |
| | | console.log(min, max); |
| | | |
| | | let _TrailLine = earthCtrl.factory.createTrailLineWall( |
| | | LineInterpolation.positions, |
| | | { |
| | | maximumHeights: max, |
| | | minimumHeights: min, |
| | | color: "#ffffff", //线颜色(可选) |
| | | url: colors, |
| | | } |
| | | ); |
| | | TrailLine.push(_TrailLine); |
| | | } |
| | | // 清除轨迹线对象 |
| | | |
| | | // 清除避险路线 |
| | | function clearTrailLine() { |
| | | TrailLine.forEach((item, index) => { |
| | | if (item && typeof item.deleteObject === 'function') { |
| | | item.deleteObject(); |
| | | } else if (item && typeof item.clear === 'function') { |
| | | item.clear(); |
| | | } else if (item && earthCtrl && earthCtrl.coreMap) { |
| | | earthCtrl.coreMap.entities.remove(item); |
| | | } |
| | | }); |
| | | TrailLine = []; |
| | | if (pathLayer) { |
| | | pathLayer.clear(); |
| | | } |
| | | // if (item && typeof item.deleteObject === "function") { |
| | | // item.deleteObject(); |
| | | // } else if (item && typeof item.clear === "function") { |
| | | // item.clear(); |
| | | // } else if (item && earthCtrl && earthCtrl.coreMap) { |
| | | // earthCtrl.coreMap.entities.remove(item); |
| | | // } |
| | | // }); |
| | | // pathLayer = []; |
| | | } |
| | | function timeUpdate(percentage) { |
| | | if (percentage > 99) { |
| | |
| | | // 切换颜色(例如红色和原始颜色交替) |
| | | const currentTime = Date.now(); |
| | | const flashColor = Cesium.Color.RED.withAlpha(1); // 闪动颜色 |
| | | return Math.floor(currentTime / 500) % 2 === 0 ? flashColor : originalColor; |
| | | return Math.floor(currentTime / 500) % 2 === 0 |
| | | ? flashColor |
| | | : originalColor; |
| | | }, false) |
| | | ); |
| | | // 将闪动状态保存到实体上,便于后续控制 |
| | |
| | | function stopFlashing(polygonEntity) { |
| | | // 恢复原始颜色 |
| | | const originalColor = polygonEntity._originalColor || Cesium.Color.WHITE; // 如果没有原始颜色,默认使用白色 |
| | | polygonEntity.polygon.material = new Cesium.ColorMaterialProperty(originalColor); |
| | | polygonEntity.polygon.material = new Cesium.ColorMaterialProperty( |
| | | originalColor |
| | | ); |
| | | // 清空闪动状态 |
| | | polygonEntity._isFlashing = false; |
| | | polygonEntity._originalColor = null; // 清除保存的原始颜色 |
| | | } |
| | | onMounted(() => { |
| | | setupRowClickListener() |
| | | setupRowClickListener(); |
| | | getMaxInfluenceAreaData(); |
| | | }); |
| | | onUnmounted(() => { |
| | | endSimulate(); |
| | | }); |
| | | // // 转换坐标系,笛卡尔坐标转为WGS48 |
| | | // const positions = [[-2171569.1995107993, 4338474.198855222, 4127198.938949332]]; |
| | | // const wgs84Positions = positions.map((xyz) => { |
| | | // const cartesian = Cesium.Cartesian3.fromArray(xyz); |
| | | // const cartographic = Cesium.Cartographic.fromCartesian(cartesian); |
| | | |
| | | // // 弧度转角度 |
| | | // const lon = Cesium.Math.toDegrees(cartographic.longitude); |
| | | // const lat = Cesium.Math.toDegrees(cartographic.latitude); |
| | | // const height = cartographic.height; // 单位:米 |
| | | |
| | | // return [lon, lat, height]; |
| | | // }); |
| | | </script> |
| | | <style lang="less" scoped> |
| | | @import url("../assets/css/home.css"); |