无人机管理后台前端(已迁走)
shuishen
2025-09-27 e7be05464134cb01ee3a9da428cada4758acd227
feat:地形加载方式调整
5 files modified
38 ■■■■ changed files
.env.development 4 ●●●● patch | view | raw | blame | history
.env.localhost 2 ●●● patch | view | raw | blame | history
.env.production 2 ●●● patch | view | raw | blame | history
.env.test 2 ●●● patch | view | raw | blame | history
src/utils/cesium/publicCesium.js 28 ●●●● patch | view | raw | blame | history
.env.development
@@ -2,7 +2,7 @@
 # @Author       : yuan
 # @Date         : 2025-07-29 15:59:42
 # @LastEditors  : yuan
 # @LastEditTime : 2025-07-29 16:15:31
 # @LastEditTime : 2025-09-27 15:47:12
 # @FilePath     : \.env.development
 # @Description  :
 # Copyright 2025 OBKoro1, All Rights Reserved.
@@ -37,7 +37,7 @@
VITE_APP_AIRLINE_URL = https://wrj.shuixiongit.com/minio/cloud-bucket
# 图片存放地址
VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_terrain/all_terrain
VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_terrain/
# 行政区划存放地址
VITE_APP_REGION_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_region
# 算法仓库图片地址
.env.localhost
@@ -26,7 +26,7 @@
VITE_APP_AIRLINE_URL = http://192.168.1.227:80/minio/cloud-bucket
# 图片存放地址
VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_terrain/all_terrain
VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_terrain/
# 行政区划存放地址
VITE_APP_REGION_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_region
.env.production
@@ -28,7 +28,7 @@
VITE_APP_AIRLINE_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket
# 图片存放地址
VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_terrain/all_terrain
VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_terrain/
# 算法仓库图片地址
VITE_APP_PICTURE_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket
.env.test
@@ -26,7 +26,7 @@
VITE_APP_AIRLINE_URL = https://wrj.shuixiongit.com/minio/cloud-bucket
# 图片存放地址
VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_terrain/all_terrain
VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_terrain/
# 算法仓库图片地址
VITE_APP_PICTURE_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket
src/utils/cesium/publicCesium.js
@@ -143,8 +143,28 @@
        this.viewer?.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK) // 禁用双击
        if (terrain) {
            // 正则:第一位非0,第二位任意数字,后10位都是0
            const re = /^[1-9]\d0{10}$/
            let result = null
            // 1️⃣先判断 areaCode
            if (re.test(store.state.user.userInfo.detail.areaCode)) {
                result = store.state.user.userInfo.detail.areaCode.slice(0, 6)
            } else {
                // 2️⃣如果不满足,从 ancestors 里找
                const matchedItems = store.state.user.userInfo.detail.ancestors
                    .split(',')
                    .filter(item => re.test(item)) // 过滤出符合条件的
                // 取第一个符合条件的前6位(可以改成 last one 看需求)
                if (matchedItems.length > 0) {
                    result = matchedItems[0].slice(0, 6)
                }
            }
            try {
                Cesium.CesiumTerrainProvider.fromUrl(`${import.meta.env.VITE_APP_TERRAIN_URL}`, {
                Cesium.CesiumTerrainProvider.fromUrl(`${import.meta.env.VITE_APP_TERRAIN_URL}${result}`, {
                    requestVertexNormals: true, // 启用地形法线增强立体感
                    requestWaterMask: true, // 启用水体遮罩效果
                }).then(terrainProvider => {
@@ -209,7 +229,7 @@
    async switchContour (open) {
        if (open) {
            await this.boundary?.openContour()
        } else {
            this.boundary?.closeContour()
        }
@@ -752,7 +772,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)),
@@ -781,7 +801,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
    }