diff --git a/src/components/draw-app/DrawProperties.vue b/src/components/draw-app/DrawProperties.vue index 96b1ec7..b1b628b 100644 --- a/src/components/draw-app/DrawProperties.vue +++ b/src/components/draw-app/DrawProperties.vue @@ -81,6 +81,9 @@ + @@ -116,6 +119,7 @@ import SignalProperty from './properties/SignalProperty.vue'; import TurnoutProperty from './properties/TurnoutProperty.vue'; import SectionProperty from './properties/SectionProperty.vue'; import SeparatorProperty from './properties/SeparatorProperty.vue'; +import TransponderProperty from './properties/TransponderProperty.vue'; import SectionLinkProperty from './properties/SectionLinkProperty.vue'; import { Platform } from 'src/graphics/platform/Platform'; import { Station } from 'src/graphics/station/Station'; @@ -129,6 +133,7 @@ import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting'; import { AxleCountingSection } from 'src/graphics/axleCountingSection/AxleCountingSection'; import { LogicSection } from 'src/graphics/logicSection/LogicSection'; import { Separator } from 'src/graphics/separator/Separator'; +import { Transponder } from 'src/graphics/transponder/Transponder'; import { SectionLink } from 'src/graphics/sectionLink/SectionLink'; import StopPositionProperty from './properties/StopPositionProperty.vue'; import { StopPosition } from 'src/graphics/stopPosition/StopPosition'; diff --git a/src/components/draw-app/properties/PlatformProperty.vue b/src/components/draw-app/properties/PlatformProperty.vue index 7f672db..51cf877 100644 --- a/src/components/draw-app/properties/PlatformProperty.vue +++ b/src/components/draw-app/properties/PlatformProperty.vue @@ -1,5 +1,5 @@ + + diff --git a/src/drawApp/graphics/TransponderInteraction.ts b/src/drawApp/graphics/TransponderInteraction.ts new file mode 100644 index 0000000..6a7763b --- /dev/null +++ b/src/drawApp/graphics/TransponderInteraction.ts @@ -0,0 +1,55 @@ +import * as pb_1 from 'google-protobuf'; +import { + ITransponderData, + Transponder, +} from 'src/graphics/transponder/Transponder'; +import { graphicData } from 'src/protos/stationLayoutGraphics'; +import { GraphicDataBase } from './GraphicDataBase'; + +export class TransponderData + extends GraphicDataBase + implements ITransponderData +{ + constructor(data?: graphicData.Transponder) { + let transponder; + if (!data) { + transponder = new graphicData.Transponder({ + common: GraphicDataBase.defaultCommonInfo(Transponder.Type), + }); + } else { + transponder = data; + } + super(transponder); + } + + public get data(): graphicData.Transponder { + return this.getData(); + } + get code(): string { + return this.data.code; + } + set code(v: string) { + this.data.code = v; + } + get transponderType(): number { + return this.data.transponderType; + } + set transponderType(v: number) { + this.data.transponderType = v; + } + get index(): number { + return this.data.index; + } + set index(v: number) { + this.data.index = v; + } + clone(): TransponderData { + return new TransponderData(this.data.cloneMessage()); + } + copyFrom(data: TransponderData): void { + pb_1.Message.copyInto(data.data, this.data); + } + eq(other: TransponderData): boolean { + return pb_1.Message.equals(this.data, other.data); + } +} diff --git a/src/drawApp/index.ts b/src/drawApp/index.ts index 14f5799..d84d487 100644 --- a/src/drawApp/index.ts +++ b/src/drawApp/index.ts @@ -105,6 +105,12 @@ import { checkMapData } from 'src/api/Simulation'; import { SpksSwitchDraw } from 'src/graphics/spksSwitch/SpksSwitchDrawAssistant'; import { GatedBoxDraw } from 'src/graphics/gatedBox/GatedBoxDrawAssistant'; import { EsbButtonDraw } from 'src/graphics/esbButton/EsbButtonDrawAssistant'; +import { TransponderDraw } from 'src/graphics/transponder/TransponderDrawAssistant'; +import { + Transponder, + TransponderTemplate, +} from 'src/graphics/transponder/Transponder'; +import { TransponderData } from './graphics/TransponderInteraction'; // export function fromStoragePoint(p: graphicData.Point): Point { // return new Point(p.x, p.y); @@ -241,6 +247,7 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp { | SpksSwitchDraw | GatedBoxDraw | EsbButtonDraw + | TransponderDraw )[] = []; if (draftType === 'Line') { drawAssistants = [ @@ -278,6 +285,7 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp { app, new LogicSectionTemplate(new LogicSectionData()) ), + new TransponderDraw(app, new TransponderTemplate(new TransponderData())), new StopPositionDraw( app, new StopPositionTemplate(new StopPositionData()) @@ -494,6 +502,9 @@ export function saveDrawDatas(app: JlDrawApp) { } else if (EsbButton.Type === g.type) { const esbButtonData = (g as EsbButton).saveData(); storage.esbButtons.push((esbButtonData as EsbButtonData).data); + } else if (Transponder.Type === g.type) { + const transponderData = (g as Transponder).saveData(); + storage.transponders.push((transponderData as TransponderData).data); } }); const base64 = fromUint8Array(storage.serialize()); @@ -574,6 +585,9 @@ export async function loadDrawDatas(app: GraphicApp) { storage.esbButtons.forEach((esbButton) => { datas.push(new EsbButtonData(esbButton)); }); + storage.transponders.forEach((transponder) => { + datas.push(new TransponderData(transponder)); + }); await app.loadGraphic(datas); } else { app.loadGraphic([]); diff --git a/src/graphics/platform/Platform.ts b/src/graphics/platform/Platform.ts index 1a6dedc..22d3fd5 100644 --- a/src/graphics/platform/Platform.ts +++ b/src/graphics/platform/Platform.ts @@ -85,9 +85,10 @@ const platformConsts = { lineWidth: 3, besideFontSize: 12, doorOpenSpacing: 15, - doorPlatformSpacing: 10, + doorPlatformSpacing: 17, besideSpacing: 10, circleRadius: 9, + smallDoorWidth: 10, }; //子元素--矩形 @@ -126,45 +127,58 @@ export class rectGraphic extends Container { } } //子元素--门 -export class doorGraphic extends Container { - static Type = 'Door'; - doorGraphic: Graphics; - doorCloseGraphic: Graphics; +class smallDoorGraphic extends Container { + smallDoorGraphic: Graphics; + labelGraphic: VectorText; constructor() { super(); - this.doorGraphic = new Graphics(); - this.doorCloseGraphic = new Graphics(); - this.addChild(this.doorGraphic); - this.addChild(this.doorCloseGraphic); + this.smallDoorGraphic = new Graphics(); + this.labelGraphic = new VectorText(); + this.labelGraphic.setVectorFontSize(12); + this.labelGraphic.anchor.set(0.5); + this.addChild(this.smallDoorGraphic); + this.addChild(this.labelGraphic); } - draw(stateData: IPlatformState): void { - const doorGraphic = this.doorGraphic; - const doorCloseGraphic = this.doorCloseGraphic; - doorGraphic.clear(); - doorCloseGraphic.clear(); + draw(direction: string, stateData: IPlatformState, i): void { + const start = + -platformConsts.smallDoorWidth * 15 + platformConsts.smallDoorWidth * i; + const smallDoorGraphic = this.smallDoorGraphic; const lineColor = PlatformColorEnum.doorGreen; // if (stateData.psdCut) { // lineColor = PlatformColorEnum.doorRed; // } - doorGraphic.lineStyle(platformConsts.lineWidth, new Color(lineColor)); - doorGraphic.moveTo( - -platformConsts.width / 2 - platformConsts.lineWidth / 2, - 0 - ); - doorGraphic.lineTo(-platformConsts.doorOpenSpacing, 0); - doorGraphic.moveTo(platformConsts.doorOpenSpacing, 0); - doorGraphic.lineTo( - platformConsts.width / 2 + platformConsts.lineWidth / 2, - 0 - ); - //屏蔽门闭合 - doorCloseGraphic.lineStyle(platformConsts.lineWidth, new Color(lineColor)); - doorCloseGraphic.moveTo(-platformConsts.doorOpenSpacing, 0); - doorCloseGraphic.lineTo(platformConsts.doorOpenSpacing, 0); + smallDoorGraphic.lineStyle(platformConsts.lineWidth, new Color(lineColor)); + smallDoorGraphic.moveTo(start, 0); + smallDoorGraphic.lineTo(start + platformConsts.smallDoorWidth - 3, 0); + if (direction == 'down') { + this.labelGraphic.text = 30 - i; + } else { + this.labelGraphic.text = i + 1; + } + this.labelGraphic.style.fill = 'red'; + if (i % 2 == 0) { + this.labelGraphic.position.set(start + 4, 7); + } else { + this.labelGraphic.position.set(start + 4, -7); + } + } +} +export class doorGraphic extends Container { + constructor() { + super(); + } + draw(direction: string, stateData: IPlatformState): void { + for (let i = 0; i < 30; i++) { + const smallDoor = new smallDoorGraphic(); + smallDoor.draw(direction, stateData, i); + this.addChild(smallDoor); + } } clear(): void { - this.doorGraphic.clear(); - this.doorCloseGraphic.clear(); + this.children.forEach((smallDoorGraphic) => { + smallDoorGraphic.children[0].clear(); + smallDoorGraphic.children[1].text = ''; + }); } // changeState(stateData: IPlatformState): void { // // if (stateData.psdOpen) { @@ -409,7 +423,7 @@ export class Platform extends JlGraphic { doRepaint(): void { this.doorGraphic.clear(); if (this.datas.hasdoor) { - this.doorGraphic.draw(this.states); + this.doorGraphic.draw(this.datas.direction, this.states); } this.platformGraphic.draw(this.states); this.emergClose.draw(); diff --git a/src/graphics/transponder/Transponder.ts b/src/graphics/transponder/Transponder.ts new file mode 100644 index 0000000..57d54dc --- /dev/null +++ b/src/graphics/transponder/Transponder.ts @@ -0,0 +1,164 @@ +import { Container, Graphics } from 'pixi.js'; +import { + GraphicData, + JlGraphic, + JlGraphicTemplate, + VectorText, +} from 'src/jl-graphic'; + +export interface ITransponderData extends GraphicData { + get code(): string; // 编号 + set code(v: string); + get transponderType(): number; // 类型 + set transponderType(v: number); + get index(): number; // 索引 + set index(v: number); + clone(): ITransponderData; + copyFrom(data: ITransponderData): void; + eq(other: ITransponderData): boolean; +} + +export enum transponderTypeEnum { + FB, // 固定应答器 + WB, // 轮径校正应答器 + DB, // 休眠唤醒应答器 +} + +export const TransponderConsts = { + height: 12, + lineWidth: 2, + lineColor: '0xFFFFFF', + wblineColor: '0xFF0000', + textFontSize: 12, + textMarginY: 5, // 名称与应答器的距离 +}; +export const transponderTypePoints = { + [transponderTypeEnum[transponderTypeEnum.FB]]: [ + [-TransponderConsts.height / 2, -TransponderConsts.height / 2], + [TransponderConsts.height / 2, -TransponderConsts.height / 2], + [TransponderConsts.height / 2, TransponderConsts.height / 2], + [-TransponderConsts.height / 2, TransponderConsts.height / 2], + [ + -TransponderConsts.height / 2, + -TransponderConsts.height / 2 - TransponderConsts.lineWidth / 2, + ], + [-TransponderConsts.height / 2, -TransponderConsts.height / 2], + [TransponderConsts.height / 2, TransponderConsts.height / 2], + [TransponderConsts.height / 2, -TransponderConsts.height / 2], + [-TransponderConsts.height / 2, TransponderConsts.height / 2], + ], + [transponderTypeEnum[transponderTypeEnum.WB]]: [ + [-TransponderConsts.height / 2, -TransponderConsts.height / 2], + [TransponderConsts.height / 2, -TransponderConsts.height / 2], + [TransponderConsts.height / 2, TransponderConsts.height / 2], + [-TransponderConsts.height / 2, TransponderConsts.height / 2], + [ + -TransponderConsts.height / 2, + -TransponderConsts.height / 2 - TransponderConsts.lineWidth / 2, + ], + [0, -TransponderConsts.height / 2], + [0, TransponderConsts.height / 2], + [TransponderConsts.height / 2, 0], + [-TransponderConsts.height / 2, 0], + ], + [transponderTypeEnum[transponderTypeEnum.DB]]: [ + [-TransponderConsts.height, -TransponderConsts.height / 2], + [TransponderConsts.height, -TransponderConsts.height / 2], + [TransponderConsts.height, TransponderConsts.height / 2], + [-TransponderConsts.height, TransponderConsts.height / 2], + [ + -TransponderConsts.height, + -TransponderConsts.height / 2 - TransponderConsts.lineWidth / 2, + ], + [-TransponderConsts.height, -TransponderConsts.height / 2], + [TransponderConsts.height, TransponderConsts.height / 2], + [TransponderConsts.height, -TransponderConsts.height / 2], + [-TransponderConsts.height, TransponderConsts.height / 2], + ], +}; + +export class TransponderCode extends Container { + codeText: VectorText = new VectorText(''); + name = 'transponderCode'; + constructor() { + super(); + this.addChild(this.codeText); + } + clear() { + this.codeText.text = ''; + } + paint(datas: ITransponderData) { + this.codeText.text = datas.code; + this.codeText.anchor.set(0.5); + } +} + +export class Transponder extends JlGraphic { + static Type = 'Transponder'; + polygonGraphic: Graphics = new Graphics(); + labelGraphic: TransponderCode = new TransponderCode(); + constructor() { + super(Transponder.Type); + this.addChild(this.polygonGraphic); + this.addChild(this.labelGraphic); + } + get datas(): ITransponderData { + return this.getDatas(); + } + clear() { + this.polygonGraphic.clear(); + this.labelGraphic.clear(); + } + doRepaint(): void { + this.clear(); + const polygonGraphic = this.polygonGraphic; + const type = transponderTypeEnum[this.datas.transponderType]; + const ps = transponderTypePoints[type]; + const lineColor = + type == 'WB' + ? TransponderConsts.wblineColor + : TransponderConsts.lineColor; + polygonGraphic.lineStyle(TransponderConsts.lineWidth, lineColor); + const indexArr = [0, 5, 7]; + ps.forEach((item, index) => { + if (indexArr.includes(index)) { + polygonGraphic.moveTo(item[0], item[1]); + } else { + polygonGraphic.lineTo(item[0], item[1]); + } + }); + this.labelGraphic.paint(this.datas); + const style = { + fill: lineColor, + fontSize: TransponderConsts.textFontSize, + }; + this.labelGraphic.codeText.style = style; + const codeTransform = this.datas?.childTransforms?.find( + (item) => item.name === 'transponderCode' + ); + if (codeTransform) { + const position = codeTransform?.transform.position; + const rotation = codeTransform?.transform?.rotation; + this.labelGraphic.position.set(position?.x, position?.y); + this.labelGraphic.rotation = rotation || 0; + } else { + const { height: polygonHeight } = this.polygonGraphic.getLocalBounds(); + const { height: textHeight } = this.labelGraphic.getLocalBounds(); + this.labelGraphic.position.set( + 0, + polygonHeight / 2 + textHeight / 2 + TransponderConsts.textMarginY + ); + } + } +} + +export class TransponderTemplate extends JlGraphicTemplate { + constructor(dataTemplate: ITransponderData) { + super(Transponder.Type, { + dataTemplate, + }); + } + new(): Transponder { + return new Transponder(); + } +} diff --git a/src/graphics/transponder/TransponderDrawAssistant.ts b/src/graphics/transponder/TransponderDrawAssistant.ts new file mode 100644 index 0000000..07ce9ab --- /dev/null +++ b/src/graphics/transponder/TransponderDrawAssistant.ts @@ -0,0 +1,187 @@ +import { DisplayObject, FederatedPointerEvent, IHitArea, Point } from 'pixi.js'; +import { + AbsorbableLine, + AbsorbablePosition, + GraphicDrawAssistant, + GraphicInteractionPlugin, + GraphicTransformEvent, + JlDrawApp, + JlGraphic, + linePoint, +} from 'src/jl-graphic'; +import { + ITransponderData, + Transponder, + TransponderConsts, + TransponderTemplate, + transponderTypeEnum, + transponderTypePoints, +} from './Transponder'; + +export class TransponderDraw extends GraphicDrawAssistant< + TransponderTemplate, + ITransponderData +> { + TransponderGraph: Transponder; + constructor(app: JlDrawApp, template: TransponderTemplate) { + super(app, template, 'border_all', '应答器Transponder'); + this.TransponderGraph = this.graphicTemplate.new(); + this.container.addChild(this.TransponderGraph); + TransponderInteraction.init(app); + } + + bind(): void { + super.bind(); + this.TransponderGraph.loadData(this.graphicTemplate.datas); + this.TransponderGraph.doRepaint(); + } + + onLeftDown(e: FederatedPointerEvent): void { + this.container.position.copyFrom(this.toCanvasCoordinates(e.global)); + this.createAndStore(true); + } + + redraw(p: Point): void { + this.container.position.copyFrom(p); + } + + prepareData(data: ITransponderData): boolean { + data.transform = this.container.saveTransform(); + return true; + } +} + +//碰撞检测 +export class TransponderGraphicHitArea implements IHitArea { + transponder: Transponder; + constructor(transponder: Transponder) { + this.transponder = transponder; + } + contains(x: number, y: number): boolean { + let contains = false; + const p = new Point(x, y); + const type = transponderTypeEnum[this.transponder.datas.transponderType]; + const ps = transponderTypePoints[type]; + const tolerance = TransponderConsts.lineWidth; + const indexArr = [0, 5, 7]; + ps.forEach((item, index) => { + if (!indexArr.includes(index)) { + const p1 = new Point(ps[index - 1][0], ps[index - 1][1]); + const p2 = new Point(item[0], item[1]); + contains = contains || linePoint(p1, p2, p, tolerance); + } + }); + return contains; + } +} + +export class TransponderInteraction extends GraphicInteractionPlugin { + static Name = 'Transponder_transform'; + constructor(app: JlDrawApp) { + super(TransponderInteraction.Name, app); + } + static init(app: JlDrawApp) { + return new TransponderInteraction(app); + } + filter(...grahpics: JlGraphic[]): Transponder[] | undefined { + return grahpics + .filter((g) => g.type === Transponder.Type) + .map((g) => g as Transponder); + } + bind(g: Transponder): void { + g.polygonGraphic.eventMode = 'static'; + g.polygonGraphic.cursor = 'pointer'; + g.polygonGraphic.scalable = true; + g.polygonGraphic.hitArea = new TransponderGraphicHitArea(g); + g.on('transformstart', this.transformstart, this); + g.labelGraphic.on('transformstart', this.codetransformstart, this); + g.labelGraphic.draggable = true; + g.labelGraphic.selectable = true; + g.labelGraphic.rotatable = true; + g.labelGraphic.transformSave = true; + g.labelGraphic.eventMode = 'static'; + } + unbind(g: Transponder): void { + g.polygonGraphic.eventMode = 'none'; + g.polygonGraphic.scalable = false; + g.polygonGraphic.rotatable = false; + g.off('transformstart', this.transformstart, this); + g.labelGraphic.off('transformstart', this.codetransformstart, this); + g.labelGraphic.draggable = false; + g.labelGraphic.selectable = false; + g.labelGraphic.rotatable = false; + g.labelGraphic.transformSave = false; + g.labelGraphic.eventMode = 'none'; + } + transformstart(e: GraphicTransformEvent) { + const target = e.target as DisplayObject; + const transponder = target.getGraphic() as Transponder; + transponder.getGraphicApp().setOptions({ + absorbablePositions: buildAbsorbablePositions(transponder), + }); + } + codetransformstart(e: GraphicTransformEvent) { + const target = e.target as DisplayObject; + const transponder = target.getGraphic() as Transponder; + transponder.getGraphicApp().setOptions({ + absorbablePositions: buildCodeAbsorbablePositions(transponder), + }); + } +} + +/** + * 构建吸附线 + * @param transponder + */ +function buildAbsorbablePositions( + transponder: Transponder +): AbsorbablePosition[] { + const aps: AbsorbablePosition[] = []; + const transponders = transponder.queryStore.queryByType( + Transponder.Type + ); + const canvas = transponder.getCanvas(); + transponders.forEach((item) => { + if (item.id === transponder.id) { + return; + } + const ala = new AbsorbableLine( + new Point(item.x, 0), + new Point(item.x, canvas.height) + ); + const alb = new AbsorbableLine( + new Point(0, item.y), + new Point(canvas.width, item.y) + ); + aps.push(ala); + aps.push(alb); + }); + return aps; +} + +/** + * 名称构建吸附线 + * @param transponder + */ +function buildCodeAbsorbablePositions( + transponder: Transponder +): AbsorbablePosition[] { + const aps: AbsorbablePosition[] = []; + const transponders = transponder.queryStore.queryByType( + Transponder.Type + ); + const canvas = transponder.getCanvas(); + transponders.forEach((item) => { + const ala = new AbsorbableLine( + new Point(item.x, 0), + new Point(item.x, canvas.height) + ); + const alb = new AbsorbableLine( + new Point(0, item.y), + new Point(canvas.width, item.y) + ); + aps.push(ala); + aps.push(alb); + }); + return aps; +} diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts index 4c97b26..31725bf 100644 --- a/src/protos/stationLayoutGraphics.ts +++ b/src/protos/stationLayoutGraphics.ts @@ -24,9 +24,10 @@ export namespace graphicData { spksSwitchs?: SpksSwitch[]; esbButtons?: EsbButton[]; gateBoxs?: GatedBox[]; + transponders?: Transponder[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("canvas" in data && data.canvas != undefined) { this.canvas = data.canvas; @@ -76,6 +77,9 @@ export namespace graphicData { if ("gateBoxs" in data && data.gateBoxs != undefined) { this.gateBoxs = data.gateBoxs; } + if ("transponders" in data && data.transponders != undefined) { + this.transponders = data.transponders; + } } } get canvas() { @@ -177,6 +181,12 @@ export namespace graphicData { set gateBoxs(value: GatedBox[]) { pb_1.Message.setRepeatedWrapperField(this, 21, value); } + get transponders() { + return pb_1.Message.getRepeatedWrapperField(this, Transponder, 22) as Transponder[]; + } + set transponders(value: Transponder[]) { + pb_1.Message.setRepeatedWrapperField(this, 22, value); + } static fromObject(data: { canvas?: ReturnType; Platforms?: ReturnType[]; @@ -194,6 +204,7 @@ export namespace graphicData { spksSwitchs?: ReturnType[]; esbButtons?: ReturnType[]; gateBoxs?: ReturnType[]; + transponders?: ReturnType[]; }): RtssGraphicStorage { const message = new RtssGraphicStorage({}); if (data.canvas != null) { @@ -244,6 +255,9 @@ export namespace graphicData { if (data.gateBoxs != null) { message.gateBoxs = data.gateBoxs.map(item => GatedBox.fromObject(item)); } + if (data.transponders != null) { + message.transponders = data.transponders.map(item => Transponder.fromObject(item)); + } return message; } toObject() { @@ -264,6 +278,7 @@ export namespace graphicData { spksSwitchs?: ReturnType[]; esbButtons?: ReturnType[]; gateBoxs?: ReturnType[]; + transponders?: ReturnType[]; } = {}; if (this.canvas != null) { data.canvas = this.canvas.toObject(); @@ -313,6 +328,9 @@ export namespace graphicData { if (this.gateBoxs != null) { data.gateBoxs = this.gateBoxs.map((item: GatedBox) => item.toObject()); } + if (this.transponders != null) { + data.transponders = this.transponders.map((item: Transponder) => item.toObject()); + } return data; } serialize(): Uint8Array; @@ -351,6 +369,8 @@ export namespace graphicData { writer.writeRepeatedMessage(20, this.esbButtons, (item: EsbButton) => item.serialize(writer)); if (this.gateBoxs.length) writer.writeRepeatedMessage(21, this.gateBoxs, (item: GatedBox) => item.serialize(writer)); + if (this.transponders.length) + writer.writeRepeatedMessage(22, this.transponders, (item: Transponder) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -408,6 +428,9 @@ export namespace graphicData { case 21: reader.readMessage(message.gateBoxs, () => pb_1.Message.addToRepeatedWrapperField(message, 21, GatedBox.deserialize(reader), GatedBox)); break; + case 22: + reader.readMessage(message.transponders, () => pb_1.Message.addToRepeatedWrapperField(message, 22, Transponder.deserialize(reader), Transponder)); + break; default: reader.skipField(); } } @@ -2774,6 +2797,145 @@ export namespace graphicData { return Separator.deserialize(bytes); } } + export class Transponder extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + common?: CommonInfo; + code?: string; + transponderType?: number; + index?: number; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], 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 ("transponderType" in data && data.transponderType != undefined) { + this.transponderType = data.transponderType; + } + if ("index" in data && data.index != undefined) { + this.index = data.index; + } + } + } + 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 transponderType() { + return pb_1.Message.getFieldWithDefault(this, 3, 0) as number; + } + set transponderType(value: number) { + pb_1.Message.setField(this, 3, value); + } + get index() { + return pb_1.Message.getFieldWithDefault(this, 4, 0) as number; + } + set index(value: number) { + pb_1.Message.setField(this, 4, value); + } + static fromObject(data: { + common?: ReturnType; + code?: string; + transponderType?: number; + index?: number; + }): Transponder { + const message = new Transponder({}); + if (data.common != null) { + message.common = CommonInfo.fromObject(data.common); + } + if (data.code != null) { + message.code = data.code; + } + if (data.transponderType != null) { + message.transponderType = data.transponderType; + } + if (data.index != null) { + message.index = data.index; + } + return message; + } + toObject() { + const data: { + common?: ReturnType; + code?: string; + transponderType?: number; + index?: number; + } = {}; + if (this.common != null) { + data.common = this.common.toObject(); + } + if (this.code != null) { + data.code = this.code; + } + if (this.transponderType != null) { + data.transponderType = this.transponderType; + } + if (this.index != null) { + data.index = this.index; + } + 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.transponderType != 0) + writer.writeInt32(3, this.transponderType); + if (this.index != 0) + writer.writeInt32(4, this.index); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Transponder { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Transponder(); + 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: + message.transponderType = reader.readInt32(); + break; + case 4: + message.index = reader.readInt32(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): Transponder { + return Transponder.deserialize(bytes); + } + } export class SimpleRef extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | {