| | |
| | | // import cameraIconSel from "../assets/images/base/视频测点sel.png" |
| | | import { ElLoading, ElMessage } from "element-plus"; |
| | | import RainEffect from './rain' |
| | | import SnowEffect from './snow' |
| | | let layerIsOpen = false; |
| | | const Cesium = SmartEarth.Cesium; |
| | | const colorAll = { |
| | |
| | | slopeArrow: null, |
| | | elevationTool: null, |
| | | rainEffect: null, |
| | | snowEffect: null, // 新增雪效果实例 |
| | | |
| | | init(earthCtrl) { |
| | | this.earthCtrl = earthCtrl; |
| | |
| | | const b = parseInt(hex.substring(4, 6), 16) / 255; |
| | | return new Cesium.Color(r, g, b, 1.0); |
| | | }, |
| | | // 天气 |
| | | // 清除天气特效 |
| | | delRain(){ |
| | | if (this.rainEffect) { |
| | | this.rainEffect.destroy() |
| | | this.rainEffect = null |
| | | } |
| | | }, |
| | | delSnow(){ |
| | | if (this.snowEffect) { |
| | | this.snowEffect.destroy(); |
| | | this.snowEffect = null; |
| | | } |
| | | }, |
| | | // 雨天模拟 |
| | | toggleRain(option, show) { |
| | | console.log(option, 'option') |
| | | // 先销毁旧实例 |
| | |
| | | rainSpeed: option.rainSpeed, // 雨的速度 |
| | | color: this.hexToColor(option.rainColor) // 雨的颜色 |
| | | }) |
| | | }, |
| | | // 雪天模拟 |
| | | toggleSnow(option = {}, show = true) { |
| | | console.log(option, 'option'); |
| | | const defaultOption = { |
| | | snowSize: 0.02, // 默认雪的大小 |
| | | snowSpeed: 100.0, // 默认雪的速度 |
| | | snowColor: "#ffffff", // 默认颜色:白色 |
| | | }; |
| | | option = { ...defaultOption, ...option }; |
| | | if (this.snowEffect) { |
| | | this.snowEffect.destroy(); |
| | | this.snowEffect = null; |
| | | } |
| | | this.snowEffect = new SnowEffect(earthCtrl.viewer, { |
| | | snowSize: option.snowSize, // 雪的大小 |
| | | snowSpeed: option.snowSpeed, // 雪的速度 |
| | | snowColor: this.hexToColor(option.snowColor), // 雪的颜色 |
| | | }); |
| | | |
| | | // 控制显示/隐藏 |
| | | if (this.snowEffect) { |
| | | this.snowEffect.show(show); |
| | | } |
| | | }, |
| | | // 坡度分析 |
| | | pdfx(option) { |
| | |
| | | this.slopeArrow.setSlopeType(0); |
| | | } |
| | | }, |
| | | |
| | | |
| | | toggleSnow(weather = "snow", show) { |
| | | if (show) { |
| | | earthCtrl.environment.showEffect(weather); |
| | | } else { |
| | | let snowValue = { |
| | | test1: 2, |
| | | test2: 1.0, |
| | | test3: 0.5, |
| | | test4: 0.5, |
| | | }; |
| | | earthCtrl.environment.disableEffect(weather); |
| | | } |
| | | }, |
| | | |
| | | // 标绘 |
| | | CreateLabel(pic, show) { |
| | | if (show) { |