Browse Source

fix(cockpit): 关联设备点图标在地形采样前回退椭球投影

关联设备 billboard 已由 DOM 接管,DOM 投影仍按“无地形就不画”的严格口径时,
地面采样未就绪的几帧里设备图标会被 hidePooledNode 整块隐藏,表现为定位成功但设备点丢失。
设备/聚合 DOM 投影改用 anchorGroundHeightAt,先回退椭球面 0 米再随采样校正。
ChenJZ 10 hours ago
parent
commit
228c16382c
1 changed files with 9 additions and 7 deletions
  1. 9 7
      src/modules/cockpit/services/cesiumEngine.js

+ 9 - 7
src/modules/cockpit/services/cesiumEngine.js

@@ -1813,9 +1813,10 @@ export function projectDeviceMarkers(viewer) {
         if (!code || entity.show === false) continue
         // projectMarkerEntity 已含画布原点(窗口坐标)与 pixelOffset(尖端落点)——直接用,
         // 调用方只减宿主原点(与 projectToWindow 的口径只差 host 一层)。
-        // 渲染口径:地形还没有可信地面时回 null,该设备本轮不上图
-        // (不按椭球面画到地底;见 `markerGroundHeight`)。
-        const projected = projectMarkerEntity(viewer, entity, markerGroundHeightAt)
+        // 关联设备是 DOM 视觉(billboard 已隐藏):地面高度采样未就绪时若回 null,
+        // DOM 节点会被隐藏,用户看到“定位成功但设备点图标丢失”(#135 走查)。
+        // 回退椭球面 0 米先画出来,采样到达后再校正;锚定/让位早已用同一口径。
+        const projected = projectMarkerEntity(viewer, entity, anchorGroundHeightAt)
         if (!projected) continue
         const color = entity.billboard && entity.billboard.color ? entity.billboard.color.getValue() : null
         // 本设备是否是当前组的中心(= 聚合点已被它替换)。
@@ -1888,8 +1889,8 @@ export function projectOverlapSymbols(viewer) {
         const properties = entity.properties || {}
         const read = (key) => (properties[key] && properties[key].getValue ? properties[key].getValue() : '')
         if (read('overlapAggregate') !== true || entity.isShowing !== true) continue
-        // 渲染口径同上:没有可信地面就不画聚合符号,不摆椭球假位置。
-        const projected = projectMarkerEntity(viewer, entity, markerGroundHeightAt)
+        // 渲染口径同上:关联设备/聚合符号是 DOM 视觉,地面采样未就绪也不能整块消失。
+        const projected = projectMarkerEntity(viewer, entity, anchorGroundHeightAt)
         if (!projected) continue
         out.push({
             key: `overlap|${read('overlapPointCode')}|${read('overlapGroup')}`,
@@ -2528,8 +2529,9 @@ function anchorGroundHeightAt(viewer, lon, lat) {
 /** 贴地投影与屏幕分离共用一份口径,返回视觉中心及当前图标尺寸。
  *
  * `groundOf` 决定「没有可信地面时怎么办」,由调用方显式给(两个消费方的要求相反):
- *   · `markerGroundHeightAt`(DOM 标记层):回 null=不上图,不按椭球面摆假位置;
- *   · `anchorGroundHeightAt`(让位/锚定/走查读数):回椭球面 0 米,判据不能比可见性更严。
+ *   · `markerGroundHeightAt`(摘要点标记层):回 null=不上图,不按椭球面摆假位置;
+ *   · `anchorGroundHeightAt`(锚定/让位/关联设备 DOM 标记):回椭球面 0 米,
+ *     判据不能比可见性更严;关联设备 billboard 已由 DOM 接管,采样未就绪也不能整块消失。
  */
 function projectMarkerEntity(viewer, entity, groundOf) {
     if (!viewer || !viewer.scene || !viewer.canvas || !entity || !entity.isShowing || !entity.position || !entity.billboard) return null