From dd471e3a5e26994c1cf074342ac998866930a214 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Thu, 3 Aug 2023 09:56:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E8=BD=B4=E5=A2=9E=E5=8A=A0=E8=99=9A?= =?UTF-8?q?=E6=8B=9F=E8=AE=A1=E8=BD=B4=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../properties/AxleCountingProperty.vue | 23 ++++++++++++++++++- .../graphics/AxleCountingInteraction.ts | 6 +++++ src/graphics/axleCounting/AxleCounting.ts | 2 ++ src/protos/stationLayoutGraphics.ts | 23 +++++++++++++++++++ 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/components/draw-app/properties/AxleCountingProperty.vue b/src/components/draw-app/properties/AxleCountingProperty.vue index b81172b..56a1487 100644 --- a/src/components/draw-app/properties/AxleCountingProperty.vue +++ b/src/components/draw-app/properties/AxleCountingProperty.vue @@ -43,6 +43,13 @@ @blur="onUpdate" label="公里标(mm):" /> + @@ -86,7 +93,7 @@ import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting'; import { Section } from 'src/graphics/section/Section'; import { Turnout } from 'src/graphics/turnout/Turnout'; import { useDrawStore } from 'src/stores/draw-store'; -import { computed, onMounted, reactive, watch } from 'vue'; +import { computed, onMounted, reactive, ref, watch } from 'vue'; const drawStore = useDrawStore(); const axleCountingModel = reactive(new AxleCountingData()); @@ -99,12 +106,24 @@ const CoordinateSystemOptions = [ { label: '换线', value: 'TRANSFER' }, ]; +const invent = ref(''); +const optionsInvent = ['是', '否']; +enum showSelect { + 是 = 'true', + 否 = 'false', +} +enum showSelectData { + true = '是', + false = '否', +} + drawStore.$subscribe; watch( () => drawStore.selectedGraphic, (val) => { if (val && val.type == AxleCounting.Type) { axleCountingModel.copyFrom(val.saveData() as AxleCountingData); + invent.value = (showSelectData as never)[axleCountingModel.invent + '']; if (axleCountingModel.kilometerSystem) { kilometerSystem.coordinateSystem = axleCountingModel.kilometerSystem.coordinateSystem; @@ -118,6 +137,7 @@ onMounted(() => { const axleCounting = drawStore.selectedGraphic as AxleCounting; if (axleCounting) { axleCountingModel.copyFrom(axleCounting.saveData()); + invent.value = (showSelectData as never)[axleCountingModel.invent + '']; if (axleCountingModel.kilometerSystem) { kilometerSystem.coordinateSystem = axleCountingModel.kilometerSystem.coordinateSystem; @@ -128,6 +148,7 @@ onMounted(() => { function onUpdate() { const axleCounting = drawStore.selectedGraphic as AxleCounting; + axleCountingModel.invent = JSON.parse((showSelect as never)[invent.value]); axleCountingModel.kilometerSystem = { coordinateSystem: kilometerSystem.coordinateSystem, kilometer: kilometerSystem.kilometer, diff --git a/src/drawApp/graphics/AxleCountingInteraction.ts b/src/drawApp/graphics/AxleCountingInteraction.ts index 42b4c3f..c186912 100644 --- a/src/drawApp/graphics/AxleCountingInteraction.ts +++ b/src/drawApp/graphics/AxleCountingInteraction.ts @@ -50,6 +50,12 @@ export class AxleCountingData set index(v: number) { this.data.index = v; } + get invent(): boolean { + return this.data.invent; + } + set invent(v: boolean) { + this.data.invent = v; + } clone(): AxleCountingData { return new AxleCountingData(this.data.cloneMessage()); } diff --git a/src/graphics/axleCounting/AxleCounting.ts b/src/graphics/axleCounting/AxleCounting.ts index 0c5550e..1550372 100644 --- a/src/graphics/axleCounting/AxleCounting.ts +++ b/src/graphics/axleCounting/AxleCounting.ts @@ -18,6 +18,8 @@ export interface IAxleCountingData extends GraphicData { set axleCountingRef(ref: IRelatedRefData[]); get index(): number; // 索引编号 set index(v: number); + get invent(): boolean; // 是否虚拟计轴 + set invent(v: boolean); clone(): IAxleCountingData; copyFrom(data: IAxleCountingData): void; eq(other: IAxleCountingData): boolean; diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts index a0c9586..80411d6 100644 --- a/src/protos/stationLayoutGraphics.ts +++ b/src/protos/stationLayoutGraphics.ts @@ -1523,6 +1523,7 @@ export namespace graphicData { kilometerSystem?: KilometerSystem; axleCountingRef?: RelatedRef[]; index?: number; + invent?: boolean; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4], this.#one_of_decls); @@ -1542,6 +1543,9 @@ export namespace graphicData { if ("index" in data && data.index != undefined) { this.index = data.index; } + if ("invent" in data && data.invent != undefined) { + this.invent = data.invent; + } } } get common() { @@ -1580,12 +1584,19 @@ export namespace graphicData { set index(value: number) { pb_1.Message.setField(this, 5, value); } + get invent() { + return pb_1.Message.getFieldWithDefault(this, 6, false) as boolean; + } + set invent(value: boolean) { + pb_1.Message.setField(this, 6, value); + } static fromObject(data: { common?: ReturnType; code?: string; kilometerSystem?: ReturnType; axleCountingRef?: ReturnType[]; index?: number; + invent?: boolean; }): AxleCounting { const message = new AxleCounting({}); if (data.common != null) { @@ -1603,6 +1614,9 @@ export namespace graphicData { if (data.index != null) { message.index = data.index; } + if (data.invent != null) { + message.invent = data.invent; + } return message; } toObject() { @@ -1612,6 +1626,7 @@ export namespace graphicData { kilometerSystem?: ReturnType; axleCountingRef?: ReturnType[]; index?: number; + invent?: boolean; } = {}; if (this.common != null) { data.common = this.common.toObject(); @@ -1628,6 +1643,9 @@ export namespace graphicData { if (this.index != null) { data.index = this.index; } + if (this.invent != null) { + data.invent = this.invent; + } return data; } serialize(): Uint8Array; @@ -1644,6 +1662,8 @@ export namespace graphicData { writer.writeRepeatedMessage(4, this.axleCountingRef, (item: RelatedRef) => item.serialize(writer)); if (this.index != 0) writer.writeInt32(5, this.index); + if (this.invent != false) + writer.writeBool(6, this.invent); if (!w) return writer.getResultBuffer(); } @@ -1668,6 +1688,9 @@ export namespace graphicData { case 5: message.index = reader.readInt32(); break; + case 6: + message.invent = reader.readBool(); + break; default: reader.skipField(); } }