From 21d4c0aa8f53ec7ce90cc744ed3e6b7fea22bf6a Mon Sep 17 00:00:00 2001 From: fan Date: Mon, 12 Aug 2024 16:05:39 +0800 Subject: [PATCH 1/2] =?UTF-8?q?proto=E5=90=8C=E6=AD=A5=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 +- src/protos/device_state.ts | 115 +++++++++++++++++++++++++++- src/protos/stationLayoutGraphics.ts | 48 ++++++------ 3 files changed, 139 insertions(+), 26 deletions(-) diff --git a/rts-sim-testing-message b/rts-sim-testing-message index 2f5d8c3..74bea4e 160000 --- a/rts-sim-testing-message +++ b/rts-sim-testing-message @@ -1 +1 @@ -Subproject commit 2f5d8c3cfdf06ced1a0b0a50f47f9353c441e196 +Subproject commit 74bea4e9955524f7254876c90af08d963f666585 diff --git a/src/protos/device_state.ts b/src/protos/device_state.ts index 1244641..56d308f 100644 --- a/src/protos/device_state.ts +++ b/src/protos/device_state.ts @@ -263,6 +263,96 @@ export namespace state { return SectionState.deserialize(bytes); } } + export class AxleCountingSectionState extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + id?: number; + occupied?: boolean; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("id" in data && data.id != undefined) { + this.id = data.id; + } + if ("occupied" in data && data.occupied != undefined) { + this.occupied = data.occupied; + } + } + } + get id() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; + } + set id(value: number) { + pb_1.Message.setField(this, 1, value); + } + get occupied() { + return pb_1.Message.getFieldWithDefault(this, 2, false) as boolean; + } + set occupied(value: boolean) { + pb_1.Message.setField(this, 2, value); + } + static fromObject(data: { + id?: number; + occupied?: boolean; + }): AxleCountingSectionState { + const message = new AxleCountingSectionState({}); + if (data.id != null) { + message.id = data.id; + } + if (data.occupied != null) { + message.occupied = data.occupied; + } + return message; + } + toObject() { + const data: { + id?: number; + occupied?: boolean; + } = {}; + if (this.id != null) { + data.id = this.id; + } + if (this.occupied != null) { + data.occupied = this.occupied; + } + 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.writeUint32(1, this.id); + if (this.occupied != false) + writer.writeBool(2, this.occupied); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): AxleCountingSectionState { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new AxleCountingSectionState(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.id = reader.readUint32(); + break; + case 2: + message.occupied = reader.readBool(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): AxleCountingSectionState { + return AxleCountingSectionState.deserialize(bytes); + } + } export class SwitchState extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { @@ -9549,9 +9639,10 @@ export namespace state { ckmStates?: CkmState[]; fymStates?: CkmState[]; xcjStates?: XcjState[]; + axleCountingSection?: AxleCountingSectionState[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("trainState" in data && data.trainState != undefined) { this.trainState = data.trainState; @@ -9601,6 +9692,9 @@ export namespace state { if ("xcjStates" in data && data.xcjStates != undefined) { this.xcjStates = data.xcjStates; } + if ("axleCountingSection" in data && data.axleCountingSection != undefined) { + this.axleCountingSection = data.axleCountingSection; + } } } get trainState() { @@ -9702,6 +9796,12 @@ export namespace state { set xcjStates(value: XcjState[]) { pb_1.Message.setRepeatedWrapperField(this, 16, value); } + get axleCountingSection() { + return pb_1.Message.getRepeatedWrapperField(this, AxleCountingSectionState, 17) as AxleCountingSectionState[]; + } + set axleCountingSection(value: AxleCountingSectionState[]) { + pb_1.Message.setRepeatedWrapperField(this, 17, value); + } static fromObject(data: { trainState?: ReturnType[]; switchState?: ReturnType[]; @@ -9719,6 +9819,7 @@ export namespace state { ckmStates?: ReturnType[]; fymStates?: ReturnType[]; xcjStates?: ReturnType[]; + axleCountingSection?: ReturnType[]; }): AllDevicesStatus { const message = new AllDevicesStatus({}); if (data.trainState != null) { @@ -9769,6 +9870,9 @@ export namespace state { if (data.xcjStates != null) { message.xcjStates = data.xcjStates.map(item => XcjState.fromObject(item)); } + if (data.axleCountingSection != null) { + message.axleCountingSection = data.axleCountingSection.map(item => AxleCountingSectionState.fromObject(item)); + } return message; } toObject() { @@ -9789,6 +9893,7 @@ export namespace state { ckmStates?: ReturnType[]; fymStates?: ReturnType[]; xcjStates?: ReturnType[]; + axleCountingSection?: ReturnType[]; } = {}; if (this.trainState != null) { data.trainState = this.trainState.map((item: TrainMapState) => item.toObject()); @@ -9838,6 +9943,9 @@ export namespace state { if (this.xcjStates != null) { data.xcjStates = this.xcjStates.map((item: XcjState) => item.toObject()); } + if (this.axleCountingSection != null) { + data.axleCountingSection = this.axleCountingSection.map((item: AxleCountingSectionState) => item.toObject()); + } return data; } serialize(): Uint8Array; @@ -9876,6 +9984,8 @@ export namespace state { writer.writeRepeatedMessage(15, this.fymStates, (item: CkmState) => item.serialize(writer)); if (this.xcjStates.length) writer.writeRepeatedMessage(16, this.xcjStates, (item: XcjState) => item.serialize(writer)); + if (this.axleCountingSection.length) + writer.writeRepeatedMessage(17, this.axleCountingSection, (item: AxleCountingSectionState) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -9933,6 +10043,9 @@ export namespace state { case 16: reader.readMessage(message.xcjStates, () => pb_1.Message.addToRepeatedWrapperField(message, 16, XcjState.deserialize(reader), XcjState)); break; + case 17: + reader.readMessage(message.axleCountingSection, () => pb_1.Message.addToRepeatedWrapperField(message, 17, AxleCountingSectionState.deserialize(reader), AxleCountingSectionState)); + break; default: reader.skipField(); } } diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts index ac7ab40..1e1f75d 100644 --- a/src/protos/stationLayoutGraphics.ts +++ b/src/protos/stationLayoutGraphics.ts @@ -9432,7 +9432,6 @@ export namespace graphicData { switchs?: LianSuoIndexData[]; screenDoors?: LianSuoIndexData[]; signals?: LianSuoIndexData[]; - sections?: LianSuoIndexData[]; floodGates?: LianSuoIndexData[]; spksSwitchs?: LianSuoIndexData[]; garageDoors?: LianSuoIndexData[]; @@ -9440,9 +9439,10 @@ export namespace graphicData { esbButtons?: LianSuoIndexData[]; holdButtons?: LianSuoIndexData[]; unattengedButtons?: LianSuoIndexData[]; + acSections?: 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); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("stations" in data && data.stations != undefined) { this.stations = data.stations; @@ -9456,9 +9456,6 @@ export namespace graphicData { 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; } @@ -9480,6 +9477,9 @@ export namespace graphicData { if ("unattengedButtons" in data && data.unattengedButtons != undefined) { this.unattengedButtons = data.unattengedButtons; } + if ("acSections" in data && data.acSections != undefined) { + this.acSections = data.acSections; + } } } get stations() { @@ -9506,12 +9506,6 @@ export namespace graphicData { 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[]; } @@ -9554,12 +9548,17 @@ export namespace graphicData { set unattengedButtons(value: LianSuoIndexData[]) { pb_1.Message.setRepeatedWrapperField(this, 12, value); } + get acSections() { + return pb_1.Message.getRepeatedWrapperField(this, LianSuoIndexData, 13) as LianSuoIndexData[]; + } + set acSections(value: LianSuoIndexData[]) { + pb_1.Message.setRepeatedWrapperField(this, 13, value); + } static fromObject(data: { stations?: ReturnType[]; switchs?: ReturnType[]; screenDoors?: ReturnType[]; signals?: ReturnType[]; - sections?: ReturnType[]; floodGates?: ReturnType[]; spksSwitchs?: ReturnType[]; garageDoors?: ReturnType[]; @@ -9567,6 +9566,7 @@ export namespace graphicData { esbButtons?: ReturnType[]; holdButtons?: ReturnType[]; unattengedButtons?: ReturnType[]; + acSections?: ReturnType[]; }): LianSuoData { const message = new LianSuoData({}); if (data.stations != null) { @@ -9581,9 +9581,6 @@ export namespace graphicData { 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)); } @@ -9605,6 +9602,9 @@ export namespace graphicData { if (data.unattengedButtons != null) { message.unattengedButtons = data.unattengedButtons.map(item => LianSuoIndexData.fromObject(item)); } + if (data.acSections != null) { + message.acSections = data.acSections.map(item => LianSuoIndexData.fromObject(item)); + } return message; } toObject() { @@ -9613,7 +9613,6 @@ export namespace graphicData { switchs?: ReturnType[]; screenDoors?: ReturnType[]; signals?: ReturnType[]; - sections?: ReturnType[]; floodGates?: ReturnType[]; spksSwitchs?: ReturnType[]; garageDoors?: ReturnType[]; @@ -9621,6 +9620,7 @@ export namespace graphicData { esbButtons?: ReturnType[]; holdButtons?: ReturnType[]; unattengedButtons?: ReturnType[]; + acSections?: ReturnType[]; } = {}; if (this.stations != null) { data.stations = this.stations.map((item: LianSuoIndexData) => item.toObject()); @@ -9634,9 +9634,6 @@ export namespace graphicData { 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()); } @@ -9658,6 +9655,9 @@ export namespace graphicData { if (this.unattengedButtons != null) { data.unattengedButtons = this.unattengedButtons.map((item: LianSuoIndexData) => item.toObject()); } + if (this.acSections != null) { + data.acSections = this.acSections.map((item: LianSuoIndexData) => item.toObject()); + } return data; } serialize(): Uint8Array; @@ -9672,8 +9672,6 @@ export namespace graphicData { 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) @@ -9688,6 +9686,8 @@ export namespace graphicData { 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 (this.acSections.length) + writer.writeRepeatedMessage(13, this.acSections, (item: LianSuoIndexData) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -9709,9 +9709,6 @@ export namespace graphicData { 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; @@ -9733,6 +9730,9 @@ export namespace graphicData { case 12: reader.readMessage(message.unattengedButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 12, LianSuoIndexData.deserialize(reader), LianSuoIndexData)); break; + case 13: + reader.readMessage(message.acSections, () => pb_1.Message.addToRepeatedWrapperField(message, 13, LianSuoIndexData.deserialize(reader), LianSuoIndexData)); + break; default: reader.skipField(); } } From eabfd3ddb72840e98d8bcd11a4f62c599169b4e0 Mon Sep 17 00:00:00 2001 From: joylink_fanyuhong <18706759286@163.com> Date: Mon, 12 Aug 2024 16:25:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=81=94=E9=94=81=E7=BC=96=E5=8F=B7?= =?UTF-8?q?=E6=98=A0=E5=B0=84=E6=95=B0=E6=8D=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../draw-app/dialogs/LianSuoBianHao.vue | 72 +++++++++++++------ 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a/src/components/draw-app/dialogs/LianSuoBianHao.vue b/src/components/draw-app/dialogs/LianSuoBianHao.vue index 043c2fd..7275fe4 100644 --- a/src/components/draw-app/dialogs/LianSuoBianHao.vue +++ b/src/components/draw-app/dialogs/LianSuoBianHao.vue @@ -20,7 +20,8 @@ - + + @@ -115,7 +116,7 @@ - + + + +
+ +
@@ -291,6 +311,8 @@ import { graphicData } from 'src/protos/stationLayoutGraphics'; import { EsbButton } from 'src/graphics/esbButton/EsbButton'; import { HoldButton } from 'src/graphics/holdButton/HoldButton'; import { UnattengedButton } from 'src/graphics/unattengedButton/UnattengedButton'; +import { AxleCountingSection } from 'src/graphics/axleCountingSection/AxleCountingSection'; +import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting'; const drawStore = useDrawStore(); const stationOptions = ref<{ id: number; name: string; index: number }[]>([]); @@ -299,7 +321,8 @@ const screenDoorOptions = ref<{ id: number; name: string; index: number }[]>( [] ); const signalOptions = ref<{ id: number; name: string; index: number }[]>([]); -const sectionOptions = ref<{ id: number; name: string; index: number }[]>([]); +// const sectionOptions = ref<{ id: number; name: string; index: number }[]>([]); +const acSectionOptions = ref<{ id: number; name: string; index: number }[]>([]); const floodGateOptions = ref<{ id: number; name: string; index: number }[]>([]); const spksSwitchOptions = ref<{ id: number; name: string; index: number }[]>( [] @@ -339,7 +362,7 @@ onMounted(() => { lianSuoData.signals.forEach((t) => { lianSuoMapData.set(t.id, t.index); }); - lianSuoData.sections.forEach((t) => { + lianSuoData.acSections.forEach((t) => { lianSuoMapData.set(t.id, t.index); }); lianSuoData.garageDoors.forEach((t) => { @@ -368,7 +391,7 @@ onMounted(() => { turnoutUpdateData(); screenDoorUpdateData(); signalUpdateData(); - sectionUpdateData(); + acSectionUpdateData(); floodGateUpdateData(); spksSwitchUpdateData(); garageDoorUpdateData(); @@ -462,24 +485,31 @@ function signalUpdateData() { }); } -function sectionUpdateData() { +function acSectionUpdateData() { const list: { id: number; name: string; index: number }[] = []; - const sections = drawApp.queryStore.queryByType
(Section.Type); - sections.forEach((section) => { - let name = section.datas.code; - if (section.datas.centralizedStations.length > 0) { - section.datas.centralizedStations.forEach((id) => { - const station = drawApp.queryStore.queryById(id); - name = name + '-' + station.datas.stationName; - }); + const acSections = drawApp.queryStore.queryByType( + AxleCountingSection.Type + ); + acSections.forEach((acSection) => { + let name = acSection.datas.code; + if (acSection.datas.paRef) { + const axleCounting = drawApp.queryStore.queryById( + acSection.datas.paRef.id + ); + if (axleCounting.datas.centralizedStations.length > 0) { + axleCounting.datas.centralizedStations.forEach((id) => { + const station = drawApp.queryStore.queryById(id); + name = name + '-' + station.datas.stationName; + }); + } } - const index = lianSuoMapData.get(section.datas.id) || 0; + const index = lianSuoMapData.get(acSection.datas.id) || 0; list.push({ - id: section.datas.id, + id: acSection.datas.id, name: name, index: index, }); - sectionOptions.value = list; + acSectionOptions.value = list; }); } @@ -674,8 +704,8 @@ function tabUpdate() { case 'signal': signalUpdateData(); break; - case 'section': - sectionUpdateData(); + case 'acSection': + acSectionUpdateData(); break; case 'floodGate': floodGateUpdateData(); @@ -717,8 +747,8 @@ function updateData() { new graphicData.LianSuoIndexData({ id: sd.id, index: sd.index }) ); }); - sectionOptions.value.forEach((se) => { - newLianSuoData.sections.push( + acSectionOptions.value.forEach((se) => { + newLianSuoData.acSections.push( new graphicData.LianSuoIndexData({ id: se.id, index: se.index }) ); });