线路图车次窗和计轴数据

This commit is contained in:
joylink_zhaoerwei 2023-07-03 16:05:41 +08:00
parent e91c6bcb28
commit 07b6ede1df

View File

@ -32,6 +32,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;
@ -59,6 +69,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({
@ -113,8 +125,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,