From 971929e86716b71e251926bf67778d3bd70a6750 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Sat, 7 Oct 2023 09:32:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=BA=E6=99=AF=E6=B7=BB=E5=8A=A0=E7=BB=A7?= =?UTF-8?q?=E7=94=B5=E5=99=A8=E5=85=B3=E8=81=94=E8=AE=BE=E5=A4=87=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drawApp/relayScene.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/drawApp/relayScene.ts b/src/drawApp/relayScene.ts index e2f2260..c41023a 100644 --- a/src/drawApp/relayScene.ts +++ b/src/drawApp/relayScene.ts @@ -12,7 +12,7 @@ import { toUint8Array } from 'js-base64'; import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics'; import { RelayCabinetTemplate } from 'src/graphics/relayCabinet/RelayCabinet'; import { RelayCabinetData } from './relayCabinetGraphics/RelayCabinetInteraction'; -import { RelayTemplate } from 'src/graphics/relay/Relay'; +import { Relay, RelayTemplate } from 'src/graphics/relay/Relay'; import { RelayData, RelayState } from './relayCabinetGraphics/RelayInteraction'; import { PhaseFailureProtectorTemplate } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector'; import { PhaseFailureProtectorData } from './relayCabinetGraphics/PhaseFailureProtectorInteraction'; @@ -37,6 +37,21 @@ export function initRelayScene(lineApp: IGraphicApp, sceneName: string) { relayScene.registerGraphicTemplates(...relayGraphicTemplate); relayScene.on('postdataloaded', () => { handleSubscribe(relayScene); + const map = new Map(); + refRelaysList.forEach((device) => { + device.combinationtypes.forEach((combinationtype) => { + combinationtype.refRelays.forEach((relayId) => { + map.set(relayId, device.code); + }); + }); + }); + const relays = relayScene.queryStore.queryByType(Relay.Type); + relays.forEach((relay) => { + relay.refDevice.text = map.get(relay.id) as string; + }); + }); + relayScene.on('destroy', async () => { + refRelaysList = []; }); } @@ -91,6 +106,7 @@ function handleSubscribe(relayScene: IGraphicScene) { }); } +let refRelaysList: relayCabinetGraphicData.DeviceRelateRelay[] = []; async function loadRelayDatas(): Promise { const lineStore = useLineStore(); const mapId = lineStore.mapId; @@ -114,6 +130,7 @@ async function loadRelayDatas(): Promise { storage.phaseFailureProtectors.forEach((phaseFailureProtector) => { datas.push(new PhaseFailureProtectorData(phaseFailureProtector)); }); + refRelaysList = storage.deviceRelateRelayList; return Promise.resolve({ canvasProperty: storage.canvas, datas: datas,