From 6694ce6c51abe3a45cd710b676e4b92ae4acc866 Mon Sep 17 00:00:00 2001 From: renxiangke Date: Mon, 27 Jul 2026 14:45:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=88=87=E6=8D=A2=E4=BA=8C?= =?UTF-8?q?=E4=B8=89=E7=BB=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gis/cesium/map.ts | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/gis/cesium/map.ts b/src/gis/cesium/map.ts index af3ed7fe..a25700de 100644 --- a/src/gis/cesium/map.ts +++ b/src/gis/cesium/map.ts @@ -373,35 +373,52 @@ async function obtainViewer(id: string, opt?: InitViewerOptions): Promise { - if (!Cesium.defined(viewer)) - return; - duration = Cesium.defaultValue(duration, 2.0); - if (modelType === '3D') { + if (!defined(viewer)) return; + + // 替换 Cesium.Core.defaultValue + duration = defaultValue(duration, 2.0); + + if (modelType === "3D") { viewer.scene.morphTo3D(duration); - } - else if (modelType === '2D') { + } else if (modelType === "2D") { viewer.scene.morphTo2D(duration); - } - else if (modelType === '2.5D') { + } else if (modelType === "2.5D") { viewer.scene.morphToColumbusView(duration); } + if (callback instanceof Function) { setTimeout(() => { callback(); - }, duration + 1); + }, (duration + 1) * 1000); // 注意:duration单位是秒,setTimeout是毫秒!这里你原有代码有BUG } }); } + function updateViewOnZoom(viewer: any, key: any) { // 获取当前镜头位置的笛卡尔坐标 let cameraPos = viewer.camera.position; @@ -737,6 +754,7 @@ function controlEntityVisibilityByType(type: any, isShow: any) { console.warn(`无此类型的Entity:${type}`); return; } + console.log(entityTypeMap,"2222222222222") // 遍历同类型所有Entity,修改show属性 entityTypeMap[type].forEach((entity: any) => { // 同时控制billboard和label的显隐(也可单独控制)