|
|
@@ -1590,7 +1590,9 @@ 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 projectionStartedAt = overlayPerfEnabled ? performance.now() : 0
|
|
|
const pos = projectToWindow(marker.longitude, marker.latitude, marker)
|
|
|
+ if (overlayPerfEnabled) markerProjectionMs += performance.now() - projectionStartedAt
|
|
|
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 })
|
|
|
}
|
|
|
// 设施/构件的投影也先算一次:聚合、深度排序、渲染共用同一份(不再每帧投两遍)。
|
|
|
@@ -1598,14 +1600,18 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
|
|
|
for (const facility of facilities || []) {
|
|
|
const key = facility.key || `facility-point|${facility.code}`
|
|
|
if (!Number.isFinite(facility.longitude) || !Number.isFinite(facility.latitude)) continue
|
|
|
+ const projectionStartedAt = overlayPerfEnabled ? performance.now() : 0
|
|
|
const pos = projectToWindow(facility.longitude, facility.latitude, facility)
|
|
|
+ if (overlayPerfEnabled) markerProjectionMs += performance.now() - projectionStartedAt
|
|
|
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 projectionStartedAt = overlayPerfEnabled ? performance.now() : 0
|
|
|
const pos = projectToWindow(component.longitude, component.latitude, component)
|
|
|
+ if (overlayPerfEnabled) markerProjectionMs += performance.now() - projectionStartedAt
|
|
|
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 设施点:各自独立命名空间,同位置也不跨类合并。
|
|
|
@@ -1628,19 +1634,26 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
|
|
|
if (marker.kind === 'unassociated-equipment') aggregateRows.push(row)
|
|
|
else if (marker.kind === 'monitoring-point') pointAggregateRows.push(row)
|
|
|
}
|
|
|
+ // 服务端桶覆盖的类别直接使用桶结果;本地聚合只为缺失类别回退。
|
|
|
+ const externalGroups = Array.isArray(displayGroups) ? displayGroups.filter((group) => group && group.count > 1) : []
|
|
|
+ const externalKinds = new Set(externalGroups.map((group) => group.memberKind))
|
|
|
// 迟滞:带上上一帧的组,已进组成员要拉开「阈值 + 缓冲」才释放(防止边界闪烁)。
|
|
|
- if (!aggregateRows.length) lastAggregateGroups = []
|
|
|
- const aggregateResult = groupUnassociatedByScreen(aggregateRows, {
|
|
|
- selectedCode: aggregateSelectedCode,
|
|
|
- previousGroups: lastAggregateGroups,
|
|
|
- })
|
|
|
+ if (!aggregateRows.length || externalKinds.has('unassociated-equipment')) lastAggregateGroups = []
|
|
|
+ const aggregateResult = externalKinds.has('unassociated-equipment')
|
|
|
+ ? { groups: [] }
|
|
|
+ : groupUnassociatedByScreen(aggregateRows, {
|
|
|
+ selectedCode: aggregateSelectedCode,
|
|
|
+ previousGroups: lastAggregateGroups,
|
|
|
+ })
|
|
|
lastAggregateGroups = aggregateResult.groups
|
|
|
- if (!pointAggregateRows.length) lastPointAggregateGroups = []
|
|
|
- const pointAggregateResult = groupMonitoringPointsByScreen(pointAggregateRows, {
|
|
|
- // 选中的监测点从聚合移出,单独显示并保持两级详情(选中态由详情 store 驱动)。
|
|
|
- selectedCode: typeof selectedPointCode === 'string' ? selectedPointCode : '',
|
|
|
- previousGroups: lastPointAggregateGroups,
|
|
|
- })
|
|
|
+ if (!pointAggregateRows.length || externalKinds.has('monitoring-point')) lastPointAggregateGroups = []
|
|
|
+ const pointAggregateResult = externalKinds.has('monitoring-point')
|
|
|
+ ? { groups: [] }
|
|
|
+ : groupMonitoringPointsByScreen(pointAggregateRows, {
|
|
|
+ // 选中的监测点从聚合移出,单独显示并保持两级详情(选中态由详情 store 驱动)。
|
|
|
+ selectedCode: typeof selectedPointCode === 'string' ? selectedPointCode : '',
|
|
|
+ previousGroups: lastPointAggregateGroups,
|
|
|
+ })
|
|
|
lastPointAggregateGroups = pointAggregateResult.groups
|
|
|
// 05 设施点:独立命名空间;选中设施用完整 key 移出,保留单体标记与设施详情。
|
|
|
const facilityAggregateRows = []
|
|
|
@@ -1664,11 +1677,13 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
|
|
|
screen: pos,
|
|
|
})
|
|
|
}
|
|
|
- if (!facilityAggregateRows.length) lastFacilityAggregateGroups = []
|
|
|
- const facilityAggregateResult = groupFacilityPointsByScreen(facilityAggregateRows, {
|
|
|
- selectedCode: typeof selectedFacilityKey === 'string' ? selectedFacilityKey : '',
|
|
|
- previousGroups: lastFacilityAggregateGroups,
|
|
|
- })
|
|
|
+ if (!facilityAggregateRows.length || externalKinds.has('facility-point')) lastFacilityAggregateGroups = []
|
|
|
+ const facilityAggregateResult = externalKinds.has('facility-point')
|
|
|
+ ? { groups: [] }
|
|
|
+ : groupFacilityPointsByScreen(facilityAggregateRows, {
|
|
|
+ selectedCode: typeof selectedFacilityKey === 'string' ? selectedFacilityKey : '',
|
|
|
+ previousGroups: lastFacilityAggregateGroups,
|
|
|
+ })
|
|
|
lastFacilityAggregateGroups = facilityAggregateResult.groups
|
|
|
let badgeGroups = [
|
|
|
...aggregateResult.groups,
|
|
|
@@ -1678,17 +1693,15 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
|
|
|
const groupedMemberKeys = new Set()
|
|
|
// 票 07:服务端桶可用时用它作为聚合入口;仍用本地对象投影来隐藏桶内成员,
|
|
|
// 成员详情/游标另走真实成员页。桶不可用时 displayGroups 为空,完全保留旧聚合。
|
|
|
- const externalGroups = Array.isArray(displayGroups) ? displayGroups.filter((group) => group && group.count > 1) : []
|
|
|
if (externalGroups.length) {
|
|
|
- const externalKinds = new Set(externalGroups.map((group) => group.memberKind))
|
|
|
const localForMissingClass = [
|
|
|
...aggregateResult.groups,
|
|
|
...pointAggregateResult.groups,
|
|
|
+ ...facilityAggregateResult.groups,
|
|
|
].filter((group) => group.count > 1 && !externalKinds.has(group.memberKind))
|
|
|
badgeGroups = [
|
|
|
...externalGroups,
|
|
|
...localForMissingClass,
|
|
|
- ...facilityAggregateResult.groups.filter((group) => group.count > 1),
|
|
|
]
|
|
|
for (const marker of markers || []) {
|
|
|
if (!marker) continue
|
|
|
@@ -1755,9 +1768,7 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
|
|
|
if (groupedMemberKeys.has(key)) { hidePooledNode(key); continue }
|
|
|
if (!Number.isFinite(marker.longitude) || !Number.isFinite(marker.latitude)) { hidePooledNode(key); continue }
|
|
|
|
|
|
- const projectionStartedAt = overlayPerfEnabled ? performance.now() : 0
|
|
|
- const windowPos = projectToWindow(marker.longitude, marker.latitude, marker)
|
|
|
- if (overlayPerfEnabled) markerProjectionMs += performance.now() - projectionStartedAt
|
|
|
+ const windowPos = windowPositions.get(key)
|
|
|
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)
|
|
|
@@ -2011,7 +2022,7 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
|
|
|
const key = facility.key || `facility-point|${facility.code}`
|
|
|
if (groupedMemberKeys.has(key)) { hidePooledNode(key); continue }
|
|
|
if (!Number.isFinite(facility.longitude) || !Number.isFinite(facility.latitude)) { hidePooledNode(key); continue }
|
|
|
- const windowPos = projectToWindow(facility.longitude, facility.latitude, facility)
|
|
|
+ const windowPos = facilityPositions.get(key)
|
|
|
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)
|
|
|
@@ -2077,7 +2088,7 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
|
|
|
for (const component of pipeComponentsVisible === false ? [] : (pipeComponents || [])) {
|
|
|
const key = component.key || `pipe-component|${component.code}`
|
|
|
if (!Number.isFinite(component.longitude) || !Number.isFinite(component.latitude)) { hidePooledNode(key); continue }
|
|
|
- const windowPos = projectToWindow(component.longitude, component.latitude, component)
|
|
|
+ const windowPos = componentPositions.get(key)
|
|
|
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)
|