diff --git a/package.json b/package.json index 02dfac9..7a20af7 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "dev": "quasar dev", "build": "quasar build", "build:local": "URL_ENV=local_test quasar build", + "build:pxf": "URL_ENV=local_pxf quasar build", "build:test": "URL_ENV=test quasar build", "build:publish": "URL_ENV=publish quasar build", "protoc": "node scripts/proto.cjs", diff --git a/public/drawIcon.svg b/public/drawIcon.svg index 5fff84a..0639126 100644 --- a/public/drawIcon.svg +++ b/public/drawIcon.svg @@ -27,15 +27,30 @@ + + + + + - - - + + + + + + + + + + + + + diff --git a/rts-sim-testing-message b/rts-sim-testing-message index 0ed6b1d..fed626a 160000 --- a/rts-sim-testing-message +++ b/rts-sim-testing-message @@ -1 +1 @@ -Subproject commit 0ed6b1d451f617804d608ede072121a0f1e36fb5 +Subproject commit fed626ac4b0d1b2696026438d32fe812ebd00ac2 diff --git a/src/components/draw-app/DrawProperties.vue b/src/components/draw-app/DrawProperties.vue index 7d29d25..b583138 100644 --- a/src/components/draw-app/DrawProperties.vue +++ b/src/components/draw-app/DrawProperties.vue @@ -148,6 +148,12 @@ + + diff --git a/src/components/draw-app/properties/UnattengedButtonProperty.vue b/src/components/draw-app/properties/UnattengedButtonProperty.vue new file mode 100644 index 0000000..f067ae7 --- /dev/null +++ b/src/components/draw-app/properties/UnattengedButtonProperty.vue @@ -0,0 +1,55 @@ + + + diff --git a/src/components/line-app/infos/TrainInfo.vue b/src/components/line-app/infos/TrainInfo.vue index 2f05102..c624ba6 100644 --- a/src/components/line-app/infos/TrainInfo.vue +++ b/src/components/line-app/infos/TrainInfo.vue @@ -455,13 +455,17 @@ function trainLengthFormat(v: number) { function connStateFormat(v: boolean) { return v ? '已连接' : '未连接'; } +// PC_SIM_A = 3; //PC仿真 +// PC_SIM_B = 4; //PC仿真 function connTypeFormat(v: state.TrainConnState.TrainConnType) { if (v === state.TrainConnState.TrainConnType.NONE) { return '无'; - } else if (v === state.TrainConnState.TrainConnType.PC_SIM) { - return 'PC仿真'; + } else if (v === state.TrainConnState.TrainConnType.PC_SIM_A) { + return 'PC仿真A'; } else if (v === state.TrainConnState.TrainConnType.VOBC) { return '半实物'; + } else if (v === state.TrainConnState.TrainConnType.PC_SIM_B) { + return 'PC仿真B'; } else { return '无'; } diff --git a/src/configs/UrlManage.ts b/src/configs/UrlManage.ts index 19a909f..32b1e1f 100644 --- a/src/configs/UrlManage.ts +++ b/src/configs/UrlManage.ts @@ -5,7 +5,12 @@ function getHost(): string { return 'joylink.club/bjrtsts-server'; } else if (process.env.URL_ENV == 'local_test') { return '192.168.33.233:9091'; + } else if (process.env.URL_ENV == 'local_pxf') { + //北京现场 + + return '172.29.5.168/bjrtss-server'; } + // return '192.168.3.7:9091'; // return '192.168.3.47:9091'; // return '192.168.3.37:9091'; @@ -26,7 +31,7 @@ export function getHttpBase() { export function getWebsocketUrl() { let protocol = 'ws'; - let host = '192.168.33.233'; + let host = '192.168.33.233:9091'; // let host = 'test.joylink.club'; let port = '8083'; let url = `${protocol}://${host}:${port}`; @@ -42,6 +47,8 @@ export function getWebsocketUrl() { url = `${protocol}://${host}`; } else if (process.env.URL_ENV == 'local_test') { host = '192.168.33.233'; + } else if (process.env.URL_ENV == 'local_pxf') { + host = '172.29.5.168'; } return `${url}/mqtt`; diff --git a/src/drawApp/common.ts b/src/drawApp/common.ts index f1d3927..7e40f91 100644 --- a/src/drawApp/common.ts +++ b/src/drawApp/common.ts @@ -24,6 +24,8 @@ import { PslBox } from 'src/graphics/pslBox/PslBox'; import { GarageDoor } from 'src/graphics/garageDoor/GarageDoor'; import { CarWashing } from 'src/graphics/carWashing/CarWashing'; import { FloodGate } from 'src/graphics/floodGate/FloodGate'; +import { HoldButton } from 'src/graphics/holdButton/HoldButton'; +import { UnattengedButton } from 'src/graphics/unattengedButton/UnattengedButton'; export const drawCommonLayerList = [ // 图层列表 默认显示的图层defaultShow: true @@ -61,4 +63,6 @@ export const drawCommonLayerList = [ { label: '车库门', value: GarageDoor.Type, defaultShow: true }, { label: '洗车机', value: CarWashing.Type, defaultShow: true }, { label: '防淹门', value: FloodGate.Type, defaultShow: true }, + { label: '扣车按钮', value: HoldButton.Type, defaultShow: true }, + { label: '无人折返按钮', value: UnattengedButton.Type, defaultShow: true }, ]; diff --git a/src/drawApp/commonApp.ts b/src/drawApp/commonApp.ts index 87df5f6..67f0494 100644 --- a/src/drawApp/commonApp.ts +++ b/src/drawApp/commonApp.ts @@ -91,6 +91,10 @@ import { SpksSwitchData, DrawSpksSwitchInteraction, } from './graphics/SpksSwitchInteraction'; +import { HoldButton, HoldButtonTemplate } from 'src/graphics/holdButton/HoldButton'; +import { DrawHoldButtonInteraction, HoldButtonData } from './graphics/HoldButtonInteraction'; +import { UnattengedButton, UnattengedButtonTemplate } from 'src/graphics/unattengedButton/UnattengedButton'; +import { UnattengedButtonData, DrawUnattengedButtonInteraction } from './graphics/UnattengedButtonInteraction'; import { GatedBox, GatedBoxTemplate } from 'src/graphics/gatedBox/GatedBox'; import { GatedBoxData, @@ -103,6 +107,8 @@ import { // EsbButtonState, // } from './graphics/EsbButtonInteraction'; import { SpksSwitchDraw } from 'src/graphics/spksSwitch/SpksSwitchDrawAssistant'; +import { HoldButtonDraw } from 'src/graphics/holdButton/HoldButtonDrawAssistant'; +import { UnattengedButtonDraw } from 'src/graphics/unattengedButton/UnattengedButtonDrawAssistant'; import { GatedBoxDraw } from 'src/graphics/gatedBox/GatedBoxDrawAssistant'; // import { EsbButtonDraw } from 'src/graphics/esbButton/EsbButtonDrawAssistant'; import { TransponderDraw } from 'src/graphics/transponder/TransponderDrawAssistant'; @@ -228,6 +234,8 @@ export function initCommonDrawApp(app: IDrawApp) { ); new StopPositionDraw(app, new StopPositionTemplate(new StopPositionData())); new SpksSwitchDraw(app, new SpksSwitchTemplate(new SpksSwitchData())); + new HoldButtonDraw(app, new HoldButtonTemplate(new HoldButtonData())); + new UnattengedButtonDraw(app, new UnattengedButtonTemplate(new UnattengedButtonData())); new GatedBoxDraw(app, new GatedBoxTemplate(new GatedBoxData())); // new EsbButtonDraw( // app, @@ -264,6 +272,8 @@ export function initCommonDrawApp(app: IDrawApp) { DrawSignalInteraction.init(app); DrawStopPositionInteraction.init(app); DrawSpksSwitchInteraction.init(app); + DrawHoldButtonInteraction.init(app); + DrawUnattengedButtonInteraction.init(app); DrawGatedBoxInteraction.init(app); // DrawEsbButtonInteraction.init(app); @@ -293,6 +303,7 @@ export function initCommonDrawApp(app: IDrawApp) { UniqueIdPrefix = new graphicData.UniqueIdOfStationLayout(); screenDoorConfig = new graphicData.ScreenDoorConfig(); generateAxleCountingConfig = new graphicData.GenerateAxleCountingConfig(); + lianSuoData = new graphicData.LianSuoData(); kilometerConvertList = []; sectionCodePointList = []; otherLineList = []; @@ -351,10 +362,10 @@ export function initCommonDrawApp(app: IDrawApp) { prev.localToCanvasPoint(prev.getStartPoint()), mousePos ) > - distance2( - cur.localToCanvasPoint(cur.getStartPoint()), - mousePos - )) + distance2( + cur.localToCanvasPoint(cur.getStartPoint()), + mousePos + )) ? cur : prev; }); @@ -400,6 +411,9 @@ export function loadCommonDrawDatas( UniqueIdPrefix = storage.UniqueIdPrefix; screenDoorConfig = storage.screenDoorConfig; generateAxleCountingConfig = storage.generateAxleCountingConfig; + if (storage.lianSuoData) { + lianSuoData = storage.lianSuoData; + } kilometerConvertList = storage.kilometerConvertList; sectionCodePointList = storage.sectionCodePointList; otherLineList = storage.otherLineList; @@ -443,6 +457,12 @@ export function loadCommonDrawDatas( storage.spksSwitchs.forEach((spksSwitch) => { datas.push(new SpksSwitchData(spksSwitch)); }); + storage.holdButtons.forEach((holdButton) => { + datas.push(new HoldButtonData(holdButton)); + }) + storage.unattengedButtons.forEach((unattengedButton) => { + datas.push(new UnattengedButtonData(unattengedButton)); + }) storage.gateBoxs.forEach((gatedBox) => { datas.push(new GatedBoxData(gatedBox)); }); @@ -532,6 +552,14 @@ export function saveCommonDrawDatas(app: IDrawApp) { } else if (SpksSwitch.Type === g.type) { const spksSwitchData = (g as SpksSwitch).saveData(); storage.spksSwitchs.push((spksSwitchData as SpksSwitchData).data); + } else if (HoldButton.Type === g.type) { + const holdButtonData = (g as HoldButton).saveData(); + storage.holdButtons.push((holdButtonData as HoldButtonData).data); + } else if (UnattengedButton.Type === g.type) { + const unattengedButtonData = (g as UnattengedButton).saveData(); + storage.unattengedButtons.push( + (unattengedButtonData as UnattengedButtonData).data + ); } else if (GatedBox.Type === g.type) { const gatedBoxData = (g as GatedBox).saveData(); storage.gateBoxs.push((gatedBoxData as GatedBoxData).data); @@ -692,6 +720,7 @@ export function saveCommonDrawDatas(app: IDrawApp) { storage.sectionCodePointList = sectionCodePointList; storage.otherLineList = otherLineList; storage.stationRelateDeviceList = refDevicesList; + storage.lianSuoData = lianSuoData; // if (storage.generateAxleCountingConfig?.bbConnect) { // storage.generateAxleCountingConfig.newbbConnect = // storage.generateAxleCountingConfig.bbConnect.map((item) => +item); @@ -845,6 +874,15 @@ export function setGenerateAxleCountingConfig( generateAxleCountingConfig = newScreenDoorConfig; } +let lianSuoData = new graphicData.LianSuoData(); +export function loadLianSuoData() { + return lianSuoData; +} + +export function setLianSuoData(newLianSuoData: graphicData.LianSuoData) { + lianSuoData = newLianSuoData; +} + // 其他线路数据 let otherLineList: graphicData.OtherLine[] = []; export function loadOtherLineList() { diff --git a/src/drawApp/graphics/HoldButtonInteraction.ts b/src/drawApp/graphics/HoldButtonInteraction.ts new file mode 100644 index 0000000..a122ec9 --- /dev/null +++ b/src/drawApp/graphics/HoldButtonInteraction.ts @@ -0,0 +1,107 @@ +import * as pb_1 from 'google-protobuf'; +import { DisplayObject, FederatedMouseEvent } from 'pixi.js'; +import { IHoldButtonData, HoldButton } from 'src/graphics/holdButton/HoldButton'; +import { + IGraphicApp, + GraphicInteractionPlugin, + JlGraphic, + IGraphicScene, + MenuItemOptions, + ContextMenu, +} from 'jl-graphic'; + +import { graphicData } from 'src/protos/stationLayoutGraphics'; +import { GraphicDataBase } from './GraphicDataBase'; +import { useIbpStore } from 'src/stores/ibp-store'; +import { Station } from 'src/graphics/station/Station'; +import { Platform } from 'src/graphics/platform/Platform'; + +export class HoldButtonData extends GraphicDataBase implements IHoldButtonData { + constructor(data?: graphicData.HoldButton) { + let holdButton; + if (!data) { + holdButton = new graphicData.HoldButton({ + common: GraphicDataBase.defaultCommonInfo(HoldButton.Type), + }); + } else { + holdButton = data; + } + super(holdButton); + } + + public get data(): graphicData.HoldButton { + return this.getData(); + } + get code(): string { + return this.data.code; + } + set code(v: string) { + this.data.code = v; + } + get flip(): boolean { + return this.data.flip; + } + set flip(v: boolean) { + this.data.flip = v; + } + get refStand(): number { + return this.data.refStand; + } + set refStand(v: number) { + this.data.refStand = v; + } + clone(): HoldButtonData { + return new HoldButtonData(this.data.cloneMessage()); + } + copyFrom(data: HoldButtonData): void { + pb_1.Message.copyInto(data.data, this.data); + } + eq(other: HoldButtonData): boolean { + return pb_1.Message.equals(this.data, other.data); + } +} + +const flipConfig: MenuItemOptions = { + name: '上下翻转', +}; +const HoldButtonEditMenu: ContextMenu = ContextMenu.init({ + name: '扣车按钮编辑菜单', + groups: [ + { + items: [flipConfig], + }, + ], +}); +export class DrawHoldButtonInteraction extends GraphicInteractionPlugin { + static Name = 'hold_button_draw_right_menu'; + constructor(app: IGraphicApp) { + super(DrawHoldButtonInteraction.Name, app); + app.registerMenu(HoldButtonEditMenu); + } + static init(app: IGraphicApp) { + return new DrawHoldButtonInteraction(app); + } + filter(...grahpics: JlGraphic[]): HoldButton[] | undefined { + return grahpics + .filter((g) => g.type === HoldButton.Type) + .map((g) => g as HoldButton); + } + bind(g: HoldButton): void { + g.on('_rightclick', this.onContextMenu, this); + } + + unbind(g: HoldButton): void { + g.off('_rightclick', this.onContextMenu, this); + } + + onContextMenu(e: FederatedMouseEvent) { + const target = e.target as DisplayObject; + const holdButton = target.getGraphic() as HoldButton; + this.app.updateSelected(holdButton); + flipConfig.handler = () => { + holdButton.datas.flip = !holdButton.datas.flip; + holdButton.repaint(); + }; + HoldButtonEditMenu.open(e.global); + } +} diff --git a/src/drawApp/graphics/SpksSwitchInteraction.ts b/src/drawApp/graphics/SpksSwitchInteraction.ts index b7d31b6..fc9ccb9 100644 --- a/src/drawApp/graphics/SpksSwitchInteraction.ts +++ b/src/drawApp/graphics/SpksSwitchInteraction.ts @@ -53,12 +53,12 @@ export class SpksSwitchData extends GraphicDataBase implements ISpksSwitchData { set refStand(v: number) { this.data.refStand = v; } - get refSections(): number[] { - return this.data.refSections; - } - set refSections(v: number[]) { - this.data.refSections = v; - } + // get refSections(): number[] { + // return this.data.refSections; + // } + // set refSections(v: number[]) { + // this.data.refSections = v; + // } clone(): SpksSwitchData { return new SpksSwitchData(this.data.cloneMessage()); } @@ -114,36 +114,3 @@ export class DrawSpksSwitchInteraction extends GraphicInteractionPlugin { - static Name = 'spks_switch_operation'; - constructor(app: IGraphicScene) { - super(SpksSwitchOperationInteraction.Name, app); - } - static init(app: IGraphicScene) { - return new SpksSwitchOperationInteraction(app); - } - filter(...grahpics: JlGraphic[]): SpksSwitch[] | undefined { - return grahpics.filter((g): g is SpksSwitch => g instanceof SpksSwitch); - } - bind(g: SpksSwitch): void { - g.eventMode = 'static'; - g.cursor = 'pointer'; - g.on('_leftclick', this.onLeftClick, this); - } - unbind(g: SpksSwitch): void { - g.off('_leftclick', this.onLeftClick, this); - } - onLeftClick(e: FederatedMouseEvent) { - const target = e.target as DisplayObject; - const spksSwitch = target.getGraphic() as SpksSwitch; - const stand = this.app.queryStore.queryById( - spksSwitch.datas.refStand - ); - const station = this.app.queryStore.queryById( - stand.datas.refStation - ); - - useIbpStore().openIbpScene(station); - } -} diff --git a/src/drawApp/graphics/UnattengedButtonInteraction.ts b/src/drawApp/graphics/UnattengedButtonInteraction.ts new file mode 100644 index 0000000..aec3eb8 --- /dev/null +++ b/src/drawApp/graphics/UnattengedButtonInteraction.ts @@ -0,0 +1,107 @@ +import * as pb_1 from 'google-protobuf'; +import { DisplayObject, FederatedMouseEvent } from 'pixi.js'; +import { IUnattengedButtonData, UnattengedButton } from 'src/graphics/unattengedButton/UnattengedButton'; +import { + IGraphicApp, + GraphicInteractionPlugin, + JlGraphic, + IGraphicScene, + MenuItemOptions, + ContextMenu, +} from 'jl-graphic'; + +import { graphicData } from 'src/protos/stationLayoutGraphics'; +import { GraphicDataBase } from './GraphicDataBase'; +import { useIbpStore } from 'src/stores/ibp-store'; +import { Station } from 'src/graphics/station/Station'; +import { Platform } from 'src/graphics/platform/Platform'; + +export class UnattengedButtonData extends GraphicDataBase implements IUnattengedButtonData { + constructor(data?: graphicData.UnattengedButton) { + let unattengedButton; + if (!data) { + unattengedButton = new graphicData.UnattengedButton({ + common: GraphicDataBase.defaultCommonInfo(UnattengedButton.Type), + }); + } else { + unattengedButton = data; + } + super(unattengedButton); + } + + public get data(): graphicData.UnattengedButton { + return this.getData(); + } + get code(): string { + return this.data.code; + } + set code(v: string) { + this.data.code = v; + } + get flip(): boolean { + return this.data.flip; + } + set flip(v: boolean) { + this.data.flip = v; + } + get refStand(): number { + return this.data.refStand; + } + set refStand(v: number) { + this.data.refStand = v; + } + clone(): UnattengedButtonData { + return new UnattengedButtonData(this.data.cloneMessage()); + } + copyFrom(data: UnattengedButtonData): void { + pb_1.Message.copyInto(data.data, this.data); + } + eq(other: UnattengedButtonData): boolean { + return pb_1.Message.equals(this.data, other.data); + } +} + +const flipConfig: MenuItemOptions = { + name: '上下翻转', +}; +const UnattengedButtonEditMenu: ContextMenu = ContextMenu.init({ + name: '无人折返按钮编辑菜单', + groups: [ + { + items: [flipConfig], + }, + ], +}); +export class DrawUnattengedButtonInteraction extends GraphicInteractionPlugin { + static Name = 'unattenged_button_draw_right_menu'; + constructor(app: IGraphicApp) { + super(DrawUnattengedButtonInteraction.Name, app); + app.registerMenu(UnattengedButtonEditMenu); + } + static init(app: IGraphicApp) { + return new DrawUnattengedButtonInteraction(app); + } + filter(...grahpics: JlGraphic[]): UnattengedButton[] | undefined { + return grahpics + .filter((g) => g.type === UnattengedButton.Type) + .map((g) => g as UnattengedButton); + } + bind(g: UnattengedButton): void { + g.on('_rightclick', this.onContextMenu, this); + } + + unbind(g: UnattengedButton): void { + g.off('_rightclick', this.onContextMenu, this); + } + + onContextMenu(e: FederatedMouseEvent) { + const target = e.target as DisplayObject; + const unattengedButton = target.getGraphic() as UnattengedButton; + this.app.updateSelected(unattengedButton); + flipConfig.handler = () => { + unattengedButton.datas.flip = !unattengedButton.datas.flip; + unattengedButton.repaint(); + }; + UnattengedButtonEditMenu.open(e.global); + } +} diff --git a/src/drawApp/lineScene.ts b/src/drawApp/lineScene.ts index d94d2c9..91d4832 100644 --- a/src/drawApp/lineScene.ts +++ b/src/drawApp/lineScene.ts @@ -122,7 +122,6 @@ import { EsbButton, EsbButtonTemplate } from 'src/graphics/esbButton/EsbButton'; import { StopPositionData } from './graphics/StopPositionInteraction'; import { SpksSwitchData, - SpksSwitchOperationInteraction, } from './graphics/SpksSwitchInteraction'; import { GatedBoxData } from './graphics/GatedBoxInteraction'; import { @@ -195,6 +194,8 @@ import { FloodGateOperationInteraction, FloodGateState, } from './graphics/FloodGateInteraction'; +import { HoldButton } from 'src/graphics/holdButton/HoldButton'; +import { UnattengedButton } from 'src/graphics/unattengedButton/UnattengedButton'; const showOptions: MenuItemOptions = { name: '显示控制', @@ -260,6 +261,8 @@ export const layerList = [ { label: '车库门', value: GarageDoor.Type, defaultShow: true }, { label: '洗车机', value: CarWashing.Type, defaultShow: true }, { label: '防淹门', value: FloodGate.Type, defaultShow: true }, + { label: '扣车按钮', value: HoldButton.Type, defaultShow: true }, + { label: '无人折返按钮', value: UnattengedButton.Type, defaultShow: true }, ]; let lineScene: IGraphicScene; @@ -343,7 +346,6 @@ export function initLineScene(lineApp: IGraphicApp, sceneName: string) { TurnoutOperationPlugin.init(lineScene); TransponderOperationPlugin.init(lineScene); EsbButtonOperationInteraction.init(lineScene); - SpksSwitchOperationInteraction.init(lineScene); AutoReturnBoxOperationInteraction.init(lineScene); PslBoxOperateInteraction.init(lineScene); IbpBoxOperateInteraction.init(lineScene); diff --git a/src/graphics/esbButton/EsbButton.ts b/src/graphics/esbButton/EsbButton.ts index f5071cd..3a38ef3 100644 --- a/src/graphics/esbButton/EsbButton.ts +++ b/src/graphics/esbButton/EsbButton.ts @@ -42,7 +42,7 @@ const esbButtonConsts = { export class EsbButton extends JlGraphic { static Type = 'esbButton'; codeGraph: VectorText = new VectorText(''); - circleBody: Graphics = new Graphics(); + textGraph: VectorText = new VectorText('E'); rectBody: Graphics = new Graphics(); lineBody: Graphics = new Graphics(); @@ -51,7 +51,7 @@ export class EsbButton extends JlGraphic { this.addChild(this.codeGraph); this.addChild(this.rectBody); this.addChild(this.lineBody); - this.addChild(this.circleBody); + this.addChild(this.textGraph); this.codeGraph.name = 'esb_code'; } get code(): string { @@ -80,15 +80,9 @@ export class EsbButton extends JlGraphic { } else { codeGraph.position.set(-30, 0); } - this.circleBody.clear(); - this.circleBody.beginFill( - this.state.down - ? esbButtonConsts.pressedColor - : esbButtonConsts.bodyCircleColor, - 1 - ); - this.circleBody.drawCircle(0, 0, esbButtonConsts.bodyCircleRadius); - this.circleBody.endFill(); + this.textGraph.style.fill = esbButtonConsts.codeColor; + this.textGraph.setVectorFontSize(esbButtonConsts.codeFontSize); + this.textGraph.anchor.set(0.5); this.rectBody.clear(); this.rectBody.beginFill(esbButtonConsts.bodyColor, 0); this.rectBody.lineStyle( diff --git a/src/graphics/holdButton/HoldButton.ts b/src/graphics/holdButton/HoldButton.ts new file mode 100644 index 0000000..8bd371d --- /dev/null +++ b/src/graphics/holdButton/HoldButton.ts @@ -0,0 +1,102 @@ +import { Graphics } from 'pixi.js'; +import { + GraphicData, + JlGraphic, + JlGraphicTemplate, + VectorText, +} from 'jl-graphic'; + +export interface IHoldButtonData extends GraphicData { + get code(): string; + set code(v: string); + get flip(): boolean; + set flip(v: boolean); + get refStand(): number; + set refStand(v: number); +} + +const holdButtonConsts = { + codeFontSize: 12, + codeColor: 0xffffff, + bodyLineColor: 0xffffff, + bodyLineWidth: 4, + bodyRectLineColor: 0xffffff, + bodyRectLineWidth: 2, + bodyRectWidth: 20, + bodyRectHeight: 20, + bodyColor: 0x000000, +}; +export class HoldButton extends JlGraphic { + static Type = 'holdButton'; + codeGraph: VectorText = new VectorText(''); + rectBody: Graphics = new Graphics(); + lineBody: Graphics = new Graphics(); + textGraph: VectorText = new VectorText('H'); + + constructor() { + super(HoldButton.Type); + this.addChild(this.codeGraph); + this.addChild(this.rectBody); + this.addChild(this.lineBody); + this.addChild(this.textGraph); + this.codeGraph.name = 'hold_button_code'; + } + get datas(): IHoldButtonData { + return this.getDatas(); + } + doRepaint(): void { + const codeGraph = this.codeGraph; + codeGraph.text = this.datas.code; + codeGraph.style.fill = holdButtonConsts.codeColor; + codeGraph.setVectorFontSize(holdButtonConsts.codeFontSize); + const codeTransform = this.datas?.childTransforms?.find( + (item) => item.name === 'hold_button_code' + ); + if (codeTransform) { + const position = codeTransform?.transform.position; + const rotation = codeTransform?.transform?.rotation; + codeGraph.position.set(position?.x, position?.y); + codeGraph.rotation = rotation || 0; + } else { + codeGraph.position.set(20, 0); + } + codeGraph.anchor.set(0.5); + this.textGraph.style.fill = holdButtonConsts.codeColor; + this.textGraph.setVectorFontSize(holdButtonConsts.codeFontSize); + this.textGraph.anchor.set(0.5); + this.rectBody.clear(); + this.rectBody.beginFill(holdButtonConsts.bodyColor, 0); + this.rectBody.lineStyle( + holdButtonConsts.bodyRectLineWidth, + holdButtonConsts.bodyRectLineColor + ); + this.rectBody.drawRect( + -holdButtonConsts.bodyRectWidth / 2, + -holdButtonConsts.bodyRectHeight / 2, + holdButtonConsts.bodyRectWidth, + holdButtonConsts.bodyRectHeight + ); + this.rectBody.endFill(); + this.lineBody.clear(); + const lineY = this.datas.flip + ? holdButtonConsts.bodyRectHeight / 2 + : -holdButtonConsts.bodyRectHeight / 2; + this.lineBody.lineStyle( + holdButtonConsts.bodyLineWidth, + holdButtonConsts.bodyLineColor + ); + this.lineBody.moveTo(-holdButtonConsts.bodyRectWidth / 2, lineY); + this.lineBody.lineTo(holdButtonConsts.bodyRectWidth / 2, lineY); + } +} + +export class HoldButtonTemplate extends JlGraphicTemplate { + constructor(dataTemplate: IHoldButtonData) { + super(HoldButton.Type, { dataTemplate }); + } + new(): HoldButton { + const holdButton = new HoldButton(); + holdButton.loadData(this.datas); + return holdButton; + } +} diff --git a/src/graphics/holdButton/HoldButtonDrawAssistant.ts b/src/graphics/holdButton/HoldButtonDrawAssistant.ts new file mode 100644 index 0000000..cfbd6a6 --- /dev/null +++ b/src/graphics/holdButton/HoldButtonDrawAssistant.ts @@ -0,0 +1,128 @@ +import { DisplayObject, FederatedMouseEvent, Point } from 'pixi.js'; +import { + AbsorbableLine, + AbsorbablePosition, + GraphicDrawAssistant, + GraphicInteractionPlugin, + GraphicTransformEvent, + IDrawApp, + JlGraphic, +} from 'jl-graphic'; +import { IHoldButtonData, HoldButton, HoldButtonTemplate } from './HoldButton'; + +export interface IHoldButtonDataDrawOptions { + newData: () => IHoldButtonData; +} +export class HoldButtonDraw extends GraphicDrawAssistant< + HoldButtonTemplate, + IHoldButtonData +> { + _holdButton: HoldButton | null = null; + constructor(app: IDrawApp, template: HoldButtonTemplate) { + super( + app, + template, + 'svguse:../../drawIcon.svg#icon-hold-button', + '扣车按钮HoldButton' + ); + HoldButtonInteraction.init(app); + } + public get holdButton(): HoldButton { + if (!this._holdButton) { + this._holdButton = this.graphicTemplate.new(); + this._holdButton.loadData(this.graphicTemplate.datas); + this.container.addChild(this._holdButton); + } + return this._holdButton; + } + + onLeftUp(e: FederatedMouseEvent): void { + this.container.position.copyFrom(this.toCanvasCoordinates(e.global)); + this.createAndStore(true); + } + + redraw(p: Point): void { + this.holdButton.repaint(); + this.container.position.set(p.x, p.y); + } + + prepareData(data: IHoldButtonData): boolean { + data.transform = this.container.saveTransform(); + data.code = 'H'; + return true; + } +} +/** + * 构建吸附线 + * @param holdButton + */ +function buildAbsorbablePositions( + holdButton: HoldButton +): AbsorbablePosition[] { + const aps: AbsorbablePosition[] = []; + const holdButtons = holdButton.queryStore.queryByType( + HoldButton.Type + ); + const canvas = holdButton.getCanvas(); + holdButtons.forEach((item) => { + if (item.id === holdButton.id) { + return; + } + const ala = new AbsorbableLine( + new Point(item.x, 0), + new Point(item.x, canvas.height) + ); + const alb = new AbsorbableLine( + new Point(0, item.y), + new Point(canvas.width, item.y) + ); + aps.push(ala); + aps.push(alb); + }); + return aps; +} + +export class HoldButtonInteraction extends GraphicInteractionPlugin { + static Name = 'hold_button_transform'; + constructor(app: IDrawApp) { + super(HoldButtonInteraction.Name, app); + } + static init(app: IDrawApp) { + return new HoldButtonInteraction(app); + } + filter(...grahpics: JlGraphic[]): HoldButton[] | undefined { + return grahpics + .filter((g) => g.type === HoldButton.Type) + .map((g) => g as HoldButton); + } + bind(g: HoldButton): void { + g.eventMode = 'static'; + g.cursor = 'pointer'; + g.scalable = true; + g.rotatable = true; + g.codeGraph.draggable = true; + g.codeGraph.selectable = true; + g.codeGraph.rotatable = true; + g.codeGraph.transformSave = true; + g.codeGraph.eventMode = 'static'; + g.on('transformstart', this.transformstart, this); + } + unbind(g: HoldButton): void { + g.eventMode = 'none'; + g.scalable = false; + g.rotatable = false; + g.codeGraph.draggable = false; + g.codeGraph.selectable = false; + g.codeGraph.rotatable = false; + g.codeGraph.transformSave = false; + g.codeGraph.eventMode = 'none'; + g.off('transformstart', this.transformstart, this); + } + transformstart(e: GraphicTransformEvent) { + const target = e.target as DisplayObject; + const holdButton = target.getGraphic() as HoldButton; + holdButton.getGraphicApp().setOptions({ + absorbablePositions: buildAbsorbablePositions(holdButton), + }); + } +} diff --git a/src/graphics/ibpBox/IbpBoxDrawAssistant.ts b/src/graphics/ibpBox/IbpBoxDrawAssistant.ts index ea60003..816d133 100644 --- a/src/graphics/ibpBox/IbpBoxDrawAssistant.ts +++ b/src/graphics/ibpBox/IbpBoxDrawAssistant.ts @@ -16,7 +16,7 @@ export interface IIbpBoxDrawOptions { export class IbpBoxDraw extends GraphicDrawAssistant { _gatedBox: IbpBox | null = null; constructor(app: IDrawApp, template: IbpBoxTemplate) { - super(app, template, 'svguse:../../drawIcon.svg#icon-spks-switch', 'Ibp'); + super(app, template, 'svguse:../../drawIcon.svg#icon-ibp-box', 'Ibp'); IbpBoxInteraction.init(app); } public get gatedBox(): IbpBox { diff --git a/src/graphics/spksSwitch/SpksSwitch.ts b/src/graphics/spksSwitch/SpksSwitch.ts index 4d1a475..4ea4325 100644 --- a/src/graphics/spksSwitch/SpksSwitch.ts +++ b/src/graphics/spksSwitch/SpksSwitch.ts @@ -13,8 +13,8 @@ export interface ISpksSwitchData extends GraphicData { set flip(v: boolean); get refStand(): number; set refStand(v: number); - get refSections(): number[]; - set refSections(v: number[]); + // get refSections(): number[]; + // set refSections(v: number[]); } const spksSwitchConsts = { diff --git a/src/graphics/unattengedButton/UnattengedButton.ts b/src/graphics/unattengedButton/UnattengedButton.ts new file mode 100644 index 0000000..2947c03 --- /dev/null +++ b/src/graphics/unattengedButton/UnattengedButton.ts @@ -0,0 +1,102 @@ +import { Graphics } from 'pixi.js'; +import { + GraphicData, + JlGraphic, + JlGraphicTemplate, + VectorText, +} from 'jl-graphic'; + +export interface IUnattengedButtonData extends GraphicData { + get code(): string; + set code(v: string); + get flip(): boolean; + set flip(v: boolean); + get refStand(): number; + set refStand(v: number); +} + +const unattengedButtonConsts = { + codeFontSize: 12, + codeColor: 0xffffff, + bodyLineColor: 0xffffff, + bodyLineWidth: 4, + bodyRectLineColor: 0xffffff, + bodyRectLineWidth: 2, + bodyRectWidth: 20, + bodyRectHeight: 20, + bodyColor: 0x000000, +}; +export class UnattengedButton extends JlGraphic { + static Type = 'unattengedButton'; + codeGraph: VectorText = new VectorText(''); + rectBody: Graphics = new Graphics(); + lineBody: Graphics = new Graphics(); + textGraph: VectorText = new VectorText('W'); + + constructor() { + super(UnattengedButton.Type); + this.addChild(this.codeGraph); + this.addChild(this.rectBody); + this.addChild(this.lineBody); + this.addChild(this.textGraph); + this.codeGraph.name = 'unattenged_button_code'; + } + get datas(): IUnattengedButtonData { + return this.getDatas(); + } + doRepaint(): void { + const codeGraph = this.codeGraph; + codeGraph.text = this.datas.code; + codeGraph.style.fill = unattengedButtonConsts.codeColor; + codeGraph.setVectorFontSize(unattengedButtonConsts.codeFontSize); + const codeTransform = this.datas?.childTransforms?.find( + (item) => item.name === 'unattenged_button_code' + ); + if (codeTransform) { + const position = codeTransform?.transform.position; + const rotation = codeTransform?.transform?.rotation; + codeGraph.position.set(position?.x, position?.y); + codeGraph.rotation = rotation || 0; + } else { + codeGraph.position.set(20, 0); + } + codeGraph.anchor.set(0.5); + this.textGraph.style.fill = unattengedButtonConsts.codeColor; + this.textGraph.setVectorFontSize(unattengedButtonConsts.codeFontSize); + this.textGraph.anchor.set(0.5); + this.rectBody.clear(); + this.rectBody.beginFill(unattengedButtonConsts.bodyColor, 0); + this.rectBody.lineStyle( + unattengedButtonConsts.bodyRectLineWidth, + unattengedButtonConsts.bodyRectLineColor + ); + this.rectBody.drawRect( + -unattengedButtonConsts.bodyRectWidth / 2, + -unattengedButtonConsts.bodyRectHeight / 2, + unattengedButtonConsts.bodyRectWidth, + unattengedButtonConsts.bodyRectHeight + ); + this.rectBody.endFill(); + this.lineBody.clear(); + const lineY = this.datas.flip + ? unattengedButtonConsts.bodyRectHeight / 2 + : -unattengedButtonConsts.bodyRectHeight / 2; + this.lineBody.lineStyle( + unattengedButtonConsts.bodyLineWidth, + unattengedButtonConsts.bodyLineColor + ); + this.lineBody.moveTo(-unattengedButtonConsts.bodyRectWidth / 2, lineY); + this.lineBody.lineTo(unattengedButtonConsts.bodyRectWidth / 2, lineY); + } +} + +export class UnattengedButtonTemplate extends JlGraphicTemplate { + constructor(dataTemplate: IUnattengedButtonData) { + super(UnattengedButton.Type, { dataTemplate }); + } + new(): UnattengedButton { + const unattengedButton = new UnattengedButton(); + unattengedButton.loadData(this.datas); + return unattengedButton; + } +} diff --git a/src/graphics/unattengedButton/UnattengedButtonDrawAssistant.ts b/src/graphics/unattengedButton/UnattengedButtonDrawAssistant.ts new file mode 100644 index 0000000..2f2d175 --- /dev/null +++ b/src/graphics/unattengedButton/UnattengedButtonDrawAssistant.ts @@ -0,0 +1,128 @@ +import { DisplayObject, FederatedMouseEvent, Point } from 'pixi.js'; +import { + AbsorbableLine, + AbsorbablePosition, + GraphicDrawAssistant, + GraphicInteractionPlugin, + GraphicTransformEvent, + IDrawApp, + JlGraphic, +} from 'jl-graphic'; +import { IUnattengedButtonData, UnattengedButton, UnattengedButtonTemplate } from './UnattengedButton'; + +export interface IUnattengedButtonDataOptions { + newData: () => IUnattengedButtonData; +} +export class UnattengedButtonDraw extends GraphicDrawAssistant< + UnattengedButtonTemplate, + IUnattengedButtonData +> { + _unattengedButton: UnattengedButton | null = null; + constructor(app: IDrawApp, template: UnattengedButtonTemplate) { + super( + app, + template, + 'svguse:../../drawIcon.svg#icon-unattenged-button', + '无人折返按钮UnattengedButton' + ); + UnattengedButtonInteraction.init(app); + } + public get unattengedButton(): UnattengedButton { + if (!this._unattengedButton) { + this._unattengedButton = this.graphicTemplate.new(); + this._unattengedButton.loadData(this.graphicTemplate.datas); + this.container.addChild(this._unattengedButton); + } + return this._unattengedButton; + } + + onLeftUp(e: FederatedMouseEvent): void { + this.container.position.copyFrom(this.toCanvasCoordinates(e.global)); + this.createAndStore(true); + } + + redraw(p: Point): void { + this.unattengedButton.repaint(); + this.container.position.set(p.x, p.y); + } + + prepareData(data: IUnattengedButtonData): boolean { + data.transform = this.container.saveTransform(); + data.code = 'W'; + return true; + } +} +/** + * 构建吸附线 + * @param unattengedButton + */ +function buildAbsorbablePositions( + unattengedButton: UnattengedButton +): AbsorbablePosition[] { + const aps: AbsorbablePosition[] = []; + const unattengedButtons = unattengedButton.queryStore.queryByType( + UnattengedButton.Type + ); + const canvas = unattengedButton.getCanvas(); + unattengedButtons.forEach((item) => { + if (item.id === unattengedButton.id) { + return; + } + const ala = new AbsorbableLine( + new Point(item.x, 0), + new Point(item.x, canvas.height) + ); + const alb = new AbsorbableLine( + new Point(0, item.y), + new Point(canvas.width, item.y) + ); + aps.push(ala); + aps.push(alb); + }); + return aps; +} + +export class UnattengedButtonInteraction extends GraphicInteractionPlugin { + static Name = 'unattenged_button_transform'; + constructor(app: IDrawApp) { + super(UnattengedButtonInteraction.Name, app); + } + static init(app: IDrawApp) { + return new UnattengedButtonInteraction(app); + } + filter(...grahpics: JlGraphic[]): UnattengedButton[] | undefined { + return grahpics + .filter((g) => g.type === UnattengedButton.Type) + .map((g) => g as UnattengedButton); + } + bind(g: UnattengedButton): void { + g.eventMode = 'static'; + g.cursor = 'pointer'; + g.scalable = true; + g.rotatable = true; + g.codeGraph.draggable = true; + g.codeGraph.selectable = true; + g.codeGraph.rotatable = true; + g.codeGraph.transformSave = true; + g.codeGraph.eventMode = 'static'; + g.on('transformstart', this.transformstart, this); + } + unbind(g: UnattengedButton): void { + g.eventMode = 'none'; + g.scalable = false; + g.rotatable = false; + g.codeGraph.draggable = false; + g.codeGraph.selectable = false; + g.codeGraph.rotatable = false; + g.codeGraph.transformSave = false; + g.codeGraph.eventMode = 'none'; + g.off('transformstart', this.transformstart, this); + } + transformstart(e: GraphicTransformEvent) { + const target = e.target as DisplayObject; + const unattengedButton = target.getGraphic() as UnattengedButton; + unattengedButton.getGraphicApp().setOptions({ + absorbablePositions: buildAbsorbablePositions(unattengedButton), + }); + } +} diff --git a/src/layouts/DrawLayout.vue b/src/layouts/DrawLayout.vue index be29fca..752c2a9 100644 --- a/src/layouts/DrawLayout.vue +++ b/src/layouts/DrawLayout.vue @@ -248,6 +248,7 @@ import { CategoryType } from 'src/components/CategoryType'; import { graphicData } from 'src/protos/stationLayoutGraphics'; import KilometerConvertList from 'src/components/draw-app/dialogs/KilometerConvertList.vue'; import LoadTransponderData from 'src/components/draw-app/dialogs/LoadTransponderData.vue'; +import LianSuoBianHao from 'src/components/draw-app/dialogs/LianSuoBianHao.vue'; import KilometerConvertConfig from 'src/components/draw-app/properties/KilometerConvertConfig.vue'; import SectionCodePointList from 'src/components/draw-app/dialogs/SectionCodePointList.vue'; import SectionCodePointConfig from 'src/components/draw-app/properties/SectionCodePointConfig.vue'; @@ -277,6 +278,8 @@ import { PslBox } from 'src/graphics/pslBox/PslBox'; import { CarWashing } from 'src/graphics/carWashing/CarWashing'; import { GarageDoor } from 'src/graphics/garageDoor/GarageDoor'; import { FloodGate } from 'src/graphics/floodGate/FloodGate'; +import { HoldButton } from 'src/graphics/holdButton/HoldButton'; +import { UnattengedButton } from 'src/graphics/unattengedButton/UnattengedButton'; const $q = useQuasar(); const route = useRoute(); @@ -409,6 +412,10 @@ const dataManageConfig = [ label: '导入应答器报文', click: uploadTransponderMessage, }, + { + label: '联锁编号映射数据', + click: lianSuoBianHao, + }, ]; onMounted(() => { @@ -445,6 +452,8 @@ onMounted(() => { CarWashing.Type, GarageDoor.Type, FloodGate.Type, + HoldButton.Type, + UnattengedButton.Type, ]; switch (drawStore.categoryType) { case CategoryType.TH: @@ -1169,6 +1178,18 @@ function uploadTransponderMessage() { }); } +let lianSuoBianHaoDialog: DialogChainObject | null = null; +function lianSuoBianHao() { + if (lianSuoBianHaoDialog) return; + lianSuoBianHaoDialog = $q + .dialog({ + component: LianSuoBianHao, + }) + .onCancel(() => { + lianSuoBianHaoDialog = null; + }); +} + let relateDeviceDialogInstance: DialogChainObject | null = null; const relateDeviceConfigEdit = ref>(); diff --git a/src/protos/device_state.ts b/src/protos/device_state.ts index 4e306fd..02fc97f 100644 --- a/src/protos/device_state.ts +++ b/src/protos/device_state.ts @@ -1132,7 +1132,9 @@ export namespace state { export enum TrainConnType { NONE = 0, VOBC = 1, - PC_SIM = 2 + PC_SIM = 2, + PC_SIM_A = 3, + PC_SIM_B = 4 } } export class TrainState extends pb_1.Message { diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts index 2dbb09c..a26b3fc 100644 --- a/src/protos/stationLayoutGraphics.ts +++ b/src/protos/stationLayoutGraphics.ts @@ -55,9 +55,12 @@ export namespace graphicData { carWashings?: CarWashing[]; garageDoors?: GarageDoor[]; floodGates?: GarageDoor[]; + lianSuoData?: LianSuoData; + holdButtons?: HoldButton[]; + unattengedButtons?: UnattengedButton[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 32, 33, 34, 35, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 32, 33, 34, 35, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 50, 51], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("canvas" in data && data.canvas != undefined) { this.canvas = data.canvas; @@ -185,6 +188,15 @@ export namespace graphicData { if ("floodGates" in data && data.floodGates != undefined) { this.floodGates = data.floodGates; } + if ("lianSuoData" in data && data.lianSuoData != undefined) { + this.lianSuoData = data.lianSuoData; + } + if ("holdButtons" in data && data.holdButtons != undefined) { + this.holdButtons = data.holdButtons; + } + if ("unattengedButtons" in data && data.unattengedButtons != undefined) { + this.unattengedButtons = data.unattengedButtons; + } } } get canvas() { @@ -451,6 +463,27 @@ export namespace graphicData { set floodGates(value: GarageDoor[]) { pb_1.Message.setRepeatedWrapperField(this, 47, value); } + get lianSuoData() { + return pb_1.Message.getWrapperField(this, LianSuoData, 49) as LianSuoData; + } + set lianSuoData(value: LianSuoData) { + pb_1.Message.setWrapperField(this, 49, value); + } + get has_lianSuoData() { + return pb_1.Message.getField(this, 49) != null; + } + get holdButtons() { + return pb_1.Message.getRepeatedWrapperField(this, HoldButton, 50) as HoldButton[]; + } + set holdButtons(value: HoldButton[]) { + pb_1.Message.setRepeatedWrapperField(this, 50, value); + } + get unattengedButtons() { + return pb_1.Message.getRepeatedWrapperField(this, UnattengedButton, 51) as UnattengedButton[]; + } + set unattengedButtons(value: UnattengedButton[]) { + pb_1.Message.setRepeatedWrapperField(this, 51, value); + } static fromObject(data: { canvas?: ReturnType; Platforms?: ReturnType[]; @@ -494,6 +527,9 @@ export namespace graphicData { carWashings?: ReturnType[]; garageDoors?: ReturnType[]; floodGates?: ReturnType[]; + lianSuoData?: ReturnType; + holdButtons?: ReturnType[]; + unattengedButtons?: ReturnType[]; }): RtssGraphicStorage { const message = new RtssGraphicStorage({}); if (data.canvas != null) { @@ -622,6 +658,15 @@ export namespace graphicData { if (data.floodGates != null) { message.floodGates = data.floodGates.map(item => GarageDoor.fromObject(item)); } + if (data.lianSuoData != null) { + message.lianSuoData = LianSuoData.fromObject(data.lianSuoData); + } + if (data.holdButtons != null) { + message.holdButtons = data.holdButtons.map(item => HoldButton.fromObject(item)); + } + if (data.unattengedButtons != null) { + message.unattengedButtons = data.unattengedButtons.map(item => UnattengedButton.fromObject(item)); + } return message; } toObject() { @@ -668,6 +713,9 @@ export namespace graphicData { carWashings?: ReturnType[]; garageDoors?: ReturnType[]; floodGates?: ReturnType[]; + lianSuoData?: ReturnType; + holdButtons?: ReturnType[]; + unattengedButtons?: ReturnType[]; } = {}; if (this.canvas != null) { data.canvas = this.canvas.toObject(); @@ -795,6 +843,15 @@ export namespace graphicData { if (this.floodGates != null) { data.floodGates = this.floodGates.map((item: GarageDoor) => item.toObject()); } + if (this.lianSuoData != null) { + data.lianSuoData = this.lianSuoData.toObject(); + } + if (this.holdButtons != null) { + data.holdButtons = this.holdButtons.map((item: HoldButton) => item.toObject()); + } + if (this.unattengedButtons != null) { + data.unattengedButtons = this.unattengedButtons.map((item: UnattengedButton) => item.toObject()); + } return data; } serialize(): Uint8Array; @@ -885,6 +942,12 @@ export namespace graphicData { writer.writeRepeatedMessage(46, this.garageDoors, (item: GarageDoor) => item.serialize(writer)); if (this.floodGates.length) writer.writeRepeatedMessage(47, this.floodGates, (item: GarageDoor) => item.serialize(writer)); + if (this.has_lianSuoData) + writer.writeMessage(49, this.lianSuoData, () => this.lianSuoData.serialize(writer)); + if (this.holdButtons.length) + writer.writeRepeatedMessage(50, this.holdButtons, (item: HoldButton) => item.serialize(writer)); + if (this.unattengedButtons.length) + writer.writeRepeatedMessage(51, this.unattengedButtons, (item: UnattengedButton) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -1020,6 +1083,15 @@ export namespace graphicData { case 47: reader.readMessage(message.floodGates, () => pb_1.Message.addToRepeatedWrapperField(message, 47, GarageDoor.deserialize(reader), GarageDoor)); break; + case 49: + reader.readMessage(message.lianSuoData, () => message.lianSuoData = LianSuoData.deserialize(reader)); + break; + case 50: + reader.readMessage(message.holdButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 50, HoldButton.deserialize(reader), HoldButton)); + break; + case 51: + reader.readMessage(message.unattengedButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 51, UnattengedButton.deserialize(reader), UnattengedButton)); + break; default: reader.skipField(); } } @@ -6392,11 +6464,10 @@ export namespace graphicData { common?: CommonInfo; code?: string; flip?: boolean; - refSections?: number[]; refStand?: number; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [8], 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 ("common" in data && data.common != undefined) { this.common = data.common; @@ -6407,9 +6478,6 @@ export namespace graphicData { if ("flip" in data && data.flip != undefined) { this.flip = data.flip; } - if ("refSections" in data && data.refSections != undefined) { - this.refSections = data.refSections; - } if ("refStand" in data && data.refStand != undefined) { this.refStand = data.refStand; } @@ -6436,12 +6504,6 @@ export namespace graphicData { set flip(value: boolean) { pb_1.Message.setField(this, 3, value); } - get refSections() { - return pb_1.Message.getFieldWithDefault(this, 8, []) as number[]; - } - set refSections(value: number[]) { - pb_1.Message.setField(this, 8, value); - } get refStand() { return pb_1.Message.getFieldWithDefault(this, 9, 0) as number; } @@ -6452,7 +6514,6 @@ export namespace graphicData { common?: ReturnType; code?: string; flip?: boolean; - refSections?: number[]; refStand?: number; }): SpksSwitch { const message = new SpksSwitch({}); @@ -6465,9 +6526,6 @@ export namespace graphicData { if (data.flip != null) { message.flip = data.flip; } - if (data.refSections != null) { - message.refSections = data.refSections; - } if (data.refStand != null) { message.refStand = data.refStand; } @@ -6478,7 +6536,6 @@ export namespace graphicData { common?: ReturnType; code?: string; flip?: boolean; - refSections?: number[]; refStand?: number; } = {}; if (this.common != null) { @@ -6490,9 +6547,6 @@ export namespace graphicData { if (this.flip != null) { data.flip = this.flip; } - if (this.refSections != null) { - data.refSections = this.refSections; - } if (this.refStand != null) { data.refStand = this.refStand; } @@ -6508,8 +6562,6 @@ export namespace graphicData { writer.writeString(2, this.code); if (this.flip != false) writer.writeBool(3, this.flip); - if (this.refSections.length) - writer.writePackedUint32(8, this.refSections); if (this.refStand != 0) writer.writeUint32(9, this.refStand); if (!w) @@ -6530,9 +6582,6 @@ export namespace graphicData { case 3: message.flip = reader.readBool(); break; - case 8: - message.refSections = reader.readPackedUint32(); - break; case 9: message.refStand = reader.readUint32(); break; @@ -9238,4 +9287,692 @@ export namespace graphicData { return OtherLine.deserialize(bytes); } } + export class LianSuoIndexData extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + id?: number; + index?: number; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("id" in data && data.id != undefined) { + this.id = data.id; + } + if ("index" in data && data.index != undefined) { + this.index = data.index; + } + } + } + get id() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; + } + set id(value: number) { + pb_1.Message.setField(this, 1, value); + } + get index() { + return pb_1.Message.getFieldWithDefault(this, 2, 0) as number; + } + set index(value: number) { + pb_1.Message.setField(this, 2, value); + } + static fromObject(data: { + id?: number; + index?: number; + }): LianSuoIndexData { + const message = new LianSuoIndexData({}); + if (data.id != null) { + message.id = data.id; + } + if (data.index != null) { + message.index = data.index; + } + return message; + } + toObject() { + const data: { + id?: number; + index?: number; + } = {}; + if (this.id != null) { + data.id = this.id; + } + if (this.index != null) { + data.index = this.index; + } + 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.id != 0) + writer.writeInt32(1, this.id); + if (this.index != 0) + writer.writeInt32(2, this.index); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): LianSuoIndexData { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new LianSuoIndexData(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.id = reader.readInt32(); + break; + case 2: + message.index = reader.readInt32(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): LianSuoIndexData { + return LianSuoIndexData.deserialize(bytes); + } + } + export class LianSuoData extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + stations?: LianSuoIndexData[]; + switchs?: LianSuoIndexData[]; + screenDoors?: LianSuoIndexData[]; + signals?: LianSuoIndexData[]; + sections?: LianSuoIndexData[]; + floodGates?: LianSuoIndexData[]; + spksSwitchs?: LianSuoIndexData[]; + garageDoors?: LianSuoIndexData[]; + carWashing?: LianSuoIndexData[]; + esbButtons?: LianSuoIndexData[]; + holdButtons?: LianSuoIndexData[]; + unattengedButtons?: LianSuoIndexData[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("stations" in data && data.stations != undefined) { + this.stations = data.stations; + } + if ("switchs" in data && data.switchs != undefined) { + this.switchs = data.switchs; + } + if ("screenDoors" in data && data.screenDoors != undefined) { + this.screenDoors = data.screenDoors; + } + if ("signals" in data && data.signals != undefined) { + this.signals = data.signals; + } + if ("sections" in data && data.sections != undefined) { + this.sections = data.sections; + } + if ("floodGates" in data && data.floodGates != undefined) { + this.floodGates = data.floodGates; + } + if ("spksSwitchs" in data && data.spksSwitchs != undefined) { + this.spksSwitchs = data.spksSwitchs; + } + if ("garageDoors" in data && data.garageDoors != undefined) { + this.garageDoors = data.garageDoors; + } + if ("carWashing" in data && data.carWashing != undefined) { + this.carWashing = data.carWashing; + } + if ("esbButtons" in data && data.esbButtons != undefined) { + this.esbButtons = data.esbButtons; + } + if ("holdButtons" in data && data.holdButtons != undefined) { + this.holdButtons = data.holdButtons; + } + if ("unattengedButtons" in data && data.unattengedButtons != undefined) { + this.unattengedButtons = data.unattengedButtons; + } + } + } + get stations() { + return pb_1.Message.getRepeatedWrapperField(this, LianSuoIndexData, 1) as LianSuoIndexData[]; + } + set stations(value: LianSuoIndexData[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value); + } + get switchs() { + return pb_1.Message.getRepeatedWrapperField(this, LianSuoIndexData, 2) as LianSuoIndexData[]; + } + set switchs(value: LianSuoIndexData[]) { + pb_1.Message.setRepeatedWrapperField(this, 2, value); + } + get screenDoors() { + return pb_1.Message.getRepeatedWrapperField(this, LianSuoIndexData, 3) as LianSuoIndexData[]; + } + set screenDoors(value: LianSuoIndexData[]) { + pb_1.Message.setRepeatedWrapperField(this, 3, value); + } + get signals() { + return pb_1.Message.getRepeatedWrapperField(this, LianSuoIndexData, 4) as LianSuoIndexData[]; + } + set signals(value: LianSuoIndexData[]) { + pb_1.Message.setRepeatedWrapperField(this, 4, value); + } + get sections() { + return pb_1.Message.getRepeatedWrapperField(this, LianSuoIndexData, 5) as LianSuoIndexData[]; + } + set sections(value: LianSuoIndexData[]) { + pb_1.Message.setRepeatedWrapperField(this, 5, value); + } + get floodGates() { + return pb_1.Message.getRepeatedWrapperField(this, LianSuoIndexData, 6) as LianSuoIndexData[]; + } + set floodGates(value: LianSuoIndexData[]) { + pb_1.Message.setRepeatedWrapperField(this, 6, value); + } + get spksSwitchs() { + return pb_1.Message.getRepeatedWrapperField(this, LianSuoIndexData, 7) as LianSuoIndexData[]; + } + set spksSwitchs(value: LianSuoIndexData[]) { + pb_1.Message.setRepeatedWrapperField(this, 7, value); + } + get garageDoors() { + return pb_1.Message.getRepeatedWrapperField(this, LianSuoIndexData, 8) as LianSuoIndexData[]; + } + set garageDoors(value: LianSuoIndexData[]) { + pb_1.Message.setRepeatedWrapperField(this, 8, value); + } + get carWashing() { + return pb_1.Message.getRepeatedWrapperField(this, LianSuoIndexData, 9) as LianSuoIndexData[]; + } + set carWashing(value: LianSuoIndexData[]) { + pb_1.Message.setRepeatedWrapperField(this, 9, value); + } + get esbButtons() { + return pb_1.Message.getRepeatedWrapperField(this, LianSuoIndexData, 10) as LianSuoIndexData[]; + } + set esbButtons(value: LianSuoIndexData[]) { + pb_1.Message.setRepeatedWrapperField(this, 10, value); + } + get holdButtons() { + return pb_1.Message.getRepeatedWrapperField(this, LianSuoIndexData, 11) as LianSuoIndexData[]; + } + set holdButtons(value: LianSuoIndexData[]) { + pb_1.Message.setRepeatedWrapperField(this, 11, value); + } + get unattengedButtons() { + return pb_1.Message.getRepeatedWrapperField(this, LianSuoIndexData, 12) as LianSuoIndexData[]; + } + set unattengedButtons(value: LianSuoIndexData[]) { + pb_1.Message.setRepeatedWrapperField(this, 12, value); + } + static fromObject(data: { + stations?: ReturnType[]; + switchs?: ReturnType[]; + screenDoors?: ReturnType[]; + signals?: ReturnType[]; + sections?: ReturnType[]; + floodGates?: ReturnType[]; + spksSwitchs?: ReturnType[]; + garageDoors?: ReturnType[]; + carWashing?: ReturnType[]; + esbButtons?: ReturnType[]; + holdButtons?: ReturnType[]; + unattengedButtons?: ReturnType[]; + }): LianSuoData { + const message = new LianSuoData({}); + if (data.stations != null) { + message.stations = data.stations.map(item => LianSuoIndexData.fromObject(item)); + } + if (data.switchs != null) { + message.switchs = data.switchs.map(item => LianSuoIndexData.fromObject(item)); + } + if (data.screenDoors != null) { + message.screenDoors = data.screenDoors.map(item => LianSuoIndexData.fromObject(item)); + } + if (data.signals != null) { + message.signals = data.signals.map(item => LianSuoIndexData.fromObject(item)); + } + if (data.sections != null) { + message.sections = data.sections.map(item => LianSuoIndexData.fromObject(item)); + } + if (data.floodGates != null) { + message.floodGates = data.floodGates.map(item => LianSuoIndexData.fromObject(item)); + } + if (data.spksSwitchs != null) { + message.spksSwitchs = data.spksSwitchs.map(item => LianSuoIndexData.fromObject(item)); + } + if (data.garageDoors != null) { + message.garageDoors = data.garageDoors.map(item => LianSuoIndexData.fromObject(item)); + } + if (data.carWashing != null) { + message.carWashing = data.carWashing.map(item => LianSuoIndexData.fromObject(item)); + } + if (data.esbButtons != null) { + message.esbButtons = data.esbButtons.map(item => LianSuoIndexData.fromObject(item)); + } + if (data.holdButtons != null) { + message.holdButtons = data.holdButtons.map(item => LianSuoIndexData.fromObject(item)); + } + if (data.unattengedButtons != null) { + message.unattengedButtons = data.unattengedButtons.map(item => LianSuoIndexData.fromObject(item)); + } + return message; + } + toObject() { + const data: { + stations?: ReturnType[]; + switchs?: ReturnType[]; + screenDoors?: ReturnType[]; + signals?: ReturnType[]; + sections?: ReturnType[]; + floodGates?: ReturnType[]; + spksSwitchs?: ReturnType[]; + garageDoors?: ReturnType[]; + carWashing?: ReturnType[]; + esbButtons?: ReturnType[]; + holdButtons?: ReturnType[]; + unattengedButtons?: ReturnType[]; + } = {}; + if (this.stations != null) { + data.stations = this.stations.map((item: LianSuoIndexData) => item.toObject()); + } + if (this.switchs != null) { + data.switchs = this.switchs.map((item: LianSuoIndexData) => item.toObject()); + } + if (this.screenDoors != null) { + data.screenDoors = this.screenDoors.map((item: LianSuoIndexData) => item.toObject()); + } + if (this.signals != null) { + data.signals = this.signals.map((item: LianSuoIndexData) => item.toObject()); + } + if (this.sections != null) { + data.sections = this.sections.map((item: LianSuoIndexData) => item.toObject()); + } + if (this.floodGates != null) { + data.floodGates = this.floodGates.map((item: LianSuoIndexData) => item.toObject()); + } + if (this.spksSwitchs != null) { + data.spksSwitchs = this.spksSwitchs.map((item: LianSuoIndexData) => item.toObject()); + } + if (this.garageDoors != null) { + data.garageDoors = this.garageDoors.map((item: LianSuoIndexData) => item.toObject()); + } + if (this.carWashing != null) { + data.carWashing = this.carWashing.map((item: LianSuoIndexData) => item.toObject()); + } + if (this.esbButtons != null) { + data.esbButtons = this.esbButtons.map((item: LianSuoIndexData) => item.toObject()); + } + if (this.holdButtons != null) { + data.holdButtons = this.holdButtons.map((item: LianSuoIndexData) => item.toObject()); + } + if (this.unattengedButtons != null) { + data.unattengedButtons = this.unattengedButtons.map((item: LianSuoIndexData) => item.toObject()); + } + 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.stations.length) + writer.writeRepeatedMessage(1, this.stations, (item: LianSuoIndexData) => item.serialize(writer)); + if (this.switchs.length) + writer.writeRepeatedMessage(2, this.switchs, (item: LianSuoIndexData) => item.serialize(writer)); + if (this.screenDoors.length) + writer.writeRepeatedMessage(3, this.screenDoors, (item: LianSuoIndexData) => item.serialize(writer)); + if (this.signals.length) + writer.writeRepeatedMessage(4, this.signals, (item: LianSuoIndexData) => item.serialize(writer)); + if (this.sections.length) + writer.writeRepeatedMessage(5, this.sections, (item: LianSuoIndexData) => item.serialize(writer)); + if (this.floodGates.length) + writer.writeRepeatedMessage(6, this.floodGates, (item: LianSuoIndexData) => item.serialize(writer)); + if (this.spksSwitchs.length) + writer.writeRepeatedMessage(7, this.spksSwitchs, (item: LianSuoIndexData) => item.serialize(writer)); + if (this.garageDoors.length) + writer.writeRepeatedMessage(8, this.garageDoors, (item: LianSuoIndexData) => item.serialize(writer)); + if (this.carWashing.length) + writer.writeRepeatedMessage(9, this.carWashing, (item: LianSuoIndexData) => item.serialize(writer)); + if (this.esbButtons.length) + writer.writeRepeatedMessage(10, this.esbButtons, (item: LianSuoIndexData) => item.serialize(writer)); + if (this.holdButtons.length) + writer.writeRepeatedMessage(11, this.holdButtons, (item: LianSuoIndexData) => item.serialize(writer)); + if (this.unattengedButtons.length) + writer.writeRepeatedMessage(12, this.unattengedButtons, (item: LianSuoIndexData) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): LianSuoData { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new LianSuoData(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.stations, () => pb_1.Message.addToRepeatedWrapperField(message, 1, LianSuoIndexData.deserialize(reader), LianSuoIndexData)); + break; + case 2: + reader.readMessage(message.switchs, () => pb_1.Message.addToRepeatedWrapperField(message, 2, LianSuoIndexData.deserialize(reader), LianSuoIndexData)); + break; + case 3: + reader.readMessage(message.screenDoors, () => pb_1.Message.addToRepeatedWrapperField(message, 3, LianSuoIndexData.deserialize(reader), LianSuoIndexData)); + break; + case 4: + reader.readMessage(message.signals, () => pb_1.Message.addToRepeatedWrapperField(message, 4, LianSuoIndexData.deserialize(reader), LianSuoIndexData)); + break; + case 5: + reader.readMessage(message.sections, () => pb_1.Message.addToRepeatedWrapperField(message, 5, LianSuoIndexData.deserialize(reader), LianSuoIndexData)); + break; + case 6: + reader.readMessage(message.floodGates, () => pb_1.Message.addToRepeatedWrapperField(message, 6, LianSuoIndexData.deserialize(reader), LianSuoIndexData)); + break; + case 7: + reader.readMessage(message.spksSwitchs, () => pb_1.Message.addToRepeatedWrapperField(message, 7, LianSuoIndexData.deserialize(reader), LianSuoIndexData)); + break; + case 8: + reader.readMessage(message.garageDoors, () => pb_1.Message.addToRepeatedWrapperField(message, 8, LianSuoIndexData.deserialize(reader), LianSuoIndexData)); + break; + case 9: + reader.readMessage(message.carWashing, () => pb_1.Message.addToRepeatedWrapperField(message, 9, LianSuoIndexData.deserialize(reader), LianSuoIndexData)); + break; + case 10: + reader.readMessage(message.esbButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 10, LianSuoIndexData.deserialize(reader), LianSuoIndexData)); + break; + case 11: + reader.readMessage(message.holdButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 11, LianSuoIndexData.deserialize(reader), LianSuoIndexData)); + break; + case 12: + reader.readMessage(message.unattengedButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 12, LianSuoIndexData.deserialize(reader), LianSuoIndexData)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): LianSuoData { + return LianSuoData.deserialize(bytes); + } + } + export class UnattengedButton extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + common?: CommonInfo; + code?: string; + flip?: boolean; + refStand?: number; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("common" in data && data.common != undefined) { + this.common = data.common; + } + if ("code" in data && data.code != undefined) { + this.code = data.code; + } + if ("flip" in data && data.flip != undefined) { + this.flip = data.flip; + } + if ("refStand" in data && data.refStand != undefined) { + this.refStand = data.refStand; + } + } + } + get common() { + return pb_1.Message.getWrapperField(this, CommonInfo, 1) as CommonInfo; + } + set common(value: CommonInfo) { + pb_1.Message.setWrapperField(this, 1, value); + } + get has_common() { + return pb_1.Message.getField(this, 1) != null; + } + get code() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; + } + set code(value: string) { + pb_1.Message.setField(this, 2, value); + } + get flip() { + return pb_1.Message.getFieldWithDefault(this, 3, false) as boolean; + } + set flip(value: boolean) { + pb_1.Message.setField(this, 3, value); + } + get refStand() { + return pb_1.Message.getFieldWithDefault(this, 4, 0) as number; + } + set refStand(value: number) { + pb_1.Message.setField(this, 4, value); + } + static fromObject(data: { + common?: ReturnType; + code?: string; + flip?: boolean; + refStand?: number; + }): UnattengedButton { + const message = new UnattengedButton({}); + if (data.common != null) { + message.common = CommonInfo.fromObject(data.common); + } + if (data.code != null) { + message.code = data.code; + } + if (data.flip != null) { + message.flip = data.flip; + } + if (data.refStand != null) { + message.refStand = data.refStand; + } + return message; + } + toObject() { + const data: { + common?: ReturnType; + code?: string; + flip?: boolean; + refStand?: number; + } = {}; + if (this.common != null) { + data.common = this.common.toObject(); + } + if (this.code != null) { + data.code = this.code; + } + if (this.flip != null) { + data.flip = this.flip; + } + if (this.refStand != null) { + data.refStand = this.refStand; + } + 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.has_common) + writer.writeMessage(1, this.common, () => this.common.serialize(writer)); + if (this.code.length) + writer.writeString(2, this.code); + if (this.flip != false) + writer.writeBool(3, this.flip); + if (this.refStand != 0) + writer.writeUint32(4, this.refStand); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): UnattengedButton { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new UnattengedButton(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.common, () => message.common = CommonInfo.deserialize(reader)); + break; + case 2: + message.code = reader.readString(); + break; + case 3: + message.flip = reader.readBool(); + break; + case 4: + message.refStand = reader.readUint32(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): UnattengedButton { + return UnattengedButton.deserialize(bytes); + } + } + export class HoldButton extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + common?: CommonInfo; + code?: string; + flip?: boolean; + refStand?: number; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("common" in data && data.common != undefined) { + this.common = data.common; + } + if ("code" in data && data.code != undefined) { + this.code = data.code; + } + if ("flip" in data && data.flip != undefined) { + this.flip = data.flip; + } + if ("refStand" in data && data.refStand != undefined) { + this.refStand = data.refStand; + } + } + } + get common() { + return pb_1.Message.getWrapperField(this, CommonInfo, 1) as CommonInfo; + } + set common(value: CommonInfo) { + pb_1.Message.setWrapperField(this, 1, value); + } + get has_common() { + return pb_1.Message.getField(this, 1) != null; + } + get code() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; + } + set code(value: string) { + pb_1.Message.setField(this, 2, value); + } + get flip() { + return pb_1.Message.getFieldWithDefault(this, 3, false) as boolean; + } + set flip(value: boolean) { + pb_1.Message.setField(this, 3, value); + } + get refStand() { + return pb_1.Message.getFieldWithDefault(this, 4, 0) as number; + } + set refStand(value: number) { + pb_1.Message.setField(this, 4, value); + } + static fromObject(data: { + common?: ReturnType; + code?: string; + flip?: boolean; + refStand?: number; + }): HoldButton { + const message = new HoldButton({}); + if (data.common != null) { + message.common = CommonInfo.fromObject(data.common); + } + if (data.code != null) { + message.code = data.code; + } + if (data.flip != null) { + message.flip = data.flip; + } + if (data.refStand != null) { + message.refStand = data.refStand; + } + return message; + } + toObject() { + const data: { + common?: ReturnType; + code?: string; + flip?: boolean; + refStand?: number; + } = {}; + if (this.common != null) { + data.common = this.common.toObject(); + } + if (this.code != null) { + data.code = this.code; + } + if (this.flip != null) { + data.flip = this.flip; + } + if (this.refStand != null) { + data.refStand = this.refStand; + } + 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.has_common) + writer.writeMessage(1, this.common, () => this.common.serialize(writer)); + if (this.code.length) + writer.writeString(2, this.code); + if (this.flip != false) + writer.writeBool(3, this.flip); + if (this.refStand != 0) + writer.writeUint32(4, this.refStand); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): HoldButton { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new HoldButton(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.common, () => message.common = CommonInfo.deserialize(reader)); + break; + case 2: + message.code = reader.readString(); + break; + case 3: + message.flip = reader.readBool(); + break; + case 4: + message.refStand = reader.readUint32(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): HoldButton { + return HoldButton.deserialize(bytes); + } + } }