From be9c1145fc79165142fbe29aacb04dd8e34dd23f Mon Sep 17 00:00:00 2001 From: guonan <guonan201020@163.com> Date: 星期二, 17 六月 2025 17:32:29 +0800 Subject: [PATCH] 避险场所以及完善弹窗详情 --- src/views/mnfz.vue | 99 +++++++++++++++++++++++-------------------------- 1 files changed, 47 insertions(+), 52 deletions(-) diff --git a/src/views/mnfz.vue b/src/views/mnfz.vue index f1ec1b4..5274d50 100644 --- a/src/views/mnfz.vue +++ b/src/views/mnfz.vue @@ -34,7 +34,11 @@ import DebuffTable from "@/components/tools/DebuffTable.vue"; import { getMaxInfluenceArea } from "@/api/index"; import { createPoint, geomToGeoJSON } from "@/utils/map.js"; -import { loadAreaPolygon, clearAreaPolygon } from "@/utils/area"; +import { + loadAreaPolygon, + clearAreaPolygon, + convertToGeoJson, +} from "@/utils/area"; import colors from "@/assets/img/left/colors3.png"; @@ -43,6 +47,7 @@ import { useSimStore } from "@/store/simulation"; import { storeToRefs } from "pinia"; +import { getSafePoint } from "@/api/hpApi"; const simStore = useSimStore(); const { rightRiverShow } = storeToRefs(simStore); @@ -139,51 +144,41 @@ dataSources.length = 0; } // 閬块櫓鍦烘墍锛岀豢鑹插瘜鏂囨湰 -function addTetrahedron(visible) { +async function addTetrahedron(visible) { const emergencyAreaList = []; - // 杩欓噷鏄坊鍔犻伩闄╁満鎵�搴曞眰闈㈢墖 - loadAreaPolygon("/json/emergency_area.geojson", true).then((entities) => { - emergencyAreaList.push(...entities); - }); - // console.log('polygon', polygon); - let list = [ - { - name: "灏瑰缓鍗庡", - longitude: 116.593517, - latitude: 40.568391, - altitude: 528.45, - }, - // { - // name: "鑼冩尟姹熷", - // longitude: 116.591059, - // latitude: 40.574068, - // altitude: 528, - // }, - // { - // name: "鍚庡潯", - // longitude: 116.597975, - // latitude: 40.558199, - // altitude: 528, - // }, - ]; - // 杩欓噷鏄坊鍔犻伩闄╁満鎵�瀵屾枃鏈珮浜樉绀� - 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" - ); - console.log("point", point); - emergencyAreaList.push(point); - }); - treeMap.set("閬块櫓鍦烘墍", emergencyAreaList); + try { + const res = await getSafePoint(); + + const geoJsonData = convertToGeoJson(res.data); + + // 鍔犺浇搴曞眰闈㈢墖锛堝杈瑰舰锛� + const polygonEntities = await loadAreaPolygon(geoJsonData, true); + emergencyAreaList.push(...polygonEntities); + + // 娣诲姞缁胯壊瀵屾枃鏈爣娉� + const textPromises = res.data.map(async (item) => { + const point = earthCtrl.factory.createRichTextPoint( + "閬块櫓鍦烘墍", + [item.lon , item.lat , 540], + { + distanceDisplayCondition: + new SmartEarth.Cesium.DistanceDisplayCondition(0, 2000), + fontColor: "#fff", + fontSize: 20, + }, + "0" + ); + emergencyAreaList.push(point); + }); + + await Promise.all(textPromises); + + // 灏嗙粨鏋滀繚瀛樺埌 treeMap + treeMap.set("閬块櫓鍦烘墍", emergencyAreaList); + } catch (error) { + console.error("鍔犺浇閬块櫓鍦烘墍澶辫触锛�", error); + } } // 鍒犻櫎閬块櫓鍦烘墍鐨勫瘜鏂囨湰瀹炰綋 function removeEmergencyPoints() { @@ -542,9 +537,9 @@ function playbackFinished(val) { isFinish.value = val; } -function isColorRender(val){ +function isColorRender(val) { // console.log('杩欓噷鎵撳嵃鏄惁鏄剧ず姘翠綅鍥句緥鐨勫�硷細',val); - isShowLegend.value = val + isShowLegend.value = val; } // 瀹氫箟鍏ㄥ眬鍙橀噺瀛樺偍褰撳墠姝e湪闂姩鐨勯潰鐗� let flashingPolygon = null; @@ -654,11 +649,11 @@ <style lang="less" scoped> @import url("../assets/css/home.css"); .legend { - // background: url("@/assets/img/right/rightbg.png"); - color: white; - position: fixed; - bottom: 6%; - right: 20%; - z-index: 3333; + // background: url("@/assets/img/right/rightbg.png"); + color: white; + position: fixed; + bottom: 6%; + right: 20%; + z-index: 3333; } </style> -- Gitblit v1.9.3