From 4f09b99366e257bd04c7ae0b901eea8cea8be2e6 Mon Sep 17 00:00:00 2001 From: fan Date: Mon, 9 Oct 2023 18:24:40 +0800 Subject: [PATCH] =?UTF-8?q?ibp=E8=AE=BE=E5=A4=87=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drawApp/graphics/ArrowInteraction.ts | 12 +- src/drawApp/graphics/IbpAlarmInteraction.ts | 10 +- src/drawApp/graphics/IbpKeyInteraction.ts | 10 +- src/drawApp/graphics/IbpTextInteraction.ts | 59 ++ src/drawApp/ibpDrawApp.ts | 39 ++ src/graphics/arrow/ArrowDrawAssistant.ts | 2 +- src/graphics/ibpKey/ibp-key-data.json | 4 +- src/layouts/IBPDrawLayout.vue | 14 +- src/protos/ibpGraphics.ts | 585 +++++++++++++++++++- 9 files changed, 697 insertions(+), 38 deletions(-) create mode 100644 src/drawApp/graphics/IbpTextInteraction.ts diff --git a/src/drawApp/graphics/ArrowInteraction.ts b/src/drawApp/graphics/ArrowInteraction.ts index 37a1f70..99d6248 100644 --- a/src/drawApp/graphics/ArrowInteraction.ts +++ b/src/drawApp/graphics/ArrowInteraction.ts @@ -1,24 +1,24 @@ import * as pb_1 from 'google-protobuf'; import { IArrowData, Arrow } from 'src/graphics/arrow/Arrow'; -import { pslGraphicData } from 'src/protos/pslGraphics'; +import { ibpGraphicData } from 'src/protos/ibpGraphics'; import { GraphicDataBase } from './GraphicDataBase'; import { IPointData } from 'pixi.js'; export class ArrowData extends GraphicDataBase implements IArrowData { - constructor(data?: pslGraphicData.PslKey) { + constructor(data?: ibpGraphicData.IbpArrow) { let arrow; if (data) { arrow = data; } else { - arrow = new pslGraphicData.PslKey({ + arrow = new ibpGraphicData.IbpArrow({ common: GraphicDataBase.defaultCommonInfo(Arrow.Type), }); } super(arrow); } - public get data(): pslGraphicData.PslKey { - return this.getData(); + public get data(): ibpGraphicData.IbpArrow { + return this.getData(); } get code(): string { @@ -32,7 +32,7 @@ export class ArrowData extends GraphicDataBase implements IArrowData { } set points(points: IPointData[]) { this.data.points = points.map( - (p) => new pslGraphicData.Point({ x: p.x, y: p.y }) + (p) => new ibpGraphicData.Point({ x: p.x, y: p.y }) ); } clone(): ArrowData { diff --git a/src/drawApp/graphics/IbpAlarmInteraction.ts b/src/drawApp/graphics/IbpAlarmInteraction.ts index e90336b..a8f6e95 100644 --- a/src/drawApp/graphics/IbpAlarmInteraction.ts +++ b/src/drawApp/graphics/IbpAlarmInteraction.ts @@ -1,23 +1,23 @@ import * as pb_1 from 'google-protobuf'; import { IIbpAlarmData, IbpAlarm } from 'src/graphics/ibpAlarm/IbpAlarm'; -import { pslGraphicData } from 'src/protos/pslGraphics'; +import { ibpGraphicData } from 'src/protos/ibpGraphics'; import { GraphicDataBase } from './GraphicDataBase'; export class IbpAlarmData extends GraphicDataBase implements IIbpAlarmData { - constructor(data?: pslGraphicData.PslKey) { + constructor(data?: ibpGraphicData.IbpAlarm) { let ibpAlram; if (data) { ibpAlram = data; } else { - ibpAlram = new pslGraphicData.PslKey({ + ibpAlram = new ibpGraphicData.IbpAlarm({ common: GraphicDataBase.defaultCommonInfo(IbpAlarm.Type), }); } super(ibpAlram); } - public get data(): pslGraphicData.PslKey { - return this.getData(); + public get data(): ibpGraphicData.IbpAlarm { + return this.getData(); } get code(): string { diff --git a/src/drawApp/graphics/IbpKeyInteraction.ts b/src/drawApp/graphics/IbpKeyInteraction.ts index b5392e0..3a581f6 100644 --- a/src/drawApp/graphics/IbpKeyInteraction.ts +++ b/src/drawApp/graphics/IbpKeyInteraction.ts @@ -1,23 +1,23 @@ import * as pb_1 from 'google-protobuf'; import { IIbpKeyData, IbpKey } from 'src/graphics/ibpKey/IbpKey'; -import { pslGraphicData } from 'src/protos/pslGraphics'; +import { ibpGraphicData } from 'src/protos/ibpGraphics'; import { GraphicDataBase } from './GraphicDataBase'; export class IbpKeyData extends GraphicDataBase implements IIbpKeyData { - constructor(data?: pslGraphicData.PslKey) { + constructor(data?: ibpGraphicData.IbpKey) { let ibpKey; if (data) { ibpKey = data; } else { - ibpKey = new pslGraphicData.PslKey({ + ibpKey = new ibpGraphicData.IbpKey({ common: GraphicDataBase.defaultCommonInfo(IbpKey.Type), }); } super(ibpKey); } - public get data(): pslGraphicData.PslKey { - return this.getData(); + public get data(): ibpGraphicData.IbpKey { + return this.getData(); } get code(): string { diff --git a/src/drawApp/graphics/IbpTextInteraction.ts b/src/drawApp/graphics/IbpTextInteraction.ts new file mode 100644 index 0000000..f993b9e --- /dev/null +++ b/src/drawApp/graphics/IbpTextInteraction.ts @@ -0,0 +1,59 @@ +import * as pb_1 from 'google-protobuf'; +import { + ITextContentData, + TextContent, +} from 'src/graphics/textContent/TextContent'; +import { ibpGraphicData } from 'src/protos/ibpGraphics'; +import { GraphicDataBase } from './GraphicDataBase'; + +export class IbpTextData extends GraphicDataBase implements ITextContentData { + constructor(data?: ibpGraphicData.IBPText) { + let pslText; + if (data) { + pslText = data; + } else { + pslText = new ibpGraphicData.IBPText({ + common: GraphicDataBase.defaultCommonInfo(TextContent.Type), + }); + } + super(pslText); + } + + public get data(): ibpGraphicData.IBPText { + return this.getData(); + } + + get code(): string { + return this.data.code; + } + set code(v: string) { + this.data.code = v; + } + get content(): string { + return this.data.content; + } + set content(v: string) { + this.data.content = v; + } + get color(): string { + return this.data.color; + } + set color(v: string) { + this.data.color = v; + } + get fontSize(): number { + return this.data.fontSize; + } + set fontSize(v: number) { + this.data.fontSize = v; + } + clone(): IbpTextData { + return new IbpTextData(this.data.cloneMessage()); + } + copyFrom(data: IbpTextData): void { + pb_1.Message.copyInto(data.data, this.data); + } + eq(other: IbpTextData): boolean { + return pb_1.Message.equals(this.data, other.data); + } +} diff --git a/src/drawApp/ibpDrawApp.ts b/src/drawApp/ibpDrawApp.ts index f046072..a66752e 100644 --- a/src/drawApp/ibpDrawApp.ts +++ b/src/drawApp/ibpDrawApp.ts @@ -12,7 +12,22 @@ import { IBPButtonTemplate, IIBPButtonData, } from 'src/graphics/IBPButton/IBPButton'; +import { IbpAlarm, IbpAlarmTemplate } from 'src/graphics/ibpAlarm/IbpAlarm'; +import { IbpKey, IbpKeyTemplate } from 'src/graphics/ibpKey/IbpKey'; +import { Arrow, ArrowTemplate } from 'src/graphics/arrow/Arrow'; import { IBPButtonDrawAssistant } from 'src/graphics/IBPButton/IBPButtonDrawAssistant'; +import { + TextContent, + TextContentTemplate, +} from 'src/graphics/textContent/TextContent'; +import { IbpAlarmDraw } from 'src/graphics/ibpAlarm/IbpAlarmDrawAssistant'; +import { IbpAlarmData } from './graphics/IbpAlarmInteraction'; +import { IbpKeyDraw } from 'src/graphics/ibpKey/IbpKeyDrawAssistant'; +import { IbpKeyData } from './graphics/IbpKeyInteraction'; +import { ArrowDraw } from 'src/graphics/arrow/ArrowDrawAssistant'; +import { ArrowData } from './graphics/ArrowInteraction'; +import { TextContentDraw } from 'src/graphics/textContent/TextContentDrawAssistant'; +import { IbpTextData } from './graphics/IbpTextInteraction'; let drawApp: IDrawApp | null = null; @@ -29,6 +44,10 @@ export function initIBPDrawApp() { drawApp, new IBPButtonTemplate(new IBPButtonData()) ); + new IbpAlarmDraw(drawApp, new IbpAlarmTemplate(new IbpAlarmData())); + new IbpKeyDraw(drawApp, new IbpKeyTemplate(new IbpKeyData())); + new ArrowDraw(drawApp, new ArrowTemplate(new ArrowData())); + new TextContentDraw(drawApp, new TextContentTemplate(new IbpTextData())); return drawApp; } @@ -61,6 +80,14 @@ function saveIBPDrawDatas(app: IDrawApp) { graphics.forEach((g) => { if (g instanceof IBPButton) { storage.ibpButtons.push(g.saveData().data); + } else if (g instanceof IbpAlarm) { + storage.ibpAlarms.push(g.saveData().data); + } else if (g instanceof IbpKey) { + storage.ibpKeys.push(g.saveData().data); + } else if (g instanceof Arrow) { + storage.ibpArrows.push(g.saveData().data); + } else if (g instanceof TextContent) { + storage.IBPTexts.push(g.saveData().data); } }); const base64 = fromUint8Array(storage.serialize()); @@ -82,6 +109,18 @@ async function IBPDrawDataLoader() { storage.ibpButtons.forEach((ibpButton) => { datas.push(new IBPButtonData(ibpButton)); }); + storage.ibpAlarms.forEach((ibpAlarm) => { + datas.push(new IbpAlarmData(ibpAlarm)); + }); + storage.ibpKeys.forEach((ibpKey) => { + datas.push(new IbpKeyData(ibpKey)); + }); + storage.ibpArrows.forEach((ibpArrow) => { + datas.push(new ArrowData(ibpArrow)); + }); + storage.IBPTexts.forEach((ibpText) => { + datas.push(new IbpTextData(ibpText)); + }); return { canvasProperty: storage.canvas, datas: datas, diff --git a/src/graphics/arrow/ArrowDrawAssistant.ts b/src/graphics/arrow/ArrowDrawAssistant.ts index b95b9c3..067de7d 100644 --- a/src/graphics/arrow/ArrowDrawAssistant.ts +++ b/src/graphics/arrow/ArrowDrawAssistant.ts @@ -46,7 +46,7 @@ export class ArrowDraw extends GraphicDrawAssistant { const p = new Point(x, y); this.points.push(p); if (this.points.length === 2) { - this.createAndStore; + this.createAndStore(true); } } diff --git a/src/graphics/ibpKey/ibp-key-data.json b/src/graphics/ibpKey/ibp-key-data.json index 4aeff53..9dd9c38 100644 --- a/src/graphics/ibpKey/ibp-key-data.json +++ b/src/graphics/ibpKey/ibp-key-data.json @@ -12,7 +12,7 @@ "frame": { "x": 378, "y": 0, "w": 377, "h": 1032 }, "rotated": false, "trimmed": false, - "spriteSourceSize": { "x": 378, "y": 0, "w": 377, "h": 1032 }, + "spriteSourceSize": { "x": 0, "y": 0, "w": 377, "h": 1032 }, "sourceSize": { "w": 377, "h": 1032 }, "anchor": { "x": 0.5, "y": 0.5 } } @@ -23,7 +23,7 @@ "image": "ibp-key.png", "format": "RGBA8888", "size": { "w": 755, "h": 1032 }, - "scale": "1", + "scale": "10", "smartupdate": "$TexturePacker:SmartUpdate:e7620bd2d73cc0b3e2deea9704e7eefc:f129a1d9e4b9ba57720b3861c22b155b:eb2d421f7759984b7713aa4aa5354134$" } } diff --git a/src/layouts/IBPDrawLayout.vue b/src/layouts/IBPDrawLayout.vue index 4ed2e19..46db9ed 100644 --- a/src/layouts/IBPDrawLayout.vue +++ b/src/layouts/IBPDrawLayout.vue @@ -3,6 +3,10 @@ import { onMounted, reactive, ref } from 'vue'; import { useIBPDrawStore } from '../stores/ibp-draw-store'; import { useRoute, useRouter } from 'vue-router'; import { IBPButton } from 'src/graphics/IBPButton/IBPButton'; +import { IbpAlarm } from 'src/graphics/ibpAlarm/IbpAlarm'; +import { IbpKey } from 'src/graphics/ibpKey/IbpKey'; +import { Arrow } from 'src/graphics/arrow/Arrow'; +import { TextContent } from 'src/graphics/textContent/TextContent'; import { getIBPDrawApp } from 'src/drawApp/ibpDrawApp'; import IbpDrawProperties from 'src/components/draw-app/IbpDrawProperties.vue'; @@ -64,7 +68,13 @@ onMounted(() => { } else { ibpDrawStore.setDraftId(null); } - const drawAssistantsTypes = [IBPButton.Type]; + const drawAssistantsTypes = [ + IBPButton.Type, + IbpAlarm.Type, + IbpKey.Type, + Arrow.Type, + TextContent.Type, + ]; drawAssistantsTypes.forEach((type) => { const drawAssistant = getIBPDrawApp()?.getDrawAssistant(type); if (drawAssistant) { @@ -89,8 +99,6 @@ function onResize() { canvasHeight.value = clientHeight - headerHeight.value; const dom = document.getElementById('draw-app-container'); // console.log(dom); - console.log(canvasWidth.value); - console.log(canvasHeight.value); if (dom) { dom.style.width = canvasWidth.value + 'px'; dom.style.height = canvasHeight.value + 'px'; diff --git a/src/protos/ibpGraphics.ts b/src/protos/ibpGraphics.ts index 049c065..bb762d4 100644 --- a/src/protos/ibpGraphics.ts +++ b/src/protos/ibpGraphics.ts @@ -11,9 +11,13 @@ export namespace ibpGraphicData { constructor(data?: any[] | { canvas?: dependency_1.graphicData.Canvas; ibpButtons?: IBPButton[]; + ibpAlarms?: IbpAlarm[]; + ibpKeys?: IbpKey[]; + ibpArrows?: IbpArrow[]; + IBPTexts?: IBPText[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("canvas" in data && data.canvas != undefined) { this.canvas = data.canvas; @@ -21,6 +25,18 @@ export namespace ibpGraphicData { if ("ibpButtons" in data && data.ibpButtons != undefined) { this.ibpButtons = data.ibpButtons; } + if ("ibpAlarms" in data && data.ibpAlarms != undefined) { + this.ibpAlarms = data.ibpAlarms; + } + if ("ibpKeys" in data && data.ibpKeys != undefined) { + this.ibpKeys = data.ibpKeys; + } + if ("ibpArrows" in data && data.ibpArrows != undefined) { + this.ibpArrows = data.ibpArrows; + } + if ("IBPTexts" in data && data.IBPTexts != undefined) { + this.IBPTexts = data.IBPTexts; + } } } get canvas() { @@ -38,9 +54,37 @@ export namespace ibpGraphicData { set ibpButtons(value: IBPButton[]) { pb_1.Message.setRepeatedWrapperField(this, 2, value); } + get ibpAlarms() { + return pb_1.Message.getRepeatedWrapperField(this, IbpAlarm, 3) as IbpAlarm[]; + } + set ibpAlarms(value: IbpAlarm[]) { + pb_1.Message.setRepeatedWrapperField(this, 3, value); + } + get ibpKeys() { + return pb_1.Message.getRepeatedWrapperField(this, IbpKey, 4) as IbpKey[]; + } + set ibpKeys(value: IbpKey[]) { + pb_1.Message.setRepeatedWrapperField(this, 4, value); + } + get ibpArrows() { + return pb_1.Message.getRepeatedWrapperField(this, IbpArrow, 5) as IbpArrow[]; + } + set ibpArrows(value: IbpArrow[]) { + pb_1.Message.setRepeatedWrapperField(this, 5, value); + } + get IBPTexts() { + return pb_1.Message.getRepeatedWrapperField(this, IBPText, 6) as IBPText[]; + } + set IBPTexts(value: IBPText[]) { + pb_1.Message.setRepeatedWrapperField(this, 6, value); + } static fromObject(data: { canvas?: ReturnType; ibpButtons?: ReturnType[]; + ibpAlarms?: ReturnType[]; + ibpKeys?: ReturnType[]; + ibpArrows?: ReturnType[]; + IBPTexts?: ReturnType[]; }): IBPGraphicStorage { const message = new IBPGraphicStorage({}); if (data.canvas != null) { @@ -49,12 +93,28 @@ export namespace ibpGraphicData { if (data.ibpButtons != null) { message.ibpButtons = data.ibpButtons.map(item => IBPButton.fromObject(item)); } + if (data.ibpAlarms != null) { + message.ibpAlarms = data.ibpAlarms.map(item => IbpAlarm.fromObject(item)); + } + if (data.ibpKeys != null) { + message.ibpKeys = data.ibpKeys.map(item => IbpKey.fromObject(item)); + } + if (data.ibpArrows != null) { + message.ibpArrows = data.ibpArrows.map(item => IbpArrow.fromObject(item)); + } + if (data.IBPTexts != null) { + message.IBPTexts = data.IBPTexts.map(item => IBPText.fromObject(item)); + } return message; } toObject() { const data: { canvas?: ReturnType; ibpButtons?: ReturnType[]; + ibpAlarms?: ReturnType[]; + ibpKeys?: ReturnType[]; + ibpArrows?: ReturnType[]; + IBPTexts?: ReturnType[]; } = {}; if (this.canvas != null) { data.canvas = this.canvas.toObject(); @@ -62,6 +122,18 @@ export namespace ibpGraphicData { if (this.ibpButtons != null) { data.ibpButtons = this.ibpButtons.map((item: IBPButton) => item.toObject()); } + if (this.ibpAlarms != null) { + data.ibpAlarms = this.ibpAlarms.map((item: IbpAlarm) => item.toObject()); + } + if (this.ibpKeys != null) { + data.ibpKeys = this.ibpKeys.map((item: IbpKey) => item.toObject()); + } + if (this.ibpArrows != null) { + data.ibpArrows = this.ibpArrows.map((item: IbpArrow) => item.toObject()); + } + if (this.IBPTexts != null) { + data.IBPTexts = this.IBPTexts.map((item: IBPText) => item.toObject()); + } return data; } serialize(): Uint8Array; @@ -72,6 +144,14 @@ export namespace ibpGraphicData { writer.writeMessage(1, this.canvas, () => this.canvas.serialize(writer)); if (this.ibpButtons.length) writer.writeRepeatedMessage(2, this.ibpButtons, (item: IBPButton) => item.serialize(writer)); + if (this.ibpAlarms.length) + writer.writeRepeatedMessage(3, this.ibpAlarms, (item: IbpAlarm) => item.serialize(writer)); + if (this.ibpKeys.length) + writer.writeRepeatedMessage(4, this.ibpKeys, (item: IbpKey) => item.serialize(writer)); + if (this.ibpArrows.length) + writer.writeRepeatedMessage(5, this.ibpArrows, (item: IbpArrow) => item.serialize(writer)); + if (this.IBPTexts.length) + writer.writeRepeatedMessage(6, this.IBPTexts, (item: IBPText) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -87,6 +167,18 @@ export namespace ibpGraphicData { case 2: reader.readMessage(message.ibpButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 2, IBPButton.deserialize(reader), IBPButton)); break; + case 3: + reader.readMessage(message.ibpAlarms, () => pb_1.Message.addToRepeatedWrapperField(message, 3, IbpAlarm.deserialize(reader), IbpAlarm)); + break; + case 4: + reader.readMessage(message.ibpKeys, () => pb_1.Message.addToRepeatedWrapperField(message, 4, IbpKey.deserialize(reader), IbpKey)); + break; + case 5: + reader.readMessage(message.ibpArrows, () => pb_1.Message.addToRepeatedWrapperField(message, 5, IbpArrow.deserialize(reader), IbpArrow)); + break; + case 6: + reader.readMessage(message.IBPTexts, () => pb_1.Message.addToRepeatedWrapperField(message, 6, IBPText.deserialize(reader), IBPText)); + break; default: reader.skipField(); } } @@ -251,7 +343,10 @@ export namespace ibpGraphicData { #one_of_decls: number[][] = []; constructor(data?: any[] | { common?: dependency_1.graphicData.CommonInfo; - size?: number; + code?: string; + content?: string; + color?: string; + fontSize?: number; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); @@ -259,8 +354,17 @@ export namespace ibpGraphicData { if ("common" in data && data.common != undefined) { this.common = data.common; } - if ("size" in data && data.size != undefined) { - this.size = data.size; + if ("code" in data && data.code != undefined) { + this.code = data.code; + } + if ("content" in data && data.content != undefined) { + this.content = data.content; + } + if ("color" in data && data.color != undefined) { + this.color = data.color; + } + if ("fontSize" in data && data.fontSize != undefined) { + this.fontSize = data.fontSize; } } } @@ -273,35 +377,77 @@ export namespace ibpGraphicData { get has_common() { return pb_1.Message.getField(this, 1) != null; } - get size() { - return pb_1.Message.getFieldWithDefault(this, 2, 0) as number; + get code() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; } - set size(value: number) { + set code(value: string) { pb_1.Message.setField(this, 2, value); } + get content() { + return pb_1.Message.getFieldWithDefault(this, 3, "") as string; + } + set content(value: string) { + pb_1.Message.setField(this, 3, value); + } + get color() { + return pb_1.Message.getFieldWithDefault(this, 4, "") as string; + } + set color(value: string) { + pb_1.Message.setField(this, 4, value); + } + get fontSize() { + return pb_1.Message.getFieldWithDefault(this, 5, 0) as number; + } + set fontSize(value: number) { + pb_1.Message.setField(this, 5, value); + } static fromObject(data: { common?: ReturnType; - size?: number; + code?: string; + content?: string; + color?: string; + fontSize?: number; }): IBPText { const message = new IBPText({}); if (data.common != null) { message.common = dependency_1.graphicData.CommonInfo.fromObject(data.common); } - if (data.size != null) { - message.size = data.size; + if (data.code != null) { + message.code = data.code; + } + if (data.content != null) { + message.content = data.content; + } + if (data.color != null) { + message.color = data.color; + } + if (data.fontSize != null) { + message.fontSize = data.fontSize; } return message; } toObject() { const data: { common?: ReturnType; - size?: number; + code?: string; + content?: string; + color?: string; + fontSize?: number; } = {}; if (this.common != null) { data.common = this.common.toObject(); } - if (this.size != null) { - data.size = this.size; + if (this.code != null) { + data.code = this.code; + } + if (this.content != null) { + data.content = this.content; + } + if (this.color != null) { + data.color = this.color; + } + if (this.fontSize != null) { + data.fontSize = this.fontSize; } return data; } @@ -311,8 +457,14 @@ export namespace ibpGraphicData { const writer = w || new pb_1.BinaryWriter(); if (this.has_common) writer.writeMessage(1, this.common, () => this.common.serialize(writer)); - if (this.size != 0) - writer.writeInt32(2, this.size); + if (this.code.length) + writer.writeString(2, this.code); + if (this.content.length) + writer.writeString(3, this.content); + if (this.color.length) + writer.writeString(4, this.color); + if (this.fontSize != 0) + writer.writeInt32(5, this.fontSize); if (!w) return writer.getResultBuffer(); } @@ -326,7 +478,16 @@ export namespace ibpGraphicData { reader.readMessage(message.common, () => message.common = dependency_1.graphicData.CommonInfo.deserialize(reader)); break; case 2: - message.size = reader.readInt32(); + message.code = reader.readString(); + break; + case 3: + message.content = reader.readString(); + break; + case 4: + message.color = reader.readString(); + break; + case 5: + message.fontSize = reader.readInt32(); break; default: reader.skipField(); } @@ -340,4 +501,396 @@ export namespace ibpGraphicData { return IBPText.deserialize(bytes); } } + export class IbpAlarm extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + common?: dependency_1.graphicData.CommonInfo; + code?: string; + }) { + 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; + } + } + } + get common() { + return pb_1.Message.getWrapperField(this, dependency_1.graphicData.CommonInfo, 1) as dependency_1.graphicData.CommonInfo; + } + set common(value: dependency_1.graphicData.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); + } + static fromObject(data: { + common?: ReturnType; + code?: string; + }): IbpAlarm { + const message = new IbpAlarm({}); + if (data.common != null) { + message.common = dependency_1.graphicData.CommonInfo.fromObject(data.common); + } + if (data.code != null) { + message.code = data.code; + } + return message; + } + toObject() { + const data: { + common?: ReturnType; + code?: string; + } = {}; + if (this.common != null) { + data.common = this.common.toObject(); + } + if (this.code != null) { + data.code = this.code; + } + 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 (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): IbpAlarm { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new IbpAlarm(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.common, () => message.common = dependency_1.graphicData.CommonInfo.deserialize(reader)); + break; + case 2: + message.code = reader.readString(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): IbpAlarm { + return IbpAlarm.deserialize(bytes); + } + } + export class IbpKey extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + common?: dependency_1.graphicData.CommonInfo; + code?: string; + }) { + 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; + } + } + } + get common() { + return pb_1.Message.getWrapperField(this, dependency_1.graphicData.CommonInfo, 1) as dependency_1.graphicData.CommonInfo; + } + set common(value: dependency_1.graphicData.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); + } + static fromObject(data: { + common?: ReturnType; + code?: string; + }): IbpKey { + const message = new IbpKey({}); + if (data.common != null) { + message.common = dependency_1.graphicData.CommonInfo.fromObject(data.common); + } + if (data.code != null) { + message.code = data.code; + } + return message; + } + toObject() { + const data: { + common?: ReturnType; + code?: string; + } = {}; + if (this.common != null) { + data.common = this.common.toObject(); + } + if (this.code != null) { + data.code = this.code; + } + 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 (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): IbpKey { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new IbpKey(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.common, () => message.common = dependency_1.graphicData.CommonInfo.deserialize(reader)); + break; + case 2: + message.code = reader.readString(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): IbpKey { + return IbpKey.deserialize(bytes); + } + } + export class Point extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + x?: number; + y?: 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 ("x" in data && data.x != undefined) { + this.x = data.x; + } + if ("y" in data && data.y != undefined) { + this.y = data.y; + } + } + } + get x() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; + } + set x(value: number) { + pb_1.Message.setField(this, 1, value); + } + get y() { + return pb_1.Message.getFieldWithDefault(this, 2, 0) as number; + } + set y(value: number) { + pb_1.Message.setField(this, 2, value); + } + static fromObject(data: { + x?: number; + y?: number; + }): Point { + const message = new Point({}); + if (data.x != null) { + message.x = data.x; + } + if (data.y != null) { + message.y = data.y; + } + return message; + } + toObject() { + const data: { + x?: number; + y?: number; + } = {}; + if (this.x != null) { + data.x = this.x; + } + if (this.y != null) { + data.y = this.y; + } + 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.x != 0) + writer.writeFloat(1, this.x); + if (this.y != 0) + writer.writeFloat(2, this.y); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Point { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Point(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.x = reader.readFloat(); + break; + case 2: + message.y = reader.readFloat(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): Point { + return Point.deserialize(bytes); + } + } + export class IbpArrow extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + common?: dependency_1.graphicData.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, dependency_1.graphicData.CommonInfo, 1) as dependency_1.graphicData.CommonInfo; + } + set common(value: dependency_1.graphicData.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[]; + }): IbpArrow { + const message = new IbpArrow({}); + if (data.common != null) { + message.common = dependency_1.graphicData.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): IbpArrow { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new IbpArrow(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.common, () => message.common = dependency_1.graphicData.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): IbpArrow { + return IbpArrow.deserialize(bytes); + } + } }