From f73b171f153cd170f3ff3236b4868d56f5622851 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Mon, 12 Aug 2024 18:00:50 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=AE=A1=E8=BD=B4=E5=8C=BA=E6=AE=B5?= =?UTF-8?q?=E7=9A=84=E6=98=BE=E7=A4=BA=E5=92=8C=E7=8A=B6=E6=80=81=EF=BC=88?= =?UTF-8?q?=E5=BE=85=E4=B8=8E=E5=90=8E=E7=AB=AF=E6=B5=8B=E8=AF=95=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/line-app/StateProperties.vue | 5 + .../states/AxleCountingSectionState.vue | 115 ++++++++++++++++++ .../line-app/states/SectionState.vue | 4 +- .../AxleCountingSectionInteraction.ts | 88 +++++++++++++- src/drawApp/jkApp.ts | 4 +- src/drawApp/lineScene.ts | 19 ++- .../AxleCountingSection.ts | 31 ++++- .../AxleCountingSectionAssistant.ts | 2 +- 8 files changed, 254 insertions(+), 14 deletions(-) create mode 100644 src/components/line-app/states/AxleCountingSectionState.vue diff --git a/src/components/line-app/StateProperties.vue b/src/components/line-app/StateProperties.vue index adb2b83..308d232 100644 --- a/src/components/line-app/StateProperties.vue +++ b/src/components/line-app/StateProperties.vue @@ -37,6 +37,9 @@ + @@ -71,6 +74,8 @@ import { FloodGate } from 'src/graphics/floodGate/FloodGate'; import FloodGateState from './states/FloodGateState.vue'; import CarWashingState from './states/CarWashingState.vue'; import { CarWashing } from 'src/graphics/carWashing/CarWashing'; +import AxleCountingSectionState from './states/AxleCountingSectionState.vue'; +import { AxleCountingSection } from 'src/graphics/axleCountingSection/AxleCountingSection'; const lineStore = useLineStore(); diff --git a/src/components/line-app/states/AxleCountingSectionState.vue b/src/components/line-app/states/AxleCountingSectionState.vue new file mode 100644 index 0000000..64be335 --- /dev/null +++ b/src/components/line-app/states/AxleCountingSectionState.vue @@ -0,0 +1,115 @@ + + diff --git a/src/components/line-app/states/SectionState.vue b/src/components/line-app/states/SectionState.vue index 6468f7a..8baf77c 100644 --- a/src/components/line-app/states/SectionState.vue +++ b/src/components/line-app/states/SectionState.vue @@ -68,8 +68,8 @@ interface KeyType { const list: KeyType[] = [ { label: '轨道索引', key: 'id' }, { label: '轨道名称', key: 'code' }, - { label: '是否占用', key: 'axleFault', formatFn: getName }, - { label: '是否计轴故障', key: 'occupied', formatFn: getName }, + { label: '是否占用', key: 'occupied', formatFn: getName }, + { label: '是否计轴故障', key: 'axleFault', formatFn: getName }, { label: '是否计轴复位', key: 'axleDrst', formatFn: getName }, { label: '是否计轴预复位', key: 'axlePdrst', formatFn: getName }, ]; diff --git a/src/drawApp/graphics/AxleCountingSectionInteraction.ts b/src/drawApp/graphics/AxleCountingSectionInteraction.ts index 4372843..60e5b4d 100644 --- a/src/drawApp/graphics/AxleCountingSectionInteraction.ts +++ b/src/drawApp/graphics/AxleCountingSectionInteraction.ts @@ -1,12 +1,17 @@ import * as pb_1 from 'google-protobuf'; -import { GraphicDataBase } from './GraphicDataBase'; +import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase'; import { IAxleCountingSectionData, AxleCountingSection, ITurnoutPosRefData, + IAxleCountingSectionState, } from 'src/graphics/axleCountingSection/AxleCountingSection'; import { graphicData } from 'src/protos/stationLayoutGraphics'; import { IPointData } from 'pixi.js'; +import { state } from 'src/protos/device_state'; +import { useLineStore } from 'src/stores/line-store'; +import { GraphicInteractionPlugin, IGraphicScene, JlGraphic } from 'jl-graphic'; +import { AxleCountingSectionGraphicHitArea } from 'src/graphics/axleCountingSection/AxleCountingSectionAssistant'; export class AxleCountingSectionData extends GraphicDataBase @@ -68,3 +73,84 @@ export class AxleCountingSectionData return pb_1.Message.equals(this.data, other.data); } } + +export class AxleCountingSectionStates + extends GraphicStateBase + implements IAxleCountingSectionState +{ + constructor(proto?: state.AxleCountingSectionState) { + let states; + if (proto) { + states = proto; + } else { + states = new state.AxleCountingSectionState(); + } + super(states, AxleCountingSection.Type); + } + get code(): string { + return this.states.id + ''; + } + get id(): number { + return this.states.id; + } + set id(id: number) { + this.states.id = id; + } + get occupied(): boolean { + return this.states.occupied; + } + set occupied(occupied: boolean) { + this.states.occupied = occupied; + } + get states(): state.AxleCountingSectionState { + return this.getState(); + } + clone(): AxleCountingSectionStates { + return new AxleCountingSectionStates(this.states.cloneMessage()); + } + copyFrom(data: GraphicStateBase): void { + pb_1.Message.copyInto(data._state, this._state); + } + eq(data: GraphicStateBase): boolean { + return pb_1.Message.equals(this._state, data._state); + } +} + +export class AxleCountingSectionOperateInteraction extends GraphicInteractionPlugin { + static Name = 'AxleCountingSection_operate_menu'; + constructor(app: IGraphicScene) { + super(AxleCountingSectionOperateInteraction.Name, app); + } + static init(app: IGraphicScene) { + return new AxleCountingSectionOperateInteraction(app); + } + filter(...grahpics: JlGraphic[]): AxleCountingSection[] | undefined { + return grahpics + .filter((g) => g.type === AxleCountingSection.Type) + .map((g) => g as AxleCountingSection); + } + bind(g: AxleCountingSection): void { + g.lineGraphic.eventMode = 'static'; + g.lineGraphic.cursor = 'pointer'; + g.lineGraphic.hitArea = new AxleCountingSectionGraphicHitArea(g); + g.lineGraphic.selectable = true; + g.selectable = true; + g.labelGraphic.eventMode = 'static'; + g.labelGraphic.cursor = 'pointer'; + g.labelGraphic.selectable = true; + g.on('_leftclick', this.onLeftClick, this); + } + + unbind(g: AxleCountingSection): void { + g.lineGraphic.eventMode = 'none'; + g.lineGraphic.scalable = false; + g.lineGraphic.selectable = false; + g.selectable = false; + g.labelGraphic.eventMode = 'none'; + g.labelGraphic.selectable = false; + g.off('_leftclick', this.onLeftClick, this); + } + onLeftClick() { + useLineStore().stateProCountIncrease(); + } +} diff --git a/src/drawApp/jkApp.ts b/src/drawApp/jkApp.ts index dcf3350..1f5837c 100644 --- a/src/drawApp/jkApp.ts +++ b/src/drawApp/jkApp.ts @@ -16,7 +16,7 @@ import { AxleCountingSectionTemplate, } from 'src/graphics/axleCountingSection/AxleCountingSection'; import { AxleCountingSectionDraw } from 'src/graphics/axleCountingSection/AxleCountingSectionAssistant'; -import { AxleCountingSectionData } from './graphics/AxleCountingSectionInteraction'; +import { AxleCountingSectionData, AxleCountingSectionStates } from './graphics/AxleCountingSectionInteraction'; import { SectionLink, SectionLinkTemplate, @@ -104,7 +104,7 @@ export function initJkDrawApp(): IDrawApp { new SectionLinkDraw(app, new SectionLinkTemplate(new SectionLinkData())); new AxleCountingSectionDraw( app, - new AxleCountingSectionTemplate(new AxleCountingSectionData()) + new AxleCountingSectionTemplate(new AxleCountingSectionData(), new AxleCountingSectionStates()) ); new EsbButtonDraw( app, diff --git a/src/drawApp/lineScene.ts b/src/drawApp/lineScene.ts index 9199b75..a6dff24 100644 --- a/src/drawApp/lineScene.ts +++ b/src/drawApp/lineScene.ts @@ -106,7 +106,11 @@ import { SectionLinkData, SectionLinkOperateInteraction, } from './graphics/SectionLinkInteraction'; -import { AxleCountingSectionData } from './graphics/AxleCountingSectionInteraction'; +import { + AxleCountingSectionData, + AxleCountingSectionOperateInteraction, + AxleCountingSectionStates, +} from './graphics/AxleCountingSectionInteraction'; import { LogicSectionData } from './graphics/LogicSectionInteraction'; import { Notify, QNotifyUpdateOptions, Dialog } from 'quasar'; import { @@ -308,7 +312,10 @@ export function initLineScene(lineApp: IGraphicApp, sceneName: string) { new TrainWindowTemplate(new TrainWindowData()), new SeparatorTemplate(new SeparatorData()), new SectionLinkTemplate(new SectionLinkData()), - new AxleCountingSectionTemplate(new AxleCountingSectionData()), + new AxleCountingSectionTemplate( + new AxleCountingSectionData(), + new AxleCountingSectionStates() + ), new LogicSectionTemplate(new LogicSectionData()), new StopPositionTemplate(new StopPositionData()), new SpksSwitchTemplate(new SpksSwitchData()), @@ -353,6 +360,9 @@ export function initLineScene(lineApp: IGraphicApp, sceneName: string) { if (categoryType === CategoryType.TH) { GatedBoxOperateInteraction.init(lineScene); } + if (categoryType === CategoryType.JK) { + AxleCountingSectionOperateInteraction.init(lineScene); + } // 画布右键菜单 lineScene.registerMenu(DefaultCanvasMenu); lineScene.canvas.on('_rightclick', (e) => { @@ -424,6 +434,11 @@ function handleSubscribe(lineScene: IGraphicScene) { states.push(new SectionStates(item)); } }); + storage.allStatus.axleCountingSection.forEach((item) => { + if (item.id) { + states.push(new AxleCountingSectionStates(item)); + } + }); storage.allStatus.psdState.forEach((item) => { if (item.id) { states.push(new ScreenDoorState(item)); diff --git a/src/graphics/axleCountingSection/AxleCountingSection.ts b/src/graphics/axleCountingSection/AxleCountingSection.ts index 806cba9..6cbb627 100644 --- a/src/graphics/axleCountingSection/AxleCountingSection.ts +++ b/src/graphics/axleCountingSection/AxleCountingSection.ts @@ -2,6 +2,7 @@ import { Graphics, IPointData } from 'pixi.js'; import { GraphicData, GraphicRelationParam, + GraphicState, JlGraphic, JlGraphicTemplate, VectorText, @@ -9,6 +10,7 @@ import { } from 'jl-graphic'; import { IRelatedRefData, protoPort2Data } from '../CommonGraphics'; import { DevicePort } from '../section/Section'; +import { state } from 'src/protos/device_state'; export interface ITurnoutPosRefData { get id(): number; //道岔的ID @@ -34,10 +36,17 @@ export interface IAxleCountingSectionData extends GraphicData { } export const AxleCountingSectionConsts = { - lineColor: '0xff0000', - lineWidth: 2, + lineColor: '#5578b6', + occupiedColor: '#f00', + lineWidth: 5, }; +export interface IAxleCountingSectionState extends GraphicState { + id: number; + type?: state.SectionType; + occupied?: boolean; //计轴区段占用 +} + export class AxleCountingSection extends JlGraphic { static Type = 'AxleCountingSection'; lineGraphic: Graphics; @@ -48,7 +57,7 @@ export class AxleCountingSection extends JlGraphic { this.labelGraphic = new VectorText(); this.labelGraphic.setVectorFontSize(14); this.labelGraphic.anchor.set(0.5); - this.labelGraphic.style.fill = '0xff0000'; + this.labelGraphic.style.fill = '0xffffff'; this.labelGraphic.transformSave = true; this.labelGraphic.name = 'label'; this.transformSave = true; @@ -61,6 +70,9 @@ export class AxleCountingSection extends JlGraphic { get datas(): IAxleCountingSectionData { return this.getDatas(); } + get states(): IAxleCountingSectionState { + return this.getStates(); + } doRepaint(): void { if (this.datas.points.length < 2) { throw new Error('AxleCountingSection坐标数据异常'); @@ -68,7 +80,9 @@ export class AxleCountingSection extends JlGraphic { this.lineGraphic.clear(); this.lineGraphic.lineStyle( AxleCountingSectionConsts.lineWidth, - AxleCountingSectionConsts.lineColor + this.states.occupied + ? AxleCountingSectionConsts.occupiedColor + : AxleCountingSectionConsts.lineColor ); this.datas.points.forEach((p, i) => { if (i !== 0) { @@ -77,7 +91,7 @@ export class AxleCountingSection extends JlGraphic { this.lineGraphic.moveTo(p.x, p.y); } }); - this.labelGraphic.text = this.datas.code; + this.labelGraphic.text = this.datas.code + '(计)'; const labelPosition = this.datas.childTransforms?.find( (t) => t.name === this.labelGraphic.name )?.transform.position; @@ -133,14 +147,19 @@ export class AxleCountingSection extends JlGraphic { } export class AxleCountingSectionTemplate extends JlGraphicTemplate { - constructor(dataTemplate: IAxleCountingSectionData) { + constructor( + dataTemplate: IAxleCountingSectionData, + stateTemplate?: IAxleCountingSectionState + ) { super(AxleCountingSection.Type, { dataTemplate, + stateTemplate, }); } new(): AxleCountingSection { const axleCountingSection = new AxleCountingSection(); axleCountingSection.loadData(this.datas); + axleCountingSection.loadState(this.states); return axleCountingSection; } } diff --git a/src/graphics/axleCountingSection/AxleCountingSectionAssistant.ts b/src/graphics/axleCountingSection/AxleCountingSectionAssistant.ts index 0c775b8..4f32ece 100644 --- a/src/graphics/axleCountingSection/AxleCountingSectionAssistant.ts +++ b/src/graphics/axleCountingSection/AxleCountingSectionAssistant.ts @@ -246,7 +246,7 @@ export class AxleCountingSectionDraw extends GraphicDrawAssistant< }); } } -class AxleCountingSectionGraphicHitArea implements IHitArea { +export class AxleCountingSectionGraphicHitArea implements IHitArea { axleCountingSection: AxleCountingSection; constructor(axleCountingSection: AxleCountingSection) { this.axleCountingSection = axleCountingSection; From 5313a00dc6de037052640b5c4179c36fbdf8a48a Mon Sep 17 00:00:00 2001 From: fan Date: Wed, 21 Aug 2024 16:57:21 +0800 Subject: [PATCH 2/5] =?UTF-8?q?proto=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rts-sim-testing-message | 2 +- src/protos/device_state.ts | 503 ++++++++++++++++++---------- src/protos/stationLayoutGraphics.ts | 121 ++++++- src/protos/tccGraphics.ts | 3 +- 4 files changed, 445 insertions(+), 184 deletions(-) diff --git a/rts-sim-testing-message b/rts-sim-testing-message index 74bea4e..30f6530 160000 --- a/rts-sim-testing-message +++ b/rts-sim-testing-message @@ -1 +1 @@ -Subproject commit 74bea4e9955524f7254876c90af08d963f666585 +Subproject commit 30f6530a925f672eb0e5e6e3654b72865c2598df diff --git a/src/protos/device_state.ts b/src/protos/device_state.ts index 56d308f..551e1d2 100644 --- a/src/protos/device_state.ts +++ b/src/protos/device_state.ts @@ -1280,6 +1280,7 @@ export namespace state { vobcBtm?: VobcBtmState; oldLink?: string; oldLinkOffset?: number; + btmBaliseCache?: TrainBtmCache; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); @@ -1371,6 +1372,9 @@ export namespace state { if ("oldLinkOffset" in data && data.oldLinkOffset != undefined) { this.oldLinkOffset = data.oldLinkOffset; } + if ("btmBaliseCache" in data && data.btmBaliseCache != undefined) { + this.btmBaliseCache = data.btmBaliseCache; + } } } get id() { @@ -1577,6 +1581,15 @@ export namespace state { set oldLinkOffset(value: number) { pb_1.Message.setField(this, 29, value); } + get btmBaliseCache() { + return pb_1.Message.getWrapperField(this, TrainBtmCache, 30) as TrainBtmCache; + } + set btmBaliseCache(value: TrainBtmCache) { + pb_1.Message.setWrapperField(this, 30, value); + } + get has_btmBaliseCache() { + return pb_1.Message.getField(this, 30) != null; + } static fromObject(data: { id?: string; up?: boolean; @@ -1607,6 +1620,7 @@ export namespace state { vobcBtm?: ReturnType; oldLink?: string; oldLinkOffset?: number; + btmBaliseCache?: ReturnType; }): TrainState { const message = new TrainState({}); if (data.id != null) { @@ -1696,6 +1710,9 @@ export namespace state { if (data.oldLinkOffset != null) { message.oldLinkOffset = data.oldLinkOffset; } + if (data.btmBaliseCache != null) { + message.btmBaliseCache = TrainBtmCache.fromObject(data.btmBaliseCache); + } return message; } toObject() { @@ -1729,6 +1746,7 @@ export namespace state { vobcBtm?: ReturnType; oldLink?: string; oldLinkOffset?: number; + btmBaliseCache?: ReturnType; } = {}; if (this.id != null) { data.id = this.id; @@ -1817,6 +1835,9 @@ export namespace state { if (this.oldLinkOffset != null) { data.oldLinkOffset = this.oldLinkOffset; } + if (this.btmBaliseCache != null) { + data.btmBaliseCache = this.btmBaliseCache.toObject(); + } return data; } serialize(): Uint8Array; @@ -1881,6 +1902,8 @@ export namespace state { writer.writeString(28, this.oldLink); if (this.oldLinkOffset != 0) writer.writeInt64(29, this.oldLinkOffset); + if (this.has_btmBaliseCache) + writer.writeMessage(30, this.btmBaliseCache, () => this.btmBaliseCache.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -1977,6 +2000,9 @@ export namespace state { case 29: message.oldLinkOffset = reader.readInt64(); break; + case 30: + reader.readMessage(message.btmBaliseCache, () => message.btmBaliseCache = TrainBtmCache.deserialize(reader)); + break; default: reader.skipField(); } } @@ -1989,6 +2015,165 @@ export namespace state { return TrainState.deserialize(bytes); } } + export class TrainBtmCache extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + dsn?: number; + baliseCount?: number; + messageCounter?: number; + resendBaliseId?: string; + baliseList?: BTMState[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [5], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("dsn" in data && data.dsn != undefined) { + this.dsn = data.dsn; + } + if ("baliseCount" in data && data.baliseCount != undefined) { + this.baliseCount = data.baliseCount; + } + if ("messageCounter" in data && data.messageCounter != undefined) { + this.messageCounter = data.messageCounter; + } + if ("resendBaliseId" in data && data.resendBaliseId != undefined) { + this.resendBaliseId = data.resendBaliseId; + } + if ("baliseList" in data && data.baliseList != undefined) { + this.baliseList = data.baliseList; + } + } + } + get dsn() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; + } + set dsn(value: number) { + pb_1.Message.setField(this, 1, value); + } + get baliseCount() { + return pb_1.Message.getFieldWithDefault(this, 2, 0) as number; + } + set baliseCount(value: number) { + pb_1.Message.setField(this, 2, value); + } + get messageCounter() { + return pb_1.Message.getFieldWithDefault(this, 3, 0) as number; + } + set messageCounter(value: number) { + pb_1.Message.setField(this, 3, value); + } + get resendBaliseId() { + return pb_1.Message.getFieldWithDefault(this, 4, "") as string; + } + set resendBaliseId(value: string) { + pb_1.Message.setField(this, 4, value); + } + get baliseList() { + return pb_1.Message.getRepeatedWrapperField(this, BTMState, 5) as BTMState[]; + } + set baliseList(value: BTMState[]) { + pb_1.Message.setRepeatedWrapperField(this, 5, value); + } + static fromObject(data: { + dsn?: number; + baliseCount?: number; + messageCounter?: number; + resendBaliseId?: string; + baliseList?: ReturnType[]; + }): TrainBtmCache { + const message = new TrainBtmCache({}); + if (data.dsn != null) { + message.dsn = data.dsn; + } + if (data.baliseCount != null) { + message.baliseCount = data.baliseCount; + } + if (data.messageCounter != null) { + message.messageCounter = data.messageCounter; + } + if (data.resendBaliseId != null) { + message.resendBaliseId = data.resendBaliseId; + } + if (data.baliseList != null) { + message.baliseList = data.baliseList.map(item => BTMState.fromObject(item)); + } + return message; + } + toObject() { + const data: { + dsn?: number; + baliseCount?: number; + messageCounter?: number; + resendBaliseId?: string; + baliseList?: ReturnType[]; + } = {}; + if (this.dsn != null) { + data.dsn = this.dsn; + } + if (this.baliseCount != null) { + data.baliseCount = this.baliseCount; + } + if (this.messageCounter != null) { + data.messageCounter = this.messageCounter; + } + if (this.resendBaliseId != null) { + data.resendBaliseId = this.resendBaliseId; + } + if (this.baliseList != null) { + data.baliseList = this.baliseList.map((item: BTMState) => 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.dsn != 0) + writer.writeUint32(1, this.dsn); + if (this.baliseCount != 0) + writer.writeUint32(2, this.baliseCount); + if (this.messageCounter != 0) + writer.writeUint32(3, this.messageCounter); + if (this.resendBaliseId.length) + writer.writeString(4, this.resendBaliseId); + if (this.baliseList.length) + writer.writeRepeatedMessage(5, this.baliseList, (item: BTMState) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TrainBtmCache { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TrainBtmCache(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.dsn = reader.readUint32(); + break; + case 2: + message.baliseCount = reader.readUint32(); + break; + case 3: + message.messageCounter = reader.readUint32(); + break; + case 4: + message.resendBaliseId = reader.readString(); + break; + case 5: + reader.readMessage(message.baliseList, () => pb_1.Message.addToRepeatedWrapperField(message, 5, BTMState.deserialize(reader), BTMState)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): TrainBtmCache { + return TrainBtmCache.deserialize(bytes); + } + } export class VobcBtmState extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { @@ -3202,6 +3387,7 @@ export namespace state { lightDir1?: boolean; lightDir2?: boolean; lightDriverActive?: boolean; + trainConnInitComplate?: boolean; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); @@ -3437,6 +3623,9 @@ export namespace state { if ("lightDriverActive" in data && data.lightDriverActive != undefined) { this.lightDriverActive = data.lightDriverActive; } + if ("trainConnInitComplate" in data && data.trainConnInitComplate != undefined) { + this.trainConnInitComplate = data.trainConnInitComplate; + } } } get lifeSignal() { @@ -3901,6 +4090,12 @@ export namespace state { set lightDriverActive(value: boolean) { pb_1.Message.setField(this, 81, value); } + get trainConnInitComplate() { + return pb_1.Message.getFieldWithDefault(this, 82, false) as boolean; + } + set trainConnInitComplate(value: boolean) { + pb_1.Message.setField(this, 82, value); + } static fromObject(data: { lifeSignal?: number; tc1Active?: boolean; @@ -3979,6 +4174,7 @@ export namespace state { lightDir1?: boolean; lightDir2?: boolean; lightDriverActive?: boolean; + trainConnInitComplate?: boolean; }): TrainVobcState { const message = new TrainVobcState({}); if (data.lifeSignal != null) { @@ -4212,6 +4408,9 @@ export namespace state { if (data.lightDriverActive != null) { message.lightDriverActive = data.lightDriverActive; } + if (data.trainConnInitComplate != null) { + message.trainConnInitComplate = data.trainConnInitComplate; + } return message; } toObject() { @@ -4293,6 +4492,7 @@ export namespace state { lightDir1?: boolean; lightDir2?: boolean; lightDriverActive?: boolean; + trainConnInitComplate?: boolean; } = {}; if (this.lifeSignal != null) { data.lifeSignal = this.lifeSignal; @@ -4525,6 +4725,9 @@ export namespace state { if (this.lightDriverActive != null) { data.lightDriverActive = this.lightDriverActive; } + if (this.trainConnInitComplate != null) { + data.trainConnInitComplate = this.trainConnInitComplate; + } return data; } serialize(): Uint8Array; @@ -4685,6 +4888,8 @@ export namespace state { writer.writeBool(80, this.lightDir2); if (this.lightDriverActive != false) writer.writeBool(81, this.lightDriverActive); + if (this.trainConnInitComplate != false) + writer.writeBool(82, this.trainConnInitComplate); if (!w) return writer.getResultBuffer(); } @@ -4925,6 +5130,9 @@ export namespace state { case 81: message.lightDriverActive = reader.readBool(); break; + case 82: + message.trainConnInitComplate = reader.readBool(); + break; default: reader.skipField(); } } @@ -6606,105 +6814,26 @@ export namespace state { return TrainMapState.deserialize(bytes); } } - export class BtmStateCache extends pb_1.Message { - #one_of_decls: number[][] = []; - constructor(data?: any[] | { - btmStateList?: BTMState[]; - }) { - super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls); - if (!Array.isArray(data) && typeof data == "object") { - if ("btmStateList" in data && data.btmStateList != undefined) { - this.btmStateList = data.btmStateList; - } - } - } - get btmStateList() { - return pb_1.Message.getRepeatedWrapperField(this, BTMState, 1) as BTMState[]; - } - set btmStateList(value: BTMState[]) { - pb_1.Message.setRepeatedWrapperField(this, 1, value); - } - static fromObject(data: { - btmStateList?: ReturnType[]; - }): BtmStateCache { - const message = new BtmStateCache({}); - if (data.btmStateList != null) { - message.btmStateList = data.btmStateList.map(item => BTMState.fromObject(item)); - } - return message; - } - toObject() { - const data: { - btmStateList?: ReturnType[]; - } = {}; - if (this.btmStateList != null) { - data.btmStateList = this.btmStateList.map((item: BTMState) => 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.btmStateList.length) - writer.writeRepeatedMessage(1, this.btmStateList, (item: BTMState) => item.serialize(writer)); - if (!w) - return writer.getResultBuffer(); - } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): BtmStateCache { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new BtmStateCache(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.btmStateList, () => pb_1.Message.addToRepeatedWrapperField(message, 1, BTMState.deserialize(reader), BTMState)); - break; - default: reader.skipField(); - } - } - return message; - } - serializeBinary(): Uint8Array { - return this.serialize(); - } - static deserializeBinary(bytes: Uint8Array): BtmStateCache { - return BtmStateCache.deserialize(bytes); - } - } export class BTMState extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { - dataSerialNumber?: number; - baliseCount?: number; - messageCounter?: number; telegram?: string; - distance?: number; aboveBalise?: boolean; baliseTelegramForPcSimResend?: string; telegram128?: string; baliseId?: string; isSend?: boolean; + unpack?: boolean; + baliseType?: number; + hasData?: boolean; + resendCount?: 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 ("dataSerialNumber" in data && data.dataSerialNumber != undefined) { - this.dataSerialNumber = data.dataSerialNumber; - } - if ("baliseCount" in data && data.baliseCount != undefined) { - this.baliseCount = data.baliseCount; - } - if ("messageCounter" in data && data.messageCounter != undefined) { - this.messageCounter = data.messageCounter; - } if ("telegram" in data && data.telegram != undefined) { this.telegram = data.telegram; } - if ("distance" in data && data.distance != undefined) { - this.distance = data.distance; - } if ("aboveBalise" in data && data.aboveBalise != undefined) { this.aboveBalise = data.aboveBalise; } @@ -6720,96 +6849,96 @@ export namespace state { if ("isSend" in data && data.isSend != undefined) { this.isSend = data.isSend; } + if ("unpack" in data && data.unpack != undefined) { + this.unpack = data.unpack; + } + if ("baliseType" in data && data.baliseType != undefined) { + this.baliseType = data.baliseType; + } + if ("hasData" in data && data.hasData != undefined) { + this.hasData = data.hasData; + } + if ("resendCount" in data && data.resendCount != undefined) { + this.resendCount = data.resendCount; + } } } - get dataSerialNumber() { - return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; - } - set dataSerialNumber(value: number) { - pb_1.Message.setField(this, 1, value); - } - get baliseCount() { - return pb_1.Message.getFieldWithDefault(this, 2, 0) as number; - } - set baliseCount(value: number) { - pb_1.Message.setField(this, 2, value); - } - get messageCounter() { - return pb_1.Message.getFieldWithDefault(this, 3, 0) as number; - } - set messageCounter(value: number) { - pb_1.Message.setField(this, 3, value); - } get telegram() { - return pb_1.Message.getFieldWithDefault(this, 4, "") as string; + return pb_1.Message.getFieldWithDefault(this, 1, "") as string; } set telegram(value: string) { - pb_1.Message.setField(this, 4, value); - } - get distance() { - return pb_1.Message.getFieldWithDefault(this, 5, 0) as number; - } - set distance(value: number) { - pb_1.Message.setField(this, 5, value); + pb_1.Message.setField(this, 1, value); } get aboveBalise() { - return pb_1.Message.getFieldWithDefault(this, 6, false) as boolean; + return pb_1.Message.getFieldWithDefault(this, 2, false) as boolean; } set aboveBalise(value: boolean) { - pb_1.Message.setField(this, 6, value); + pb_1.Message.setField(this, 2, value); } get baliseTelegramForPcSimResend() { - return pb_1.Message.getFieldWithDefault(this, 7, "") as string; + return pb_1.Message.getFieldWithDefault(this, 3, "") as string; } set baliseTelegramForPcSimResend(value: string) { - pb_1.Message.setField(this, 7, value); + pb_1.Message.setField(this, 3, value); } get telegram128() { - return pb_1.Message.getFieldWithDefault(this, 8, "") as string; + return pb_1.Message.getFieldWithDefault(this, 4, "") as string; } set telegram128(value: string) { - pb_1.Message.setField(this, 8, value); + pb_1.Message.setField(this, 4, value); } get baliseId() { - return pb_1.Message.getFieldWithDefault(this, 9, "") as string; + return pb_1.Message.getFieldWithDefault(this, 5, "") as string; } set baliseId(value: string) { - pb_1.Message.setField(this, 9, value); + pb_1.Message.setField(this, 5, value); } get isSend() { - return pb_1.Message.getFieldWithDefault(this, 10, false) as boolean; + return pb_1.Message.getFieldWithDefault(this, 6, false) as boolean; } set isSend(value: boolean) { + pb_1.Message.setField(this, 6, value); + } + get unpack() { + return pb_1.Message.getFieldWithDefault(this, 7, false) as boolean; + } + set unpack(value: boolean) { + pb_1.Message.setField(this, 7, value); + } + get baliseType() { + return pb_1.Message.getFieldWithDefault(this, 8, 0) as number; + } + set baliseType(value: number) { + pb_1.Message.setField(this, 8, value); + } + get hasData() { + return pb_1.Message.getFieldWithDefault(this, 9, false) as boolean; + } + set hasData(value: boolean) { + pb_1.Message.setField(this, 9, value); + } + get resendCount() { + return pb_1.Message.getFieldWithDefault(this, 10, 0) as number; + } + set resendCount(value: number) { pb_1.Message.setField(this, 10, value); } static fromObject(data: { - dataSerialNumber?: number; - baliseCount?: number; - messageCounter?: number; telegram?: string; - distance?: number; aboveBalise?: boolean; baliseTelegramForPcSimResend?: string; telegram128?: string; baliseId?: string; isSend?: boolean; + unpack?: boolean; + baliseType?: number; + hasData?: boolean; + resendCount?: number; }): BTMState { const message = new BTMState({}); - if (data.dataSerialNumber != null) { - message.dataSerialNumber = data.dataSerialNumber; - } - if (data.baliseCount != null) { - message.baliseCount = data.baliseCount; - } - if (data.messageCounter != null) { - message.messageCounter = data.messageCounter; - } if (data.telegram != null) { message.telegram = data.telegram; } - if (data.distance != null) { - message.distance = data.distance; - } if (data.aboveBalise != null) { message.aboveBalise = data.aboveBalise; } @@ -6825,36 +6954,36 @@ export namespace state { if (data.isSend != null) { message.isSend = data.isSend; } + if (data.unpack != null) { + message.unpack = data.unpack; + } + if (data.baliseType != null) { + message.baliseType = data.baliseType; + } + if (data.hasData != null) { + message.hasData = data.hasData; + } + if (data.resendCount != null) { + message.resendCount = data.resendCount; + } return message; } toObject() { const data: { - dataSerialNumber?: number; - baliseCount?: number; - messageCounter?: number; telegram?: string; - distance?: number; aboveBalise?: boolean; baliseTelegramForPcSimResend?: string; telegram128?: string; baliseId?: string; isSend?: boolean; + unpack?: boolean; + baliseType?: number; + hasData?: boolean; + resendCount?: number; } = {}; - if (this.dataSerialNumber != null) { - data.dataSerialNumber = this.dataSerialNumber; - } - if (this.baliseCount != null) { - data.baliseCount = this.baliseCount; - } - if (this.messageCounter != null) { - data.messageCounter = this.messageCounter; - } if (this.telegram != null) { data.telegram = this.telegram; } - if (this.distance != null) { - data.distance = this.distance; - } if (this.aboveBalise != null) { data.aboveBalise = this.aboveBalise; } @@ -6870,32 +6999,44 @@ export namespace state { if (this.isSend != null) { data.isSend = this.isSend; } + if (this.unpack != null) { + data.unpack = this.unpack; + } + if (this.baliseType != null) { + data.baliseType = this.baliseType; + } + if (this.hasData != null) { + data.hasData = this.hasData; + } + if (this.resendCount != null) { + data.resendCount = this.resendCount; + } 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.dataSerialNumber != 0) - writer.writeUint32(1, this.dataSerialNumber); - if (this.baliseCount != 0) - writer.writeUint32(2, this.baliseCount); - if (this.messageCounter != 0) - writer.writeUint32(3, this.messageCounter); if (this.telegram.length) - writer.writeString(4, this.telegram); - if (this.distance != 0) - writer.writeInt64(5, this.distance); + writer.writeString(1, this.telegram); if (this.aboveBalise != false) - writer.writeBool(6, this.aboveBalise); + writer.writeBool(2, this.aboveBalise); if (this.baliseTelegramForPcSimResend.length) - writer.writeString(7, this.baliseTelegramForPcSimResend); + writer.writeString(3, this.baliseTelegramForPcSimResend); if (this.telegram128.length) - writer.writeString(8, this.telegram128); + writer.writeString(4, this.telegram128); if (this.baliseId.length) - writer.writeString(9, this.baliseId); + writer.writeString(5, this.baliseId); if (this.isSend != false) - writer.writeBool(10, this.isSend); + writer.writeBool(6, this.isSend); + if (this.unpack != false) + writer.writeBool(7, this.unpack); + if (this.baliseType != 0) + writer.writeInt32(8, this.baliseType); + if (this.hasData != false) + writer.writeBool(9, this.hasData); + if (this.resendCount != 0) + writer.writeUint32(10, this.resendCount); if (!w) return writer.getResultBuffer(); } @@ -6906,35 +7047,35 @@ export namespace state { break; switch (reader.getFieldNumber()) { case 1: - message.dataSerialNumber = reader.readUint32(); - break; - case 2: - message.baliseCount = reader.readUint32(); - break; - case 3: - message.messageCounter = reader.readUint32(); - break; - case 4: message.telegram = reader.readString(); break; - case 5: - message.distance = reader.readInt64(); - break; - case 6: + case 2: message.aboveBalise = reader.readBool(); break; - case 7: + case 3: message.baliseTelegramForPcSimResend = reader.readString(); break; - case 8: + case 4: message.telegram128 = reader.readString(); break; - case 9: + case 5: message.baliseId = reader.readString(); break; - case 10: + case 6: message.isSend = reader.readBool(); break; + case 7: + message.unpack = reader.readBool(); + break; + case 8: + message.baliseType = reader.readInt32(); + break; + case 9: + message.hasData = reader.readBool(); + break; + case 10: + message.resendCount = reader.readUint32(); + break; default: reader.skipField(); } } diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts index 1e1f75d..38af44f 100644 --- a/src/protos/stationLayoutGraphics.ts +++ b/src/protos/stationLayoutGraphics.ts @@ -58,9 +58,10 @@ export namespace graphicData { lianSuoData?: LianSuoData; holdButtons?: HoldButton[]; unattengedButtons?: UnattengedButton[]; + kilometerMarkCalibrations?: KilometerMarkCalibration[]; }) { 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, 50, 51], 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, 52], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("canvas" in data && data.canvas != undefined) { this.canvas = data.canvas; @@ -197,6 +198,9 @@ export namespace graphicData { if ("unattengedButtons" in data && data.unattengedButtons != undefined) { this.unattengedButtons = data.unattengedButtons; } + if ("kilometerMarkCalibrations" in data && data.kilometerMarkCalibrations != undefined) { + this.kilometerMarkCalibrations = data.kilometerMarkCalibrations; + } } } get canvas() { @@ -484,6 +488,12 @@ export namespace graphicData { set unattengedButtons(value: UnattengedButton[]) { pb_1.Message.setRepeatedWrapperField(this, 51, value); } + get kilometerMarkCalibrations() { + return pb_1.Message.getRepeatedWrapperField(this, KilometerMarkCalibration, 52) as KilometerMarkCalibration[]; + } + set kilometerMarkCalibrations(value: KilometerMarkCalibration[]) { + pb_1.Message.setRepeatedWrapperField(this, 52, value); + } static fromObject(data: { canvas?: ReturnType; Platforms?: ReturnType[]; @@ -530,6 +540,7 @@ export namespace graphicData { lianSuoData?: ReturnType; holdButtons?: ReturnType[]; unattengedButtons?: ReturnType[]; + kilometerMarkCalibrations?: ReturnType[]; }): RtssGraphicStorage { const message = new RtssGraphicStorage({}); if (data.canvas != null) { @@ -667,6 +678,9 @@ export namespace graphicData { if (data.unattengedButtons != null) { message.unattengedButtons = data.unattengedButtons.map(item => UnattengedButton.fromObject(item)); } + if (data.kilometerMarkCalibrations != null) { + message.kilometerMarkCalibrations = data.kilometerMarkCalibrations.map(item => KilometerMarkCalibration.fromObject(item)); + } return message; } toObject() { @@ -716,6 +730,7 @@ export namespace graphicData { lianSuoData?: ReturnType; holdButtons?: ReturnType[]; unattengedButtons?: ReturnType[]; + kilometerMarkCalibrations?: ReturnType[]; } = {}; if (this.canvas != null) { data.canvas = this.canvas.toObject(); @@ -852,6 +867,9 @@ export namespace graphicData { if (this.unattengedButtons != null) { data.unattengedButtons = this.unattengedButtons.map((item: UnattengedButton) => item.toObject()); } + if (this.kilometerMarkCalibrations != null) { + data.kilometerMarkCalibrations = this.kilometerMarkCalibrations.map((item: KilometerMarkCalibration) => item.toObject()); + } return data; } serialize(): Uint8Array; @@ -948,6 +966,8 @@ export namespace graphicData { 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 (this.kilometerMarkCalibrations.length) + writer.writeRepeatedMessage(52, this.kilometerMarkCalibrations, (item: KilometerMarkCalibration) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -1092,6 +1112,9 @@ export namespace graphicData { case 51: reader.readMessage(message.unattengedButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 51, UnattengedButton.deserialize(reader), UnattengedButton)); break; + case 52: + reader.readMessage(message.kilometerMarkCalibrations, () => pb_1.Message.addToRepeatedWrapperField(message, 52, KilometerMarkCalibration.deserialize(reader), KilometerMarkCalibration)); + break; default: reader.skipField(); } } @@ -10023,4 +10046,100 @@ export namespace graphicData { return HoldButton.deserialize(bytes); } } + export class KilometerMarkCalibration extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + actualKm?: KilometerSystem; + designKm?: KilometerSystem; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("actualKm" in data && data.actualKm != undefined) { + this.actualKm = data.actualKm; + } + if ("designKm" in data && data.designKm != undefined) { + this.designKm = data.designKm; + } + } + } + get actualKm() { + return pb_1.Message.getWrapperField(this, KilometerSystem, 1) as KilometerSystem; + } + set actualKm(value: KilometerSystem) { + pb_1.Message.setWrapperField(this, 1, value); + } + get has_actualKm() { + return pb_1.Message.getField(this, 1) != null; + } + get designKm() { + return pb_1.Message.getWrapperField(this, KilometerSystem, 2) as KilometerSystem; + } + set designKm(value: KilometerSystem) { + pb_1.Message.setWrapperField(this, 2, value); + } + get has_designKm() { + return pb_1.Message.getField(this, 2) != null; + } + static fromObject(data: { + actualKm?: ReturnType; + designKm?: ReturnType; + }): KilometerMarkCalibration { + const message = new KilometerMarkCalibration({}); + if (data.actualKm != null) { + message.actualKm = KilometerSystem.fromObject(data.actualKm); + } + if (data.designKm != null) { + message.designKm = KilometerSystem.fromObject(data.designKm); + } + return message; + } + toObject() { + const data: { + actualKm?: ReturnType; + designKm?: ReturnType; + } = {}; + if (this.actualKm != null) { + data.actualKm = this.actualKm.toObject(); + } + if (this.designKm != null) { + data.designKm = this.designKm.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.has_actualKm) + writer.writeMessage(1, this.actualKm, () => this.actualKm.serialize(writer)); + if (this.has_designKm) + writer.writeMessage(2, this.designKm, () => this.designKm.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): KilometerMarkCalibration { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new KilometerMarkCalibration(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.actualKm, () => message.actualKm = KilometerSystem.deserialize(reader)); + break; + case 2: + reader.readMessage(message.designKm, () => message.designKm = KilometerSystem.deserialize(reader)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): KilometerMarkCalibration { + return KilometerMarkCalibration.deserialize(bytes); + } + } } diff --git a/src/protos/tccGraphics.ts b/src/protos/tccGraphics.ts index a054cc7..e3ccdea 100644 --- a/src/protos/tccGraphics.ts +++ b/src/protos/tccGraphics.ts @@ -593,7 +593,8 @@ export namespace tccGraphicData { export namespace TccKey { export enum TccKeyType { driverControllerActivationClint = 0, - frontAndRearDirectionalControl = 1 + frontAndRearDirectionalControl = 1, + trainDoorMode = 2 } } export class TccHandle extends pb_1.Message { From fe56bdc27da8c492cbe1cf4c84f34c8774137fa3 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Wed, 21 Aug 2024 17:37:48 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=97=8B=E9=92=AE=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/Simulation.ts | 2 +- src/protos/request.ts | 57 +++++++++++++++++++++-------------------- src/stores/tcc-store.ts | 2 +- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/api/Simulation.ts b/src/api/Simulation.ts index 753d809..26b250b 100644 --- a/src/api/Simulation.ts +++ b/src/api/Simulation.ts @@ -191,7 +191,7 @@ export interface TccOperationParams { controlType: request.TrainControl.TrainControlType; controlButton?: object; driverKey?: object; - dirKey?: object; + switchKey?: object; handler?: object; } export async function tccOperation(params: TccOperationParams) { diff --git a/src/protos/request.ts b/src/protos/request.ts index c23e593..1d99933 100644 --- a/src/protos/request.ts +++ b/src/protos/request.ts @@ -1423,7 +1423,7 @@ export namespace request { controlType?: TrainControl.TrainControlType; controlButton?: TrainControl.ControlButton; driverKey?: TrainControl.DriverKeySwitch; - dirKey?: TrainControl.DirectionKeySwitch; + switchKey?: TrainControl.SwitchKeyChange; handler?: TrainControl.PushHandler; }) { super(); @@ -1447,8 +1447,8 @@ export namespace request { if ("driverKey" in data && data.driverKey != undefined) { this.driverKey = data.driverKey; } - if ("dirKey" in data && data.dirKey != undefined) { - this.dirKey = data.dirKey; + if ("switchKey" in data && data.switchKey != undefined) { + this.switchKey = data.switchKey; } if ("handler" in data && data.handler != undefined) { this.handler = data.handler; @@ -1497,13 +1497,13 @@ export namespace request { get has_driverKey() { return pb_1.Message.getField(this, 6) != null; } - get dirKey() { - return pb_1.Message.getWrapperField(this, TrainControl.DirectionKeySwitch, 7) as TrainControl.DirectionKeySwitch; + get switchKey() { + return pb_1.Message.getWrapperField(this, TrainControl.SwitchKeyChange, 7) as TrainControl.SwitchKeyChange; } - set dirKey(value: TrainControl.DirectionKeySwitch) { + set switchKey(value: TrainControl.SwitchKeyChange) { pb_1.Message.setWrapperField(this, 7, value); } - get has_dirKey() { + get has_switchKey() { return pb_1.Message.getField(this, 7) != null; } get handler() { @@ -1522,7 +1522,7 @@ export namespace request { controlType?: TrainControl.TrainControlType; controlButton?: ReturnType; driverKey?: ReturnType; - dirKey?: ReturnType; + switchKey?: ReturnType; handler?: ReturnType; }): TrainControl { const message = new TrainControl({}); @@ -1544,8 +1544,8 @@ export namespace request { if (data.driverKey != null) { message.driverKey = TrainControl.DriverKeySwitch.fromObject(data.driverKey); } - if (data.dirKey != null) { - message.dirKey = TrainControl.DirectionKeySwitch.fromObject(data.dirKey); + if (data.switchKey != null) { + message.switchKey = TrainControl.SwitchKeyChange.fromObject(data.switchKey); } if (data.handler != null) { message.handler = TrainControl.PushHandler.fromObject(data.handler); @@ -1560,7 +1560,7 @@ export namespace request { controlType?: TrainControl.TrainControlType; controlButton?: ReturnType; driverKey?: ReturnType; - dirKey?: ReturnType; + switchKey?: ReturnType; handler?: ReturnType; } = {}; if (this.simulationId != null) { @@ -1581,8 +1581,8 @@ export namespace request { if (this.driverKey != null) { data.driverKey = this.driverKey.toObject(); } - if (this.dirKey != null) { - data.dirKey = this.dirKey.toObject(); + if (this.switchKey != null) { + data.switchKey = this.switchKey.toObject(); } if (this.handler != null) { data.handler = this.handler.toObject(); @@ -1605,8 +1605,8 @@ export namespace request { writer.writeMessage(5, this.controlButton, () => this.controlButton.serialize(writer)); if (this.has_driverKey) writer.writeMessage(6, this.driverKey, () => this.driverKey.serialize(writer)); - if (this.has_dirKey) - writer.writeMessage(7, this.dirKey, () => this.dirKey.serialize(writer)); + if (this.has_switchKey) + writer.writeMessage(7, this.switchKey, () => this.switchKey.serialize(writer)); if (this.has_handler) writer.writeMessage(8, this.handler, () => this.handler.serialize(writer)); if (!w) @@ -1637,7 +1637,7 @@ export namespace request { reader.readMessage(message.driverKey, () => message.driverKey = TrainControl.DriverKeySwitch.deserialize(reader)); break; case 7: - reader.readMessage(message.dirKey, () => message.dirKey = TrainControl.DirectionKeySwitch.deserialize(reader)); + reader.readMessage(message.switchKey, () => message.switchKey = TrainControl.SwitchKeyChange.deserialize(reader)); break; case 8: reader.readMessage(message.handler, () => message.handler = TrainControl.PushHandler.deserialize(reader)); @@ -1659,12 +1659,13 @@ export namespace request { EMERGENT_BUTTON = 0, DRIVER_KEY_SWITCH = 1, DIRECTION_KEY_SWITCH = 2, - HANDLER = 3 + HANDLER = 3, + TRAIN_DOOR_MODE_CHANGE = 4 } - export enum Direction { - BACKWARD = 0, - FORWARD = 1, - NEUTRALWARD = 2 + export enum KeyLocation { + KL_END = 0, + KL_FONT = 1, + KL_CENTER = 2 } export class ControlButton extends pb_1.Message { #one_of_decls: number[][] = []; @@ -1867,7 +1868,7 @@ export namespace request { return DriverKeySwitch.deserialize(bytes); } } - export class DirectionKeySwitch extends pb_1.Message { + export class SwitchKeyChange extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { val?: number; @@ -1888,8 +1889,8 @@ export namespace request { } static fromObject(data: { val?: number; - }): DirectionKeySwitch { - const message = new DirectionKeySwitch({}); + }): SwitchKeyChange { + const message = new SwitchKeyChange({}); if (data.val != null) { message.val = data.val; } @@ -1913,8 +1914,8 @@ export namespace request { if (!w) return writer.getResultBuffer(); } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DirectionKeySwitch { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DirectionKeySwitch(); + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SwitchKeyChange { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SwitchKeyChange(); while (reader.nextField()) { if (reader.isEndGroup()) break; @@ -1930,8 +1931,8 @@ export namespace request { serializeBinary(): Uint8Array { return this.serialize(); } - static deserializeBinary(bytes: Uint8Array): DirectionKeySwitch { - return DirectionKeySwitch.deserialize(bytes); + static deserializeBinary(bytes: Uint8Array): SwitchKeyChange { + return SwitchKeyChange.deserialize(bytes); } } export class PushHandler extends pb_1.Message { diff --git a/src/stores/tcc-store.ts b/src/stores/tcc-store.ts index 67892f8..29c2497 100644 --- a/src/stores/tcc-store.ts +++ b/src/stores/tcc-store.ts @@ -85,7 +85,7 @@ export const useTccStore = defineStore('tcc', { trainId: this.tccId + '', deviceId: this.tccKeyDirId, controlType: request.TrainControl.TrainControlType.DIRECTION_KEY_SWITCH, - dirKey: { + switchKey: { val: position, }, }) From 1b855710056f0d2c342cfe5e3c5082350eaf0094 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Wed, 21 Aug 2024 18:23:43 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E9=A9=BE=E9=A9=B6=E5=8F=B0=E6=8E=A5?= =?UTF-8?q?=E6=94=B6=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9=EF=BC=88=E5=BE=85?= =?UTF-8?q?=E4=B8=8E=E5=90=8E=E7=AB=AF=E6=B5=8B=E8=AF=95=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drawApp/graphics/TccKeyInteraction.ts | 8 +- src/drawApp/tccScene.ts | 8 +- src/protos/device_state.ts | 100 ++++++++++++---------- 3 files changed, 62 insertions(+), 54 deletions(-) diff --git a/src/drawApp/graphics/TccKeyInteraction.ts b/src/drawApp/graphics/TccKeyInteraction.ts index d8477c6..d5986dc 100644 --- a/src/drawApp/graphics/TccKeyInteraction.ts +++ b/src/drawApp/graphics/TccKeyInteraction.ts @@ -57,20 +57,20 @@ export class TccKeyData extends GraphicDataBase implements ITccKeyData { } export class TccKeyState extends GraphicStateBase implements ITccKeyState { - constructor(data?: state.TrainControlState.DirectionKeySwitch) { + constructor(data?: state.TrainControlState.SwitchKeyChange) { let tccKeyState; if (data) { tccKeyState = data; } else { - tccKeyState = new state.TrainControlState.DirectionKeySwitch(); + tccKeyState = new state.TrainControlState.SwitchKeyChange(); } super(tccKeyState, TccKey.Type); } get code(): string { return this.states.id + ''; } - get states(): state.TrainControlState.DirectionKeySwitch { - return this.getState(); + get states(): state.TrainControlState.SwitchKeyChange { + return this.getState(); } get position(): number { return this.states.val; diff --git a/src/drawApp/tccScene.ts b/src/drawApp/tccScene.ts index 093165d..b29b6b8 100644 --- a/src/drawApp/tccScene.ts +++ b/src/drawApp/tccScene.ts @@ -90,11 +90,11 @@ function handleSubscribe(tccScene: IGraphicScene) { storage?.buttons.forEach((button) => { states.push(new TccButtonState(button)); }); - if (storage.dirKey) { - states.push(new TccKeyState(storage.dirKey)); - } + storage?.switchKeys.forEach((switchKey) => { + states.push(new TccKeyState(switchKey)); + }); storage?.driverKey.forEach((driverKey) => { - const data = new state.TrainControlState.DirectionKeySwitch({ + const data = new state.TrainControlState.SwitchKeyChange({ id: driverKey.id, val: driverKey.val ? 1 : 0, }); diff --git a/src/protos/device_state.ts b/src/protos/device_state.ts index 551e1d2..a491e92 100644 --- a/src/protos/device_state.ts +++ b/src/protos/device_state.ts @@ -10614,7 +10614,7 @@ export namespace state { constructor(data?: any[] | { buttons?: Map; driverKey?: TrainControlState.DriverKeySwitch[]; - dirKey?: TrainControlState.DirectionKeySwitch; + switchKeyMap?: Map; pushHandler?: TrainControlState.PushHandler; lightMaps?: Map; lineInitTimeStamp12?: number; @@ -10629,8 +10629,8 @@ export namespace state { if ("driverKey" in data && data.driverKey != undefined) { this.driverKey = data.driverKey; } - if ("dirKey" in data && data.dirKey != undefined) { - this.dirKey = data.dirKey; + if ("switchKeyMap" in data && data.switchKeyMap != undefined) { + this.switchKeyMap = data.switchKeyMap; } if ("pushHandler" in data && data.pushHandler != undefined) { this.pushHandler = data.pushHandler; @@ -10647,6 +10647,8 @@ export namespace state { } if (!this.buttons) this.buttons = new Map(); + if (!this.switchKeyMap) + this.switchKeyMap = new Map(); if (!this.lightMaps) this.lightMaps = new Map(); } @@ -10662,14 +10664,11 @@ export namespace state { set driverKey(value: TrainControlState.DriverKeySwitch[]) { pb_1.Message.setRepeatedWrapperField(this, 2, value); } - get dirKey() { - return pb_1.Message.getWrapperField(this, TrainControlState.DirectionKeySwitch, 3) as TrainControlState.DirectionKeySwitch; + get switchKeyMap() { + return pb_1.Message.getField(this, 3) as any as Map; } - set dirKey(value: TrainControlState.DirectionKeySwitch) { - pb_1.Message.setWrapperField(this, 3, value); - } - get has_dirKey() { - return pb_1.Message.getField(this, 3) != null; + set switchKeyMap(value: Map) { + pb_1.Message.setField(this, 3, value as any); } get pushHandler() { return pb_1.Message.getWrapperField(this, TrainControlState.PushHandler, 4) as TrainControlState.PushHandler; @@ -10703,7 +10702,9 @@ export namespace state { [key: string]: ReturnType; }; driverKey?: ReturnType[]; - dirKey?: ReturnType; + switchKeyMap?: { + [key: string]: ReturnType; + }; pushHandler?: ReturnType; lightMaps?: { [key: string]: ReturnType; @@ -10718,8 +10719,8 @@ export namespace state { if (data.driverKey != null) { message.driverKey = data.driverKey.map(item => TrainControlState.DriverKeySwitch.fromObject(item)); } - if (data.dirKey != null) { - message.dirKey = TrainControlState.DirectionKeySwitch.fromObject(data.dirKey); + if (typeof data.switchKeyMap == "object") { + message.switchKeyMap = new Map(Object.entries(data.switchKeyMap).map(([key, value]) => [key, TrainControlState.SwitchKeyChange.fromObject(value)])); } if (data.pushHandler != null) { message.pushHandler = TrainControlState.PushHandler.fromObject(data.pushHandler); @@ -10741,7 +10742,9 @@ export namespace state { [key: string]: ReturnType; }; driverKey?: ReturnType[]; - dirKey?: ReturnType; + switchKeyMap?: { + [key: string]: ReturnType; + }; pushHandler?: ReturnType; lightMaps?: { [key: string]: ReturnType; @@ -10755,8 +10758,8 @@ export namespace state { if (this.driverKey != null) { data.driverKey = this.driverKey.map((item: TrainControlState.DriverKeySwitch) => item.toObject()); } - if (this.dirKey != null) { - data.dirKey = this.dirKey.toObject(); + if (this.switchKeyMap != null) { + data.switchKeyMap = (Object.fromEntries)((Array.from)(this.switchKeyMap).map(([key, value]) => [key, value.toObject()])); } if (this.pushHandler != null) { data.pushHandler = this.pushHandler.toObject(); @@ -10784,8 +10787,12 @@ export namespace state { } if (this.driverKey.length) writer.writeRepeatedMessage(2, this.driverKey, (item: TrainControlState.DriverKeySwitch) => item.serialize(writer)); - if (this.has_dirKey) - writer.writeMessage(3, this.dirKey, () => this.dirKey.serialize(writer)); + for (const [key, value] of this.switchKeyMap) { + writer.writeMessage(3, this.switchKeyMap, () => { + writer.writeString(1, key); + writer.writeMessage(2, value, () => value.serialize(writer)); + }); + } if (this.has_pushHandler) writer.writeMessage(4, this.pushHandler, () => this.pushHandler.serialize(writer)); for (const [key, value] of this.lightMaps) { @@ -10818,7 +10825,11 @@ export namespace state { reader.readMessage(message.driverKey, () => pb_1.Message.addToRepeatedWrapperField(message, 2, TrainControlState.DriverKeySwitch.deserialize(reader), TrainControlState.DriverKeySwitch)); break; case 3: - reader.readMessage(message.dirKey, () => message.dirKey = TrainControlState.DirectionKeySwitch.deserialize(reader)); + reader.readMessage(message, () => pb_1.Map.deserializeBinary(message.switchKeyMap as any, reader, reader.readString, () => { + let value; + reader.readMessage(message, () => value = TrainControlState.SwitchKeyChange.deserialize(reader)); + return value; + })); break; case 4: reader.readMessage(message.pushHandler, () => message.pushHandler = TrainControlState.PushHandler.deserialize(reader)); @@ -11029,7 +11040,7 @@ export namespace state { return DriverKeySwitch.deserialize(bytes); } } - export class DirectionKeySwitch extends pb_1.Message { + export class SwitchKeyChange extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { id?: number; @@ -11061,8 +11072,8 @@ export namespace state { static fromObject(data: { id?: number; val?: number; - }): DirectionKeySwitch { - const message = new DirectionKeySwitch({}); + }): SwitchKeyChange { + const message = new SwitchKeyChange({}); if (data.id != null) { message.id = data.id; } @@ -11095,8 +11106,8 @@ export namespace state { if (!w) return writer.getResultBuffer(); } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DirectionKeySwitch { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DirectionKeySwitch(); + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SwitchKeyChange { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SwitchKeyChange(); while (reader.nextField()) { if (reader.isEndGroup()) break; @@ -11115,8 +11126,8 @@ export namespace state { serializeBinary(): Uint8Array { return this.serialize(); } - static deserializeBinary(bytes: Uint8Array): DirectionKeySwitch { - return DirectionKeySwitch.deserialize(bytes); + static deserializeBinary(bytes: Uint8Array): SwitchKeyChange { + return SwitchKeyChange.deserialize(bytes); } } export class PushHandler extends pb_1.Message { @@ -11305,12 +11316,12 @@ export namespace state { constructor(data?: any[] | { buttons?: TrainControlState.ControlButton[]; driverKey?: TrainControlState.DriverKeySwitch[]; - dirKey?: TrainControlState.DirectionKeySwitch; + switchKeys?: TrainControlState.SwitchKeyChange[]; pushHandler?: TrainControlState.PushHandler; lights?: TrainControlState.ControlLight[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 5], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 5], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("buttons" in data && data.buttons != undefined) { this.buttons = data.buttons; @@ -11318,8 +11329,8 @@ export namespace state { if ("driverKey" in data && data.driverKey != undefined) { this.driverKey = data.driverKey; } - if ("dirKey" in data && data.dirKey != undefined) { - this.dirKey = data.dirKey; + if ("switchKeys" in data && data.switchKeys != undefined) { + this.switchKeys = data.switchKeys; } if ("pushHandler" in data && data.pushHandler != undefined) { this.pushHandler = data.pushHandler; @@ -11341,14 +11352,11 @@ export namespace state { set driverKey(value: TrainControlState.DriverKeySwitch[]) { pb_1.Message.setRepeatedWrapperField(this, 2, value); } - get dirKey() { - return pb_1.Message.getWrapperField(this, TrainControlState.DirectionKeySwitch, 3) as TrainControlState.DirectionKeySwitch; + get switchKeys() { + return pb_1.Message.getRepeatedWrapperField(this, TrainControlState.SwitchKeyChange, 3) as TrainControlState.SwitchKeyChange[]; } - set dirKey(value: TrainControlState.DirectionKeySwitch) { - pb_1.Message.setWrapperField(this, 3, value); - } - get has_dirKey() { - return pb_1.Message.getField(this, 3) != null; + set switchKeys(value: TrainControlState.SwitchKeyChange[]) { + pb_1.Message.setRepeatedWrapperField(this, 3, value); } get pushHandler() { return pb_1.Message.getWrapperField(this, TrainControlState.PushHandler, 4) as TrainControlState.PushHandler; @@ -11368,7 +11376,7 @@ export namespace state { static fromObject(data: { buttons?: ReturnType[]; driverKey?: ReturnType[]; - dirKey?: ReturnType; + switchKeys?: ReturnType[]; pushHandler?: ReturnType; lights?: ReturnType[]; }): TrainControlStateMsg { @@ -11379,8 +11387,8 @@ export namespace state { if (data.driverKey != null) { message.driverKey = data.driverKey.map(item => TrainControlState.DriverKeySwitch.fromObject(item)); } - if (data.dirKey != null) { - message.dirKey = TrainControlState.DirectionKeySwitch.fromObject(data.dirKey); + if (data.switchKeys != null) { + message.switchKeys = data.switchKeys.map(item => TrainControlState.SwitchKeyChange.fromObject(item)); } if (data.pushHandler != null) { message.pushHandler = TrainControlState.PushHandler.fromObject(data.pushHandler); @@ -11394,7 +11402,7 @@ export namespace state { const data: { buttons?: ReturnType[]; driverKey?: ReturnType[]; - dirKey?: ReturnType; + switchKeys?: ReturnType[]; pushHandler?: ReturnType; lights?: ReturnType[]; } = {}; @@ -11404,8 +11412,8 @@ export namespace state { if (this.driverKey != null) { data.driverKey = this.driverKey.map((item: TrainControlState.DriverKeySwitch) => item.toObject()); } - if (this.dirKey != null) { - data.dirKey = this.dirKey.toObject(); + if (this.switchKeys != null) { + data.switchKeys = this.switchKeys.map((item: TrainControlState.SwitchKeyChange) => item.toObject()); } if (this.pushHandler != null) { data.pushHandler = this.pushHandler.toObject(); @@ -11423,8 +11431,8 @@ export namespace state { writer.writeRepeatedMessage(1, this.buttons, (item: TrainControlState.ControlButton) => item.serialize(writer)); if (this.driverKey.length) writer.writeRepeatedMessage(2, this.driverKey, (item: TrainControlState.DriverKeySwitch) => item.serialize(writer)); - if (this.has_dirKey) - writer.writeMessage(3, this.dirKey, () => this.dirKey.serialize(writer)); + if (this.switchKeys.length) + writer.writeRepeatedMessage(3, this.switchKeys, (item: TrainControlState.SwitchKeyChange) => item.serialize(writer)); if (this.has_pushHandler) writer.writeMessage(4, this.pushHandler, () => this.pushHandler.serialize(writer)); if (this.lights.length) @@ -11445,7 +11453,7 @@ export namespace state { reader.readMessage(message.driverKey, () => pb_1.Message.addToRepeatedWrapperField(message, 2, TrainControlState.DriverKeySwitch.deserialize(reader), TrainControlState.DriverKeySwitch)); break; case 3: - reader.readMessage(message.dirKey, () => message.dirKey = TrainControlState.DirectionKeySwitch.deserialize(reader)); + reader.readMessage(message.switchKeys, () => pb_1.Message.addToRepeatedWrapperField(message, 3, TrainControlState.SwitchKeyChange.deserialize(reader), TrainControlState.SwitchKeyChange)); break; case 4: reader.readMessage(message.pushHandler, () => message.pushHandler = TrainControlState.PushHandler.deserialize(reader)); From 3773aef4ac5b8d74919b2b5a2b854d2420870753 Mon Sep 17 00:00:00 2001 From: joylink_fanyuhong <18706759286@163.com> Date: Thu, 22 Aug 2024 08:41:56 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=AC=E9=87=8C?= =?UTF-8?q?=E6=A0=87=E9=95=BF=E7=9F=AD=E9=93=BE=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rts-sim-testing-message | 2 +- .../draw-app/dialogs/KmChainData.vue | 161 +++++++++++++++ .../draw-app/properties/KmChainDataConfig.vue | 194 ++++++++++++++++++ src/drawApp/commonApp.ts | 58 +++++- src/layouts/DrawLayout.vue | 25 +++ src/stores/draw-store.ts | 7 + 6 files changed, 435 insertions(+), 12 deletions(-) create mode 100644 src/components/draw-app/dialogs/KmChainData.vue create mode 100644 src/components/draw-app/properties/KmChainDataConfig.vue diff --git a/rts-sim-testing-message b/rts-sim-testing-message index 30f6530..939b7a2 160000 --- a/rts-sim-testing-message +++ b/rts-sim-testing-message @@ -1 +1 @@ -Subproject commit 30f6530a925f672eb0e5e6e3654b72865c2598df +Subproject commit 939b7a2604a29cb3d486199cc9491af49f81a2f3 diff --git a/src/components/draw-app/dialogs/KmChainData.vue b/src/components/draw-app/dialogs/KmChainData.vue new file mode 100644 index 0000000..d16a82d --- /dev/null +++ b/src/components/draw-app/dialogs/KmChainData.vue @@ -0,0 +1,161 @@ + + + + + diff --git a/src/components/draw-app/properties/KmChainDataConfig.vue b/src/components/draw-app/properties/KmChainDataConfig.vue new file mode 100644 index 0000000..7dd27a8 --- /dev/null +++ b/src/components/draw-app/properties/KmChainDataConfig.vue @@ -0,0 +1,194 @@ + + + diff --git a/src/drawApp/commonApp.ts b/src/drawApp/commonApp.ts index 67f0494..5ae9926 100644 --- a/src/drawApp/commonApp.ts +++ b/src/drawApp/commonApp.ts @@ -91,10 +91,22 @@ 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 { + 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, @@ -235,7 +247,10 @@ 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 UnattengedButtonDraw( + app, + new UnattengedButtonTemplate(new UnattengedButtonData()) + ); new GatedBoxDraw(app, new GatedBoxTemplate(new GatedBoxData())); // new EsbButtonDraw( // app, @@ -307,6 +322,7 @@ export function initCommonDrawApp(app: IDrawApp) { kilometerConvertList = []; sectionCodePointList = []; otherLineList = []; + kmChainDataList = []; }); // KeyA 用于区段复制--控制生成的区段位置 const graphicCopyPlugin = app.app.graphicCopyPlugin; @@ -362,10 +378,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; }); @@ -415,6 +431,7 @@ export function loadCommonDrawDatas( lianSuoData = storage.lianSuoData; } kilometerConvertList = storage.kilometerConvertList; + kmChainDataList = storage.kilometerMarkCalibrations; sectionCodePointList = storage.sectionCodePointList; otherLineList = storage.otherLineList; refDevicesList = storage.stationRelateDeviceList; @@ -459,10 +476,10 @@ export function loadCommonDrawDatas( }); 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)); }); @@ -721,6 +738,7 @@ export function saveCommonDrawDatas(app: IDrawApp) { storage.otherLineList = otherLineList; storage.stationRelateDeviceList = refDevicesList; storage.lianSuoData = lianSuoData; + storage.kilometerMarkCalibrations = kmChainDataList; // if (storage.generateAxleCountingConfig?.bbConnect) { // storage.generateAxleCountingConfig.newbbConnect = // storage.generateAxleCountingConfig.bbConnect.map((item) => +item); @@ -815,6 +833,24 @@ export function editKilometerConvert(row: graphicData.KilometerConvert) { export function deleteKilometerConvert(index: number) { kilometerConvertList.splice(index, 1); } +//公里标设计-实测数据增删改查 +let kmChainDataList: graphicData.KilometerMarkCalibration[] = []; +export function loadKmChainDataList() { + return kmChainDataList; +} +export function createKmChainData(row: graphicData.KilometerMarkCalibration) { + kmChainDataList.push(row); +} +export function editKmChainData(row: graphicData.KilometerMarkCalibration) { + const drawStore = useDrawStore(); + const findIndex = drawStore.editKmChainDataIndex; + if (findIndex >= 0) { + kmChainDataList.splice(findIndex, 1, row); + } +} +export function deleteKmChainData(index: number) { + kmChainDataList.splice(index, 1); +} // 公里标转换趋势 export const sameTrendOptions = [ { label: '相反', value: false }, diff --git a/src/layouts/DrawLayout.vue b/src/layouts/DrawLayout.vue index feec5a4..1f9888f 100644 --- a/src/layouts/DrawLayout.vue +++ b/src/layouts/DrawLayout.vue @@ -87,6 +87,9 @@ + @@ -249,7 +252,9 @@ 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 KmChainData from 'src/components/draw-app/dialogs/KmChainData.vue'; import KilometerConvertConfig from 'src/components/draw-app/properties/KilometerConvertConfig.vue'; +import KmChainDataConfig from 'src/components/draw-app/properties/KmChainDataconfig.vue'; import SectionCodePointList from 'src/components/draw-app/dialogs/SectionCodePointList.vue'; import SectionCodePointConfig from 'src/components/draw-app/properties/SectionCodePointConfig.vue'; import StationRelateDeviceConfig from 'src/components/draw-app/properties/StationRelateDeviceConfig.vue'; @@ -415,6 +420,10 @@ const dataManageConfig = [ label: '联锁编号映射数据', click: lianSuoBianHao, }, + { + label: '公里标长短链数据', + click: kmChainData, + }, ]; onMounted(() => { @@ -1115,6 +1124,10 @@ onUnmounted(() => { if (otherLineDialog.value) { otherLineDialog.value.hide(); } + drawStore.setEditKmChainDataIndex(-1); + if (kmChainDataDialog.value) { + kmChainDataDialog.value.hide(); + } drawStore.setEditOtherLineIndex(-1); drawStore.destroy(); drawStore.setCategoryType(null); @@ -1208,6 +1221,18 @@ function lianSuoBianHao() { }); } +let kmChainDataDialog = ref(); +function kmChainData() { + if (kmChainDataDialog.value) return; + kmChainDataDialog.value = $q + .dialog({ + component: KmChainData, + }) + .onCancel(() => { + kmChainDataDialog.value = null; + }); +} + let relateDeviceDialogInstance: DialogChainObject | null = null; const relateDeviceConfigEdit = ref>(); diff --git a/src/stores/draw-store.ts b/src/stores/draw-store.ts index e7bcd16..7355a59 100644 --- a/src/stores/draw-store.ts +++ b/src/stores/draw-store.ts @@ -35,6 +35,7 @@ export const useDrawStore = defineStore('draw', { editKilometerConvertIndex: -1, editSectionCodePointIndex: -1, editOtherLineIndex: -1, + editKmChainDataIndex: -1, table: undefined as QTable | undefined, showRelateDeviceConfig: false, showDirectionConfig: '' as string, @@ -98,6 +99,9 @@ export const useDrawStore = defineStore('draw', { showEditOtherLine: (state) => { return state.editOtherLineIndex >= 0; }, + showEditKmChainData: (state) => { + return state.editKmChainDataIndex >= 0; + }, }, actions: { getDrawApp(): IDrawApp { @@ -186,5 +190,8 @@ export const useDrawStore = defineStore('draw', { setDirectionConfigVisible(visible: string) { this.showDirectionConfig = visible; }, + setEditKmChainDataIndex(index: number) { + this.editKmChainDataIndex = index; + }, }, });