子模块同步
This commit is contained in:
parent
2273218dfb
commit
658ab9efb1
@ -1 +1 @@
|
|||||||
Subproject commit f12288dffe11443fbf16c02b9e1f39f3b44ceda2
|
Subproject commit f6f49ec19378c9a9845c53bd4425143f654ae59e
|
@ -1 +1 @@
|
|||||||
Subproject commit 0a0cb0a77afd9783081c2dc6ba19687b0b3aa0f7
|
Subproject commit a7debf165e24e6200d7c986555f31c721792af38
|
@ -528,7 +528,10 @@ export class GraphicApp extends EventEmitter<GraphicAppEvents> {
|
|||||||
*/
|
*/
|
||||||
handleGraphicStates(graphicStates: GraphicState[]) {
|
handleGraphicStates(graphicStates: GraphicState[]) {
|
||||||
graphicStates.forEach((state) => {
|
graphicStates.forEach((state) => {
|
||||||
const list = this.queryStore.queryByIdOrCode(state.code);
|
const list = this.queryStore.queryByIdOrCodeAndType(
|
||||||
|
state.code,
|
||||||
|
state.graphicType
|
||||||
|
);
|
||||||
if (list.length == 0) {
|
if (list.length == 0) {
|
||||||
const template = this.getGraphicTemplatesByType(state.graphicType);
|
const template = this.getGraphicTemplatesByType(state.graphicType);
|
||||||
const g = template.new();
|
const g = template.new();
|
||||||
|
@ -37,6 +37,12 @@ export interface GraphicQueryStore {
|
|||||||
* @param v
|
* @param v
|
||||||
*/
|
*/
|
||||||
queryByIdOrCode(v: string): JlGraphic[];
|
queryByIdOrCode(v: string): JlGraphic[];
|
||||||
|
/**
|
||||||
|
* 根据id或code及类型查询图形
|
||||||
|
* @param v
|
||||||
|
* @param type
|
||||||
|
*/
|
||||||
|
queryByIdOrCodeAndType(v: string, type: string): JlGraphic[];
|
||||||
/**
|
/**
|
||||||
* 根据code和类型获取图形
|
* 根据code和类型获取图形
|
||||||
* @param code
|
* @param code
|
||||||
@ -69,6 +75,7 @@ export class GraphicStore implements GraphicQueryStore {
|
|||||||
this.store = new Map<string, JlGraphic>();
|
this.store = new Map<string, JlGraphic>();
|
||||||
this.relationManage = new RelationManage(app);
|
this.relationManage = new RelationManage(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有图形对象
|
* 获取所有图形对象
|
||||||
*/
|
*/
|
||||||
@ -125,6 +132,15 @@ export class GraphicStore implements GraphicQueryStore {
|
|||||||
});
|
});
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
queryByIdOrCodeAndType(s: string, type: string): JlGraphic[] {
|
||||||
|
const list: JlGraphic[] = [];
|
||||||
|
this.store.forEach((g) => {
|
||||||
|
if (g.isIdOrCode(s) && g.type === type) {
|
||||||
|
list.push(g);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return list;
|
||||||
|
}
|
||||||
queryByCodeAndType<T extends JlGraphic>(
|
queryByCodeAndType<T extends JlGraphic>(
|
||||||
code: string,
|
code: string,
|
||||||
type: string
|
type: string
|
||||||
|
@ -32,13 +32,13 @@ export abstract class GraphicEditPlugin<
|
|||||||
this.sortableChildren = true;
|
this.sortableChildren = true;
|
||||||
this.graphic.on('transformstart', this.hideAll, this);
|
this.graphic.on('transformstart', this.hideAll, this);
|
||||||
this.graphic.on('transformend', this.showAll, this);
|
this.graphic.on('transformend', this.showAll, this);
|
||||||
this.graphic.on('repaint', this.showAll, this);
|
this.graphic.on('repaint', this.updateEditedPointsPosition, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy(options?: boolean | IDestroyOptions | undefined): void {
|
destroy(options?: boolean | IDestroyOptions | undefined): void {
|
||||||
this.graphic.off('transformstart', this.hideAll, this);
|
this.graphic.off('transformstart', this.hideAll, this);
|
||||||
this.graphic.off('transformend', this.showAll, this);
|
this.graphic.off('transformend', this.showAll, this);
|
||||||
this.graphic.off('repaint', this.showAll, this);
|
this.graphic.off('repaint', this.updateEditedPointsPosition, this);
|
||||||
super.destroy(options);
|
super.destroy(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
512
src/protos/device_state.ts
Normal file
512
src/protos/device_state.ts
Normal file
@ -0,0 +1,512 @@
|
|||||||
|
/**
|
||||||
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
|
* compiler version: 4.23.1
|
||||||
|
* source: device_state.proto
|
||||||
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
|
import * as pb_1 from "google-protobuf";
|
||||||
|
export namespace state {
|
||||||
|
export enum SectionType {
|
||||||
|
Any = 0,
|
||||||
|
Axle = 1,
|
||||||
|
Logic = 2,
|
||||||
|
Physic = 3
|
||||||
|
}
|
||||||
|
export class LinkState extends pb_1.Message {
|
||||||
|
#one_of_decls: number[][] = [];
|
||||||
|
constructor(data?: any[] | {
|
||||||
|
id?: string;
|
||||||
|
trainId?: string[];
|
||||||
|
}) {
|
||||||
|
super();
|
||||||
|
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
|
||||||
|
if (!Array.isArray(data) && typeof data == "object") {
|
||||||
|
if ("id" in data && data.id != undefined) {
|
||||||
|
this.id = data.id;
|
||||||
|
}
|
||||||
|
if ("trainId" in data && data.trainId != undefined) {
|
||||||
|
this.trainId = data.trainId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get id() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||||
|
}
|
||||||
|
set id(value: string) {
|
||||||
|
pb_1.Message.setField(this, 1, value);
|
||||||
|
}
|
||||||
|
get trainId() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 2, []) as string[];
|
||||||
|
}
|
||||||
|
set trainId(value: string[]) {
|
||||||
|
pb_1.Message.setField(this, 2, value);
|
||||||
|
}
|
||||||
|
static fromObject(data: {
|
||||||
|
id?: string;
|
||||||
|
trainId?: string[];
|
||||||
|
}): LinkState {
|
||||||
|
const message = new LinkState({});
|
||||||
|
if (data.id != null) {
|
||||||
|
message.id = data.id;
|
||||||
|
}
|
||||||
|
if (data.trainId != null) {
|
||||||
|
message.trainId = data.trainId;
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
toObject() {
|
||||||
|
const data: {
|
||||||
|
id?: string;
|
||||||
|
trainId?: string[];
|
||||||
|
} = {};
|
||||||
|
if (this.id != null) {
|
||||||
|
data.id = this.id;
|
||||||
|
}
|
||||||
|
if (this.trainId != null) {
|
||||||
|
data.trainId = this.trainId;
|
||||||
|
}
|
||||||
|
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.id.length)
|
||||||
|
writer.writeString(1, this.id);
|
||||||
|
if (this.trainId.length)
|
||||||
|
writer.writeRepeatedString(2, this.trainId);
|
||||||
|
if (!w)
|
||||||
|
return writer.getResultBuffer();
|
||||||
|
}
|
||||||
|
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): LinkState {
|
||||||
|
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new LinkState();
|
||||||
|
while (reader.nextField()) {
|
||||||
|
if (reader.isEndGroup())
|
||||||
|
break;
|
||||||
|
switch (reader.getFieldNumber()) {
|
||||||
|
case 1:
|
||||||
|
message.id = reader.readString();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
pb_1.Message.addToRepeatedField(message, 2, reader.readString());
|
||||||
|
break;
|
||||||
|
default: reader.skipField();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
serializeBinary(): Uint8Array {
|
||||||
|
return this.serialize();
|
||||||
|
}
|
||||||
|
static deserializeBinary(bytes: Uint8Array): LinkState {
|
||||||
|
return LinkState.deserialize(bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class SectionState extends pb_1.Message {
|
||||||
|
#one_of_decls: number[][] = [];
|
||||||
|
constructor(data?: any[] | {
|
||||||
|
id?: string;
|
||||||
|
type?: SectionType;
|
||||||
|
occupied?: boolean;
|
||||||
|
}) {
|
||||||
|
super();
|
||||||
|
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||||
|
if (!Array.isArray(data) && typeof data == "object") {
|
||||||
|
if ("id" in data && data.id != undefined) {
|
||||||
|
this.id = data.id;
|
||||||
|
}
|
||||||
|
if ("type" in data && data.type != undefined) {
|
||||||
|
this.type = data.type;
|
||||||
|
}
|
||||||
|
if ("occupied" in data && data.occupied != undefined) {
|
||||||
|
this.occupied = data.occupied;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get id() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||||
|
}
|
||||||
|
set id(value: string) {
|
||||||
|
pb_1.Message.setField(this, 1, value);
|
||||||
|
}
|
||||||
|
get type() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 2, SectionType.Any) as SectionType;
|
||||||
|
}
|
||||||
|
set type(value: SectionType) {
|
||||||
|
pb_1.Message.setField(this, 2, value);
|
||||||
|
}
|
||||||
|
get occupied() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 3, false) as boolean;
|
||||||
|
}
|
||||||
|
set occupied(value: boolean) {
|
||||||
|
pb_1.Message.setField(this, 3, value);
|
||||||
|
}
|
||||||
|
static fromObject(data: {
|
||||||
|
id?: string;
|
||||||
|
type?: SectionType;
|
||||||
|
occupied?: boolean;
|
||||||
|
}): SectionState {
|
||||||
|
const message = new SectionState({});
|
||||||
|
if (data.id != null) {
|
||||||
|
message.id = data.id;
|
||||||
|
}
|
||||||
|
if (data.type != null) {
|
||||||
|
message.type = data.type;
|
||||||
|
}
|
||||||
|
if (data.occupied != null) {
|
||||||
|
message.occupied = data.occupied;
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
toObject() {
|
||||||
|
const data: {
|
||||||
|
id?: string;
|
||||||
|
type?: SectionType;
|
||||||
|
occupied?: boolean;
|
||||||
|
} = {};
|
||||||
|
if (this.id != null) {
|
||||||
|
data.id = this.id;
|
||||||
|
}
|
||||||
|
if (this.type != null) {
|
||||||
|
data.type = this.type;
|
||||||
|
}
|
||||||
|
if (this.occupied != null) {
|
||||||
|
data.occupied = this.occupied;
|
||||||
|
}
|
||||||
|
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.id.length)
|
||||||
|
writer.writeString(1, this.id);
|
||||||
|
if (this.type != SectionType.Any)
|
||||||
|
writer.writeEnum(2, this.type);
|
||||||
|
if (this.occupied != false)
|
||||||
|
writer.writeBool(3, this.occupied);
|
||||||
|
if (!w)
|
||||||
|
return writer.getResultBuffer();
|
||||||
|
}
|
||||||
|
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SectionState {
|
||||||
|
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SectionState();
|
||||||
|
while (reader.nextField()) {
|
||||||
|
if (reader.isEndGroup())
|
||||||
|
break;
|
||||||
|
switch (reader.getFieldNumber()) {
|
||||||
|
case 1:
|
||||||
|
message.id = reader.readString();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
message.type = reader.readEnum();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
message.occupied = reader.readBool();
|
||||||
|
break;
|
||||||
|
default: reader.skipField();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
serializeBinary(): Uint8Array {
|
||||||
|
return this.serialize();
|
||||||
|
}
|
||||||
|
static deserializeBinary(bytes: Uint8Array): SectionState {
|
||||||
|
return SectionState.deserialize(bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class SwitchState extends pb_1.Message {
|
||||||
|
#one_of_decls: number[][] = [];
|
||||||
|
constructor(data?: any[] | {
|
||||||
|
id?: string;
|
||||||
|
normal?: boolean;
|
||||||
|
reverse?: boolean;
|
||||||
|
}) {
|
||||||
|
super();
|
||||||
|
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||||
|
if (!Array.isArray(data) && typeof data == "object") {
|
||||||
|
if ("id" in data && data.id != undefined) {
|
||||||
|
this.id = data.id;
|
||||||
|
}
|
||||||
|
if ("normal" in data && data.normal != undefined) {
|
||||||
|
this.normal = data.normal;
|
||||||
|
}
|
||||||
|
if ("reverse" in data && data.reverse != undefined) {
|
||||||
|
this.reverse = data.reverse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get id() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||||
|
}
|
||||||
|
set id(value: string) {
|
||||||
|
pb_1.Message.setField(this, 1, value);
|
||||||
|
}
|
||||||
|
get normal() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 2, false) as boolean;
|
||||||
|
}
|
||||||
|
set normal(value: boolean) {
|
||||||
|
pb_1.Message.setField(this, 2, value);
|
||||||
|
}
|
||||||
|
get reverse() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 3, false) as boolean;
|
||||||
|
}
|
||||||
|
set reverse(value: boolean) {
|
||||||
|
pb_1.Message.setField(this, 3, value);
|
||||||
|
}
|
||||||
|
static fromObject(data: {
|
||||||
|
id?: string;
|
||||||
|
normal?: boolean;
|
||||||
|
reverse?: boolean;
|
||||||
|
}): SwitchState {
|
||||||
|
const message = new SwitchState({});
|
||||||
|
if (data.id != null) {
|
||||||
|
message.id = data.id;
|
||||||
|
}
|
||||||
|
if (data.normal != null) {
|
||||||
|
message.normal = data.normal;
|
||||||
|
}
|
||||||
|
if (data.reverse != null) {
|
||||||
|
message.reverse = data.reverse;
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
toObject() {
|
||||||
|
const data: {
|
||||||
|
id?: string;
|
||||||
|
normal?: boolean;
|
||||||
|
reverse?: boolean;
|
||||||
|
} = {};
|
||||||
|
if (this.id != null) {
|
||||||
|
data.id = this.id;
|
||||||
|
}
|
||||||
|
if (this.normal != null) {
|
||||||
|
data.normal = this.normal;
|
||||||
|
}
|
||||||
|
if (this.reverse != null) {
|
||||||
|
data.reverse = this.reverse;
|
||||||
|
}
|
||||||
|
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.id.length)
|
||||||
|
writer.writeString(1, this.id);
|
||||||
|
if (this.normal != false)
|
||||||
|
writer.writeBool(2, this.normal);
|
||||||
|
if (this.reverse != false)
|
||||||
|
writer.writeBool(3, this.reverse);
|
||||||
|
if (!w)
|
||||||
|
return writer.getResultBuffer();
|
||||||
|
}
|
||||||
|
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SwitchState {
|
||||||
|
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SwitchState();
|
||||||
|
while (reader.nextField()) {
|
||||||
|
if (reader.isEndGroup())
|
||||||
|
break;
|
||||||
|
switch (reader.getFieldNumber()) {
|
||||||
|
case 1:
|
||||||
|
message.id = reader.readString();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
message.normal = reader.readBool();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
message.reverse = reader.readBool();
|
||||||
|
break;
|
||||||
|
default: reader.skipField();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
serializeBinary(): Uint8Array {
|
||||||
|
return this.serialize();
|
||||||
|
}
|
||||||
|
static deserializeBinary(bytes: Uint8Array): SwitchState {
|
||||||
|
return SwitchState.deserialize(bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class TrainState extends pb_1.Message {
|
||||||
|
#one_of_decls: number[][] = [];
|
||||||
|
constructor(data?: any[] | {
|
||||||
|
id?: string;
|
||||||
|
headLinkId?: string;
|
||||||
|
headLinkOffset?: number;
|
||||||
|
tailLinkId?: string;
|
||||||
|
tailLinkOffset?: number;
|
||||||
|
occupiedLinkId?: string[];
|
||||||
|
}) {
|
||||||
|
super();
|
||||||
|
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [6], this.#one_of_decls);
|
||||||
|
if (!Array.isArray(data) && typeof data == "object") {
|
||||||
|
if ("id" in data && data.id != undefined) {
|
||||||
|
this.id = data.id;
|
||||||
|
}
|
||||||
|
if ("headLinkId" in data && data.headLinkId != undefined) {
|
||||||
|
this.headLinkId = data.headLinkId;
|
||||||
|
}
|
||||||
|
if ("headLinkOffset" in data && data.headLinkOffset != undefined) {
|
||||||
|
this.headLinkOffset = data.headLinkOffset;
|
||||||
|
}
|
||||||
|
if ("tailLinkId" in data && data.tailLinkId != undefined) {
|
||||||
|
this.tailLinkId = data.tailLinkId;
|
||||||
|
}
|
||||||
|
if ("tailLinkOffset" in data && data.tailLinkOffset != undefined) {
|
||||||
|
this.tailLinkOffset = data.tailLinkOffset;
|
||||||
|
}
|
||||||
|
if ("occupiedLinkId" in data && data.occupiedLinkId != undefined) {
|
||||||
|
this.occupiedLinkId = data.occupiedLinkId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get id() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||||
|
}
|
||||||
|
set id(value: string) {
|
||||||
|
pb_1.Message.setField(this, 1, value);
|
||||||
|
}
|
||||||
|
get headLinkId() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||||
|
}
|
||||||
|
set headLinkId(value: string) {
|
||||||
|
pb_1.Message.setField(this, 2, value);
|
||||||
|
}
|
||||||
|
get headLinkOffset() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
|
||||||
|
}
|
||||||
|
set headLinkOffset(value: number) {
|
||||||
|
pb_1.Message.setField(this, 3, value);
|
||||||
|
}
|
||||||
|
get tailLinkId() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
|
||||||
|
}
|
||||||
|
set tailLinkId(value: string) {
|
||||||
|
pb_1.Message.setField(this, 4, value);
|
||||||
|
}
|
||||||
|
get tailLinkOffset() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
|
||||||
|
}
|
||||||
|
set tailLinkOffset(value: number) {
|
||||||
|
pb_1.Message.setField(this, 5, value);
|
||||||
|
}
|
||||||
|
get occupiedLinkId() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 6, []) as string[];
|
||||||
|
}
|
||||||
|
set occupiedLinkId(value: string[]) {
|
||||||
|
pb_1.Message.setField(this, 6, value);
|
||||||
|
}
|
||||||
|
static fromObject(data: {
|
||||||
|
id?: string;
|
||||||
|
headLinkId?: string;
|
||||||
|
headLinkOffset?: number;
|
||||||
|
tailLinkId?: string;
|
||||||
|
tailLinkOffset?: number;
|
||||||
|
occupiedLinkId?: string[];
|
||||||
|
}): TrainState {
|
||||||
|
const message = new TrainState({});
|
||||||
|
if (data.id != null) {
|
||||||
|
message.id = data.id;
|
||||||
|
}
|
||||||
|
if (data.headLinkId != null) {
|
||||||
|
message.headLinkId = data.headLinkId;
|
||||||
|
}
|
||||||
|
if (data.headLinkOffset != null) {
|
||||||
|
message.headLinkOffset = data.headLinkOffset;
|
||||||
|
}
|
||||||
|
if (data.tailLinkId != null) {
|
||||||
|
message.tailLinkId = data.tailLinkId;
|
||||||
|
}
|
||||||
|
if (data.tailLinkOffset != null) {
|
||||||
|
message.tailLinkOffset = data.tailLinkOffset;
|
||||||
|
}
|
||||||
|
if (data.occupiedLinkId != null) {
|
||||||
|
message.occupiedLinkId = data.occupiedLinkId;
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
toObject() {
|
||||||
|
const data: {
|
||||||
|
id?: string;
|
||||||
|
headLinkId?: string;
|
||||||
|
headLinkOffset?: number;
|
||||||
|
tailLinkId?: string;
|
||||||
|
tailLinkOffset?: number;
|
||||||
|
occupiedLinkId?: string[];
|
||||||
|
} = {};
|
||||||
|
if (this.id != null) {
|
||||||
|
data.id = this.id;
|
||||||
|
}
|
||||||
|
if (this.headLinkId != null) {
|
||||||
|
data.headLinkId = this.headLinkId;
|
||||||
|
}
|
||||||
|
if (this.headLinkOffset != null) {
|
||||||
|
data.headLinkOffset = this.headLinkOffset;
|
||||||
|
}
|
||||||
|
if (this.tailLinkId != null) {
|
||||||
|
data.tailLinkId = this.tailLinkId;
|
||||||
|
}
|
||||||
|
if (this.tailLinkOffset != null) {
|
||||||
|
data.tailLinkOffset = this.tailLinkOffset;
|
||||||
|
}
|
||||||
|
if (this.occupiedLinkId != null) {
|
||||||
|
data.occupiedLinkId = this.occupiedLinkId;
|
||||||
|
}
|
||||||
|
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.id.length)
|
||||||
|
writer.writeString(1, this.id);
|
||||||
|
if (this.headLinkId.length)
|
||||||
|
writer.writeString(2, this.headLinkId);
|
||||||
|
if (this.headLinkOffset != 0)
|
||||||
|
writer.writeInt64(3, this.headLinkOffset);
|
||||||
|
if (this.tailLinkId.length)
|
||||||
|
writer.writeString(4, this.tailLinkId);
|
||||||
|
if (this.tailLinkOffset != 0)
|
||||||
|
writer.writeInt64(5, this.tailLinkOffset);
|
||||||
|
if (this.occupiedLinkId.length)
|
||||||
|
writer.writeRepeatedString(6, this.occupiedLinkId);
|
||||||
|
if (!w)
|
||||||
|
return writer.getResultBuffer();
|
||||||
|
}
|
||||||
|
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TrainState {
|
||||||
|
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TrainState();
|
||||||
|
while (reader.nextField()) {
|
||||||
|
if (reader.isEndGroup())
|
||||||
|
break;
|
||||||
|
switch (reader.getFieldNumber()) {
|
||||||
|
case 1:
|
||||||
|
message.id = reader.readString();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
message.headLinkId = reader.readString();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
message.headLinkOffset = reader.readInt64();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
message.tailLinkId = reader.readString();
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
message.tailLinkOffset = reader.readInt64();
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
pb_1.Message.addToRepeatedField(message, 6, reader.readString());
|
||||||
|
break;
|
||||||
|
default: reader.skipField();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
serializeBinary(): Uint8Array {
|
||||||
|
return this.serialize();
|
||||||
|
}
|
||||||
|
static deserializeBinary(bytes: Uint8Array): TrainState {
|
||||||
|
return TrainState.deserialize(bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user