| | |
| | | this.waypoints = await this.parseKMZ(arrayBuffer); |
| | | //加点逻辑 比如向第2-n-1中插入元素 经纬度为当前的 heading pitch roll 下一个的 |
| | | const dealArr = []; |
| | | // console.log(">> this.waypoints:", this.waypoints); |
| | | console.log(">> this.waypoints:", this.waypoints); |
| | | for (let i = 0; i < this.waypoints.length - 1; i++) { |
| | | dealArr.push(this.waypoints[i]); // Push the current element |
| | | const current = this.waypoints[i]; |
| | | const next = this.waypoints[i + 1]; |
| | | 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' : 5 |
| | | }); |
| | | dealArr.push({ |
| | | "lng": next.lng, |
| | | "lat": next.lat, |
| | |
| | | "heading": current.heading, |
| | | "pitch": current.pitch, |
| | | "roll": current.roll, |
| | | "zoom":next.zoom || 1 |
| | | "zoom":current.zoom || 1, |
| | | 'wait':1 |
| | | }); |
| | | |
| | | } |
| | | |
| | | // Push the last element without any change |
| | | dealArr.push(this.waypoints[this.waypoints.length - 1]); |
| | | this.waypoints = dealArr |
| | | console.log(dealArr) |
| | | this.fileInfo = ` |
| | | 航点:${this.waypoints.length}个 <br/> |
| | | 距离:${this.calculateTotalDistance(this.waypoints).toFixed(2)}公里 |
| | |
| | | } |
| | | // const startDate = new Date("2025-04-01T13:00:00Z"); |
| | | const startDate = new Date(date.toISOString()); |
| | | 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).toISOString(); |
| | | // 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 |
| | | } |
| | | const time = new Date(nowTime).toISOString() |
| | | // const time = Cesium.JulianDate.addSeconds(startDate, 3600, new Cesium.JulianDate()); |
| | | return { |
| | | time, |
| | |
| | | }; |
| | | }); |
| | | this.trajectoryData = result |
| | | // console.log(this.trajectoryData) |
| | | console.log(this.trajectoryData) |
| | | this.loadTimeLine() |
| | | } catch (error) { |
| | | console.error(error); |
| | |
| | | const height = placemarks[i]["wpml:height"]?.[0]; |
| | | if(i<placemarks.length-1){ |
| | | // console.log(placemarks[i]) |
| | | console.log( placemarks[i].Point?.[0]?.coordinates?.[0].split(',')[0]) |
| | | console.log( placemarks[i].Point?.[0]?.coordinates?.[0].split(',')[1]) |
| | | console.log( placemarks[i+1].Point?.[0]?.coordinates?.[0].split(',')[0]) |
| | | console.log( placemarks[i+1].Point?.[0]?.coordinates?.[0].split(',')[1]) |
| | | // console.log( placemarks[i].Point?.[0]?.coordinates?.[0].split(',')[0]) |
| | | // console.log( placemarks[i].Point?.[0]?.coordinates?.[0].split(',')[1]) |
| | | // console.log( placemarks[i+1].Point?.[0]?.coordinates?.[0].split(',')[0]) |
| | | // console.log( placemarks[i+1].Point?.[0]?.coordinates?.[0].split(',')[1]) |
| | | let lon1 = placemarks[i].Point?.[0]?.coordinates?.[0].split(',')[0] |
| | | let lat1 = placemarks[i].Point?.[0]?.coordinates?.[0].split(',')[1] |
| | | let lon2 = placemarks[i+1].Point?.[0]?.coordinates?.[0].split(',')[0] |
| | |
| | | // lastHeading = this.azimuthtwopoi(lon1,lat1,lon2,lat2) |
| | | } |
| | | |
| | | console.log(lastHeading) |
| | | console.log('+++++++++++++++++++++++++') |
| | | // console.log(lastHeading) |
| | | // console.log('+++++++++++++++++++++++++') |
| | | } |
| | | // 提取 aircraftHeading |
| | | // 提取 action 里的参数 |