From 9e83e1436df36f55ab805ec7923076a41c488787 Mon Sep 17 00:00:00 2001 From: fan Date: Fri, 13 Sep 2024 16:36:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5proto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rtss-proto-msg | 2 +- src/protos/iscs_graphic_data.ts | 141 +++++++++++++++++++++++++++++++- 2 files changed, 141 insertions(+), 2 deletions(-) diff --git a/rtss-proto-msg b/rtss-proto-msg index d4a3340..d5735a5 160000 --- a/rtss-proto-msg +++ b/rtss-proto-msg @@ -1 +1 @@ -Subproject commit d4a3340f7cee52ce5dc0c5ad4cdbe9cbe5a1d414 +Subproject commit d5735a58f40f7e013e4a4789e47b46e6f3f99adc diff --git a/src/protos/iscs_graphic_data.ts b/src/protos/iscs_graphic_data.ts index f3433b9..2549c80 100644 --- a/src/protos/iscs_graphic_data.ts +++ b/src/protos/iscs_graphic_data.ts @@ -10,9 +10,10 @@ export namespace iscsGraphicData { constructor(data?: any[] | { canvas?: Canvas; UniqueIdPrefix?: UniqueIdOfStationLayout; + arrows?: Arrow[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("canvas" in data && data.canvas != undefined) { this.canvas = data.canvas; @@ -20,6 +21,9 @@ export namespace iscsGraphicData { if ("UniqueIdPrefix" in data && data.UniqueIdPrefix != undefined) { this.UniqueIdPrefix = data.UniqueIdPrefix; } + if ("arrows" in data && data.arrows != undefined) { + this.arrows = data.arrows; + } } } get canvas() { @@ -40,9 +44,16 @@ export namespace iscsGraphicData { get has_UniqueIdPrefix() { return pb_1.Message.getField(this, 2) != null; } + get arrows() { + return pb_1.Message.getRepeatedWrapperField(this, Arrow, 3) as Arrow[]; + } + set arrows(value: Arrow[]) { + pb_1.Message.setRepeatedWrapperField(this, 3, value); + } static fromObject(data: { canvas?: ReturnType; UniqueIdPrefix?: ReturnType; + arrows?: ReturnType[]; }): IscsGraphicStorage { const message = new IscsGraphicStorage({}); if (data.canvas != null) { @@ -51,12 +62,16 @@ export namespace iscsGraphicData { if (data.UniqueIdPrefix != null) { message.UniqueIdPrefix = UniqueIdOfStationLayout.fromObject(data.UniqueIdPrefix); } + if (data.arrows != null) { + message.arrows = data.arrows.map(item => Arrow.fromObject(item)); + } return message; } toObject() { const data: { canvas?: ReturnType; UniqueIdPrefix?: ReturnType; + arrows?: ReturnType[]; } = {}; if (this.canvas != null) { data.canvas = this.canvas.toObject(); @@ -64,6 +79,9 @@ export namespace iscsGraphicData { if (this.UniqueIdPrefix != null) { data.UniqueIdPrefix = this.UniqueIdPrefix.toObject(); } + if (this.arrows != null) { + data.arrows = this.arrows.map((item: Arrow) => item.toObject()); + } return data; } serialize(): Uint8Array; @@ -74,6 +92,8 @@ export namespace iscsGraphicData { writer.writeMessage(1, this.canvas, () => this.canvas.serialize(writer)); if (this.has_UniqueIdPrefix) writer.writeMessage(2, this.UniqueIdPrefix, () => this.UniqueIdPrefix.serialize(writer)); + if (this.arrows.length) + writer.writeRepeatedMessage(3, this.arrows, (item: Arrow) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -89,6 +109,9 @@ export namespace iscsGraphicData { case 2: reader.readMessage(message.UniqueIdPrefix, () => message.UniqueIdPrefix = UniqueIdOfStationLayout.deserialize(reader)); break; + case 3: + reader.readMessage(message.arrows, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Arrow.deserialize(reader), Arrow)); + break; default: reader.skipField(); } } @@ -959,4 +982,120 @@ export namespace iscsGraphicData { return UniqueIdOfStationLayout.deserialize(bytes); } } + export class Arrow extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + common?: CommonInfo; + code?: string; + points?: Point[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("common" in data && data.common != undefined) { + this.common = data.common; + } + if ("code" in data && data.code != undefined) { + this.code = data.code; + } + if ("points" in data && data.points != undefined) { + this.points = data.points; + } + } + } + get common() { + return pb_1.Message.getWrapperField(this, CommonInfo, 1) as CommonInfo; + } + set common(value: CommonInfo) { + pb_1.Message.setWrapperField(this, 1, value); + } + get has_common() { + return pb_1.Message.getField(this, 1) != null; + } + get code() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; + } + set code(value: string) { + pb_1.Message.setField(this, 2, value); + } + get points() { + return pb_1.Message.getRepeatedWrapperField(this, Point, 3) as Point[]; + } + set points(value: Point[]) { + pb_1.Message.setRepeatedWrapperField(this, 3, value); + } + static fromObject(data: { + common?: ReturnType; + code?: string; + points?: ReturnType[]; + }): Arrow { + const message = new Arrow({}); + if (data.common != null) { + message.common = CommonInfo.fromObject(data.common); + } + if (data.code != null) { + message.code = data.code; + } + if (data.points != null) { + message.points = data.points.map(item => Point.fromObject(item)); + } + return message; + } + toObject() { + const data: { + common?: ReturnType; + code?: string; + points?: ReturnType[]; + } = {}; + if (this.common != null) { + data.common = this.common.toObject(); + } + if (this.code != null) { + data.code = this.code; + } + if (this.points != null) { + data.points = this.points.map((item: Point) => item.toObject()); + } + 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.has_common) + writer.writeMessage(1, this.common, () => this.common.serialize(writer)); + if (this.code.length) + writer.writeString(2, this.code); + if (this.points.length) + writer.writeRepeatedMessage(3, this.points, (item: Point) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Arrow { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Arrow(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.common, () => message.common = CommonInfo.deserialize(reader)); + break; + case 2: + message.code = reader.readString(); + break; + case 3: + reader.readMessage(message.points, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Point.deserialize(reader), Point)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): Arrow { + return Arrow.deserialize(bytes); + } + } }