This commit is contained in:
joylink_zhaoerwei 2023-06-16 15:46:29 +08:00
commit 683dc43c8e
3 changed files with 191 additions and 97 deletions

View File

@ -129,8 +129,10 @@ function buildAbsorbablePositions(section: Section): AbsorbablePosition[] {
const turnouts = section.queryStore.queryByType<Turnout>(Turnout.Type);
turnouts.forEach((turnout) => {
turnout.localToCanvasPoints(...turnout.getPortPoints()).forEach((p) => {
aps.push(new AbsorbablePoint(p));
turnout.getPortPoints().forEach((points) => {
turnout.localToCanvasPoints(...points).forEach((p) => {
aps.push(new AbsorbablePoint(p));
});
});
});

View File

@ -198,11 +198,13 @@ export class TurnoutPointsInteractionPlugin extends GraphicInteractionPlugin<Tur
g.transformSave = true;
g.on('selected', this.onSelected, this);
g.on('unselected', this.onUnSelected, this);
g.on('rightclick', this.onContextMenu, this);
}
unbind(g: Turnout): void {
g.off('selected', this.onSelected, this);
g.off('unselected', this.onUnSelected, this);
g.off('rightclick', this.onContextMenu, this);
}
onSelected(g: DisplayObject) {
@ -228,6 +230,10 @@ export class TurnoutPointsInteractionPlugin extends GraphicInteractionPlugin<Tur
}
}
onContextMenu(event: FederatedMouseEvent) {
console.log(event);
}
filter(...grahpics: JlGraphic[]): Turnout[] | undefined {
return grahpics.filter((g) => g.type == Turnout.Type) as Turnout[];
}
@ -282,7 +288,6 @@ export class TurnoutEditPlugin extends GraphicEditPlugin<Turnout> {
this.editPoints[i].push(dp);
});
});
console.log(this.editPoints);
this.editPoints.forEach((cps) => {
this.addChild(...cps);
});

View File

@ -4,12 +4,12 @@
* source: ws_message.proto
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./device_status";
import * as dependency_2 from "./LineNetTrainOffsetDiagram";
import * as pb_1 from "google-protobuf";
export namespace state {
export class WsLineMessage extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
lineId?: number;
rtu?: dependency_1.state.Rtu[];
station?: dependency_1.state.Station[];
signal?: dependency_1.state.Signal[];
@ -25,11 +25,8 @@ export namespace state {
netWork?: dependency_1.state.OccNccFepNetwork[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("lineId" in data && data.lineId != undefined) {
this.lineId = data.lineId;
}
if ("rtu" in data && data.rtu != undefined) {
this.rtu = data.rtu;
}
@ -71,92 +68,85 @@ export namespace state {
}
}
}
get lineId() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set lineId(value: number) {
pb_1.Message.setField(this, 1, value);
}
get rtu() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Rtu, 2) as dependency_1.state.Rtu[];
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Rtu, 1) as dependency_1.state.Rtu[];
}
set rtu(value: dependency_1.state.Rtu[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
pb_1.Message.setRepeatedWrapperField(this, 1, value);
}
get station() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Station, 3) as dependency_1.state.Station[];
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Station, 2) as dependency_1.state.Station[];
}
set station(value: dependency_1.state.Station[]) {
pb_1.Message.setRepeatedWrapperField(this, 3, value);
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
get signal() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Signal, 4) as dependency_1.state.Signal[];
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Signal, 3) as dependency_1.state.Signal[];
}
set signal(value: dependency_1.state.Signal[]) {
pb_1.Message.setRepeatedWrapperField(this, 4, value);
pb_1.Message.setRepeatedWrapperField(this, 3, value);
}
get entry() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Entry, 5) as dependency_1.state.Entry[];
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Entry, 4) as dependency_1.state.Entry[];
}
set entry(value: dependency_1.state.Entry[]) {
pb_1.Message.setRepeatedWrapperField(this, 5, value);
pb_1.Message.setRepeatedWrapperField(this, 4, value);
}
get switch() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Switch, 6) as dependency_1.state.Switch[];
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Switch, 5) as dependency_1.state.Switch[];
}
set switch(value: dependency_1.state.Switch[]) {
pb_1.Message.setRepeatedWrapperField(this, 6, value);
pb_1.Message.setRepeatedWrapperField(this, 5, value);
}
get track() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Track, 7) as dependency_1.state.Track[];
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Track, 6) as dependency_1.state.Track[];
}
set track(value: dependency_1.state.Track[]) {
pb_1.Message.setRepeatedWrapperField(this, 7, value);
pb_1.Message.setRepeatedWrapperField(this, 6, value);
}
get platform() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Platform, 8) as dependency_1.state.Platform[];
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Platform, 7) as dependency_1.state.Platform[];
}
set platform(value: dependency_1.state.Platform[]) {
pb_1.Message.setRepeatedWrapperField(this, 8, value);
pb_1.Message.setRepeatedWrapperField(this, 7, value);
}
get scada() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Scada, 9) as dependency_1.state.Scada[];
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Scada, 8) as dependency_1.state.Scada[];
}
set scada(value: dependency_1.state.Scada[]) {
pb_1.Message.setRepeatedWrapperField(this, 9, value);
pb_1.Message.setRepeatedWrapperField(this, 8, value);
}
get waterProofDoor() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.WaterProofDoor, 10) as dependency_1.state.WaterProofDoor[];
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.WaterProofDoor, 9) as dependency_1.state.WaterProofDoor[];
}
set waterProofDoor(value: dependency_1.state.WaterProofDoor[]) {
pb_1.Message.setRepeatedWrapperField(this, 10, value);
pb_1.Message.setRepeatedWrapperField(this, 9, value);
}
get workArea() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.WorkArea, 11) as dependency_1.state.WorkArea[];
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.WorkArea, 10) as dependency_1.state.WorkArea[];
}
set workArea(value: dependency_1.state.WorkArea[]) {
pb_1.Message.setRepeatedWrapperField(this, 11, value);
pb_1.Message.setRepeatedWrapperField(this, 10, value);
}
get gama() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Gama, 12) as dependency_1.state.Gama[];
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Gama, 11) as dependency_1.state.Gama[];
}
set gama(value: dependency_1.state.Gama[]) {
pb_1.Message.setRepeatedWrapperField(this, 12, value);
pb_1.Message.setRepeatedWrapperField(this, 11, value);
}
get trainMode() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.TrainMode, 13) as dependency_1.state.TrainMode[];
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.TrainMode, 12) as dependency_1.state.TrainMode[];
}
set trainMode(value: dependency_1.state.TrainMode[]) {
pb_1.Message.setRepeatedWrapperField(this, 13, value);
pb_1.Message.setRepeatedWrapperField(this, 12, value);
}
get netWork() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.OccNccFepNetwork, 14) as dependency_1.state.OccNccFepNetwork[];
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.OccNccFepNetwork, 13) as dependency_1.state.OccNccFepNetwork[];
}
set netWork(value: dependency_1.state.OccNccFepNetwork[]) {
pb_1.Message.setRepeatedWrapperField(this, 14, value);
pb_1.Message.setRepeatedWrapperField(this, 13, value);
}
static fromObject(data: {
lineId?: number;
rtu?: ReturnType<typeof dependency_1.state.Rtu.prototype.toObject>[];
station?: ReturnType<typeof dependency_1.state.Station.prototype.toObject>[];
signal?: ReturnType<typeof dependency_1.state.Signal.prototype.toObject>[];
@ -172,9 +162,6 @@ export namespace state {
netWork?: ReturnType<typeof dependency_1.state.OccNccFepNetwork.prototype.toObject>[];
}): WsLineMessage {
const message = new WsLineMessage({});
if (data.lineId != null) {
message.lineId = data.lineId;
}
if (data.rtu != null) {
message.rtu = data.rtu.map(item => dependency_1.state.Rtu.fromObject(item));
}
@ -218,7 +205,6 @@ export namespace state {
}
toObject() {
const data: {
lineId?: number;
rtu?: ReturnType<typeof dependency_1.state.Rtu.prototype.toObject>[];
station?: ReturnType<typeof dependency_1.state.Station.prototype.toObject>[];
signal?: ReturnType<typeof dependency_1.state.Signal.prototype.toObject>[];
@ -233,9 +219,6 @@ export namespace state {
trainMode?: ReturnType<typeof dependency_1.state.TrainMode.prototype.toObject>[];
netWork?: ReturnType<typeof dependency_1.state.OccNccFepNetwork.prototype.toObject>[];
} = {};
if (this.lineId != null) {
data.lineId = this.lineId;
}
if (this.rtu != null) {
data.rtu = this.rtu.map((item: dependency_1.state.Rtu) => item.toObject());
}
@ -281,34 +264,32 @@ 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.lineId != 0)
writer.writeInt32(1, this.lineId);
if (this.rtu.length)
writer.writeRepeatedMessage(2, this.rtu, (item: dependency_1.state.Rtu) => item.serialize(writer));
writer.writeRepeatedMessage(1, this.rtu, (item: dependency_1.state.Rtu) => item.serialize(writer));
if (this.station.length)
writer.writeRepeatedMessage(3, this.station, (item: dependency_1.state.Station) => item.serialize(writer));
writer.writeRepeatedMessage(2, this.station, (item: dependency_1.state.Station) => item.serialize(writer));
if (this.signal.length)
writer.writeRepeatedMessage(4, this.signal, (item: dependency_1.state.Signal) => item.serialize(writer));
writer.writeRepeatedMessage(3, this.signal, (item: dependency_1.state.Signal) => item.serialize(writer));
if (this.entry.length)
writer.writeRepeatedMessage(5, this.entry, (item: dependency_1.state.Entry) => item.serialize(writer));
writer.writeRepeatedMessage(4, this.entry, (item: dependency_1.state.Entry) => item.serialize(writer));
if (this.switch.length)
writer.writeRepeatedMessage(6, this.switch, (item: dependency_1.state.Switch) => item.serialize(writer));
writer.writeRepeatedMessage(5, this.switch, (item: dependency_1.state.Switch) => item.serialize(writer));
if (this.track.length)
writer.writeRepeatedMessage(7, this.track, (item: dependency_1.state.Track) => item.serialize(writer));
writer.writeRepeatedMessage(6, this.track, (item: dependency_1.state.Track) => item.serialize(writer));
if (this.platform.length)
writer.writeRepeatedMessage(8, this.platform, (item: dependency_1.state.Platform) => item.serialize(writer));
writer.writeRepeatedMessage(7, this.platform, (item: dependency_1.state.Platform) => item.serialize(writer));
if (this.scada.length)
writer.writeRepeatedMessage(9, this.scada, (item: dependency_1.state.Scada) => item.serialize(writer));
writer.writeRepeatedMessage(8, this.scada, (item: dependency_1.state.Scada) => item.serialize(writer));
if (this.waterProofDoor.length)
writer.writeRepeatedMessage(10, this.waterProofDoor, (item: dependency_1.state.WaterProofDoor) => item.serialize(writer));
writer.writeRepeatedMessage(9, this.waterProofDoor, (item: dependency_1.state.WaterProofDoor) => item.serialize(writer));
if (this.workArea.length)
writer.writeRepeatedMessage(11, this.workArea, (item: dependency_1.state.WorkArea) => item.serialize(writer));
writer.writeRepeatedMessage(10, this.workArea, (item: dependency_1.state.WorkArea) => item.serialize(writer));
if (this.gama.length)
writer.writeRepeatedMessage(12, this.gama, (item: dependency_1.state.Gama) => item.serialize(writer));
writer.writeRepeatedMessage(11, this.gama, (item: dependency_1.state.Gama) => item.serialize(writer));
if (this.trainMode.length)
writer.writeRepeatedMessage(13, this.trainMode, (item: dependency_1.state.TrainMode) => item.serialize(writer));
writer.writeRepeatedMessage(12, this.trainMode, (item: dependency_1.state.TrainMode) => item.serialize(writer));
if (this.netWork.length)
writer.writeRepeatedMessage(14, this.netWork, (item: dependency_1.state.OccNccFepNetwork) => item.serialize(writer));
writer.writeRepeatedMessage(13, this.netWork, (item: dependency_1.state.OccNccFepNetwork) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -319,46 +300,43 @@ export namespace state {
break;
switch (reader.getFieldNumber()) {
case 1:
message.lineId = reader.readInt32();
reader.readMessage(message.rtu, () => pb_1.Message.addToRepeatedWrapperField(message, 1, dependency_1.state.Rtu.deserialize(reader), dependency_1.state.Rtu));
break;
case 2:
reader.readMessage(message.rtu, () => pb_1.Message.addToRepeatedWrapperField(message, 2, dependency_1.state.Rtu.deserialize(reader), dependency_1.state.Rtu));
reader.readMessage(message.station, () => pb_1.Message.addToRepeatedWrapperField(message, 2, dependency_1.state.Station.deserialize(reader), dependency_1.state.Station));
break;
case 3:
reader.readMessage(message.station, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_1.state.Station.deserialize(reader), dependency_1.state.Station));
reader.readMessage(message.signal, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_1.state.Signal.deserialize(reader), dependency_1.state.Signal));
break;
case 4:
reader.readMessage(message.signal, () => pb_1.Message.addToRepeatedWrapperField(message, 4, dependency_1.state.Signal.deserialize(reader), dependency_1.state.Signal));
reader.readMessage(message.entry, () => pb_1.Message.addToRepeatedWrapperField(message, 4, dependency_1.state.Entry.deserialize(reader), dependency_1.state.Entry));
break;
case 5:
reader.readMessage(message.entry, () => pb_1.Message.addToRepeatedWrapperField(message, 5, dependency_1.state.Entry.deserialize(reader), dependency_1.state.Entry));
reader.readMessage(message.switch, () => pb_1.Message.addToRepeatedWrapperField(message, 5, dependency_1.state.Switch.deserialize(reader), dependency_1.state.Switch));
break;
case 6:
reader.readMessage(message.switch, () => pb_1.Message.addToRepeatedWrapperField(message, 6, dependency_1.state.Switch.deserialize(reader), dependency_1.state.Switch));
reader.readMessage(message.track, () => pb_1.Message.addToRepeatedWrapperField(message, 6, dependency_1.state.Track.deserialize(reader), dependency_1.state.Track));
break;
case 7:
reader.readMessage(message.track, () => pb_1.Message.addToRepeatedWrapperField(message, 7, dependency_1.state.Track.deserialize(reader), dependency_1.state.Track));
reader.readMessage(message.platform, () => pb_1.Message.addToRepeatedWrapperField(message, 7, dependency_1.state.Platform.deserialize(reader), dependency_1.state.Platform));
break;
case 8:
reader.readMessage(message.platform, () => pb_1.Message.addToRepeatedWrapperField(message, 8, dependency_1.state.Platform.deserialize(reader), dependency_1.state.Platform));
reader.readMessage(message.scada, () => pb_1.Message.addToRepeatedWrapperField(message, 8, dependency_1.state.Scada.deserialize(reader), dependency_1.state.Scada));
break;
case 9:
reader.readMessage(message.scada, () => pb_1.Message.addToRepeatedWrapperField(message, 9, dependency_1.state.Scada.deserialize(reader), dependency_1.state.Scada));
reader.readMessage(message.waterProofDoor, () => pb_1.Message.addToRepeatedWrapperField(message, 9, dependency_1.state.WaterProofDoor.deserialize(reader), dependency_1.state.WaterProofDoor));
break;
case 10:
reader.readMessage(message.waterProofDoor, () => pb_1.Message.addToRepeatedWrapperField(message, 10, dependency_1.state.WaterProofDoor.deserialize(reader), dependency_1.state.WaterProofDoor));
reader.readMessage(message.workArea, () => pb_1.Message.addToRepeatedWrapperField(message, 10, dependency_1.state.WorkArea.deserialize(reader), dependency_1.state.WorkArea));
break;
case 11:
reader.readMessage(message.workArea, () => pb_1.Message.addToRepeatedWrapperField(message, 11, dependency_1.state.WorkArea.deserialize(reader), dependency_1.state.WorkArea));
reader.readMessage(message.gama, () => pb_1.Message.addToRepeatedWrapperField(message, 11, dependency_1.state.Gama.deserialize(reader), dependency_1.state.Gama));
break;
case 12:
reader.readMessage(message.gama, () => pb_1.Message.addToRepeatedWrapperField(message, 12, dependency_1.state.Gama.deserialize(reader), dependency_1.state.Gama));
reader.readMessage(message.trainMode, () => pb_1.Message.addToRepeatedWrapperField(message, 12, dependency_1.state.TrainMode.deserialize(reader), dependency_1.state.TrainMode));
break;
case 13:
reader.readMessage(message.trainMode, () => pb_1.Message.addToRepeatedWrapperField(message, 13, dependency_1.state.TrainMode.deserialize(reader), dependency_1.state.TrainMode));
break;
case 14:
reader.readMessage(message.netWork, () => pb_1.Message.addToRepeatedWrapperField(message, 14, dependency_1.state.OccNccFepNetwork.deserialize(reader), dependency_1.state.OccNccFepNetwork));
reader.readMessage(message.netWork, () => pb_1.Message.addToRepeatedWrapperField(message, 13, dependency_1.state.OccNccFepNetwork.deserialize(reader), dependency_1.state.OccNccFepNetwork));
break;
default: reader.skipField();
}
@ -372,40 +350,40 @@ export namespace state {
return WsLineMessage.deserialize(bytes);
}
}
export class WsMessage extends pb_1.Message {
export class WsLineNetMessage extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
message?: WsLineMessage[];
diagram?: dependency_2.diagram.LineNetTrainOffsetDiagram[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("message" in data && data.message != undefined) {
this.message = data.message;
if ("diagram" in data && data.diagram != undefined) {
this.diagram = data.diagram;
}
}
}
get message() {
return pb_1.Message.getRepeatedWrapperField(this, WsLineMessage, 1) as WsLineMessage[];
get diagram() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.diagram.LineNetTrainOffsetDiagram, 1) as dependency_2.diagram.LineNetTrainOffsetDiagram[];
}
set message(value: WsLineMessage[]) {
set diagram(value: dependency_2.diagram.LineNetTrainOffsetDiagram[]) {
pb_1.Message.setRepeatedWrapperField(this, 1, value);
}
static fromObject(data: {
message?: ReturnType<typeof WsLineMessage.prototype.toObject>[];
}): WsMessage {
const message = new WsMessage({});
if (data.message != null) {
message.message = data.message.map(item => WsLineMessage.fromObject(item));
diagram?: ReturnType<typeof dependency_2.diagram.LineNetTrainOffsetDiagram.prototype.toObject>[];
}): WsLineNetMessage {
const message = new WsLineNetMessage({});
if (data.diagram != null) {
message.diagram = data.diagram.map(item => dependency_2.diagram.LineNetTrainOffsetDiagram.fromObject(item));
}
return message;
}
toObject() {
const data: {
message?: ReturnType<typeof WsLineMessage.prototype.toObject>[];
diagram?: ReturnType<typeof dependency_2.diagram.LineNetTrainOffsetDiagram.prototype.toObject>[];
} = {};
if (this.message != null) {
data.message = this.message.map((item: WsLineMessage) => item.toObject());
if (this.diagram != null) {
data.diagram = this.diagram.map((item: dependency_2.diagram.LineNetTrainOffsetDiagram) => item.toObject());
}
return data;
}
@ -413,8 +391,114 @@ 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.message.length)
writer.writeRepeatedMessage(1, this.message, (item: WsLineMessage) => item.serialize(writer));
if (this.diagram.length)
writer.writeRepeatedMessage(1, this.diagram, (item: dependency_2.diagram.LineNetTrainOffsetDiagram) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): WsLineNetMessage {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new WsLineNetMessage();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.diagram, () => pb_1.Message.addToRepeatedWrapperField(message, 1, dependency_2.diagram.LineNetTrainOffsetDiagram.deserialize(reader), dependency_2.diagram.LineNetTrainOffsetDiagram));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): WsLineNetMessage {
return WsLineNetMessage.deserialize(bytes);
}
}
export class WsMessage extends pb_1.Message {
#one_of_decls: number[][] = [[1, 2]];
constructor(data?: any[] | ({} & (({
lineMessage?: WsLineMessage;
lineNetMessage?: never;
} | {
lineMessage?: never;
lineNetMessage?: WsLineNetMessage;
})))) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("lineMessage" in data && data.lineMessage != undefined) {
this.lineMessage = data.lineMessage;
}
if ("lineNetMessage" in data && data.lineNetMessage != undefined) {
this.lineNetMessage = data.lineNetMessage;
}
}
}
get lineMessage() {
return pb_1.Message.getWrapperField(this, WsLineMessage, 1) as WsLineMessage;
}
set lineMessage(value: WsLineMessage) {
pb_1.Message.setOneofWrapperField(this, 1, this.#one_of_decls[0], value);
}
get has_lineMessage() {
return pb_1.Message.getField(this, 1) != null;
}
get lineNetMessage() {
return pb_1.Message.getWrapperField(this, WsLineNetMessage, 2) as WsLineNetMessage;
}
set lineNetMessage(value: WsLineNetMessage) {
pb_1.Message.setOneofWrapperField(this, 2, this.#one_of_decls[0], value);
}
get has_lineNetMessage() {
return pb_1.Message.getField(this, 2) != null;
}
get message_oneOf() {
const cases: {
[index: number]: "none" | "lineMessage" | "lineNetMessage";
} = {
0: "none",
1: "lineMessage",
2: "lineNetMessage"
};
return cases[pb_1.Message.computeOneofCase(this, [1, 2])];
}
static fromObject(data: {
lineMessage?: ReturnType<typeof WsLineMessage.prototype.toObject>;
lineNetMessage?: ReturnType<typeof WsLineNetMessage.prototype.toObject>;
}): WsMessage {
const message = new WsMessage({});
if (data.lineMessage != null) {
message.lineMessage = WsLineMessage.fromObject(data.lineMessage);
}
if (data.lineNetMessage != null) {
message.lineNetMessage = WsLineNetMessage.fromObject(data.lineNetMessage);
}
return message;
}
toObject() {
const data: {
lineMessage?: ReturnType<typeof WsLineMessage.prototype.toObject>;
lineNetMessage?: ReturnType<typeof WsLineNetMessage.prototype.toObject>;
} = {};
if (this.lineMessage != null) {
data.lineMessage = this.lineMessage.toObject();
}
if (this.lineNetMessage != null) {
data.lineNetMessage = this.lineNetMessage.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_lineMessage)
writer.writeMessage(1, this.lineMessage, () => this.lineMessage.serialize(writer));
if (this.has_lineNetMessage)
writer.writeMessage(2, this.lineNetMessage, () => this.lineNetMessage.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -425,7 +509,10 @@ export namespace state {
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.message, () => pb_1.Message.addToRepeatedWrapperField(message, 1, WsLineMessage.deserialize(reader), WsLineMessage));
reader.readMessage(message.lineMessage, () => message.lineMessage = WsLineMessage.deserialize(reader));
break;
case 2:
reader.readMessage(message.lineNetMessage, () => message.lineNetMessage = WsLineNetMessage.deserialize(reader));
break;
default: reader.skipField();
}