From 3b5b026d43835a82a9e922d18b7b64ece4506211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E5=A4=A7=E8=83=86?= <1101282782@qq.com> Date: Thu, 17 Jul 2025 17:32:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A3=9E=E7=BA=BF=E9=AB=98?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Obj/Base/FlowLine/index.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Obj/Base/FlowLine/index.js b/src/Obj/Base/FlowLine/index.js index d742203..c631284 100644 --- a/src/Obj/Base/FlowLine/index.js +++ b/src/Obj/Base/FlowLine/index.js @@ -89,6 +89,7 @@ class FlowLine extends Base { const minLat = Math.min(...lats), maxLat = Math.max(...lats); const points = []; + let that = this while (points.length < count) { const lon = minLon + Math.random() * (maxLon - minLon); const lat = minLat + Math.random() * (maxLat - minLat); @@ -100,9 +101,14 @@ class FlowLine extends Base { const isInside = turf.booleanPointInPolygon(point, polygon); if (isInside) { + let posi = Cesium.Cartesian3.fromDegrees(lon, lat); + const cartographic = that.viewer.scene.globe.ellipsoid.cartesianToCartographic(posi); + const height = cartographic.height; + points.push([ lon, - lat + lat, + height ]); } } @@ -126,9 +132,10 @@ class FlowLine extends Base { positions.forEach((item, index) => { let point = item //根据点设置起始点位置 - let start = Cesium.Cartesian3.fromDegrees(point[0], point[1], 0) + // let start = Cesium.Cartesian3.fromDegrees(point[0], point[1], 0) + let start = Cesium.Cartesian3.fromDegrees(point[0], point[1], point[2]) //根据点设置结束点位置 - let end = Cesium.Cartesian3.fromDegrees(point[0], point[1], that.options.height + Math.random() * that.options.heightDifference) + let end = Cesium.Cartesian3.fromDegrees(point[0], point[1], point[2] + that.options.height + Math.random() * that.options.heightDifference) //创建线 that.viewer.entities.add({ parent: celiangEntity, @@ -425,7 +432,7 @@ class FlowLine extends Base { let a = Cesium.Cartesian3.fromDegrees( this.positions[i][0], this.positions[i][1], - this.options.height + this.options.heightDifference / 2 + this.positions[i][2] + this.options.height + this.options.heightDifference / 2 ) positionArray.push(a.x, a.y, a.z) }