From 8f142b9ba72ad40308e6f49bacd1cdddd8ebdb2e Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Sat, 7 Oct 2023 15:55:35 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=93=E5=B2=94=E5=A4=B1=E8=A1=A8=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drawApp/graphics/TurnoutInteraction.ts | 16 +++---- src/graphics/turnout/Turnout.ts | 16 ++++--- src/protos/device_state.ts | 56 +++++++++++----------- 3 files changed, 46 insertions(+), 42 deletions(-) diff --git a/src/drawApp/graphics/TurnoutInteraction.ts b/src/drawApp/graphics/TurnoutInteraction.ts index 81862d0..54cf644 100644 --- a/src/drawApp/graphics/TurnoutInteraction.ts +++ b/src/drawApp/graphics/TurnoutInteraction.ts @@ -321,17 +321,17 @@ export class TurnoutStates extends GraphicStateBase implements ITurnoutState { set reverse(reverse: boolean) { this.states.reverse = reverse; } - get turning(): boolean { - return this.states.turning; + get dw(): boolean { + return this.states.dw; } - set turning(turning: boolean) { - this.states.turning = turning; + set dw(dw: boolean) { + this.states.dw = dw; } - get split(): boolean { - return this.states.split; + get fw(): boolean { + return this.states.fw; } - set split(split: boolean) { - this.states.split = split; + set fw(fw: boolean) { + this.states.fw = fw; } get states(): state.SwitchState { return this.getState(); diff --git a/src/graphics/turnout/Turnout.ts b/src/graphics/turnout/Turnout.ts index 6b3107e..95fad1e 100644 --- a/src/graphics/turnout/Turnout.ts +++ b/src/graphics/turnout/Turnout.ts @@ -59,8 +59,8 @@ export interface ITurnoutState extends GraphicState { id?: string; normal?: boolean; reverse?: boolean; - turning?: boolean; - split?: boolean; + dw?: boolean; + fw?: boolean; } export const TurnoutConsts = { @@ -209,11 +209,15 @@ export class Turnout extends JlGraphic { this.graphics.sections.forEach((sectionGraphic) => sectionGraphic.paint()); this.graphics.label.text = this.datas.code; - if (this.states.split) { - this.initTurnoutSplit(); - } else { - this.stopTurnoutSplit(); + if (!this.states.normal && !this.states.reverse) { + // 失表 + this.graphics.fork.visible = false; } + // if (this.states.split) { + // this.initTurnoutSplit(); + // } else { + // this.stopTurnoutSplit(); + // } } initTurnoutSplit() { // 道岔失表 diff --git a/src/protos/device_state.ts b/src/protos/device_state.ts index cd17680..aa5aa9a 100644 --- a/src/protos/device_state.ts +++ b/src/protos/device_state.ts @@ -220,8 +220,8 @@ export namespace state { id?: string; normal?: boolean; reverse?: boolean; - turning?: boolean; - split?: boolean; + dw?: boolean; + fw?: boolean; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); @@ -235,11 +235,11 @@ export namespace state { if ("reverse" in data && data.reverse != undefined) { this.reverse = data.reverse; } - if ("turning" in data && data.turning != undefined) { - this.turning = data.turning; + if ("dw" in data && data.dw != undefined) { + this.dw = data.dw; } - if ("split" in data && data.split != undefined) { - this.split = data.split; + if ("fw" in data && data.fw != undefined) { + this.fw = data.fw; } } } @@ -261,24 +261,24 @@ export namespace state { set reverse(value: boolean) { pb_1.Message.setField(this, 3, value); } - get turning() { + get dw() { return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean; } - set turning(value: boolean) { + set dw(value: boolean) { pb_1.Message.setField(this, 4, value); } - get split() { + get fw() { return pb_1.Message.getFieldWithDefault(this, 5, false) as boolean; } - set split(value: boolean) { + set fw(value: boolean) { pb_1.Message.setField(this, 5, value); } static fromObject(data: { id?: string; normal?: boolean; reverse?: boolean; - turning?: boolean; - split?: boolean; + dw?: boolean; + fw?: boolean; }): SwitchState { const message = new SwitchState({}); if (data.id != null) { @@ -290,11 +290,11 @@ export namespace state { if (data.reverse != null) { message.reverse = data.reverse; } - if (data.turning != null) { - message.turning = data.turning; + if (data.dw != null) { + message.dw = data.dw; } - if (data.split != null) { - message.split = data.split; + if (data.fw != null) { + message.fw = data.fw; } return message; } @@ -303,8 +303,8 @@ export namespace state { id?: string; normal?: boolean; reverse?: boolean; - turning?: boolean; - split?: boolean; + dw?: boolean; + fw?: boolean; } = {}; if (this.id != null) { data.id = this.id; @@ -315,11 +315,11 @@ export namespace state { if (this.reverse != null) { data.reverse = this.reverse; } - if (this.turning != null) { - data.turning = this.turning; + if (this.dw != null) { + data.dw = this.dw; } - if (this.split != null) { - data.split = this.split; + if (this.fw != null) { + data.fw = this.fw; } return data; } @@ -333,10 +333,10 @@ export namespace state { writer.writeBool(2, this.normal); if (this.reverse != false) writer.writeBool(3, this.reverse); - if (this.turning != false) - writer.writeBool(4, this.turning); - if (this.split != false) - writer.writeBool(5, this.split); + if (this.dw != false) + writer.writeBool(4, this.dw); + if (this.fw != false) + writer.writeBool(5, this.fw); if (!w) return writer.getResultBuffer(); } @@ -356,10 +356,10 @@ export namespace state { message.reverse = reader.readBool(); break; case 4: - message.turning = reader.readBool(); + message.dw = reader.readBool(); break; case 5: - message.split = reader.readBool(); + message.fw = reader.readBool(); break; default: reader.skipField(); }