src/assets/img/tools/tools_second/大气散射.png | 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/components/tools/Dam.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/components/tools/Ditching.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/components/tools/SunAnalysis.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/components/tools/Tools.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/utils/tools.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/GisView.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/left/KGSim.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/assets/img/tools/tools_second/´óÆøÉ¢Éä.png
src/components/tools/Dam.vue
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,53 @@ <template> <div class="custom-panel"> <div class="panel-content"> <el-switch v-model="isDamEnabled" active-text="弿å¼å¯" inactive-text="å¼æå ³é" @change="handleSwitchChange" /> </div> </div> </template> <script setup> import { ref } from 'vue'; import { ElSwitch } from 'element-plus'; const isDamEnabled = ref(false); function handleDamOn() { console.log('弿åè½å·²å¼å¯'); earthCtrl.factory.createModelLibrary() } // å¼å ³å ³éæ¶æ§è¡ç彿° function handleDamOff() { console.log('弿åè½å·²å ³é'); } // çå¬ switch åå function handleSwitchChange(value) { if (value) { handleDamOn(); } else { handleDamOff(); } } </script> <style scoped> .custom-panel { padding: 20px; width: 290px; background: url("@/assets/img/tools/plotting_new.png") no-repeat; filter: opacity(83%); background-size: 100% 100%; box-sizing: border-box; } .panel-content { display: flex; flex-direction: column; } </style> src/components/tools/Ditching.vue
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,137 @@ <template> <div class="custom-panel"> <div class="panel-content"> <!-- å¼ææ·±åº¦è®¾ç½® --> <el-form :model="form" label-width="80px"> <el-form-item label="å¼ææ·±åº¦"> <el-input v-model="form.digDepth" placeholder="请è¾å ¥å¼ææ·±åº¦(m)" /> </el-form-item> </el-form> <!-- æé®åºå --> <div class="button-group"> <el-button type="primary" @click="handleDraw">ç»å¶</el-button> <el-button type="success" @click="handleConfirm">确认</el-button> <el-button type="danger" @click="handleClear">æ¸ é¤</el-button> </div> </div> </div> </template> <script setup> import { ref, reactive, watch, defineEmits } from 'vue'; import { ElForm, ElFormItem, ElInput, ElButton, ElMessage } from 'element-plus'; const emit = defineEmits(['update-excavation-data']); const form = reactive({ digDepth: '100' }); let excavationInstance = null; const currentPoints = reactive([]); const isDrawing = ref(false); let clickHandler = null; const handleDraw = () => { if (!window.viewer) { console.error('Cesium Viewer å°æªåå§å'); return; } const viewer = window.viewer; // æ¸ ç©ºä¹åçæ°æ® currentPoints.splice(0, currentPoints.length); isDrawing.value = true; // 鿝æ§ççå¬å¨ if (clickHandler) { clickHandler.destroy(); } // ç«å³åå»ºå¼æå¯¹è±¡ï¼ä¸ä¾èµåå§ç¹ï¼ createExcavation(); // å¼å§çå¬ç¹å»äºä»¶ clickHandler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); clickHandler.setInputAction((movement) => { const cartesian = viewer.camera.pickEllipsoid(movement.position, viewer.scene.globe.ellipsoid); if (cartesian) { currentPoints.push(cartesian.clone()); } }, Cesium.ScreenSpaceEventType.LEFT_CLICK); }; const createExcavation = () => { const depth = parseFloat(form.digDepth); if (!isNaN(depth)) { excavationInstance = window.earthCtrl.analysis.createTerrainExcavation({ height: depth, callback: function (a) { }, }); }else{ ElMessage.warning('请è¾å ¥ææçå¼ææ·±åº¦ï¼'); } }; watch( () => form.digDepth, (newVal) => { const num = parseFloat(newVal); if (!isNaN(num) && excavationInstance) { excavationInstance.setDeepth?.(num); } } ); // ç¹å»ç¡®è®¤æé®ï¼æå°å½ååæ ç¹éååæ·±åº¦ï¼ const handleConfirm = () => { if (currentPoints.length === 0) { ElMessage.warning('请éå弿²ææçåæ ç¹ï¼'); return; } const depth = parseFloat(form.digDepth); // 转æ¢ä¸ºæ®é对象æ°ç» const plainPoints = currentPoints.map(point => ({ x: point.x, y: point.y, z: point.z })); const result = { points: plainPoints, depth: depth }; emit('update-excavation-data', result); }; const handleClear = () => { isDrawing.value = false; // 鿝ç¹å»äºä»¶çå¬å¨ if (clickHandler) { clickHandler.destroy(); clickHandler = null; } // æ¸ ç©ºä¸´æ¶ç¹ currentPoints.splice(0, currentPoints.length); // ç§»é¤å¼æå¯¹è±¡ if (excavationInstance) { excavationInstance.removeFromMap?.(); excavationInstance = null; } }; </script> <style scoped> .custom-panel { padding: 20px; width: 290px; background: url("@/assets/img/tools/plotting_new.png") no-repeat; filter: opacity(83%); background-size: 100% 100%; box-sizing: border-box; } .panel-content { display: flex; flex-direction: column; } .button-group { display: flex; justify-content: space-around; } </style> src/components/tools/SunAnalysis.vue
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,71 @@ <template> <div class="settings-panel"> <el-form :model="form" label-width="80px" class="terrain-settings"> <el-form-item label="渲æå¤§å°"> <el-select v-model="form.renderSize" placeholder="è¯·éæ©"> <el-option v-for="item in sizeOptions" :key="item.value" :label="item.label" :value="item.value"></el-option> </el-select> </el-form-item> <el-form-item label="é ç½®é项"> <el-switch v-model="form.lightShadow" active-text="å æºé´å½±"></el-switch> <el-switch v-model="form.softShadow" active-text="软é´å½±"></el-switch> </el-form-item> <el-button type="primary" @click="analyzeShadows">é´å½±åæ</el-button> </el-form> </div> </template> <script setup> import { reactive, watch } from "vue"; import mapUtils from "@/utils/tools.js"; // å®ä¹è¡¨åæ°æ® const form = reactive({ renderSize: '1024px X 1024px', // é»è®¤æ¸²æå¤§å° lightShadow: true, // é»è®¤å¼å¯å æºé´å½± softShadow: true, // é»è®¤å ³é软é´å½± }); // 渲æå¤§å°é项 const sizeOptions = [ { value: '2048px X 2048px', label: '2048px X 2048px' }, { value: '1024px X 1024px', label: '1024px X 1024px' }, { value: '512px X 512px', label: '512px X 512px' }, { value: '256px X 256px', label: '256px X 256px' }, ]; // é´å½±åææé®ç¹å»äºä»¶ const analyzeShadows = () => { let currentTime = earthCtrl.viewer.clock.currentTime.clone(); let startTime = earthCtrl.viewer.clock.startTime.clone(); let stopTime = earthCtrl.viewer.clock.stopTime.clone(); let multiplier = earthCtrl.viewer.clock.multiplier; console.log('é´å½±åæ'); mapUtils.AnalysisSunshine() }; </script> <style lang="less" scoped> .settings-panel { padding: 20px; width: 350px; background: url("@/assets/img/tools/plotting_new.png") no-repeat; filter: opacity(83%); background-size: 100% 100%; box-sizing: border-box; } .terrain-settings { .el-form-item { margin-bottom: 10px; } .el-select, .el-switch { margin-right: 10px; } .el-button { width: 100%; margin-top: 10px; } } </style> src/components/tools/Tools.vue
@@ -4,16 +4,17 @@ <div class="tools-title" @click="toggleCollapse"> å·¥å ·æ <div class="popup-menu" v-if="isPopupVisible"> <div class="popup-item" v-for="(option, idx) in currentToolOptions" :key="idx" @click="handleOptionClick(option)"> <img class="popup-icon" :src=" require(`../../assets/img/tools/tools_second/${option.icon}.png`) <div class="popup-item" v-for="(option, idx) in currentToolOptions" :key="idx" @click="handleOptionClick(option)"> <img class="popup-icon" :src="require(`../../assets/img/tools/tools_second/${option.icon}.png`) " :alt="option.name" /> {{ option.name }} </div> </div> <LayerTree class="popup-menu" v-show="showLayerTree" /> <!-- å¯è§ååæ --> <seeAnalyze :option="option" v-show="seeAnalyzeShow" @update:showConeLine="handleUpdateShowConeLine" @update-option="onUpdateOption" @draw="onDraw" @clear="onClear" class="popup-menu-see" /> <seeAnalyze :option="option" v-show="seeAnalyzeShow" @update:showConeLine="handleUpdateShowConeLine" @update-option="onUpdateOption" @draw="onDraw" @clear="onClear" class="popup-menu-see" /> <!-- å颿å --> <TopographyDia @draw="handleDraw" @clear="handleClear" class="popup-menu-see" v-show="topographyShow" /> <!-- å颿åçecharts --> @@ -21,11 +22,14 @@ <div id="echartsView1" style="width: 100%; height: 100%"></div> </div> <!-- å¡åº¦å¡ååæ --> <Aspect v-show="showAspect" @draw="SlopeArrow" @clear="SlopeArrowClose" @handleaspect="handleaspect" @handleSlope="handleSlope" class="popup-menu-see" /> <SlopeAnalysis @draw="SlopeAnalysiss" v-show="isContourLabel" class="popup-menu-see" @update-slope="onUpdateSlope" /> <Aspect v-show="showAspect" @draw="SlopeArrow" @clear="SlopeArrowClose" @handleaspect="handleaspect" @handleSlope="handleSlope" class="popup-menu-see" /> <SlopeAnalysis @draw="SlopeAnalysiss" v-show="isContourLabel" class="popup-menu-see" @update-slope="onUpdateSlope" /> <!-- é¨ --> <Rain v-show="showRain" class="popup-menu-see" @update-rain="onUpdateRain" /> <Snow v-show="showSnow" class="popup-menu-see" @update-snow="onUpdateSnow" /> <SunAnalysis v-show="showSunAnalysis" class="popup-menu-see"></SunAnalysis> </div> <!-- å·¥å ·æ å 容 --> @@ -49,9 +53,10 @@ import mapUtils from "@/utils/tools.js"; import Rain from "@/components/tools/Rain.vue"; import Snow from "@/components/tools/Snow.vue"; import SunAnalysis from "@/components/tools/SunAnalysis.vue"; // 忢å±å¼/æ¶ç¼©ç¶æ function toggleCollapse () { function toggleCollapse() { // isCollapsed.value = !isCollapsed.value; } @@ -66,6 +71,8 @@ const isContourLabel = ref(false); const showRain = ref(false); const showSnow = ref(false); const showAtmosphere = ref(false); const showSunAnalysis = ref(false); // åé¢åæå¼¹çª const topographyShow = ref(false); @@ -141,12 +148,14 @@ { name: "é¨å¤©æ¨¡å¼", icon: "é¨å¤©æ¨¡å¼" }, { name: "éªå¤©æ¨¡å¼", icon: "éªå¤©æ¨¡å¼" }, { name: "æ¸ é¤å¤©æ°", icon: "æ¸ é¤åæ" }, { name: "å¤§æ°æ£å°", icon: "å¤§æ°æ£å°" }, { name: "æ¥ç §åæ", icon: "å¤§æ°æ£å°" }, ], }, ]); // å¤çå·¥å ·ç¹å»äºä»¶ function handleClick (tool, event) { function handleClick(tool, event) { // éåå·¥å ·åè¡¨ï¼æ´æ°æ¿æ´»ç¶æ toolList.value.forEach((item) => { item.active = item.name === tool.name && currentToolOptions.value !== tool.options; @@ -188,7 +197,7 @@ const currentOption = ref(null); // å¤çå¼¹çªé项ç¹å»äºä»¶ function handleOptionClick (option) { function handleOptionClick(option) { isPopupVisible.value = false; currentOption.value = option.name; console.log("Selected option:", currentOption.value); @@ -212,6 +221,22 @@ console.log("å¤©æ°ææå·²æ¸ é¤"); } else { console.log("没ææå¼çå¤©æ°ææ"); } }, å¤§æ°æ£å°: () => { showAtmosphere.value = !showAtmosphere.value if (showAtmosphere.value) { mapUtils.enableAtmosphere() } else { mapUtils.disableAtmosphere() } }, æ¥ç §åæ: () => { showSunAnalysis.value = !showSunAnalysis.value if (showSunAnalysis.value) { // mapUtils.AnalysisSunshine() } else { // mapUtils.disableAtmosphere() } }, @@ -292,13 +317,13 @@ }; // å¤çåç»ä»¶ä¼ æ¥çå¯è§åæ¾ç¤ºé¥çº¿çå¼ function handleUpdateShowConeLine (value) { function handleUpdateShowConeLine(value) { showConeLine.value = value; mapUtils.showSyfxViewCone(showConeLine.value); } // é¼ æ ç»å¶å¯è§å function onDraw () { function onDraw() { // å®ä¹åè°å½æ°ï¼ç¨äºæ¥æ¶ res å¹¶æ´æ° option const callback = (res) => { option.heading = res.heading; @@ -309,7 +334,7 @@ } // æ¸ é¤å¯è§å function onClear () { function onClear() { mapUtils.syfxqc(option); } src/utils/tools.js
@@ -299,7 +299,7 @@ polyline: Cesium.Color.fromCssColorString("#ffff0050"), polygon: Cesium.Color.fromCssColorString("#ffff0050"), }, (e) => { } (e) => {} ); }, qxcl() { @@ -309,7 +309,7 @@ polyline: Cesium.Color.fromCssColorString("#ffff0050"), polygon: Cesium.Color.fromCssColorString("#ffff0050"), }, (e) => { } (e) => {} ); }, fwjcl() { @@ -319,7 +319,7 @@ polyline: Cesium.Color.fromCssColorString("#ffff0050"), polygon: Cesium.Color.fromCssColorString("#ffff0050"), }, (e) => { } (e) => {} ); }, // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>åºæ¯æªå¾<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @@ -929,7 +929,7 @@ }; this.analysisFlood = earthCtrl.analysis.createSubmergence( method, (value) => { } (value) => {} ); }, clearFlood() { @@ -962,6 +962,12 @@ this.contourLabel.showContourLabel(false); } }, enableAtmosphere() { earthCtrl.atmosphere.enable(); }, disableAtmosphere() { earthCtrl.atmosphere.disable(); }, }; export default mapUtils; src/views/GisView.vue
@@ -27,15 +27,17 @@ // 1. 设置åå§æ¶é´ const date = new Date(2025, 3, 11, 12, 0, 0, 0); // const date = new Date(2024, 6, 13, 5, 5, 50); const julianDate = SmartEarth.Cesium.JulianDate.fromDate(date); // earthCtrl.viewer.clock.currentTime = julianDate; // 2. é ç½®æ¶éé项ï¼ç¦æ¢èªå¨æ¨è¿æ¶é´ // // 2. é ç½®æ¶éé项ï¼ç¦æ¢èªå¨æ¨è¿æ¶é´ earthCtrl.viewer.clockViewModel.shouldAnimate = false; // ç¦ç¨å¨ç» earthCtrl.viewer.clockViewModel.clockRange = SmartEarth.Cesium.ClockRange.CLAMPED; // éå¶æ¶é´èå´ earthCtrl.viewer.clockViewModel.multiplier = 0; // 设置æ¶é´æ¨è¿é度为0 // å¼å¯å¤§æ°æ£å°ææ // earthCtrl.atmosphere.enable(); // 3. 设置å½åæ¶é´å¹¶éå® earthCtrl.viewer.clock.currentTime = julianDate; src/views/left/KGSim.vue
@@ -3,29 +3,21 @@ <!-- 模æåºå --> <div class="simulation-area"> <p>模æåºå</p> <el-select v-model="selectedArea" placeholder="è¯·éæ©" style="max-width: 600px" popper-class="mySelectStyle" filterable :filter-method="filterOptions" @change="handleSelectChange" > <el-option v-for="item in filteredOptions" :key="item.value" :label="item.label" :value="item" /> <el-select v-model="selectedArea" placeholder="è¯·éæ©" style="max-width: 600px" popper-class="mySelectStyle" filterable :filter-method="filterOptions" @change="handleSelectChange"> <el-option v-for="item in filteredOptions" :key="item.value" :label="item.label" :value="item" /> </el-select> </div> <!-- æ²»çå·¥ç¨æ ç» --> <div class="engineering-buttons"> <p>æ²»çå·¥ç¨æ ç»</p> <el-button type="primary" @click="handleStart">弿²</el-button> <el-button type="success" @click="handleAdd">å å</el-button> <el-button type="primary" @click="toggleDitch"> {{ ditchingActive ? "å ³é弿²" : "å¼å¯å¼æ²" }} </el-button> <el-button type="primary" @click="toggleDam"> {{ damActive ? "å ³éå å" : "å¼å¯å å" }} </el-button> </div> <!-- å岿¨¡æ --> @@ -36,7 +28,6 @@ <el-radio label="颿µæ¨¡æ">颿µæ¨¡æ</el-radio> </el-radio-group> <div v-if="selectedSimulation === 'å岿¨¡æ'"> <!-- <HistorySimulation :selectedArea="selectedArea" /> --> <CitySim :selectedArea="selectedArea" /> </div> <div v-if="selectedSimulation === '宿¶æ¨¡æ'"> @@ -46,6 +37,8 @@ <PredictiveSimulation :selectedArea="selectedArea" /> </div> </div> <Ditching v-show="ditchingShow" class="ditchingPosition" @update-excavation-data="handleUpdateExcavationData"></Ditching> <Dam v-show="damShow" class="ditchingPosition"></Dam> </div> </template> @@ -53,6 +46,8 @@ import { ref, computed, onMounted, reactive } from "vue"; import HistorySimulation from "./KGSimOption/HistorySimulation.vue"; import CitySim from './CitySim.vue' import Ditching from "@/components/tools/Ditching.vue"; import Dam from "@/components/tools/Dam.vue"; import PredictiveSimulation from "./KGSimOption/PredictiveSimulation.vue"; import RealTimeSimulation from "./KGSimOption/RealTimeSimulation.vue"; import { getRegionData } from "@/api/trApi"; @@ -62,6 +57,10 @@ const selectedArea = ref(); // éä¸çåºå // éç¹æ²æ°æ® const importGOptions = reactive([]); let ditchingShow = ref(false); let damShow = ref(false); let ditchingActive = ref(false); let damActive = ref(false); onMounted(() => { // è·åéç¹æ²æ°æ® @@ -86,6 +85,10 @@ ); }); const handleUpdateExcavationData = (data) => { console.log('æ¥æ¶å°åç»ä»¶çæ°æ®:', data); // æ¤å¤å¯è¿è¡åç»æä½ï¼å¦ä¿åãç»å¾ç }; // èªå®ä¹è¿æ»¤æ¹æ³ const filterOptions = (query) => { searchQuery.value = query; @@ -101,8 +104,35 @@ ); // æå°å®æ´çé䏿°æ® }; const handleStart = () => { console.log("å¼å§æé®è¢«ç¹å»"); // 忢弿²ç¶æ const toggleDitch = () => { ditchingActive.value = !ditchingActive.value; ditchingShow.value = ditchingActive.value; if (ditchingActive.value) { console.log("å¼å¯æé®è¢«ç¹å»"); } else { console.log("å ³éæé®è¢«ç¹å»"); cloesDitch(); } }; // 忢å åç¶æ const toggleDam = () => { damActive.value = !damActive.value; damShow.value = damActive.value; if (damActive.value) { console.log("å¼å¯æé®è¢«ç¹å»"); } else { console.log("å ³éæé®è¢«ç¹å»"); cloesDam(); } }; const cloesDitch = () => { ditchingShow.value = false; }; const cloesDam = () => { damShow.value = false; }; const handleAdd = () => { @@ -111,6 +141,12 @@ </script> <style scoped> .ditchingPosition { position: fixed; left: 18%; top: 20%; } .simulation-module { color: #61f7d4; font-size: 14px; @@ -130,25 +166,36 @@ .history-simulation-wrapper { margin-bottom: 20px; height: 100%; /* åºå®é«åº¦ */ height: 100%; /* åºå®é«åº¦ */ overflow: auto; } /* èªå®ä¹åéæ¡æ ·å¼ */ :deep(.el-radio__input.is-checked .el-radio__inner) { background-color: #009688; /* é䏿¶çèæ¯é¢è² */ border-color: #009688; /* é䏿¶çè¾¹æ¡é¢è² */ background-color: #009688; /* é䏿¶çèæ¯é¢è² */ border-color: #009688; /* é䏿¶çè¾¹æ¡é¢è² */ } :deep(.el-radio__input.is-checked + .el-radio__label) { color: inherit; /* 让æåé¢è²è·éç¶çº§ */ color: inherit; /* 让æåé¢è²è·éç¶çº§ */ } :deep(.el-select__placeholder) { color: #fff; /* 让æåé¢è²è·éç¶çº§ */ color: #fff; /* 让æåé¢è²è·éç¶çº§ */ } :deep(.el-radio) { color: #fff; /* 让æåé¢è²è·éç¶çº§ */ color: #fff; /* 让æåé¢è²è·éç¶çº§ */ } :deep(.el-input__inner) { color: #fff; /* 让æåé¢è²è·éç¶çº§ */ color: #fff; /* 让æåé¢è²è·éç¶çº§ */ } </style> </style>