线 空间长度、投影长度、地表长度bug修改

This commit is contained in:
2025-07-11 15:46:29 +08:00
parent e45b67298a
commit ff60cc4f65
8 changed files with 25 additions and 54 deletions

View File

@ -212,22 +212,12 @@ class Tools {
arr.push(r)
}
let l = arr.length - 1
arr.forEach((item, index) => {
if (index !== l) {
let posi = [item.position, arr[index + 1].position]
let d1 = 0
for (let i = 0; i < posi.length - 1; i++) {
const position1 = Cesium.Cartesian3.fromDegrees(posi[i].lng, posi[i].lat, posi[i].alt);
const position2 = Cesium.Cartesian3.fromDegrees(posi[i + 1].lng, posi[i + 1].lat, posi[i + 1].alt);
const distance = Cesium.Cartesian3.distance(position1, position2);
d1 = d1 + distance
}
let d2 = Math.abs(item.position.alt - arr[index + 1].position.alt)
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
length += d3
}
})
for (let i = 0; i < arr.length - 1; i++) {
const position1 = Cesium.Cartesian3.fromDegrees(arr[i].position.lng, arr[i].position.lat, 0);
const position2 = Cesium.Cartesian3.fromDegrees(arr[i + 1].position.lng, arr[i + 1].position.lat, 0);
const distance = Cesium.Cartesian3.distance(position1, position2);
length = length + distance
}
break
default:
break;
@ -1273,7 +1263,7 @@ class Tools {
replaceHost(url, host) {
let newUrl = url
if(!url || !host) {
if (!url || !host) {
return url
}
try {