This commit is contained in:
fan 2023-06-28 13:54:32 +08:00
commit 124eb1f758
6 changed files with 128 additions and 165 deletions

View File

@ -43,7 +43,7 @@ export class SectionData extends GraphicDataBase implements ISectionData {
return this.data.pbRef;
}
set pbRef(ref: graphicData.RelatedRef) {
this.data.paRef = ref;
this.data.pbRef = ref;
}
get sectionType(): graphicData.Section.SectionType {
return this.data.sectionType;

View File

@ -64,13 +64,13 @@ export class TurnoutData extends GraphicDataBase implements ITurnoutData {
return new graphicData.RelatedRef();
}
set pbRef(ref: graphicData.RelatedRef) {
this.data.paRef = ref;
this.data.pbRef = ref;
}
get pcRef(): graphicData.RelatedRef {
return new graphicData.RelatedRef();
}
set pcRef(ref: graphicData.RelatedRef) {
this.data.paRef = ref;
this.data.pcRef = ref;
}
clone(): TurnoutData {
return new TurnoutData(this.data.cloneMessage());

View File

@ -211,7 +211,7 @@ export class Section extends JlGraphic implements ILineGraphic {
);
const pbDevice = pbRelation?.getOtherGraphic<Section | Turnout>(this);
if (pbDevice) {
this.datas.paRef = createRelatedRefProto(
this.datas.pbRef = createRelatedRefProto(
pbDevice.type,
pbDevice.id,
pbRelation?.getOtherRelationParam(this).param

View File

@ -12,12 +12,11 @@ export namespace state {
id?: string;
code?: string;
type?: dependency_1.graphicData.Section.SectionType;
paKilometerCode?: string;
pbKilometerCode?: string;
kilometerCode?: string[];
children?: Section[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [6], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("id" in data && data.id != undefined) {
this.id = data.id;
@ -28,11 +27,8 @@ export namespace state {
if ("type" in data && data.type != undefined) {
this.type = data.type;
}
if ("paKilometerCode" in data && data.paKilometerCode != undefined) {
this.paKilometerCode = data.paKilometerCode;
}
if ("pbKilometerCode" in data && data.pbKilometerCode != undefined) {
this.pbKilometerCode = data.pbKilometerCode;
if ("kilometerCode" in data && data.kilometerCode != undefined) {
this.kilometerCode = data.kilometerCode;
}
if ("children" in data && data.children != undefined) {
this.children = data.children;
@ -57,30 +53,23 @@ export namespace state {
set type(value: dependency_1.graphicData.Section.SectionType) {
pb_1.Message.setField(this, 3, value);
}
get paKilometerCode() {
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
get kilometerCode() {
return pb_1.Message.getFieldWithDefault(this, 4, []) as string[];
}
set paKilometerCode(value: string) {
set kilometerCode(value: string[]) {
pb_1.Message.setField(this, 4, value);
}
get pbKilometerCode() {
return pb_1.Message.getFieldWithDefault(this, 5, "") as string;
}
set pbKilometerCode(value: string) {
pb_1.Message.setField(this, 5, value);
}
get children() {
return pb_1.Message.getRepeatedWrapperField(this, Section, 6) as Section[];
return pb_1.Message.getRepeatedWrapperField(this, Section, 5) as Section[];
}
set children(value: Section[]) {
pb_1.Message.setRepeatedWrapperField(this, 6, value);
pb_1.Message.setRepeatedWrapperField(this, 5, value);
}
static fromObject(data: {
id?: string;
code?: string;
type?: dependency_1.graphicData.Section.SectionType;
paKilometerCode?: string;
pbKilometerCode?: string;
kilometerCode?: string[];
children?: ReturnType<typeof Section.prototype.toObject>[];
}): Section {
const message = new Section({});
@ -93,11 +82,8 @@ export namespace state {
if (data.type != null) {
message.type = data.type;
}
if (data.paKilometerCode != null) {
message.paKilometerCode = data.paKilometerCode;
}
if (data.pbKilometerCode != null) {
message.pbKilometerCode = data.pbKilometerCode;
if (data.kilometerCode != null) {
message.kilometerCode = data.kilometerCode;
}
if (data.children != null) {
message.children = data.children.map(item => Section.fromObject(item));
@ -109,8 +95,7 @@ export namespace state {
id?: string;
code?: string;
type?: dependency_1.graphicData.Section.SectionType;
paKilometerCode?: string;
pbKilometerCode?: string;
kilometerCode?: string[];
children?: ReturnType<typeof Section.prototype.toObject>[];
} = {};
if (this.id != null) {
@ -122,11 +107,8 @@ export namespace state {
if (this.type != null) {
data.type = this.type;
}
if (this.paKilometerCode != null) {
data.paKilometerCode = this.paKilometerCode;
}
if (this.pbKilometerCode != null) {
data.pbKilometerCode = this.pbKilometerCode;
if (this.kilometerCode != null) {
data.kilometerCode = this.kilometerCode;
}
if (this.children != null) {
data.children = this.children.map((item: Section) => item.toObject());
@ -143,12 +125,10 @@ export namespace state {
writer.writeString(2, this.code);
if (this.type != dependency_1.graphicData.Section.SectionType.Physical)
writer.writeEnum(3, this.type);
if (this.paKilometerCode.length)
writer.writeString(4, this.paKilometerCode);
if (this.pbKilometerCode.length)
writer.writeString(5, this.pbKilometerCode);
if (this.kilometerCode.length)
writer.writeRepeatedString(4, this.kilometerCode);
if (this.children.length)
writer.writeRepeatedMessage(6, this.children, (item: Section) => item.serialize(writer));
writer.writeRepeatedMessage(5, this.children, (item: Section) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -168,13 +148,10 @@ export namespace state {
message.type = reader.readEnum();
break;
case 4:
message.paKilometerCode = reader.readString();
pb_1.Message.addToRepeatedField(message, 4, reader.readString());
break;
case 5:
message.pbKilometerCode = reader.readString();
break;
case 6:
reader.readMessage(message.children, () => pb_1.Message.addToRepeatedWrapperField(message, 6, Section.deserialize(reader), Section));
reader.readMessage(message.children, () => pb_1.Message.addToRepeatedWrapperField(message, 5, Section.deserialize(reader), Section));
break;
default: reader.skipField();
}

View File

@ -26,10 +26,12 @@ export namespace train {
arriveTime?: number;
departTime?: number;
speed?: number;
show?: boolean;
type?: boolean;
routeId?: number;
rate?: number;
remove?: TrainRemove;
block?: TrainBlock;
record?: TrainRecord;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -85,9 +87,6 @@ export namespace train {
if ("speed" in data && data.speed != undefined) {
this.speed = data.speed;
}
if ("show" in data && data.show != undefined) {
this.show = data.show;
}
if ("type" in data && data.type != undefined) {
this.type = data.type;
}
@ -97,6 +96,15 @@ export namespace train {
if ("rate" in data && data.rate != undefined) {
this.rate = data.rate;
}
if ("remove" in data && data.remove != undefined) {
this.remove = data.remove;
}
if ("block" in data && data.block != undefined) {
this.block = data.block;
}
if ("record" in data && data.record != undefined) {
this.record = data.record;
}
}
}
get lineId() {
@ -207,29 +215,50 @@ export namespace train {
set speed(value: number) {
pb_1.Message.setField(this, 17, value);
}
get show() {
get type() {
return pb_1.Message.getFieldWithDefault(this, 18, false) as boolean;
}
set show(value: boolean) {
set type(value: boolean) {
pb_1.Message.setField(this, 18, value);
}
get type() {
return pb_1.Message.getFieldWithDefault(this, 19, false) as boolean;
}
set type(value: boolean) {
pb_1.Message.setField(this, 19, value);
}
get routeId() {
return pb_1.Message.getFieldWithDefault(this, 20, 0) as number;
return pb_1.Message.getFieldWithDefault(this, 19, 0) as number;
}
set routeId(value: number) {
pb_1.Message.setField(this, 20, value);
pb_1.Message.setField(this, 19, value);
}
get rate() {
return pb_1.Message.getFieldWithDefault(this, 21, 0) as number;
return pb_1.Message.getFieldWithDefault(this, 20, 0) as number;
}
set rate(value: number) {
pb_1.Message.setField(this, 21, value);
pb_1.Message.setField(this, 20, value);
}
get remove() {
return pb_1.Message.getWrapperField(this, TrainRemove, 21) as TrainRemove;
}
set remove(value: TrainRemove) {
pb_1.Message.setWrapperField(this, 21, value);
}
get has_remove() {
return pb_1.Message.getField(this, 21) != null;
}
get block() {
return pb_1.Message.getWrapperField(this, TrainBlock, 22) as TrainBlock;
}
set block(value: TrainBlock) {
pb_1.Message.setWrapperField(this, 22, value);
}
get has_block() {
return pb_1.Message.getField(this, 22) != null;
}
get record() {
return pb_1.Message.getWrapperField(this, TrainRecord, 23) as TrainRecord;
}
set record(value: TrainRecord) {
pb_1.Message.setWrapperField(this, 23, value);
}
get has_record() {
return pb_1.Message.getField(this, 23) != null;
}
static fromObject(data: {
lineId?: number;
@ -249,10 +278,12 @@ export namespace train {
arriveTime?: number;
departTime?: number;
speed?: number;
show?: boolean;
type?: boolean;
routeId?: number;
rate?: number;
remove?: ReturnType<typeof TrainRemove.prototype.toObject>;
block?: ReturnType<typeof TrainBlock.prototype.toObject>;
record?: ReturnType<typeof TrainRecord.prototype.toObject>;
}): TrainInfo {
const message = new TrainInfo({});
if (data.lineId != null) {
@ -306,9 +337,6 @@ export namespace train {
if (data.speed != null) {
message.speed = data.speed;
}
if (data.show != null) {
message.show = data.show;
}
if (data.type != null) {
message.type = data.type;
}
@ -318,6 +346,15 @@ export namespace train {
if (data.rate != null) {
message.rate = data.rate;
}
if (data.remove != null) {
message.remove = TrainRemove.fromObject(data.remove);
}
if (data.block != null) {
message.block = TrainBlock.fromObject(data.block);
}
if (data.record != null) {
message.record = TrainRecord.fromObject(data.record);
}
return message;
}
toObject() {
@ -339,10 +376,12 @@ export namespace train {
arriveTime?: number;
departTime?: number;
speed?: number;
show?: boolean;
type?: boolean;
routeId?: number;
rate?: number;
remove?: ReturnType<typeof TrainRemove.prototype.toObject>;
block?: ReturnType<typeof TrainBlock.prototype.toObject>;
record?: ReturnType<typeof TrainRecord.prototype.toObject>;
} = {};
if (this.lineId != null) {
data.lineId = this.lineId;
@ -395,9 +434,6 @@ export namespace train {
if (this.speed != null) {
data.speed = this.speed;
}
if (this.show != null) {
data.show = this.show;
}
if (this.type != null) {
data.type = this.type;
}
@ -407,6 +443,15 @@ export namespace train {
if (this.rate != null) {
data.rate = this.rate;
}
if (this.remove != null) {
data.remove = this.remove.toObject();
}
if (this.block != null) {
data.block = this.block.toObject();
}
if (this.record != null) {
data.record = this.record.toObject();
}
return data;
}
serialize(): Uint8Array;
@ -447,14 +492,18 @@ export namespace train {
writer.writeInt64(16, this.departTime);
if (this.speed != 0)
writer.writeFloat(17, this.speed);
if (this.show != false)
writer.writeBool(18, this.show);
if (this.type != false)
writer.writeBool(19, this.type);
writer.writeBool(18, this.type);
if (this.routeId != 0)
writer.writeInt32(20, this.routeId);
writer.writeInt32(19, this.routeId);
if (this.rate != 0)
writer.writeInt32(21, this.rate);
writer.writeInt32(20, this.rate);
if (this.has_remove)
writer.writeMessage(21, this.remove, () => this.remove.serialize(writer));
if (this.has_block)
writer.writeMessage(22, this.block, () => this.block.serialize(writer));
if (this.has_record)
writer.writeMessage(23, this.record, () => this.record.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -516,17 +565,23 @@ export namespace train {
message.speed = reader.readFloat();
break;
case 18:
message.show = reader.readBool();
break;
case 19:
message.type = reader.readBool();
break;
case 20:
case 19:
message.routeId = reader.readInt32();
break;
case 21:
case 20:
message.rate = reader.readInt32();
break;
case 21:
reader.readMessage(message.remove, () => message.remove = TrainRemove.deserialize(reader));
break;
case 22:
reader.readMessage(message.block, () => message.block = TrainBlock.deserialize(reader));
break;
case 23:
reader.readMessage(message.record, () => message.record = TrainRecord.deserialize(reader));
break;
default: reader.skipField();
}
}

View File

@ -330,91 +330,37 @@ export namespace state {
export class WsLineTrainMessage extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
train?: dependency_2.train.TrainInfo[];
trainBlock?: dependency_2.train.TrainBlock[];
trainRecord?: dependency_2.train.TrainRecord[];
trainRemove?: dependency_2.train.TrainRemove[];
trainInfo?: dependency_2.train.TrainInfo[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("train" in data && data.train != undefined) {
this.train = data.train;
}
if ("trainBlock" in data && data.trainBlock != undefined) {
this.trainBlock = data.trainBlock;
}
if ("trainRecord" in data && data.trainRecord != undefined) {
this.trainRecord = data.trainRecord;
}
if ("trainRemove" in data && data.trainRemove != undefined) {
this.trainRemove = data.trainRemove;
if ("trainInfo" in data && data.trainInfo != undefined) {
this.trainInfo = data.trainInfo;
}
}
}
get train() {
get trainInfo() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.train.TrainInfo, 1) as dependency_2.train.TrainInfo[];
}
set train(value: dependency_2.train.TrainInfo[]) {
set trainInfo(value: dependency_2.train.TrainInfo[]) {
pb_1.Message.setRepeatedWrapperField(this, 1, value);
}
get trainBlock() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.train.TrainBlock, 2) as dependency_2.train.TrainBlock[];
}
set trainBlock(value: dependency_2.train.TrainBlock[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
get trainRecord() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.train.TrainRecord, 3) as dependency_2.train.TrainRecord[];
}
set trainRecord(value: dependency_2.train.TrainRecord[]) {
pb_1.Message.setRepeatedWrapperField(this, 3, value);
}
get trainRemove() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.train.TrainRemove, 4) as dependency_2.train.TrainRemove[];
}
set trainRemove(value: dependency_2.train.TrainRemove[]) {
pb_1.Message.setRepeatedWrapperField(this, 4, value);
}
static fromObject(data: {
train?: ReturnType<typeof dependency_2.train.TrainInfo.prototype.toObject>[];
trainBlock?: ReturnType<typeof dependency_2.train.TrainBlock.prototype.toObject>[];
trainRecord?: ReturnType<typeof dependency_2.train.TrainRecord.prototype.toObject>[];
trainRemove?: ReturnType<typeof dependency_2.train.TrainRemove.prototype.toObject>[];
trainInfo?: ReturnType<typeof dependency_2.train.TrainInfo.prototype.toObject>[];
}): WsLineTrainMessage {
const message = new WsLineTrainMessage({});
if (data.train != null) {
message.train = data.train.map(item => dependency_2.train.TrainInfo.fromObject(item));
}
if (data.trainBlock != null) {
message.trainBlock = data.trainBlock.map(item => dependency_2.train.TrainBlock.fromObject(item));
}
if (data.trainRecord != null) {
message.trainRecord = data.trainRecord.map(item => dependency_2.train.TrainRecord.fromObject(item));
}
if (data.trainRemove != null) {
message.trainRemove = data.trainRemove.map(item => dependency_2.train.TrainRemove.fromObject(item));
if (data.trainInfo != null) {
message.trainInfo = data.trainInfo.map(item => dependency_2.train.TrainInfo.fromObject(item));
}
return message;
}
toObject() {
const data: {
train?: ReturnType<typeof dependency_2.train.TrainInfo.prototype.toObject>[];
trainBlock?: ReturnType<typeof dependency_2.train.TrainBlock.prototype.toObject>[];
trainRecord?: ReturnType<typeof dependency_2.train.TrainRecord.prototype.toObject>[];
trainRemove?: ReturnType<typeof dependency_2.train.TrainRemove.prototype.toObject>[];
trainInfo?: ReturnType<typeof dependency_2.train.TrainInfo.prototype.toObject>[];
} = {};
if (this.train != null) {
data.train = this.train.map((item: dependency_2.train.TrainInfo) => item.toObject());
}
if (this.trainBlock != null) {
data.trainBlock = this.trainBlock.map((item: dependency_2.train.TrainBlock) => item.toObject());
}
if (this.trainRecord != null) {
data.trainRecord = this.trainRecord.map((item: dependency_2.train.TrainRecord) => item.toObject());
}
if (this.trainRemove != null) {
data.trainRemove = this.trainRemove.map((item: dependency_2.train.TrainRemove) => item.toObject());
if (this.trainInfo != null) {
data.trainInfo = this.trainInfo.map((item: dependency_2.train.TrainInfo) => item.toObject());
}
return data;
}
@ -422,14 +368,8 @@ export namespace state {
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.train.length)
writer.writeRepeatedMessage(1, this.train, (item: dependency_2.train.TrainInfo) => item.serialize(writer));
if (this.trainBlock.length)
writer.writeRepeatedMessage(2, this.trainBlock, (item: dependency_2.train.TrainBlock) => item.serialize(writer));
if (this.trainRecord.length)
writer.writeRepeatedMessage(3, this.trainRecord, (item: dependency_2.train.TrainRecord) => item.serialize(writer));
if (this.trainRemove.length)
writer.writeRepeatedMessage(4, this.trainRemove, (item: dependency_2.train.TrainRemove) => item.serialize(writer));
if (this.trainInfo.length)
writer.writeRepeatedMessage(1, this.trainInfo, (item: dependency_2.train.TrainInfo) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -440,16 +380,7 @@ export namespace state {
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.train, () => pb_1.Message.addToRepeatedWrapperField(message, 1, dependency_2.train.TrainInfo.deserialize(reader), dependency_2.train.TrainInfo));
break;
case 2:
reader.readMessage(message.trainBlock, () => pb_1.Message.addToRepeatedWrapperField(message, 2, dependency_2.train.TrainBlock.deserialize(reader), dependency_2.train.TrainBlock));
break;
case 3:
reader.readMessage(message.trainRecord, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_2.train.TrainRecord.deserialize(reader), dependency_2.train.TrainRecord));
break;
case 4:
reader.readMessage(message.trainRemove, () => pb_1.Message.addToRepeatedWrapperField(message, 4, dependency_2.train.TrainRemove.deserialize(reader), dependency_2.train.TrainRemove));
reader.readMessage(message.trainInfo, () => pb_1.Message.addToRepeatedWrapperField(message, 1, dependency_2.train.TrainInfo.deserialize(reader), dependency_2.train.TrainInfo));
break;
default: reader.skipField();
}