From 9eb8bb59b802ceef1f52d334c8e577f2bf02c90e Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Wed, 21 Jan 2026 15:12:02 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 applications/drone-command/src/utils/cesium/publicCesium.js |   37 ++++++++++++++++++++++++++++++++++---
 1 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/applications/drone-command/src/utils/cesium/publicCesium.js b/applications/drone-command/src/utils/cesium/publicCesium.js
index e0fe177..7fb65d2 100644
--- a/applications/drone-command/src/utils/cesium/publicCesium.js
+++ b/applications/drone-command/src/utils/cesium/publicCesium.js
@@ -2,6 +2,7 @@
 import * as Cesium from 'cesium'
 import { Cartesian3, Terrain, Viewer } from 'cesium'
 import store from '@/store/index'
+import jaGeojsonRaw from '@/assets/geojson/ja.geojson?raw'
 
 import getBaseConfig from '@/buildConfig/config'
 
@@ -32,6 +33,36 @@
 /**
  * 公共的Cesium (蓝色,2d)
  */
+
+const DEFAULT_VIEW_RECTANGLE = (() => {
+	try {
+		const geojson = JSON.parse(jaGeojsonRaw)
+		let west = Infinity
+		let east = -Infinity
+		let south = Infinity
+		let north = -Infinity
+		const walk = coords => {
+			if (!Array.isArray(coords)) return
+			if (typeof coords[0] === 'number' && typeof coords[1] === 'number') {
+				const lng = coords[0]
+				const lat = coords[1]
+				if (!Number.isFinite(lng) || !Number.isFinite(lat)) return
+				west = Math.min(west, lng)
+				east = Math.max(east, lng)
+				south = Math.min(south, lat)
+				north = Math.max(north, lat)
+				return
+			}
+			coords.forEach(walk)
+		}
+		geojson?.features?.forEach(feature => walk(feature?.geometry?.coordinates))
+		if ([west, east, south, north].every(Number.isFinite)) {
+			return Cesium.Rectangle.fromDegrees(west, south, east, north)
+		}
+	} catch (error) {}
+	return Cesium.Rectangle.fromDegrees(66, 4, 135, 53.55)
+})()
+
 
 // 封装的不用管
 let cn = {
@@ -100,13 +131,13 @@
 			dockOptions = {},
 			boundaryChange,
 			terrainLoadCallback,
-			boundaryColor = '#7FFFD4',
+			boundaryColor = '#00F9EC',
 			dockRangeType = 1,
 			useDockHeight = false
 		} = options
 		Cesium.Camera.DEFAULT_VIEW_FACTOR = -0.45
 		// 西南东北,默认显示中国
-		Cesium.Camera.DEFAULT_VIEW_RECTANGLE = Cesium.Rectangle.fromDegrees(66, 4, 135, 53.55)
+		Cesium.Camera.DEFAULT_VIEW_RECTANGLE = DEFAULT_VIEW_RECTANGLE
 		const viewerOptions = {
 			infoBox: false, // 禁用沙箱,解决控制台报错
 			animation: false, // 左下角的动画仪表盘
@@ -881,4 +912,4 @@
 			this.viewer?.imageryLayers.remove(imageryLayers)
 		}
 	}
-}
+}
\ No newline at end of file

--
Gitblit v1.9.3