From 02409bfbe15f22fc3b5dccadabfd860a660a49d9 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Sat, 11 Oct 2025 10:37:14 +0800
Subject: [PATCH] feat: 名称修改

---
 src/utils/cesium/publicCesium.js |   53 +++++++++++++++++++++++++++++------------------------
 1 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/src/utils/cesium/publicCesium.js b/src/utils/cesium/publicCesium.js
index 59b1acf..e0d3d88 100644
--- a/src/utils/cesium/publicCesium.js
+++ b/src/utils/cesium/publicCesium.js
@@ -94,13 +94,13 @@
 			terrain = false,
 			layerMode = 0,
 			contour = true,
-			// flyToContour = false,
+			flyToContour = false,
 			multiple = 1.4,
 
 			dockOptions = {},
 
-
-
+			boundaryColor = '#7FFFD4',
+			boundaryChange,
 			dockRangeType = 1,
 			useDockHeight = false
 		} = options
@@ -135,7 +135,7 @@
 		this.viewer.clockViewModel.currentTime = Cesium.JulianDate.addHours(utc, 0, new Cesium.JulianDate())
 
 		// 边界,机巢
-
+		this.boundary = useBoundary(this.viewer, { multiple, dockOptions, boundaryChange, boundaryColor, dockRangeType, useDockHeight })
 		this.viewer?.imageryLayers.removeAll()
 		this.viewer._cesiumWidget._creditContainer.style.display = 'none'
 		handler = new Cesium.ScreenSpaceEventHandler(this.viewer?.scene.canvas)
@@ -149,6 +149,8 @@
 					requestWaterMask: true, // 启用水体遮罩效果
 				}).then(terrainProvider => {
 					this.viewer.terrainProvider = terrainProvider
+
+					options?.terrainInit?.()
 				})
 			} catch (error) {
 				console.error('地形加载失败:', error)
@@ -158,8 +160,8 @@
 		this.viewer.scene.screenSpaceCameraController.maximumZoomDistance = 4500000
 		this.switchLayers(layerMode)
 		this.switchFlatMode(flatMode)
-		// this.switchContour(contour)
-		// flyToContour && this.flyToContour(contour)
+		this.switchContour(contour)
+		flyToContour && this.flyToContour(contour)
 	}
 
 	getViewer () {
@@ -193,33 +195,36 @@
 			gl = null
 			this.viewer?.destroy() // 销毁Viewer实例
 			this.viewer = null
-			var cesiumContainer = document.getElementById(this.viewerDom)
-			if (cesiumContainer && removeDom) {
-				cesiumContainer.remove() // 移除与地图相关的DOM元素
-				this.viewerDom = null
-			}
+			// var cesiumContainer = document.getElementById(this.viewerDom)
+			// if (cesiumContainer && removeDom) {
+			// 	cesiumContainer.remove() // 移除与地图相关的DOM元素
+			// 	this.viewerDom = null
+			// }
+			this.viewerDom = null
 		}
 	}
 
 	setShowDock (sns) {
-		// this.boundary?.setShowDock(sns)
+		this.boundary?.setShowDock(sns)
 	}
 
 	// 切换轮廓显示
-	// async switchContour (open) {
-	// 	if (open) {
-	// 		await this.boundary?.openContour()
-	// 	} else {
-	// 		this.boundary?.closeContour()
-	// 	}
-	// }
+	async switchContour (open) {
+		if (open) {
+			await this.boundary?.openContour()
+
+		} else {
+			this.boundary?.closeContour()
+		}
+	}
 	// // 飞向轮廓居中
-	// flyToContour () {
-	// 	this.boundary?.flyToBoundary()
-	// }
+	flyToContour () {
+		this.boundary?.flyToBoundary()
+	}
 
 	// 飞行 flyto
 	flyTo (pointOption, time = 4, height = 3000, orientation = {}, complete = () => { }) {
+		console.log(pointOption, )
 		if (!pointOption.longitude && !pointOption.latitude) return
 		const destination = Cesium.Cartesian3.fromDegrees(pointOption.longitude, pointOption.latitude, height)
 		const duration = time
@@ -751,7 +756,7 @@
 			Cesium.Cartesian3.subtract(a, this.viewer?.camera.position, a),
 			Cesium.Cartesian3.normalize(r, r),
 			Cesium.Cartesian3.normalize(a, a)) : (r = c.direction,
-			a = h.direction)
+				a = h.direction)
 		let d = Cesium.Cartesian3.dot(r, a)
 			, p = 0
 		return d < 1 && (p = Math.acos(d)),
@@ -780,7 +785,7 @@
 				, r = Cesium.Math.acosClamped(-e)
 			a > 0 && a > r && (a = r - Cesium.Math.EPSILON4),
 				r = Cesium.Math.acosClamped(e),
-			a < 0 && -a > r && (a = -r + Cesium.Math.EPSILON4)
+				a < 0 && -a > r && (a = -r + Cesium.Math.EPSILON4)
 		}
 		return a
 	}

--
Gitblit v1.9.3