恢复测试内容

This commit is contained in:
fan 2023-08-01 10:30:19 +08:00
parent a12929f048
commit f9c8594253

View File

@ -2,7 +2,7 @@ import {
GraphicApp, GraphicApp,
GraphicData, GraphicData,
GraphicState, GraphicState,
// ClientEngine, ClientEngine,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { TrainState } from './graphics/TrainInteraction'; import { TrainState } from './graphics/TrainInteraction';
import { Train, TrainTemplate } from 'src/graphics/train/Train'; import { Train, TrainTemplate } from 'src/graphics/train/Train';
@ -308,91 +308,91 @@ export async function loadLineDatas(app: GraphicApp) {
} }
}); });
// app.enableWsMassaging({ app.enableWsMassaging({
// engine: ClientEngine.Centrifugo, engine: ClientEngine.Centrifugo,
// wsUrl: `${getWebsocketUrl()}`, wsUrl: `${getWebsocketUrl()}`,
// token: getOnlyToken() as string, token: getOnlyToken() as string,
// }); });
// app.subscribe({ app.subscribe({
// // destination: `/simulation/${simulationId}/devices/status`, // destination: `/simulation/${simulationId}/devices/status`,
// destination: `simulation-${simulationId}-devices-status`, destination: `simulation-${simulationId}-devices-status`,
// messageConverter: (message: Uint8Array) => { messageConverter: (message: Uint8Array) => {
// const states: GraphicState[] = []; const states: GraphicState[] = [];
// const storage = state.PushedDevicesStatus.deserialize(message); const storage = state.PushedDevicesStatus.deserialize(message);
// // console.log(storage, 'storage'); // console.log(storage, 'storage');
// if (storage.all) { if (storage.all) {
// storage.allStatus.sectionState.forEach((item) => { storage.allStatus.sectionState.forEach((item) => {
// if (state.SectionType[item.type] == 'Axle') { if (state.SectionType[item.type] == 'Axle') {
// //计轴区段 //计轴区段
// // states.push(new AxleCountingState(item)); // states.push(new AxleCountingState(item));
// } else if (state.SectionType[item.type] == 'Logic') { } else if (state.SectionType[item.type] == 'Logic') {
// // 逻辑区段 // 逻辑区段
// // states.push(new LogicSectionState(item)); // states.push(new LogicSectionState(item));
// } else if (state.SectionType[item.type] == 'Physic') { } else if (state.SectionType[item.type] == 'Physic') {
// // 物理区段 // 物理区段
// // states.push(new SectionState(item)); // states.push(new SectionState(item));
// } }
// }); });
// storage.allStatus.switchState.forEach((item) => { storage.allStatus.switchState.forEach((item) => {
// // 道岔 // 道岔
// states.push(new TurnoutStates(item)); states.push(new TurnoutStates(item));
// }); });
// storage.allStatus.trainState.forEach((item) => { storage.allStatus.trainState.forEach((item) => {
// // 列车 // 列车
// states.push(new TrainState(item)); states.push(new TrainState(item));
// }); });
// } else { } else {
// storage.varStatus.updatedSection.forEach((item) => { storage.varStatus.updatedSection.forEach((item) => {
// if (state.SectionType[item.type] == 'Axle') { if (state.SectionType[item.type] == 'Axle') {
// //计轴区段 //计轴区段
// // states.push(new AxleCountingState(item)); // states.push(new AxleCountingState(item));
// } else if (state.SectionType[item.type] == 'Logic') { } else if (state.SectionType[item.type] == 'Logic') {
// // 逻辑区段 // 逻辑区段
// // states.push(new LogicSectionState(item)); // states.push(new LogicSectionState(item));
// } else if (state.SectionType[item.type] == 'Physic') { } else if (state.SectionType[item.type] == 'Physic') {
// // 物理区段 // 物理区段
// // states.push(new SectionState(item)); // states.push(new SectionState(item));
// } }
// }); });
// storage.varStatus.updatedSwitch.forEach((item) => { storage.varStatus.updatedSwitch.forEach((item) => {
// // 道岔 // 道岔
// states.push(new TurnoutStates(item)); states.push(new TurnoutStates(item));
// }); });
// storage.varStatus.updatedTrain.forEach((item) => { storage.varStatus.updatedTrain.forEach((item) => {
// // 列车 // 列车
// states.push(new TrainState(item)); states.push(new TrainState(item));
// }); });
// storage.varStatus.removedTrainId.forEach((item) => { storage.varStatus.removedTrainId.forEach((item) => {
// // 移除列车 // 移除列车
// const train = app.queryStore.queryByCodeAndType(item, Train.Type); const train = app.queryStore.queryByCodeAndType(item, Train.Type);
// if (train) { if (train) {
// app.deleteGraphics(train); app.deleteGraphics(train);
// } }
// }); });
// } }
// if (states && states.length > 0) { if (states && states.length > 0) {
// lineStore.setSocketStates(states); lineStore.setSocketStates(states);
// } }
// return states; return states;
// }, },
// }); });
// let msgNotify: null | ((props?: QNotifyUpdateOptions | undefined) => void) = let msgNotify: null | ((props?: QNotifyUpdateOptions | undefined) => void) =
// null; null;
// app.on('websocket-connect-state-change', (connected) => { app.on('websocket-connect-state-change', (connected) => {
// if (!connected && !msgNotify) { if (!connected && !msgNotify) {
// msgNotify = Notify.create({ msgNotify = Notify.create({
// type: 'negative', type: 'negative',
// timeout: 0, timeout: 0,
// position: 'top-right', position: 'top-right',
// message: '通信链接已断开!', message: '通信链接已断开!',
// }); });
// } else if (msgNotify && connected) { } else if (msgNotify && connected) {
// msgNotify(); msgNotify();
// msgNotify = null; msgNotify = null;
// } }
// }); });
} else { } else {
app.loadGraphic([]); app.loadGraphic([]);
} }