| | |
| | | flowUrl: jsonData.flowUrl, |
| | | waterUrl: jsonData.waterUrl, |
| | | version: jsonData.version, |
| | | waterTimestamps: waterTimestamps, // åå§æ¶é´æ°ç» |
| | | waterTimestamps: waterTimestamps, |
| | | watersMaxHeight: jsonData.waters.maxHeight, |
| | | watersMinHeight: jsonData.waters.minHeight, |
| | | }; |
| | | } catch (error) { |
| | | console.error("è§£ææ°´æ¨¡ææ°æ®æ¶åºé:", error); |
| | |
| | | throw new Error(`HTTP error! status: ${response.status}`); |
| | | } |
| | | const jsonData = await response.json(); // è§£æ JSON æ°æ® |
| | | console.log(jsonData, "jsonjsonjsonjson"); |
| | | // console.log(jsonData, "jsonjsonjsonjson"); |
| | | return parseWaterSimulationData(jsonData); // è°ç¨è§£æå½æ° |
| | | } catch (error) { |
| | | console.error("è¯·æ±æè§£ææ°æ®æ¶åºé:", error); |
| | |
| | | <ratelevel ref="ratelevelRef" :playing-time="sendCurrentPlayingTime" |
| | | @finish-calculation="handleFinishCalculation" |
| | | style="margin-top: 12px; margin-left: 28px; margin-right: 10px;justify-content: flex-end;" /> |
| | | <crossanalysis ref="crossRef" style="margin-top: 12px; margin-left: 16px; margin-right: 20px;justify-content: flex-end;" /> |
| | | <crossanalysis ref="crossRef" |
| | | style="margin-top: 12px; margin-left: 16px; margin-right: 20px;justify-content: flex-end;" /> |
| | | |
| | | </div> |
| | | <el-button @click="handleBack" style="margin-top: 3px; margin-left: 28px; margin-right: 10px;width: 75%;height: 30%;">ç»ææ¨¡æ</el-button> |
| | | <el-button @click="handleBack" |
| | | style="margin-top: 3px; margin-left: 28px; margin-right: 10px;width: 75%;height: 30%;">ç»ææ¨¡æ</el-button> |
| | | </div> |
| | | |
| | | </div> |
| | |
| | | rainColor: "#99B3CC", |
| | | rainDensity: 30 // é¨çå¯åº¦ |
| | | }); |
| | | let minFlowRate =ref() |
| | | let maxFlowRate =ref() |
| | | let minFlowRate = ref() |
| | | let maxFlowRate = ref() |
| | | // 计ç®å±æ§ |
| | | const progressPercentage = computed( |
| | | () => (currentTime.value / duration.value) * 100 |
| | |
| | | // baseUrl: `/simu/c2h1dc`, |
| | | interval: intervalMap[playbackRate.value], |
| | | colorRender: isColorRenderEnabled.value, |
| | | minFlowRate:0.1, |
| | | maxFlowRate:10, |
| | | minFlowRate, |
| | | maxFlowRate, |
| | | }); |
| | | isWaterPrimitiveCreated.value = true; |
| | | } else { |
| | |
| | | // å½åæ¹æ¡çææä¿¡æ¯ |
| | | const schemeInfo = selectedScheme.value; |
| | | serviceInfo = schemeInfo.serviceName; |
| | | // minFlowRate = schemeInfo.æå°æ°´æ·± |
| | | // maxFlowRate = schemeInfo.æå¤§æ°´æ·± |
| | | |
| | | // console.log('è·åå°ç serviceName:', serviceInfo); |
| | | getRainfallData() |
| | | // æ ¹æ®layer.jsonå»è·åæ¶é´è½´ä¿¡æ¯ |
| | | const { waterTimestamps: timestamps } = await fetchWaterSimulationData(serviceInfo); |
| | | const { waterTimestamps: timestamps, watersMaxHeight, watersMinHeight } = await fetchWaterSimulationData(serviceInfo); |
| | | console.log('å½åæ¹æ¡ä¸çæå¤§æ°´ä½æ·±åº¦åæå°æ°´ä½æ·±åº¦',watersMaxHeight,watersMinHeight); |
| | | |
| | | // ç°å¨æ¯æç
§æ»å
±æå¤å°ä¸ªç¹æ¥æ¸²ææ¶é´è½´ |
| | | if (timestamps) { |
| | | waterTimestamps.value = timestamps; |
| | |
| | | "YYYY-MM-DD HH:mm:ss" |
| | | ); |
| | | } |
| | | minFlowRate = watersMinHeight |
| | | maxFlowRate = watersMaxHeight |
| | | } catch (error) { |
| | | console.error("Error loading water simulation data:", error); |
| | | ElMessage({ |
| | |
| | | if (crossRef.value) { |
| | | crossRef.value.clearPoints(); |
| | | console.log('æ§è¡å é¤ç¹åè½'); |
| | | |
| | | |
| | | } |
| | | emit("isColorRender", false); |
| | | setTimeout(() => { |
| | |
| | | }, 3000); |
| | | destoryWaterPrimitive(); |
| | | EventBus.emit("hide-schemeInfo"); |
| | | EventBus.emit("clear-water-depth"); |
| | | EventBus.emit("clear-water-velocity"); |
| | | ElMessage({ message: "模æè¿ç¨æ£å¨å
³éä¸...", type: "success" }); |
| | | } |
| | | </script> |
| | |
| | | import { useSimStore } from "@/store/simulation"; |
| | | import { storeToRefs } from "pinia"; |
| | | const simStore = useSimStore(); |
| | | const { selectedScheme } = storeToRefs(simStore); |
| | | const { selectedScheme, currentInfo } = storeToRefs(simStore); |
| | | import { EventBus } from "@/eventBus"; |
| | | |
| | | const pickedPoints = ref([]); |
| | | const handler = ref(null); |
| | |
| | | const schemeInfo = selectedScheme.value; |
| | | serviceInfo = schemeInfo.serviceName; |
| | | |
| | | // 妿已æéä¸ç¹ï¼åå
æ¸
é¤ |
| | | if (pickedPoints.value.length >= 1) { |
| | | endCalculation(); // æ¸
餿æå·²æç¹ |
| | | } |
| | | |
| | | // å建 label å®ä½ |
| | | const labelEntity = viewer.entities.add({ |
| | | position: point.cartesian, |
| | | label: { |
| | | text: `æµéç¹ ${pickedPoints.value.length + 1}\næ°´æ·±: çå¾
å¯å¨...\næµé: çå¾
å¯å¨...`, |
| | | text: `æµéç¹\næ°´æ·±: çå¾
å¯å¨...\næµé: çå¾
å¯å¨...`, |
| | | font: 'bold 14pt monospace', |
| | | style: Cesium.LabelStyle.FILL_AND_OUTLINE, |
| | | fillColor: Cesium.Color.YELLOW, |
| | |
| | | pixelOffsetScaleByDistance: new Cesium.NearFarScalar(100, 1.0, 5000, 0.3), |
| | | } |
| | | }); |
| | | |
| | | const groundPosition = Cesium.Cartesian3.fromRadians( |
| | | point.longitude * Math.PI / 180, |
| | | point.latitude * Math.PI / 180, |
| | |
| | | distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000) |
| | | } |
| | | }); |
| | | |
| | | // åå¨å®ä½å¼ç¨ä¹åå°±æ´æ° currentInfo |
| | | currentInfo.value = { |
| | | longitude: point.longitude, |
| | | latitude: point.latitude, |
| | | serviceInfo: serviceInfo |
| | | }; |
| | | // è¯·æ±æ°æ®å¹¶æ´æ° label |
| | | getFlowRateInfo(point.longitude, point.latitude, displayTime).then(result => { |
| | | updateLabel(pickedPoints.value.length - 1, result.depth, result.velocity); |
| | | updateLabel(pickedPoints.value.length, result.depth, result.velocity); |
| | | }); |
| | | |
| | | // åå¨å®ä½å¼ç¨ |
| | | pickedPoints.value.push({ |
| | | labelEntity, |
| | | cylinderEntity, // 使ç¨åæ±ä»£æ¿ line å circle |
| | | cylinderEntity, |
| | | longitude: point.longitude, |
| | | latitude: point.latitude |
| | | }); |
| | |
| | | ); |
| | | |
| | | async function updateAllLabels() { |
| | | for (const pointInfo of pickedPoints.value) { |
| | | for (let i = 0; i < pickedPoints.value.length; i++) { |
| | | const pointInfo = pickedPoints.value[i]; |
| | | if (!pointInfo || !pointInfo.labelEntity) continue; |
| | | |
| | | const result = await getFlowRateInfo(pointInfo.longitude, pointInfo.latitude, currentTime.value); |
| | | updateLabel(pointInfo, result.depth, result.velocity); |
| | | updateLabel(i, result.depth, result.velocity); |
| | | } |
| | | } |
| | | |
| | | function updateLabel(pointInfo, depth, velocity) { |
| | | if (pointInfo.labelEntity && pointInfo.labelEntity.label) { |
| | | function updateLabel(index, depth, velocity) { |
| | | const pointInfo = pickedPoints.value[index]; |
| | | if (pointInfo && pointInfo.labelEntity && pointInfo.labelEntity.label) { |
| | | pointInfo.labelEntity.label.text = ` |
| | | æµéç¹ ${pickedPoints.value.findIndex(p => p === pointInfo) + 1} |
| | | æµéç¹ |
| | | æ°´æ·±: ${depth} m |
| | | æµé: ${velocity} m/s |
| | | `.trim(); |
| | |
| | | if (pointInfo.cylinderEntity) viewer.entities.remove(pointInfo.cylinderEntity); |
| | | }); |
| | | pickedPoints.value = []; |
| | | EventBus.emit("clear-water-depth"); |
| | | EventBus.emit("clear-water-velocity"); |
| | | |
| | | } |
| | | |
| | | defineExpose({ |
| | |
| | | serviceName: serviceInfo |
| | | }; |
| | | return getFlowRate(params).then(data => { |
| | | // console.log('è·åå°çæ°æ®:', data); |
| | | console.log('è·åå°çæ°æ®:', data); |
| | | if (data && data.code === 200) { |
| | | return { |
| | | depth: data.data.depth.toFixed(2), |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div style="display: flex;justify-content: space-between;"> |
| | | <el-tooltip class="box-item" effect="dark" placement="top" show-after="1000"> |
| | | <template #content> |
| | | æ°´æ·±/æµéåæåè½è¯´æï¼ |
| | | <br /><br /> |
| | | ð¹ ç¹å»æé®åæ¢ç¶æï¼ |
| | | <br /> |
| | | - ç½è²ï¼å
³éæ¾ååè½ï¼ä¸å¯éç¹ï¼ |
| | | <br /> |
| | | - é»è²ï¼å¼å¯æ¾ååè½ï¼å¯ç¹å»å°å¾éæ©åæç¹ï¼ |
| | | <br /><br /> |
| | | ð¹ ä½¿ç¨æµç¨ï¼ |
| | | <br /> |
| | | 1. ç¹å»æé®åæ¢ä¸ºé»è²ç¶æ â å¼å§æ¾ååæ ç¹ |
| | | <br /> |
| | | 2. å¨å°å¾ä¸ç¹å»æéä½ç½® â æ·»å æ°´æ·±/æµéåæç¹ |
| | | <br /> |
| | | 3. 宿éç¹åï¼è¯·å°æé®ååç½è² â å
³éæ¾ååè½ |
| | | <br /><br /> |
| | | â ï¸ æ¸©é¦¨æç¤ºï¼ |
| | | <br /> |
| | | 使ç¨å®æ¯è¯·å¡å¿
å
³éæ¾ååè½ï¼é¿å
误æä½å½±åå
¶ä»åè½ã |
| | | </template> |
| | | <div @click="togglePick" :class="['pick-button', { active: isPickingActive }]"> |
| | | <img v-if="!isPickingActive" src="@/assets/img/timeline/æµé.png" style="width: 28px;height: 28px;" /> |
| | | <img v-else src="@/assets/img/timeline/å·²æµé.png" style="width: 28px;height: 28px;" /> |
| | | </div> |
| | | </el-tooltip> |
| | | <el-tooltip class="box-item" effect="dark" placement="top" show-after="1000"> |
| | | <template #content> |
| | | æ¸
餿æåæåæ ç¹ååæç»æï¼ |
| | | <br /><br /> |
| | | ð åè½è¯´æï¼ |
| | | <br /> |
| | | ç¹å»åå°ç§»é¤å°å¾ä¸çæææ°´æ·±/æµéåæç¹ä»¥åç¸å
³åæå¾è¡¨ |
| | | <br /><br /> |
| | | â ï¸ æ¸©é¦¨æç¤ºï¼ |
| | | <br /> |
| | | æ¤æä½ä¼æ¸
空å½ååæè¿åº¦ï¼è¯·ç¡®è®¤ååæ§è¡ |
| | | </template> |
| | | <div @click="endCalculation"> |
| | | <img src="@/assets/img/timeline/æ¸
é¤.png" style="width: 26px;height: 26px;" /> |
| | | </div> |
| | | </el-tooltip> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { defineProps, watch, ref, onMounted, defineExpose } from "vue"; |
| | | import { ElMessage } from 'element-plus'; |
| | | import { getFlowRate } from "@/api/trApi.js"; |
| | | import { useSimStore } from "@/store/simulation"; |
| | | import { storeToRefs } from "pinia"; |
| | | const simStore = useSimStore(); |
| | | const { selectedScheme } = storeToRefs(simStore); |
| | | |
| | | const pickedPoints = ref([]); |
| | | const handler = ref(null); |
| | | const isPickingActive = ref(false); |
| | | const currentTime = ref(0); |
| | | let serviceInfo = ref(null); |
| | | |
| | | const props = defineProps({ |
| | | playingTime: { |
| | | type: String, |
| | | required: true |
| | | } |
| | | }); |
| | | |
| | | const viewer = window.viewer; |
| | | |
| | | function getPickPosition(windowPosition) { |
| | | if (!viewer) return null; |
| | | viewer.scene.globe.depthTestAgainstTerrain = true; |
| | | const cartesian = viewer.scene.pickPosition(windowPosition); |
| | | if (!cartesian) return null; |
| | | const cartographic = Cesium.Cartographic.fromCartesian(cartesian); |
| | | cartographic.height += 110.0; |
| | | return { |
| | | cartesian: Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, cartographic.height), |
| | | longitude: Cesium.Math.toDegrees(cartographic.longitude), |
| | | latitude: Cesium.Math.toDegrees(cartographic.latitude), |
| | | height: cartographic.height |
| | | }; |
| | | } |
| | | function addPointToViewer(point, index) { |
| | | const displayTime = currentTime.value || "æªè®¾ç½®æ¶é´"; |
| | | const schemeInfo = selectedScheme.value; |
| | | serviceInfo = schemeInfo.serviceName; |
| | | |
| | | // å建 label å®ä½ |
| | | const labelEntity = viewer.entities.add({ |
| | | position: point.cartesian, |
| | | label: { |
| | | text: `æµéç¹ ${pickedPoints.value.length + 1}\næ°´æ·±: çå¾
å¯å¨...\næµé: çå¾
å¯å¨...`, |
| | | font: 'bold 14pt monospace', |
| | | style: Cesium.LabelStyle.FILL_AND_OUTLINE, |
| | | fillColor: Cesium.Color.YELLOW, |
| | | outlineColor: Cesium.Color.BLACK, |
| | | outlineWidth: 2, |
| | | verticalOrigin: Cesium.VerticalOrigin.CENTER, |
| | | horizontalOrigin: Cesium.HorizontalOrigin.CENTER, |
| | | backgroundColor: Cesium.Color.fromCssColorString('rgba(0,0,0,0.7)'), |
| | | backgroundPadding: new Cesium.Cartesian2(10, 10), |
| | | showBackground: true, |
| | | scale: 1, |
| | | distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000), |
| | | pixelOffsetScaleByDistance: new Cesium.NearFarScalar(100, 1.0, 5000, 0.3), |
| | | } |
| | | }); |
| | | const groundPosition = Cesium.Cartesian3.fromRadians( |
| | | point.longitude * Math.PI / 180, |
| | | point.latitude * Math.PI / 180, |
| | | 0 |
| | | ); |
| | | const cylinderEntity = viewer.entities.add({ |
| | | position: groundPosition, // åºé¨ä½ç½® |
| | | cylinder: { |
| | | length: 100.0, |
| | | topRadius: 1.0, |
| | | bottomRadius: 1.0, |
| | | material: Cesium.Color.YELLOW, |
| | | outline: true, |
| | | outlineColor: Cesium.Color.YELLOW, |
| | | slices: 32, |
| | | heightReference: Cesium.HeightReference.RELATIVE_TO_GROUND, |
| | | distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000) |
| | | } |
| | | }); |
| | | |
| | | // è¯·æ±æ°æ®å¹¶æ´æ° label |
| | | getFlowRateInfo(point.longitude, point.latitude, displayTime).then(result => { |
| | | updateLabel(pickedPoints.value.length - 1, result.depth, result.velocity); |
| | | }); |
| | | |
| | | // åå¨å®ä½å¼ç¨ |
| | | pickedPoints.value.push({ |
| | | labelEntity, |
| | | cylinderEntity, // 使ç¨åæ±ä»£æ¿ line å circle |
| | | longitude: point.longitude, |
| | | latitude: point.latitude |
| | | }); |
| | | } |
| | | |
| | | function initPickHandler() { |
| | | if (!viewer?.scene?.canvas) return; |
| | | if (handler.value) { |
| | | handler.value.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | handler.value.destroy(); |
| | | handler.value = null; |
| | | } |
| | | handler.value = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); |
| | | |
| | | handler.value.setInputAction((movement) => { |
| | | const position = getPickPosition(movement.position); |
| | | if (position) { |
| | | const index = pickedPoints.value.length; |
| | | addPointToViewer(position, index); |
| | | |
| | | } |
| | | }, Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | } |
| | | |
| | | function startPicking() { |
| | | if (!handler.value) { |
| | | initPickHandler(); |
| | | } |
| | | isPickingActive.value = true; |
| | | ElMessage.success(`å¼å§--æµéæµé--æ¾ååæ åè½ï¼è¯·ç¹å»å°å¾éæ©ç¹ä½ï¼éåå®è¯·åæ¶å
³éï¼é¿å
å½±åå
¶ä»åè½ï¼`); |
| | | } |
| | | function stopPicking() { |
| | | if (handler.value) { |
| | | handler.value.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | handler.value.destroy(); |
| | | handler.value = null; |
| | | } |
| | | isPickingActive.value = false; |
| | | } |
| | | function togglePick() { |
| | | if (isPickingActive.value) { |
| | | stopPicking(); |
| | | isPickingActive.value = false; |
| | | ElMessage.info('å·²å
³é--æµéæµé--æ¾åç¹åæ åè½ï¼'); |
| | | } else { |
| | | startPicking(); |
| | | isPickingActive.value = true; |
| | | } |
| | | } |
| | | watch( |
| | | () => props.playingTime, |
| | | async (newVal, oldVal) => { |
| | | if (newVal !== oldVal) { |
| | | currentTime.value = newVal || "æªè®¾ç½®æ¶é´"; |
| | | await updateAllLabels(); |
| | | } |
| | | }, |
| | | { immediate: true } |
| | | ); |
| | | |
| | | async function updateAllLabels() { |
| | | for (const pointInfo of pickedPoints.value) { |
| | | if (!pointInfo || !pointInfo.labelEntity) continue; |
| | | |
| | | const result = await getFlowRateInfo(pointInfo.longitude, pointInfo.latitude, currentTime.value); |
| | | updateLabel(pointInfo, result.depth, result.velocity); |
| | | } |
| | | } |
| | | |
| | | function updateLabel(pointInfo, depth, velocity) { |
| | | if (pointInfo.labelEntity && pointInfo.labelEntity.label) { |
| | | pointInfo.labelEntity.label.text = ` |
| | | æµéç¹ ${pickedPoints.value.findIndex(p => p === pointInfo) + 1} |
| | | æ°´æ·±: ${depth} m |
| | | æµé: ${velocity} m/s |
| | | `.trim(); |
| | | } |
| | | } |
| | | function endCalculation() { |
| | | pickedPoints.value.forEach(pointInfo => { |
| | | if (pointInfo.labelEntity) viewer.entities.remove(pointInfo.labelEntity); |
| | | if (pointInfo.cylinderEntity) viewer.entities.remove(pointInfo.cylinderEntity); |
| | | }); |
| | | pickedPoints.value = []; |
| | | } |
| | | |
| | | defineExpose({ |
| | | endCalculation, |
| | | stopPicking |
| | | }); |
| | | function getFlowRateInfo(lon, lat, time) { |
| | | const params = { |
| | | lon: lon, |
| | | lat: lat, |
| | | time: time, |
| | | serviceName: serviceInfo |
| | | }; |
| | | return getFlowRate(params).then(data => { |
| | | // console.log('è·åå°çæ°æ®:', data); |
| | | if (data && data.code === 200) { |
| | | return { |
| | | depth: data.data.depth.toFixed(2), |
| | | velocity: data.data.velocity.toFixed(2) |
| | | }; |
| | | } else { |
| | | return { depth: 'N/A', velocity: 'N/A' }; |
| | | } |
| | | }).catch(error => { |
| | | console.error('è·åæ°æ®æ¶åçé误:', error); |
| | | return { depth: 'N/A', velocity: 'N/A' }; |
| | | }); |
| | | } |
| | | </script> |
| | | <style lang="less" scoped></style> |
| | |
| | | <template> |
| | | <div class="right"> |
| | | <div class="right-top"> |
| | | <span>模æç»æ</span> |
| | | <span>æ°´æ·±æµéç»æ</span> |
| | | </div> |
| | | <div class="right-content" > |
| | | <div class="listinfo-title">åç¾ç»è®¡</div> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="water-depth-content"> |
| | | <!-- æç¤ºä¿¡æ¯ --> |
| | | <div v-if="showSelectPrompt" style=" font-weight: bold;"> |
| | | 请å¨å°å¾ä¸éåå¯ä¸æµéç¹ |
| | | </div> |
| | | |
| | | <!-- æ£å¸¸å
容 --> |
| | | <div v-else> |
| | | <!-- ä½ç½®ä¿¡æ¯ --> |
| | | <div class="location-info"> |
| | | <h3>ä½ç½®ä¿¡æ¯</h3> |
| | | <p class="coordinates"> |
| | | ç»åº¦ï¼ <strong>{{ safeCurrentInfo.longitude.toFixed(3) }} </strong> |
| | | 纬度ï¼<strong>{{ safeCurrentInfo.latitude.toFixed(3) }}</strong> |
| | | </p> |
| | | </div> |
| | | |
| | | <!-- æ°´æ·±ä¿¡æ¯ --> |
| | | <div class="depth-info"> |
| | | <h3>æ°´æ·±ä¿¡æ¯ (m)</h3> |
| | | <p> |
| | | å¹³åï¼<strong>2.45</strong> |
| | | æå¤§ï¼<strong>3.10</strong> |
| | | æå°ï¼<strong>1.80</strong> |
| | | </p> |
| | | </div> |
| | | </div> |
| | | <div class="chart-placeholder"> |
| | | <div ref="chartDom" style="width: 100%; height:300px;"></div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, onMounted, watch, computed, onBeforeUnmount, onBeforeMount } from 'vue'; |
| | | import * as echarts from 'echarts'; |
| | | import { useSimStore } from "@/store/simulation"; |
| | | import { storeToRefs } from "pinia"; |
| | | import { getFlowRate } from "@/api/trApi.js"; |
| | | import { EventBus } from "@/eventBus"; // å¼å
¥äºä»¶æ»çº¿ |
| | | |
| | | const simStore = useSimStore(); |
| | | const { currentInfo } = storeToRefs(simStore); |
| | | |
| | | // å®ä¹å¾è¡¨ç DOM å
ç´ å¼ç¨ |
| | | const chartDom = ref(null); |
| | | let myChart = null; |
| | | |
| | | // 计ç®å±æ§ï¼å®å
¨è·åç»çº¬åº¦ |
| | | const safeCurrentInfo = computed(() => { |
| | | const info = currentInfo.value || {}; |
| | | return { |
| | | longitude: info.longitude !== undefined ? info.longitude : 0.0, |
| | | latitude: info.latitude !== undefined ? info.latitude : 0.0 |
| | | }; |
| | | }); |
| | | |
| | | // 夿æ¯å¦éè¦æ¾ç¤ºéæ©æç¤º |
| | | const showSelectPrompt = computed(() => { |
| | | const info = safeCurrentInfo.value; |
| | | return info.longitude === 0.0 && info.latitude === 0.0; |
| | | }); |
| | | |
| | | // 鲿彿° |
| | | function debounce(func, wait) { |
| | | let timeout; |
| | | return function () { |
| | | const context = this; |
| | | const args = arguments; |
| | | clearTimeout(timeout); |
| | | timeout = setTimeout(() => { |
| | | func.apply(context, args); |
| | | }, wait); |
| | | }; |
| | | } |
| | | |
| | | // ç®åæ°æ®æº |
| | | function generateSampleData() { |
| | | const now = new Date(); |
| | | const data = []; |
| | | // çæ7ä¸ªæ°æ®ç¹ï¼æ¯10åéä¸ä¸ª |
| | | for (let i = 99; i >= 0; i--) { |
| | | const time = new Date(now.getTime() - i * 10 * 60 * 1000); |
| | | // éæºçæ1.8-3.1ä¹é´çæ°´æ·±æ°æ® |
| | | const depth = (1.8 + Math.random() * 1.3).toFixed(2); |
| | | data.push({ |
| | | time: time, |
| | | value: parseFloat(depth) |
| | | }); |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | function initChart(chart) { |
| | | const data = generateSampleData(); |
| | | |
| | | const option = { |
| | | title: { |
| | | text: 'æ°´æ·±ååè¶å¿', |
| | | textStyle: { |
| | | color: '#fff', |
| | | fontSize: 16 |
| | | }, |
| | | left: '-1%' // åç»ä»¶ A å¯¹é½ |
| | | }, |
| | | tooltip: { |
| | | trigger: 'axis', |
| | | formatter: (params) => { |
| | | const date = new Date(params[0].value[0]); |
| | | return `${date.getHours()}:${date.getMinutes().toString().padStart(2, '0')}<br/>æ°´æ·±ï¼${params[0].value[1]} m`; |
| | | }, |
| | | backgroundColor: 'rgba(0,0,0,0.7)', |
| | | textStyle: { |
| | | color: '#fff', |
| | | fontSize: 14 |
| | | } |
| | | }, |
| | | xAxis: { |
| | | type: 'time', |
| | | name: '', // å»é¤Xè½´åä½åç§° |
| | | axisLabel: { |
| | | color: '#fff', |
| | | fontSize: 12, |
| | | formatter: function (value) { |
| | | const date = new Date(value); |
| | | return `${date.getHours()}:${date.getMinutes().toString().padStart(2, '0')}`; |
| | | }, |
| | | interval: 'auto', // èªå¨è®¡ç®é´é鲿¢éå |
| | | rotate: 45 // 徿45åº¦é²æ¢éå |
| | | }, |
| | | nameTextStyle: { |
| | | color: '#fff', |
| | | fontSize: 14 |
| | | } |
| | | }, |
| | | yAxis: { |
| | | type: 'value', |
| | | name: 'æ°´æ·±(m)', // åä½ç®å为å°åm |
| | | min: 1.5, |
| | | max: 3.5, |
| | | axisLabel: { |
| | | color: '#fff', |
| | | fontSize: 12 |
| | | }, |
| | | nameTextStyle: { |
| | | color: '#fff', |
| | | fontSize: 14 |
| | | } |
| | | }, |
| | | series: [{ |
| | | name: 'æ°´æ·±', |
| | | type: 'line', |
| | | data: data.map(item => [item.time, item.value]), |
| | | showSymbol: true, |
| | | lineStyle: { |
| | | color: '#f97316', // æ¹ä¸ºæ©è²ï¼ä¸æµéä¸è´ |
| | | width: 2 |
| | | }, |
| | | itemStyle: { |
| | | color: '#f97316' |
| | | }, |
| | | smooth: false |
| | | }], |
| | | // dataZoom: [{ |
| | | // type: 'slider', |
| | | // start: 0, |
| | | // end: 100, |
| | | // bottom: '0%', // ä¸ç§»ç¼©æ¾æ§ä»¶ |
| | | // textStyle: { |
| | | // color: '#fff', |
| | | // fontSize: 12 |
| | | // }, |
| | | // filterMode: 'filter' |
| | | // }], |
| | | // å
¨å±æåæ ·å¼ |
| | | textStyle: { |
| | | color: '#fff', |
| | | fontSize: 14 |
| | | }, |
| | | animation: false |
| | | }; |
| | | |
| | | chart.setOption(option); |
| | | |
| | | window.addEventListener('resize', debounce(() => { |
| | | chart.resize(); |
| | | }, 200)); |
| | | } |
| | | |
| | | watch( |
| | | () => currentInfo.value, |
| | | (newVal) => { |
| | | if (!newVal || showSelectPrompt.value || !chartDom.value) return; |
| | | |
| | | console.log('ç»åº¦:', newVal.longitude); |
| | | console.log('纬度:', newVal.latitude); |
| | | console.log('æå¡åç§°:', newVal.serviceInfo); |
| | | |
| | | // 鿝æ§å¾è¡¨ |
| | | if (myChart) { |
| | | myChart.dispose(); |
| | | } |
| | | |
| | | // å建æ°å¾è¡¨ |
| | | myChart = echarts.init(chartDom.value); |
| | | initChart(myChart); |
| | | }, |
| | | { deep: true } |
| | | ); |
| | | |
| | | onMounted(() => { |
| | | if (!showSelectPrompt.value && chartDom.value) { |
| | | myChart = echarts.init(chartDom.value); |
| | | initChart(myChart); |
| | | } |
| | | }); |
| | | onBeforeMount(() => { |
| | | EventBus.on('clear-water-depth', clear); |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | if (myChart) { |
| | | myChart.dispose(); |
| | | myChart = null; |
| | | } |
| | | EventBus.off('clear-water-depth', clear); |
| | | |
| | | }); |
| | | function clear() { |
| | | // æ¸
空 store ä¸çç»çº¬åº¦ä¿¡æ¯ |
| | | currentInfo.value.longitude = 0.0; |
| | | currentInfo.value.latitude = 0.0; |
| | | |
| | | // æ¸
é¤ ECharts å¾è¡¨ |
| | | if (myChart) { |
| | | myChart.clear(); // æ¸
é¤å¾è¡¨æ°æ®åå¾å½¢ |
| | | myChart.dispose(); // 鿝å®ä¾ï¼éæ¾èµæº |
| | | myChart = null; |
| | | } |
| | | } |
| | | function getFlowRateInfo(lon, lat, serviceInfo) { |
| | | const params = { |
| | | lon: lon, |
| | | lat: lat, |
| | | serviceName: serviceInfo |
| | | }; |
| | | return getFlowRate(params).then(data => { |
| | | console.log('è·åå°çæ°æ®:', data); |
| | | if (data && data.code === 200) { |
| | | return { |
| | | depth: data.data.depth.toFixed(2), |
| | | velocity: data.data.velocity.toFixed(2) |
| | | }; |
| | | } else { |
| | | return { depth: 'N/A', velocity: 'N/A' }; |
| | | } |
| | | }).catch(error => { |
| | | console.error('è·åæ°æ®æ¶åçé误:', error); |
| | | return { depth: 'N/A', velocity: 'N/A' }; |
| | | }); |
| | | } |
| | | |
| | | function resizeChart() { |
| | | if (myChart) { |
| | | myChart.resize(); |
| | | } |
| | | } |
| | | |
| | | defineExpose({ resizeChart }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .water-depth-content { |
| | | padding-left: 8px; |
| | | padding-top: 8px; |
| | | border-radius: 6px; |
| | | } |
| | | |
| | | .chart-placeholder { |
| | | margin-top: 10px; |
| | | } |
| | | |
| | | .location-info, |
| | | .depth-info { |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .coordinates { |
| | | font-size: 15px; |
| | | color: #fff; |
| | | user-select: all; |
| | | display: inline-block; |
| | | border-radius: 4px; |
| | | transition: background-color 0.2s ease; |
| | | } |
| | | |
| | | .depth-info p { |
| | | font-size: 14px; |
| | | color: #fff; |
| | | } |
| | | |
| | | .depth-info strong { |
| | | color: #fff; |
| | | margin: 0 4px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="water-velocity-content"> |
| | | <!-- æç¤ºä¿¡æ¯ --> |
| | | <div v-if="showSelectPrompt" style=" font-weight: bold;"> |
| | | 请å¨å°å¾ä¸éåå¯ä¸æµéç¹ |
| | | </div> |
| | | |
| | | <!-- æ£å¸¸å
容 --> |
| | | <div v-else> |
| | | <!-- ä½ç½®ä¿¡æ¯ --> |
| | | <div class="location-info"> |
| | | <h3>ä½ç½®ä¿¡æ¯</h3> |
| | | <p class="coordinates"> |
| | | ç»åº¦ï¼ <strong>{{ safeCurrentInfo.longitude.toFixed(3) }} </strong> |
| | | 纬度ï¼<strong>{{ safeCurrentInfo.latitude.toFixed(3) }}</strong> |
| | | </p> |
| | | </div> |
| | | |
| | | <!-- æµéä¿¡æ¯ --> |
| | | <div class="velocity-info"> |
| | | <h3>æµéä¿¡æ¯ (m/s)</h3> |
| | | <p> |
| | | å¹³åï¼<strong>1.25</strong> |
| | | æå¤§ï¼<strong>1.80</strong> |
| | | æå°ï¼<strong>0.70</strong> |
| | | </p> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- å¾è¡¨åºå --> |
| | | <div class="chart-placeholder"> |
| | | <div ref="chartDom" style="width: 100%; height: 300px;"></div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, onMounted, watch, computed, onBeforeUnmount,onBeforeMount } from 'vue'; |
| | | import * as echarts from 'echarts'; |
| | | import { useSimStore } from "@/store/simulation"; |
| | | import { storeToRefs } from "pinia"; |
| | | import { EventBus } from "@/eventBus"; // å¼å
¥äºä»¶æ»çº¿ |
| | | |
| | | const simStore = useSimStore(); |
| | | const { currentInfo } = storeToRefs(simStore); |
| | | |
| | | // å®ä¹å¾è¡¨ç DOM å
ç´ å¼ç¨ |
| | | const chartDom = ref(null); |
| | | let myChart = null; |
| | | |
| | | // 计ç®å±æ§ï¼å®å
¨è·åç»çº¬åº¦ |
| | | const safeCurrentInfo = computed(() => { |
| | | const info = currentInfo.value || {}; |
| | | return { |
| | | longitude: info.longitude !== undefined ? info.longitude : 0.0, |
| | | latitude: info.latitude !== undefined ? info.latitude : 0.0 |
| | | }; |
| | | }); |
| | | |
| | | // 夿æ¯å¦éè¦æ¾ç¤ºéæ©æç¤º |
| | | const showSelectPrompt = computed(() => { |
| | | const info = safeCurrentInfo.value; |
| | | return info.longitude === 0.0 && info.latitude === 0.0; |
| | | }); |
| | | |
| | | // 鲿彿° |
| | | function debounce(func, wait) { |
| | | let timeout; |
| | | return function () { |
| | | const context = this; |
| | | const args = arguments; |
| | | clearTimeout(timeout); |
| | | timeout = setTimeout(() => { |
| | | func.apply(context, args); |
| | | }, wait); |
| | | }; |
| | | } |
| | | |
| | | // ç®åæ°æ®æº |
| | | function generateSampleData() { |
| | | const now = new Date(); |
| | | const data = []; |
| | | // çæ7ä¸ªæ°æ®ç¹ï¼æ¯10åéä¸ä¸ª |
| | | for (let i = 100; i >= 0; i--) { |
| | | const time = new Date(now.getTime() - i * 10 * 60 * 1000); |
| | | // éæºçæ0.7-1.8ä¹é´çæµéæ°æ® |
| | | const velocity = (0.7 + Math.random() * 3).toFixed(2); |
| | | data.push({ |
| | | time: time, |
| | | value: parseFloat(velocity) |
| | | }); |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | function initChart(chart) { |
| | | const data = generateSampleData(); |
| | | |
| | | const option = { |
| | | // grid: { |
| | | // top: '5%', // ä¸è¾¹è·åå° => æçº¿å¾åé« |
| | | // bottom: '%', // ä¸è¾¹è·åå° => æçº¿å¾åé« |
| | | // left: '10%', // 左边è·åå° => æçº¿å¾å宽 |
| | | // right: '10%' // å³è¾¹è·åå° => æçº¿å¾å宽 |
| | | // }, |
| | | title: { |
| | | text: 'æµéååè¶å¿', |
| | | textStyle: { |
| | | color: '#fff', |
| | | fontSize: 16 |
| | | }, |
| | | // å°æ é¢åå·¦ç§»å¨ 1% |
| | | left: '-1%' |
| | | }, |
| | | tooltip: { |
| | | trigger: 'axis', |
| | | formatter: (params) => { |
| | | const date = new Date(params[0].value[0]); |
| | | return `${date.getHours()}:${date.getMinutes().toString().padStart(2, '0')}<br/>æµéï¼${params[0].value[1]} m/s`; |
| | | }, |
| | | backgroundColor: 'rgba(0,0,0,0.7)', |
| | | textStyle: { |
| | | color: '#fff', |
| | | fontSize: 14 |
| | | } |
| | | }, |
| | | xAxis: { |
| | | type: 'time', |
| | | // åæ¶ X è½´åä½ |
| | | name: '', |
| | | axisLabel: { |
| | | color: '#fff', |
| | | fontSize: 12, |
| | | formatter: function (value) { |
| | | const date = new Date(value); |
| | | return `${date.getHours()}:${date.getMinutes().toString().padStart(2, '0')}`; |
| | | }, |
| | | interval: 'auto', // èªå¨è®¡ç®é´é鲿¢éå |
| | | rotate: 45 // 徿45åº¦é²æ¢éå |
| | | }, |
| | | nameTextStyle: { |
| | | color: '#fff', |
| | | fontSize: 14 |
| | | } |
| | | }, |
| | | yAxis: { |
| | | type: 'value', |
| | | name: 'æµé(m/s)', |
| | | min: 0.5, // 设置æå°å¼ |
| | | max: 6.0, // 设置æå¤§å¼ |
| | | axisLabel: { |
| | | color: '#fff', |
| | | fontSize: 12, |
| | | }, |
| | | nameTextStyle: { |
| | | color: '#fff', |
| | | fontSize: 14 |
| | | }, |
| | | }, |
| | | series: [{ |
| | | name: 'æµé', |
| | | type: 'line', |
| | | data: data.map(item => [item.time, item.value]), |
| | | showSymbol: true, |
| | | lineStyle: { |
| | | color: '#f97316', // æ©è² |
| | | width: 2 |
| | | }, |
| | | itemStyle: { |
| | | color: '#f97316' |
| | | }, |
| | | smooth: true // å¹³æ»æ²çº¿ |
| | | }], |
| | | // dataZoom: [{ |
| | | // type: 'slider', |
| | | // start: 0, |
| | | // end: 100, |
| | | // textStyle: { |
| | | // color: '#fff', |
| | | // fontSize: 12 |
| | | // }, |
| | | // filterMode: 'filter', // é¿å
é夿¸²æ |
| | | // // ç¼©æ¾æ§ä»¶åä¸ç§»å¨ 2% |
| | | // bottom: '0%' |
| | | // }], |
| | | // å
¨å±æåæ ·å¼ |
| | | textStyle: { |
| | | color: '#fff', |
| | | fontSize: 14 |
| | | }, |
| | | animation: false // ç¦ç¨å¨ç»ï¼æé«æ§è½ |
| | | }; |
| | | |
| | | chart.setOption(option); |
| | | |
| | | // æ·»å 鲿çresizeçå¬ |
| | | window.addEventListener('resize', debounce(() => { |
| | | chart.resize(); |
| | | }, 200)); |
| | | } |
| | | |
| | | watch( |
| | | () => currentInfo.value, |
| | | (newVal) => { |
| | | if (!newVal || showSelectPrompt.value || !chartDom.value) return; |
| | | |
| | | console.log('ç»åº¦:', newVal.longitude); |
| | | console.log('纬度:', newVal.latitude); |
| | | console.log('æå¡åç§°:', newVal.serviceInfo); |
| | | |
| | | // 鿝æ§å¾è¡¨ |
| | | if (myChart) { |
| | | myChart.dispose(); |
| | | } |
| | | |
| | | // å建æ°å¾è¡¨ |
| | | myChart = echarts.init(chartDom.value); |
| | | initChart(myChart); |
| | | }, |
| | | { deep: true } |
| | | ); |
| | | |
| | | onMounted(() => { |
| | | if (!showSelectPrompt.value && chartDom.value) { |
| | | myChart = echarts.init(chartDom.value); |
| | | initChart(myChart); |
| | | } |
| | | }); |
| | | onBeforeMount(() => { |
| | | EventBus.on('clear-water-velocity', clear); |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | if (myChart) { |
| | | myChart.dispose(); |
| | | myChart = null; |
| | | } |
| | | EventBus.off('clear-water-velocity', clear); |
| | | |
| | | }); |
| | | function clear() { |
| | | // æ¸
空 store ä¸çç»çº¬åº¦ä¿¡æ¯ |
| | | currentInfo.value.longitude = 0.0; |
| | | currentInfo.value.latitude = 0.0; |
| | | |
| | | // æ¸
é¤ ECharts å¾è¡¨ |
| | | if (myChart) { |
| | | myChart.clear(); // æ¸
é¤å¾è¡¨æ°æ®åå¾å½¢ |
| | | myChart.dispose(); // 鿝å®ä¾ï¼éæ¾èµæº |
| | | myChart = null; |
| | | } |
| | | } |
| | | // æ·»å resizeChart æ¹æ³ |
| | | function resizeChart() { |
| | | if (myChart) { |
| | | myChart.resize(); |
| | | } |
| | | } |
| | | |
| | | // æ´é²æ¹æ³ç»ç¶ç»ä»¶è°ç¨ |
| | | defineExpose({ resizeChart }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .water-velocity-content { |
| | | padding-left: 8px; |
| | | padding-top: 8px; |
| | | padding-bottom: -8px; |
| | | border-radius: 6px; |
| | | } |
| | | |
| | | .location-info, |
| | | .velocity-info { |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .coordinates { |
| | | font-size: 15px; |
| | | color: #fff; |
| | | user-select: all; |
| | | display: inline-block; |
| | | border-radius: 4px; |
| | | transition: background-color 0.2s ease; |
| | | } |
| | | |
| | | .velocity-info p { |
| | | font-size: 14px; |
| | | color: #fff; |
| | | } |
| | | |
| | | .velocity-info strong { |
| | | color: #fff; |
| | | margin: 0 4px; |
| | | } |
| | | |
| | | .chart-placeholder { |
| | | overflow: hidden; |
| | | height: 284px; |
| | | /* margin-top: 10px; */ |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="right-top"> |
| | | <span>模æç»æ</span> |
| | | </div> |
| | | <el-tabs v-model="activeTab" class="full-width-tabs" @tab-change="handleTabChange"> |
| | | <el-tab-pane label="æ°´æ·±" name="depth"> |
| | | <WaterDepthContent ref="depthRef"/> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="æµé" name="velocity"> |
| | | <WaterVelocityContent ref="velocityRef" /> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue' |
| | | import { nextTick } from 'vue' |
| | | import WaterDepthContent from './WaterDepthContent.vue' |
| | | import WaterVelocityContent from './WaterVelocityContent.vue' |
| | | |
| | | const activeTab = ref('depth') |
| | | const depthRef = ref(null) |
| | | const velocityRef = ref(null) |
| | | |
| | | const handleTabChange = () => { |
| | | nextTick(() => { |
| | | if (activeTab.value === 'depth' && depthRef.value?.resizeChart) { |
| | | depthRef.value.resizeChart() |
| | | } else if (activeTab.value === 'velocity' && velocityRef.value?.resizeChart) { |
| | | velocityRef.value.resizeChart() |
| | | } |
| | | }) |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .full-width-tabs { |
| | | width: 100%; |
| | | } |
| | | |
| | | </style> |
| | | |
| | | <style scoped> |
| | | .full-width-tabs :deep(.el-tabs__header) { |
| | | margin: 0; |
| | | } |
| | | |
| | | .full-width-tabs :deep(.el-tabs__nav) { |
| | | width: 100%; |
| | | } |
| | | |
| | | .full-width-tabs :deep(.el-tabs__item) { |
| | | width: 50%; |
| | | text-align: center; |
| | | padding: 0; |
| | | font-size: 16px; |
| | | font-weight: bold; |
| | | color: #fff; |
| | | } |
| | | .full-width-tabs :deep(.el-tabs__item.is-active) { |
| | | color: #61f7d4; |
| | | |
| | | } |
| | | .full-width-tabs :deep(.el-tabs__active-bar) { |
| | | background-color: #61f7d4; |
| | | |
| | | } |
| | | |
| | | </style> |
| | |
| | | :selectedScheme="currentScheme" |
| | | @back="handleBack" |
| | | /> |
| | | <flowRateTab |
| | | v-if="schemeInfoShow"> |
| | | 123 |
| | | </flowRateTab> |
| | | </div> |
| | | <Message |
| | | @close="close" |
| | |
| | | import { useSimStore } from "@/store/simulation.js"; |
| | | import { SimAPIStore } from "@/store/simAPI"; |
| | | import schemeInfo from "@/components/monifangzhen/schemeInfo.vue"; |
| | | import flowRateTab from "@/components/monifangzhen/flowRateTab.vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | const emit = defineEmits(["start", "end", "reset", "closeBtn"]); |
| | | import { |
| | |
| | | margin-bottom: 20px; |
| | | border-radius: 8px; |
| | | color: white; |
| | | |
| | | .left-top { |
| | | display: flex; |
| | | justify-content: space-between; |
| | |
| | | } |
| | | |
| | | .details { |
| | | padding: 8px; |
| | | padding-left: 8px; |
| | | |
| | | .input-group { |
| | | display: flex; |
| | |
| | | } |
| | | }, |
| | | æ¥ç
§åæ: () => { |
| | | showSunAnalysis.value = !showSunAnalysis.value |
| | | if (showSunAnalysis.value) { |
| | | // mapUtils.AnalysisSunshine() |
| | | } else { |
| | | // mapUtils.disableAtmosphere() |
| | | } |
| | | window.Viewer = earthCtrl.viewer; |
| | | mapUtils.AnalysisSunshine() |
| | | }, |
| | | |
| | | æåæ ç»: () => mapUtils.CreateLabel("label", true), |
| | |
| | | |
| | | // é´å½±åæ |
| | | AnalysisSunshine() { |
| | | if (!layerIsOpen) { |
| | | layerIsOpen = true; |
| | | let currentTime = viewer.clock.currentTime.clone(); |
| | | let startTime = viewer.clock.startTime.clone(); |
| | | let stopTime = viewer.clock.stopTime.clone(); |
| | |
| | | type: 2, |
| | | title: "é´å½±åæ", |
| | | shade: false, |
| | | area: ["350px", "540px"], |
| | | area: ["350px", "350px"], |
| | | offset: "r", |
| | | skin: "other-class", |
| | | content: SmartEarthRootUrl + "Workers/analysis/AnalysisShadow.html", |
| | |
| | | Viewer.shadowLayer = false; |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | transformCartesianToCoord(position) { |
| | | const cartographic = SmartEarth.Cesium.Cartographic.fromCartesian(position); |
| | |
| | | "#ffe930", "#fdd10a", "#feb652", "#fd7f06", |
| | | "#fe2b07", "#4d0a08" |
| | | ]; |
| | | // æé waterHeightLevelsï¼ä» min å° max ä½¿ç¨ææ°å¢é¿ï¼ç¡®ä¿å°å¼åºåæ´å¯é |
| | | const levelCount = colorStops.length; // ä¿æåé¢è²æ°éä¸è´ |
| | | |
| | | const levelCount = colorStops.length; |
| | | const minAllowed = 0.01; // æå°å
è®¸å¼ |
| | | const threshold = 1; // å°å¼ä¸å¤§å¼åçç¹ |
| | | |
| | | let effectiveMin = Math.max(minFlowRate, minAllowed); // æå°ä¸è½å°äº 0.01 |
| | | |
| | | const waterHeightLevels = []; |
| | | // ææ°å¢é¿å
¬å¼ï¼y = base^x |
| | | const base = Math.exp(Math.log(maxFlowRate / minFlowRate) / (levelCount - 1)); |
| | | |
| | | // å两段æé é«åº¦æ°ç» |
| | | for (let i = 0; i < levelCount; i++) { |
| | | const ratio = i / (levelCount - 1); // 0 ~ 1 |
| | | // ä½¿ç¨ææ°æå¼ï¼ä¿è¯ä½å¼åºåæ´å¯é |
| | | const height = minFlowRate * Math.pow(base, i); |
| | | const color = colorStops[i]; |
| | | let ratio = i / (levelCount - 1); // 0 ~ 1 |
| | | |
| | | let height; |
| | | if (ratio <= 0.5) { |
| | | // ååæ®µï¼ä½å¼åºåï¼ä½¿ç¨å¼ºææ°å¢é¿ï¼ä» effectiveMin å° threshold |
| | | const localRatio = ratio * 2; // æ å°å° 0~1 |
| | | const expRatio = Math.pow(localRatio, 2); // æ´å¼ºè°ä½å¼åºåå¯åº¦ |
| | | height = effectiveMin + (threshold - effectiveMin) * expRatio; |
| | | } else { |
| | | // ååæ®µï¼é«å¼åºåï¼ä» threshold å° maxFlowRateï¼ä½¿ç¨ææ°å¢é¿ |
| | | const localRatio = (ratio - 0.5) * 2; // æ å°å° 0~1 |
| | | const expBase = Math.exp(Math.log(maxFlowRate / threshold) / 1); |
| | | height = threshold * Math.pow(expBase, localRatio); |
| | | } |
| | | |
| | | waterHeightLevels.push({ |
| | | height: height.toFixed(2), // å¯éï¼ä¿ç两ä½å°æ° |
| | | color |
| | | height: parseFloat(height.toFixed(2)), // ä¿ç两ä½å°æ° |
| | | color: colorStops[i] |
| | | }); |
| | | } |
| | | waterLegendData.value = waterHeightLevels |
| | | console.log(waterLegendData.value,'å¾éæ°æ®'); |
| | | |
| | | |
| | | waterLegendData.value = waterHeightLevels; |
| | | console.log(waterLegendData.value, 'å¾ä¾æ°æ®'); |
| | | |
| | | // å建å¾å± |
| | | water = earthCtrl.simulate.createWaterSimulateLayer({ |
| | | baseUrl, |
| | | interval, |
| | | color: new SmartEarth.Cesium.Color.fromCssColorString("#D4F2E7"), |
| | | color: SmartEarth.Cesium.Color.fromCssColorString("#D4F2E7"), |
| | | loop: false, |
| | | callback: timeCallback, |
| | | alphaByDepth: -0.3, |
| | |
| | | }); |
| | | |
| | | console.log( |
| | | `ä»¿çæ¨¡æåæ°ï¼è¯·æ±è·¯å¾ ${baseUrl}, 帧é´é´é ${interval}ms, æ¯å¦å¼å¯ä¸é¢æ¸²æ ${colorRender},å¾ä¾åæ°${waterHeightLevels}` |
| | | `ä»¿çæ¨¡æåæ°ï¼è¯·æ±è·¯å¾ ${baseUrl}, 帧é´é´é ${interval}ms, æ¯å¦å¼å¯ä¸é¢æ¸²æ ${colorRender}` |
| | | ); |
| | | } |
| | | /** |