道岔失表调整

This commit is contained in:
dong 2023-10-07 15:55:35 +08:00
parent bfe3ab20c8
commit 8f142b9ba7
3 changed files with 46 additions and 42 deletions

View File

@ -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<state.SwitchState>();

View File

@ -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() {
// 道岔失表

View File

@ -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();
}