线 空间长度、投影长度、地表长度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

@ -23,7 +23,7 @@ class PolylineObject extends Base {
* @description 折线
* @param options {object} 线属性
* @param options.name{string} 名称
* @param options.width=3{number} 线宽
* @param options.width * @param options.width=3{number} 线宽
* @param options.color=#ff0000 {string} 颜色
* @param options.type=0 {number} 材质类型 0-实线 1-虚线 2-泛光
* @param options.heightMode=2{number} 高度模式0海拔高度1相对高度2依附模式
@ -261,6 +261,7 @@ class PolylineObject extends Base {
break
default:
this.length = this.noseToTail ? this.options.fitLengthByMeter : this.options.lengthByMeter
break
}
} else {
let length = this.noseToTail ? this.options.fitLengthByMeter : this.options.lengthByMeter
@ -279,7 +280,6 @@ class PolylineObject extends Base {
})
let _this = this
if (!this.noseToTail) {
this.computeDistance(
this.options.positions,
@ -294,12 +294,10 @@ class PolylineObject extends Base {
_this.length = res
_this.lengthUnit = '米'
}
})
} else {
let fromDegreesArray = this.renewPositions(this.options.positions)
}
}
get fitLengthUnit() {
@ -478,16 +476,20 @@ class PolylineObject extends Base {
}
if (v) {
if (this.options.fitLengthByMeter > 1000 || this.options.fitLengthByMeter == 1000) {
document.getElementsByClassName('input-select-unit')[1].querySelectorAll('dd')[1].click()
let dom = document.getElementsByClassName('input-select-unit')[1]
dom && dom.querySelectorAll('dd')[1] && dom.querySelectorAll('dd')[1].click()
} else {
document.getElementsByClassName('input-select-unit')[1].querySelectorAll('dd')[0].click()
let dom = document.getElementsByClassName('input-select-unit')[1]
dom && dom.querySelectorAll('dd')[0] && dom.querySelectorAll('dd')[0].click()
}
} else {
if (this.options.lengthByMeter > 1000 || this.options.lengthByMeter == 1000) {
document.getElementsByClassName('input-select-unit')[1].querySelectorAll('dd')[1].click()
let dom = document.getElementsByClassName('input-select-unit')[1]
dom && dom.querySelectorAll('dd')[1] && dom.querySelectorAll('dd')[1].click()
} else {
document.getElementsByClassName('input-select-unit')[1].querySelectorAll('dd')[0].click()
let dom = document.getElementsByClassName('input-select-unit')[1]
dom && dom.querySelectorAll('dd')[0] && dom.querySelectorAll('dd')[0].click()
}
}
}
@ -554,7 +556,7 @@ class PolylineObject extends Base {
// 2,
// ground
// )
this.lengthUnit = this.lengthUnit
// this.lengthUnit = this.lengthUnit
this._elms.heightMode && (this._elms.heightMode.value = heightModeName)
this._elms.heightModeObject && (this._elms.heightModeObject.legp_searchActive(
heightModeName
@ -810,29 +812,6 @@ class PolylineObject extends Base {
}, //点击确认按钮事件回调
clear: () => {
this.labelLineColor = 'rgba(0,255,255,0.5)'
} //点击清空按钮事件回调
})
this._elms.labelLineColor[i] = lineColorPicker
})
}
}
get labelBackgroundColorStart() {
return this.options.label.backgroundColor[0]
}
set labelBackgroundColorStart(v) {
this.options.label.backgroundColor[0] = v
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
if (this._elms.labelBackgroundColorStart) {
this._elms.labelBackgroundColorStart.forEach((item, i) => {
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
el: item.el,
size: 'mini', //颜色box类型
alpha: true, //是否开启透明度
defaultColor: this.labelBackgroundColorStart,
disabled: false, //是否禁止打开颜色选择器
openPickerAni: 'opacity', //打开颜色选择器动画
sure: color => {
this.labelBackgroundColorStart = color
}, //点击确认按钮事件回调
clear: () => {
@ -2178,7 +2157,8 @@ class PolylineObject extends Base {
2,
this.options['words-name']
).then(res => {
_this.options.fitLengthByMeter
_this.options.fitLengthByMeter = res
_this.lengthUnit = _this.options['length-unit']
})
} else {
let _this = this
@ -2187,17 +2167,18 @@ class PolylineObject extends Base {
2,
this.options['words-name']
).then(res => {
_this.options.fitLengthByMeter
_this.options.fitLengthByMeter = res
_this.lengthUnit = _this.options['length-unit']
})
}
this.fitLengthUnit = this.options['fit-length-unit']
let _this = this
this.computeDistance(
positions,
2,
this.options['words-name']
).then(res => {
_this.options.lengthByMeter
_this.options.lengthByMeter = res
_this.lengthUnit = this.options['length-unit']
})
return fromDegreesArray

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);
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);
d1 = d1 + distance
length = length + distance
}
let d2 = Math.abs(item.position.alt - arr[index + 1].position.alt)
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
length += d3
}
})
break
default:
break;
@ -1273,7 +1263,7 @@ class Tools {
replaceHost(url, host) {
let newUrl = url
if(!url || !host) {
if (!url || !host) {
return url
}
try {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 18 KiB