Bladeren bron

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/modules/cockpit/services/mapService.js
#	src/modules/cockpit/services/markerOverlay.js
ChenJZ 1 dag geleden
bovenliggende
commit
528e55669d

+ 5 - 2
.env.development

@@ -9,8 +9,11 @@ VITE_APP_MINIO_BASE_URL='http://111.23.174.45:9000/pipe/'
 
 # 现有配置服务使用 VITE_COCKPIT_*,不是参考项目的 VITE_APP_BASE_API。
 VITE_COCKPIT_DATA_SOURCE='real'
-VITE_COCKPIT_API_BASE_URL='http://192.168.110.96:8301/api/cockpit/v1'
-VITE_COCKPIT_WS_URL='ws://192.168.110.96:8301/ws/deviceStatus'
+VITE_COCKPIT_API_BASE_URL='/api/cockpit/v1'
+VITE_COCKPIT_WS_URL='/ws/deviceStatus'
+
+# 仅 Node 侧 dev 代理目标,不进入浏览器产物;后端不在本机时改这里。
+COCKPIT_API_ORIGIN='http://127.0.0.1:8301'
 
 # 自动读取 public/cockpit/config.json;该文件的值优先于上述兜底值。
 # 无本机 JSON 时使用 deploy/cockpit.config.json + 本环境连接配置;GIS/模型不在 .env 重复维护。

+ 4 - 0
.env.local.example

@@ -2,3 +2,7 @@
 # 生产不使用开发中间件,须由 Nginx/CDN 挂载相同 URL 前缀。
 # 不要在 .env.local 写开发 API/WS/图片地址,以免 FES 预加载覆盖生产配置。
 COCKPIT_GIS_MOUNTS=[{"prefix":"/gis/pic-ring0","dir":"D:/GIS/cockpit-gis-v2/pic-ring0"},{"prefix":"/gis/pic-ring1","dir":"D:/GIS/cockpit-gis-v2/pic-ring1"},{"prefix":"/gis/pic-ring2","dir":"D:/GIS/cockpit-gis-v2/pic-ring2"},{"prefix":"/gis/pic-ring3","dir":"D:/GIS/cockpit-gis-v2/pic-ring3"},{"prefix":"/gis/dem-lod","dir":"D:/GIS/cockpit-gis-v2/dem"},{"prefix":"/gis/cad-bim","dir":"D:/GIS/cockpit-models/cad-bim"}]
+
+# 后端不在本机时,在本机 .env.local 覆盖 dev 代理目标(Node 侧变量,不进入浏览器产物)。
+# 默认见 .env.development 的 COCKPIT_API_ORIGIN='http://127.0.0.1:8301'。
+COCKPIT_API_ORIGIN='http://127.0.0.1:8301'

+ 73 - 0
docs/marker-rendering-performance.md

@@ -0,0 +1,73 @@
+# 地图标点交互性能优化记录
+
+## 问题与数据流
+
+地图标记计划由 [MapCanvas.vue](../src/modules/cockpit/components/MapCanvas.vue) 消费 [modeLayerPlan.js](../src/modules/cockpit/domain/modeLayerPlan.js) 的模式计划;点位状态及坐标准入由 [pointStatus.js](../src/modules/cockpit/domain/pointStatus.js) 处理。计划随后进入 [mapService.js](../src/modules/cockpit/services/mapService.js) 的 `syncPointMarkersForPlan()`:
+
+1. Cesium 点位实体保留完整身份和诊断数据;DOM overlay 接管视觉时,Cesium 点位视觉隐藏。
+2. Cesium `postRender` 调用 `getFrameState()`,取得当前标记行、相机帧状态和投影函数。
+3. [cesiumEngine.js](../src/modules/cockpit/services/cesiumEngine.js) 计算点位地面高度并投影;[markerOverlay.js](../src/modules/cockpit/services/markerOverlay.js) 更新 DOM 标记、标签和交互状态。
+4. 地图卸载时,overlay 清除 `preRender` / `postRender` 监听器、节点池和宿主节点。
+
+本次浏览器检查时,真实页面有 **397 个标点计划、408 个 overlay 节点**。
+
+## 根因与影响
+
+### 主因:逐点重复进行 Cesium 世界坐标到窗口坐标转换
+
+相机每次渲染都会投影标点。旧路径对每个点调用 `SceneTransforms.worldToWindowCoordinates()`,重复执行视图/投影矩阵变换及视口变换。标点数增多后,这项同步主线程工作随标点数逐帧增长,直接影响平移和旋转期间的帧预算。
+
+匹配的 40 步平移/旋转浏览器采样中,优化前 overlay 投影 P95 为 **44.9ms**,overlay 总 P95 为 **51.7ms**。
+
+### 次因:逐点临时对象与重复状态工作
+
+- 遮挡缓存每个点都格式化相机坐标并创建字符串键。
+- 行坐标的 ECEF 计算、地形高度键生成及画布矩形读取存在可复用部分。
+- Overlay 每帧遍历标记并重复构造身份/状态指纹;节点池中已隐藏节点也会被扫描。
+
+DOM 标记和标签仍需随相机移动,但可避免重复构造和无变化写入。离屏节点仍保留在池中,不改变标记计划或总数。
+
+## 实施内容
+
+- 新增 [markerProjection.js](../src/modules/cockpit/services/markerProjection.js):复用 `Cartesian4` / `Cartesian2` scratch 结果,用帧级 view-projection 矩阵投影 3D 透视场景中的单个 ECEF 点。
+- 在 [cesiumEngine.js](../src/modules/cockpit/services/cesiumEngine.js) 的帧准备阶段合并投影矩阵和相机视图矩阵;标点逐点路径改为一次矩阵向量变换。非 3D 透视场景保留原 Cesium 转换回退路径。
+- 按标记行对象缓存 ECEF 坐标与地形高度键;遮挡体按相机数值坐标和椭球体复用。
+- 在 [mapService.js](../src/modules/cockpit/services/mapService.js) 复用 overlay 坐标对象,并每帧准备一次投影矩形和矩阵。
+- 在 [markerOverlay.js](../src/modules/cockpit/services/markerOverlay.js) 缓存标记身份和指纹,只隐藏上一帧可见、当前已不可见的节点;超过 320px 视口安全边界的节点不参与绘制,回到视口后仍可重显。
+- DOM overlay 接管时隐藏专用 Cesium 点位数据源的视觉;实体仍保留,计数和诊断读取不变。
+- 增加仅用于 DEV 的 overlay 分段耗时采样接口。
+
+未改变共享数据结构、点位筛选、排序、状态、样式、相机控制、刷新语义或交互身份;没有新增依赖、丢弃数据、限制标点数量或改造数据源。
+
+## 验证结果
+
+### 自动化与静态检查
+
+- `node --test tests/markerProjection.test.js tests/markerOverlay.test.js`:**4 项通过**。
+- `node --check`:修改的服务代码、新投影模块和测试文件均通过。
+- `git diff --check`:通过。
+- `npm.cmd run build`:通过。构建仍提示 Browserslist 数据过期和 Cesium bundle 较大。
+- [package.json](../package.json) 没有 lint、typecheck 或项目级 test 脚本;代码为 JavaScript,没有 TypeScript 类型检查配置。本次直接使用 Node 内置测试运行器。
+
+测试覆盖 Cesium 投影坐标一致性、相机后方点裁剪、100/500/1000 标记批次更新、投影 scratch 对象复用、输入坐标未修改、节点隐藏/恢复、点击/hover 回调以及重复挂载后的渲染监听清理。测试文件:[markerProjection.test.js](../tests/markerProjection.test.js)、[markerOverlay.test.js](../tests/markerOverlay.test.js)。
+
+### 浏览器与性能
+
+- 匹配的 40 步平移/旋转采样中,投影 P95 从 **44.9ms 降至 1.6ms**;overlay 总 P95 从 **51.7ms 降至 8.7ms**。采样帧数分别为 9 和 10。
+- 后续 100 步平移/旋转采样记录了 78 个 `postRender` 样本:投影 P95 **0.9ms**,overlay P95 **8.0ms**,overlay 峰值 **13.3ms**;该样本中 Cesium 场景渲染 P95 约 **14ms**。
+- 实际页面滚轮缩放后,计划仍为 397 个点位、节点仍为 408;视野缩小时可见节点变少,窗口尺寸变化后节点和计划数不变,地图生命周期无引擎错误。测试结束后恢复到主页视角。
+- 修复前记录的整页基线为平均 **20.1fps**、帧间隔 P95 **80.3ms**、P99 **106.8ms**、115 个长任务(最大 **116ms**)。优化后有一次 100 步操作记录平均 **47fps**、P95 **40.1ms**、P99 **66.7ms**、2 个长任务(最大 **84ms**)。
+
+整页 FPS 采样受自动化浏览器和主机调度影响,不同运行间波动较大,操作序列也不完全相同;整页数据不构成严格 A/B 结论。overlay 分段耗时和匹配操作采样更直接地验证了本次标点投影优化的收益。
+
+## 未确认项与后续验证
+
+- 真实浏览器只加载了 397 个标点;1000 点规模验证覆盖 DOM 同步和数据完整性,没有在 Cesium/GPU 上构造 1000 个真实点位。
+- 整页帧间隔仍有长尾,已测到的场景渲染 P95 约 14ms;部分长任务的归因信息为 `unknown`。本次只确认并显著降低标点 overlay 投影开销,不能据此承诺所有设备上整页完全无掉帧。
+- 若目标设备仍有明显 Jank,应在目标硬件使用 Chrome Performance 录制相同的平移/旋转过程,分别检查 Cesium scene render、tileset 更新和主线程长任务。控制台曾出现通用 404 信息,但本次没有确认其 URL 或与掉帧的因果关系。
+
+## 参考资料
+
+- [SceneTransforms.worldToWindowCoordinates](https://cesium.com/learn/cesiumjs/ref-doc/SceneTransforms.html#worldToWindowCoordinates) — CesiumJS API。
+- [Matrix4](https://cesium.com/learn/cesiumjs/ref-doc/Matrix4.html) — CesiumJS API。
+- [PerformanceObserver](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver) — MDN Web Docs。

+ 12 - 10
src/common/cockpitGisProxyPlugin.js

@@ -1,22 +1,24 @@
 import { loadEnv } from 'vite'
 
 /**
- * 仅在 dev server 生效:把 /gis/... 代理到公共 GIS 静态服务。
+ * 仅在 dev server 生效:/gis 走公共 GIS 静态服务,/api 与 /ws 走驾驶舱后端。
+ * 浏览器侧一律同源,生产由 Nginx 转发,开发代理只存在于 Node 侧。
  */
 export default function cockpitGisProxy() {
     return {
-        name: 'cockpit-gis-proxy',
+        name: 'cockpit-dev-proxy',
         config(config, { mode }) {
             const env = loadEnv(mode, process.cwd(), '')
-            const target = env.COCKPIT_GIS_ORIGIN
-            if (!target) return {}
-            return {
-                server: {
-                    proxy: {
-                        '/gis': { target, changeOrigin: true },
-                    },
-                },
+            const proxy = {}
+            if (env.COCKPIT_GIS_ORIGIN) {
+                proxy['/gis'] = { target: env.COCKPIT_GIS_ORIGIN, changeOrigin: true }
             }
+            if (env.COCKPIT_API_ORIGIN) {
+                proxy['/api/cockpit/v1'] = { target: env.COCKPIT_API_ORIGIN, changeOrigin: true }
+                proxy['/ws/deviceStatus'] = { target: env.COCKPIT_API_ORIGIN, changeOrigin: true, ws: true }
+            }
+            if (!Object.keys(proxy).length) return {}
+            return { server: { proxy } }
         },
     }
 }

+ 2 - 2
src/modules/cockpit/CockpitShell.vue

@@ -1313,7 +1313,7 @@ const facilityUndergroundReady = computed(() => Boolean(
 /**
  * 设备→设施真实关联索引(维护者 2026-10-22 批准的后端契约)。
  *
- * 后端 `GET /api/cockpit/v1/device-facility-relations` 只按真实主键解析出 `deviceCode` 的行;
+ * 后端 `GET /api/cockpit/v1/equipments/facility-relations` 只按真实主键解析出 `deviceCode` 的行;
  * 当前库数据下通常为空(关联表存的是设备 id、管点 network_id 悬空、equipment_id 查不到),
  * 因此这里拿到空 Map 属**正常降级**,界面继续标「邻近设备 · 示意安装」,不伪报真实绑定。
  */
@@ -1413,7 +1413,7 @@ function selectPipeEnhancement(hit) {
  * 3D 视图按主键认回即可。管段从管线拾取链进来,`entityDetailStore` 从未被填充,
  * 资产详情因此恒空 —— 这就是「井盖能显示、管道不显示」的根源。
  *
- * 详情取数沿用既有的 `facilityPointStore.select`(同一条 `/entities/{id}/detail` 只读端点),
+ * 详情取数沿用既有的 `facilityPointStore.select`(同一条 `/infrastructure/entities/{id}/detail` 只读端点),
  * 不新造取数路径;失败按既有降级(资产详情显示取数提示,不阻塞 3D 场景)。
  */
 function loadPipeAssetDetail(kind, code) {

+ 1 - 1
src/modules/cockpit/domain/assetDetailKind.js

@@ -49,7 +49,7 @@ export function resolveAssetKind({ deviceCode = '', facilityDetail = null } = {}
  *
  * **取数主键是 `sourceId` 而不是 `code`**(实测):几何里管段的
  * `properties.code` 是业务编码(TCRQ202609080001),`properties.sourceId` 才是
- * `pipe_network_base` 的主键(raw_P11920)。用编码去查 `/entities/{id}/detail` 会 404。
+ * `pipe_network_base` 的主键(raw_P11920)。用编码去查 `/infrastructure/entities/{id}/detail` 会 404。
  *
  * @param {{kind?: string, code?: string, sourceId?: string}|null} selection `pipeEnhancementStore.selected`
  * @param {Array<object>} [visiblePipes] 当前可上图管线(用于把编码补成主键)

+ 0 - 4
src/modules/cockpit/domain/eventList.js

@@ -7,10 +7,6 @@
  *   `CockpitSectionResult<List<EventItem>>`(**预警与报警永不混合**,mode 决定取哪一族);
  *   行内另带 `sections.workOrders`(工单摘要分区,本票不画、留给票 19)。
  *
- * 与设备维度 `/equipments/{code}/events/current`(`CockpitEventReadResponse`)不是
- * 同一个契约:设备维度一次带回 warnings+alarms 两族,本层只认跨设备的这一份。
- * `domain/events.js` 的 `toEventRead` 留在设备维度用,不在这里重复实现。
- *
  * 四条硬纪律(都是本票验收原句,收口在这里、组件不再自己判):
  *   1. **预警与报警可切换,列表字段和状态标签同步变化**(验收第 1 条):
  *      `eventListSwitchView(mode)` 是**唯一**的切换视图 —— 字段标签(预警编号/报警编号)

+ 0 - 46
src/modules/cockpit/domain/events.js

@@ -118,52 +118,6 @@ export function toAlarmWarningRelation(raw) {
     }
 }
 
-/**
- * 事件读响应 → 领域对象。适用于设备维度与(票 25 补契约后的)跨设备维度。
- * @param {object} raw 后端 `CockpitEventReadResponse`
- */
-export function toEventRead(raw) {
-    const reader = fieldReader(raw)
-
-    const warnings = reader.list('warnings').map(toWarningEvent)
-    const alarms = reader.list('alarms').map(toAlarmEvent)
-
-    return {
-        deviceCode: reader.optionalStr('deviceCode'),
-        deviceTypeName: reader.optionalStr('deviceTypeName'),
-        state: reader.optionalStr('state'),
-        stateReason: reader.optionalStr('stateReason'),
-        warnings,
-        alarms,
-        relations: reader.optionalList('alarmWarningRelations').map(toAlarmWarningRelation),
-        // 时间范围(历史流才有;当前流是 null,属正常)。
-        startTime: reader.optionalStr('startTime'),
-        endTime: reader.optionalStr('endTime'),
-        timezone: reader.optionalStr('timezone'),
-        page: reader.optionalNum('page'),
-        pageSize: reader.optionalNum('pageSize'),
-        total: reader.optionalNum('total'),
-        missing: reader.missing,
-    }
-}
-
-/**
- * 按家族取事件列表(票 13 的分段切换)。
- * @param {object} read toEventRead() 的结果
- * @param {string} family EVENT_FAMILY 之一
- */
-export function eventsOfFamily(read, family) {
-    const current = read || {}
-    if (family === EVENT_FAMILY.ALARM) return current.alarms || []
-    return current.warnings || []
-}
-
-/** 全部事件(先预警后报警,与后端数组顺序一致)。 */
-export function allEvents(read) {
-    const current = read || {}
-    return [...(current.warnings || []), ...(current.alarms || [])]
-}
-
 /** 按时间倒序(票 13「默认展示最新 10-15 条」的排序依据)。 */
 export function sortByEventTimeDesc(events) {
     return [...(events || [])].sort((a, b) => String(b.eventTime).localeCompare(String(a.eventTime)))

+ 1 - 1
src/modules/cockpit/domain/facilityPoints.js

@@ -4,7 +4,7 @@
  * 与「管线与构件」(`domain/pipeNetwork.js`)分属不同对象域,不共用口径:
  *   · 管线/构件来自 `/infrastructure/geometry`,每个 feature 带后端 `coordinateValidation`;
  *   · 设施点类型来自设施台账:`/infrastructure/operating-information` 给出可枚举的设施实体
- *     (`facilityId` + `facilityKind`),坐标取自 `/entities/{id}/detail` 的 `coordinates`。
+ *     (`facilityId` + `facilityKind`),坐标取自 `/infrastructure/entities/{id}/detail` 的 `coordinates`。
  *
  * **准入纪律(票 07 的边界,写清差异而不是假装没有)**:
  *   实体详情不带几何图层那套 `coordinateValidation`,所以本层**不做**第二套范围校核、

+ 1 - 2
src/modules/cockpit/domain/monitoringPanels.js

@@ -196,7 +196,7 @@ function toStatusCounts(raw) {
 /**
  * 监测分布的一个地图标记 → 领域行。
  *
- * **注意本端点不给设备编码列表**(那是 `/map-snapshot` 的 `CockpitMonitoringPointSummary.deviceCodes`),
+ * **注意本端点不给设备编码列表**(那是 `/map/snapshot` 的 `CockpitMonitoringPointSummary.deviceCodes`),
  * 所以台账卡片的设备徽标只能逐点位拉详情(票 18 的 Q10 裁定),不由本层伪造。
  */
 function toDistributionMarker(raw, kind) {
@@ -733,7 +733,6 @@ export function monitoringDistributionPanel(data, section, extra = {}) {
     const current = data || {}
 
     // 覆盖情况(Q11 裁定):用**本端点自己的**区域/行业/设备类型分布 ——
-    // 票 24 指向的 `overview/monitoring` 的 `formalScope` 不在本端点上,拿不到也不去拉。
     // 票 37 走查扩展(维护者 2026-10-14):三块都是排名类别,统一按计数降序(并列保序);
     // 环形图(行业)与条形(片区/类型)同口径。
     const regionRows = sortByCountDesc(

+ 4 - 374
src/modules/cockpit/mocks/contractMocks.js

@@ -1060,15 +1060,6 @@ const TIMELINE_BY_CODE = {
     ],
 }
 
-/** 某工单编码的时间线载荷(认不出的编码回 null,与真接口的 404 语义一致)。 */
-function timelinePayload(workOrderCode) {
-    if (workOrderCode === WORK_ORDER.workOrderCode) return TIMELINE
-    const order = TIMELINE_ORDERS.find((item) => item.workOrderCode === workOrderCode)
-    const entries = TIMELINE_BY_CODE[workOrderCode]
-    if (!order || !entries) return null
-    return { workOrder: { ...order }, timelineEntries: entries }
-}
-
 function equipmentAggregate(scenario, deviceCode = '') {
     const success = aggregateSection('SUCCESS', 'SUCCESS', null)
     // 请求哪台设备就报哪台(与真接口一致,客户端传错编码能看出来)。
@@ -1261,61 +1252,6 @@ function collectionRecordsPayload(scenario, deviceCode = '') {
 
 // ---------------------------------------------------------------- 事件与工单
 
-function eventRead(scenario, deviceCode = '') {
-    const base = {
-        requestId: 'mock-event-read',
-        apiVersion: 'v1',
-        readOnly: true,
-        deviceCode: deviceCode || ARCHIVE.deviceCode,
-        deviceType: 'ws_sewage_environment',
-        deviceTypeName: '污水环境监测设备',
-        startTime: null,
-        endTime: null,
-        timezone: 'Asia/Shanghai',
-        page: 1,
-        pageSize: 0,
-    }
-
-    if (scenario === 'empty') {
-        return { ...base, state: 'EMPTY', stateReason: 'NO_EVENTS', warnings: [], alarms: [], alarmWarningRelations: [], total: 0 }
-    }
-
-    if (scenario === 'degraded') {
-        // 缺 levelColor 与设备编码:适配层不得猜颜色,也不得伪造归属设备。
-        return {
-            ...base,
-            state: 'READY',
-            stateReason: 'READY',
-            warnings: [{ warningNo: 'WRN-DEGRADED-001', warningName: '字段缺失预警', level: 2, status: 'PROCESSING', eventTime: '2026-09-02T09:59:30+08:00', unit: 'mg/L' }],
-            alarms: [],
-            alarmWarningRelations: [],
-            total: 1,
-        }
-    }
-
-    if (scenario === 'stale') {
-        return {
-            ...base,
-            state: 'STALE',
-            stateReason: 'SAMPLE_OUTDATED',
-            warnings: [{ ...WARNING, freshness: 'STALE' }],
-            alarms: [],
-            alarmWarningRelations: [],
-            total: 1,
-        }
-    }
-
-    return {
-        ...base,
-        state: 'READY',
-        stateReason: 'READY',
-        warnings: [WARNING],
-        alarms: [ALARM],
-        alarmWarningRelations: [RELATION],
-        total: 2,
-    }
-}
-
 // ---------------------------------------------------------------- 跨设备当前事件(票 13)
 
 /**
@@ -1997,7 +1933,7 @@ function operatingInformationPayload(scenario, query = {}) {
 /**
  * 票 68:设施点图层补坐标用的实体详情样例(水厂 / 泵站各一条)。
  *
- * 形状照抄真实 `/api/cockpit/v1/entities/{id}/detail`:坐标在 `coordinates` 上
+ * 形状照抄真实 `/api/cockpit/v1/infrastructure/entities/{id}/detail`:坐标在 `coordinates` 上
  * (缺坐标即 null,前端据此把该设施进「无地图位置」清单,不补默认值)。
  * 两条样例与运行信息 mock 里带 `facilityId/facilityKind` 的指标行一一对应。
  */
@@ -2746,32 +2682,12 @@ function statusCountsOf(normal, warning, alarm, expired, offline, unknown) {
 
 // ================================================================ 票 20:总体概览三端点
 
-/**
- * 概览信封(三个端点同款:`requestId/apiVersion/readOnly/timezone/updatedAt/freshness`)。
- *
- * 与 `infraEnvelope`/`monitoringEnvelope` 同形,但**不带 `displayName`** ——
- * 概览的三个响应类里只有 `warning-settings` 有它,另两个没有(逐类读过)。
- */
-function overviewEnvelope(updatedAt) {
-    const status = updatedAt ? 'CURRENT' : 'EMPTY'
-    return {
-        requestId: 'mock-overview',
-        apiVersion: 'v1',
-        readOnly: true,
-        timezone: 'Asia/Shanghai',
-        updatedAt: updatedAt || null,
-        freshness: { status, reason: updatedAt ? 'READ_ONLY_AGGREGATE' : 'NO_SNAPSHOT', updatedAt: updatedAt || null, serverUpdatedAt: SNAPSHOT_AT },
-    }
-}
-
-
 // ================================================================ 票 05–08:总体概览四模块端点
 
 /**
  * 四模块信封(规格 §0:`requestId/apiVersion/readOnly/timezone/updatedAt/freshness`)。
  *
- * 与旧 `overviewEnvelope` 的区别:**空态要能带固定行**。旧 helper 用 `updatedAt` 有无
- * 推 `EMPTY`,而四模块的空态恰恰是「freshness=EMPTY + 仍回 4 类型/3 片区/4 等级/7 天」——
+ * 空态要能带固定行:四模块的空态是「freshness=EMPTY + 仍回 4 类型/3 片区/4 等级/7 天」,
  * 前端靠它画「无数据 0」(规格 §6.7 的例外)。所以这里显式给 `status/reason`。
  */
 function overviewModulesEnvelope(status, updatedAt = SNAPSHOT_AT, reason = null) {
@@ -2984,268 +2900,15 @@ function overviewAlarmDisposalPayload(scenario) {
     }
 }
 
-/**
- * `/overview/infrastructure`(票 20 验收第 2 条)。
- *
- * 注意**没有 `districtDistribution`** —— 这正是本端点的契约现状(区域分布走票 17 的
- * `base-archives`)。样例必须照实,
- * 否则"区域分布不在本端点上"这条判断就失去了证据。
- */
-function overviewInfrastructurePayload(scenario) {
-    if (scenario === 'empty') {
-        return { ...overviewEnvelope(null), totals: { facilityCount: 0, smartDeviceCount: 0 }, industries: [], excluded: { unknownTypeCount: 0, typeKindMismatchCount: 0 } }
-    }
-    if (scenario === 'degraded') {
-        // 缺 `excluded`(可选段)与 `smartDeviceCount`:界面显示占位符,不伪造 0。
-        return { ...overviewEnvelope(SNAPSHOT_AT), totals: { facilityCount: 5 }, industries: [{ code: 'GAS', key: 'gas', label: '燃气', facilityCount: 2 }] }
-    }
-    return {
-        ...overviewEnvelope(SNAPSHOT_AT),
-        totals: { facilityCount: 5, smartDeviceCount: 9 },
-        industries: [
-            // 票 38 mock 同构:概览端点 `facilityTypes[].scale` 照抄真实形状(管线行是长度单位串 "km",
-            // 其余 null)——不再给 'medium' 这种规模语义值(真实后端从不给,见 t18 审计)。
-            { code: 'GAS', key: 'gas', label: '燃气', facilityCount: 2, smartDeviceCount: 4, facilityTypes: [{ code: 'PIPE', name: '燃气管线', count: 2, lengthKm: 12.4, scale: 'km' }], deviceTypes: [] },
-            { code: 'WATER_SUPPLY', key: 'water', label: '供水', facilityCount: 2, smartDeviceCount: 3, facilityTypes: [], deviceTypes: [] },
-            { code: 'DRAINAGE', key: 'drainage', label: '排水', facilityCount: 1, smartDeviceCount: 2, facilityTypes: [], deviceTypes: [] },
-        ],
-        excluded: { unknownTypeCount: 1, typeKindMismatchCount: 0 },
-    }
-}
-
-/**
- * `/overview/monitoring`(票 20 验收第 3 条)。
- *
- * **状态桶是四态、没有"故障"**(`online/offline/stale/unknownOrMissing`),
- * 与 `CockpitOverviewMonitoringResponse.Status` 逐字段对齐 ——
- * 样例里若凭空多一个"故障"桶,验收第 3 条的缺口说明就自相矛盾了。
- *
- * `industry` 入参**真的过滤并重算**(否则"筛选真的生效"会退化成只看请求串,票 08/18 的教训)。
- */
-function overviewMonitoringPayload(scenario, query) {
-    const industry = (query && query.industry) || ''
-    const all = [
-        { code: 'GAS', key: 'gas', label: '燃气', devices: 4, points: 3, online: 3, offline: 1, stale: 0, unknownOrMissing: 0, types: [['PIPE', '燃气管线', 4]] },
-        { code: 'WATER_SUPPLY', key: 'water', label: '供水', devices: 3, points: 2, online: 2, offline: 0, stale: 1, unknownOrMissing: 0, types: [['PUMP', '水泵', 3]] },
-        { code: 'DRAINAGE', key: 'drainage', label: '排水', devices: 2, points: 2, online: 1, offline: 0, stale: 0, unknownOrMissing: 1, types: [['FLOW', '流量计', 2]] },
-    ]
-    // 认不出的行业码回空数组(后端会 400,mock 不模拟报错,但也不假装有数据)。
-    const rows = industry ? all.filter((row) => row.code === industry) : all
-
-    if (scenario === 'empty') {
-        return {
-            ...overviewEnvelope(null),
-            counts: { deviceCount: 0, monitoringPointCount: 0, monitoringFacilityCount: 0, infrastructureFacilityCount: 0, status: { online: 0, offline: 0, stale: 0, unknownOrMissing: 0, denominator: 0 }, onlineRate: { value: null, onlineCount: 0, denominator: 0, state: 'EMPTY', reason: 'NO_RESOLVED_DEVICES' } },
-            metricFreshness: { status: 'EMPTY', updatedAt: null, serverUpdatedAt: SNAPSHOT_AT },
-            selectedIndustry: null,
-            formalScope: { industries: [], keys: [] },
-            typeDistribution: [],
-            excluded: { unknownTypeCount: 0, typeKindMismatchCount: 0 },
-        }
-    }
-
-    const sum = (key) => rows.reduce((total, row) => total + row[key], 0)
-    const devices = sum('devices')
-    const online = sum('online')
-    const offline = sum('offline')
-    const stale = sum('stale')
-    const unknownOrMissing = sum('unknownOrMissing')
-    // 后端分母是 online+offline+stale(**不含** unknownOrMissing,服务逐行读过)。
-    const denominator = online + offline + stale
-    const typeDistribution = rows.flatMap((row) =>
-        row.types.map(([typeCode, typeName, deviceCount]) => ({ industry: { code: row.code, key: row.key, label: row.label }, deviceType: { code: typeCode, name: typeName }, deviceCount })),
-    )
-
-    return {
-        ...overviewEnvelope(SNAPSHOT_AT),
-        counts: {
-            deviceCount: devices,
-            monitoringPointCount: sum('points'),
-            monitoringFacilityCount: rows.length,
-            infrastructureFacilityCount: 5,
-            status: { online, offline, stale, unknownOrMissing, denominator },
-            onlineRate: {
-                // 分母为 0 时后端回 value="0.0000" + state=EMPTY(照实模拟,界面负责不画成 0%)。
-                value: denominator === 0 ? '0.0000' : (online / denominator).toFixed(4),
-                onlineCount: online,
-                denominator,
-                state: denominator === 0 ? 'EMPTY' : stale === 0 ? 'CURRENT' : 'STALE',
-                reason: denominator === 0 ? 'NO_RESOLVED_DEVICES' : null,
-            },
-        },
-        // **本端点独有**:逐设备指标最近采集时间(票 18 的 I2/BT-8 在这里有值)。
-        metricFreshness: { status: 'CURRENT', updatedAt: SNAPSHOT_AT, serverUpdatedAt: SNAPSHOT_AT },
-        selectedIndustry: industry ? { code: industry, key: (all.find((row) => row.code === industry) || {}).key || '', label: (all.find((row) => row.code === industry) || {}).label || '' } : null,
-        formalScope: { industries: rows.map((row) => row.code), keys: rows.map((row) => row.key) },
-        typeDistribution,
-        excluded: { unknownTypeCount: 0, typeKindMismatchCount: 0 },
-    }
-}
-
-/**
- * `/overview/warning-settings`(票 20 验收第 1、4 条;票 42 起契约两族分叉)。
- *
- * **一次返回预警与报警两族**(`warning` + `alarm`),所以态势总览与预警设置共用这一次取数。
- * `range` 入参真的过滤趋势桶:不声明时后端维持无界(`CURRENT_BASELINE`),
- * 声明 `LAST_7_DAYS` 时只留窗口内的桶 —— 本票固定声明它(验收第 1 条的"近 7 日")。
- *
- * **票 42(后端 `b047a60d`)**:预警族只给**预警自身生命周期**(状态/等级/行业/片区分布 +
- * 已解除率),工单口径六字段(含 `workOrderStates`)恒 `null` —— mock 与 real 同构,
- * **不用 0 冒充「不适用」**;报警族**保留工单口径**(报警靠工单闭环)并**并存**
- * `alarm_status` 生命周期分布。分布数值在自家总数(8/9)内自洽(`sum(桶)==total`),
- * 桶种类与真实契约一一对应(含 UNKNOWN / UNASSIGNED 这类显式桶)。
- */
-function overviewWarningSettingsPayload(scenario, query) {
-    const rangeType = (query && query.range) || 'CURRENT_BASELINE'
-    const bounded = rangeType === 'LAST_7_DAYS'
-    const blank = scenario === 'empty'
-
-    // 预警族:WarningWorkflow 六态(DRAFT/PENDING/RECEIVED/PROCESSING/HANDLED/CLOSED)。
-    const warningStatusDistribution = [
-        { code: 'DRAFT', label: '草稿', count: 0 },
-        { code: 'PENDING', label: '待办', count: 1 },
-        { code: 'RECEIVED', label: '已接收', count: 0 },
-        { code: 'PROCESSING', label: '处置中', count: 1 },
-        { code: 'HANDLED', label: '已处置', count: 1 },
-        { code: 'CLOSED', label: '已解除', count: 5 },
-    ]
-    const warningLevelDistribution = [
-        { code: '1', label: '1级', count: 2 },
-        { code: '2', label: '2级', count: 3 },
-        { code: '3', label: '3级', count: 2 },
-        { code: '4', label: '4级', count: 1 },
-    ]
-    const warningIndustryDistribution = [
-        { code: 'GAS', label: '燃气', count: 3 },
-        { code: 'WATER_SUPPLY', label: '供水', count: 2 },
-        { code: 'DRAINAGE', label: '排水', count: 2 },
-        { code: 'MANHOLE', label: '窨井', count: 0 },
-        { code: 'UNKNOWN', label: '未知', count: 1 },
-    ]
-    const warningDistrictDistribution = [
-        { code: '0', label: '城南', count: 3 },
-        { code: '1', label: '城北', count: 2 },
-        { code: '2', label: '太常', count: 1 },
-        { code: 'UNASSIGNED', label: '未分区', count: 2 },
-    ]
-    // 报警族:工单口径 0–7 全键(缺的态是真实计数 0)+ alarm_status 两态。
-    const alarmWorkOrderStates = { 0: 0, 1: 1, 2: 2, 3: 1, 4: 1, 5: 3, 6: 1, 7: 0 }
-    const alarmStatusDistribution = [
-        { code: 'UNHANDLED', label: '未处理', count: 3 },
-        { code: 'HANDLED', label: '已处理', count: 6 },
-    ]
-    const alarmLevelDistribution = [
-        { code: '1', label: '1级', count: 1 },
-        { code: '2', label: '2级', count: 2 },
-        { code: '3', label: '3级', count: 4 },
-        { code: '4', label: '4级', count: 2 },
-    ]
-    const alarmIndustryDistribution = [
-        { code: 'GAS', label: '燃气', count: 2 },
-        { code: 'WATER_SUPPLY', label: '供水', count: 3 },
-        { code: 'DRAINAGE', label: '排水', count: 3 },
-        { code: 'MANHOLE', label: '窨井', count: 1 },
-    ]
-    const alarmDistrictDistribution = [
-        { code: '0', label: '城南', count: 4 },
-        { code: '1', label: '城北', count: 2 },
-        { code: '2', label: '太常', count: 2 },
-        { code: 'UNASSIGNED', label: '未分区', count: 1 },
-    ]
-    // 空场景:分布仍全铺(缺的态是真实计数 0,不是"没有数据")。
-    const zeroed = (rows) => rows.map((row) => ({ ...row, count: 0 }))
-    const pick = (rows) => (blank ? zeroed(rows) : rows)
-
-    // 趋势桶:`handled` 的含义按族不同 —— 预警=桶内已解除,报警=关联工单已结案(工单口径)。
-    const trendOf = (base) => {
-        const trend = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((index) => {
-            const total = blank ? 0 : base + (index % 3)
-            const handled = blank ? 0 : base
-            return {
-                bucket: `2026-09-${String(index + 1).padStart(2, '0')}`,
-                total,
-                handled,
-                // 分母为 0 时后端回 "0.0000" + EMPTY(照实模拟;界面不得画成 0.0%)。
-                handlingEfficiency: { value: total === 0 ? '0.0000' : (handled / total).toFixed(4), state: total === 0 ? 'EMPTY' : 'AVAILABLE' },
-            }
-        })
-        // 桶是业务时区日期;声明窗口后只留窗口内的桶。
-        return bounded ? trend.slice(-7) : trend
-    }
-
-    return {
-        ...overviewEnvelope(blank ? null : SNAPSHOT_AT),
-        displayName: '预警设置',
-        // `mode` 不传时后端默认 WARNING(本票不传,因为两族都要)。
-        selectedMode: (query && query.mode) || 'WARNING',
-        range: { type: rangeType, start: bounded ? '2026-09-23T00:00:00+08:00' : null, end: bounded ? '2026-09-30T00:00:00+08:00' : null },
-        warning: {
-            eventFamily: 'WARNING',
-            state: blank ? 'EMPTY' : 'READY',
-            stateReason: blank ? 'NO_EVENTS' : 'WARNINGS_RESOLVED',
-            total: blank ? 0 : 8,
-            // 预警不走工单流程(维护者 2026-10-14 裁定):工单口径六字段恒 null —— 不适用 ≠ 0。
-            handled: null,
-            pending: null,
-            cancelledCount: null,
-            unlinkedEventCount: null,
-            invalidWorkOrderStateCount: null,
-            // 已解除率=已解除 ÷ 预警总数(预警自身口径;分母 0 → EMPTY/NO_WARNINGS)。
-            handlingEfficiency: {
-                numerator: blank ? 0 : 5,
-                denominator: blank ? 0 : 8,
-                value: blank ? '0.0000' : '0.6250',
-                state: blank ? 'EMPTY' : 'AVAILABLE',
-                reason: blank ? 'NO_WARNINGS' : null,
-            },
-            workOrderStates: null,
-            statusDistribution: pick(warningStatusDistribution),
-            levelDistribution: pick(warningLevelDistribution),
-            industryDistribution: pick(warningIndustryDistribution),
-            districtDistribution: pick(warningDistrictDistribution),
-            trend: trendOf(1),
-        },
-        alarm: {
-            eventFamily: 'ALARM',
-            state: blank ? 'EMPTY' : 'READY',
-            stateReason: blank ? 'NO_EVENTS' : 'EVENTS_RESOLVED',
-            total: blank ? 0 : 9,
-            // 报警族保留工单口径;`handled` 是 alarm_status 自身生命周期(已处理 6)。
-            handled: blank ? 0 : 6,
-            pending: blank ? 0 : 6,
-            cancelledCount: 0,
-            unlinkedEventCount: 0,
-            invalidWorkOrderStateCount: 0,
-            // 处置率仍是**工单口径**(状态 5 ÷ 状态 0–6 = 3/9;分母 0 → NO_ELIGIBLE_WORK_ORDERS)。
-            handlingEfficiency: {
-                numerator: blank ? 0 : 3,
-                denominator: blank ? 0 : 9,
-                value: blank ? '0.0000' : '0.3333',
-                state: blank ? 'EMPTY' : 'AVAILABLE',
-                reason: blank ? 'NO_ELIGIBLE_WORK_ORDERS' : null,
-            },
-            workOrderStates: blank ? { 0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0 } : alarmWorkOrderStates,
-            statusDistribution: pick(alarmStatusDistribution),
-            levelDistribution: pick(alarmLevelDistribution),
-            industryDistribution: pick(alarmIndustryDistribution),
-            districtDistribution: pick(alarmDistrictDistribution),
-            trend: trendOf(2),
-        },
-        mapFilter: { eventFamily: (query && query.mode) || 'WARNING', label: (query && query.mode) === 'ALARM' ? '报警' : '预警' },
-    }
-}
-
 // ---------------------------------------------------------------- 注册
 
 /** 各接口在五类样例下的载荷(`failed` 由处理器抛出,不在这里给载荷)。 */
 const PAYLOADS = {
     // 票 08:地图摘要按**真实分页语义**给(分页窗口横跨监测点与未关联设备、第 2 页起要求快照一致)。
-    '/map-snapshot': (s, _requested, context) => mapSnapshotPayload(s, context.path, context.mapSnapshot),
+    '/map/snapshot': (s, _requested, context) => mapSnapshotPayload(s, context.path, context.mapSnapshot),
     '/monitoring-points/*': (s, requested) => pointDetailPayload(s, requested),
     '/equipments/*/detail-aggregate': (s, requested) => equipmentAggregate(s, requested),
     '/equipments/*/collection-records': (s, requested) => collectionRecordsPayload(s, requested),
-    '/equipments/*/events/current': (s, requested) => eventRead(s, requested),
-    '/equipments/*/events/history': (s, requested) => eventRead(s, requested),
     // 票 13:跨设备当前事件(预警/报警切换 + 当前事件列表;`mode` 必填并校验)。
     // 用 `context.query` 真的读 mode/level/industry/status/page/pageSize ——
     // 否则「切到报警列表真的换内容」这条断言会退化成在看请求串(票 08 的教训)。
@@ -3254,7 +2917,6 @@ const PAYLOADS = {
     '/events/handling-efficiency': (s, _requested, context) => handlingEfficiencyPayload(s, context.query),
     '/events/multidimensional-analysis': (s, _requested, context) => multidimensionalAnalysisPayload(s, context.query),
     // 票 65:全量工单分页(报警效率面板的「当前工单列表」)。
-    // 与下面 `/equipments/*/work-orders` 的区别只在**没有设备/事件维度**:
     // 真实后端 `GET /api/cockpit/v1/work-orders` 就是这个形状(含 pagination 四件套)。
     // 分页在这里真的切窗口 —— mock 若总是回全量,前端的翻页与「共 N 张」口径就永远测不到。
     '/work-orders': (s, _requested, context) => {
@@ -3271,36 +2933,11 @@ const PAYLOADS = {
             readOnly: true,
             state: total === 0 ? 'EMPTY' : 'READY',
             stateReason: total === 0 ? 'NO_WORK_ORDERS' : 'READY',
-            // 字典与设备维度同源(`domain/workOrder.js` 的 `WORK_ORDER_STATES`),不登记第二份。
             stateDictionary: WORK_ORDER_STATES.map((state) => ({ code: state.code, name: state.name })),
             workOrders: all.slice((safePage - 1) * pageSize, safePage * pageSize),
             pagination: { page: safePage, pageSize, total, totalPages },
         }
     },
-    '/equipments/*/work-orders': (s) => ({
-        requestId: 'mock-work-orders',
-        apiVersion: 'v1',
-        readOnly: true,
-        deviceCode: ARCHIVE.deviceCode,
-        eventSource: null,
-        eventCode: null,
-        state: s === 'empty' ? 'EMPTY' : 'READY',
-        stateReason: s === 'empty' ? 'NO_WORK_ORDERS' : 'READY',
-        // 票 20:字典**从唯一源派生**(`domain/workOrder.js` 的 `WORK_ORDER_STATES`,
-        // 其真理是后端 `WorkOrderStatusEnum` 0–7)。这里原先硬编码了一份 1–7 的副本,
-        // 是"同一份业务词表登记两处"的典型 —— 后端一改成 0–7,两份就各说各话。
-        stateDictionary: WORK_ORDER_STATES.map((state) => ({ code: state.code, name: state.name })),
-        // 票 12 的专用场景给多张工单(每张一条轨迹的形状都不同);票 20 加了「延期中」那张。
-        workOrders: s === 'empty' ? [] : s === 'work-order-timeline' ? TIMELINE_ORDERS : [WORK_ORDER],
-    }),
-    // 票 12:按工单编码回显该工单自己的轨迹(与真接口一致 —— 认不出的编码**抛错**,
-    // 而不是回一张空轨迹或永远给同一张工单;那会把"没找到"画成"没有动作")。
-    '/work-orders/*/timeline': (s, requested) => {
-        if (s === 'empty') return { workOrder: null, timelineEntries: [] }
-        const payload = timelinePayload(requested)
-        if (!payload) throw new Error(`mock: 工单 ${requested || '(空)'} 不存在`)
-        return payload
-    },
     '/equipments/*/freshness': (s, requested) => freshnessPayload(s, requested),
     '/equipments/*/archive': (s) => (s === 'empty' ? null : ARCHIVE),
     // 票 17:基础设施模式四块面板的面板级聚合读模型(各块独立成败,互不牵连)。
@@ -3327,17 +2964,10 @@ const PAYLOADS = {
     '/overview/pipe-network': (s) => overviewPipeNetworkPayload(s),
     '/overview/warning-study': (s) => overviewWarningStudyPayload(s),
     '/overview/alarm-disposal': (s) => overviewAlarmDisposalPayload(s),
-    // 票 20:总体概览模式三块面板的面板级聚合读模型(各块独立成败)。
-    // 三个 builder 都吃**请求查询串**:`/overview/monitoring` 的行业筛选与
-    // `/overview/warning-settings` 的窗口必须真的按请求回,否则
-    // 「筛选真的生效」「近 7 日窗口真的声明了」这些断言全是假绿(票 08/18 的教训)。
-    '/overview/infrastructure': (s) => overviewInfrastructurePayload(s),
-    '/overview/monitoring': (s, _requested, context) => overviewMonitoringPayload(s, context.query),
-    '/overview/warning-settings': (s, _requested, context) => overviewWarningSettingsPayload(s, context.query),
     // 票 24:设施点位与管线几何读模型(票 30 的真实端点 `/infrastructure/geometry`,免鉴权)。
     '/infrastructure/geometry': (s, _requested, context) => pipeNetworkPayload(s, context.query),
     // 票 68:四类设施点的实体详情(设施点图层补坐标;查询串 `category` 与真接口同形)。
-    '/entities/*/detail': (s, requested, context) => facilityEntityDetailPayload(s, requested, context.query),
+    '/infrastructure/entities/*/detail': (s, requested, context) => facilityEntityDetailPayload(s, requested, context.query),
 }
 
 /**

+ 1 - 1
src/modules/cockpit/mocks/index.js

@@ -8,7 +8,7 @@
  * 场景覆盖(走查与人工演示都用同一套开关,无需改代码重新构建):
  *   `window.__COCKPIT_MOCK_SCENARIO__` = `success`(默认)| `empty` | `degraded` | `stale` | `failed` | `unauthorized`
  *       票 09 追加 `point-statuses`:后端六态 + 未关联设备 + 一个前端不认识的状态,全部可上图。
- *       它只影响 `/map-snapshot` 的样例内容,不改默认场景的任何数字(票 07/08 的断言依赖那些数)。
+ *       它只影响 `/map/snapshot` 的样例内容,不改默认场景的任何数字(票 07/08 的断言依赖那些数)。
  *       票 10 追加 `point-detail-order`:设备卡片逆状态优先级排列,验「顺序由后端返回顺序决定」。
  *       票 11 追加 `equipment-partial`:设备详情**分区级部分失败**(档案/工单/图片各自 FAILED,
  *       指标/预警/报警照常 SUCCESS),验「任一分区失败不遮盖其它成功分区」。它与 `failed` 不同:

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

@@ -18,6 +18,7 @@ import {
     BoundingSphere,
     Intersect,
     Cartesian3,
+    Cartesian4,
     Cartographic,
     Cesium3DTileset,
     Cesium3DTileStyle,
@@ -41,6 +42,7 @@ import {
     Rectangle,
     RequestScheduler,
     SceneTransforms,
+    SceneMode,
     TileMapServiceImageryProvider,
     Transforms,
     UrlTemplateImageryProvider,
@@ -75,6 +77,7 @@ import { planToDataset } from '../domain/markerPlan.js'
 // 票 82/84:标记几何与光环层数读数都取单源(旧的 RING_LAYERS 常量已随 billboard 环退役)。
 import { MARKER_BODY_WIDTH, markerMetricsFor, maxRingLayers } from '../domain/markerMetrics.js'
 import { renderMarker } from './markerAssets.js'
+import { projectWorldToWindow } from './markerProjection.js'
 
 const DEG = Math.PI / 180
 
@@ -134,7 +137,14 @@ export function disposeSceneBloom(viewer) {
  *   · `new EllipsoidalOccluder(...)` —— 只跟相机位置有关,同一帧内所有实体共用一份。
  * 这里各缓存一份:画布矩形按 120ms 保鲜(只有 resize 才会变),遮挡体按相机位置失效。
  */
-const projectionCache = { rect: null, rectAt: 0, occluder: null, occluderKey: '', occluderEllipsoid: null, toward: new Cartesian3() }
+const projectionCache = {
+    rect: null,
+    rectAt: 0,
+    occluder: null,
+    occluderPosition: { x: NaN, y: NaN, z: NaN },
+    occluderEllipsoid: null,
+    toward: new Cartesian3(),
+}
 
 function canvasRectCached(viewer) {
     const now = typeof performance !== 'undefined' && performance.now ? performance.now() : Date.now()
@@ -147,10 +157,13 @@ function canvasRectCached(viewer) {
 
 function occluderCached(viewer, camera) {
     const p = camera.positionWC
-    const key = `${p.x.toFixed(2)}|${p.y.toFixed(2)}|${p.z.toFixed(2)}`
-    if (projectionCache.occluderKey !== key || projectionCache.occluderEllipsoid !== viewer.scene.globe.ellipsoid) {
+    const cached = projectionCache.occluderPosition
+    if (cached.x !== p.x || cached.y !== p.y || cached.z !== p.z
+        || projectionCache.occluderEllipsoid !== viewer.scene.globe.ellipsoid) {
         projectionCache.occluder = new EllipsoidalOccluder(viewer.scene.globe.ellipsoid, p)
-        projectionCache.occluderKey = key
+        cached.x = p.x
+        cached.y = p.y
+        cached.z = p.z
         projectionCache.occluderEllipsoid = viewer.scene.globe.ellipsoid
     }
     return projectionCache.occluder
@@ -1260,6 +1273,8 @@ export function syncPointMarkers(viewer, markers, colorOf, imageOf, planOf, tint
     // 只把 billboard/label 的 `show` 置 false —— 不重画同一枚标记;DOM 点位坐标走相机投影
     // (`projectToWindow`),不依赖 billboard,故隐藏视觉不影响 DOM 位置。
     const hideVisual = options.hideVisual === true
+    // 数据源仍保留实体供计数/诊断读取;DOM 接管时同步关闭其引擎可视性。
+    if (source.show !== !hideVisual) source.show = !hideVisual
     let index = markerEntityIndex.get(viewer)
     if (!index) {
         index = new Map()
@@ -2356,6 +2371,7 @@ export function pipelineSource(viewer) {
  * 同一坐标永远得到同一个值,位置就不可能再跳。
  */
 const detailedGroundHeights = new WeakMap()
+const markerHeightKeys = new WeakMap()
 /** 单批采样上限:批太大请求会被拆得很零碎(与 `cesiumPipeModels` 同量级)。 */
 const GROUND_SAMPLE_CHUNK = 256
 
@@ -2370,10 +2386,10 @@ function groundSamplerFor(viewer) {
 }
 
 /** 已定值就直接用;没采过就先定值(无地形)或返回 null 并排一次异步采样。 */
-function queuedGroundHeight(viewer, lon, lat) {
+function queuedGroundHeight(viewer, lon, lat, key) {
     if (!viewer || !Number.isFinite(lon) || !Number.isFinite(lat)) return null
     const sampler = groundSamplerFor(viewer)
-    const key = heightKey(lon, lat)
+    if (key === undefined) key = heightKey(lon, lat)
     if (sampler.heights.has(key)) return sampler.heights.get(key)
     if (!viewer.terrainProvider) {
         // 无地形部署:椭球面就是地面,不必等一拍异步。
@@ -2472,7 +2488,16 @@ export function groundHeightAt(viewer, lon, lat) {
  * 标记依旧会在粗/细网格切换时跳。这里是**采一次、永不重采**的确定性值。
  * @returns {number|null} 米
  */
-export function markerGroundHeight(viewer, lon, lat) {
+export function markerGroundHeight(viewer, lon, lat, source) {
+    if (!viewer || !Number.isFinite(lon) || !Number.isFinite(lat)) return null
+    if (source && typeof source === 'object') {
+        let cached = markerHeightKeys.get(source)
+        if (!cached || cached.lon !== lon || cached.lat !== lat) {
+            cached = { lon, lat, key: heightKey(lon, lat) }
+            markerHeightKeys.set(source, cached)
+        }
+        return queuedGroundHeight(viewer, lon, lat, cached.key)
+    }
     return deterministicGroundHeight(viewer, lon, lat)
 }
 
@@ -2600,6 +2625,15 @@ export function projectPointToWindow(viewer, longitude, latitude) {
 export function createCameraEngine(viewer) {
     const scene = viewer.scene
     const camera = viewer.camera
+    const markerWorldPositions = new WeakMap()
+    const markerScreenPosition = new Cartesian2()
+    const markerClipPosition = new Cartesian4()
+    const markerWindowPosition = { x: 0, y: 0 }
+    const markerViewProjection = new Matrix4()
+    let markerProjectionRect = null
+    let markerCanvasWidth = 0
+    let markerCanvasHeight = 0
+    let markerProjectionReady = false
     let frameHandle = null
 
     /**
@@ -2690,6 +2724,55 @@ export function createCameraEngine(viewer) {
             return { x: at.x + rect.left, y: at.y + rect.top, distance: Cartesian3.distance(world, camera.positionWC) }
         },
 
+        /**
+         * DOM overlay projection: cache immutable row coordinates in ECEF and apply the
+         * frame's precomputed view-projection matrix. The result is scratch storage consumed in-frame.
+         */
+        projectMarkerPoint(lon, lat, height, source) {
+            if (!Number.isFinite(lon) || !Number.isFinite(lat) || !Number.isFinite(height)) return null
+            let cached = source && typeof source === 'object' ? markerWorldPositions.get(source) : null
+            if (!cached || cached.lon !== lon || cached.lat !== lat || cached.height !== height) {
+                const world = cached ? cached.world : new Cartesian3()
+                Cartesian3.fromDegrees(lon, lat, height, Ellipsoid.WGS84, world)
+                cached = { lon, lat, height, world }
+                if (source && typeof source === 'object') markerWorldPositions.set(source, cached)
+            }
+            const world = cached.world
+            const toward = Cartesian3.subtract(world, camera.positionWC, projectionCache.toward)
+            if (Cartesian3.dot(toward, camera.directionWC) <= 0 || !occluderCached(viewer, camera).isPointVisible(world)) return null
+            let at
+            if (markerProjectionReady) {
+                at = projectWorldToWindow(
+                    world,
+                    markerViewProjection,
+                    markerCanvasWidth,
+                    markerCanvasHeight,
+                    markerScreenPosition,
+                    markerClipPosition,
+                )
+            } else {
+                at = SceneTransforms.worldToWindowCoordinates(scene, world, markerScreenPosition)
+            }
+            if (!at) return null
+            const rect = markerProjectionRect || canvasRectCached(viewer)
+            markerWindowPosition.x = at.x + rect.left
+            markerWindowPosition.y = at.y + rect.top
+            return markerWindowPosition
+        },
+
+        prepareMarkerProjectionFrame() {
+            markerProjectionRect = canvasRectCached(viewer)
+            markerCanvasWidth = scene.canvas.clientWidth
+            markerCanvasHeight = scene.canvas.clientHeight
+            const frustum = camera.frustum
+            markerProjectionReady = !!scene.frameState
+                && scene.frameState.mode === SceneMode.SCENE3D
+                && Number.isFinite(frustum.fovy)
+            if (markerProjectionReady) {
+                Matrix4.multiply(frustum.projectionMatrix, camera.viewMatrix, markerViewProjection)
+            }
+        },
+
         /**
          * **相机正下方**的地形高度(米),取不到返回 null(票 37 的防入地输入)。
          *

+ 1 - 1
src/modules/cockpit/services/cockpitApi.js

@@ -134,7 +134,7 @@ async function readJsonPayload(response) {
  * 从后端错误载荷里取业务失效态(票 08)。
  *
  * 后端把「快照失效」放在 400 响应体 `AjaxResult.data.category`(`CockpitErrorCategory` 的**大写枚举**
- * `SNAPSHOT_EXPIRED`,见 `CockpitMapSnapshotController` 的异常处理),**不在 HTTP 状态码里**——
+ * `SNAPSHOT_EXPIRED`,见 `CockpitMapController` 的异常处理),**不在 HTTP 状态码里**——
  * 只看状态码会把它和「分页参数不合法」(`INVALID_REQUEST`)混成同一个原因,界面就只能笼统说
  * 「数据不可用」,而值班人员真正需要的是「刷新一下」。
  *

+ 2 - 69
src/modules/cockpit/services/detailApi.js

@@ -7,8 +7,7 @@
  */
 import { toMonitoringPointDetail } from '../domain/pointDetail.js'
 import { toEquipmentArchive, toEquipmentDetailAggregate, toDeviceFreshnessSection, toMetricsPayload, toCollectionRecordsPayload } from '../domain/equipmentDetail.js'
-import { toEventRead } from '../domain/events.js'
-import { toWorkOrder, toWorkOrderTimeline } from '../domain/workOrder.js'
+import { toWorkOrder } from '../domain/workOrder.js'
 import { isEmptyBy, fetchSection } from './domainRequest.js'
 import { deviceMetricKind, deviceMetricPath, toTypedMetricsPayload } from '../domain/deviceMetricSources.js'
 import { SECTION_STATE } from '../domain/sectionState.js'
@@ -149,37 +148,10 @@ export function fetchEquipmentFreshness(deviceCode, options = {}) {
     })
 }
 
-/** 工单列表(票 11/12:设备维度或事件维度,二选一给参)。 */
-export function fetchWorkOrders({ deviceCode = '', eventSource = '', eventCode = '' } = {}, options = {}) {
-    const path = deviceCode
-        ? `/equipments/${encodeURIComponent(deviceCode)}/work-orders`
-        : eventSource && eventCode
-          ? `/events/${encodeURIComponent(eventSource)}/${encodeURIComponent(eventCode)}/work-orders`
-          : ''
-
-    if (!path) return missingCode('设备或事件', '')
-
-    return fetchSection(path, {
-        toData: (payload) => ({
-            state: (payload && payload.state) || '',
-            stateReason: (payload && payload.stateReason) || '',
-            // 状态字典以领域字典为准(后端 0–7),后端字典仅作为补充(响应缺字典时界面仍能显示状态名)。
-            dictionary: (payload && payload.stateDictionary) || [],
-            orders: Array.isArray(payload && payload.workOrders) ? payload.workOrders.map(toWorkOrder) : [],
-        }),
-        isEmpty: isEmptyBy((payload) => Array.isArray(payload && payload.workOrders) && payload.workOrders.length === 0),
-        config: options.config,
-        fetchImpl: options.fetchImpl,
-    })
-}
-
 /**
  * 全量工单分页(票 65:报警效率面板的「当前工单列表」)。
  *
- * 与上面的 `fetchWorkOrders` 是**两个不同的问题**,刻意不合并:
- *   · `fetchWorkOrders` 回答「某设备/某事件下有哪些工单」(详情卡用,无分页概念);
- *   · 本函数回答「本窗口有哪些工单、共多少张」(效率面板用,要翻页 + 要时间筛)。
- * 混成一个函数会让「没有编码」与「要全量」变成同一件事,调用方就得靠传空串区分。
+ * 本函数回答「本窗口有哪些工单、共多少张」(效率面板用,要翻页 + 要时间筛)。
  *
  * `startTime`/`endTime` 是 2026-10-22 补的:面板按近 7/30/90 天切换时列表必须跟着收窄
  * (后端按 `create_time` 过滤,与上方「工单状态分布」同一批工单)。
@@ -228,42 +200,3 @@ export function fetchWorkOrderList(query = {}, options = {}) {
     })
 }
 
-/** 单个工单的时间线(票 12)。 */
-export function fetchWorkOrderTimeline(workOrderCode, options = {}) {    if (!workOrderCode) return missingCode('工单', workOrderCode)
-
-    return fetchSection(`/work-orders/${encodeURIComponent(workOrderCode)}/timeline`, {
-        toData: toWorkOrderTimeline,
-        isEmpty: isEmptyBy((payload) => {
-            const entries = payload && payload.timelineEntries
-            return !payload || !payload.workOrder || (Array.isArray(entries) && entries.length === 0)
-        }),
-        config: options.config,
-        fetchImpl: options.fetchImpl,
-    })
-}
-
-/**
- * 事件读(票 13 当前、票 14 详情、票 19 面板)。
- * @param {object} params `{ deviceCode, startTime, endTime, page, pageSize }`
- *        —— 设备维度与历史流(带时间范围)走同一函数。
- */
-export function fetchEvents(params = {}, options = {}) {
-    const { deviceCode = '', startTime = '', endTime = '' } = params
-    if (!deviceCode) return missingCode('设备', deviceCode)
-
-    const history = !!startTime || !!endTime
-    const path = `/equipments/${encodeURIComponent(deviceCode)}/events/${history ? 'history' : 'current'}`
-
-    return fetchSection(path, {
-        params: { startTime, endTime, page: params.page, pageSize: params.pageSize },
-        toData: toEventRead,
-        isEmpty: isEmptyBy((payload) => {
-            const warnings = Array.isArray(payload && payload.warnings) ? payload.warnings.length : 0
-            const alarms = Array.isArray(payload && payload.alarms) ? payload.alarms.length : 0
-            return warnings === 0 && alarms === 0
-        }),
-        freshnessOf: (payload) => (payload && payload.state) || '',
-        config: options.config,
-        fetchImpl: options.fetchImpl,
-    })
-}

+ 2 - 2
src/modules/cockpit/services/deviceFacilityRelations.js

@@ -1,7 +1,7 @@
 /**
  * 设备→设施真实关联读模型(维护者 2026-10-22 批准的后端契约落地)。
  *
- * 端点:`GET /api/cockpit/v1/device-facility-relations`(免认证只读,提交 `83bd5ee`)。
+ * 端点:`GET /api/cockpit/v1/equipments/facility-relations`(免认证只读)。
  * 响应:`{ generatedAt, readOnly, relations: [{ deviceId, deviceCode, facilityCode, facilityKind, relationType }], statistics }`
  *
  * **为什么仍要降级**(2026-10-22 实测,勿把「契约已就绪」当成「真实关联已生效」):
@@ -17,7 +17,7 @@
 import { fetchSection } from './domainRequest.js'
 import { SECTION_STATE } from '../domain/sectionState.js'
 
-export const DEVICE_FACILITY_RELATION_PATH = '/device-facility-relations'
+export const DEVICE_FACILITY_RELATION_PATH = '/equipments/facility-relations'
 
 function toRelationData(payload) {
     const rows = Array.isArray(payload?.relations) ? payload.relations : []

+ 2 - 2
src/modules/cockpit/services/entityDetailApi.js

@@ -4,9 +4,9 @@ import { ENTITY_DETAIL_KIND, entityIdentity, normalizeEntityDetail } from '../do
 
 export const ENTITY_DETAIL_PATHS = Object.freeze({
     [ENTITY_DETAIL_KIND.FACILITY]: (id, target) => target.category
-        ? `/entities/${encodeURIComponent(id)}/detail?category=${encodeURIComponent(target.category)}` : '',
+        ? `/infrastructure/entities/${encodeURIComponent(id)}/detail?category=${encodeURIComponent(target.category)}` : '',
     [ENTITY_DETAIL_KIND.EMERGENCY]: (id, target) => target.category
-        ? `/entities/${encodeURIComponent(id)}/detail?category=${encodeURIComponent(target.category)}` : '',
+        ? `/infrastructure/entities/${encodeURIComponent(id)}/detail?category=${encodeURIComponent(target.category)}` : '',
     [ENTITY_DETAIL_KIND.EVENT]: (id, target) => target.family
         ? `/events/${encodeURIComponent(id)}/detail?family=${encodeURIComponent(target.family)}` : '',
     [ENTITY_DETAIL_KIND.WORK_ORDER]: (id) => `/work-orders/${encodeURIComponent(id)}/detail`,

+ 0 - 4
src/modules/cockpit/services/eventApi.js

@@ -15,10 +15,6 @@
  * 同一份 `scope` 下发(见 `warningResponseApi.js`);不传=全域,不得静默当成某个片区。
  * 票 67 时代「本端点不认片区」的旧结论已过期,缺口说明已随票 79 撤除。
  *
- * 与设备维度 `/equipments/{code}/events/current` 的区别:那是单台设备的当前事件
- * (`CockpitEventReadResponse`,`domain/events.js` 的 `toEventRead`),
- * 这里是**跨设备**的当前预警/报警(`CockpitCurrentEventsResponse`,`domain/eventList.js`)。
- *
  * 为什么 `/events/current` 不做顶层 `isEmpty`:事件的成败**已经由内部
  * `sections.events` 分区状态表达**(后端 `CockpitSectionResult`),与设备详情聚合
  * (`fetchEquipmentDetailAggregate`)同一模式 —— 顶层区分区保持 SUCCESS、携带领域对象,

+ 1 - 1
src/modules/cockpit/services/facilityPointService.js

@@ -4,7 +4,7 @@
  * 为什么是两跳(而不是一条几何端点):
  *   · cockpit 没有「设施列表」端点,四类设施的实体标识只出现在
  *     `/infrastructure/operating-information` 的指标行上(`facilityId` + `facilityKind`);
- *   · 坐标只出现在 `/entities/{id}/detail?category=…` 的 `coordinates` 上。
+ *   · 坐标只出现在 `/infrastructure/entities/{id}/detail?category=…` 的 `coordinates` 上。
  *   两条都是 `GET /api/cockpit/v1/**` 免鉴权只读端点,不碰业务 GIS 路径(ADR 0005)。
  *   **契约缺口**(票 68 登记):实体详情不带几何图层那套 `coordinateValidation`,
  *   基础设施也还没进 `/infrastructure/geometry` —— 后端补齐后可去掉这层两跳拼装。

+ 5 - 5
src/modules/cockpit/services/mapApi.js

@@ -7,10 +7,10 @@
  * 关于**分页与快照**:票 05 只定「一页怎么翻成领域批次」,不持状态——
  * 「同一批加载用同一快照、刷新换新快照」是票 08 的活,所以这里只把 `snapshotAt` 如实带出。
  *
- * 票 18 补上**全局筛选落到地图**(票 25 第 3 节冻结的路径①:以 `map-snapshot` 为准):
+ * 票 18 补上**全局筛选落到地图**(票 25 第 3 节冻结的路径①:以 `/map/snapshot` 为准):
  * 端点收 industry/district/deviceType;片区按 0/1/2/UNASSIGNED 直接下发,无部署映射。
  *
- * 票 14(决策 02/规格 07):`map-snapshot` **收多值 `pointStatus`**(八桶:六态 + UNKNOWN +
+ * 票 14(决策 02/规格 07):`/map/snapshot` **收多值 `pointStatus`**(八桶:六态 + UNKNOWN +
  * UNASSOCIATED,逗号分隔、OR)。旧注释「本端点不收该入参、状态筛选不作用到一张图」的
  * 缺口已由后端契约修订关闭——前端白名单先挡认不出的桶,不拿脏值去换 400。
  */
@@ -39,7 +39,7 @@ export function fetchMapSnapshot(options = {}) {
         return points === 0 && equipment === 0 && Number(payload && payload.total) === 0
     })
 
-    return fetchSection('/map-snapshot', {
+    return fetchSection('/map/snapshot', {
         params: {
             page: options.page,
             pageSize: options.pageSize,
@@ -57,11 +57,11 @@ export function fetchMapSnapshot(options = {}) {
 }
 
 /**
- * 基础帧(`/foundation`):地图能不能画、数据新不新鲜。
+ * 基础帧(`/map/foundation`):地图能不能画、数据新不新鲜。
  * 票 05 只交这一条读取路径,引导页与全域提示归后续票。
  */
 export async function fetchFoundation(options = {}) {
-    const result = await fetchSection('/foundation', {
+    const result = await fetchSection('/map/foundation', {
         toData: (payload) => ({
             mapFrame: (payload && payload.mapFrame) || null,
             freshness: (payload && payload.freshness) || null,

+ 20 - 12
src/modules/cockpit/services/mapService.js

@@ -52,7 +52,7 @@ import { MARKER_BODY_WIDTH, markerDevKnobs, markerMetricsFor, resetMarkerDevKnob
 import { EMPHASIS_STYLE, shouldEmphasize } from '../domain/mapEmphasis.js'
 import { renderMarker } from './markerAssets.js'
 // 批次 3 第五轮(票 20):DOM overlay 渲染层(billboard 发糊的结构性解决)。
-import { mountMarkerOverlay, attachOverlayRenderer, unmountMarkerOverlay, isMarkerOverlayVisible, isMarkerOverlayMounted, refreshMarkerFx } from './markerOverlay.js'
+import { mountMarkerOverlay, attachOverlayRenderer, unmountMarkerOverlay, isMarkerOverlayVisible, isMarkerOverlayMounted, refreshMarkerFx, startMarkerOverlayPerfSample, stopMarkerOverlayPerfSample, getMarkerOverlayPerfStats } from './markerOverlay.js'
 import { zoomRangeForBounds } from '../domain/pointAggregation.js'
 import { DEVICE_LAYER_KIND } from '../domain/deviceLayer.js'
 import { deviceVisualForStatus } from '../domain/deviceStatus.js'
@@ -684,6 +684,9 @@ function publishDevHook() {
         // 票 83:读 `data-*` 读数前的**可用性自检入口**(overlay 未挂载/不可见时读数无效,必须判红不判绿)。
         isMarkerOverlayMounted: () => isMarkerOverlayMounted(),
         isMarkerOverlayVisible: () => isMarkerOverlayVisible(),
+        startOverlayPerfSample: () => startMarkerOverlayPerfSample(),
+        stopOverlayPerfSample: () => stopMarkerOverlayPerfSample(),
+        getOverlayPerfStats: () => getMarkerOverlayPerfStats(),
         // 票 86:六个 DEV/验收旋钮(点位档/设备档/环峰值/选中/alpha 下限/可见带占比)。
         // **只作用于渲染**,不改业务;默认值 = 单源声明,正式路径不会因为旋钮存在而改变。
         // 改完清几何缓存并重建环样式(关键帧与带型都按新参数重生成)。
@@ -1094,10 +1097,19 @@ async function bootEngine(record) {
         }
         // DOM 标记层的投影(维护者 2026-11-11):按坐标采一次**最详细**地形高程并永不重采,
         // 同一坐标永远同一高度,标记不会随镜头 LOD 跳;还没采到就回 null=先不上图。
-        record.projectMarkerPoint = (lon, lat) => {
-            const height = engine.markerGroundHeight(viewer, lon, lat)
+        record.projectMarkerPoint = (lon, lat, source) => {
+            const height = engine.markerGroundHeight(viewer, lon, lat, source)
             if (height === null) return null
-            return cameraEngine.projectPivot({ lon, lat, height }, { visibleOnly: true })
+            return cameraEngine.projectMarkerPoint(lon, lat, height, source)
+        }
+        const overlayHostOrigin = { left: 0, top: 0 }
+        const overlayWindowPosition = { x: 0, y: 0 }
+        const projectOverlayMarker = (lon, lat, source) => {
+            const at = record.projectMarkerPoint(lon, lat, source)
+            if (!at) return null
+            overlayWindowPosition.x = at.x - overlayHostOrigin.left
+            overlayWindowPosition.y = at.y - overlayHostOrigin.top
+            return overlayWindowPosition
         }
         record.cameraControl = createCameraControl({
             engine: cameraEngine,
@@ -1263,6 +1275,8 @@ async function bootEngine(record) {
                     overlayFrameCache.rectKey = [hostRect.left, hostRect.top, hostRect.width, hostRect.height].join(',')
                     overlayFrameCache.rectAt = nowMs
                 }
+                overlayHostOrigin.left = hostRect.left
+                overlayHostOrigin.top = hostRect.top
                 const rectKey = overlayFrameCache.rectKey || `${hostRect.left},${hostRect.top},${hostRect.width},${hostRect.height}`
                 const inputsChanged = overlayFrameCache.lastPlan !== markerPlan
                     || overlayFrameCache.lastRows !== deviceRows
@@ -1319,6 +1333,7 @@ async function bootEngine(record) {
                     overlayFrameCache.facilityEffectOf = (facility) => facilityAnimated.get(facility.key || `facility-point|${facility.code}`) || ''
                     overlayFrameCache.converge = combinedEffectState.converge
                 }
+                cameraEngine.prepareMarkerProjectionFrame()
                 return {
                     markers: markerPlan.markers,
                     // 票 68:设施点计划行(DOM overlay 第四条循环消费;计划/引用一变就重建帧状态)。
@@ -1365,14 +1380,7 @@ async function bootEngine(record) {
                     // DOM 标记层贴地(维护者 2026-11-11):没有可信地面就回 null,
                     // overlay 会把该节点隐藏=**不上图**,而不是先画在地底再上浮。
                     displayGroups: displayBucketGroups,
-                    projectToWindow: (lon, lat) => {
-                        const at = record.projectMarkerPoint(lon, lat)
-                        if (!at) return null
-                        // projectPivot 回**窗口坐标**;overlay 宿主 inset:0 铺在 host 内,
-                        // 节点坐标原点 = host 左上角 → 减 host 的窗口原点(每帧只读一次布局)。
-                        // distance 供 overlay 做深度排序(近者在上)。
-                        return { x: at.x - hostRect.left, y: at.y - hostRect.top, distance: at.distance }
-                    },
+                    projectToWindow: projectOverlayMarker,
                 }
             })
         }

+ 229 - 42
src/modules/cockpit/services/markerOverlay.js

@@ -61,6 +61,7 @@ const NODE_CLASS = 'marker-overlay-node'
 const LABEL_CLASS = 'marker-overlay-label'
 /** 标签的零尺寸锚点(随节点位移;真正的标签盒子在它内部)。 */
 const LABEL_WRAP_CLASS = 'marker-overlay-label-wrap'
+const OFFSCREEN_MARGIN = 320
 const FX_CLASS = 'marker-overlay-fx'
 const FX_RING_CLASS = 'marker-overlay-fx-ring'
 const FX_GLOW_CLASS = 'marker-overlay-fx-glow'
@@ -206,6 +207,19 @@ function buildFxCss() {
     box-shadow:0 0 18px currentColor, 0 0 40px currentColor;
     will-change:transform,opacity;
 }
+@keyframes markerOverlayDrop {
+    from { translate: 0 -16px; opacity: 0; }
+    to { translate: 0 0; opacity: 1; }
+}
+@keyframes markerOverlayFade {
+    from { scale: 0.88; opacity: 0; }
+    to { scale: 1; opacity: 1; }
+}
+.marker-overlay-node--enter { animation: markerOverlayDrop 220ms cubic-bezier(0.2, 0.75, 0.3, 1) both; }
+.marker-overlay-node--aggregate.marker-overlay-node--enter { animation-name: markerOverlayFade; animation-duration: 190ms; }
+@media (prefers-reduced-motion: reduce) {
+    .marker-overlay-node--enter { animation: none !important; }
+}
 ${ringKeyframesCss()}
 `
 }
@@ -232,6 +246,8 @@ export function refreshMarkerFx() {
         if (record.root && record.root.parentNode) record.root.parentNode.removeChild(record.root)
     }
     pool.clear()
+    visibleKeys.clear()
+    nextVisibleKeys.clear()
 }
 
 /**
@@ -286,6 +302,8 @@ let frameConverge = null
 let frameDeviceEffectOf = () => ''
 /** 设施点层的门控查询(维护者 2026-11-06:设施点挂与设备同一套状态特效)。 */
 let frameFacilityEffectOf = () => ''
+const markerFxCache = new WeakMap()
+const markerKeyCache = new WeakMap()
 
 /** 状态 → 特效 profile(domain 单源;DOM 层数/亮度/辉光只消费这一份表,不另造)。 */
 function markerFxProfile(status) {
@@ -303,7 +321,62 @@ function fxOf(marker) {
     if (!effect) return null
     const profile = markerFxProfile(marker.status)
     if (!profile || profile.effect !== effect) return null
-    return { effect, profile, converge: frameConverge }
+    const cached = markerFxCache.get(marker)
+    if (cached && cached.effect === effect && cached.profile === profile && cached.converge === frameConverge) {
+        return cached.value
+    }
+    const value = { effect, profile, converge: frameConverge }
+    markerFxCache.set(marker, { effect, profile, converge: frameConverge, value })
+    return value
+}
+
+function markerKey(marker) {
+    const cached = markerKeyCache.get(marker)
+    if (cached && cached.kind === marker.kind && cached.code === marker.code) return cached.key
+    const key = `${marker.kind}|${marker.code}`
+    markerKeyCache.set(marker, { kind: marker.kind, code: marker.code, key })
+    return key
+}
+
+function markerFingerprintMatches(record, marker, plan, toneHex, fx) {
+    const converge = fx && fx.converge
+    return record
+        && record.fpStatus === marker.status
+        && record.fpIndustry === marker.industry
+        && record.fpName === marker.name
+        && record.fpMaster === plan.master
+        && record.fpInnerEnabled === plan.inner.enabled
+        && record.fpInnerIcon === plan.inner.icon
+        && record.fpDiameterRatio === plan.inner.diameterRatio
+        && record.fpDesaturate === plan.desaturate
+        && record.fpToneHex === toneHex
+        && record.fpEffect === (fx ? fx.effect : '')
+        && record.fpLayers === (fx ? fx.profile.layers : 0)
+        && record.fpConvergePeak === (converge && converge.peak != null ? converge.peak : 1)
+        && record.fpConvergeAlpha === (converge && converge.alpha != null ? converge.alpha : 1)
+}
+
+function rememberMarkerFingerprint(record, marker, plan, toneHex, fx) {
+    const converge = fx && fx.converge
+    record.fpStatus = marker.status
+    record.fpIndustry = marker.industry
+    record.fpName = marker.name
+    record.fpMaster = plan.master
+    record.fpInnerEnabled = plan.inner.enabled
+    record.fpInnerIcon = plan.inner.icon
+    record.fpDiameterRatio = plan.inner.diameterRatio
+    record.fpDesaturate = plan.desaturate
+    record.fpToneHex = toneHex
+    record.fpEffect = fx ? fx.effect : ''
+    record.fpLayers = fx ? fx.profile.layers : 0
+    record.fpConvergePeak = converge && converge.peak != null ? converge.peak : 1
+    record.fpConvergeAlpha = converge && converge.alpha != null ? converge.alpha : 1
+}
+
+function withinOverlayMargin(x, y, width, height) {
+    if (!Number.isFinite(width) || !Number.isFinite(height)) return true
+    return x >= -OFFSCREEN_MARGIN && x <= width + OFFSCREEN_MARGIN
+        && y >= -OFFSCREEN_MARGIN && y <= height + OFFSCREEN_MARGIN
 }
 
 /**
@@ -537,11 +610,37 @@ function markerSvg(master, toneHex) {
 
 /** 节点池:key → { root, inner, fp };标记消失时节点隐藏不销毁,计划读数变化时重建。 */
 const pool = new Map()
-/** 帧内复用的"本轮在计划里"集合(票 35:原先每帧 new Set)。 */
-const wantedKeys = new Set()
+let visibleKeys = new Set()
+let nextVisibleKeys = new Set()
 /** 指纹分隔符:用不可打印字符避免与业务字符串拼接歧义。 */
 const FP_SEP = '\u0001'
 let hostNode = null
+// 票 08:只给“第一次进入主场景”的节点播一次落图/淡入;刷新/筛选/状态更新复用节点时不重播。
+const entranceSeen = new Set()
+let entranceSequence = 0
+
+function applyEntrance(root, key) {
+    if (!root || !key || entranceSeen.has(key)) return
+    if (!root.classList || typeof root.classList.add !== 'function') return
+    entranceSeen.add(key)
+    if (typeof document !== 'undefined' && document.hidden) return
+    try {
+        if (typeof window !== 'undefined' && window.matchMedia
+            && window.matchMedia('(prefers-reduced-motion: reduce)').matches) return
+    } catch (error) {
+        // 浏览器不支持 matchMedia 时按可动效处理;动画本身有 CSS 降级。
+    }
+    const delay = Math.min(entranceSequence * 18, 160)
+    entranceSequence += 1
+    root.classList.add(NODE_CLASS + '--enter')
+    root.style.animationDelay = delay + 'ms'
+    const finish = () => {
+        root.classList.remove(NODE_CLASS + '--enter')
+        root.style.animationDelay = ''
+    }
+    root.addEventListener('animationend', finish, { once: true })
+    if (typeof window !== 'undefined' && window.setTimeout) window.setTimeout(finish, 420 + delay)
+}
 let hostRecord = null
 let postRenderRemove = null
 /** 聚合徽章节点池:groupKey → { root, countEl }。 */
@@ -572,6 +671,10 @@ let memberListTitleEl = null
 let memberListSummaryEl = null
 let memberListChipsEl = null
 let memberListRowsEl = null
+let overlayPerfEnabled = false
+let markerProjectionMs = 0
+let sceneRenderStartedAt = 0
+const overlayPerfSamples = []
 /** 标签独立图层(宿主子节点);`null` = 尚未挂载。 */
 let labelLayer = null
 /**
@@ -594,6 +697,7 @@ let markerSelectedCode = ''
 function buildNode(key, marker, plan, toneHex, fx) {
     const root = document.createElement('div')
     root.className = NODE_CLASS
+    applyEntrance(root, key)
     root.dataset.markerOverlayKey = key
     root.dataset.markerOverlayKind = marker.kind
     root.dataset.markerOverlayCode = marker.code
@@ -1014,6 +1118,7 @@ function buildUnassociatedAggregateNode(key, badge, tones) {
 
     const root = document.createElement('div')
     root.className = NODE_CLASS + ' ' + NODE_CLASS + '--aggregate'
+    applyEntrance(root, key)
     root.dataset.markerOverlayKey = key
     root.dataset.markerOverlayKind = badge.kind || AGGREGATE_KIND
     root.dataset.markerOverlayCode = key
@@ -1447,10 +1552,9 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
     // 当前选中的对象编码(2026-10-28):**非聚合设备点**选中时要上「被选择态」同款高亮,
     // 而聚合设备的中心由引擎的 pinned 标志负责;两者语义不同,故这里另收一份。
     markerSelectedCode = typeof selectedCode === 'string' ? selectedCode : ''
-    // 票 35 卡顿整改:Set 复用(原先每帧 new 一个);指纹改成廉价拼接(原先每标记
-    // JSON.stringify 一次,纯分配)。DOM 写入也改成"只有真的变了才写"。
-    wantedKeys.clear()
-    const wanted = wantedKeys
+    const previousVisible = visibleKeys
+    const currentVisible = nextVisibleKeys
+    currentVisible.clear()
     // 设备行坐标是**窗口坐标**(引擎投影真值):转宿主相对要减宿主(overlay 挂载父级)的
     // 窗口原点。每帧读一次——宿主可能随布局移动,不能在挂载时缓存。
     const hostRect = hostNode.parentElement && hostNode.parentElement.getBoundingClientRect
@@ -1462,23 +1566,23 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
     const windowPositions = new Map()
     for (const marker of markers || []) {
         if (!marker || !Number.isFinite(marker.longitude) || !Number.isFinite(marker.latitude)) continue
-        const pos = projectToWindow(marker.longitude, marker.latitude)
-        if (pos && Number.isFinite(pos.x) && Number.isFinite(pos.y)) windowPositions.set(`${marker.kind}|${marker.code}`, pos)
+        const pos = projectToWindow(marker.longitude, marker.latitude, marker)
+        if (pos && Number.isFinite(pos.x) && Number.isFinite(pos.y)) windowPositions.set(`${marker.kind}|${marker.code}`, { x: pos.x, y: pos.y, distance: pos.distance })
     }
     // 设施/构件的投影也先算一次:聚合、深度排序、渲染共用同一份(不再每帧投两遍)。
     const facilityPositions = new Map()
     for (const facility of facilities || []) {
         const key = facility.key || `facility-point|${facility.code}`
         if (!Number.isFinite(facility.longitude) || !Number.isFinite(facility.latitude)) continue
-        const pos = projectToWindow(facility.longitude, facility.latitude)
-        if (pos && Number.isFinite(pos.x) && Number.isFinite(pos.y)) facilityPositions.set(key, pos)
+        const pos = projectToWindow(facility.longitude, facility.latitude, facility)
+        if (pos && Number.isFinite(pos.x) && Number.isFinite(pos.y)) facilityPositions.set(key, { x: pos.x, y: pos.y, distance: pos.distance })
     }
     const componentPositions = new Map()
     for (const component of pipeComponentsVisible === false ? [] : (pipeComponents || [])) {
         const key = component.key || `pipe-component|${component.code}`
         if (!Number.isFinite(component.longitude) || !Number.isFinite(component.latitude)) continue
-        const pos = projectToWindow(component.longitude, component.latitude)
-        if (pos && Number.isFinite(pos.x) && Number.isFinite(pos.y)) componentPositions.set(key, pos)
+        const pos = projectToWindow(component.longitude, component.latitude, component)
+        if (pos && Number.isFinite(pos.x) && Number.isFinite(pos.y)) componentPositions.set(key, { x: pos.x, y: pos.y, distance: pos.distance })
     }
     // 03 未关联设备 / 04 监测点 / 05 设施点:各自独立命名空间,同位置也不跨类合并。
     const aggregateRows = []
@@ -1619,29 +1723,30 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
     const depthZOf = (key) => (depthRanks.get(key) || 1) * 2
 
     for (const marker of markers || []) {
-        const key = `${marker.kind}|${marker.code}`
+        const key = markerKey(marker)
         // 聚合组成员不单独渲染(选中成员不在组里,仍会正常显示)。
         if (groupedMemberKeys.has(key)) { hidePooledNode(key); continue }
-        wanted.add(key)
         if (!Number.isFinite(marker.longitude) || !Number.isFinite(marker.latitude)) { hidePooledNode(key); continue }
 
-        const windowPos = windowPositions.get(key)
-        if (!windowPos) { hidePooledNode(key); continue }
+        const projectionStartedAt = overlayPerfEnabled ? performance.now() : 0
+        const windowPos = projectToWindow(marker.longitude, marker.latitude, marker)
+        if (overlayPerfEnabled) markerProjectionMs += performance.now() - projectionStartedAt
+        if (!windowPos || !Number.isFinite(windowPos.x) || !Number.isFinite(windowPos.y)) { hidePooledNode(key); continue }
+        if (!withinOverlayMargin(windowPos.x, windowPos.y, hostRect.width, hostRect.height)) {
+            hidePooledNode(key)
+            continue
+        }
 
         const plan = planOf(marker)
         const toneHex = tones[marker.tone] || tones.neutral
         // 票 70:fxOf 的键取自 effectOf 门控查询(domain 计划已判开关/降级);profile 取状态。
         const fx = fxOf(marker)
-        // 计划读数指纹:状态/行业/名称/母版/内层/降饱和/色值/**动效键与层数**任一变化就重建节点。
-        const fp = [marker.status, marker.industry, marker.name,
-            plan.master, plan.inner.enabled, plan.inner.icon, plan.inner.diameterRatio,
-            plan.desaturate, toneHex, fx ? fx.effect : '', fx ? fx.profile.layers : 0,
-            fx?.converge?.peak ?? 1, fx?.converge?.alpha ?? 1].join(FP_SEP)
 
         let record = pool.get(key)
-        if (!record || record.fp !== fp) {
+        if (!markerFingerprintMatches(record, marker, plan, toneHex, fx)) {
             destroyRecord(record)
-            record = { ...buildNode(key, marker, plan, toneHex, fx), fp }
+            record = buildNode(key, marker, plan, toneHex, fx)
+            rememberMarkerFingerprint(record, marker, plan, toneHex, fx)
             pool.set(key, record)
             hostNode.appendChild(record.root)
             if (plan.inner.enabled) {
@@ -1673,6 +1778,7 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
             if (record.fxHost.style.transform !== fxTransform) record.fxHost.style.transform = fxTransform
         }
         if (record.root.style.display !== 'block') record.root.style.display = 'block'
+        currentVisible.add(key)
         // 深度排序:图标 = 2z,标签 = 2z+1(标签略高于自身图标,低于更近的图标)。
         // 04:已选中的监测点单独显示时置顶,且标签不被邻近聚合折叠 —— 否则「保持选择」只剩一个点。
         const selectedPoint = marker.kind === 'monitoring-point' && marker.code === selectedPointCode
@@ -1705,8 +1811,13 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
     // 反应量真值),形态走与摘要未关联设备同一套合成计划(实心母版 + 内层行业图标)。
     for (const device of devices || []) {
         const key = device.key || `device|${device.code}`
-        wanted.add(key)
         if (!Number.isFinite(device.x) || !Number.isFinite(device.y)) { hidePooledNode(key); continue }
+        const x = device.x - hostOffset.x
+        const y = device.y - hostOffset.y
+        if (!withinOverlayMargin(x, y, hostRect.width, hostRect.height)) {
+            hidePooledNode(key)
+            continue
+        }
 
         // 2026-10-27 维护者走查修正:圈内子设备点**也要顶部标签**(此前被置空 + CSS 隐藏,
         // 表现为"关联监测点的子设备点没有名称")。标签与普通设备点同一条渲染路径。
@@ -1750,7 +1861,7 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
             }
         }
         // 坐标 = 引擎投影的窗口坐标(含 pixelOffset 尖端补偿),只差宿主原点一层。
-        const deviceTransform = `translate(${device.x - hostOffset.x}px, ${device.y - hostOffset.y}px)`
+        const deviceTransform = `translate(${x}px, ${y}px)`
         if (record.root.style.transform !== deviceTransform) record.root.style.transform = deviceTransform
         // 反应量镜像:scale 读的是 billboard 实体真值(选中 1.6/hover 1.3/弱化 0.75),
         // 弱化的压暗同理镜像 alpha(只写透明度,不动色相——色键语义归设备状态)。
@@ -1768,6 +1879,7 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
             if (record.fxHost.style.transform !== fxTransform) record.fxHost.style.transform = fxTransform
         }
         if (record.root.style.display !== 'block') record.root.style.display = 'block'
+        currentVisible.add(key)
         // ==================== 标签与选择态(2026-10-28 维护者状态机)====================
         // 标签规则(唯一出口 applyLabelState;这里只按状态给两个布尔量):
         //   · 圈内设备(fan,处于「环可见」的 ①hover预览/②固定/③hover预览/④固定」):
@@ -1775,7 +1887,7 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
         //   · ③ 设备常态的中心设备:显示(它此时就是一枚正常设备点);hover 展开全名。
         //   · ④ 设备被选择的中心设备:隐藏(与 ② 聚合被选择态同性质)。
         //   · 非聚合设备点(k=1 关联设备):**始终显示** —— 聚合规则不得外溢到它们。
-        const devicePos = { x: device.x - hostOffset.x, y: device.y - hostOffset.y }
+        const devicePos = { x, y }
         const deviceZNum = depthZOf('device|' + device.code)
         const deviceZ = String(deviceZNum)
         if (record.root.style.zIndex !== deviceZ) record.root.style.zIndex = deviceZ
@@ -1809,8 +1921,13 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
     // 坐标同为引擎投影的窗口坐标,只差宿主原点一层。点击由宿主既有触发器派发(kind=overlap-aggregate)。
     for (const row of aggregates || []) {
         const key = row.key || `overlap|${row.pointCode}|${row.group}`
-        wanted.add(key)
         if (!Number.isFinite(row.x) || !Number.isFinite(row.y)) { hidePooledNode(key); continue }
+        const x = row.x - hostOffset.x
+        const y = row.y - hostOffset.y
+        if (!withinOverlayMargin(x, y, hostRect.width, hostRect.height)) {
+            hidePooledNode(key)
+            continue
+        }
 
         const toneHex = tones[row.tone] || tones.neutral
         // 票 76(统一设备点位渲染):聚合符号也走 `planOf` 合成计划(母版/内层/几何与设备点同源),
@@ -1827,7 +1944,7 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
             pool.set(key, record)
             hostNode.appendChild(record.root)
         }
-        const aggTransform = `translate(${row.x - hostOffset.x}px, ${row.y - hostOffset.y}px)`
+        const aggTransform = `translate(${x}px, ${y}px)`
         if (record.root.style.transform !== aggTransform) record.root.style.transform = aggTransform
         // 状态强调镜像(billboard `scale` / `outlineWidth` 真值)。
         // 票 76(四态):② 被选择态 = `pinned`(聚合点固定环 + 发光 + 略放大);
@@ -1850,10 +1967,12 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
             const aggLabelZ = String(aggZNum + 1)
             if (record.labelWrap.style.zIndex !== aggLabelZ) record.labelWrap.style.zIndex = aggLabelZ
         }
-        placeLabel(record, row.x - hostOffset.x, row.y - hostOffset.y)
+        // 2026-10-28:标签在**独立图层**,显隐由 `applyLabelState` 统一驱动(不再内联查 DOM 子元素)。
+        placeLabel(record, x, y)
         const aggregateLabel = aggregateLabelState(row)
         applyLabelState(record, aggregateLabel.visible, aggregateLabel.expanded)
         record.root.style.display = row.replaced ? 'none' : 'block'
+        if (!row.replaced) currentVisible.add(key)
         // ③④ 中心已是设备点:聚合节点虽然隐藏,但保险起见再降掉 pointer-events,
         // 避免它(或其子元素)在过渡帧里吃掉对中心设备的点击。
         record.root.classList.toggle(`${NODE_CLASS}--replaced`, row.replaced === true)
@@ -1864,10 +1983,13 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
     for (const facility of facilities || []) {
         const key = facility.key || `facility-point|${facility.code}`
         if (groupedMemberKeys.has(key)) { hidePooledNode(key); continue }
-        wanted.add(key)
         if (!Number.isFinite(facility.longitude) || !Number.isFinite(facility.latitude)) { hidePooledNode(key); continue }
-        const windowPos = facilityPositions.get(key)
-        if (!windowPos) { hidePooledNode(key); continue }
+        const windowPos = projectToWindow(facility.longitude, facility.latitude, facility)
+        if (!windowPos || !Number.isFinite(windowPos.x) || !Number.isFinite(windowPos.y)) { hidePooledNode(key); continue }
+        if (!withinOverlayMargin(windowPos.x, windowPos.y, hostRect.width, hostRect.height)) {
+            hidePooledNode(key)
+            continue
+        }
 
         const marker = { ...facility, kind: 'facility-point' }
         const plan = facilityPlanOf(marker)
@@ -1905,6 +2027,7 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
         const transform = `translate(${windowPos.x}px, ${windowPos.y}px)`
         if (record.root.style.transform !== transform) record.root.style.transform = transform
         if (record.root.style.display !== 'block') record.root.style.display = 'block'
+        currentVisible.add(key)
         const facilityZNum = depthZOf(key)
         const facilityZ = String(facilityZNum)
         if (record.root.style.zIndex !== facilityZ) record.root.style.zIndex = facilityZ
@@ -1926,10 +2049,13 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
     // 点击派发回**管线拾取链**(局部增强),不进设施详情 —— 构件不是设施实体。
     for (const component of pipeComponentsVisible === false ? [] : (pipeComponents || [])) {
         const key = component.key || `pipe-component|${component.code}`
-        wanted.add(key)
         if (!Number.isFinite(component.longitude) || !Number.isFinite(component.latitude)) { hidePooledNode(key); continue }
-        const windowPos = componentPositions.get(key)
-        if (!windowPos) { hidePooledNode(key); continue }
+        const windowPos = projectToWindow(component.longitude, component.latitude, component)
+        if (!windowPos || !Number.isFinite(windowPos.x) || !Number.isFinite(windowPos.y)) { hidePooledNode(key); continue }
+        if (!withinOverlayMargin(windowPos.x, windowPos.y, hostRect.width, hostRect.height)) {
+            hidePooledNode(key)
+            continue
+        }
 
         const marker = { ...component, kind: 'pipe-component' }
         const plan = componentPlanOf(marker)
@@ -1958,6 +2084,7 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
         const transform = `translate(${windowPos.x}px, ${windowPos.y}px)`
         if (record.root.style.transform !== transform) record.root.style.transform = transform
         if (record.root.style.display !== 'block') record.root.style.display = 'block'
+        currentVisible.add(key)
         const componentZNum = depthZOf(key)
         const componentZ = String(componentZNum)
         if (record.root.style.zIndex !== componentZ) record.root.style.zIndex = componentZ
@@ -1972,12 +2099,16 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
         applyLabelState(record, componentLabel.visible && !componentCollapsed, componentLabel.expanded)
     }
 
-    // 本轮不在计划里的:隐藏(池复用,不销毁)。
-    // ⚠️ 这一轮**必须**在所有计划遍历之后:放进某个循环里会漏掉「点位/设备被筛掉」的节点,
-    // 它们会停在最后一次投影位置变成幽灵标记(2026-10-27 实测缺陷,勿再合并进循环)。
-    for (const [key, record] of pool.entries()) {
-        if (!wanted.has(key)) hideRecord(record)
+    // Hide only nodes visible in the previous frame but not in this one; the pool can
+    // retain thousands of already-hidden records without making every camera frame scan it.
+    for (const key of previousVisible) {
+        if (!currentVisible.has(key)) {
+            const record = pool.get(key)
+            if (record) hideRecord(record)
+        }
     }
+    visibleKeys = currentVisible
+    nextVisibleKeys = previousVisible
 }
 
 /**
@@ -1986,15 +2117,67 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
  */
 export function attachOverlayRenderer(viewer, getFrameState) {
     if (!viewer || !viewer.scene) return () => {}
+    const onPreRender = () => {
+        if (overlayPerfEnabled) sceneRenderStartedAt = performance.now()
+    }
     const onFrame = () => {
+        if (overlayPerfEnabled) markerProjectionMs = 0
+        const startedAt = overlayPerfEnabled ? performance.now() : 0
+        const sceneRenderedAt = startedAt
         const state = getFrameState()
+        const stateReadyAt = overlayPerfEnabled ? performance.now() : 0
         if (state) syncMarkerOverlay(state)
+        if (overlayPerfEnabled) {
+            const endedAt = performance.now()
+            overlayPerfSamples.push({
+                sceneMs: sceneRenderStartedAt ? sceneRenderedAt - sceneRenderStartedAt : 0,
+                stateMs: stateReadyAt - startedAt,
+                overlayMs: endedAt - stateReadyAt,
+                projectionMs: markerProjectionMs,
+                totalMs: endedAt - startedAt,
+            })
+            if (overlayPerfSamples.length > 120) overlayPerfSamples.shift()
+        }
     }
+    viewer.scene.preRender.addEventListener(onPreRender)
     viewer.scene.postRender.addEventListener(onFrame)
-    postRenderRemove = () => viewer.scene.postRender.removeEventListener(onFrame)
+    postRenderRemove = () => {
+        viewer.scene.preRender.removeEventListener(onPreRender)
+        viewer.scene.postRender.removeEventListener(onFrame)
+    }
     return postRenderRemove
 }
 
+export function startMarkerOverlayPerfSample() {
+    if (!import.meta.env || !import.meta.env.DEV) return false
+    overlayPerfSamples.length = 0
+    sceneRenderStartedAt = 0
+    overlayPerfEnabled = true
+    return true
+}
+
+export function stopMarkerOverlayPerfSample() {
+    overlayPerfEnabled = false
+    return getMarkerOverlayPerfStats()
+}
+
+export function getMarkerOverlayPerfStats() {
+    const quantile = (key, p) => {
+        const values = overlayPerfSamples.map((sample) => sample[key]).sort((a, b) => a - b)
+        if (!values.length) return 0
+        return values[Math.min(values.length - 1, Math.ceil(values.length * p) - 1)]
+    }
+    return {
+        samples: overlayPerfSamples.length,
+        sceneP95Ms: quantile('sceneMs', 0.95),
+        stateP95Ms: quantile('stateMs', 0.95),
+        overlayP95Ms: quantile('overlayMs', 0.95),
+        projectionP95Ms: quantile('projectionMs', 0.95),
+        totalP95Ms: quantile('totalMs', 0.95),
+        totalMaxMs: overlayPerfSamples.reduce((max, sample) => Math.max(max, sample.totalMs), 0),
+    }
+}
+
 /** overlay 节点池(调试/断言用)。 */
 export function overlayPoolSize() {
     return pool.size
@@ -2044,6 +2227,8 @@ export function unmountMarkerOverlay() {
     if (hostNode && hostNode.parentNode) hostNode.parentNode.removeChild(hostNode)
     hostNode = null
     hostRecord = null
+    entranceSeen.clear()
+    entranceSequence = 0
     // 标签图层与 hover 记忆一并清掉(宿主已移除,引用留着只会拖住 DOM)。
     labelLayer = null
     hoveredLabelKey = ''
@@ -2059,5 +2244,7 @@ export function unmountMarkerOverlay() {
     currentBadgeLayout = new Map()
     previousBadgeOffsetKeys = new Set()
     pool.clear()
+    visibleKeys.clear()
+    nextVisibleKeys.clear()
 }
 

+ 16 - 0
src/modules/cockpit/services/markerProjection.js

@@ -0,0 +1,16 @@
+import { Matrix4 } from 'cesium'
+
+/** Project one ECEF point with a view-projection matrix prepared once per frame. */
+export function projectWorldToWindow(position, viewProjection, width, height, result, clipPosition) {
+    clipPosition.x = position.x
+    clipPosition.y = position.y
+    clipPosition.z = position.z
+    clipPosition.w = 1
+    Matrix4.multiplyByVector(viewProjection, clipPosition, clipPosition)
+    if (clipPosition.z < 0) return null
+
+    const inverseW = 1 / clipPosition.w
+    result.x = (clipPosition.x * inverseW + 1) * width / 2
+    result.y = height - (clipPosition.y * inverseW + 1) * height / 2
+    return result
+}

+ 1 - 1
src/modules/cockpit/stores/monitoringStore.js

@@ -358,7 +358,7 @@ export const useMonitoringStore = defineStore('monitoringStore', () => {
      * 补拉一个点位的设备徽标(Q10:走 N+1,Q14:卡片进视口才拉)。
      *
      * 为什么不能从已有数据算:`/monitoring/distribution` 的 marker **不给设备编码列表**
-     * (那是 `/map-snapshot` 的 `deviceCodes`),所以徽标只能问详情端点要设备计数
+     * (那是 `/map/snapshot` 的 `deviceCodes`),所以徽标只能问详情端点要设备计数
      * (`domain/pointDetail.js` 已把它翻成 `statistics`,本文件只见这个领域字段)。
      * **一台失败不影响其它卡片**:失败记成 `failed` 状态,
      * 界面显示占位符而不是 0(0 是"确实没有设备",与"没取到"是两件事)。

+ 4 - 4
tests/cockpit-video/hosts.mjs

@@ -104,7 +104,7 @@ async function mountRoot({ positioned = false, underground = false } = {}) {
         requests.push({ url, path, body, options })
         if (url.origin !== 'http://fixture.invalid') { unexpected.push(url.href); throw new Error('Offline origin rejected') }
         assert.equal(new Headers(options.headers).get('authorization'), null)
-        if (path === '/map-snapshot') {
+        if (path === '/map/snapshot') {
             if (server.snapshotGate) await server.snapshotGate
             return envelope({ page: 1, pageSize: 100, snapshotAt: '2026-11-11T00:00:00Z',
                 batchUpdatedAt: '2026-11-11T00:00:00Z', total: 1, complete: true,
@@ -125,7 +125,7 @@ async function mountRoot({ positioned = false, underground = false } = {}) {
                 diameter: 300, material: '钢', coordinateValidation: { renderable: true } },
             geometry: { type: 'LineString', coordinates: [[110.3998, 28.4], [110.4008, 28.4]] },
         }] : [] })
-        if (path === '/device-facility-relations') return envelope({ rows: [] })
+        if (path === '/equipments/facility-relations') return envelope({ rows: [] })
         if (path.startsWith('/equipments/') && path.endsWith('/detail-aggregate')) return envelope({ ...aggregate, archive: { state: 'SUCCESS', data: selectedCamera } })
         if (path.startsWith('/equipments/') && path.endsWith('/collection-records')) return envelope({ deviceCode: cameraCode,
             state: 'EMPTY', recordView: { columns: [], rows: [] } })
@@ -634,10 +634,10 @@ test('三宿主同设备刷新保持同一媒体;浮动锚点暂隐不释放
             let releaseSnapshot, releasePoint
             page.server.snapshotGate = new Promise((resolve) => { releaseSnapshot = resolve })
             page.server.pointGate = new Promise((resolve) => { releasePoint = resolve })
-            const before = page.requests.filter((request) => request.path === '/map-snapshot').length
+            const before = page.requests.filter((request) => request.path === '/map/snapshot').length
             const beforeDetails = page.requests.filter((request) => request.path.endsWith('/detail-aggregate')).length
             page.host.querySelector('[data-map-refresh]').click(); await settle()
-            assert.equal(page.requests.filter((request) => request.path === '/map-snapshot').length, before + 1)
+            assert.equal(page.requests.filter((request) => request.path === '/map/snapshot').length, before + 1)
             assert.ok(document.querySelector('[data-video-monitor] video') === media, `${host}: 摘要刷新等待期保留媒体`)
             releaseSnapshot(); page.server.snapshotGate = null; await settle()
             assert.ok(document.querySelector('[data-video-monitor] video') === media, `${host}: 设备清单等待期保留媒体`)

+ 152 - 0
tests/markerOverlay.test.js

@@ -0,0 +1,152 @@
+import assert from 'node:assert/strict'
+import { afterEach, test } from 'node:test'
+import { parseHTML } from 'linkedom'
+import { planMarker } from '../src/modules/cockpit/domain/markerPlan.js'
+
+const { document, window } = parseHTML('<html><head></head><body></body></html>')
+globalThis.document = document
+globalThis.window = window
+
+const overlay = await import('../src/modules/cockpit/services/markerOverlay.js')
+
+afterEach(() => {
+    overlay.unmountMarkerOverlay()
+    document.body.innerHTML = ''
+})
+
+function makeMarkers(count) {
+    return Array.from({ length: count }, (_, index) => ({
+        kind: 'monitoring-point',
+        code: `point-${index}`,
+        name: `Point ${index}`,
+        status: 'NORMAL',
+        industry: '',
+        tone: 'lv4',
+        longitude: 110 + index / 10000,
+        latitude: 28 + index / 10000,
+        screenX: 10 + (index % 30) * 30,
+        screenY: 10 + Math.floor(index / 30) * 18,
+    }))
+}
+
+function makeFrame(markers, position) {
+    return {
+        markers,
+        devices: [],
+        aggregates: [],
+        facilities: [],
+        pipeComponents: [],
+        pipeComponentsVisible: false,
+        selectedFacilityKey: '',
+        pointScales: new Map(),
+        tones: { neutral: '#888888', lv4: '#22aa88' },
+        planOf: (marker) => planMarker({
+            kind: marker.kind,
+            status: marker.status,
+            industry: marker.industry,
+            tone: marker.tone,
+        }),
+        facilityPlanOf: () => null,
+        componentPlanOf: () => null,
+        effectOf: () => '',
+        deviceEffectOf: () => '',
+        facilityEffectOf: () => '',
+        selectedCode: '',
+        projectToWindow: (_longitude, _latitude, marker) => {
+            position.x = marker.screenX
+            position.y = marker.screenY
+            return position
+        },
+    }
+}
+
+test('preserves all markers through 100/500/1000 point updates and reuses projection results safely', () => {
+    const host = document.createElement('div')
+    host.getBoundingClientRect = () => ({ left: 0, top: 0, width: 1200, height: 900 })
+    document.body.appendChild(host)
+    assert.equal(overlay.mountMarkerOverlay(host), true)
+
+    const position = { x: 0, y: 0 }
+    const rows = makeMarkers(1000)
+    const coordinatesBefore = rows.map(({ longitude, latitude }) => [longitude, latitude])
+    for (const count of [100, 500, 1000]) {
+        overlay.syncMarkerOverlay(makeFrame(rows.slice(0, count), position))
+        assert.equal(overlay.overlayPoolSize(), count)
+        const visible = [...host.querySelectorAll('.marker-overlay-node')]
+            .filter((node) => node.style.display === 'block')
+        assert.equal(visible.length, count)
+    }
+
+    const first = host.querySelector('[data-marker-overlay-key="monitoring-point|point-0"]')
+    const second = host.querySelector('[data-marker-overlay-key="monitoring-point|point-1"]')
+    assert.equal(first.style.transform, 'translate(10px, 10px)')
+    assert.equal(second.style.transform, 'translate(40px, 10px)')
+
+    overlay.syncMarkerOverlay(makeFrame(rows.slice(0, 100), position))
+    assert.equal(overlay.overlayPoolSize(), 1000)
+    assert.equal(overlay.overlayNodeDisplayOf('monitoring-point|point-999'), 'none')
+    assert.deepEqual(rows.map(({ longitude, latitude }) => [longitude, latitude]), coordinatesBefore)
+
+    overlay.syncMarkerOverlay(makeFrame(rows, position))
+    assert.equal(overlay.overlayNodeDisplayOf('monitoring-point|point-999'), 'block')
+})
+
+test('keeps click/hover callbacks and removes render listeners on teardown and remount', () => {
+    const host = document.createElement('div')
+    host.getBoundingClientRect = () => ({ left: 0, top: 0, width: 1200, height: 900 })
+    document.body.appendChild(host)
+    const picks = []
+    const hovers = []
+    assert.equal(overlay.mountMarkerOverlay(host, {
+        onPick: (event) => picks.push(event),
+        onHover: (event) => hovers.push(event),
+    }), true)
+
+    const rows = makeMarkers(1)
+    overlay.syncMarkerOverlay(makeFrame(rows, { x: 0, y: 0 }))
+    const node = host.querySelector('.marker-overlay-node')
+    const click = new window.Event('click', { bubbles: true })
+    click.clientX = 12
+    click.clientY = 14
+    node.dispatchEvent(click)
+    node.dispatchEvent(new window.Event('pointermove', { bubbles: true }))
+    overlay.syncMarkerOverlay(makeFrame(rows, { x: 0, y: 0 }))
+    assert.equal(picks.length, 1)
+    assert.deepEqual(hovers.at(-1), { kind: 'monitoring-point', code: 'point-0' })
+    assert.equal(overlay.overlayLabelExpandedOf('monitoring-point|point-0'), true)
+
+    const makeEvent = () => {
+        const listeners = new Set()
+        return {
+            addEventListener: (listener) => listeners.add(listener),
+            removeEventListener: (listener) => listeners.delete(listener),
+            get size() { return listeners.size },
+        }
+    }
+    const preRender = makeEvent()
+    const postRender = makeEvent()
+    overlay.attachOverlayRenderer({ scene: { preRender, postRender } }, () => null)
+    assert.equal(preRender.size, 1)
+    assert.equal(postRender.size, 1)
+
+    overlay.unmountMarkerOverlay()
+    assert.equal(preRender.size, 0)
+    assert.equal(postRender.size, 0)
+    assert.equal(host.childElementCount, 0)
+    assert.equal(overlay.overlayPoolSize(), 0)
+
+    const secondHost = document.createElement('div')
+    document.body.appendChild(secondHost)
+    assert.equal(overlay.mountMarkerOverlay(secondHost), true)
+    overlay.syncMarkerOverlay(makeFrame(rows, { x: 0, y: 0 }))
+    assert.equal(secondHost.querySelectorAll('.marker-overlay-node').length, 1)
+
+    const secondPreRender = makeEvent()
+    const secondPostRender = makeEvent()
+    overlay.attachOverlayRenderer({ scene: { preRender: secondPreRender, postRender: secondPostRender } }, () => null)
+    assert.equal(secondPreRender.size, 1)
+    assert.equal(secondPostRender.size, 1)
+    overlay.unmountMarkerOverlay()
+    assert.equal(secondPreRender.size, 0)
+    assert.equal(secondPostRender.size, 0)
+})

+ 74 - 0
tests/markerProjection.test.js

@@ -0,0 +1,74 @@
+import assert from 'node:assert/strict'
+import { test } from 'node:test'
+import {
+    Cartesian2,
+    Cartesian3,
+    Cartesian4,
+    Matrix3,
+    Matrix4,
+    PerspectiveFrustum,
+    SceneMode,
+    SceneTransforms,
+} from 'cesium'
+import { projectWorldToWindow } from '../src/modules/cockpit/services/markerProjection.js'
+
+test('matches Cesium window projection for points visible through a 3D perspective camera', () => {
+    const width = 1234
+    const height = 511
+    const frustum = new PerspectiveFrustum({
+        fov: Math.PI / 3,
+        aspectRatio: width / height,
+        near: 1,
+        far: 100000,
+    })
+    const view = Matrix4.fromRotationTranslation(
+        Matrix3.fromRotationZ(Math.PI / 7, new Matrix3()),
+        new Cartesian3(-2, 1, -10),
+        new Matrix4(),
+    )
+    const scene = {
+        frameState: { mode: SceneMode.SCENE3D },
+        canvas: { clientWidth: width, clientHeight: height },
+        camera: { viewMatrix: view, frustum },
+    }
+    const viewProjection = Matrix4.multiply(frustum.projectionMatrix, view, new Matrix4())
+    const result = new Cartesian2()
+    const clipPosition = new Cartesian4()
+
+    for (const point of [
+        new Cartesian3(0, 0, 0),
+        new Cartesian3(4, 2, -20),
+        new Cartesian3(-12, 8, -50),
+    ]) {
+        const expected = SceneTransforms.worldToWindowCoordinates(scene, point, new Cartesian2())
+        const actual = projectWorldToWindow(point, viewProjection, width, height, result, clipPosition)
+        assert.ok(actual)
+        assert.ok(Math.abs(actual.x - expected.x) < 1e-8)
+        assert.ok(Math.abs(actual.y - expected.y) < 1e-8)
+        assert.equal(actual, result)
+    }
+})
+
+test('rejects points behind the camera like Cesium perspective projection', () => {
+    const width = 800
+    const height = 600
+    const frustum = new PerspectiveFrustum({
+        fov: Math.PI / 3,
+        aspectRatio: width / height,
+        near: 1,
+        far: 1000,
+    })
+    const scene = {
+        frameState: { mode: SceneMode.SCENE3D },
+        canvas: { clientWidth: width, clientHeight: height },
+        camera: { viewMatrix: Matrix4.IDENTITY, frustum },
+    }
+    const viewProjection = Matrix4.clone(frustum.projectionMatrix, new Matrix4())
+    const pointBehind = new Cartesian3(0, 0, 1)
+
+    assert.equal(SceneTransforms.worldToWindowCoordinates(scene, pointBehind, new Cartesian2()), undefined)
+    assert.equal(
+        projectWorldToWindow(pointBehind, viewProjection, width, height, new Cartesian2(), new Cartesian4()),
+        null,
+    )
+})