线路图同步计轴和车次窗数据

This commit is contained in:
joylink_zhaoerwei 2023-07-06 14:37:38 +08:00
parent cdb7ee59ac
commit bd4ee6a5a6

View File

@ -36,6 +36,16 @@ import { toUint8Array } from 'js-base64';
import { getWebsocketUrl } from 'src/configs/UrlManage';
import { getJwtToken } from 'src/configs/TokenManage';
import { state } from 'src/protos/ws_message';
import {
AxleCounting,
AxleCountingTemplate,
} from 'src/graphics/axleCounting/AxleCounting';
import { AxleCountingData } from './graphics/AxleCountingInteraction';
import {
TrainWindow,
TrainWindowTemplate,
} from 'src/graphics/trainWindow/TrainWindow';
import { TrainWindowData } from './graphics/TrainWindowInteraction';
let lineApp: GraphicApp | null = null;
let msgBroker: AppWsMsgBroker | null = null;
@ -63,6 +73,8 @@ export function initLineApp(dom: HTMLElement): GraphicApp {
new StationTemplate(new StationData(), new StationState()),
new TurnoutTemplate(new TurnoutData()),
new SectionTemplate(new SectionData()),
new AxleCountingTemplate(new AxleCountingData()),
new TrainWindowTemplate(new TrainWindowData()),
];
lineApp.registerGraphicTemplates(...graphicTemplate);
lineApp.setOptions({
@ -122,8 +134,28 @@ export async function loadLineDatas(app: GraphicApp) {
storage.section.forEach((section) => {
datas.push(new SectionData(section));
});
storage.axleCountings.forEach((axleCounting) => {
datas.push(new AxleCountingData(axleCounting));
});
storage.trainWindows.forEach((trainWindow) => {
datas.push(new TrainWindowData(trainWindow));
});
await app.loadGraphic(datas);
//隐藏计轴--和车次窗
const axleCountings = app.queryStore.queryByType<AxleCounting>(
AxleCounting.Type
);
axleCountings.forEach((axleCounting) => {
axleCounting.visible = false;
});
const trainWindows = app.queryStore.queryByType<TrainWindow>(
TrainWindow.Type
);
trainWindows.forEach((trainWindow) => {
trainWindow.visible = false;
});
StompCli.new({
wsUrl: `${getWebsocketUrl()}`,
token: getJwtToken() as string,