| | |
| | | minZoom: 1,//最小变倍 |
| | | maxZoom: 56,//最大变倍 |
| | | baseBoxSize: 576,//默认box宽度 |
| | | // actionArr : new Cesium.SampledProperty(array),//云台朝向pitch |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | "pitch": current.pitch, |
| | | "roll": current.roll, |
| | | "zoom":current.zoom || 1, |
| | | 'wait' : 3 |
| | | 'wait' : 3, |
| | | // 'wait' : current.waitTime, |
| | | // 'nowAction':ele.value |
| | | }); |
| | | dealArr.push({ |
| | | "lng": next.lng, |
| | |
| | | }); |
| | | |
| | | } |
| | | |
| | | // for (let i = 0; i < this.waypoints.length; i++) { |
| | | // dealArr.push(this.waypoints[i]); // Push the current element |
| | | // const current = this.waypoints[i]; |
| | | // const next = this.waypoints[i + 1]; |
| | | // //插值悬停 |
| | | // this.waypoints[i].nowResult?.forEach((ele)=>{ |
| | | // dealArr.push({ |
| | | // "lng": current.lng, |
| | | // "lat": current.lat, |
| | | // "alt": current.alt, |
| | | // 'flyHeading':current.flyHeading, |
| | | // "heading": current.heading, |
| | | // "pitch": current.pitch, |
| | | // "roll": current.roll, |
| | | // "zoom":current.zoom || 1, |
| | | // // 'wait' : current.waitTime, |
| | | // 'wait' : 1, |
| | | // 'nowAction':ele.value |
| | | // }); |
| | | // }) |
| | | // if(next){ |
| | | // console.log(next) |
| | | // //插值下一个点经纬度 当前pt |
| | | // dealArr.push({ |
| | | // "lng": next.lng, |
| | | // "lat": next.lat, |
| | | // "alt": next.alt, |
| | | // 'flyHeading':next.flyHeading, |
| | | // "heading": current.heading, |
| | | // "pitch": current.pitch, |
| | | // "roll": current.roll, |
| | | // "zoom":current.zoom || 1, |
| | | // // 'wait':1 |
| | | // 'wait':0 |
| | | // }); |
| | | // } |
| | | // } |
| | | // Push the last element without any change |
| | | dealArr.push(this.waypoints[this.waypoints.length - 1]); |
| | | // dealArr.push(this.waypoints[this.waypoints.length - 1]); |
| | | this.waypoints = dealArr |
| | | console.log(dealArr) |
| | | this.fileInfo = ` |
| | |
| | | console.log(dealArr) |
| | | let nowTime |
| | | const result = dealArr.map((item, index) => { |
| | | console.log(index) |
| | | // const result = this.waypoints.map((item, index) => { |
| | | // 每次加一天 |
| | | // const time = new Date(startDate.getTime() + index * 60 *1000 + (item.wait ? item.wait :1 ) * 60 * 1000).toISOString(); |
| | | if(index == 0) { |
| | | nowTime = startDate.getTime() + 1 *1000 |
| | | }else{ |
| | | // nowTime = nowTime + (item.wait ? item.wait :1 ) *1000 |
| | | nowTime = nowTime + (item.wait ? item.wait :1 ) *1000 |
| | | } |
| | | const time = new Date(nowTime).toISOString() |
| | |
| | | roll:item.roll || 0, |
| | | speed: 80, |
| | | zoom:item.zoom, |
| | | flyHeading:item.flyHeading |
| | | flyHeading:item.flyHeading, |
| | | nowResult:item.nowResult || [], |
| | | nowAction:item.nowAction |
| | | }; |
| | | }); |
| | | this.trajectoryData = result |
| | |
| | | let totalRoll = 0; |
| | | let totalHeading = 0; |
| | | let flyHeadingData = 0; |
| | | let waitTime = 0; |
| | | let nowResult = [] |
| | | if (placemarks[i]["wpml:actionGroup"]?.[0]?.["wpml:action"]) { |
| | | placemarks[i]["wpml:actionGroup"][0]["wpml:action"].forEach(action => { |
| | | // 处理 gimbalRotate 和 rotateYaw 函数 |
| | |
| | | const aircraftZoom = parseFloat(action['wpml:actionActuatorFuncParam'][0]["wpml:focalLength"][0]); |
| | | lastZoom = aircraftZoom |
| | | } |
| | | |
| | | if (action['wpml:actionActuatorFunc'].includes("hover")) { |
| | | // 获取 aircraftHeading |
| | | var aircraftHeading = parseFloat(action['wpml:actionActuatorFuncParam'][0]["wpml:hoverTime"][0]); |
| | | // 将 aircraftHeading 累加到 totalHeading |
| | | waitTime += aircraftHeading; |
| | | } |
| | | nowResult.push( |
| | | { |
| | | type:action['wpml:actionActuatorFunc'][0], |
| | | value:this.dealDataValue(action) |
| | | } |
| | | ) |
| | | }); |
| | | } |
| | | const filteredArray = nowResult.filter(item => item.type !== "rotateYaw" && item.type !== "gimbalRotate"); |
| | | |
| | | console.log(filteredArray) |
| | | if (coords) { |
| | | coords.trim().split(" ").forEach(coord => { |
| | | const [lng, lat] = coord.split(",").map(Number); |
| | | points.push({ lng, lat, alt: height,heading:totalHeading ?totalHeading:lastHeading ,pitch:totalPitch || 0,roll:totalRoll|| 0 ,flyHeading:flyHeadingData,zoom :lastZoom}); |
| | | // points.push({ lng, lat, alt: height,heading:totalHeading ?totalHeading:lastHeading ,pitch:totalPitch || 0,roll:totalRoll|| 0 ,flyHeading:flyHeadingData,zoom :lastZoom}); |
| | | points.push({ lng, lat, alt: height,heading:totalHeading ?totalHeading:lastHeading ,pitch:totalPitch || 0,roll:totalRoll|| 0 ,flyHeading:flyHeadingData,zoom :lastZoom,waitTime:waitTime,nowResult:filteredArray}); |
| | | }); |
| | | } |
| | | } |
| | |
| | | if (points.length === 0) throw new Error("未找到有效航点"); |
| | | return points; |
| | | }, |
| | | |
| | | dealDataValue(action){ |
| | | switch (action['wpml:actionActuatorFunc'][0]) { |
| | | case 'zoom': |
| | | return '变倍' |
| | | break; |
| | | case 'takePhoto': |
| | | return '拍照' |
| | | break; |
| | | case 'startRecord': |
| | | return '开始录像' |
| | | break; |
| | | case 'hover': |
| | | return `悬停${parseFloat(action['wpml:actionActuatorFuncParam'][0]["wpml:hoverTime"][0])}秒` |
| | | break; |
| | | case 'stopRecord': |
| | | return '结束录像' |
| | | break; |
| | | default: |
| | | console.log('Access Denied!'); |
| | | } |
| | | }, |
| | | // 计算总距离 |
| | | calculateTotalDistance(points) { |
| | | let total = 0; |
| | |
| | | } |
| | | }); |
| | | }, |
| | | julianToDate(julianDate, secondsOfDay) { |
| | | // 1儒略日 = 86400秒,计算时间戳(从公元前4713年1月1日起的秒数) |
| | | const baseJulianDate = 2440587.5; // UTC 1970-01-01 00:00:00 对应的儒略日 |
| | | const daysSinceEpoch = julianDate - baseJulianDate; |
| | | |
| | | // 计算自1970年1月1日以来的秒数 |
| | | const epochSeconds = daysSinceEpoch * 86400 + secondsOfDay; |
| | | |
| | | // 创建对应的 JavaScript Date 对象(毫秒级时间戳) |
| | | const date = new Date(epochSeconds * 1000); // 将秒转换为毫秒 |
| | | return date; |
| | | }, |
| | | |
| | | getCurrentPosition() { |
| | | let viewer = window['cesiumContainer'].viewer; |
| | | // 获取当前时间 |
| | | const currentTime = viewer.clock.currentTime; |
| | | const currentPosition = this.positionProperty.getValue(currentTime); |
| | | // console.log(currentTime) |
| | | // 3. 将 Julian Date 转换为对应的日期对象 |
| | | // const julianDateObj = this.julianToDate(currentTime.dayNumber, currentTime.secondsOfDay); |
| | | |
| | | // console.log("Julian Date 转换后的时间:", julianDateObj.toISOString()); // 转换为 ISO 8601 格式 |
| | | const currentTimeISO = Cesium.JulianDate.toIso8601(currentTime,3) |
| | | this.trajectoryData.forEach((ele)=>{ |
| | | console.log(currentTimeISO) |
| | | console.log(ele.time) |
| | | console.log(currentTimeISO.split('.')[0] ) |
| | | console.log(ele.time.split('.')[0]) |
| | | const eventTimeISO = ele.time; |
| | | // console.log(new Date(currentTimeISO) -new Date(eventTimeISO)) |
| | | console.log(Math.abs(new Date(eventTimeISO).getTime() - new Date(currentTimeISO).getTime())) |
| | | // if ((new Date(currentTimeISO) -new Date(eventTimeISO)) < 20) { |
| | | // if (currentTimeISO.split('.')[0] == ele.time.split('.')[0]) { |
| | | // console.log(ele) |
| | | // // this.matchedEvents.push(event); |
| | | // // console.log(ele) |
| | | // if(ele.nowAction) { |
| | | // this.$message({ |
| | | // message: ele.nowAction, |
| | | // type: 'success' |
| | | // }); |
| | | // } |
| | | // } |
| | | if(Math.abs(new Date(eventTimeISO).getTime() - new Date(currentTimeISO).getTime()) < 15) { |
| | | if(ele.nowAction) { |
| | | this.$message({ |
| | | message: ele.nowAction, |
| | | type: 'success' |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | |
| | | // this.trajectoryData.forEach((ele)=>{ |
| | | // console.log(Cesium.JulianDate.fromIso8601(ele.time)) |
| | | |
| | | // // console.log( Cesium.JulianDate.fromIso8601(ele.time)) |
| | | // // if (Math.abs(julianDateObj - new Date(ele.time)) < 20) { // 允许 1 秒内的误差 |
| | | // // console.log("Julian Date 和 ISO 8601 时间格式非常接近"); |
| | | // // if(ele.nowAction) { |
| | | // // this.$message({ |
| | | // // message: ele.nowAction, |
| | | // // type: 'success' |
| | | // // }); |
| | | // // } |
| | | // // } else { |
| | | // // console.log("Julian Date 和 ISO 8601 时间格式不同"); |
| | | // // } |
| | | // }) |
| | | // console.log(currentTime) |
| | | // console.log(this.trajectoryData) |
| | | const currentPosition = this.positionProperty.getValue(currentTime); |
| | | // 如果获取到位置 |
| | | if (currentPosition) { |
| | | // console.log(currentPosition) |
| | | // 将位置从 Cartesian 转换为 Cartographic |
| | | const cartographicPosition = Cesium.Cartographic.fromCartesian(currentPosition); |
| | | |
| | |
| | | const holderYtHeading = this.holderHeadingProperty.getValue(currentTime) |
| | | const holderYtPitch = this.holderPitchProperty.getValue(currentTime) |
| | | const holderYtRoll = this.holderRollProperty.getValue(currentTime) |
| | | console.log(holderYtHeading) |
| | | // console.log(holderYtHeading) |
| | | if(holderYtHeading) { |
| | | this.heading = holderYtHeading |
| | | this.pitch = holderYtPitch |