| | |
| | | const placemarks = |
| | | result.kml.Document[0].Folder[0].Placemark || []; |
| | | const points = []; |
| | | |
| | | var lastZoom =1 |
| | | placemarks.forEach(placemark => { |
| | | const coords = placemark.Point?.[0]?.coordinates?.[0]; |
| | | const height = placemark["wpml:height"]?.[0]; |
| | |
| | | let totalRoll = 0; |
| | | let totalHeading = 0; |
| | | let flyHeadingData = 0; |
| | | let currentzoom = 1 |
| | | if (placemark["wpml:actionGroup"]?.[0]?.["wpml:action"]) { |
| | | placemark["wpml:actionGroup"][0]["wpml:action"].forEach(action => { |
| | | // 处理 gimbalRotate 和 rotateYaw 函数 |
| | |
| | | // 将 aircraftHeading 累加到 totalHeading |
| | | totalHeading += aircraftHeading; |
| | | } |
| | | |
| | | // 处理 rotateYaw 函数 |
| | | if (action['wpml:actionActuatorFunc'].includes("zoom")) { |
| | | const aircraftHeading = parseFloat(action['wpml:actionActuatorFuncParam'][0]["wpml:focalLength"][0]); |
| | | currentzoom = aircraftHeading |
| | | } |
| | | const aircraftZoom = parseFloat(action['wpml:actionActuatorFuncParam'][0]["wpml:focalLength"][0]); |
| | | lastZoom = aircraftZoom |
| | | } |
| | | }); |
| | | } |
| | | if (coords) { |
| | | coords.trim().split(" ").forEach(coord => { |
| | | const [lng, lat] = coord.split(",").map(Number); |
| | | points.push({ lng, lat, alt: height,heading:totalHeading || 0,pitch:totalPitch || 0,roll:totalRoll|| 0 ,flyHeading:flyHeadingData,zoom : currentzoom || 1}); |
| | | points.push({ lng, lat, alt: height,heading:totalHeading || 0,pitch:totalPitch || 0,roll:totalRoll|| 0 ,flyHeading:flyHeadingData,zoom :lastZoom}); |
| | | }); |
| | | } |
| | | }); |