距离计算
This commit is contained in:
@ -73,7 +73,7 @@ class MeasureProjectionDistance extends Measure {
|
||||
let l = this.clampPositions.length - 1
|
||||
this.clampPositions.forEach((item, index) => {
|
||||
if (index !== l) {
|
||||
let d1 = this.computeDistance([item.position, this.clampPositions[index + 1].position])
|
||||
let d1 = this.computeDistance2([item.position, this.clampPositions[index + 1].position])
|
||||
let d2 = Math.abs(item.position.alt - this.clampPositions[index + 1].position.alt)
|
||||
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||
total_length += d3
|
||||
@ -174,7 +174,7 @@ class MeasureProjectionDistance extends Measure {
|
||||
if (this.ids.length !== 0) {
|
||||
let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
||||
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||
let cur_len = this.computeDistance([cur_point, pre_p])
|
||||
let cur_len = this.computeDistance2([cur_point, pre_p])
|
||||
let text = "投影距离:" + cur_len + " 米"
|
||||
this.ids.push(MeasureProjectionDistance.create_point(car, {label: this.getLabel(text)}, this))
|
||||
this.cachePositions.push(car)
|
||||
@ -215,7 +215,7 @@ class MeasureProjectionDistance extends Measure {
|
||||
if (this.cachePositions.length) {
|
||||
let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
||||
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||
let cur_len = this.computeDistance([cur_point, pre_p])
|
||||
let cur_len = this.computeDistance2([cur_point, pre_p])
|
||||
let text = "当前投影距离:" + cur_len + " 米"
|
||||
this.tip.set_text(text)
|
||||
}
|
||||
|
Reference in New Issue
Block a user