信号机操作调整
This commit is contained in:
parent
1aa6514809
commit
ec07d43813
@ -1 +1 @@
|
|||||||
Subproject commit f43d8dbec4b997ef729ceb6e086db1bd066c0790
|
Subproject commit c3893c5b49cf1c5c169655fb321d133d71e4fcdf
|
10224
package-lock.json
generated
Normal file
10224
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -56,6 +56,15 @@ export async function removeTrain(data: {
|
|||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function setSignalState(data: {
|
||||||
|
simulationId: string;
|
||||||
|
mapId: number;
|
||||||
|
id: string;
|
||||||
|
aspect: number;
|
||||||
|
}) {
|
||||||
|
return await api.post(`${UriBase}/signal/operation`, data);
|
||||||
|
}
|
||||||
|
|
||||||
export async function setSwitchPosition(data: {
|
export async function setSwitchPosition(data: {
|
||||||
simulationId: string;
|
simulationId: string;
|
||||||
mapId: number;
|
mapId: number;
|
||||||
|
@ -3,9 +3,9 @@ function getHost(): string {
|
|||||||
// return '192.168.3.47:9091';
|
// return '192.168.3.47:9091';
|
||||||
// return '192.168.3.37:9091';
|
// return '192.168.3.37:9091';
|
||||||
// return '192.168.3.15:9091';
|
// return '192.168.3.15:9091';
|
||||||
// return '192.168.3.5:9091';
|
return '192.168.3.5:9091';
|
||||||
// return '192.168.3.37:9091';
|
// return '192.168.3.37:9091';
|
||||||
return '192.168.3.233:9091';
|
// return '192.168.3.233:9091';
|
||||||
// return 'test.joylink.club/bjrtss-server';
|
// return 'test.joylink.club/bjrtss-server';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { TrainTemplate } from 'src/graphics/train/Train';
|
import { TrainTemplate } from 'src/graphics/train/Train';
|
||||||
import { TrainDraw } from 'src/graphics/train/TrainDrawAssistant';
|
import { TrainDraw } from 'src/graphics/train/TrainDrawAssistant';
|
||||||
import { Signal, SignalTemplate } from 'src/graphics/signal/Signal';
|
import { Signal } from 'src/graphics/signal/Signal';
|
||||||
import { SignalDraw } from 'src/graphics/signal/SignalDrawAssistant';
|
|
||||||
import { GraphicData, IDrawApp } from 'src/jl-graphic';
|
import { GraphicData, IDrawApp } from 'src/jl-graphic';
|
||||||
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
|
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
|
||||||
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
|
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
|
||||||
@ -9,7 +8,6 @@ import { TrainState } from './graphics/TrainInteraction';
|
|||||||
import {
|
import {
|
||||||
SignalData,
|
SignalData,
|
||||||
DrawSignalInteraction,
|
DrawSignalInteraction,
|
||||||
SignalState,
|
|
||||||
} from './graphics/SignalInteraction';
|
} from './graphics/SignalInteraction';
|
||||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||||
import { Platform, PlatformTemplate } from 'src/graphics/platform/Platform';
|
import { Platform, PlatformTemplate } from 'src/graphics/platform/Platform';
|
||||||
@ -175,7 +173,7 @@ export function initCommonDrawApp(app: IDrawApp) {
|
|||||||
app,
|
app,
|
||||||
new StationTemplate(new StationData(), new StationState())
|
new StationTemplate(new StationData(), new StationState())
|
||||||
);
|
);
|
||||||
new SignalDraw(app, new SignalTemplate(new SignalData(), new SignalState()));
|
// new SignalDraw(app, new SignalTemplate(new SignalData(), new SignalState()));
|
||||||
new TrainDraw(app, new TrainTemplate(new TrainState()));
|
new TrainDraw(app, new TrainTemplate(new TrainState()));
|
||||||
new SectionDraw(app, new SectionTemplate(new SectionData()));
|
new SectionDraw(app, new SectionTemplate(new SectionData()));
|
||||||
new TurnoutDraw(
|
new TurnoutDraw(
|
||||||
|
36
src/drawApp/gategoryConsts.ts
Normal file
36
src/drawApp/gategoryConsts.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import { Signal } from 'src/graphics/signal/Signal';
|
||||||
|
import { CategoryType } from 'src/components/CategoryType';
|
||||||
|
|
||||||
|
const jkSignalConsts = {
|
||||||
|
lampNum: 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
const thSignalConsts = {
|
||||||
|
lampNum: 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
function getJkTypeConsts(type: string) {
|
||||||
|
if (type === Signal.Type) {
|
||||||
|
return jkSignalConsts;
|
||||||
|
} else {
|
||||||
|
throw new Error('未找到该设备类型的常量');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getThTypeConsts(type: string) {
|
||||||
|
if (type === Signal.Type) {
|
||||||
|
return thSignalConsts;
|
||||||
|
} else {
|
||||||
|
throw new Error('未找到该设备类型的常量');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCategoryConsts(category: CategoryType) {
|
||||||
|
if (category === CategoryType.TH) {
|
||||||
|
return getThTypeConsts;
|
||||||
|
} else if (category === CategoryType.JK) {
|
||||||
|
return getJkTypeConsts;
|
||||||
|
} else {
|
||||||
|
throw new Error('未找到该厂商的常量函数');
|
||||||
|
}
|
||||||
|
}
|
@ -18,6 +18,7 @@ import { FederatedMouseEvent, DisplayObject } from 'pixi.js';
|
|||||||
import { state } from 'src/protos/device_state';
|
import { state } from 'src/protos/device_state';
|
||||||
import { useLineStore } from 'src/stores/line-store';
|
import { useLineStore } from 'src/stores/line-store';
|
||||||
import { SignalGraphicHitArea } from 'src/graphics/signal/SignalDrawAssistant';
|
import { SignalGraphicHitArea } from 'src/graphics/signal/SignalDrawAssistant';
|
||||||
|
import { setSignalState } from 'src/api/Simulation';
|
||||||
|
|
||||||
export class SignalData extends GraphicDataBase implements ISignalData {
|
export class SignalData extends GraphicDataBase implements ISignalData {
|
||||||
constructor(data?: graphicData.Signal) {
|
constructor(data?: graphicData.Signal) {
|
||||||
@ -97,144 +98,12 @@ export class SignalState extends GraphicStateBase implements ISignalState {
|
|||||||
get code(): string {
|
get code(): string {
|
||||||
return this.states.id;
|
return this.states.id;
|
||||||
}
|
}
|
||||||
// get redOpen(): boolean {
|
get aspect(): number {
|
||||||
// return this.states.redOpen;
|
return this.states.aspect;
|
||||||
// }
|
}
|
||||||
// set redOpen(v: boolean) {
|
set aspect(v: number) {
|
||||||
// this.states.redOpen = v;
|
this.states.aspect = v;
|
||||||
// }
|
}
|
||||||
// get redFlash(): boolean {
|
|
||||||
// return this.states.redFlash;
|
|
||||||
// }
|
|
||||||
// set redFlash(v: boolean) {
|
|
||||||
// this.states.redFlash = v;
|
|
||||||
// }
|
|
||||||
// get greenOpen(): boolean {
|
|
||||||
// return this.states.greenOpen;
|
|
||||||
// }
|
|
||||||
// set greenOpen(v: boolean) {
|
|
||||||
// this.states.greenOpen = v;
|
|
||||||
// }
|
|
||||||
// get greenFlash(): boolean {
|
|
||||||
// return this.states.greenFlash;
|
|
||||||
// }
|
|
||||||
// set greenFlash(v: boolean) {
|
|
||||||
// this.states.greenFlash = v;
|
|
||||||
// }
|
|
||||||
// get yellowOpen(): boolean {
|
|
||||||
// return this.states.yellowOpen;
|
|
||||||
// }
|
|
||||||
// set yellowOpen(v: boolean) {
|
|
||||||
// this.states.yellowOpen = v;
|
|
||||||
// }
|
|
||||||
// get yellowFlash(): boolean {
|
|
||||||
// return this.states.yellowFlash;
|
|
||||||
// }
|
|
||||||
// set yellowFlash(v: boolean) {
|
|
||||||
// this.states.yellowFlash = v;
|
|
||||||
// }
|
|
||||||
// get whiteOpen(): boolean {
|
|
||||||
// return this.states.whiteOpen;
|
|
||||||
// }
|
|
||||||
// set whiteOpen(v: boolean) {
|
|
||||||
// this.states.whiteOpen = v;
|
|
||||||
// }
|
|
||||||
// get whiteFlash(): boolean {
|
|
||||||
// return this.states.whiteFlash;
|
|
||||||
// }
|
|
||||||
// set whiteFlash(v: boolean) {
|
|
||||||
// this.states.whiteFlash = v;
|
|
||||||
// }
|
|
||||||
// get blueOpen(): boolean {
|
|
||||||
// return this.states.blueOpen;
|
|
||||||
// }
|
|
||||||
// set blueOpen(v: boolean) {
|
|
||||||
// this.states.blueOpen = v;
|
|
||||||
// }
|
|
||||||
// get blueFlash(): boolean {
|
|
||||||
// return this.states.blueFlash;
|
|
||||||
// }
|
|
||||||
// set blueFlash(v: boolean) {
|
|
||||||
// this.states.blueFlash = v;
|
|
||||||
// }
|
|
||||||
// get fleetMode(): boolean {
|
|
||||||
// return this.states.fleetMode;
|
|
||||||
// }
|
|
||||||
// set fleetMode(v: boolean) {
|
|
||||||
// this.states.fleetMode = v;
|
|
||||||
// }
|
|
||||||
// get ctrlFleetMode(): boolean {
|
|
||||||
// return this.states.ctrlFleetMode;
|
|
||||||
// }
|
|
||||||
// set ctrlFleetMode(v: boolean) {
|
|
||||||
// this.states.ctrlFleetMode = v;
|
|
||||||
// }
|
|
||||||
// get autoMode(): boolean {
|
|
||||||
// return this.states.autoMode;
|
|
||||||
// }
|
|
||||||
// set autoMode(v: boolean) {
|
|
||||||
// this.states.autoMode = v;
|
|
||||||
// }
|
|
||||||
// get ctrlAutoMode(): boolean {
|
|
||||||
// return this.states.ctrlAutoMode;
|
|
||||||
// }
|
|
||||||
// set ctrlAutoMode(v: boolean) {
|
|
||||||
// this.states.ctrlAutoMode = v;
|
|
||||||
// }
|
|
||||||
// get extinguish(): boolean {
|
|
||||||
// return this.states.extinguish;
|
|
||||||
// }
|
|
||||||
// set extinguish(v: boolean) {
|
|
||||||
// this.states.extinguish = v;
|
|
||||||
// }
|
|
||||||
// get approachLock(): boolean {
|
|
||||||
// return this.states.approachLock;
|
|
||||||
// }
|
|
||||||
// set approachLock(v: boolean) {
|
|
||||||
// this.states.approachLock = v;
|
|
||||||
// }
|
|
||||||
// get protectRoute(): boolean {
|
|
||||||
// return this.states.protectRoute;
|
|
||||||
// }
|
|
||||||
// set protectRoute(v: boolean) {
|
|
||||||
// this.states.protectRoute = v;
|
|
||||||
// }
|
|
||||||
// get autoRouteDisable(): boolean {
|
|
||||||
// return this.states.autoRouteDisable;
|
|
||||||
// }
|
|
||||||
// set autoRouteDisable(v: boolean) {
|
|
||||||
// this.states.autoRouteDisable = v;
|
|
||||||
// }
|
|
||||||
// get callon(): boolean {
|
|
||||||
// return this.states.callon;
|
|
||||||
// }
|
|
||||||
// set callon(v: boolean) {
|
|
||||||
// this.states.callon = v;
|
|
||||||
// }
|
|
||||||
// get yellowYellow(): boolean {
|
|
||||||
// return this.states.yellowYellow;
|
|
||||||
// }
|
|
||||||
// set yellowYellow(v: boolean) {
|
|
||||||
// this.states.yellowYellow = v;
|
|
||||||
// }
|
|
||||||
// get yellowGreen(): boolean {
|
|
||||||
// return this.states.yellowGreen;
|
|
||||||
// }
|
|
||||||
// set yellowGreen(v: boolean) {
|
|
||||||
// this.states.yellowGreen = v;
|
|
||||||
// }
|
|
||||||
// get blocked(): boolean {
|
|
||||||
// return this.states.blocked;
|
|
||||||
// }
|
|
||||||
// set blocked(v: boolean) {
|
|
||||||
// this.states.blocked = v;
|
|
||||||
// }
|
|
||||||
// get lampFailure(): boolean {
|
|
||||||
// return this.states.lampFailure;
|
|
||||||
// }
|
|
||||||
// set lampFailure(v: boolean) {
|
|
||||||
// this.states.lampFailure = v;
|
|
||||||
// }
|
|
||||||
get states(): state.SignalState {
|
get states(): state.SignalState {
|
||||||
return this.getState<state.SignalState>();
|
return this.getState<state.SignalState>();
|
||||||
}
|
}
|
||||||
@ -252,23 +121,21 @@ export class SignalState extends GraphicStateBase implements ISignalState {
|
|||||||
const mirrorFlipConfig: MenuItemOptions = {
|
const mirrorFlipConfig: MenuItemOptions = {
|
||||||
name: '镜像翻转',
|
name: '镜像翻转',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const signalRedConfig: MenuItemOptions = {
|
||||||
|
name: '开红灯',
|
||||||
|
};
|
||||||
|
const signalGreenConfig: MenuItemOptions = {
|
||||||
|
name: '开绿灯',
|
||||||
|
};
|
||||||
|
const signalYellowConfig: MenuItemOptions = {
|
||||||
|
name: '开黄灯',
|
||||||
|
};
|
||||||
|
const signalGuideConfig: MenuItemOptions = {
|
||||||
|
name: '开引导',
|
||||||
|
};
|
||||||
const signalCloseConfig: MenuItemOptions = {
|
const signalCloseConfig: MenuItemOptions = {
|
||||||
name: '信号机关闭',
|
name: '关灯',
|
||||||
};
|
|
||||||
const signalRedFlashConfig: MenuItemOptions = {
|
|
||||||
name: '信号机红闪',
|
|
||||||
};
|
|
||||||
const signalOpenConfig: MenuItemOptions = {
|
|
||||||
name: '信号机开放',
|
|
||||||
};
|
|
||||||
const signalFleetConfig: MenuItemOptions = {
|
|
||||||
name: '连锁自动进路',
|
|
||||||
};
|
|
||||||
const humanControlConfig: MenuItemOptions = {
|
|
||||||
name: '进路交人工控',
|
|
||||||
};
|
|
||||||
const logicConfig: MenuItemOptions = {
|
|
||||||
name: '逻辑点灯',
|
|
||||||
};
|
};
|
||||||
const SignalEditMenu: ContextMenu = ContextMenu.init({
|
const SignalEditMenu: ContextMenu = ContextMenu.init({
|
||||||
name: '信号机编辑菜单',
|
name: '信号机编辑菜单',
|
||||||
@ -283,12 +150,11 @@ const SignalOperateMenu: ContextMenu = ContextMenu.init({
|
|||||||
groups: [
|
groups: [
|
||||||
{
|
{
|
||||||
items: [
|
items: [
|
||||||
|
signalRedConfig,
|
||||||
|
signalGreenConfig,
|
||||||
|
signalYellowConfig,
|
||||||
|
signalGuideConfig,
|
||||||
signalCloseConfig,
|
signalCloseConfig,
|
||||||
signalOpenConfig,
|
|
||||||
signalFleetConfig,
|
|
||||||
humanControlConfig,
|
|
||||||
logicConfig,
|
|
||||||
signalRedFlashConfig,
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -331,6 +197,7 @@ export class SignalOperateInteraction extends GraphicInteractionPlugin<Signal> {
|
|||||||
constructor(app: IGraphicScene) {
|
constructor(app: IGraphicScene) {
|
||||||
super(SignalOperateInteraction.Name, app);
|
super(SignalOperateInteraction.Name, app);
|
||||||
app.registerMenu(SignalOperateMenu);
|
app.registerMenu(SignalOperateMenu);
|
||||||
|
console.log('111111111');
|
||||||
}
|
}
|
||||||
static init(app: IGraphicScene) {
|
static init(app: IGraphicScene) {
|
||||||
return new SignalOperateInteraction(app);
|
return new SignalOperateInteraction(app);
|
||||||
@ -346,49 +213,64 @@ export class SignalOperateInteraction extends GraphicInteractionPlugin<Signal> {
|
|||||||
g.selectable = true;
|
g.selectable = true;
|
||||||
g.lampMainBody.hitArea = new SignalGraphicHitArea(g);
|
g.lampMainBody.hitArea = new SignalGraphicHitArea(g);
|
||||||
g.on('_leftclick', this.onLeftClick, this);
|
g.on('_leftclick', this.onLeftClick, this);
|
||||||
|
g.on('rightclick', this.onContextMenu, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
unbind(g: Signal): void {
|
unbind(g: Signal): void {
|
||||||
g.selectable = false;
|
g.selectable = false;
|
||||||
g.eventMode = 'none';
|
g.eventMode = 'none';
|
||||||
g.off('_leftclick', this.onLeftClick, this);
|
g.off('_leftclick', this.onLeftClick, this);
|
||||||
|
g.off('rightclick', this.onContextMenu);
|
||||||
}
|
}
|
||||||
onLeftClick() {
|
onLeftClick() {
|
||||||
useLineStore().stateProCountIncrease();
|
useLineStore().stateProCountIncrease();
|
||||||
}
|
}
|
||||||
// onContextMenu(e: FederatedMouseEvent) {
|
onContextMenu(e: FederatedMouseEvent) {
|
||||||
// const target = e.target as DisplayObject;
|
const target = e.target as DisplayObject;
|
||||||
// const signal = target.getGraphic() as Signal;
|
const signal = target.getGraphic() as Signal;
|
||||||
// this.app.updateSelected(signal);
|
this.app.updateSelected(signal);
|
||||||
// signalCloseConfig.handler = () => {
|
const simulationId = useLineStore().simulationId || '';
|
||||||
// signal.states.redOpen = true;
|
const mapId = useLineStore().mapId as number;
|
||||||
// signal.states.greenOpen = false;
|
signalCloseConfig.handler = () => {
|
||||||
// signal.doRepaint();
|
setSignalState({
|
||||||
// };
|
simulationId,
|
||||||
// signalOpenConfig.handler = () => {
|
mapId,
|
||||||
// signal.states.redOpen = false;
|
id: signal.datas.id,
|
||||||
// signal.states.greenOpen = true;
|
aspect: state.Signal.Aspect.OFF,
|
||||||
// signal.doRepaint();
|
});
|
||||||
// };
|
};
|
||||||
// signalFleetConfig.handler = () => {
|
signalRedConfig.handler = () => {
|
||||||
// signal.states.fleetMode = true;
|
setSignalState({
|
||||||
// signal.doRepaint();
|
simulationId,
|
||||||
// };
|
mapId,
|
||||||
// humanControlConfig.handler = () => {
|
id: signal.datas.id,
|
||||||
// signal.states.autoRouteDisable = true;
|
aspect: state.Signal.Aspect.H,
|
||||||
// signal.doRepaint();
|
});
|
||||||
// };
|
};
|
||||||
// logicConfig.handler = () => {
|
signalGreenConfig.handler = () => {
|
||||||
// signal.states.extinguish = true;
|
setSignalState({
|
||||||
// signal.doRepaint();
|
simulationId,
|
||||||
// };
|
mapId,
|
||||||
// signalRedFlashConfig.handler = () => {
|
id: signal.datas.id,
|
||||||
// signal.states.redFlash = true;
|
aspect: state.Signal.Aspect.L,
|
||||||
// signal.states.redOpen = false;
|
});
|
||||||
// signal.states.greenOpen = false;
|
};
|
||||||
// signal.doRepaint();
|
signalYellowConfig.handler = () => {
|
||||||
// };
|
setSignalState({
|
||||||
|
simulationId,
|
||||||
// SignalOperateMenu.open(e.global);
|
mapId,
|
||||||
// }
|
id: signal.datas.id,
|
||||||
|
aspect: state.Signal.Aspect.U,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
signalGuideConfig.handler = () => {
|
||||||
|
setSignalState({
|
||||||
|
simulationId,
|
||||||
|
mapId,
|
||||||
|
id: signal.datas.id,
|
||||||
|
aspect: state.Signal.Aspect.HU,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
SignalOperateMenu.open(e.global);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,11 @@ import {
|
|||||||
} from './commonApp';
|
} from './commonApp';
|
||||||
import { Notify } from 'quasar';
|
import { Notify } from 'quasar';
|
||||||
import { generateCalculateLink } from 'src/api/GenerateApi';
|
import { generateCalculateLink } from 'src/api/GenerateApi';
|
||||||
|
import { SignalDraw } from 'src/graphics/signal/SignalDrawAssistant';
|
||||||
|
import { SignalTemplate, Signal } from 'src/graphics/signal/Signal';
|
||||||
|
import { SignalData, SignalState } from './graphics/SignalInteraction';
|
||||||
|
import { getCategoryConsts } from './gategoryConsts';
|
||||||
|
import { CategoryType } from 'src/components/CategoryType';
|
||||||
|
|
||||||
let jkDrawApp: IDrawApp | null = null;
|
let jkDrawApp: IDrawApp | null = null;
|
||||||
|
|
||||||
@ -93,12 +98,21 @@ export function initJkDrawApp(): IDrawApp {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
const getJkTypeConsts = getCategoryConsts(CategoryType.JK);
|
||||||
jkDrawApp = newDrawApp({
|
jkDrawApp = newDrawApp({
|
||||||
dataLoader: loadJkDrawDatas,
|
dataLoader: loadJkDrawDatas,
|
||||||
isSupportDeletion: isSupportDeletion,
|
isSupportDeletion: isSupportDeletion,
|
||||||
});
|
});
|
||||||
const app = jkDrawApp;
|
const app = jkDrawApp;
|
||||||
initCommonDrawApp(app);
|
initCommonDrawApp(app);
|
||||||
|
new SignalDraw(
|
||||||
|
app,
|
||||||
|
new SignalTemplate(
|
||||||
|
new SignalData(),
|
||||||
|
new SignalState(),
|
||||||
|
getJkTypeConsts(Signal.Type)
|
||||||
|
)
|
||||||
|
);
|
||||||
new SectionLinkDraw(app, new SectionLinkTemplate(new SectionLinkData()));
|
new SectionLinkDraw(app, new SectionLinkTemplate(new SectionLinkData()));
|
||||||
new AxleCountingSectionDraw(
|
new AxleCountingSectionDraw(
|
||||||
app,
|
app,
|
||||||
|
@ -130,6 +130,7 @@ import {
|
|||||||
TrackLogicSectionTemplate,
|
TrackLogicSectionTemplate,
|
||||||
} from 'src/graphics/trackLogicSection/TrackLogicSection';
|
} from 'src/graphics/trackLogicSection/TrackLogicSection';
|
||||||
import { TrackLogicSectionData } from './graphics/TrackLogicSectionInteraction';
|
import { TrackLogicSectionData } from './graphics/TrackLogicSectionInteraction';
|
||||||
|
import { getCategoryConsts } from './gategoryConsts';
|
||||||
|
|
||||||
const showOptions: MenuItemOptions = {
|
const showOptions: MenuItemOptions = {
|
||||||
name: '显示控制',
|
name: '显示控制',
|
||||||
@ -193,9 +194,18 @@ export function initLineScene(lineApp: IGraphicApp, sceneName: string) {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
const lineScene = lineApp.initScene(sceneName, options);
|
const lineScene = lineApp.initScene(sceneName, options);
|
||||||
|
const categoryType = useLineStore().categoryType;
|
||||||
|
if (!categoryType) {
|
||||||
|
throw new Error('为获取到厂商信息');
|
||||||
|
}
|
||||||
|
const getTypeConsts = getCategoryConsts(categoryType);
|
||||||
const graphicTemplate = [
|
const graphicTemplate = [
|
||||||
new TrainTemplate(new TrainState()),
|
new TrainTemplate(new TrainState()),
|
||||||
new SignalTemplate(new SignalData(), new SignalState()),
|
new SignalTemplate(
|
||||||
|
new SignalData(),
|
||||||
|
new SignalState(),
|
||||||
|
getTypeConsts(Signal.Type)
|
||||||
|
),
|
||||||
new PlatformTemplate(new PlatformData(), new PlatformState()),
|
new PlatformTemplate(new PlatformData(), new PlatformState()),
|
||||||
new ScreenDoorTemplate(new ScreenDoorData()),
|
new ScreenDoorTemplate(new ScreenDoorData()),
|
||||||
new StationTemplate(new StationData(), new StationState()),
|
new StationTemplate(new StationData(), new StationState()),
|
||||||
@ -258,6 +268,7 @@ function handleSubscribe(lineScene: IGraphicScene) {
|
|||||||
const states: GraphicState[] = [];
|
const states: GraphicState[] = [];
|
||||||
const storage = state.PushedDevicesStatus.deserialize(message);
|
const storage = state.PushedDevicesStatus.deserialize(message);
|
||||||
if (storage.all) {
|
if (storage.all) {
|
||||||
|
console.log(storage.allStatus, '===');
|
||||||
storage.allStatus.sectionState.forEach((item) => {
|
storage.allStatus.sectionState.forEach((item) => {
|
||||||
if (state.SectionType[item.type] == 'Axle') {
|
if (state.SectionType[item.type] == 'Axle') {
|
||||||
//计轴区段
|
//计轴区段
|
||||||
@ -276,6 +287,11 @@ function handleSubscribe(lineScene: IGraphicScene) {
|
|||||||
states.push(new TurnoutStates(item));
|
states.push(new TurnoutStates(item));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
storage.allStatus.signalState.forEach((item) => {
|
||||||
|
if (item.id) {
|
||||||
|
states.push(new SignalState(item));
|
||||||
|
}
|
||||||
|
});
|
||||||
storage.allStatus.trainState.forEach((item) => {
|
storage.allStatus.trainState.forEach((item) => {
|
||||||
// 列车
|
// 列车
|
||||||
if (!item.show) {
|
if (!item.show) {
|
||||||
|
@ -29,6 +29,11 @@ import {
|
|||||||
loadCommonDrawDatas,
|
loadCommonDrawDatas,
|
||||||
saveDrawToServer,
|
saveDrawToServer,
|
||||||
} from './commonApp';
|
} from './commonApp';
|
||||||
|
import { SignalDraw } from 'src/graphics/signal/SignalDrawAssistant';
|
||||||
|
import { SignalTemplate, Signal } from 'src/graphics/signal/Signal';
|
||||||
|
import { SignalData, SignalState } from './graphics/SignalInteraction';
|
||||||
|
import { getCategoryConsts } from './gategoryConsts';
|
||||||
|
import { CategoryType } from 'src/components/CategoryType';
|
||||||
|
|
||||||
let thDrawApp: IDrawApp | null = null;
|
let thDrawApp: IDrawApp | null = null;
|
||||||
|
|
||||||
@ -74,7 +79,16 @@ export function initThDrawApp(): IDrawApp {
|
|||||||
dataLoader: loadThDrawDatas,
|
dataLoader: loadThDrawDatas,
|
||||||
});
|
});
|
||||||
const app = thDrawApp;
|
const app = thDrawApp;
|
||||||
|
const getThTypeConsts = getCategoryConsts(CategoryType.TH);
|
||||||
initCommonDrawApp(app);
|
initCommonDrawApp(app);
|
||||||
|
new SignalDraw(
|
||||||
|
app,
|
||||||
|
new SignalTemplate(
|
||||||
|
new SignalData(),
|
||||||
|
new SignalState(),
|
||||||
|
getThTypeConsts(Signal.Type)
|
||||||
|
)
|
||||||
|
);
|
||||||
new TrackSectionDraw(app, new TrackSectionTemplate(new TrackSectionData()));
|
new TrackSectionDraw(app, new TrackSectionTemplate(new TrackSectionData()));
|
||||||
new TrackLogicSectionDraw(
|
new TrackLogicSectionDraw(
|
||||||
app,
|
app,
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
} from 'src/jl-graphic';
|
} from 'src/jl-graphic';
|
||||||
import { Lamp } from './Lamp';
|
import { Lamp } from './Lamp';
|
||||||
import { ISignalState, SignalColorEnum, signalConsts } from './Signal';
|
import { ISignalState, SignalColorEnum, signalConsts } from './Signal';
|
||||||
|
import { state } from 'src/protos/device_state';
|
||||||
|
|
||||||
// export enum LampEnum {
|
// export enum LampEnum {
|
||||||
// lampPostColor = '0xFFFFFF',
|
// lampPostColor = '0xFFFFFF',
|
||||||
@ -108,6 +109,29 @@ export class LampMainBody extends JlGraphic {
|
|||||||
}
|
}
|
||||||
chagneState(states: ISignalState) {
|
chagneState(states: ISignalState) {
|
||||||
this.stopAnmiation();
|
this.stopAnmiation();
|
||||||
|
if (states.aspect === state.Signal.Aspect.H) {
|
||||||
|
this.lamps[0].createLamp(SignalColorEnum.redLamp);
|
||||||
|
if (this.lamps[1]) {
|
||||||
|
this.lamps[1].createLamp(SignalColorEnum.closeLamp);
|
||||||
|
}
|
||||||
|
} else if (states.aspect === state.Signal.Aspect.L) {
|
||||||
|
this.lamps[0].createLamp(SignalColorEnum.greenLamp);
|
||||||
|
if (this.lamps[1]) {
|
||||||
|
this.lamps[1].createLamp(SignalColorEnum.closeLamp);
|
||||||
|
}
|
||||||
|
} else if (states.aspect === state.Signal.Aspect.U) {
|
||||||
|
this.lamps[0].createLamp(SignalColorEnum.yellowLamp);
|
||||||
|
if (this.lamps[1]) {
|
||||||
|
this.lamps[1].createLamp(SignalColorEnum.closeLamp);
|
||||||
|
}
|
||||||
|
} else if (states.aspect === state.Signal.Aspect.HU) {
|
||||||
|
this.lamps[0].createLamp(SignalColorEnum.redLamp);
|
||||||
|
if (this.lamps[1]) {
|
||||||
|
this.lamps[1].createLamp(SignalColorEnum.yellowLamp);
|
||||||
|
}
|
||||||
|
} else if (states.aspect === state.Signal.Aspect.OFF) {
|
||||||
|
this.lamps.forEach((lamp) => lamp.createLamp(SignalColorEnum.closeLamp));
|
||||||
|
}
|
||||||
// if (states.extinguish) {
|
// if (states.extinguish) {
|
||||||
// this.lamps.forEach((lamp) => lamp.createLogicMode());
|
// this.lamps.forEach((lamp) => lamp.createLogicMode());
|
||||||
// } else {
|
// } else {
|
||||||
|
@ -53,52 +53,8 @@ export interface ISignalData extends GraphicData {
|
|||||||
|
|
||||||
export interface ISignalState extends GraphicState {
|
export interface ISignalState extends GraphicState {
|
||||||
id?: string;
|
id?: string;
|
||||||
// get redOpen(): boolean;
|
get aspect(): number;
|
||||||
// set redOpen(v: boolean);
|
set aspect(v: number);
|
||||||
// get redFlash(): boolean;
|
|
||||||
// set redFlash(v: boolean);
|
|
||||||
// get greenOpen(): boolean;
|
|
||||||
// set greenOpen(v: boolean);
|
|
||||||
// get greenFlash(): boolean;
|
|
||||||
// set greenFlash(v: boolean);
|
|
||||||
// get yellowOpen(): boolean;
|
|
||||||
// set yellowOpen(v: boolean);
|
|
||||||
// get yellowFlash(): boolean;
|
|
||||||
// set yellowFlash(v: boolean);
|
|
||||||
// get whiteOpen(): boolean;
|
|
||||||
// set whiteOpen(v: boolean);
|
|
||||||
// get whiteFlash(): boolean;
|
|
||||||
// set whiteFlash(v: boolean);
|
|
||||||
// get blueOpen(): boolean;
|
|
||||||
// set blueOpen(v: boolean);
|
|
||||||
// get blueFlash(): boolean;
|
|
||||||
// set blueFlash(v: boolean);
|
|
||||||
// get fleetMode(): boolean;
|
|
||||||
// set fleetMode(v: boolean);
|
|
||||||
// get ctrlFleetMode(): boolean;
|
|
||||||
// set ctrlFleetMode(v: boolean);
|
|
||||||
// get autoMode(): boolean;
|
|
||||||
// set autoMode(v: boolean);
|
|
||||||
// get ctrlAutoMode(): boolean;
|
|
||||||
// set ctrlAutoMode(v: boolean);
|
|
||||||
// get extinguish(): boolean;
|
|
||||||
// set extinguish(v: boolean);
|
|
||||||
// get approachLock(): boolean;
|
|
||||||
// set approachLock(v: boolean);
|
|
||||||
// get protectRoute(): boolean;
|
|
||||||
// set protectRoute(v: boolean);
|
|
||||||
// get autoRouteDisable(): boolean;
|
|
||||||
// set autoRouteDisable(v: boolean);
|
|
||||||
// get callon(): boolean;
|
|
||||||
// set callon(v: boolean);
|
|
||||||
// get yellowYellow(): boolean;
|
|
||||||
// set yellowYellow(v: boolean);
|
|
||||||
// get yellowGreen(): boolean;
|
|
||||||
// set yellowGreen(v: boolean);
|
|
||||||
// get blocked(): boolean;
|
|
||||||
// set blocked(v: boolean);
|
|
||||||
// get lampFailure(): boolean;
|
|
||||||
// set lampFailure(v: boolean);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SignalColorEnum {
|
export enum SignalColorEnum {
|
||||||
@ -112,6 +68,7 @@ export enum SignalColorEnum {
|
|||||||
yellowLamp = '0XFFFF00',
|
yellowLamp = '0XFFFF00',
|
||||||
whiteLamp = '0XFFFFFF',
|
whiteLamp = '0XFFFFFF',
|
||||||
blueLamp = '0X0033FF',
|
blueLamp = '0X0033FF',
|
||||||
|
closeLamp = '0X000000',
|
||||||
logicModeColor = '0x000000',
|
logicModeColor = '0x000000',
|
||||||
lampLineColor = '0x3149c3',
|
lampLineColor = '0x3149c3',
|
||||||
}
|
}
|
||||||
@ -140,13 +97,15 @@ export class Signal extends JlGraphic {
|
|||||||
fleetMode: Graphics = new Graphics();
|
fleetMode: Graphics = new Graphics();
|
||||||
lampMainBody: LampMainBody = new LampMainBody();
|
lampMainBody: LampMainBody = new LampMainBody();
|
||||||
blockedMode: Graphics = new Graphics();
|
blockedMode: Graphics = new Graphics();
|
||||||
|
gategoryConsts: { [propname: string]: any };
|
||||||
|
|
||||||
constructor() {
|
constructor(gategoryConsts: { [propname: string]: any }) {
|
||||||
super(Signal.Type);
|
super(Signal.Type);
|
||||||
this.addChild(this.humanControl);
|
this.addChild(this.humanControl);
|
||||||
this.addChild(this.fleetMode);
|
this.addChild(this.fleetMode);
|
||||||
this.addChild(this.lampMainBody);
|
this.addChild(this.lampMainBody);
|
||||||
this.addChild(this.signalCode);
|
this.addChild(this.signalCode);
|
||||||
|
this.gategoryConsts = gategoryConsts;
|
||||||
}
|
}
|
||||||
|
|
||||||
get datas(): ISignalData {
|
get datas(): ISignalData {
|
||||||
@ -170,7 +129,7 @@ export class Signal extends JlGraphic {
|
|||||||
|
|
||||||
paint(): void {
|
paint(): void {
|
||||||
const mirror = this.datas.mirror;
|
const mirror = this.datas.mirror;
|
||||||
this.lampMainBody.paint(signalConsts.lampNum, mirror, this.states);
|
this.lampMainBody.paint(this.gategoryConsts.lampNum, mirror, this.states);
|
||||||
this.signalCode.paint(this.datas, this.states);
|
this.signalCode.paint(this.datas, this.states);
|
||||||
const codeTransform = this.datas?.childTransforms?.find(
|
const codeTransform = this.datas?.childTransforms?.find(
|
||||||
(item) => item.name === 'signalCode'
|
(item) => item.name === 'signalCode'
|
||||||
@ -326,11 +285,17 @@ export class Signal extends JlGraphic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class SignalTemplate extends JlGraphicTemplate<Signal> {
|
export class SignalTemplate extends JlGraphicTemplate<Signal> {
|
||||||
constructor(dataTemplate: ISignalData, stateTemplate: ISignalState) {
|
gategoryConsts: { [propname: string]: any };
|
||||||
|
constructor(
|
||||||
|
dataTemplate: ISignalData,
|
||||||
|
stateTemplate: ISignalState,
|
||||||
|
gategoryConsts: { [propname: string]: any }
|
||||||
|
) {
|
||||||
super(Signal.Type, { dataTemplate, stateTemplate });
|
super(Signal.Type, { dataTemplate, stateTemplate });
|
||||||
|
this.gategoryConsts = gategoryConsts;
|
||||||
}
|
}
|
||||||
new(): Signal {
|
new(): Signal {
|
||||||
const g = new Signal();
|
const g = new Signal(this.gategoryConsts);
|
||||||
g.loadData(this.datas);
|
g.loadData(this.datas);
|
||||||
g.loadState(this.states);
|
g.loadState(this.states);
|
||||||
return g;
|
return g;
|
||||||
|
@ -377,16 +377,16 @@ export namespace state {
|
|||||||
#one_of_decls: number[][] = [];
|
#one_of_decls: number[][] = [];
|
||||||
constructor(data?: any[] | {
|
constructor(data?: any[] | {
|
||||||
id?: string;
|
id?: string;
|
||||||
light?: Signal.Light[];
|
aspect?: Signal.Aspect;
|
||||||
}) {
|
}) {
|
||||||
super();
|
super();
|
||||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
|
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||||
if (!Array.isArray(data) && typeof data == "object") {
|
if (!Array.isArray(data) && typeof data == "object") {
|
||||||
if ("id" in data && data.id != undefined) {
|
if ("id" in data && data.id != undefined) {
|
||||||
this.id = data.id;
|
this.id = data.id;
|
||||||
}
|
}
|
||||||
if ("light" in data && data.light != undefined) {
|
if ("aspect" in data && data.aspect != undefined) {
|
||||||
this.light = data.light;
|
this.aspect = data.aspect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -396,35 +396,35 @@ export namespace state {
|
|||||||
set id(value: string) {
|
set id(value: string) {
|
||||||
pb_1.Message.setField(this, 1, value);
|
pb_1.Message.setField(this, 1, value);
|
||||||
}
|
}
|
||||||
get light() {
|
get aspect() {
|
||||||
return pb_1.Message.getRepeatedWrapperField(this, Signal.Light, 2) as Signal.Light[];
|
return pb_1.Message.getFieldWithDefault(this, 2, Signal.Aspect.OFF) as Signal.Aspect;
|
||||||
}
|
}
|
||||||
set light(value: Signal.Light[]) {
|
set aspect(value: Signal.Aspect) {
|
||||||
pb_1.Message.setRepeatedWrapperField(this, 2, value);
|
pb_1.Message.setField(this, 2, value);
|
||||||
}
|
}
|
||||||
static fromObject(data: {
|
static fromObject(data: {
|
||||||
id?: string;
|
id?: string;
|
||||||
light?: ReturnType<typeof Signal.Light.prototype.toObject>[];
|
aspect?: Signal.Aspect;
|
||||||
}): SignalState {
|
}): SignalState {
|
||||||
const message = new SignalState({});
|
const message = new SignalState({});
|
||||||
if (data.id != null) {
|
if (data.id != null) {
|
||||||
message.id = data.id;
|
message.id = data.id;
|
||||||
}
|
}
|
||||||
if (data.light != null) {
|
if (data.aspect != null) {
|
||||||
message.light = data.light.map(item => Signal.Light.fromObject(item));
|
message.aspect = data.aspect;
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
toObject() {
|
toObject() {
|
||||||
const data: {
|
const data: {
|
||||||
id?: string;
|
id?: string;
|
||||||
light?: ReturnType<typeof Signal.Light.prototype.toObject>[];
|
aspect?: Signal.Aspect;
|
||||||
} = {};
|
} = {};
|
||||||
if (this.id != null) {
|
if (this.id != null) {
|
||||||
data.id = this.id;
|
data.id = this.id;
|
||||||
}
|
}
|
||||||
if (this.light != null) {
|
if (this.aspect != null) {
|
||||||
data.light = this.light.map((item: Signal.Light) => item.toObject());
|
data.aspect = this.aspect;
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -434,8 +434,8 @@ export namespace state {
|
|||||||
const writer = w || new pb_1.BinaryWriter();
|
const writer = w || new pb_1.BinaryWriter();
|
||||||
if (this.id.length)
|
if (this.id.length)
|
||||||
writer.writeString(1, this.id);
|
writer.writeString(1, this.id);
|
||||||
if (this.light.length)
|
if (this.aspect != Signal.Aspect.OFF)
|
||||||
writer.writeRepeatedMessage(2, this.light, (item: Signal.Light) => item.serialize(writer));
|
writer.writeEnum(2, this.aspect);
|
||||||
if (!w)
|
if (!w)
|
||||||
return writer.getResultBuffer();
|
return writer.getResultBuffer();
|
||||||
}
|
}
|
||||||
@ -449,7 +449,7 @@ export namespace state {
|
|||||||
message.id = reader.readString();
|
message.id = reader.readString();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
reader.readMessage(message.light, () => pb_1.Message.addToRepeatedWrapperField(message, 2, Signal.Light.deserialize(reader), Signal.Light));
|
message.aspect = reader.readEnum();
|
||||||
break;
|
break;
|
||||||
default: reader.skipField();
|
default: reader.skipField();
|
||||||
}
|
}
|
||||||
@ -506,103 +506,12 @@ export namespace state {
|
|||||||
export namespace Signal {
|
export namespace Signal {
|
||||||
export enum Aspect {
|
export enum Aspect {
|
||||||
OFF = 0,
|
OFF = 0,
|
||||||
ON = 1,
|
L = 1,
|
||||||
L = 2,
|
H = 2,
|
||||||
H = 3,
|
U = 3,
|
||||||
U = 4,
|
HU = 4,
|
||||||
HU = 5,
|
B = 5,
|
||||||
B = 6,
|
A = 6
|
||||||
A = 7
|
|
||||||
}
|
|
||||||
export class Light extends pb_1.Message {
|
|
||||||
#one_of_decls: number[][] = [];
|
|
||||||
constructor(data?: any[] | {
|
|
||||||
color?: Signal.Aspect;
|
|
||||||
display?: boolean;
|
|
||||||
}) {
|
|
||||||
super();
|
|
||||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
|
||||||
if (!Array.isArray(data) && typeof data == "object") {
|
|
||||||
if ("color" in data && data.color != undefined) {
|
|
||||||
this.color = data.color;
|
|
||||||
}
|
|
||||||
if ("display" in data && data.display != undefined) {
|
|
||||||
this.display = data.display;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
get color() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 1, Signal.Aspect.OFF) as Signal.Aspect;
|
|
||||||
}
|
|
||||||
set color(value: Signal.Aspect) {
|
|
||||||
pb_1.Message.setField(this, 1, value);
|
|
||||||
}
|
|
||||||
get display() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 2, false) as boolean;
|
|
||||||
}
|
|
||||||
set display(value: boolean) {
|
|
||||||
pb_1.Message.setField(this, 2, value);
|
|
||||||
}
|
|
||||||
static fromObject(data: {
|
|
||||||
color?: Signal.Aspect;
|
|
||||||
display?: boolean;
|
|
||||||
}): Light {
|
|
||||||
const message = new Light({});
|
|
||||||
if (data.color != null) {
|
|
||||||
message.color = data.color;
|
|
||||||
}
|
|
||||||
if (data.display != null) {
|
|
||||||
message.display = data.display;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
toObject() {
|
|
||||||
const data: {
|
|
||||||
color?: Signal.Aspect;
|
|
||||||
display?: boolean;
|
|
||||||
} = {};
|
|
||||||
if (this.color != null) {
|
|
||||||
data.color = this.color;
|
|
||||||
}
|
|
||||||
if (this.display != null) {
|
|
||||||
data.display = this.display;
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
serialize(): Uint8Array;
|
|
||||||
serialize(w: pb_1.BinaryWriter): void;
|
|
||||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
|
||||||
const writer = w || new pb_1.BinaryWriter();
|
|
||||||
if (this.color != Signal.Aspect.OFF)
|
|
||||||
writer.writeEnum(1, this.color);
|
|
||||||
if (this.display != false)
|
|
||||||
writer.writeBool(2, this.display);
|
|
||||||
if (!w)
|
|
||||||
return writer.getResultBuffer();
|
|
||||||
}
|
|
||||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Light {
|
|
||||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Light();
|
|
||||||
while (reader.nextField()) {
|
|
||||||
if (reader.isEndGroup())
|
|
||||||
break;
|
|
||||||
switch (reader.getFieldNumber()) {
|
|
||||||
case 1:
|
|
||||||
message.color = reader.readEnum();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.display = reader.readBool();
|
|
||||||
break;
|
|
||||||
default: reader.skipField();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
serializeBinary(): Uint8Array {
|
|
||||||
return this.serialize();
|
|
||||||
}
|
|
||||||
static deserializeBinary(bytes: Uint8Array): Light {
|
|
||||||
return Light.deserialize(bytes);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export class PlatformState extends pb_1.Message {
|
export class PlatformState extends pb_1.Message {
|
||||||
|
197
src/protos/request.ts
Normal file
197
src/protos/request.ts
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
/**
|
||||||
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
|
* compiler version: 4.23.1
|
||||||
|
* source: request.proto
|
||||||
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
|
import * as pb_1 from "google-protobuf";
|
||||||
|
export namespace request {
|
||||||
|
export class Turnout extends pb_1.Message {
|
||||||
|
#one_of_decls: number[][] = [];
|
||||||
|
constructor(data?: any[] | {}) {
|
||||||
|
super();
|
||||||
|
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||||
|
if (!Array.isArray(data) && typeof data == "object") { }
|
||||||
|
}
|
||||||
|
static fromObject(data: {}): Turnout {
|
||||||
|
const message = new Turnout({});
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
toObject() {
|
||||||
|
const data: {} = {};
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
serialize(): Uint8Array;
|
||||||
|
serialize(w: pb_1.BinaryWriter): void;
|
||||||
|
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||||
|
const writer = w || new pb_1.BinaryWriter();
|
||||||
|
if (!w)
|
||||||
|
return writer.getResultBuffer();
|
||||||
|
}
|
||||||
|
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Turnout {
|
||||||
|
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Turnout();
|
||||||
|
while (reader.nextField()) {
|
||||||
|
if (reader.isEndGroup())
|
||||||
|
break;
|
||||||
|
switch (reader.getFieldNumber()) {
|
||||||
|
default: reader.skipField();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
serializeBinary(): Uint8Array {
|
||||||
|
return this.serialize();
|
||||||
|
}
|
||||||
|
static deserializeBinary(bytes: Uint8Array): Turnout {
|
||||||
|
return Turnout.deserialize(bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export namespace Turnout {
|
||||||
|
export enum Operation {
|
||||||
|
Undefined = 0,
|
||||||
|
DC = 1,
|
||||||
|
CancelDC = 2,
|
||||||
|
FC = 3,
|
||||||
|
CancelFC = 4,
|
||||||
|
SetSB = 5,
|
||||||
|
CancelSB = 6,
|
||||||
|
SetJC = 7,
|
||||||
|
CancelJC = 8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class TurnoutOperationReq extends pb_1.Message {
|
||||||
|
#one_of_decls: number[][] = [];
|
||||||
|
constructor(data?: any[] | {
|
||||||
|
simulationId?: string;
|
||||||
|
mapId?: number;
|
||||||
|
deviceId?: string;
|
||||||
|
operation?: Turnout.Operation;
|
||||||
|
}) {
|
||||||
|
super();
|
||||||
|
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||||
|
if (!Array.isArray(data) && typeof data == "object") {
|
||||||
|
if ("simulationId" in data && data.simulationId != undefined) {
|
||||||
|
this.simulationId = data.simulationId;
|
||||||
|
}
|
||||||
|
if ("mapId" in data && data.mapId != undefined) {
|
||||||
|
this.mapId = data.mapId;
|
||||||
|
}
|
||||||
|
if ("deviceId" in data && data.deviceId != undefined) {
|
||||||
|
this.deviceId = data.deviceId;
|
||||||
|
}
|
||||||
|
if ("operation" in data && data.operation != undefined) {
|
||||||
|
this.operation = data.operation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get simulationId() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||||
|
}
|
||||||
|
set simulationId(value: string) {
|
||||||
|
pb_1.Message.setField(this, 1, value);
|
||||||
|
}
|
||||||
|
get mapId() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
|
||||||
|
}
|
||||||
|
set mapId(value: number) {
|
||||||
|
pb_1.Message.setField(this, 2, value);
|
||||||
|
}
|
||||||
|
get deviceId() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
|
||||||
|
}
|
||||||
|
set deviceId(value: string) {
|
||||||
|
pb_1.Message.setField(this, 3, value);
|
||||||
|
}
|
||||||
|
get operation() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 4, Turnout.Operation.Undefined) as Turnout.Operation;
|
||||||
|
}
|
||||||
|
set operation(value: Turnout.Operation) {
|
||||||
|
pb_1.Message.setField(this, 4, value);
|
||||||
|
}
|
||||||
|
static fromObject(data: {
|
||||||
|
simulationId?: string;
|
||||||
|
mapId?: number;
|
||||||
|
deviceId?: string;
|
||||||
|
operation?: Turnout.Operation;
|
||||||
|
}): TurnoutOperationReq {
|
||||||
|
const message = new TurnoutOperationReq({});
|
||||||
|
if (data.simulationId != null) {
|
||||||
|
message.simulationId = data.simulationId;
|
||||||
|
}
|
||||||
|
if (data.mapId != null) {
|
||||||
|
message.mapId = data.mapId;
|
||||||
|
}
|
||||||
|
if (data.deviceId != null) {
|
||||||
|
message.deviceId = data.deviceId;
|
||||||
|
}
|
||||||
|
if (data.operation != null) {
|
||||||
|
message.operation = data.operation;
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
toObject() {
|
||||||
|
const data: {
|
||||||
|
simulationId?: string;
|
||||||
|
mapId?: number;
|
||||||
|
deviceId?: string;
|
||||||
|
operation?: Turnout.Operation;
|
||||||
|
} = {};
|
||||||
|
if (this.simulationId != null) {
|
||||||
|
data.simulationId = this.simulationId;
|
||||||
|
}
|
||||||
|
if (this.mapId != null) {
|
||||||
|
data.mapId = this.mapId;
|
||||||
|
}
|
||||||
|
if (this.deviceId != null) {
|
||||||
|
data.deviceId = this.deviceId;
|
||||||
|
}
|
||||||
|
if (this.operation != null) {
|
||||||
|
data.operation = this.operation;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
serialize(): Uint8Array;
|
||||||
|
serialize(w: pb_1.BinaryWriter): void;
|
||||||
|
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||||
|
const writer = w || new pb_1.BinaryWriter();
|
||||||
|
if (this.simulationId.length)
|
||||||
|
writer.writeString(1, this.simulationId);
|
||||||
|
if (this.mapId != 0)
|
||||||
|
writer.writeInt32(2, this.mapId);
|
||||||
|
if (this.deviceId.length)
|
||||||
|
writer.writeString(3, this.deviceId);
|
||||||
|
if (this.operation != Turnout.Operation.Undefined)
|
||||||
|
writer.writeEnum(4, this.operation);
|
||||||
|
if (!w)
|
||||||
|
return writer.getResultBuffer();
|
||||||
|
}
|
||||||
|
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TurnoutOperationReq {
|
||||||
|
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TurnoutOperationReq();
|
||||||
|
while (reader.nextField()) {
|
||||||
|
if (reader.isEndGroup())
|
||||||
|
break;
|
||||||
|
switch (reader.getFieldNumber()) {
|
||||||
|
case 1:
|
||||||
|
message.simulationId = reader.readString();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
message.mapId = reader.readInt32();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
message.deviceId = reader.readString();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
message.operation = reader.readEnum();
|
||||||
|
break;
|
||||||
|
default: reader.skipField();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
serializeBinary(): Uint8Array {
|
||||||
|
return this.serialize();
|
||||||
|
}
|
||||||
|
static deserializeBinary(bytes: Uint8Array): TurnoutOperationReq {
|
||||||
|
return TurnoutOperationReq.deserialize(bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user